NCS multiple connection and save bond information

If there have a peripheral sample support for multiple central?

How NCS realize saving bonding information and distinguish different devices that bond with my board?

Whether NCS have a manager method like peer_id and I can get conn_handle by it?

I want to create a application that support multiple phones connect with.

At mean while,the application need to support pairing and bonding.Besides,I need a method like peer_id to manage.

I don't know the method need realized by myself or it already exit in NCS.

Parents
  • Hi,

    If there have a peripheral sample support for multiple central?

    There are samples that support being bonded to multiple device (that is just a matter of settng CONFIG_BT_MAX_PAIRED to a high enough number for your requierments. I am not aware of a sammple that demonstrate multiple simultanious connections in the peripheral role. It is possible, though.

    How NCS realize saving bonding information and distinguish different devices that bond with my board?

    Bonds are stored in the internal flash with the settings page. You can iterate through bonds using bt_foreach_bond(), this gives you the address of the bond which is how you refer to it.

    Whether NCS have a manager method like peer_id and I can get conn_handle by it?

    No, it is a bit different. You iterate through the list and identify the peer by address.

  • Hi,

    Does it mean that when application support bonded to mutiple device,it will use address to do any things like send data by gatt and so on?

    And by this way,peripheral how to identify mobile phone?Because my application with nRF SDK17 get the mobile phone address is a variational random address.Therefore I used peer_id to identify everyone phone that connect with my application that developed with nRF SDK17.

  • After bonding (when the IRK) is exchanged, the API's will always give you the same address even if the random resolvable address on air changes. (There are helper functions you can use to check address type if needed, bt_addr_le_is_rpa(), andbt_addr_le_is_identity()).

    You can see this if you experiment with an example that log the addresses, like the Bluetooth peripheral UART sample. This address you can save and it will always be a "handle" to that devices (until the bond is deleted). I suggest you experiment a bit with that to see, as there are no other APIs for this but it is also not needed, but it may be unfamiliar as it is handled differently here than in the old nRF5 SDK.

  • Hi,

    I test about address and find as follow.

    If it mean that board connect with bonded device using the public address so that I can realize whether a device bonded by the address type?If it is random,it mean the device is new bonding?

  • Hi,

    Chaoyue Ying said:
    If it mean that board connect with bonded device using the public address so that I can realize whether a device bonded by the address type?

    Not per se. But the Bluteooth host will resolve the address basedon the IRK that was transfered during bonding and the random resolvlable address that is used when connecting. And from that will know which peer device it is, and always use the public address for the APIs. You can see this if you wait and re-connect with the phone that the public address you see on the nRF for that device will be the same. And if you use a sniffer you will see that the adress used on air is the random resolvable address.

    Chaoyue Ying said:
    If it is random,it mean the device is new bonding?

    Not nesesarily. It could be that the peer always us a non-resolvable random address, for instance. There is no specific API for thecking if a bond exists (though it has been discussed).  But it is possible to iterate through all bonds with bt_foreach_bond().

  • Hi,

    I think I understand about address.

    Now I want know how to use flash to save some extra information that in relation to the autosaved bond information,which document I can reference.

  • Hi,

    I suggest you look at the Settings subsystem for storing persistent data. The Settings API sample demonstrate how it is used.

Reply Children
No Data
Related