This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Only first BLE service discoverable on iOS

Hello

I have got a working BLE application on a nRF51822 with the S120 as peripheral. In my application I added 3 user defined services to the softdevice. On Windows8 and Android I`m able to read/write all of these services. But on iOS I can only read/write the first service. It looks like only the first service is discovered by iOS. Is this because of the limited advertising package? In my advertising package I only add the first service. If so, why does it work on Android and iOS? How can I solve this problem?

For addition, here is my advertising_init function:

static uint32_t advertising_init(void){
uint32_t      err_code;
ble_advdata_t advdata;
	ble_advdata_t scanrsp;
	
	ble_uuid_t adv_uuids[] = {{BLE_UUID_DEVICE_SERVICE, GRL_DEV_SERVICE_UUID_TYPE}};

// Build and set advertising data.
memset(&advdata, 0, sizeof(advdata));
advdata.name_type             = BLE_ADVDATA_FULL_NAME;
	advdata.include_appearance      = true;
advdata.flags                 = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
	
	memset(&scanrsp, 0, sizeof(scanrsp));
scanrsp.uuids_complete.uuid_cnt = sizeof(adv_uuids) / sizeof(adv_uuids[0]);
scanrsp.uuids_complete.p_uuids  = adv_uuids;
	
	ble_adv_modes_config_t options = {0};
options.ble_adv_fast_enabled  = BLE_ADV_FAST_ENABLED;
options.ble_adv_fast_interval = APP_ADV_INTERVAL;
options.ble_adv_fast_timeout  = APP_ADV_TIMEOUT_IN_SECONDS;

err_code = ble_advertising_init(&advdata, &scanrsp, &options, on_adv_evt, NULL);
APP_ERROR_CHECK(err_code);
	return err_code;}

Regards, BTprogrammer

Parents
  • On the start screen, Lightblue will show the service UUID that included inside the advertising packet. In you code, I can see only GRL_DEV_SERVICE_UUID_TYPE included.

    A central device would not be able to know what inside the attribute table without performing a service discovery after the connection is established.

    I suspect that your application only look for the Service that it finds in the advertising packet, no service discovery was performed.

Reply
  • On the start screen, Lightblue will show the service UUID that included inside the advertising packet. In you code, I can see only GRL_DEV_SERVICE_UUID_TYPE included.

    A central device would not be able to know what inside the attribute table without performing a service discovery after the connection is established.

    I suspect that your application only look for the Service that it finds in the advertising packet, no service discovery was performed.

Children
No Data
Related