Good evening. I write a project on nrf51822 in which there are a number of services with a set of characteristics (write and read). I need to limit access to some characteristics with a password. Is it possible?
Good evening. I write a project on nrf51822 in which there are a number of services with a set of characteristics (write and read). I need to limit access to some characteristics with a password. Is it possible?
Yes. You can achieve this by setting the authorization flag (rd_auth
and wr_auth
for read and write authorization respectively) in the ble_gatts_attr_md_t
type for a characteristic when initializing it. This allows you to intercept the write and read requests to decide whether the requests should be accepted or not.
Here is the message flow chart for the write request with authorization.
In general the message flow charts is good to use to see how this stuff works. You find them all here for the s130 v2.0.1.
This question has a duplicate with additional information.
how specifically does authentication work? By what principle does it allow / disallow devices?
You get an event from the SoftDevice when the peer wants to read/write, and then you can decide whether you want to update the value/return the value.
but how do I know who this peer is? how to separate devices and where to check their signs