Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ArtNetID = [8]byte{'A', 'r', 't', '-', 'N', 'e', 't', 0x00}
ArtNetID is the standard 8-byte identifier for all Art-Net packets.
Functions ¶
This section is empty.
Types ¶
type ArtDmx ¶
type ArtDmx struct {
Header
ProtVerH byte // High byte of the protocol version (should be 14)
ProtVerL byte // Low byte of the protocol version (should be 14)
Sequence byte // The sequence number, used to ensure packets are processed in order
Physical byte // The physical DMX port of the sender
SubUni byte // The low 4 bits are the Sub-Net, high 4 bits are the Universe
Net byte // The high 8 bits of the 15-bit universe address
LengthH byte // High byte of the DMX data length (1-512)
LengthL byte // Low byte of the DMX data length (1-512)
Data [512]byte
}
ArtDmx is an Art-Net DMX packet. It is used to send DMX512 data to a node.
func (*ArtDmx) MarshalBinary ¶
MarshalBinary marshals the ArtDmx packet into a binary byte slice.
func (*ArtDmx) UnmarshalBinary ¶
UnmarshalBinary unmarshals a binary byte slice into the ArtDmx packet.
type ArtPoll ¶
ArtPoll is an Art-Net ArtPoll packet. It is used to discover other Art-Net nodes on the network.
func (*ArtPoll) MarshalBinary ¶
MarshalBinary marshals the ArtPoll packet into a binary byte slice.
func (*ArtPoll) UnmarshalBinary ¶
UnmarshalBinary unmarshals a binary byte slice into the ArtPoll packet.
type ArtPollReply ¶
type ArtPollReply struct {
Header
IPAddress [4]byte
Port uint16
VersionInfo uint16
NetSwitch byte
SubSwitch byte
Oem uint16
UbeaVersion byte
Status1 byte
EstaMan uint16
ShortName [18]byte
LongName [64]byte
ProgReport [64]byte
NumPorts uint16
PortTypes [4]byte
GoodInput [4]byte
GoodOutput [4]byte
Swin [4]byte
Swout [4]byte
SwVideo byte
SwMacro byte
SwRemote byte
Spare [3]byte // Not used, set to 0
Style byte
MAC [6]byte
BindIP [4]byte
BindIndex byte
Status2 byte
Filler [26]byte // Not used, set to 0
}
ArtPollReply is an Art-Net ArtPollReply packet. It is sent by a node in response to an ArtPoll packet. This packet is used to provide detailed information about the node.
func (*ArtPollReply) MarshalBinary ¶
func (p *ArtPollReply) MarshalBinary() ([]byte, error)
MarshalBinary marshals the ArtPollReply packet into a binary byte slice.
func (*ArtPollReply) OpCode ¶
func (p *ArtPollReply) OpCode() OpCode
OpCode returns the OpCode for the ArtPollReply packet.
func (*ArtPollReply) UnmarshalBinary ¶
func (p *ArtPollReply) UnmarshalBinary(data []byte) error
UnmarshalBinary unmarshals a binary byte slice into the ArtPollReply packet.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller is the main entry point for the library. It manages a UDP connection and handles sending and receiving Art-Net packets.
func NewController ¶
func NewController(destIP string) (*Controller, error)
NewController creates a new Art-Net controller. It binds to the default Art-Net port (6454) on all available network interfaces and sets the destination address for sending packets.
func (*Controller) C ¶
func (c *Controller) C() <-chan Packet
C returns a read-only channel for receiving parsed Art-Net packets.
func (*Controller) Close ¶
func (c *Controller) Close()
Close closes the UDP connection and stops the listener loop.
func (*Controller) Send ¶
func (c *Controller) Send(packet Packet) error
Send sends an Art-Net packet to the destination address.
type Header ¶
Header represents the constant header for all Art-Net packets. It contains the 8-byte ID and the 2-byte OpCode.
type OpCode ¶
type OpCode uint16
OpCode is the Art-Net operation code. It defines the type of the Art-Net packet.
const ( OpPoll OpCode = 0x2000 OpPollReply OpCode = 0x2100 OpDmx OpCode = 0x5000 OpNzs OpCode = 0x5100 OpSync OpCode = 0x5200 OpAddress OpCode = 0x6000 OpInput OpCode = 0x7000 OpTodRequest OpCode = 0x8000 OpTodData OpCode = 0x8100 OpTodControl OpCode = 0x8200 OpRdm OpCode = 0x8300 OpRdmSub OpCode = 0x8400 OpVideoSetup OpCode = 0xa010 OpVideoPalette OpCode = 0xa020 OpVideoData OpCode = 0xa040 OpFirmwareMaster OpCode = 0xf200 OpFirmwareReply OpCode = 0xf300 OpIpProg OpCode = 0xf800 OpIpProgReply OpCode = 0xf900 OpMedia OpCode = 0x9000 OpMediaPatch OpCode = 0x9100 OpMediaControl OpCode = 0x9200 OpMediaContrlReply OpCode = 0x9300 OpTimecode OpCode = 0x9700 OpTrigger OpCode = 0x9900 OpDirectory OpCode = 0x9a00 OpDirectoryReply OpCode = 0x9b00 )
Art-Net OpCodes
type Packet ¶
type Packet interface {
// OpCode returns the operation code for the packet.
OpCode() OpCode
// MarshalBinary marshals the packet struct into a binary byte slice.
MarshalBinary() ([]byte, error)
// UnmarshalBinary unmarshals a binary byte slice into the packet struct.
UnmarshalBinary(data []byte) error
}
Packet is the interface that all Art-Net packet types must implement. This provides a standard way to handle and marshal different packet types.