Liking cljdoc? Tell your friends :D

clj-artnet.impl.protocol.triggers

ArtTrigger and ArtCommand processing per Art-Net 4 specification.

Art-Net 4 §ArtTrigger mandates:

  • OEM filtering: Accept trigger if OEM = 0xFFFF or matches node's OEM
  • Key types 0-3: KeyAscii, KeyMacro, KeySoft, KeyShow
  • Key types 4-255: Undefined (pass to vendor callback if OEM != 0xFFFF)
  • Payload (512 bytes): Interpretation depends on OEM/Key

This module provides pure functions for:

  • Trigger debouncing with configurable rate limiting
  • OEM-based target filtering
  • Key/SubKey interpretation and acknowledgement generation
  • Helper dispatch for registered trigger handlers
ArtTrigger and ArtCommand processing per Art-Net 4 specification.

Art-Net 4 §ArtTrigger mandates:
- OEM filtering: Accept trigger if OEM = 0xFFFF or matches node's OEM
- Key types 0-3: KeyAscii, KeyMacro, KeySoft, KeyShow
- Key types 4-255: Undefined (pass to vendor callback if OEM != 0xFFFF)
- Payload (512 bytes): Interpretation depends on OEM/Key

This module provides pure functions for:
- Trigger debouncing with configurable rate limiting
- OEM-based target filtering
- Key/SubKey interpretation and acknowledgement generation
- Helper dispatch for registered trigger handlers
raw docstring

allow?clj

(allow? state info now)

Check if a trigger should be allowed based on a debounced interval. Returns [next-state allowed?] where:

  • next-state has updated history if allowed
  • allowed? is true if trigger passed rate limiting

The history is pruned to remove entries older than (interval * max-age-multiplier).

Check if a trigger should be allowed based on a debounced interval.
Returns [next-state allowed?] where:
- next-state has updated history if allowed
- allowed? is true if trigger passed rate limiting

The history is pruned to remove entries older than (interval * max-age-multiplier).
sourceraw docstring

apply-artcommand-directivesclj

(apply-artcommand-directives state packet)

Apply ArtCommand directives to update command labels in the state.

Takes state and packet, parses directives from packet :text, and applies SwoutText/SwinText changes to :command-labels in state.

Returns map with:

  • :state - Updated state with new :command-labels if changed
  • :directives - Parsed directive vector
  • :acks - Acknowledgement messages for diagnostics
  • :changes - Map of changed labels (nil if none)
Apply ArtCommand directives to update command labels in the state.

Takes state and packet, parses directives from packet :text, and applies
SwoutText/SwinText changes to :command-labels in state.

Returns map with:
- :state - Updated state with new :command-labels if changed
- :directives - Parsed directive vector
- :acks - Acknowledgement messages for diagnostics
- :changes - Map of changed labels (nil if none)
sourceraw docstring

canonical-trigger-kindclj

(canonical-trigger-kind value)
source

command-target?clj

(command-target? state packet)

Check if the node should accept ArtCommand based on ESTA code. Per §ArtCommand: Accept if ESTA = 0xFFFF or matches node's ESTA.

Check if the node should accept ArtCommand based on ESTA code.
Per §ArtCommand: Accept if ESTA = 0xFFFF or matches node's ESTA.
sourceraw docstring

default-min-interval-nsclj

source

helper-actionclj

(helper-action state info packet sender)

Find and invoke a registered helper function for the trigger. Returns callback effect map or nil if no helper is registered. The returned effect has :helper? true to mark it as a helper callback that should be returned in an actions list for the caller to invoke.

Find and invoke a registered helper function for the trigger.
Returns callback effect map or nil if no helper is registered.
The returned effect has :helper? true to mark it as a helper callback
that should be returned in an actions list for the caller to invoke.
sourceraw docstring

history-keyclj

(history-key info)

Generate a unique key for tracking trigger history. Returns nil if info is nil. For vendor triggers: [:vendor oem key sub-key] For standard triggers: [kind sub-key]

Generate a unique key for tracking trigger history.
Returns nil if info is nil.
For vendor triggers: [:vendor oem key sub-key]
For standard triggers: [kind sub-key]
sourceraw docstring

history-max-age-multiplierclj

source

interpret-infoclj

(interpret-info packet)

Interpret ArtTrigger packet into structured trigger info. Per Table 7:

  • Key 0: KeyAscii - SubKey is an ASCII character
  • Key 1: KeyMacro - SubKey is a macro number
  • Key 2: KeySoft - SubKey is a soft-key number
  • Key 3: KeyShow - SubKey is a show number
  • Key 4-255: Undefined (treated as vendor if OEM != 0xFFFF)

Returns a map with :kind, :key, :sub-key, and :ack for diagnostics.

Interpret ArtTrigger packet into structured trigger info.
Per Table 7:
- Key 0: KeyAscii - SubKey is an ASCII character
- Key 1: KeyMacro - SubKey is a macro number
- Key 2: KeySoft - SubKey is a soft-key number
- Key 3: KeyShow - SubKey is a show number
- Key 4-255: Undefined (treated as vendor if OEM != 0xFFFF)

Returns a map with :kind, :key, :sub-key, and :ack for diagnostics.
sourceraw docstring

nanos-per-secondclj

source

normalize-configclj

(normalize-config triggers)
source

parse-artcommand-textclj

(parse-artcommand-text text)

Parse ArtCommand text into a sequence of directive maps. ArtCommand text format: 'key=value&key2=value2'

Recognized commands:

  • SwoutText: Set the SwOut (playback) label
  • SwinText: Set the SwIn (record) label

Returns vector of maps with:

  • :raw - Original segment text
  • :key - Parsed key name
  • :command - Keyword (:swout-text, :swin-text) or nil if unknown
  • :value - Parsed value string
Parse ArtCommand text into a sequence of directive maps.
ArtCommand text format: 'key=value&key2=value2'

Recognized commands:
- SwoutText: Set the SwOut (playback) label
- SwinText: Set the SwIn (record) label

Returns vector of maps with:
- :raw - Original segment text
- :key - Parsed key name
- :command - Keyword (:swout-text, :swin-text) or nil if unknown
- :value - Parsed value string
sourceraw docstring

rate-limit-ackclj

(rate-limit-ack info interval-ns)

Generate an acknowledgement for a rate-limited trigger.

Generate an acknowledgement for a rate-limited trigger.
sourceraw docstring

reply-actionclj

(reply-action state packet sender)

Generate an ArtTrigger reply if configured. Returns [next-state action] where action may be nil.

Generate an ArtTrigger reply if configured.
Returns [next-state action] where action may be nil.
sourceraw docstring

sanitize-command-valueclj

(sanitize-command-value value)

Sanitize an ArtCommand label value by removing null bytes and trimming. Returns nil if the result is empty, otherwise a string <= 512 chars.

Sanitize an ArtCommand label value by removing null bytes and trimming.
Returns nil if the result is empty, otherwise a string <= 512 chars.
sourceraw docstring

target?clj

(target? state packet)

Check if node should accept trigger based on OEM code. Per §ArtTrigger: Accept if target OEM = 0xFFFF or matches node's OEM.

Check if node should accept trigger based on OEM code.
Per §ArtTrigger: Accept if target OEM = 0xFFFF or matches node's OEM.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close