remove constants from packet structs

This commit is contained in:
Joel Wetzell
2026-05-30 08:56:07 -05:00
parent f3b6a6ef1b
commit c0701537b6
20 changed files with 389 additions and 678 deletions
+54 -126
View File
@@ -17,234 +17,162 @@ func TestGoodArtTodRequestUnmarshal(t *testing.T) {
Name: "ACT Packet 1",
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x80, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 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.ArtTodRequest{
ID: artnet.ArtNetID,
OpCode: artnet.OpTodRequest,
ProtVerHi: 0x00,
ProtVerLo: 0x0e,
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x00},
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x00},
},
},
{
Name: "ACT Packet 2",
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x80, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 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.ArtTodRequest{
ID: artnet.ArtNetID,
OpCode: artnet.OpTodRequest,
ProtVerHi: 0x00,
ProtVerLo: 0x0e,
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
},
},
{
Name: "ACT Packet 3",
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x80, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 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.ArtTodRequest{
ID: artnet.ArtNetID,
OpCode: artnet.OpTodRequest,
ProtVerHi: 0x00,
ProtVerLo: 0x0e,
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
},
},
{
Name: "ACT Packet 4",
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x80, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 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.ArtTodRequest{
ID: artnet.ArtNetID,
OpCode: artnet.OpTodRequest,
ProtVerHi: 0x00,
ProtVerLo: 0x0e,
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
},
},
{
Name: "ACT Packet 5",
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x80, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 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.ArtTodRequest{
ID: artnet.ArtNetID,
OpCode: artnet.OpTodRequest,
ProtVerHi: 0x00,
ProtVerLo: 0x0e,
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
},
},
{
Name: "ACT Packet 6",
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x80, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 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.ArtTodRequest{
ID: artnet.ArtNetID,
OpCode: artnet.OpTodRequest,
ProtVerHi: 0x00,
ProtVerLo: 0x0e,
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
},
},
{
Name: "ACT Packet 7",
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x80, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 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.ArtTodRequest{
ID: artnet.ArtNetID,
OpCode: artnet.OpTodRequest,
ProtVerHi: 0x00,
ProtVerLo: 0x0e,
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
},
},
{
Name: "ACT Packet 8",
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x80, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 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.ArtTodRequest{
ID: artnet.ArtNetID,
OpCode: artnet.OpTodRequest,
ProtVerHi: 0x00,
ProtVerLo: 0x0e,
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
},
},
{
Name: "ACT Packet 9",
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x80, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 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.ArtTodRequest{
ID: artnet.ArtNetID,
OpCode: artnet.OpTodRequest,
ProtVerHi: 0x00,
ProtVerLo: 0x0e,
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
},
},
{
Name: "ACT Packet 10",
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x80, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 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.ArtTodRequest{
ID: artnet.ArtNetID,
OpCode: artnet.OpTodRequest,
ProtVerHi: 0x00,
ProtVerLo: 0x0e,
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
},
},
{
Name: "ACT Packet 11",
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x80, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 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.ArtTodRequest{
ID: artnet.ArtNetID,
OpCode: artnet.OpTodRequest,
ProtVerHi: 0x00,
ProtVerLo: 0x0e,
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
},
},
{
Name: "ACT Packet 12",
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x80, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 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, 0x00},
Expected: &artnet.ArtTodRequest{
ID: artnet.ArtNetID,
OpCode: artnet.OpTodRequest,
ProtVerHi: 0x00,
ProtVerLo: 0x0e,
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
},
},
{
Name: "ACT Packet 13",
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x80, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 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, 0x00, 0x00},
Expected: &artnet.ArtTodRequest{
ID: artnet.ArtNetID,
OpCode: artnet.OpTodRequest,
ProtVerHi: 0x00,
ProtVerLo: 0x0e,
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
},
},
{
Name: "ACT Packet 14",
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x80, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 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, 0x00, 0x00, 0x00},
Expected: &artnet.ArtTodRequest{
ID: artnet.ArtNetID,
OpCode: artnet.OpTodRequest,
ProtVerHi: 0x00,
ProtVerLo: 0x0e,
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
},
},
{
Name: "ACT Packet 15",
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x80, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 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, 0x00, 0x00, 0x00, 0x00},
Expected: &artnet.ArtTodRequest{
ID: artnet.ArtNetID,
OpCode: artnet.OpTodRequest,
ProtVerHi: 0x00,
ProtVerLo: 0x0e,
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
},
},
{
Name: "ACT Packet 16",
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x80, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 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, 0x00, 0x00, 0x00, 0x00, 0x00},
Expected: &artnet.ArtTodRequest{
ID: artnet.ArtNetID,
OpCode: artnet.OpTodRequest,
ProtVerHi: 0x00,
ProtVerLo: 0x0e,
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
},
},
{
Name: "ACT Packet 17",
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x80, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
Expected: &artnet.ArtTodRequest{
ID: artnet.ArtNetID,
OpCode: artnet.OpTodRequest,
ProtVerHi: 0x00,
ProtVerLo: 0x0e,
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
},
},
{
Name: "ACT Packet 18",
Data: []byte{0x41, 0x72, 0x74, 0x2d, 0x4e, 0x65, 0x74, 0x00, 0x00, 0x80, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
Expected: &artnet.ArtTodRequest{
ID: artnet.ArtNetID,
OpCode: artnet.OpTodRequest,
ProtVerHi: 0x00,
ProtVerLo: 0x0e,
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
Command: artnet.TodFull,
Net: 0x00,
Address: []uint8{0x10},
},
},
}