9.3.1 Packetizing & Line Encoding HULC Protocol uses the byte 0x1A as start-of-packet (SOP) marker. In order to avoid misinterpretation of normal data bytes with value 0x1A as SOP, each occurrence of data byte 0x1A is doubled in the data stream during transmission ('escaping'). It is thus necessary during reception to detect every 0x1A not followed by another 0x1A as an SOP marker and to reduce every occurrence of a double 0x1A to a single 0x1A data byte ('un-escaping'). Example of a 4-byte long packet including SOP marker and 0x1A data bytes: Before Escaping: 1A 32 27 1A E8 57 F0 1A 6C During Transmission: 1A 32 27 1A 1A E8 57 F0 1A 1A 6C After Un-Escaping: 1A 32 27 1A E8 57 F0 1A 6C Type Payload Size Description 0x31 4 bytes Mode-A/C raw data 0x32 7 bytes Mode-S Short Squitter raw data 0x33 14 bytes Mode-S Extended Squitter raw data ll Data messages (Type 0x31 & 0x32 & 0x33) have the following structure: 0x1A TYPE Timestamp RSSI Data (Mode-S or Mode-A/C) Fields: TYPE 8-bit 0x31 or 0x32 or 0x33 for Mode-A/C or Mode-S short or extended squitter respectively Timestamp 48-bit1 Upper 18 bits are seconds since last midnight 00:00:00 UTC Lower 30 bits are nanoseconds of current second RSSI 8-bit Logarithmic field-strength indicator, uncalibrated Data N * 8-bit raw data, N=4 for Type 0x31, N=7 for TYPE 0x32 and N=14 for TYPE 0x33 1) MSB-first Timestamps: There are two distinct timestamp formats, absolute and relative timestamps depending on whether a GPS receiver is attached or not. To find out which format is used check bit 15 (Gps Detected) in the status flag field of the HULC Status Message. Both timestamp formats are compatible with the respective timestamp formats used in the Beast Binary Protocol. Relative Timestamp (No GPS): Without a GPS receiver attached the timestamp is a 48-bit unsigned number counting 12 MHz cycles. The timestamp will wrap approximately every 271 days. Absolute Timestamp (With GPS): If a suitable GPS receiver is attached the 48-bit timestamp field is divided into the upper 18 bits which count the seconds since last midnight 00:00:00 UTC and the lower 30 bits which carry the nanoseconds of the current second. Timestamp nanoseconds are guaranteed to be less than one complete second. Example: 0x3746554be940 = (56601 sec + 357296448 nsec) = 15:43:21.357296448 UTC 1A 31 3A 52 56 53 02 E1 8F 37 5A 1A A3 1A 31 3A 52 56 53 02 E1 8F 37 5A 1A 1A A3 1A 31 4B 03 5B 02 E1 90 10 1E 89 50 1a31 19 ea b6 3a 1f 91 65 01 47 1a31 19 b4 18 c3 59 0c 6d 32 10