ArtNet.Packet.ArtVlc (ArtNet v0.1.0)

View Source

Decoder for VLC payloads carried by ArtNet.Packet.ArtNzs.

Art-Net VLC data is represented on the wire as an ArtNzs packet with start code 0x91. Decode the Art-Net packet first with ArtNet.decode/1, or pass the complete binary directly to decode/1.

with {:ok, %ArtNet.Packet.ArtNzs{} = nzs} <- ArtNet.decode(binary),
     {:ok, vlc} <- ArtNet.Packet.ArtVlc.decode(nzs) do
  vlc.payload
end

This module currently provides decoding and checksum helpers for VLC payloads. Encoding is handled by building the corresponding ArtNzs packet.

Summary

Types

t()

Structured ArtVlc payload decoded from an ArtNzs packet.

Functions

Calculates the 16-bit additive checksum for a VLC payload.

Decodes an ArtVlc payload from a complete Art-Net binary or an ArtNzs packet.

Types

t()

@type t() :: %ArtNet.Packet.ArtVlc{
  beacon_repeat: non_neg_integer(),
  flags: ArtNet.Packet.ArtVlc.Flags.t(),
  man_id: non_neg_integer(),
  net: non_neg_integer(),
  payload: [non_neg_integer()],
  payload_checksum: non_neg_integer(),
  payload_count: non_neg_integer(),
  payload_language: non_neg_integer(),
  sequence: non_neg_integer(),
  slot_address: non_neg_integer(),
  spare: non_neg_integer(),
  sub_code: non_neg_integer(),
  sub_universe: non_neg_integer(),
  transaction: non_neg_integer(),
  vlc_depth: non_neg_integer(),
  vlc_frequency: non_neg_integer(),
  vlc_modulation: non_neg_integer()
}

Structured ArtVlc payload decoded from an ArtNzs packet.

Functions

checksum(payload)

@spec checksum([non_neg_integer()]) :: non_neg_integer()

Calculates the 16-bit additive checksum for a VLC payload.

decode(binary)

@spec decode(binary() | ArtNet.Packet.ArtNzs.t()) ::
  {:ok, t()} | {:error, ArtNet.DecodeError.t()}

Decodes an ArtVlc payload from a complete Art-Net binary or an ArtNzs packet.

The function validates the ArtNzs start code, fixed VLC magic fields, payload length, maximum payload size, and payload checksum.