RemoteDescriptor

A Descriptor that is accessed remotely by a bluetooth client using BluetoothClient

Parameters

emitNewAction

method to call when a new DeviceConnectionManager.Event.AddAction event should take place

logger

the Logger to use for logging.

Constructors

Link copied to clipboard
constructor(wrapper: RemoteDescriptorWrapper, characteristic: RemoteCharacteristic, emitNewAction: (DeviceConnectionManager.Event.AddAction) -> Unit, logger: Logger)

Properties

Link copied to clipboard

the RemoteCharacteristic this descriptor belongs to

Link copied to clipboard
open override val uuid: UUID
Link copied to clipboard

the RemoteDescriptorWrapper to access the platform descriptor

Functions

Link copied to clipboard

Requests a read of the value of the attribute from the device and suspends until the value is received.

inline suspend fun <T> read(bluetoothFormat: BluetoothFormat = BluetoothFormat): T
suspend fun <T> read(deserializationStrategy: DeserializationStrategy<T>, bluetoothFormat: BluetoothFormat = BluetoothFormat): T

Requests a read of the a value of T of the attribute from the device and suspends until the value is received.

Link copied to clipboard
inline suspend fun <T> readOrNull(bluetoothFormat: BluetoothFormat = BluetoothFormat): T?
suspend fun <T> readOrNull(deserializationStrategy: DeserializationStrategy<T>, bluetoothFormat: BluetoothFormat = BluetoothFormat): T?

Requests a read of the a value of T of the attribute from the device and suspends until the value is received.

Link copied to clipboard
Link copied to clipboard

Creates and emits a WriteAction to write a given ByteArray

inline fun <T> startWrite(bluetoothFormat: BluetoothFormat = BluetoothFormat, newValue: T): DeviceAction.Write.Descriptor
fun <T> startWrite(serializationStrategy: SerializationStrategy<T>, bluetoothFormat: BluetoothFormat = BluetoothFormat, newValue: T): DeviceAction.Write.Descriptor

Creates and emits a WriteAction to write a given T

Link copied to clipboard

Attempts to write a ByteArray to the attribute on the device and suspends until the write completes.

inline suspend fun <T> write(bluetoothFormat: BluetoothFormat = BluetoothFormat, newValue: T): GattResponse.WriteResponse
suspend fun <T> write(serializationStrategy: SerializationStrategy<T>, bluetoothFormat: BluetoothFormat = BluetoothFormat, newValue: T): GattResponse.WriteResponse

Attempts to write a value of T to the attribute on the device and suspends until the write completes.