mirror of
https://github.com/jwetzell/artnet-go.git
synced 2026-09-02 04:18:59 +00:00
remove constants from packet structs
This commit is contained in:
+125
-110
@@ -17,170 +17,185 @@ func TestGoodArtPollUnmarshal(t *testing.T) {
|
||||
Name: "ACT Packet 1",
|
||||
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x20, 0x00, 0x0e, 0x00, 0x00},
|
||||
Expected: &artnet.ArtPoll{
|
||||
ID: artnet.ArtNetID,
|
||||
OpCode: 0x2000,
|
||||
ProtVerHi: 0x00,
|
||||
ProtVerLo: 0x0e,
|
||||
Flags: 0x00,
|
||||
DiagPriority: 0x00,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "ACT Packet 2",
|
||||
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x20, 0x00, 0x0e, 0x00, 0x00, 0x7f},
|
||||
Expected: &artnet.ArtPoll{
|
||||
ID: artnet.ArtNetID,
|
||||
OpCode: 0x2000,
|
||||
ProtVerHi: 0x00,
|
||||
ProtVerLo: 0x0e,
|
||||
Flags: 0x00,
|
||||
DiagPriority: 0x00,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "ACT Packet 3",
|
||||
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x20, 0x00, 0x0e, 0x00, 0x00, 0x7f, 0xff},
|
||||
Expected: &artnet.ArtPoll{
|
||||
ID: artnet.ArtNetID,
|
||||
OpCode: 0x2000,
|
||||
ProtVerHi: 0x00,
|
||||
ProtVerLo: 0x0e,
|
||||
Flags: 0x00,
|
||||
DiagPriority: 0x00,
|
||||
TargetPortAddressTop: 0x7fff,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "ACT Packet 4",
|
||||
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x20, 0x00, 0x0e, 0x00, 0x00, 0x7f, 0xff, 0x00},
|
||||
Expected: &artnet.ArtPoll{
|
||||
ID: artnet.ArtNetID,
|
||||
OpCode: 0x2000,
|
||||
ProtVerHi: 0x00,
|
||||
ProtVerLo: 0x0e,
|
||||
Flags: 0x00,
|
||||
DiagPriority: 0x00,
|
||||
TargetPortAddressTop: 0x7fff,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "ACT Packet 5",
|
||||
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x20, 0x00, 0x0e, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00},
|
||||
Expected: &artnet.ArtPoll{
|
||||
ID: artnet.ArtNetID,
|
||||
OpCode: 0x2000,
|
||||
ProtVerHi: 0x00,
|
||||
ProtVerLo: 0x0e,
|
||||
Flags: 0x00,
|
||||
DiagPriority: 0x00,
|
||||
TargetPortAddressTop: 0x7fff,
|
||||
TargetPortAddressBottom: 0x0000,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "ACT Packet 6",
|
||||
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x20, 0x00, 0x0e, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0x53},
|
||||
Expected: &artnet.ArtPoll{
|
||||
ID: artnet.ArtNetID,
|
||||
OpCode: 0x2000,
|
||||
ProtVerHi: 0x00,
|
||||
ProtVerLo: 0x0e,
|
||||
Flags: 0x00,
|
||||
DiagPriority: 0x00,
|
||||
TargetPortAddressTop: 0x7fff,
|
||||
TargetPortAddressBottom: 0x0000,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "ACT Packet 7",
|
||||
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x20, 0x00, 0x0e, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0x53, 0x79},
|
||||
Expected: &artnet.ArtPoll{
|
||||
ID: artnet.ArtNetID,
|
||||
OpCode: 0x2000,
|
||||
ProtVerHi: 0x00,
|
||||
ProtVerLo: 0x0e,
|
||||
Flags: 0x00,
|
||||
DiagPriority: 0x00,
|
||||
TargetPortAddressTop: 0x7fff,
|
||||
TargetPortAddressBottom: 0x0000,
|
||||
EstaMan: 0x5379,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "ACT Packet 8",
|
||||
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x20, 0x00, 0x0e, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0x53, 0x79, 0x22},
|
||||
Expected: &artnet.ArtPoll{
|
||||
ID: artnet.ArtNetID,
|
||||
OpCode: 0x2000,
|
||||
ProtVerHi: 0x00,
|
||||
ProtVerLo: 0x0e,
|
||||
Flags: 0x00,
|
||||
DiagPriority: 0x00,
|
||||
TargetPortAddressTop: 0x7fff,
|
||||
TargetPortAddressBottom: 0x0000,
|
||||
EstaMan: 0x5379,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "ACT Packet 9",
|
||||
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x20, 0x00, 0x0e, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0x53, 0x79, 0x22, 0x69},
|
||||
Expected: &artnet.ArtPoll{
|
||||
ID: artnet.ArtNetID,
|
||||
OpCode: 0x2000,
|
||||
ProtVerHi: 0x00,
|
||||
ProtVerLo: 0x0e,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "ACT Packet 10",
|
||||
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x20, 0x00, 0x0e, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0x53, 0x79, 0x22, 0x69, 0x00},
|
||||
Expected: &artnet.ArtPoll{
|
||||
ID: artnet.ArtNetID,
|
||||
OpCode: 0x2000,
|
||||
ProtVerHi: 0x00,
|
||||
ProtVerLo: 0x0e,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "ACT Packet 11",
|
||||
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x20, 0x00, 0x0e, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0x53, 0x79, 0x22, 0x69, 0x00, 0x00},
|
||||
Expected: &artnet.ArtPoll{
|
||||
ID: artnet.ArtNetID,
|
||||
OpCode: 0x2000,
|
||||
ProtVerHi: 0x00,
|
||||
ProtVerLo: 0x0e,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "ACT Packet 12",
|
||||
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x20, 0x00, 0x0e, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0x53, 0x79, 0x22, 0x69, 0x00, 0x00, 0x00},
|
||||
Expected: &artnet.ArtPoll{
|
||||
ID: artnet.ArtNetID,
|
||||
OpCode: 0x2000,
|
||||
ProtVerHi: 0x00,
|
||||
ProtVerLo: 0x0e,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "ACT Packet 13",
|
||||
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x20, 0x00, 0x0e, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0x53, 0x79, 0x22, 0x69, 0x00, 0x00, 0x00, 0x00},
|
||||
Expected: &artnet.ArtPoll{
|
||||
ID: artnet.ArtNetID,
|
||||
OpCode: 0x2000,
|
||||
ProtVerHi: 0x00,
|
||||
ProtVerLo: 0x0e,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "ACT Packet 14",
|
||||
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x20, 0x00, 0x0e, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0x53, 0x79, 0x22, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
Expected: &artnet.ArtPoll{
|
||||
ID: artnet.ArtNetID,
|
||||
OpCode: 0x2000,
|
||||
ProtVerHi: 0x00,
|
||||
ProtVerLo: 0x0e,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "ACT Packet 15",
|
||||
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x20, 0x00, 0x0e, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0x53, 0x79, 0x22, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
Expected: &artnet.ArtPoll{
|
||||
ID: artnet.ArtNetID,
|
||||
OpCode: 0x2000,
|
||||
ProtVerHi: 0x00,
|
||||
ProtVerLo: 0x0e,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "ACT Packet 16",
|
||||
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x20, 0x00, 0x0e, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0x53, 0x79, 0x22, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x21, 0x0a, 0x00, 0x00, 0x3e, 0x36, 0x19, 0x07, 0x33, 0x00, 0x06, 0x22, 0x69, 0x00, 0x00, 0x79, 0x53, 0x41, 0x43, 0x54, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x43, 0x54, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
Expected: &artnet.ArtPoll{
|
||||
ID: artnet.ArtNetID,
|
||||
OpCode: 0x2000,
|
||||
ProtVerHi: 0x00,
|
||||
ProtVerLo: 0x0e,
|
||||
Flags: 0x00,
|
||||
DiagPriority: 0x00,
|
||||
TargetPortAddressTop: 0x7fff,
|
||||
TargetPortAddressBottom: 0x0000,
|
||||
EstaMan: 0x5379,
|
||||
Oem: 0x2269,
|
||||
},
|
||||
},
|
||||
// TODO(jwetzell): uncomment when extend field parsing is done
|
||||
// {
|
||||
// Name: "ACT Packet 10",
|
||||
// Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x20, 0x00, 0x0e, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0x53, 0x79, 0x22, 0x69, 0x00},
|
||||
// Expected: &artnet.ArtPoll{
|
||||
// Flags: 0x00,
|
||||
// DiagPriority: 0x00,
|
||||
// TargetPortAddressTop: 0x7fff,
|
||||
// TargetPortAddressBottom: 0x0000,
|
||||
// EstaMan: 0x5379,
|
||||
// Oem: 0x2269,
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// Name: "ACT Packet 11",
|
||||
// Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x20, 0x00, 0x0e, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0x53, 0x79, 0x22, 0x69, 0x00, 0x00},
|
||||
// Expected: &artnet.ArtPoll{
|
||||
// Flags: 0x00,
|
||||
// DiagPriority: 0x00,
|
||||
// TargetPortAddressTop: 0x7fff,
|
||||
// TargetPortAddressBottom: 0x0000,
|
||||
// EstaMan: 0x5379,
|
||||
// Oem: 0x2269,
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// Name: "ACT Packet 12",
|
||||
// Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x20, 0x00, 0x0e, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0x53, 0x79, 0x22, 0x69, 0x00, 0x00, 0x00},
|
||||
// Expected: &artnet.ArtPoll{
|
||||
// Flags: 0x00,
|
||||
// DiagPriority: 0x00,
|
||||
// TargetPortAddressTop: 0x7fff,
|
||||
// TargetPortAddressBottom: 0x0000,
|
||||
// EstaMan: 0x5379,
|
||||
// Oem: 0x2269,
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// Name: "ACT Packet 13",
|
||||
// Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x20, 0x00, 0x0e, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0x53, 0x79, 0x22, 0x69, 0x00, 0x00, 0x00, 0x00},
|
||||
// Expected: &artnet.ArtPoll{
|
||||
// Flags: 0x00,
|
||||
// DiagPriority: 0x00,
|
||||
// TargetPortAddressTop: 0x7fff,
|
||||
// TargetPortAddressBottom: 0x0000,
|
||||
// EstaMan: 0x5379,
|
||||
// Oem: 0x2269,
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// Name: "ACT Packet 14",
|
||||
// Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x20, 0x00, 0x0e, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0x53, 0x79, 0x22, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
// Expected: &artnet.ArtPoll{
|
||||
// Flags: 0x00,
|
||||
// DiagPriority: 0x00,
|
||||
// TargetPortAddressTop: 0x7fff,
|
||||
// TargetPortAddressBottom: 0x0000,
|
||||
// EstaMan: 0x5379,
|
||||
// Oem: 0x2269,
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// Name: "ACT Packet 15",
|
||||
// Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x20, 0x00, 0x0e, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0x53, 0x79, 0x22, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
// Expected: &artnet.ArtPoll{
|
||||
// Flags: 0x00,
|
||||
// DiagPriority: 0x00,
|
||||
// TargetPortAddressTop: 0x7fff,
|
||||
// TargetPortAddressBottom: 0x0000,
|
||||
// EstaMan: 0x5379,
|
||||
// Oem: 0x2269,
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// Name: "ACT Packet 16",
|
||||
// Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x20, 0x00, 0x0e, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0x53, 0x79, 0x22, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x21, 0x0a, 0x00, 0x00, 0x3e, 0x36, 0x19, 0x07, 0x33, 0x00, 0x06, 0x22, 0x69, 0x00, 0x00, 0x79, 0x53, 0x41, 0x43, 0x54, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x43, 0x54, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
// Expected: &artnet.ArtPoll{
|
||||
// Flags: 0x00,
|
||||
// DiagPriority: 0x00,
|
||||
// TargetPortAddressTop: 0x7fff,
|
||||
// TargetPortAddressBottom: 0x0000,
|
||||
// EstaMan: 0x5379,
|
||||
// Oem: 0x2269,
|
||||
// },
|
||||
// },
|
||||
{
|
||||
Name: "ACT Packet 17",
|
||||
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x20, 0x00, 0x0e, 0x06, 0x00, 0x7f, 0xff, 0x00, 0x00, 0x53, 0x79, 0x22, 0x69},
|
||||
Expected: &artnet.ArtPoll{
|
||||
ID: artnet.ArtNetID,
|
||||
OpCode: 0x2000,
|
||||
ProtVerHi: 0x00,
|
||||
ProtVerLo: 0x0e,
|
||||
Flags: 0x06,
|
||||
DiagPriority: 0x00,
|
||||
TargetPortAddressTop: 0x7fff,
|
||||
TargetPortAddressBottom: 0x0000,
|
||||
EstaMan: 0x5379,
|
||||
Oem: 0x2269,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user