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

Giving read permission of a characteristic to a specific connected peer in multiperipheral device

Hi,

I am using multiperipheral configuration. I want a characteristic to be read by only a specific peer among connected peers. How do i recognize and authorize this specific peer every time it connects.

I am using PCA10040 , S132, SDK 14.0.0

thanks in advance!

  • BLE does not provide the functionality you want in itself, but it does provide functionality which will let you implement it in your application logic.

    First of all, you need to identify the peer. You can do this in multiple ways. Two of which are:

    1. Using peer address from connection request,
    2. Use application layer logic to have the peer identify itself. This could be done by providing a secret shared key or something.

    Which way you should do it would depends on the security level you want to achieve. Remember that using method 1 provides no real security.

    Anyway, regardless of how you identify the peer, you need to control access to the specific characteristic. This is done using something called "authorization" in the SoftDevice. When you initialize the characteristic, set the rw_auth and/or wr_auth flags to 1 in order to control reads and writes to the characteristic respectively.

    Setting these flags, you will get an event from the SoftDevice for each read/write operation, and you can decide whether the request should be accepted on not based on some criteria (in your case which peer is performing the request).

    For an overview, see the "... with authorization" message sequence charts here. Specifically write request, write command and read request with authorization.

Related