Table of Contents

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

TRead

The typed value produced when decoding bytes from a characteristic read.

TWrite

The 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

bytes ReadOnlyMemory<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

value TWrite

The typed value to encode.

Returns

ReadOnlyMemory<byte>

The encoded bytes to write to the characteristic.