Field Reference
Comprehensive reference documentation for LoRaWAN payload data types, units, and encoding formats used across all Truvami tracking devices.
Data Types
All payload fields use specific data types that define how binary data should be interpreted. Understanding these types is essential for proper payload decoding.
| Type | Size | Range | Description |
|---|---|---|---|
uint8 | 1 byte | 0 to 255 | Unsigned 8-bit integer |
uint16 | 2 bytes | 0 to 65,535 | Unsigned 16-bit integer |
uint32 | 4 bytes | 0 to 4,294,967,295 | Unsigned 32-bit integer |
int8 | 1 byte | -128 to 127 | Signed 8-bit integer |
int16 | 2 bytes | -32,768 to 32,767 | Signed 16-bit integer |
int32 | 4 bytes | -2,147,483,648 to 2,147,483,647 | Signed 32-bit integer |
float | 4 bytes | IEEE 754 | 32-bit floating point number |
double | 8 bytes | IEEE 754 | 64-bit floating point number |
bool | 1 bit | 0 or 1 | Boolean value (true/false) |
Integer Types
Unsigned integers (uint8, uint16, uint32) can only represent positive values and zero. They are commonly used for:
- Counters and identifiers
- Sensor readings that are always positive
- Timestamps and durations
Signed integers (int8, int16, int32) can represent both positive and negative values. They are used for:
- Temperature readings (which can be negative)
- Relative positions or offsets
- Difference calculations
Floating Point Types
Float and double types follow the IEEE 754 standard for representing decimal numbers. They are used for:
- High-precision sensor readings
- Calculated values requiring decimal precision
- Geographic coordinates requiring sub-degree precision
Boolean Type
Boolean values represent simple true/false states and are typically used for:
- Device status flags
- Configuration enable/disable settings
- Sensor threshold alerts
Unit Scales and Prefixes
Many field values include unit scaling to optimize payload size while maintaining precision. The scale indicates how to convert the raw integer value to the actual physical unit.
| Scale | Symbol | Multiplier | Example |
|---|---|---|---|
micro | μ | ×10⁻⁶ | microdegrees = degrees ÷ 1,000,000 |
milli | m | ×10⁻³ | millivolts = volts ÷ 1,000 |
centi | c | ×10⁻² | centimeters = meters ÷ 100 |
deci | d | ×10⁻¹ | decimeters = meters ÷ 10 |
deca | da | ×10¹ | decameters = meters × 10 |
hecto | h | ×10² | hectometers = meters × 100 |
kilo | k | ×10³ | kilometers = meters × 1,000 |
half | ½ | ×0.5 | half-units = units ÷ 2 |
Common Unit Examples
Geographic Coordinates:
latitudeandlongitudefields often usemicrodegrees(μ°)- Raw value
45123456withmicroscale =45.123456°
Voltage Measurements:
- Battery voltage often uses
millivolts(mV) - Raw value
3300withmilliscale =3.3V
Distance and Altitude:
- Altitude may use
decimeters(dm) for precision - Raw value
1234withdeciscale =123.4m
Common Field Patterns
Timestamps
Most devices use Unix epoch timestamps for time representation:
- Type:
uint32 - Unit:
second - Description: Seconds since January 1, 1970 (Unix epoch)
- Example:
1697788800= October 20, 2023, 08:00:00 UTC
Geographic Data
GPS coordinates are typically encoded with high precision:
- Latitude/Longitude:
int32withmicrodegreescale - Altitude:
uint16withdecimeterscale - Accuracy/PDOP:
uint8with various scales
Battery and Power
Battery information commonly uses:
- Voltage:
uint16withmillivoltscale - Current:
int16withmilliamperescale - Percentage:
uint8(0-100%)
Sensor Data
Environmental sensors typically encode:
- Temperature:
int16withcentiscale (°C × 100) - Humidity:
uint8(0-100%) - Pressure:
uint32withpascalscale
Bit Fields and Flags
Some fields pack multiple boolean values into a single byte using bit manipulation:
Status Field (uint8): 0b10110010
├─ Bit 0: Moving flag (0 = stationary)
├─ Bit 1: GPS fix (1 = valid fix)
├─ Bit 2: Reserved (0)
├─ Bit 3: Reserved (0)
├─ Bit 4: Low battery (1 = low)
├─ Bit 5: Alert active (1 = active)
├─ Bit 6: Reserved (0)
└─ Bit 7: Configuration changed (1 = changed)
Reading Bit Fields
To extract individual bits from a byte value:
- Bit 0 (LSB):
value & 0x01 - Bit 1:
(value >> 1) & 0x01 - Bit 7 (MSB):
(value >> 7) & 0x01
Enumerated Values
Some fields use predefined enumeration values instead of direct numeric interpretation:
Mode Field (uint8):
├─ 0 = Sleep mode
├─ 1 = Active mode
├─ 2 = GPS acquisition mode
└─ 3 = Emergency mode
Enumerated values provide meaningful interpretation of numeric codes and are clearly documented in each device's payload specification.
Byte Order (Endianness)
All multi-byte integer values follow little-endian byte ordering unless explicitly specified otherwise:
uint16value0x1234is transmitted as[0x34, 0x12]uint32value0x12345678is transmitted as[0x78, 0x56, 0x34, 0x12]
This convention ensures consistent interpretation across different platforms and programming languages.
This reference applies to all Truvami device protocols. For device-specific field definitions, see the individual device documentation.