ArtTrigger and ArtCommand processing per Art-Net 4 specification.
Art-Net 4 §ArtTrigger mandates:
This module provides pure functions for:
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
(allow? state info now)Check if a trigger should be allowed based on a debounced interval. Returns [next-state allowed?] where:
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).
(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:
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)
(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.
(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.
(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]
(interpret-info packet)Interpret ArtTrigger packet into structured trigger info. Per Table 7:
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.
(parse-artcommand-text text)Parse ArtCommand text into a sequence of directive maps. ArtCommand text format: 'key=value&key2=value2'
Recognized commands:
Returns vector of maps with:
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
(rate-limit-ack info interval-ns)Generate an acknowledgement for a rate-limited trigger.
Generate an acknowledgement for a rate-limited trigger.
(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.
(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.
(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.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |