Expand description
The C ABI for a LoRaWAN Class A end device, without a radio.
PamojaLorawanEndDevice wraps pamoja_lorawan::device::EndDevice: it joins, chooses a
channel and data rate for each uplink, says when and where to listen for the answer, reads
what comes back, and does what the network’s MAC commands ask. It owns no radio and no
clock, so every call takes the time in microseconds and hands back what to put on the air.
A device lives as long as the program may keep it, so it runs on a published channel plan:
a region from pamoja_lora_plan_for_region
or a CN470-510 plan from
pamoja_lora_plan_for_cn470. The plan
handle may be freed once the device is made.
A call that fails returns a status and records why on the device. Read it with
pamoja_lorawan_end_device_error, which says, for example, until when the air is not
free.
Structs§
- Pamoja
Lorawan Channel - A channel a device may send on.
- Pamoja
Lorawan Device Error - Why a device’s last call failed.
- Pamoja
Lorawan Device Settings - What a device’s radio can do, and how it takes part.
- Pamoja
Lorawan EndDevice - An opaque handle to a LoRaWAN Class A end device.
- Pamoja
Lorawan EndDevice Status - Where a device stands, read in one call.
- Pamoja
Lorawan Heard - What a frame heard in a receive window turned out to be.
- Pamoja
Lorawan Next - What to do once both receive windows closed with nothing for the device.
- Pamoja
Lorawan Relay Exchange - The wake-on-radio exchange an uplink under a relay goes out behind, TS011-1.0.1 section 5.
- Pamoja
Lorawan Relay Status - What a relay’s acknowledgment said about itself, TS011-1.0.1 table 14.
- Pamoja
Lorawan Transmission - A frame to put on the air, and where to listen afterward.
- Pamoja
Lorawan Window - When and where to listen for a downlink.
Constants§
- PAMOJA_
LORAWAN_ BATTERY_ EXTERNAL - A device running from an external supply.
- PAMOJA_
LORAWAN_ BATTERY_ LEVEL - A device reporting a battery level from 1, empty, to 254, full.
- PAMOJA_
LORAWAN_ BATTERY_ UNKNOWN - A device that cannot measure its battery.
- PAMOJA_
LORAWAN_ DEVICE_ BUSY - A transmission is still waiting on its receive windows.
- PAMOJA_
LORAWAN_ DEVICE_ COUNTER_ EXHAUSTED - The uplink frame counter is spent, and the device has to join again.
- PAMOJA_
LORAWAN_ DEVICE_ COUNTER_ GAP - The frame counter jumped further ahead than the device follows.
- PAMOJA_
LORAWAN_ DEVICE_ DATA_ RATE - The data rate
data_rateis not a LoRa one the device can use. - PAMOJA_
LORAWAN_ DEVICE_ FOREIGN - The frame is addressed to another device.
- PAMOJA_
LORAWAN_ DEVICE_ FRAME - The frame did not decode, or port 0 was asked for an application payload.
- PAMOJA_
LORAWAN_ DEVICE_ NOTHING_ PENDING - There is no transmission waiting on its windows or due to repeat.
- PAMOJA_
LORAWAN_ DEVICE_ NOT_ JOINED - The device has not joined.
- PAMOJA_
LORAWAN_ DEVICE_ NO_ CHANNEL - No enabled channel carries the data rate.
- PAMOJA_
LORAWAN_ DEVICE_ NO_ CREDENTIALS - A device activated by personalization has nothing to join with.
- PAMOJA_
LORAWAN_ DEVICE_ OK - The last call succeeded.
- PAMOJA_
LORAWAN_ DEVICE_ PAYLOAD_ TOO_ LONG - The payload does not fit;
maxbytes do. - PAMOJA_
LORAWAN_ DEVICE_ REFUSED - A join accept carries settings the region does not allow.
- PAMOJA_
LORAWAN_ DEVICE_ REPLAYED - The frame repeats or precedes the last downlink the device accepted.
- PAMOJA_
LORAWAN_ DEVICE_ STATE - A saved state was not resumed;
statesays why. - PAMOJA_
LORAWAN_ DEVICE_ TOO_ MANY_ CHANNELS - The plan defines more channels than a device keeps.
- PAMOJA_
LORAWAN_ DEVICE_ WAIT - The air is not free until
until_us. - PAMOJA_
LORAWAN_ HEARD_ DATA - A data frame for the device.
- PAMOJA_
LORAWAN_ HEARD_ JOINED - A join accept: the device is on the network.
- PAMOJA_
LORAWAN_ NEXT_ DONE - The uplink is finished.
- PAMOJA_
LORAWAN_ NEXT_ JOIN_ AGAIN - The join got no answer; join again with a new nonce, no sooner than the time given.
- PAMOJA_
LORAWAN_ NEXT_ REPEAT - Send the same frame again, no sooner than the time given.
- PAMOJA_
LORAWAN_ NEXT_ UNACKNOWLEDGED - A confirmed uplink went out every time it may without an acknowledgment.
- PAMOJA_
LORAWAN_ RELAY_ DEVICE_ CONTROLLED - Leave it to the device, which is where every device starts.
- PAMOJA_
LORAWAN_ RELAY_ DISABLED - Never send through a relay, TS011-1.0.1 table 40.
- PAMOJA_
LORAWAN_ RELAY_ DYNAMIC - Start using one after enough uplinks go unanswered.
- PAMOJA_
LORAWAN_ RELAY_ ENABLED - Always send through a relay.
- PAMOJA_
LORAWAN_ RELAY_ INITIALIZED - The device knows nothing of a relay, TS011-1.0.1 section 3.9.
- PAMOJA_
LORAWAN_ RELAY_ SYNCHRONIZED - It knows when the relay next scans.
- PAMOJA_
LORAWAN_ RELAY_ UNSYNCHRONIZED - It knows how a relay scans, but not when.
- PAMOJA_
LORAWAN_ SAVED_ LEN - How many bytes a saved device state takes.
- PAMOJA_
LORAWAN_ STATE_ CORRUPT - A saved state that is corrupt.
- PAMOJA_
LORAWAN_ STATE_ FORMAT - A saved state in a format this build does not read,
format. - PAMOJA_
LORAWAN_ STATE_ LENGTH - A saved state of the wrong length.
- PAMOJA_
LORAWAN_ STATE_ PLAN - A saved state from another channel plan.
- PAMOJA_
LORAWAN_ WINDOW_ RX1 - The first receive window, on the uplink’s downlink channel.
- PAMOJA_
LORAWAN_ WINDOW_ RX2 - The second receive window, on the fixed frequency and data rate.
- PAMOJA_
LORAWAN_ WINDOW_ RXR - The relay window, which a device under a relay opens last, TS011-1.0.1 chapter 7.
- PAMOJA_
LORAWAN_ WOR_ NEXT_ UPLINK - The uplink goes out at the time the exchange named.
- PAMOJA_
LORAWAN_ WOR_ NEXT_ WAKE_ UP - The relay is woken again first, as the network’s BackOff asks.
Functions§
- pamoja_
lorawan_ ⚠device_ settings - Fills in the settings of a typical node with a radio’s output power range.
- pamoja_
lorawan_ ⚠end_ device_ channel - Reads one of the channels a device may send on.
- pamoja_
lorawan_ ⚠end_ device_ error - Reads why a device’s last call failed.
- pamoja_
lorawan_ ⚠end_ device_ free - Releases a device handle.
- pamoja_
lorawan_ ⚠end_ device_ heard - Reads a frame heard in one of the receive windows of the last transmission, without saying which.
- pamoja_
lorawan_ ⚠end_ device_ heard_ in - Reads a frame heard in a given receive window of the last transmission.
- pamoja_
lorawan_ ⚠end_ device_ heard_ wor_ ack - Reads the acknowledgment a relay answered the last wake-on-radio frame with.
- pamoja_
lorawan_ ⚠end_ device_ join - Builds a join request.
- pamoja_
lorawan_ ⚠end_ device_ new - Makes a device that joins over the air.
- pamoja_
lorawan_ ⚠end_ device_ no_ wor_ ack - Says what to do once the acknowledgment window closed with nothing in it.
- pamoja_
lorawan_ ⚠end_ device_ nothing_ heard - Says what comes next once both receive windows closed with nothing for the device.
- pamoja_
lorawan_ ⚠end_ device_ personalized - Makes a device activated by personalization, with its session provisioned.
- pamoja_
lorawan_ ⚠end_ device_ relay_ mode - Reports how a device uses a relay, TS011-1.0.1 sections 3.9 and 10.2.
- pamoja_
lorawan_ ⚠end_ device_ relay_ status - Returns what the relay’s last acknowledgment said about itself, TS011-1.0.1 table 14.
- pamoja_
lorawan_ ⚠end_ device_ repeat - Sends the last uplink again, the same frame on a channel chosen afresh.
- pamoja_
lorawan_ ⚠end_ device_ request_ device_ time - Asks the network, with the next uplink, for the time.
- pamoja_
lorawan_ ⚠end_ device_ request_ link_ check - Asks the network, with the next uplink, how well it hears the device.
- pamoja_
lorawan_ ⚠end_ device_ resume - Puts a saved state back on a device made on the same channel plan.
- pamoja_
lorawan_ ⚠end_ device_ save - Saves a joined device’s state, to keep across a loss of power.
- pamoja_
lorawan_ ⚠end_ device_ send - Builds an uplink carrying a payload.
- pamoja_
lorawan_ ⚠end_ device_ send_ empty - Builds an uplink with no payload, carrying the answers the device owes, an acknowledgment, or an ADR acknowledgment request.
- pamoja_
lorawan_ ⚠end_ device_ set_ battery - Sets what the device reports its battery as, when a network asks.
- pamoja_
lorawan_ ⚠end_ device_ status - Reads where a device stands.
- pamoja_
lorawan_ ⚠end_ device_ use_ relay - Turns relay mode on or off, TS011-1.0.1 section 10.2 and appendix 5.