com.google.home.matter.serialization

Interfaces

BitmapAdapter

Create a class from a bitmap

ClusterBitmapFlag
ClusterEnum
ClusterPayloadReader
ClusterPayloadWriter

Writes cluster payloads Oriented around the in memory type you have e.g. writer.uint.write(10u, "foo", 100u) writer.float.write(11u, "bar", 10.3f)

ClusterPayloadWriter.FieldWriter

Writes fields in a type safe manner

FieldAdapter

A simple adapter interface for converting raw types to runtime types

OptionalValue

isPresent should be set to true if value != null when value == null it MAY be set to true, which will cause a literal null to be sent to underlying storage when isPresent == false no value will be sent to underlying storage e.g. if(v.isPresent) store.put("key", v.valueOrThrow())

SerializedPayload

Tag interface to represent generic payloads that are serialized/deserialized by cluster payload writers/readers.

StructAdapter
ValueSerializer

A serializer to convert a Kotlin type to and from a Value.

Classes

Bitmap

A class to make it simple to get/set boolean flags without dealing with Logic

ClusterId

Provides a split of source/id of a matter cluster identifier, following the matter Manufacturer Extensible Identifier (MEI) format: 16-bit source and 16-bit id.

ClusterPayload

An object which encapsulates all the data read from the wire Once you get this object, the actual read is done streaming Organized around the in-memory type you want e.g. payload.uint.getNullable(tag, name)

ClusterPayload.FieldReader

Reads fields in a type safe manner

EnumAdapter

Generated Enum should Implement Cluster Enum and then this Enum Adapter can be constructed once for each enum and stored as in or as a companion for use in reading writing adapters

FunctionAdapter
ScopedCommandId

Represents a command within a cluster.

ScopedEventId

Represents an event within a cluster.

Exceptions

RequiredFieldException

A single class to indicate that a Required field is missing

Type aliases

TagId

Extension functions summary

String
UInt
UInt
UInt
UInt.setVendor(vendor: UInt)
Unit

Unwraps an Attributes Payload with the given Cluster Id.

Unit

Unwraps a Command/CommandResult Payload with the given Command Id.

Unit

Unwraps an Event Payload with the given Event Id.

String
UInt
Unit

Wraps an Attributes Payload with the given Cluster Id.

Unit

Wraps a Command/CommandResult Payload with the given Command Id.

Unit

Wraps an Event Payload with the given Event Id.

Extension functions

camelToSnakeUpper

fun String.camelToSnakeUpper(): String

id

fun UInt.id(): UInt

setId

fun UInt.setId(id: UInt): UInt

setVendor

fun UInt.setVendor(vendor: UInt): UInt

unwrapPayload

fun ClusterPayloadReader.unwrapPayload(id: ClusterId): Unit

Unwraps an Attributes Payload with the given Cluster Id.

Attribute encapsulation example:

home.uddm.traits.Trait
home.uddm.traits.VENDOR.VENDORTrait = ClusterId.source + 1
home.uddm.traits.VENDOR.CLUSTERTrait = ClusterId.id + 1
Attributes Data Payload

unwrapPayload

fun ClusterPayloadReader.unwrapPayload(id: ScopedCommandId): Unit

Unwraps a Command/CommandResult Payload with the given Command Id.

Command/CommandResult encapsulation example:

home.uddm.traits.Command
home.uddm.traits.VENDOR.VENDORCommand = ClusterId.source + 1
home.uddm.traits.VENDOR.CLUSTERCommand = ClusterId.id + 1
home.uddm.traits.VENDOR.CLUSTERCommand.XXXXCommand = ScopedCommandId.command + 1
Command Data Payload

unwrapPayload

fun ClusterPayloadReader.unwrapPayload(id: ScopedEventId): Unit

Unwraps an Event Payload with the given Event Id.

Event encapsulation example:

home.uddm.traits.Event
home.uddm.traits.VENDOR.VENDOREvent = ClusterId.source + 1
home.uddm.traits.VENDOR.CLUSTEREvent = ClusterId.id + 1
home.uddm.traits.VENDOR.CLUSTEREvent.XXXXEvent = ScopedEventId.event + 1
Event Data Payload

upperCamelToSnakeUpper

fun String.upperCamelToSnakeUpper(): String

vendor

fun UInt.vendor(): UInt

wrapPayload

fun ClusterPayloadWriter.wrapPayload(id: ClusterId): Unit

Wraps an Attributes Payload with the given Cluster Id.

Attribute encapsulation example:

home.uddm.traits.Trait
home.uddm.traits.VENDOR.VENDORTrait = ClusterId.source + 1
home.uddm.traits.VENDOR.CLUSTERTrait = ClusterId.id + 1
Attributes Data Payload

wrapPayload

fun ClusterPayloadWriter.wrapPayload(id: ScopedCommandId): Unit

Wraps a Command/CommandResult Payload with the given Command Id.

Command/CommandResult encapsulation example:

home.uddm.traits.Command
home.uddm.traits.VENDOR.VENDORCommand = ClusterId.source + 1
home.uddm.traits.VENDOR.CLUSTERCommand = ClusterId.id + 1
home.uddm.traits.VENDOR.CLUSTERCommand.XXXXCommand = ScopedCommandId.command + 1
Command Data Payload

wrapPayload

fun ClusterPayloadWriter.wrapPayload(id: ScopedEventId): Unit

Wraps an Event Payload with the given Event Id.

Event encapsulation example:

home.uddm.traits.Event
home.uddm.traits.VENDOR.VENDOREvent = ClusterId.source + 1
home.uddm.traits.VENDOR.CLUSTEREvent = ClusterId.id + 1
home.uddm.traits.VENDOR.CLUSTEREvent.XXXXEvent = ScopedEventId.event + 1
Event Data Payload