Data Format¶
The payload device data is formatted in two blocks:
- The Device Information Text, which is a set of KEY=VALUE lines providing static device information and state
- The Data Points Ledger which is a plain bytes data block used to store data points in an optimised way
Device Information ¶
Data Points Ledger ¶
The following table presents the memory format in pages of 4 bytes. The bytes are not specially aligned to 4 bytes pages, but since the ledger is meant to be read from an NFC memory, it is more convenient to present the data as seen from an NFC memory (4 bytes pages)
Page | Byte 0 | Byte 1 | Byte 2 | Byte 3 |
---|---|---|---|---|
0 | LH | LL | OH | OL |
1 - 1023 | T | T | T | T |
-
Data Length: 2 bytes LH (MSB) and LL (LSB), MSB first
- Represents the number of temperature points in the ledger
- Conversion:
uint16_t data_length = (bytes[0] << 8) | bytes[1];
-
Data Offset: 2 bytes OH (MSB) and OL (LSB), MSB first
- Points to the latest point in the ledger, if the memory is in ring buffer mode and has looped over
- Conversion:
uint16_t offset = (bytes[2] << 8) | bytes[3];
- Temperature Point: T is a one byte value representing the temperature with a 0.5°C resolution
- 1 LSB = 0.5°C
- Values are offset by -23°C to map the range -40°C/+87°C to -63°C/+65°C and fit in a 1 byte signed integer (int8_t)
- To convert back to the original temperature:
float temperature = (bytes[i]*0.5)+23;
Last update:
2023-11-22