Callback

interface Callback

Asynchronous callbacks invoked by a BleCentralHal implementation.

Functions

Link copied to clipboard
abstract fun onCharacteristicChanged(uuid: UUID, value: ByteArray)

Invoked when a GATT notification or indication is received for uuid.

Link copied to clipboard
abstract fun onCharacteristicRead(uuid: UUID, value: ByteArray?, error: Throwable?)

Invoked when a GATT characteristic read completes.

Link copied to clipboard
abstract fun onCharacteristicsDiscovered(maxWriteSize: Int?, hasL2capCharacteristic: Boolean, error: Throwable?, hasIdentCharacteristic: Boolean = true)

Invoked when GATT characteristic discovery completes.

Link copied to clipboard
abstract fun onCharacteristicWrite(uuid: UUID, error: Throwable?)

Invoked when a GATT characteristic write completes.

Link copied to clipboard
abstract fun onConnected()

Invoked when a BLE connection to the discovered peripheral has been established.

Link copied to clipboard
abstract fun onDescriptorWrite(characteristicUuid: UUID, error: Throwable?)

Invoked when a GATT descriptor (CCCD) write completes.

Link copied to clipboard
abstract fun onDisconnected()

Invoked when the BLE connection to the peripheral is lost or fails to establish.

Link copied to clipboard
abstract fun onError(error: Throwable)

Invoked when an unrecoverable asynchronous transport error occurs.

Link copied to clipboard
abstract fun onL2capConnected(channel: BleL2capChannel?, error: Throwable?)

Invoked when an L2CAP Connection-Oriented Channel connection attempt completes.

Link copied to clipboard
abstract fun onMtuChanged(mtu: Int, error: Throwable?)

Invoked when GATT ATT MTU negotiation completes (or fails if error is non-null).

Link copied to clipboard
abstract fun onPeripheralDiscovered()

Invoked when a peripheral advertising the target service UUID has been discovered.

Link copied to clipboard
abstract fun onPowerOn(error: Throwable?)

Invoked when Bluetooth central power-on check completes (or fails if error is non-null).

Link copied to clipboard
abstract fun onScanFailed(error: Throwable)

Invoked when BLE scanning fails with error.

Link copied to clipboard
abstract fun onServicesDiscovered(hasTargetService: Boolean, error: Throwable?)

Invoked when GATT primary service discovery completes.