clj-artnet.impl.shell.lifecycle
Node lifecycle management (Shell Layer).
Manages initialization, resource acquisition (channels, buffers), and clean shutdown of the imperative shell components. Delegates core domain logic to pure functions in the protocol layer.
build-logic-config
(build-logic-config {:keys [node network callbacks diagnostics random-delay-fn programming rdm sync data capabilities failsafe], :as config})Extracts and normalizes the logic-layer configuration map from the user-provided system configuration.
Resolves bind configuration to concrete IP and port values, merging them into node and network maps. Auto-detects MAC address from the bound network interface if not explicitly configured.
close-quietly
(close-quietly c)Closes a resource (Closeable), logging any errors instead of throwing. Safe to call with nil.
create-resource-pools
(create-resource-pools {:keys [rx-buffer tx-buffer]})Creates RX and TX buffer pools.
Returns {:rx-pool
ensure-chan-open
(ensure-chan-open ch)Closes a DatagramChannel if it is still open. Logs errors instead of throwing.
make-stop-fn
(make-stop-fn {:keys [flow rx-pool tx-pool channel]})Creates an idempotent stop function for the node system.
Returns a 0-arity function that: - Stops the async flow - Closes buffer pools - Closes network channel
open-network-channel
(open-network-channel {:keys [bind]})Opens and configures the DatagramChannel for Art-Net I/O. Binds to configured address or default (0.0.0.0:6454).
pause-flow!
(pause-flow! flow)Pauses a running flow (dynamically resolved to avoid circular deps).
resolve-bind
(resolve-bind {:keys [node bind]})Resolves bind configuration to concrete IP address and UDP port.
Returns map: :ip - a b c d IP address for ArtPollReply :port - int, UDP port for ArtPollReply (not Port-Address) :ip-source - :explicit-node, :explicit-bind, :auto-detected, :fallback :port-source - :explicit-node, :explicit-bind, :default :non-standard-port? - true if UDP port != 0x1936
resume-flow!
(resume-flow! flow)Resumes a paused flow (dynamically resolved to avoid circular deps).