Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BLE_GATTS_EVT_SYS_ATTR_MISSING event in ble_peripheral_class when client is iPhone #7

Open
natersoz opened this issue Oct 9, 2018 · 1 comment
Labels
bug Something isn't working

Comments

@natersoz
Copy link
Owner

natersoz commented Oct 9, 2018

See https://devzone.nordicsemi.com/f/nordic-q-a/1948/strange-error-code-13313-0x3401-returned-by-sd_ble_gatts_hvx/8365#8365

As the error suggests, it means that the softdevice doesn't yet have a set of system attributes. :-)

I'd recommend you to read this document to better understand the concept of bonding with regard to our softdevice, since it also applies to the system attributes.

As you can see, bonding data is split between encryption keys and the system attributes. System attributes includes for example values for CCCDs, and the softdevice therefore needs to get those before sending any notification. Hence, when you try to send a notification, if the peer device have not yet written to the CCCDs, the softdevice will ask the application whether it has any previous bonding data to be used, by giving a BLE_GATTS_EVT_SYS_ATTR_MISSING. If the device does use bonding, the bond manager will normally handle this event, and pass back whatever data has previously been written.

However, the system attributes are requested with the same event no matter if the device use bonding or not (the softdevice doesn't really know that). If a device does not use bonding, but in this case, you can just reply like this:

@natersoz
Copy link
Owner Author

natersoz commented Oct 9, 2018

More from the linked answer:

If you already have this case, I'd expect this error to be returned only for a very short time, and then disappear as soon as the application has replied to the event.

If you know that you'll never have any system attributes stored (i.e. you don't use bonding), it should be fine to move the setting of system attributes to the connected event, if you for some reason need to avoid seeing this error at all.

@natersoz natersoz added the bug Something isn't working label Oct 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant