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

Change Device name from iOS not workin

Hi there,

I have the following settings:

- nrf52810 on a custom board

- only the mandatory GAP service and one custom service with three characteristics, everything is working perfectly so far.

- we are developing our own iOS app for controlling the embedded device.

- the BLE devices and iOS are bonding with a six digit passphase, nothing special and everything is working good.

But:

I can't change the device name from within the iOS bluetooth system dialog. When the app is running, the device is connected, I can see the bonded device name in the list of known devices and when I tap the information button the only thing iOS is offering is to ignore the device / delete the bonding information.

I googled a whole day and I found the following information:

1. iOS uses the advertised local device name in the first place,

2. secondly, when the bonding was sucessfull iOS reads out the mandatory GAP Device Name Characteristic and uses the value as the new Device Name.

3. according to Apple's guidelines this characteristic should be writeable

4. I can't use any of the BLE scanner apps on iOS to actually see if this characteristic is writeable or not so I tried a Window based Scanner (Bluetooth LE Explorer) which shows the GAP Service service and the included characteristics. There you can see that the Device Name Characteristic is read-only.

SDK-Version: 17.0.0

SoftDevice: S112

Question:

1. Assumed, that everything is setup correctly according to Apple's guidelines: is it fundametally possible to use the iOS system dialog to change a BLE Device's name? Or is this only working for other Bluetooth-Protocol-Based devices?

2. If 1. applies, which steps do I have to follow to make the Softdevice's Device Name Characteristic writeable? I tried the following and according to the Windows Scanner it doesn't have an effect:

/* GAP initialisieren */
void gap_params_init(void)
{
	ret_code_t err_code;
	ble_gap_conn_sec_mode_t sec_mode;
	BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);
	err_code = sd_ble_gap_device_name_set(&sec_mode, (const uint8_t *)DEVICE_NAME, strlen(DEVICE_NAME));
	APP_ERROR_CHECK(err_code);
	
	ble_gap_conn_params_t gap_conn_params;
	memset(&gap_conn_params, 0, sizeof(gap_conn_params));
	gap_conn_params.min_conn_interval = MIN_CONN_INTERVAL;
	gap_conn_params.max_conn_interval = MAX_CONN_INTERVAL;
	gap_conn_params.slave_latency = SLAVE_LATENCY;
	gap_conn_params.conn_sup_timeout = CONN_SUP_TIMEOUT;
	err_code = sd_ble_gap_ppcp_set(&gap_conn_params);
	APP_ERROR_CHECK(err_code);
}

According to a few other threads in this forum, on Stackoverflow and the descriptions within the SDK BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode); should do exactly this, make the Device Name Char. writeable.

Why isn't this working?

BTW: the first thing is to make it writeable - storing and restoring it from flash is not part of this discussion, I'm pretty sure that this will be straight forward.

Is there any known side-effect that I have to keep in mind or does this only work together with other (mandatory?) characteristics I have to supply?

I know that I could simple tinker my own custom characteristic to solve the problem but I really like it when things are done properly and when the end customer can just use iOS to change the device name, as he can do with his soundbar, stereo and headset as well.

Help is greatly appreciated because I lost a whole day without getting it to work properly.

Thanks and bye-bye!

Parents
  • Hi,
    I did a quick check using the blinky peripheral application from our SDK. Using nRF connect on windows I was able to update the device name. However using nRF connect on iOS I was not able to update the device name. As far as I know it is not possible to write to the device name from iOS, but it's been quite some time since I last checked. Still thinking it is the case, based on this from the accessory design guidelines:


    When third party iOS applications discover services on the accessory, the following services are usedinternally by iOS and are filtered out from the list of discovered services:

    ●Generic Attribute Profile Service

    ●Generic Access Profile Service

    ●Bluetooth Low Energy HID Service

    ●Apple Notification Center Service

    Also the code from the blinky example is similar to yours

    static void gap_params_init(void)
    {
        ret_code_t              err_code;
        ble_gap_conn_params_t   gap_conn_params;
        ble_gap_conn_sec_mode_t sec_mode;
    
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);
    
        err_code = sd_ble_gap_device_name_set(&sec_mode,
                                              (const uint8_t *)DEVICE_NAME,
                                              strlen(DEVICE_NAME));
        APP_ERROR_CHECK(err_code);

  • Hi run_ar,

    Thank you for your quick response!

    I know that iOS is filtering out the above mentioned services, so I don't have access to them from my app. That's the reason you can't use nrf Connect to change the name since it simply has no access to the GAP characteristics.

    Instead I would like to use the integrated mechanism in iOS:

    When you go to "Settings" -> "Bluetooth" then there is the list of known devices. If the device was bonded to the phone then there is a little "i"-Button attached to the entry. Tapping this little icon will lead you to the device settings. And in the case of my soundbar or my headset I can actually change the name of the device.

    The big question is: if GAP is implemented correctly and the Device Name Characteristic is writeable, will iOS offer me to change the name or not. Or is this only possible with other Bluetooth Protocols.

    If that's not possbile I am going to implement it in the app via my own settings characteristic. But in the first place I would like to use the "standard way" or "native way" of changing the device name in iOS.

    Thanks and have a good Day!

    David

Reply
  • Hi run_ar,

    Thank you for your quick response!

    I know that iOS is filtering out the above mentioned services, so I don't have access to them from my app. That's the reason you can't use nrf Connect to change the name since it simply has no access to the GAP characteristics.

    Instead I would like to use the integrated mechanism in iOS:

    When you go to "Settings" -> "Bluetooth" then there is the list of known devices. If the device was bonded to the phone then there is a little "i"-Button attached to the entry. Tapping this little icon will lead you to the device settings. And in the case of my soundbar or my headset I can actually change the name of the device.

    The big question is: if GAP is implemented correctly and the Device Name Characteristic is writeable, will iOS offer me to change the name or not. Or is this only possible with other Bluetooth Protocols.

    If that's not possbile I am going to implement it in the app via my own settings characteristic. But in the first place I would like to use the "standard way" or "native way" of changing the device name in iOS.

    Thanks and have a good Day!

    David

Children
Related