buildPacket

open fun buildPacket(@NotNull scheme: @NotNull McuMgrScheme, op: Int, flags: Int, groupId: Int, sequenceNum: Int, commandId: Int, @Nullable payloadMap: @Nullable Map<String, Any>): @NotNull Array<Byte>

Build a Mcu Manager packet based on the transport scheme.

Return

The packet data.

Parameters

scheme

the transport scheme.

op

the operation (OP_READ, OP_WRITE).

flags

additional flags.

groupId

group ID of the command.

sequenceNum

sequence number.

commandId

ID of the command in the group.

payloadMap

map of payload key-value pairs.

Throws

if the payload map could not be serialized into CBOR. See cause.