Expand description
Reading packets out of the concentrator.
Received packets arrive in one buffer, back to back, each wrapped in metadata the chip writes around it: a sync word and nine bytes saying how long the payload is and how it was demodulated, then the payload, then fourteen more bytes of what the receiver made of it.
The metadata is in two halves and they are addressed differently. Everything before the payload is counted from the start of the packet; everything after it is counted from the start plus the payload length, which is why a reader has to know how long the payload is before it can find the signal levels or the timestamp.
A packet can also carry fine timestamp metrics after all of that, two bytes each, and the
count lives in the tail. A reader that ignores them finds the next packet in the wrong
place, so packet_len takes them into account and the walk in packets stays aligned.
Nothing here reads a register. A buffer is bytes, and this turns those bytes into packets, so a capture from a working gateway can be replayed and checked without hardware.
Structs§
- Packet
- A packet as the concentrator wrote it into the buffer.
- Quality
- What the receiver made of a packet it heard.
Enums§
Constants§
- BUFFER_
LEN - How many bytes the receive buffer holds in all.
- FSK_
MODEM - The identifier of the frequency shift keying demodulator.
- HEAD_
METADATA - How many bytes of metadata come before the payload, the sync word included.
- LORA_
MULTI_ MODEM_ MAX - The highest identifier belonging to a multi-spreading-factor LoRa demodulator.
- LORA_
STD_ MODEM - The identifier of the single-spreading-factor LoRa demodulator.
- MAX_
PAYLOAD - The largest payload a packet carries.
- METRIC_
LEN - How many bytes each fine timestamp metric takes.
- SYNC_
BYTE_ 0 - The first byte of the word that marks the start of a packet.
- SYNC_
BYTE_ 1 - The second byte of that word.
- TAIL_
METADATA - How many bytes of metadata come after it, before any timestamp metrics.
Functions§
- packet_
len - How many bytes a packet takes in the buffer.
- packets
- Walks every packet the buffer holds, in the order the chip wrote them.
- parse
- Reads the one packet that starts at the front of these bytes.