0x06 Counter3 - Daily Archive
The packet contains a counter's readings for one day with a 1-hour step.
Timestamp Initial value FLAGS DIFF DATA
4B 4B 2B bit array
| Field | Size, bytes | Value |
|---|---|---|
| Timestamp | 4 | uint32_t (value + 946684800 = UNIX time stamp) |
| Init value | 4 | Value at the interval beginning |
| FLAGS | 2 | See below |
| DIFF DATA | variable | Differential data |
FLAGS
| Bit | Flag Meaning | Description |
|---|---|---|
| 0 … 4 | N | Differential data bits ([0 … 31] + 1) |
| 5 | DIV10 | / 10 DIFF |
| 6 | RLE | BIT RLE COMPRESSION |
| 7 | SIGNED | DIFF SIGNED |
| 8 … 13 | REC_NUM | Number of entries (up to 64) |
| 14 | RESOL | Individual bit |
| 15 | ALL_DIFF_ZERO | Counter did not change, all DIFF=0. In this case, the block DIFF_DATA is missing |
RESOL=1
In the Differential data field the data are of variable length as a bitmap using the run-length encoding – RLE. In this case – zeros. There are four possible data blocks in this package. The individually dimensioned block (if the RESOL bit is set in the flags) is used to make changes to the device settings:
| One block | |||||
|---|---|---|---|---|---|
| Bit | Designation | Description | DIFF BLOCK | DIFF BLOCK | ... |
| 0 | Variable length flag | if 0: like in previous block (if this is the first block, so N) if 1: set in the next 5 bits | |||
| 1…5 | Number of bits per differential data | Presents if bit 0 = 1 | |||
| ... | is followed by either a zeros repetition block or a block of difference (see below) | ||||
RLE=1
Zero repetition block (set Bit RLE in flags), which serves to reduce / compress the amount of data:
| Bit | Designation | Description |
|---|---|---|
| 0 | RLE | always 1 |
| 1…5 | repeat value | entries repeats with diff=0, ([0 … 31] + 1) |
After the zeros repetition block, a variable-length flag is NOT added, but the value that was before the variable-length block (variable-length flag) is used.
Difference block if Bit RLE in flags is set:
| Bit | Designation | Description |
|---|---|---|
| 0 | RLE | Always 0 |
| N bits | diff value | difference from the previous value, character if the SIGNED flag is set; |
| needs to be multiplied by 10 if Flag DIV10 is set |
RLE=0
Difference block if Bit RLE in flags is NOT set:
| Bit | Designation | Description |
|---|---|---|
| N bits | diff value | difference from the previous value, character if the SIGNED flag is set; |
| needs to be multiplied by 10 if Flag DIV10 is set |
Playground
Output will appear here...