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

About GATT Server Context in HID mouse/keyboard example

Hi,

Sorry if these are silly questions but I've tried some searchings and still cannot figure out the answers for the questions below

  1. What is GATT Server Context? What is the data inside it specifically?

  2. What is the purpose of saving GATT Server Context to persistent memory for each bonded device and what happens if I lose it?

  3. I see in the example code that both gatts_context and bond_context are saved in persistent memory. And when there is a connect request from a previous bonded device, gatts_context will be loaded (applied) using sd_ble_gatts_sys_attr_set function. So, how about the bond_context (holds encryption info)? I dont see any function to load it.

I'm using Nordic nrf51822 chip with soft device s110 v7.0.0

Thank you for any help!

  • Hi Ulrich, could you please give me some information about the need of storing and applying gatts_context to the system using sd_ble_gatts_sys_attr_set function?

    As my observation, when I reconnect to a previously bonded device, there seems to be no problem if I pass a NULL pointer to sd_ble_gatts_sys_attr_set function:

    sd_ble_gatts_sys_attr_set(conn_handle, NULL, 0);

    Everything still work fine even when my device switches the connection back and forth between its bonded peers (e.g. bond with peer 1 -> disconnect -> bond peer 2 -> disconnect -> reconnect with peer 1, ...) as long as I call the sd_ble_gatts_sys_attr_set upon BLE_GAP_EVT_CONN_SEC_UPDATE event (NULL pointer as parameter)

  • As I mentioned in the original post, you are required to get/set the system attributes for bonded devices only. Deleting/forgetting the bond AND the system attributes is allowed, but confuses the peer and might need manual removal from the peer. Deleting only one of the two is a spec violation.

Related