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

Modifying NUS - Make it bond with smart phones

Hi, I use the NUS most of the time.

(SDK 7.2 & S110 7.1 with IAR 7.1)

As you know, HID keyboard or mouse bond with centrals (smart phones).

After bonding, when using iOS devices for example, the bonded devices' information are left.

Bond Just like this picture.

However, when a device is only using the NUS does not leave the device's info.

  1. This is because the peripherals that only use NUS just pairs with the central,

not bonding, is it?

  1. Can I modify the NUS code (in SDK 7.2) in order to bond with the central?

If this is possible, what changes are needed?

The reason to make it bond is I want connect the peripheral to the central directly.

Or is there other ways to make this service to perform a direct advertising?

Or the only solution is to make an app that make it seems to connect each other automatically?

-Regards, Mango922

/**************/

Added : 7, July, 2015 :

Thanks for answering!

You said : the iOS/Android system won't show your device and bond to your

device if they are note(you mean "not"?) HID device.

Nexus 5

However, after downloading the NUS(didn't changed the service) example,

I checked with my Nexus 5 and I showed the device. It uses Android 5.1.1.

Anyway you mean, after I change the NUS to make it bond, it will still not appear at the

"Settings -> Bluetooth"?

// Edited, Feb. 25, 2016

I edited the ble_nus.c like this.

I call device_manager_init before ble_nus_init.

#define SEC_PARAM_BOND                   1       /**< Perform bonding. */
#define SEC_PARAM_MITM                   0       /**< Man In The Middle protection not required. */

// static uint32_t rx_char_add
BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&cccd_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&cccd_md.write_perm);

BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&attr_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&attr_md.write_perm);

// static uint32_t tx_char_add
BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&attr_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&attr_md.write_perm);

Error 7

Parents
  • Yes, I meant "not HID". On Android, they changed that from time to time, and also depends on the manufacturing vendors. As far as I remember Samsung device won't show it if it's not HID or bonded. But maybe in the newer version 5.1.1 they may have it.

    So it's not guaranted that your device will always show up in the Bluetooth setting if it's not bonded.

Reply
  • Yes, I meant "not HID". On Android, they changed that from time to time, and also depends on the manufacturing vendors. As far as I remember Samsung device won't show it if it's not HID or bonded. But maybe in the newer version 5.1.1 they may have it.

    So it's not guaranted that your device will always show up in the Bluetooth setting if it's not bonded.

Children
No Data
Related