This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

BLE connection handle value scope

I would like to use connection handle value as index to an array which store some per connection specific data. Some questions about connection handle:

  1. is connection handle value allocated by SD continuous?

  2. Suppose 6 connections has been established, and then one of them disconnected. Will this handle value be re-used to next built connection, or just abandoned?

Thanks in advance.

Parents
  • Hi,

    I have heard this idea before, but there are some pitfalls:

    Q1: Not necessarily. It is continuous as long as no devices disconnects. I.e. the first device will get handle 0, device number 2 gets handle 1, and so on. But if the first device disconnects, then device number 3 might get handle 0 again. Furthermore, due to the supervision timeout mechanism, it might in some cases take some time before the Softdevice detects that a device has lost its connection. And if the same device then tries to reconnect quickly (before the supervision timeout occurs) it might get assigned a new connection handle. Hence, it is actually possible that the same device has two connection handles at the same time, although only until the supervision timeout occurs.

    Q2: Yes, the Softdevice will reuse connection handles, and a particular device will not necessarily get the same connection handle value on every connection.

    Another solution to individually identify connected devices is to bond all your devices. Or you can use other information like e.g MAC addresses.

  • thanks for the detailed answer. As in my use cases, the devices at the other end is random and un-predicate-able, so i can not pre-bond any devices. Is there any other better way to do this?

Reply Children
No Data
Related