onConnectionStateChange

open override fun onConnectionStateChange(gatt: BluetoothGatt, status: Int, newState: Int)

Called when the connection state changes (connected or disconnected).

This callback is invoked when a connection attempt completes (either successfully or with an error) or when an existing connection is terminated.

Parameters

gatt

The BluetoothGatt instance for the connection.

status

The status of the operation. BluetoothGatt.GATT_SUCCESS indicates the operation completed successfully. Other values indicate errors.

See also

ConnectionStateMachine.handleConnectionStateChange