clj-artnet

Facilities for Art-Net 4 protocol communication.

Lifecycle: start-node! - starts a local Art-Net node stop-node! - stops the Art-Net node

Commands: send-dmx! - unicasts artdmx packet send-rdm! - unicasts artrdm packet send-diagnostic! - unicasts artdiagdata packet send-sync! - broadcasts artsync packet

State: state - snapshot of node state diagnostics - snapshot of diagnostics apply-state! - updates node configuration

apply-state!

(apply-state! node state-map)

Applies a partial state update to the Node. Returns nil.

State map: :node - ArtPollReply fields :network - network config :callbacks - handlers :capabilities - status overrides

compose-port-address

(compose-port-address net sub-net universe)

Composes a 15-bit Port-Address from its components.

Returns int (15-bit Port-Address).

diagnostics

(diagnostics node)(diagnostics node opts)

Returns a snapshot of the diagnostics state.

Options: :keys - vector, keys to include (default :diagnostics) :timeout-ms - int, wait duration

enqueue-command!

(enqueue-command! node command)

Enqueues a command into the logic process. Returns nil.

send-diagnostic!

(send-diagnostic! node opts)

Unicasts an ArtDiagData packet. Returns nil.

Options: :text - string, diagnostic message (ASCII) :priority - keyword/int, e.g. :dp-low :logical-port - int, port index

send-dmx!

(send-dmx! node opts)

Unicasts an ArtDmx packet to a specific Port-Address. Returns nil.

Options: :data - byte-array/ByteBuffer/seq, DMX512 data (up to 512 bytes) :net - int, Network address (0-127) :sub-net - int, Sub-Net address (0-15) :universe - int, Universe address (0-15) :port-address - int, 15-bit Port-Address (alternative to net/sub-net/universe) :target - map, {:host str, :port int} (target Node)

send-rdm!

(send-rdm! node opts)

Unicasts an ArtRdm packet to a specific Node. Returns nil.

Options: :rdm-packet - byte-array/ByteBuffer/seq, RDM PDU :net - int, Network address (0-127) :sub-net - int, Sub-Net address (0-15) :universe - int, Universe address (0-15) :port-address - int, 15-bit Port-Address (alternative to net/sub-net/universe) :target - map, {:host str, :port int} (target Node)

send-sync!

(send-sync! node)(send-sync! node opts)

Broadcasts an ArtSync packet to force synchronous output. Returns nil.

Options: :target - map, optional override {:host str, :port int}

split-port-address

(split-port-address port-address)

Splits a 15-bit Port-Address into its components.

Returns map {:net :sub-net :universe}.

start-node!

(start-node!)(start-node! {:keys [default-target max-packet recv-buffer command-buffer actions-buffer allow-limited-broadcast?], :as config, :or {max-packet 2048, recv-buffer 64, command-buffer 32, actions-buffer 32}})

Starts a local Art-Net Node. Returns control map.

Options: :node - map, ArtPollReply fields :callbacks - map, event handlers {:dmx fn, :sync fn} :bind - map, {:host str, :port int} :diagnostics - map, {:broadcast-target {:host str, :port int}} :default-target - map, fallback send target (e.g. Output Gateway) :allow-limited-broadcast? - boolean, permit 255.255.255.255 (default false) :rx-buffer - map, {:count int, :size int} :tx-buffer - map, {:count int, :size int}

Returns map: :flow - flow instance :stop! - idempotent stop function :config - resolved configuration :report-chan - flow report channel

state

(state node)(state node opts)

Returns a snapshot of the runtime state.

Options: :keys - vector, keys to include (default :node :network) :timeout-ms - int, wait duration

stop-node!

(stop-node! node)

Stops the Art-Net Node and releases resources. Returns result of flow stop.