ClientBleGatt
A class for managing BLE connection. It propagates events (ClientGattEvent) to it's corresponding characteristics (ClientBleGattCharacteristic) and descriptors (ClientBleGattDescriptor). Thanks to that values are getting updated.
Despite that it's responsible for exposing connection parameters like mtu, phy, connection state and request their changes.
Properties
Returns last GattConnectionState without it's status.
Returns last observed GattConnectionState with it's corresponding status BleGattConnectionStatus.
Returns whether a device is connected.
Returns Flow which emits services. Services can be outdated which results in emitting ServiceChanged. That's why usage of Flow may be handy.
Functions
Aborts reliable write. All writes to a characteristics which supports reliable writes will be reverted to a state preceding call to beginReliableWrite.
Begins reliable write. All writes to a characteristics which supports this feature will be transactional which means that they can be reverted in case of data inconsistency.
Clears service cache.
Closes GATT instance and releases resources. After that ClientBleGatt cannot be used.
Disconnects current device.
Executes reliable write. All writes to a characteristics which supports reliable write will be executed and new values will be set permanently.
Reconnects to the device if disconnected. Works only if BleGattConnectOptions.closeOnDisconnect is set to false.
Requests connection priority. It will influence latency and power consumption.
Suspend function requesting new MTU size.
Sets preferred PHY for the connection.
Auxiliary function which waits for bonding. The bonding may be initiated in different scenarios e.g. after connected or when reading from characteristic which is protected.