Documentation
¶
Index ¶
- Constants
- func Extract(serialData []byte) (msg messages.EnttecDMXUSBProApplicationMessage, err error)
- type EnttecDMXUSBProController
- func (d *EnttecDMXUSBProController) ClearStage()
- func (d *EnttecDMXUSBProController) Commit() error
- func (d *EnttecDMXUSBProController) Connect() error
- func (d *EnttecDMXUSBProController) Disconnect() error
- func (d *EnttecDMXUSBProController) GetName() string
- func (d *EnttecDMXUSBProController) GetStage() []byte
- func (d *EnttecDMXUSBProController) OnDMXChange(c chan messages.EnttecDMXUSBProApplicationMessage)
- func (d *EnttecDMXUSBProController) Read(buf []byte) (int, error)
- func (d *EnttecDMXUSBProController) Stage(channel int16, value byte) error
- func (d *EnttecDMXUSBProController) SwitchReadMode(changesOnly byte) error
- func (d *EnttecDMXUSBProController) Write(buf []byte) (int, error)
Constants ¶
const ( // Maximum DMX channels we can control (fixed size in this implementation) DMX_MAX_CHANNELS = 16 // Data length = Channels + 1 as DMX works 1-indexed [not 0-indexed] DMX_DATA_LENGTH = DMX_MAX_CHANNELS + 1 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EnttecDMXUSBProController ¶
type EnttecDMXUSBProController struct {
// contains filtered or unexported fields
}
Controller for Enttec DMX USB Pro device to handle communication
func NewEnttecDMXUSBProController ¶
func NewEnttecDMXUSBProController(conf *serial.Config, isWriter bool) *EnttecDMXUSBProController
Helper function for creating a new DMX USB PRO controller
func (*EnttecDMXUSBProController) ClearStage ¶
func (d *EnttecDMXUSBProController) ClearStage()
Set all values of the staged channels to '0'
func (*EnttecDMXUSBProController) Commit ¶
func (d *EnttecDMXUSBProController) Commit() error
Apply the 'staged' values to go live.
Note: This does not clear the Stage!
func (*EnttecDMXUSBProController) Connect ¶
func (d *EnttecDMXUSBProController) Connect() error
Open the serial connection to Enttec DMX USB PRO Widget
Succeeded if no error is returned
func (*EnttecDMXUSBProController) Disconnect ¶
func (d *EnttecDMXUSBProController) Disconnect() error
Close the serial connection to Enttec DMX USB PRO Widget
Succeeded if no error is returned
func (*EnttecDMXUSBProController) GetName ¶
func (d *EnttecDMXUSBProController) GetName() string
Returns the name used for opening the connection
e.g. "COM4" or "/dev/tty.usbserial"
func (*EnttecDMXUSBProController) GetStage ¶
func (d *EnttecDMXUSBProController) GetStage() []byte
Gets a copy of all staged channel values
func (*EnttecDMXUSBProController) OnDMXChange ¶
func (d *EnttecDMXUSBProController) OnDMXChange(c chan messages.EnttecDMXUSBProApplicationMessage)
Start routine to read from DMX and get the results back via channel
Example useage:
controller.SwitchReadMode(1) // read changes only
c := make(chan messages.EnttecDMXUSBProApplicationMessage) // create channel
go controller.OnDMXChange(c) // start routine
for msg := range c { ... } // handle incoming data
func (*EnttecDMXUSBProController) Read ¶
func (d *EnttecDMXUSBProController) Read(buf []byte) (int, error)
Expose serial read to be used directly
func (*EnttecDMXUSBProController) Stage ¶
func (d *EnttecDMXUSBProController) Stage(channel int16, value byte) error
Prepare a channel to be changed to the given value
Note: This does not send out the changes, you must call the 'Commit' method to apply the stage live.
func (*EnttecDMXUSBProController) SwitchReadMode ¶
func (d *EnttecDMXUSBProController) SwitchReadMode(changesOnly byte) error
Change the receive mode of the widget.
Setting it to '0' will allow reading always and reads everything
Setting it to '1' will only read when the data changes and only reads the changeset (label=9)