Skip to content

Commit 8c1a45b

Browse files
Jordan Yatesnashif
authored andcommitted
lorawan: queriable minimum datarate
Add a function to query the minimum possible datarate on the network. This value may change over the lifetime of the connection as a result of commands from the network server. Signed-off-by: Jordan Yates <[email protected]>
1 parent fa09d0d commit 8c1a45b

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

include/lorawan/lorawan.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,16 @@ void lorawan_enable_adr(bool enable);
205205
*/
206206
int lorawan_set_datarate(enum lorawan_datarate dr);
207207

208+
/**
209+
* @brief Get the minimum possible datarate
210+
*
211+
* The minimum possible datarate may change in response to a TxParamSetupReq
212+
* command from the network server.
213+
*
214+
* @return Minimum possible data rate
215+
*/
216+
enum lorawan_datarate lorawan_get_min_datarate(void);
217+
208218
/**
209219
* @brief Get the current payload sizes
210220
*

subsys/lorawan/lorawan.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,16 @@ void lorawan_get_payload_sizes(uint8_t *max_next_payload_size,
361361
*max_payload_size = txInfo.CurrentPossiblePayloadSize;
362362
}
363363

364+
enum lorawan_datarate lorawan_get_min_datarate(void)
365+
{
366+
MibRequestConfirm_t mibGet;
367+
368+
mibGet.Type = MIB_CHANNELS_MIN_TX_DATARATE;
369+
LoRaMacMibGetRequestConfirm(&mibGet);
370+
371+
return mibGet.Param.ChannelsMinTxDatarate;
372+
}
373+
364374
void lorawan_enable_adr(bool enable)
365375
{
366376
MibRequestConfirm_t mib_req;

0 commit comments

Comments
 (0)