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

Possible race condition during simultaneous connection of two peripherals?

I suspect a possible race condition happening during NUS service discoveries. I have two peripherals that are advertising and have DIS, Battery and the NUS service enabled. After the central connects to one of the peripherals I am immediately enabling the scan on the central to connect to the next peripheral. It seems if a new connection is initiated before all the services of the recently connected peripherals are discovered, the central misses discovering all the services of the current device. For example, sometimes I see NUS service was discovered only on the second connection. Its an observation from logs and not a claim. If I introduce a certain delay before initiating the scanning on the central device after the first connection has been established, everything seems to be fine. I am looking for suggestions.

Parents Reply Children
Related