ClusterPayloadReader

interface ClusterPayloadReader


Summary

Public functions

Unit

(Re)initialize a reader to use the provided serialized payload.

T
<T : Any?> read(adapter: StructAdapter<T>)

Read an outer struct (not a field).

ClusterPayload

All structs will be materialized as they are read However primitives will be converted in the getters in ClusterPayload

Unit

Unwraps the core payload from UDDM layers (WHDM payloads are not wrapped).

Extension functions

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.

Public functions

init

fun init(payload: SerializedPayload): Unit

(Re)initialize a reader to use the provided serialized payload.

read

fun <T : Any?> read(adapter: StructAdapter<T>): T

Read an outer struct (not a field).

readPayload

fun readPayload(adapters: Map<UIntStructAdapter<Any>> = emptyMap()): ClusterPayload

All structs will be materialized as they are read However primitives will be converted in the getters in ClusterPayload

unwrapPayload

fun unwrapPayload(tags: List<UInt>): Unit

Unwraps the core payload from UDDM layers (WHDM payloads are not wrapped). This function MUST be called before readPayload for wrapped UDDM payloads.

Example:

override fun read(reader: ClusterPayloadReader): Attributes {
reader.unwrapPayload(ClusterId.source.toUInt(), ClusterId.id.toUInt())
val data = reader.readPayload()
}

Note: Helper functions are available and should be preferred to using this function directly. Example:

override fun read(reader: ClusterPayloadReader): Attributes {
reader.unwrapPayload(ClusterId)
val data = reader.readPayload()
}

Public properties

strictOperationValidation

val strictOperationValidationBoolean

Extension functions

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