add read write lock to dmx data
This commit is contained in:
@@ -16,14 +16,14 @@ type Package []byte
|
||||
func NewArtNetPackage(data *DMX) Package {
|
||||
// Build ArtDMX packet
|
||||
packet := &bytes.Buffer{}
|
||||
packet.WriteString(protocolID) // Art-Net ID
|
||||
binary.Write(packet, binary.LittleEndian, uint16(opCode)) // OpCode (OpDmx)
|
||||
packet.WriteByte(0x00) // Protocol Version High
|
||||
packet.WriteByte(14) // Protocol Version Low (14 for Art-Net 4)
|
||||
packet.WriteByte(0x00) // Sequence
|
||||
packet.WriteByte(0x00) // Physical
|
||||
binary.Write(packet, binary.BigEndian, uint16(0)) // Universe (net:subuni, usually 0)
|
||||
binary.Write(packet, binary.BigEndian, uint16(len(*data))) // Length
|
||||
packet.Write(*data)
|
||||
packet.WriteString(protocolID) // Art-Net ID
|
||||
binary.Write(packet, binary.LittleEndian, uint16(opCode)) // OpCode (OpDmx)
|
||||
packet.WriteByte(0x00) // Protocol Version High
|
||||
packet.WriteByte(14) // Protocol Version Low (14 for Art-Net 4)
|
||||
packet.WriteByte(0x00) // Sequence
|
||||
packet.WriteByte(0x00) // Physical
|
||||
binary.Write(packet, binary.BigEndian, uint16(0)) // Universe (net:subuni, usually 0)
|
||||
binary.Write(packet, binary.BigEndian, uint16(len(data.Data))) // Length
|
||||
packet.Write(data.Data)
|
||||
return packet.Bytes()
|
||||
}
|
||||
|
Reference in New Issue
Block a user