This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Re-establish connection when disconnected

Hi all,

Its known fact that  if peripheral is not sending any data in between connection interval then peripheral will get disconnected from the central device(mobile in my case). Its not an issue for my application.

In my application, i need to process "for" loop for every 5sec which is unavoidable. This "for" loop i need to process only when initiated which will last for 40sec and not always. So every 5 sec(8 times in 40sec), i need to check if there is any data for peripheral at the central device.If any data is there for peripheral then central device will send data to peripheral.
So my question is
1)how much time it will take to re-establish connection and get back data from the central device after each 5sec is over. Please consider MAX time for connection to central device is 20ms.

2)As connection can be re-established only when peripheral starts advertising, but if i am processing for loop then peripheral gets disconnected from the central device and doesn't start advertising after 5sec is over. What do i need to check or how can i re-start advertising so that it can re-connect to the central device.

Thanks

  • Hello,

    The connection time is going to be dependent on your Adv rate and how fast the Central can initiate the connection. I suggest profiling the behavior with a sniffer based your Central device(s). Also, you should not do Characteristic discovery to speed up the connection setup time. You can see the example in SimpleBLEPeripheral on how Adv is re-started after the connection is terminated.

    Best wishes
  • Hi JXS,
    Can you please clarify what do you mean by "you should not do Characteristic discovery to speed up the connection setup time"?
    Thanks