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

  • Yes, this is also my assumption. To clarify this, I will get in contact to our external partner. Thanks for support!

  • I use lightblue for all primary testing, it basically just works (although the OSX one is a bit weaker).

    Know nothing about Xamarin but the procedure on iOS is

    1. discover peripherals with advertised services
    2. connect to a peripheral you think might be useful
    3. after connection discover all or just a subset of services
    4. after services are discovered you can discover characteristics of that service

    Then you can use the service. Sounds like windows 8 and android aggressively connect to everything and find all services instead of the iOS approach which has you determine what you want to connect to.

Related