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

device context storing issue

what is the procedure to find connected device is bonded or not, should i store the device, application or service context in persistent memory to help recognizing bonded devices? Iam using SDK10.0 and SoftDevice Version 110. iam using device manager for handling bonding process.

EDIT1: Actually the device was getting paired but not getting bonded. So the bonded device were not getting recognized.

I have attached the debug log trace here

Parents
  • Take a look at the function dm_ble_evt_handler() in device_manager_peripheral.c. Here bonded devices are stored in the bonded device list(m_connection_table).

    In order to check if a device already exists in the bonded device list, the function device_instance_find() is used. If the device exits in the list, the function returns NRF_SUCCESS.

  • If the function device_instance_find() returns NRF_ERROR_NOT_FOUND, the device is not bonded. If the device is already paired is irrelevant.

    The function that stores the bond information is device_context_store(), which is called on the BLE_GAP_EVT_AUTH_STATUS event in dm_ble_evt_handler(). After device_context_store() has successfully stored the bond information, you will get the event DM_EVT_DEVICE_CONTEXT_STORED. If you want to delete all the bond information, you have to use the function dm_device_delete_all().The event DM_EVT_DEVICE_CONTEXT_DELETED is reported for each deleted entry.

Reply
  • If the function device_instance_find() returns NRF_ERROR_NOT_FOUND, the device is not bonded. If the device is already paired is irrelevant.

    The function that stores the bond information is device_context_store(), which is called on the BLE_GAP_EVT_AUTH_STATUS event in dm_ble_evt_handler(). After device_context_store() has successfully stored the bond information, you will get the event DM_EVT_DEVICE_CONTEXT_STORED. If you want to delete all the bond information, you have to use the function dm_device_delete_all().The event DM_EVT_DEVICE_CONTEXT_DELETED is reported for each deleted entry.

Children
No Data
Related