invoke

operator fun <T> invoke(value: T, offset: Int = 0, serializationStrategy: SerializationStrategy<T>, bluetoothFormat: BluetoothFormat = BluetoothFormat): GattResponse.ReadSuccess

Generates a GattResponse.ReadSuccess response for a value T

Return

a GattResponse.ReadSuccess response where GattResponse.ReadSuccess.value can be deserialized by bluetoothFormat using a kotlinx.serialization.DeserializationStrategy similar to serializationStrategy

Parameters

value

the value read

offset

the offset of the ByteArray to read

serializationStrategy

the SerializationStrategy used to encode value

bluetoothFormat

the BluetoothFormat to use for encoding value

Type Parameters

T

the type of the value read

Throws

kotlinx.serialization.SerializationException

if value cannot be encoded using serializationStrategy


inline operator fun <T : Any> invoke(value: T, offset: Int = 0, bluetoothFormat: BluetoothFormat = BluetoothFormat): GattResponse.ReadSuccess

Generates a GattResponse.ReadSuccess response for a value T

Return

a GattResponse.ReadSuccess response where GattResponse.ReadSuccess.value can be deserialized by bluetoothFormat

Parameters

value

the value read

offset

the offset of the ByteArray to read

bluetoothFormat

the BluetoothFormat to use for encoding value

Type Parameters

T

the type of the value read

Throws

kotlinx.serialization.SerializationException

if value cannot be encoded