CommunicationsGattServer
class CommunicationsGattServer(context: Context, coroutineScope: CoroutineScope) : LifecycleObserver
Wrapper for BluetoothGattServer that uses coroutines to manage all asynchronous calls.
Note: All listener callbacks are called on the main thread.
Functions
Link copied to clipboard
Adds the specified service. Returns true
on success, false
otherwise.
Link copied to clipboard
suspend fun indicateCharacteristicChanged(deviceId: DeviceId, serviceUuid: ServiceUuid, characteristicId: CharacteristicId, value: ByteArray): Boolean
Indicates to the device with the specified deviceId that the value of the characteristic with the specified characteristicId on the service with the specified serviceUuid has changed to the specified value.
Link copied to clipboard
suspend fun notifyCharacteristicChanged(deviceId: DeviceId, serviceUuid: ServiceUuid, characteristicId: CharacteristicId, value: ByteArray): Boolean
Notifies the device with the specified deviceId that the value of the characteristic with the specified characteristicId on the service with the specified serviceUuid has changed to the specified value.
Link copied to clipboard
Removes the service with the specified serviceUuid.
Link copied to clipboard
Starts the gatt server with the specified listener.