ArtNet.Packet.ArtMedia (ArtNet v0.1.0)

View Source

Sends media-server data to a controller.

This packet carries media information such as media type, page, and file identifiers for Art-Net media extensions.

Packet layout

PartFieldDescriptionDefaultSizeFormat
Headeridfixed8 bytes"Art-Net\\0"
Headerop_code0x90002 byteslittle-endian OpCode
Headerprot_ver142 bytesprotocol version
Payloadfiller1Reserved byte, transmitted as zero.01 byteunsigned integer (8 bits)
Payloadfiller2Reserved byte, transmitted as zero.01 byteunsigned integer (8 bits)
Payloadfiller3Reserved byte, transmitted as zero.01 byteunsigned integer (8 bits)
Payloadfiller4Reserved byte, transmitted as zero.01 byteunsigned integer (8 bits)
PayloadstreamMedia stream identifier.required1 byteunsigned integer (8 bits)
PayloadcommandMedia command code.required1 byteunsigned integer (8 bits)
Payloadcommand_data1First command-specific data byte.required1 byteunsigned integer (8 bits)
Payloadcommand_data2Second command-specific data byte.required1 byteunsigned integer (8 bits)
Payloadcommand_data3Third command-specific data byte.required1 byteunsigned integer (8 bits)
PayloadpacksAdditional media command data bytes.requiredvariable (1 byte each)list of unsigned integer (8 bits)

Summary

Functions

Decodes a complete Art-Net binary as this packet type.

Encodes this packet struct into a complete Art-Net binary.

Builds a validated packet struct from a map or keyword list.

Builds a validated packet struct from a map or keyword list.

Returns the Art-Net OpCode value for this packet module.

Returns whether this packet includes the Art-Net protocol version header.

Returns the packet payload schema in declaration order.

Types

t()

@type t() :: %ArtNet.Packet.ArtMedia{
  command: :integer,
  command_data1: :integer,
  command_data2: :integer,
  command_data3: :integer,
  filler1: :integer,
  filler2: :integer,
  filler3: :integer,
  filler4: :integer,
  packs: [:integer],
  stream: :integer
}

Functions

decode(data)

@spec decode(binary()) :: {:ok, t()} | :error

Decodes a complete Art-Net binary as this packet type.

encode(packet)

@spec encode(t()) :: {:ok, binary()} | :error

Encodes this packet struct into a complete Art-Net binary.

new(attrs)

@spec new(map() | Keyword.t()) :: {:ok, t()} | {:error, ArtNet.EncodeError.t()}

Builds a validated packet struct from a map or keyword list.

new!(attrs)

@spec new!(map() | Keyword.t()) :: t()

Builds a validated packet struct from a map or keyword list.

Raises ArtNet.EncodeError when validation fails.

op_code()

@spec op_code() :: pos_integer()

Returns the Art-Net OpCode value for this packet module.

The OpCode is 0x9000.

require_version_header?()

@spec require_version_header?() :: boolean()

Returns whether this packet includes the Art-Net protocol version header.

schema()

Returns the packet payload schema in declaration order.