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

Change Bluetooth Device Name From iOS

Hi ,

I am using nRF6.0.0, SoftDevice 7.0, for nRF 6310 hardware. I am trying to develop a ble keyboard app with the help of Ble Keyboard Sample we have in the SDK. As you might be aware that the device name is set when it is booted (e.g Nordic_Keyboard).

Is there any way I can change the name of the device from iOS once it is connected or while booting without flashing the hardware(through config file or something).

Kind Regards, Ven

Parents
  • Hi,

    You can set the device name to be writable remotely by a peer. Simply find where sd_ble_gap_device_name_set() is called and make sure the p_write_perm is pointing to a ble_gap_conn_sec_mode_t that has the proper permission levels. There are macros available like BLE_GAP_CONN_SEC_MODE_SET_OPEN that can be used to set the conn_sec_mode to more human-readable properties. The default setting is to not allow any writes, i.e. BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS (security mode 0, level 0). You can also require encryption (with or without MITM protection) to write to the device name.

    When this permission is set, the peer can write to the device name remotely. This will however be lost when the device goes into system off, so I would recommend saving the device name to e.g flash (using pstorage). That allows you to check flash during startup and pull a device name from there, if present.

    Ex:

    #define STR_DEVICE_NAME "MY DEVICE NAME"
    ble_gap_conn_sec_mode_t security;
    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&security);
    sd_ble_gap_device_name_set(&security, STR_DEVICE_NAME, (uint16_t)strlen(STR_DEVICE_NAME)))
    

    A second alternative is to set something in the UICR during mass production. The device can then pick up a name from there, without having to rely on a peer to change it.

  • Is it possible send me an example if you have any?

Reply Children
No Data
Related