|
Arduino LMIC 6.0.1
Arduino LoRaWAN(r) MAC in C
|
LMIC API. More...
Go to the source code of this file.
Data Structures | |
| struct | bcninfo_t |
| Information about the last and previous beacons. More... | |
| struct | lmic_class_c_flags_u::lmic_class_c_flags_s |
| the Class C operating flags More... | |
| union | lmic_class_c_flags_u |
| details of lmic_class_c_flags_t. More... | |
| struct | lmic_class_c_requests_u::lmic_class_c_requests_s |
| the Class C request flags More... | |
| union | lmic_class_c_requests_u |
| details of lmic_class_c_requests_t More... | |
| struct | lmic_class_c_s |
| details of class C state More... | |
| struct | lmic_client_data_s |
| contents of lmic_client_data_t More... | |
| struct | lmic_radio_data_s |
| Details of instance data for LMIC radio driver. More... | |
| struct | lmic_t |
| Instance data for the LMIC. More... | |
| struct | lmic_time_reference_s |
| struct | rxsched_t |
Macros | |
| #define | ARDUINO_LMIC_VERSION_COMPARE_GE(a, b) |
| compare two semantic versions | |
| #define | ARDUINO_LMIC_VERSION_COMPARE_GT(a, b) |
| compare two semantic versions | |
| #define | ARDUINO_LMIC_VERSION_COMPARE_LE(a, b) |
| compare two semantic versions | |
| #define | ARDUINO_LMIC_VERSION_COMPARE_LT(a, b) |
| compare two semantic versions | |
| #define | ARDUINO_LMIC_VERSION_TO_ORDINAL(v) |
| convert a semantic version to an ordinal integer. | |
| #define | DR_RANGE_MAP(drlo, drhi) |
| Construct a bit map of allowed datarates from drlo to drhi (both included). | |
| #define | LMIC_ERROR_NAME__INIT |
| Macro to initalize a normal table of error name strings. | |
| #define | LMIC_ERROR_NAME_MULTISZ__INIT |
| Macro to initialize a compressed string of error name strings. | |
| #define | LMIC_EVENT_NAME_MULTISZ__INIT |
| Macro to initialize a compressed string of event strings. | |
| #define | LMIC_EVENT_NAME_TABLE__INIT |
| Macro to initialize a normal table of event strings. | |
Typedefs | |
| typedef s1_t | lmic_beacon_error_t |
| Error codes returned for beacon operations. | |
| typedef struct lmic_client_data_s | lmic_client_data_t |
| abstract type for collection of client data that survives LMIC_reset(). | |
| typedef u4_t | lmic_gpstime_t |
| how the network represents time. | |
| typedef struct lmic_radio_data_s | lmic_radio_data_t |
| Instance data for LMIC radio driver. | |
| typedef u1_t | lmic_radio_flags_t |
| container type for radio request flags | |
| typedef u1_t | lmic_radio_state_t |
| concrete type for holding the radio state mask. | |
| typedef void LMIC_ABI_STD | lmic_request_network_time_cb_t(void *pUserData, int flagSuccess) |
| network time request callback function type | |
| typedef int | lmic_tx_error_t |
| LMIC result codes, as an integer type. | |
| typedef union lmic_class_c_flags_u | lmic_class_c_flags_t |
| internal state flacs for class C operation | |
| typedef union lmic_class_c_requests_u | lmic_class_c_requests_t |
| requests from outside the LMIC to inside the LMIC, for class C | |
| typedef struct lmic_class_c_s | lmic_class_c_t |
| the structure containing class C state | |
Functions | |
| u1_t | LMIC_getBatteryLevel (void) |
| get battery level that is to be returned by DevStatusAns. | |
| u1_t | LMIC_queryNumDefaultChannels (void) |
| get the number of (fixed) default channels before the programmable channels. | |
| bit_t | LMIC_queryTxReady (void) |
| check whether the LMIC is ready for a transmit packet | |
| u1_t | LMIC_setBatteryLevel (u1_t) |
| set battery level to be returned by DevStatusAns. | |
| void | LMIC_setSession (u4_t netid, devaddr_t devaddr, xref2u1_t nwkKey, xref2u1_t artKey) |
| Set up keys for ABP. | |
| bit_t | LMIC_setupChannel (u1_t channel, u4_t freq, u2_t drmap, s1_t band) |
| LMIC_setupChannel for EU 868. | |
LMIC API.
| #define ARDUINO_LMIC_VERSION_COMPARE_GE | ( | a, | |
| b ) |
compare two semantic versions
true if a is greater than or equal to b (as a semantic version). | #define ARDUINO_LMIC_VERSION_COMPARE_GT | ( | a, | |
| b ) |
compare two semantic versions
true if a is greater than b (as a semantic version). | #define ARDUINO_LMIC_VERSION_COMPARE_LE | ( | a, | |
| b ) |
compare two semantic versions
true if a is less than or equal to b (as a semantic version). | #define ARDUINO_LMIC_VERSION_COMPARE_LT | ( | a, | |
| b ) |
compare two semantic versions
true if a is less than b (as a semantic version). | #define LMIC_ERROR_NAME_MULTISZ__INIT |
Macro to initialize a compressed string of error name strings.
If compling for an AVR (or worried about it), you can use this multi-zero string and put this in a single const F() string. Index through this counting up from 0, until you get to the entry you want or to an entry that begins with a \0.
| #define LMIC_EVENT_NAME_MULTISZ__INIT |
Macro to initialize a compressed string of event strings.
iIf compiling for an AVR (or worried about it), you can use this multi-zero string and put this in a single const F() string. Index through this counting up from 0, until you get to the entry you want or to an
| typedef s1_t lmic_beacon_error_t |
Error codes returned for beacon operations.
| typedef union lmic_class_c_flags_u lmic_class_c_flags_t |
internal state flacs for class C operation
| typedef union lmic_class_c_requests_u lmic_class_c_requests_t |
requests from outside the LMIC to inside the LMIC, for class C
Enabling and disabling Class C operation can happen from outside the LMIC, or as the result of processing a callback. It's very fragile to require users to understand the LMIC state, so (at least for Class C), we provide APIs that are safe to call at any time. The tradeoff is that the operation is asynchronous – it doesn't complete until the LMIC gets scheduled. An object of this type is used to represent these requests.
| typedef struct lmic_class_c_s lmic_class_c_t |
the structure containing class C state
State for class C operations are incapsulated in a single object, so that conditional compiles are easier to read.
| typedef struct lmic_client_data_s lmic_client_data_t |
abstract type for collection of client data that survives LMIC_reset().
There are a variety of client registration linkage items that must live through LMIC_reset(), because LMIC_reset() is called at frame-rollover time. We group them together into a structure to make copies easy.
| typedef struct lmic_radio_data_s lmic_radio_data_t |
Instance data for LMIC radio driver.
Eventually this will be used for all portable things for the radio driver, but for now it's where we can start to add things.
| typedef u1_t lmic_radio_flags_t |
container type for radio request flags
| typedef u1_t lmic_radio_state_t |
concrete type for holding the radio state mask.
container type for radio driver state mask
Must be wide enough to hold values of type lmic_radio_state_e.
| typedef void LMIC_ABI_STD lmic_request_network_time_cb_t(void *pUserData, int flagSuccess) |
network time request callback function type
| pUserData | [in] value passed to corresponding network time request. |
| flagSuccess | [in] true if a network time was received, otherwise false. |
A function of this type is called when a time-request succeeds or when we get a downlink without time request, "completing" the pending time request.
| typedef int lmic_tx_error_t |
LMIC result codes, as an integer type.
| anonymous enum |
| anonymous enum |
| anonymous enum |
| anonymous enum |
| anonymous enum |
| enum lmic_beacon_error_e |
Error codes returned for beacon operations.
| enum lmic_radio_flags_e |
| enum lmic_radio_state_e |
radio driver state mask
| enum lmic_tx_error_e |
LMIC error codes.
| u1_t LMIC_getBatteryLevel | ( | void | ) |
get battery level that is to be returned by DevStatusAns.
| u1_t LMIC_queryNumDefaultChannels | ( | void | ) |
get the number of (fixed) default channels before the programmable channels.
get the number of (fixed) default channels before the programmable channels.
| u1_t LMIC_setBatteryLevel | ( | u1_t | uBattLevel | ) |
set battery level to be returned by DevStatusAns.
| uBattLevel | is the 8-bit value to be returned. Per LoRaWAN 1.0.3 line 769, this is MCMD_DEVS_EXT_POWER (0) if on external power, MCMD_DEVS_NOINFO (255) if not able to measure battery level, or a value in [ MCMD_DEVS_BATT_MIN, MCMD_DEVS_BATT_MAX ], numerically [1, 254], to represent the charge state of the battery. Note that this is not millivolts. |
The LMIC maintains an idea of the current battery state, initially set to MCMD_DEVS_NOINFO after the call to LMIC_init(). The appplication then calls this function from time to time to update the battery level.
It is possible (in non-Arduino environments) to supply a local implementation of os_getBatteryLevel(). In that case, it's up to the implementation to decide whether to use the value supplied by this API.
This implementation was chosen to minimize the risk of a battery measurement introducting breaking delays into the LMIC.
| void LMIC_setSession | ( | u4_t | netid, |
| devaddr_t | devaddr, | ||
| xref2u1_t | nwkKey, | ||
| xref2u1_t | artKey ) |
Set up keys for ABP.
The LMIC stores the given session keys and put thes MAC in a state as if a join request/accept had just negotiated these keys.
| netid | a 24-bit number describing the network id this device is using |
| devaddr | the 32-bit session address of the device. It is strongly recommended to ensure that different devices use different numbers with high probability. |
| nwkKey | the 16-byte network session key used for message integrity. If NULL the caller has copied the key into LMIC.nwkKey before. |
| artKey | the 16-byte application router session key used for message confidentiality. If NULL the caller has copied the key into LMIC.artKey before. |
References OP_JOINING, OP_NEXTCHNL, OP_PINGINI, OP_REJOIN, OP_TRACK, OP_TXRXPEND, OP_UNJOIN, and os_copyMem.
| bit_t LMIC_setupChannel | ( | u1_t | chidx, |
| u4_t | freq, | ||
| u2_t | drmap, | ||
| s1_t | band ) |
LMIC_setupChannel for EU 868.
NUM_DEFAULT_CHANNELS. This routine is used internally for MAC commands, so we enforce this for the extenal API as well. References DR_RANGE_MAP, and LMIC_setupChannel().
Referenced by LMIC_setupChannel().