Decoding the Oyster Sigfox Payload: Examples
Click this link to check out the Oyster Sigfox on the Digital Matter Website.
We will expand this article with more examples in time.
Please refer to this article for the message specifications. These are just examples.
Decode a GPS Data Record (Type 0)
Here is an example payload, as sent from the Sigfox backend to your server. It fills the 12 bytes of allowed payload.
10b67dcc0006efda3d9816c2
Working our way through the bytes, from left to right:
- 0x10: Message Type 0 (GPS Data Record), In Trip = True, Last Fix Failed = False
- Remember, bit 0 is on the far right. So this is 00010000 in binary (MSb on the left). And (00-reserved)(0-last fix failed)(1-in trip)(0000-GPS data record)
- 0xb67dcc00: Lat = 1.3401526.
- Remember, little endian, so the byte order needs to be swapped for big endian systems (0x00cc7db6). 2's complement for negative numbers
- 0x06efda3d: Long = 103.7758214.
- Remember, little endian, so the byte order needs to be swapped for big endian systems (0x3ddaef06). 2's complement for negative numbers
- 0x98: Heading = 304 degrees.
- Remember, raw is in 2 degree units.
- 0x16: Speed = 22km/h
- 0xc2: Battery = 4.85V.
- Remember, raw is in 25mV units. 194 * 25mV = 4.85V
Another example payload:
00c406cc00af73f33d0000ac
Working our way through the bytes, from left to right:
- 0x00: Message Type 0 (GPS Data Record), In Trip = False, Last Fix Failed = False
- Remember, bit 0 is on the far right. So this is 00000000 in binary (MSb on the left). And (00-reserved)(0-last fix failed)(0-in trip)(0000-GPS data record)
- 0xc406cc00: Lat = 1.3371076
- Remember, little endian, so the byte order needs to be swapped for big endian systems (0x00cc06c4). 2's complement for negative numbers
- 0xaf73f33d: Long = 103.9365039
- Remember, little endian, so the byte order needs to be swapped for big endian systems (0x3df373af). 2's complement for negative numbers
- 0x00: Heading = 0 degrees.
- Remember, raw is in 2 degree units.
- 0x00: Speed = 0km/h
- 0xac: Battery = 4.30V.
- Remember, raw is in 25mV units. 172 * 25mV = 4.30V
Decode a Downlink Ack Message (Type 1)
Here is an example payload from the Sigfox backend to your server. It fills the 12 bytes of allowed payload:
110108XXXXXXXXXXXXXXXX
- Message Type 1. The lower nibble of byte 0
- Downlink Accepted = True. The higher nibble of byte 0
- Firmware major version 1
- Firmware minor version 8
- Verbatim copy of downlink: XXXXXXXXXXXXXXXX. This will be the downlink you sent to the device. 8 bytes long, made according to the integration spec.
Decode a Device Statistics Message (Type 2)
Here is an example payload from the Sigfox backend to your server. It fills the 12 bytes of allowed payload:
02600000014000801492180e
Because of the way the information is packed into the 12 byte messages, it makes sense to write this message out in binary, and reverse the bit order (MSb on the right) in the bytes. Reversing the bit order is so we can group them better in the next step:
Grouping for the message fields:
Remember, MSb is on the right, to make grouping easier:
- Message type = 2
- Uptime = 0 weeks
- Tx Count = 3 x 32
- Rx Count = 0 x 32
- Trip Count = 1 x 32
- GPS Successes = 2 x 32
- GPS Failures = 0 x 32
- Average fix time = 41 seconds
- Average fail time = 146 seconds
- Average freshen time = 12 seconds
- Wakeups per trip = 7
Decode an Extended GPS Data Uplink (Type 3)
Here is an example of an extended GPS data uplink, which includes GPS position accuracy, at the cost of other precision.
E37DCC00EFDA3D2DC2490000
This decodes to
- "MessageType": 3,
- "Heading": 315 degrees. Mask off the E nibble of the E3, and multiply by 22.5 degrees.
- "Latitude": 1.3401344. Convert to the signed integer value (7DCC00 [little endian] -> 52349 [dec]) and then multiply by 256/10'000'000.
- "Longitude": 103.7758208. Same as Latitude
- "PosAccM": 45m
- "BatteryVoltage": 4.85V. Same as uplink 1 with LSb = 25mV, so multiply value by 25 to get millivolts,
- "SpeedKmH": 22.5km/h. Multiply by 2.5 to get km/h
- "InTrip": true. Mask off bit 9.6
- "LastFixFailed": false. Mask off bit 9.7