I am doing some test with the Battery Service on SDK v10, and found out that if I have not enabled Notification on my phone, calling ble_bas_battery_level_update() returns BLE_ERROR_GATTS_SYS_ATTR_MISSING, which originated from a call to sd_ble_gatts_hvx().
I have read this question linked here, where they say that it should be OK by just having sd_ble_gatts_sys_attr_set() called when receiving BLE_GATTS_EVT_SYS_ATTR_MISSING. The way I understand that answer, the SoftDevice would trigger the event BLE_GATTS_EVT_SYS_ATTR_MISSING and sd_ble_gatts_sys_attr_set() would set up System Attribute to avoid future issues.
However, even when I have the same code in my application, but I still encounter this error when the peer central has not enabled Notification. I have tested and seen the same error code 5 seconds after I received the first one. As a matter of fact, my tests show that I never receive the event BLE_GATTS_EVT_SYS_ATTR_MISSING.
- Is this error code significant? Should I find a way to avoid this no matter what or is it OK to overlook it?
Update: I read the question linked above more and found that I could move sd_ble_gatts_sys_attr_set() to BLE_GAP_EVT_CONNECTED instead, and just stop caring about BLE_GATTS_EVT_SYS_ATTR_MISSING. But I am now interested in knowing why the original set up doesn't work.
-
How could I avoid this error code even when the peer device has not enable notification?
-
How does
BLE_GATTS_EVT_SYS_ATTR_MISSINGevent have anything to do with this issue? Why did I never receive that event?