-
@FunctionalInterface() public interface ConnectionParametersUpdatedCallback
The connection parameters for a Bluetooth LE connection is a set of parameters that determine when and how the Central and a Peripheral in a link transmits data. It is always the Central that actually sets the connection parameters used, but the Peripheral can send a so-called Connection Parameter Update Request, that the Central can then accept or reject.
On Android, requesting connection parameters is available since Android Lollipop using requestConnectionPriority. There are 3 options available: CONNECTION_PRIORITY_LOW_POWER, CONNECTION_PRIORITY_BALANCED and CONNECTION_PRIORITY_HIGH. See newConnectionPriorityRequest for details.
Until Android 8.0 Oreo, there was no callback indicating whether the change has succeeded, or not. Also, when a Central or Peripheral requested connection parameters change without explicit calling of this method, the application was not aware of it. Android Oreo added a hidden callback to android.bluetooth.BluetoothGattCallback notifying about connection parameters change. Those values will be reported with this callback.
-
-
Method Summary
Modifier and Type Method Description abstract voidonConnectionUpdated(@NonNull() BluetoothDevice device, @IntRange(from = 6, to = 3200) int interval, @IntRange(from = 0, to = 499) int latency, @IntRange(from = 10, to = 3200) int timeout)Callback indicating the connection parameters were updated. -
-
Method Detail
-
onConnectionUpdated
abstract void onConnectionUpdated(@NonNull() BluetoothDevice device, @IntRange(from = 6, to = 3200) int interval, @IntRange(from = 0, to = 499) int latency, @IntRange(from = 10, to = 3200) int timeout)
Callback indicating the connection parameters were updated. Works on Android 8.0 Oreo or newer.
- Parameters:
device- the target device.interval- Connection interval used on this connection, 1.25ms unit.latency- Slave latency for the connection in number of connection events.timeout- Supervision timeout for this connection, in 10ms unit.
-
-
-
-