Interface ICharacteristicCodec<TRead, TWrite>
- Namespace
- Bluetooth.Abstractions.Scanning.Profiles
- Assembly
- Bluetooth.Abstractions.Scanning.dll
Defines conversion logic between raw Bluetooth characteristic bytes and typed values.
public interface ICharacteristicCodec<TRead, in TWrite>
Type Parameters
TReadThe typed value produced when decoding bytes from a characteristic read.
TWriteThe typed value accepted when encoding bytes for a characteristic write.
Methods
FromBytes(ReadOnlyMemory<byte>)
Converts raw characteristic bytes into a typed value.
TRead FromBytes(ReadOnlyMemory<byte> bytes)
Parameters
bytesReadOnlyMemory<byte>The raw bytes read from the characteristic.
Returns
- TRead
The decoded typed value.
ToBytes(TWrite)
Converts a typed value into raw characteristic bytes.
ReadOnlyMemory<byte> ToBytes(TWrite value)
Parameters
valueTWriteThe typed value to encode.
Returns
- ReadOnlyMemory<byte>
The encoded bytes to write to the characteristic.