RemoteAttribute

An Attribute for the Client side of a Bluetooth Low Energy connection.

Parameters

emitNewAction

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

logger

the Logger to use for logging.

Type Parameters

ReadAction

the DeviceAction.Read associated with the attribute

WriteAction

the DeviceAction.Write associated with the attribute

Inheritors

Constructors

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

Properties

Link copied to clipboard
abstract val uuid: UUID

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

Creates and emits a ReadAction

Link copied to clipboard

Creates and emits a WriteAction to write a given ByteArray

inline fun <T> startWrite(bluetoothFormat: BluetoothFormat = BluetoothFormat, newValue: T): WriteAction
fun <T> startWrite(serializationStrategy: SerializationStrategy<T>, bluetoothFormat: BluetoothFormat = BluetoothFormat, newValue: T): WriteAction

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.