sacn

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

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

func (r *Receiver) Receive(universe uint16, bind string)

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

func (r *Receiver) ReceiveMulticast(universe uint16, ifi *net.Interface)

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

func (*Receiver) Stop

func (r *Receiver) Stop()

Stop sends a stop signal to the listener and ends the transmission of data or errors in the channels

type Transmitter added in v0.2.0

type Transmitter struct {
	// contains filtered or unexported fields
}

Transmitter : This struct is for managing the transmitting of sACN data. It handles all channels and overwatches what universes are already used.

func NewTransmitter added in v0.2.0

func NewTransmitter(binding string, cid [16]byte, sourceName string) (Transmitter, error)

NewTransmitter creates a new Transmitter object and returns it. Only use one object for one network interface. bind is a string like "192.168.2.34" or "". It is used for binding the udpconnection. In most cases an emtpy string will be sufficient. The caller is responsible for closing! If you want to use multicast, you have to provide a binding string on some operation systems (eg Windows).

func (*Transmitter) Activate added in v0.2.0

func (t *Transmitter) Activate(universe uint16) (chan<- [512]byte, error)

Activate starts sending out DMX data on the given universe. It returns a channel that accepts byte slices and transmittes them to the unicast or multicast destination. If you want to deactivate the universe, simply close the channel.

func (*Transmitter) Destinations added in v0.2.0

func (t *Transmitter) Destinations(universe uint16) []net.UDPAddr

Destinations returns all destinations that have been set via SetDestinations. Note: the returned slice contains deep copys and no change will affect the internal slice.

func (*Transmitter) IsActivated added in v0.2.0

func (t *Transmitter) IsActivated(universe uint16) bool

IsActivated checks if the given universe was activated and returns true if this is the case

func (*Transmitter) SetDestinations added in v0.2.0

func (t *Transmitter) SetDestinations(universe uint16, destinations []string) []error

SetDestinations sets a slice of destinations for the universe that is used for sending out. So multiple destinations are supported. Note: the exisitng slice will be overwritten! If you want no unicasting, just set an empty slice. If there is a string that could not be converted to an ip-address, this one is left out and an error slice will be returned, but the indices of the errors are not the same as the string indices on which the errors happended.

func (*Transmitter) SetMulticast added in v0.2.0

func (t *Transmitter) SetMulticast(universe uint16, multicast bool)

SetMulticast is for setting wether or not a universe should be send out via multicast. Keep in mind, that on some operating systems you have to provide a bind address.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL