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

add nus service with bond

Fisrt of all, I have searched all the questions but now still can't make bond work. I've done below work: 1, modify main.c file to add device manger function 2, modify ble_nus.c, change all the BLE_GAP_CONN_SEC_MODE_SET_OPEN to BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM

With above modification, ios can't find the device. Then I change all the read_perm to BLE_GAP_CONN_SEC_MODE_SET_OPEN, ios can find the device, but I can't trigger the bond process by read or write characteristics with lightblue(the ble test software) on iphone.

So anyone can tell me how to make the bond work?

Parents
  • I would recommend that you look at one of the other examples that is using bonding, e.g. Heart rate... You are right that you need to add device manager and change the conns sec modes. In addition you should make sure you also remove events from on_ble_evt that is now handled by the device manager. And you should add sys_evt_dispatch, which is probably the part that is hardest to spot without knowing it(register with softdevice using softdevice_sys_evt_handler_set).

  • Now I can bond device with phones, thank you. I didn't remove event that on_ble_evt handled which should be handled by device manager. On more question, if I set BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM to all the read_perm/write_perm of cccd_md and attr_md, then phone will not find the device, why will this hanppen?

Reply Children
No Data
Related