Is it possible to get an event when the connection event for each connected peripheral finish?
Let's explain with an example, I have 2 connections, suppose that the both connection intervals are the same for both peripherals, and this is the timeline of the connection intervals
-----1--2-----------1--2-----------1--2----> time
I want to receive an event everytime 1 or 2 has a connection event, do some processing for this connection,
However, I think there are some other considerations that have to be taken. According to the Software developer guide:
7.7.2 Limit Application Processing During Bluetooth Low Energy Activity
Because of the time-dependent nature of the Bluetooth Low Energy protocol, the controller (LL_ProcessEvent()) must process before each connection event or advertising event. If the controller does not get process, advertising restarts or the connection drops. Because OSAL is not multithreaded, each task must stop processing to let the controller process. The stack layers do not have this issue.
Ensure that the application processes less than the following: (connection/advertising interval) – 2 ms
The 2 ms are added as buffer to account for controller processing time. If extensive processing is required in the application task, split it up using OSAL events in Section 3.3.
This is easily achievable when there's only one peripheral connected, however, when there are 2 or more, I'm assuming that you must ensure to stop the processing to le the controller handle any connection events.
Therefore these are my questions:
- When calling HCI_EXT_ConnEventNoticeCmd do I have to set different taskEvents for each peripherals or there's a way to know which connHandle corresponds to the event?
- What happen if when I'm doing the processing for 1, the connect event of 2 happens before giving the control to the controller? The connection with 2 will be dropped?
- Is there anything that says how many time the controller will wait between connection intervals of different peripherals? Is this specified or controllable?
- How the controller schedule the connection intervals for multiple peripherals? Is this accessible from the code?
- Is it possible to have multiple connections with different connection intervals? (I'm guessing that's not possible or recommendable because they could overlap)
- Is there a way to get know how many time will be available until the next connection event happens?
A little more context for this question: I'm having problems when writing and reading characteristics from 2 connection at the same time: