diff --git a/sketch/production.cpp b/sketch/production.cpp index 53ca165..5a751b4 100644 --- a/sketch/production.cpp +++ b/sketch/production.cpp @@ -64,7 +64,7 @@ typedef struct { uint64_t addr; uint8_t index; char label[LABEL_LENGTH+1]; -} sensor_t; +} __attribute__((packed)) sensor_t; sensor_t sensors[NUM_OF_SENSORS]; @@ -144,6 +144,7 @@ void downLinkDataHandle(McpsIndication_t *mcpsIndication) Serial.print("+REV DATA:"); sensor_t downlinkSensors[NUM_OF_SENSORS]; + if (mcpsIndication->BufferSize != sizeof(downlinkSensors)) { Serial.println("illegal number of octets in downlink message"); } else { diff --git a/snippets/decoding2.txt b/snippets/decoding2.txt index 2ab22af..c2eb291 100644 --- a/snippets/decoding2.txt +++ b/snippets/decoding2.txt @@ -1,21 +1,26 @@ -0: Sens0: 000000006a4f8c28 -1: Sens1: 000000000ac31928 -2: Sens2: 000000006a863528 -3: Sens3: 00000000f611c728 +0: Sens0: 9400000d6a4f8c28 +1: Sens1: b400000d0ac31928 +2: Sens2: d400000d6a863528 +3: Sens3: b8012062f611c728 +Start up message + struct { uint16_t status; uint64_t addrs[NUM_OF_SENSORS]; } __attribute__((packed)) msg; -04 00 0000 3802 033C 288C 4F6A 0D00 0094 2819 C30A 0D00 00B4 2835 866A 0D00 00D4 28C7 11F6622001B8 - -0400 288C 4F6A 0D00 0094 2819 C30A 0D00 00B4 2835 866A 0D00 00D4 28C7 11F6 6220 01B8 +0400 +288C 4F6A 0D00 0094 +2819 C30A 0D00 00B4 +2835 866A 0D00 00D428C7 11F6 6220 01B8 +Measurement message + struct { uint16_t status; struct { @@ -32,4 +37,26 @@ E008 0000 2835 866A 0D00 00D4 D008 0000 28C7 11F6 6220 01B8 -9808 0000 \ No newline at end of file +9808 0000 + + +Downlink message + +typedef struct { + uint64_t addr; + uint8_t index; + char label[LABEL_LENGTH+1]; +} __attribute__((packed)) sensor_t; + +28 8C 4F 6A 0D 00 00 94 +00 +53 45 4E 53 30 00 +28 19 C3 0A 0D 00 00 B4 +01 +53 45 4E 53 31 00 +28 35 86 6A 0D 00 00 D4 +02 +53 45 4E 53 32 00 +28 C7 11 F6 62 20 01 B8 +03 +53 45 4E 53 33 00