Documentation
¶
Index ¶
- type DataPacket
- func (d *DataPacket) CID() [16]byte
- func (d *DataPacket) Data() []byte
- func (d *DataPacket) DmxStartCode() byte
- func (d *DataPacket) ForceSync() bool
- func (d *DataPacket) PreviewData() bool
- func (d *DataPacket) Priority() byte
- func (d *DataPacket) Sequence() byte
- func (d *DataPacket) SequenceIncr()
- func (d *DataPacket) SetCID(cid [16]byte)
- func (d *DataPacket) SetData(data []byte)
- func (d *DataPacket) SetDmxStartCode(startCode byte)
- func (d *DataPacket) SetForceSync(value bool)
- func (d *DataPacket) SetPreviewData(value bool)
- func (d *DataPacket) SetPriority(prio byte) error
- func (d *DataPacket) SetSequence(sequ byte)
- func (d *DataPacket) SetSourceName(s string)
- func (d *DataPacket) SetStreamTerminated(value bool)
- func (d *DataPacket) SetSyncAddress(sync uint16)
- func (d *DataPacket) SetUniverse(universe uint16)
- func (d *DataPacket) SourceName() string
- func (d *DataPacket) StreamTerminated() bool
- func (d *DataPacket) SyncAddress() uint16
- func (d *DataPacket) Universe() uint16
- type Receiver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataPacket ¶
type DataPacket struct {
// contains filtered or unexported fields
}
DataPacket is a byte array with unspecific length
func NewDataPacket ¶
func NewDataPacket() DataPacket
NewDataPacket creates a new DataPacket with an empty 638-length byte slice
func NewDataPacketRaw ¶
func NewDataPacketRaw(raw []byte) (DataPacket, error)
NewDataPacketRaw creates a new DataPacket based on the given raw bytes
func (*DataPacket) CID ¶
func (d *DataPacket) CID() [16]byte
CID returns the cid that is set for this object
func (*DataPacket) Data ¶
func (d *DataPacket) Data() []byte
Data returns the DMX data that is set for this DataPacket. Length: [0-512]
func (*DataPacket) DmxStartCode ¶
func (d *DataPacket) DmxStartCode() byte
DmxStartCode return the start code of the given packet
func (*DataPacket) ForceSync ¶
func (d *DataPacket) ForceSync() bool
ForceSync returns the state of the force_synchronization flag
func (*DataPacket) PreviewData ¶
func (d *DataPacket) PreviewData() bool
PreviewData returns wether this packet has the preview flag set
func (*DataPacket) Priority ¶
func (d *DataPacket) Priority() byte
Priority returns the byte value of the priorty field of the packet. Value range: [0-200]
func (*DataPacket) Sequence ¶
func (d *DataPacket) Sequence() byte
Sequence returns the sequence number of the packet
func (*DataPacket) SequenceIncr ¶
func (d *DataPacket) SequenceIncr()
SequenceIncr increments the sequence number
func (*DataPacket) SetCID ¶
func (d *DataPacket) SetCID(cid [16]byte)
SetCID sets the CID unique identifier
func (*DataPacket) SetData ¶
func (d *DataPacket) SetData(data []byte)
SetData sets the dmx data for the given DataPacket
func (*DataPacket) SetDmxStartCode ¶
func (d *DataPacket) SetDmxStartCode(startCode byte)
SetDmxStartCode sets the DMX start code that is transmitted together with the DMX data
func (*DataPacket) SetForceSync ¶
func (d *DataPacket) SetForceSync(value bool)
SetForceSync sets the force_synchronization bit flag
func (*DataPacket) SetPreviewData ¶
func (d *DataPacket) SetPreviewData(value bool)
SetPreviewData sets the preview_data flag in this packet to the given value
func (*DataPacket) SetPriority ¶
func (d *DataPacket) SetPriority(prio byte) error
SetPriority sets the priority field for the packet. Value must be [0-200]!
func (*DataPacket) SetSequence ¶
func (d *DataPacket) SetSequence(sequ byte)
SetSequence sets the sequence number of the packet
func (*DataPacket) SetSourceName ¶
func (d *DataPacket) SetSourceName(s string)
SetSourceName sets the source name field to the given string values. Note that only the first 64 characters are used!
func (*DataPacket) SetStreamTerminated ¶
func (d *DataPacket) SetStreamTerminated(value bool)
SetStreamTerminated sets the stream_termiantion falg on or off
func (*DataPacket) SetSyncAddress ¶
func (d *DataPacket) SetSyncAddress(sync uint16)
SetSyncAddress sets the synchronization universe for the given packet
func (*DataPacket) SetUniverse ¶
func (d *DataPacket) SetUniverse(universe uint16)
SetUniverse sets the universe value of the packet
func (*DataPacket) SourceName ¶
func (d *DataPacket) SourceName() string
SourceName returns the stored source name. Note that the source name max length is 64!
func (*DataPacket) StreamTerminated ¶
func (d *DataPacket) StreamTerminated() bool
StreamTerminated returns the state of the stream_termination flag
func (*DataPacket) SyncAddress ¶
func (d *DataPacket) SyncAddress() uint16
SyncAddress returns the sync universe of the given packet
func (*DataPacket) Universe ¶
func (d *DataPacket) Universe() uint16
Universe returns the universe value of the packet
type Receiver ¶
type Receiver struct { DataChan chan DataPacket ErrChan chan error // contains filtered or unexported fields }
Receiver is for holding the channels for the data and the errors
func NewReceiver ¶
func NewReceiver() Receiver
NewReceiver returns a new Receiver object that can be used to listen with it
func (*Receiver) Receive ¶
Receive returns two chnnels: one for data and one for errors. the data channel only returns data from the universe that was given. parameters: universe: universe to listen on; bind: the interface on which the listener should bind to. This Receiver checks for out-of-order packets and sorts out packets with too low priority. Note: if there are two sources with the same highest priority, there will be send a "sources exceeded" error in the error channel. Furthermore: through the channel only changed data will be send. So the sequence numbers may not be in order.
func (*Receiver) ReceiveMulticast ¶
ReceiveMulticast is the same as normal Receive, but uses multicast instead. Depending on your OS you have to provide an Interface to bind to. This Receiver checks for out-of-order packets and sorts out packets with too low priority. Note: if there are two sources with the same highest priority, there will be send a "sources exceeded" error in the error channel. Furthermore: through the channel only changed data will be send. So the sequence numbers may not be in order. Note: sometimes the packetloss with multicast can be very high and so expect some unintentional timeouts and therefore closing channels