When to applyConnectionParametersAsync
I am trying to extend battery life on a MetaWear device for as long as possible. So, I'm trying to configure the connection parameters for the device according to the "Experimental Connection Parameters", https://mbientlab.com/docs/metawear/ios/latest/Classes/MBLSettings.html.
*After configuring the parameters, when should applyConnectionParametersAsync be invoked?
*Before connecting the device or after the device has already been connected?
*How do you know if the Apple device (I'm trying to connect with) has accepted the new connection parameters?
Note, Apple explicitly states (see reference below) that the Apple device does not read or use the parameters in the Peripheral Preferred Connection Parameters characteristic. And that the MetaWear accessory should request connection parameters appropriate for its use case by sending an L2CAP Connection Parameter Update Request at the appropriate time.
*Does applyConnectionParametersAsync() do an L2CAP Connection Parameter Update Request at the appropriate time? And what is the "appropriate time"?
*Does applyConnectionParametersAsync get around this open radar bug report? Bluetooth LE Connection Parameter Update Request accepted, but LL_CONNECTION_UPDATE_REQ does not occur, http://www.openradar.me/21400278
From Bluetooth Design Guidelines, https://developer.apple.com/hardwaredrivers/BluetoothDesignGuidelines.pdf,
3.6 Connection Parameters
The accessory is responsible for the connection parameters used for the Low Energy connection. The accessory should request connection parameters appropriate for its use case by sending an L2CAP Connection Parameter Update Request at the appropriate time. See the Bluetooth 4.0 specification, Volume 3, Part A, Section 4.20 for details. The connection parameter request may be rejected if it does not comply with all of these rules:
Interval Max * (Slave Latency + 1) ≤ 2 seconds
Interval Min ≥ 20 ms
Interval Min + 20 ms ≤ Interval Max
Slave Latency ≤ 4
connSupervisionTimeout ≤ 6 seconds
Interval Max * (Slave Latency + 1) * 3 < connSupervisionTimeout
If Bluetooth Low Energy HID is one of the connected services of an accessory, connection interval down to 11.25 ms may be accepted by the Apple product. The Apple product will not read or use the parameters in the Peripheral Preferred Connection Parameters characteristic. See the Bluetooth 4.0 specification, Volume 3, Part C, Section 12.5.
This discussion has been closed.
Comments
Calculate Maximum BLE Energy Settings:
Interval Max * (Slave Latency + 1) * 3 < 6
Interval Max * (4 + 1) * 3 < 6
Interval Max * (15) < 6
Interval Max < 6 / 15 < 0.4 seconds
Interval Max * (4 + 1) ≤ 2 seconds
Interval Max * (5) ≤ 2 seconds
Interval Max * ≤ 2 / 5 seconds ≤ 0.4 seconds
Interval Max ≤ 4000 / 1.25ms ≤ 3200
So MetaWear API connection parameters settings are:
Slave Latency = 4
Interval Max = 4000ms; 4000 ms / 1.25 = 3200
Interval Min = 4000 ms - 20 ms; 3980 ms / 1.25 = 3184
connSupervisionTimeout = 6 seconds ; 6000 ms / 10 ms = 600
*After configuring the parameters, when should applyConnectionParametersAsync be invoked?
Any time really, configuring the parameters only sets local variables on the iPhone, applyConnectionParametersAsync is what actually sends the values over the link to the device.
*Before connecting the device or after the device has already been connected?
Nothing can be set until a connection is complete, we have no way to send data to the MetaWear before we have a connection.
*How do you know if the Apple device (I'm trying to connect with) has accepted the new connection parameters?
It's really difficult to know what actual values they end up deciding to use (its details that arn't really exposed). Perhaps if you try to stream high speed data you can calculate the bandwidth and reverse engineer the connection parameters.
*Does applyConnectionParametersAsync() do an L2CAP Connection Parameter Update Request at the appropriate time? And what is the "appropriate time"?
It appears our firmware is only setting the preferred connection parameters, thus why values don't update until a reconnection occurs. We will incorporate a fix in the next firmware to also send a L2CAP Connection Parameter Update Request.
*Does applyConnectionParametersAsync get around this open radar bug report? Bluetooth LE Connection Parameter Update Request accepted, but LL_CONNECTION_UPDATE_REQ does not occur, http://www.openradar.me/21400278
If this bug really exists and is still present, there is no way we can work around. Once we incorporate the connection update request we will be able to test.