CommunicationsGattServer
class CommunicationsGattServer(context: Context, coroutineScope: CoroutineScope) : LifecycleObserver
Content copied to clipboard
Wrapper for BluetoothGattServer that uses coroutines to manage all asynchronous calls.
Note: All listener callbacks are called on the main thread.
Constructors
Link copied to clipboard
fun CommunicationsGattServer(context: Context, coroutineScope: CoroutineScope)
Content copied to clipboard
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
Content copied to clipboard
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
Content copied to clipboard
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.