Skip to content

Commit 489eecf

Browse files
author
Antti Kauppila
committed
LoRa: LoRaMAC class refactored
- Internal change only, no functional changes - Tested by running Green tea tests manually
1 parent 6b54478 commit 489eecf

File tree

8 files changed

+224
-612
lines changed

8 files changed

+224
-612
lines changed

features/lorawan/LoRaWANStack.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,8 @@ lorawan_status_t LoRaWANStack::enable_adaptive_datarate(bool adr_enabled)
304304
tr_error("Stack not initialized!");
305305
return LORAWAN_STATUS_NOT_INITIALIZED;
306306
}
307-
308-
return _loramac.enable_adaptive_datarate(adr_enabled);
307+
_loramac.enable_adaptive_datarate(adr_enabled);
308+
return LORAWAN_STATUS_OK;
309309
}
310310

311311
lorawan_status_t LoRaWANStack::set_channel_data_rate(uint8_t data_rate)

features/lorawan/lorastack/mac/LoRaMac.cpp

Lines changed: 173 additions & 266 deletions
Large diffs are not rendered by default.

features/lorawan/lorastack/mac/LoRaMac.h

Lines changed: 44 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@
4545
#include "lorawan/system/lorawan_data_structures.h"
4646
#include "LoRaMacCommand.h"
4747
#include "events/EventQueue.h"
48-
#include "LoRaMacMlme.h"
49-
#include "LoRaMacMcps.h"
5048
#include "LoRaMacChannelPlan.h"
5149
#include "loraphy_target.h"
5250

@@ -104,7 +102,7 @@ class LoRaMac {
104102
* not fit into the payload size on the related datarate, the LoRaMAC will
105103
* omit the MAC commands.
106104
*/
107-
uint8_t query_tx_possible(uint8_t size);
105+
uint8_t get_max_possible_tx_size(uint8_t size);
108106

109107
/**
110108
* @brief nwk_joined Checks if device has joined to network
@@ -292,9 +290,8 @@ class LoRaMac {
292290
/**
293291
* @brief enable_adaptive_datarate Enables or disables adaptive datarate.
294292
* @param adr_enabled Flag indicating is adr enabled or disabled.
295-
* @return LORAWAN_STATUS_OK or a negative error code on failure.
296293
*/
297-
lorawan_status_t enable_adaptive_datarate(bool adr_enabled);
294+
void enable_adaptive_datarate(bool adr_enabled);
298295

299296
/** Sets up the data rate.
300297
*
@@ -491,6 +488,28 @@ class LoRaMac {
491488
*/
492489
lorawan_status_t send_frame_on_channel(uint8_t channel);
493490

491+
/**
492+
* @brief reset_mcps_confirmation Resets the MCPS confirmation struct
493+
*/
494+
void reset_mcps_confirmation();
495+
496+
/**
497+
* @brief reset_mlme_confirmation Resets the MLME confirmation struct
498+
*/
499+
void reset_mlme_confirmation();
500+
501+
/**
502+
* @brief set_tx_continuous_wave Puts the system in continuous transmission mode
503+
* @param [in] channel A Channel to use
504+
* @param [in] datarate A datarate to use
505+
* @param [in] tx_power A RF output power to use
506+
* @param [in] max_eirp A maximum possible EIRP to use
507+
* @param [in] antenna_gain Antenna gain to use
508+
* @param [in] timeout Time in seconds while the radio is kept in continuous wave mode
509+
*/
510+
void set_tx_continuous_wave(uint8_t channel, int8_t datarate, int8_t tx_power,
511+
float max_eirp, float antenna_gain, uint16_t timeout);
512+
494513
/**
495514
* Prototypes for ISR handlers
496515
*/
@@ -518,16 +537,6 @@ class LoRaMac {
518537
*/
519538
LoRaMacCommand mac_commands;
520539

521-
/**
522-
* MLME subsystem handle
523-
*/
524-
LoRaMacMlme mlme;
525-
526-
/**
527-
* MCPS subsystem handle
528-
*/
529-
LoRaMacMcps mcps;
530-
531540
/**
532541
* Channel planning subsystem
533542
*/
@@ -553,6 +562,26 @@ class LoRaMac {
553562
*/
554563
events::EventQueue *ev_queue;
555564

565+
/**
566+
* Structure to hold MCPS indication data.
567+
*/
568+
loramac_mcps_indication_t _mcps_indication;
569+
570+
/**
571+
* Structure to hold MCPS confirm data.
572+
*/
573+
loramac_mcps_confirm_t _mcps_confirmation;
574+
575+
/**
576+
* Structure to hold MLME indication data.
577+
*/
578+
loramac_mlme_indication_t _mlme_indication;
579+
580+
/**
581+
* Structure to hold MLME confirm data.
582+
*/
583+
loramac_mlme_confirm_t _mlme_confirmation;
584+
556585
loramac_tx_message_t _ongoing_tx_msg;
557586

558587
bool _is_nwk_joined;

features/lorawan/lorastack/mac/LoRaMacMcps.cpp

Lines changed: 0 additions & 57 deletions
This file was deleted.

features/lorawan/lorastack/mac/LoRaMacMcps.h

Lines changed: 0 additions & 88 deletions
This file was deleted.

features/lorawan/lorastack/mac/LoRaMacMlme.cpp

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)