Event data storage format
Layout
Each event stored in memory occupies 24 bytes and has the following layout.
Timestamp | Schedules | Size | Type | Auxiliary |
|---|---|---|---|---|
64 bits (8 bytes) | 32 bits (4 bytes) | 16 bits (2 bytes) | 16 bits (2 bytes) | 64 bits (8 bytes) |
All individual data items are stored in memory in little-endian format (least significant byte at lower address). Descriptions follow below.
Timestamp: a 64-bit count of milliseconds elapsed since 1970/01/01 00:00:00, commonly referred to as the Unix epoch. It accounts for leap years, but not leap seconds, time zones or any other adjustments. Note that although the Unix epoch is used as a reference point, the time does not conform exactly to the definition of "Unix time", which is measured in seconds.
Schedules: a 32-bit mask indicating which schedule(s) the event applies to by the schedule's internal reference, an integer in the range 1 to 32. Bit-0 =1 for Schedule 1, Bit-1 = 1 for Schedule 2, and so on.
Size: a 16-bit value that gives the size of the complete event in bytes. Currently the value is always 24, but different event sizes may be supported in the future.
Type: a 16-bit lookup index indicating what kind of event this is.
Auxiliary: an 8-byte array of supplementary data, some or all of which may be unused. The content depends on the event Type. Currently, there are always 8 bytes; any unused bytes are at the end of the array and 'padded' with a value of 0xFF (255).
Event types and auxiliary data
Type | Hex | Description | Auxiliary data |
|---|---|---|---|
0 | 0x00 | Unknown or unrecognized events | |
1 | 0x01 | reserved | |
2 | 0x02 | disable command received | |
3 | 0x03 | Run-time error encountered | [2-byte filename hash code], [2-byte line number], [0xFF], [0xFF], [0xFF], [0xFF] |
4 | 0x04 | CPU reset detected | |
5 | 0x05 | One or more parameters recovered after reset | |
6 | 0x06 | Restart failed: real-time clock (RTC)/calendar contents not valid | |
7 | 0x07 | Restart failed: logger status not valid | |
8 | 0x08 | Restart failed: primary schedule parameters could not be recovered | |
9 | 0x09 | Unable to load alarm time for next sample | |
10 | 0x0A | Sampling restarted after resetting RTC | |
11 | 0x0B | Parameters recovered; sampling restarted after resetting RTC | |
12 | 0x0C | Sampling finished: deployment end time reached | |
13 | 0x0D | reserved | |
14 | 0x0E | reserved | |
15 | 0x0F | Power source switched to USB | |
16 | 0x10 | reserved | |
17 | 0x11 | reserved | |
18 | 0x12 | reserved | |
19 | 0x13 | reserved | |
20 | 0x14 | reserved | |
21 | 0x15 | reserved | |
22 | 0x16 | Power source switched to internal battery | |
23 | 0x17 | Power source switched to external battery | |
24 | 0x18 | reserved | |
25 | 0x19 | reserved | |
26 | 0x1A | reserved | |
27 | 0x1B | reserved | |
28 | 0x1C | Regimes enabled, but not yet in a regime | |
29 | 0x1D | Entered regime 1 | |
30 | 0x1E | Entered regime 2 | |
31 | 0x1F | Entered regime 3 | |
32 | 0x20 | End of regime bin | |
33 | 0x21 | reserved | |
34 | 0x22 | reserved | |
35 | 0x23 | reserved | |
36 | 0x24 | Battery failed, schedule finished | |
37 | 0x25 | reserved | |
38 | 0x26 | reserved | |
39 | 0x27 | reserved | |
40 | 0x28 | reserved | |
41 | 0x29 | reserved | |
42 | 0x2A | reserved | |
43 | 0x2B | reserved | |
44 | 0x2C | reserved | |
45 | 0x2D | Regimes; passed final boundary |