Documentation
¶
Index ¶
Constants ¶
const ( // This message requests the Widget firmware to run the Widget bootstrap to enable reprogramming of the Widget firmware. LABEL_REPROGRAM_FIRMWARE_REQUEST = 1 // This message programs one Flash page of the Widget firmware. The Flash pages must be programmed in order from first to last Flash page, with the contents of the firmware binary file. LABEL_PROGRAM_FLASH_PAGE_REQUEST = 2 // The Widget sends this message to the PC on completion of the Program Flash Page request. LABEL_PROGRAM_FLASH_PAGE_REPLY = 2 // This message requests the Widget configuration. LABEL_GET_WIDGET_PARAMS_REQUEST = 3 // The Widget sends this message to the PC in response to the Get Widget Parameters request. LABEL_GET_WIDGET_PARAMS_REPLY = 3 // This message sets the Widget configuration. The Widget configuration is preserved when the Widget loses power. LABEL_SET_WIDGET_PARAMS_REQUEST = 4 // The Widget sends this message to the PC unsolicited, whenever the Widget receives a DMX or RDM packet from the DMX port, and the Receive DMX on Change mode is 'Send always'. LABEL_RECEIVED_DMX_PACKET = 5 /* This message requests the Widget to periodically send a DMX packet out of the Widget DMX port at the configured DMX output rate. This message causes the widget to leave the DMX port direction as output after each DMX packet is sent, so no DMX packets will be received as a result of this request. The periodic DMX packet output will stop and the Widget DMX port direction will change to input when the Widget receives any request message other than the Output Only Send DMX Packet request, or the Get Widget Parameters request. */ LABEL_OUTPUT_ONLY_SEND_DMX_PACKET_REQUEST = 6 // This message requests the Widget to send an RDM packet out of the Widget DMX port, and then change the DMX port direction to input, so that RDM or DMX packets can be received LABEL_SEND_RDM_PACKET_REQUEST = 7 /* This message requests the Widget send a DMX packet to the PC only when the DMX values change on the input port. By default the widget will always send, if you want to send on change it must be enabled by sending this message. This message also reinitializes the DMX receive processing, so that if change of state reception is selected, the initial received DMX data is cleared to all zeros. */ LABEL_RECEIVE_DMX_ON_CHANGE = 8 // The Widget sends one or more instances of this message to the PC unsolicited, whenever the Widget receives a changed DMX packet from the DMX port, and the Receive DMX on Change mode is 'Send on data change only'. LABEL_RECEIVED_DMX_CHANGE_OF_STATE_PACKET = 9 // This message requests the Widget serial number, which should be the same as that printed on the Widget case. LABEL_WIDGET_GET_SERIAL_NUMBER_REQUEST = 10 // The Widget sends this message to the PC in response to the Get Widget Serial Number request. LABEL_WIDGET_GET_SERIAL_NUMBER_REPLY = 10 // This message requests the Widget to send an RDM Discovery Request packet out of the Widget DMX port, and then receive an RDM Discovery Response (see Received DMX Packet). LABEL_SEND_RDM_DISCOVERY_REQUEST = 11 )
const ( // Smallest possible label-index to identify the message type SMALLEST_LABEL_INDEX = 1 // Biggest possible label-index to identify the message type BIGGEST_LABEL_INDEX = 11 )
const ( // "Start of Message" delimiter MSG_DELIM_START = 0x7E // Combined number of bytes BEFORE payload NUM_BYTES_BEFORE_PAYLOAD = 4 // "End of Message" delimiter MSG_DELIM_END = 0xE7 // Combined number of bytes AFTER payload NUM_BYTES_AFTER_PAYLOAD = 1 // Number of bytes that are not payload NUM_BYTES_WRAPPER = NUM_BYTES_BEFORE_PAYLOAD + NUM_BYTES_AFTER_PAYLOAD // Maximum data length MAXIMUM_DATA_LENGTH = 600 // Maximum number of bytes for a valid message MAXIMUM_MESSAGE_LENGTH = NUM_BYTES_WRAPPER + MAXIMUM_DATA_LENGTH )
const ( // Position of 'MSG_DELIM_START' in the byte array MSG_DELIM_START_INDEX = 0 // Position of 'label' in the byte array MSG_LABEL_INDEX = 1 // Position of 'data length LSB' in the byte array MSG_DATA_LENGTH_LSB_INDEX = 2 // Position of 'data length MSB' in the byte array MSG_DATA_LENGTH_MSB_INDEX = 3 )
Variables ¶
This section is empty.
Functions ¶
func ToChangeSet ¶
func ToChangeSet(msg EnttecDMXUSBProApplicationMessage) (map[int]byte, error)
Convert a message according to the 'Received DMX Change of State Packet' structure.
Message must have label '9' and at least 7 bytes
0 - Start Changed byte number
1 - 5 - Changed bit array, where array bit 0 is bit 0 of first byte and array bit 39 is bit 7 of last byte
6 to 45 - Changed DMX data byte array. One byte is present for each set bit in the Changed bit array
func ToDMXArray ¶ added in v0.4.0
func ToDMXArray(msg EnttecDMXUSBProApplicationMessage) ([]byte, error)
Convert a message according to the 'Received DMX Packet' structure.
Message must have label '5' and at least 1 byte
0 - DMX receive status Bit 0: 0=No error,1=Widget receive queue overflowed. Bit 1: 0=No error,1=Widget receive overrun occurred
1 - 513 - Received DMX data beginning with the start code. Get Size from overall msg size.
Types ¶
type EnttecDMXUSBProApplicationMessage ¶
type EnttecDMXUSBProApplicationMessage struct {
// contains filtered or unexported fields
}
Message as used by Enttec USB DMX Pro Widget
func FromBytes ¶
func FromBytes(raw []byte) (msg EnttecDMXUSBProApplicationMessage, err error)
Create from the byte structure, if possible
func NewEnttecDMXUSBProApplicationMessage ¶
func NewEnttecDMXUSBProApplicationMessage(label byte, payload []byte) EnttecDMXUSBProApplicationMessage
Helper function to create a new Message
func (*EnttecDMXUSBProApplicationMessage) GetLabel ¶
func (msg *EnttecDMXUSBProApplicationMessage) GetLabel() byte
Returns the message's label. See the API docs or 'labels.go' for explanations
func (*EnttecDMXUSBProApplicationMessage) GetPayload ¶
func (msg *EnttecDMXUSBProApplicationMessage) GetPayload() []byte
Return a copy of the message's payload
func (*EnttecDMXUSBProApplicationMessage) ToBytes ¶
func (msg *EnttecDMXUSBProApplicationMessage) ToBytes() ([]byte, error)
Convert the message into byte format that can be send to the widget.