Expand description
The commands a network and a device configure each other with.
A frame carries a payload for the application, and it can carry commands for the device
itself: change to this data rate, listen on this frequency, tell me how your battery is.
They ride either in the frame options, unencrypted and at most FOPTS_MAX bytes of
them, or as a whole payload on port zero, which a session encrypts with the network key.
A frame that carries them in both places is one a device is told to ignore.
Two things here are easy to get wrong, and both are quiet when you do:
- A command identifier means different things in each direction.
0x03going down is a request to change rate, and the same byte coming up is the answer to one. Nothing in the bytes says which, soMacCommand::parseis told the direction and there is no default. - A command does not carry its own length. A reader is expected to know it, which means
an identifier it does not know cannot be stepped over: everything after it is
unreadable.
MacCommandsstops there rather than guessing, and leaves the rest inremainingso a caller can see what was not read.
Every layout here is from the LoRaWAN 1.0.3 specification, section 5, and the relay commands from TS011-1.0.1 section 10. Multi-byte fields go out low byte first as the rest of the protocol does.
Structs§
- MacCommands
- Walks the commands packed into one field.
Enums§
- MacCommand
- One command, in either direction.
Constants§
- CID_
CONFIGURE_ FWD_ LIMIT - Sets a relay’s forwarding limits, TS011-1.0.1 section 10.6.
- CID_
CTRL_ UPLINK_ LIST - Reads or removes an end device of a relay’s trusted list, TS011-1.0.1 section 10.5.
- CID_
DEVICE_ TIME - Asks the network what time it is.
- CID_
DEV_ STATUS - Asks a device for its battery and how well it is hearing.
- CID_
DL_ CHANNEL - Moves the downlink frequency of a channel away from its uplink one.
- CID_
DUTY_ CYCLE - Holds a device to a share of the air.
- CID_
END_ DEVICE_ CONF - Configures how an end device uses a relay, TS011-1.0.1 section 10.2.
- CID_
FILTER_ LIST - Sets a rule of a relay’s join request filter, TS011-1.0.1 section 10.3.
- CID_
LINK_ ADR - Sets the data rate, the power, and which channels may be used.
- CID_
LINK_ CHECK - Checks the link, and asks how well it was heard.
- CID_
NEW_ CHANNEL - Creates or changes a channel.
- CID_
NOTIFY_ NEW_ END_ DEVICE - A relay telling the network of an end device it could not verify, TS011-1.0.1 section 10.7.
- CID_
RELAY_ CONF - Configures a relay’s wake-on-radio channels, TS011-1.0.1 section 10.1.
- CID_
RX_ PARAM_ SETUP - Sets where and how fast the second receive window listens.
- CID_
RX_ TIMING_ SETUP - Sets how long after sending a device starts listening.
- CID_
TX_ PARAM_ SETUP - Sets the power and the dwell time a region asks for.
- CID_
UPDATE_ UPLINK_ LIST - Adds an end device to a relay’s trusted list, TS011-1.0.1 section 10.4.
- EIRP_
DBM - The transmit powers the dwell time command can name, in dBm, by their coded value.
- FILTER_
EUI_ MAX - The longest join filter a relay rule carries: a JoinEUI and a DevEUI.
- FOPTS_
MAX - How many bytes of commands a frame can carry beside a payload.
- MAX_
COMMAND - The longest single command, which is the one that adds an end device to a relay’s trusted list.
- RELAY_
ACK_ OFFSET_ HZ - The frequency offsets a relay’s second channel can be acknowledged at, TS011-1.0.1 table 35, by their coded value.
- RELAY_
BUCKET_ MULTIPLIER - What a coded bucket size multiplies a reload rate by, TS011-1.0.1 table 55.
Functions§
- eirp_
code - The code for a transmit power, when the table has one for it exactly.
- eirp_
dbm - What a coded transmit power means in dBm.
- encode_
all - Writes a run of commands into one buffer.
- receive_
delay_ s - How long a device waits before its first receive window, in seconds.
- relay_
rssi_ code - The coded signal strength a relay reports, TS011-1.0.1 sections 9.1 and 10.7:
-15 - codedBm, clamped to what seven bits carry. - relay_
second_ channel - The second channel a relay configuration describes, where it names one.
- relay_
snr_ code - The coded signal-to-noise ratio a relay reports, TS011-1.0.1 sections 9.1 and 10.7:
code - 20dB, clamped to what five bits carry.