reworking how I actually want to publish the telemetry data for now

This commit is contained in:
2026-03-06 14:30:52 +00:00
parent 9b10042112
commit 6e98f13eb5
4 changed files with 180 additions and 39 deletions
+17 -17
View File
@@ -17,44 +17,44 @@ func Test_TelemetryField(t *testing.T) {
{
name: "test_max_uint8",
tf: TelemetryField{
Type: DataTypeUINT8,
Value: uint8(math.MaxUint8),
Type: DataTypeUINT8,
Raw: uint64(math.MaxUint8),
},
expect: []byte{0x00, 0xFF},
},
{
name: "test_max_int8",
tf: TelemetryField{
Type: DataTypeINT8,
Value: int8(math.MaxInt8),
Type: DataTypeINT8,
Raw: uint64(math.MaxInt8),
},
expect: []byte{0x01, 0x7F},
},
{
name: "test_max_uint16",
tf: TelemetryField{
Type: DataTypeUINT16,
Value: uint16(math.MaxUint16),
Type: DataTypeUINT16,
Raw: uint64(math.MaxUint16),
},
expect: []byte{0x02, 0xFF, 0xFF},
},
{
name: "test_max_int16",
tf: TelemetryField{
Type: DataTypeINT16,
Value: int16(math.MaxInt16),
Type: DataTypeINT16,
Raw: uint64(math.MaxInt16),
},
expect: []byte{0x03, 0xFF, 0x7F},
},
{
name: "test_string",
tf: TelemetryField{
Type: DataTypeSTRING,
Value: "a cool string!",
},
expect: []byte{0x04, 0x0E, 0x61, 0x20, 0x63, 0x6F, 0x6F, 0x6C, 0x20, 0x73,
0x74, 0x72, 0x69, 0x6E, 0x67, 0x21},
},
// {
// name: "test_string",
// tf: TelemetryField{
// Type: DataTypeSTRING,
// Raw: "a cool string!",
// },
// expect: []byte{0x04, 0x0E, 0x61, 0x20, 0x63, 0x6F, 0x6F, 0x6C, 0x20, 0x73,
// 0x74, 0x72, 0x69, 0x6E, 0x67, 0x21},
// },
}
for _, test := range tests {