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.
Just like this picture.
However, when a device is only using the NUS does not leave the device's info.
- This is because the peripherals that only use NUS just pairs with the central,
not bonding, is it?
- 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.
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);