Skip to content

Commit 4fa5e38

Browse files
committed
Added possibility to specify the LoRa class in the constructor of LoRaConnectionHandler
1 parent a1dee1c commit 4fa5e38

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Arduino_LoRaConnectionHandler.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ static const unsigned long NETWORK_CONNECTION_INTERVAL = 30000; /* NOT USED
3333
CTOR/DTOR
3434
******************************************************************************/
3535

36-
LoRaConnectionHandler::LoRaConnectionHandler(const char *_appeui, const char *_appkey, _lora_band band) :
36+
LoRaConnectionHandler::LoRaConnectionHandler(const char *_appeui, const char *_appkey, _lora_band band, _lora_class deviceClass) :
3737
appeui(_appeui),
3838
appkey(_appkey),
3939
band(band),
40+
deviceClass(deviceClass),
4041
lastConnectionTickTime(millis()),
4142
connectionTickTimeInterval(CHECK_INTERVAL_IDLE),
4243
keepAlive(false) {
@@ -135,6 +136,8 @@ NetworkConnectionState LoRaConnectionHandler::update_handleInit() {
135136
};
136137
//A delay is required between modem.begin(band) and modem.joinOTAA(appeui, appkey) in order to let the chip to be correctly initialized befor the connection attempt
137138
delay(100);
139+
modem.configureClass(deviceClass);
140+
delay(100);
138141
Debug.print(DBG_INFO, "Connecting to the network");
139142
connectionTickTimeInterval = CHECK_INTERVAL_CONNECTING;
140143
return NetworkConnectionState::CONNECTING;

src/Arduino_LoRaConnectionHandler.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ typedef enum {
4242

4343
class LoRaConnectionHandler : public LPWANConnectionHandler {
4444
public:
45-
LoRaConnectionHandler(const char *_appeui, const char *_appkey, _lora_band = EU868);
45+
LoRaConnectionHandler(const char *_appeui, const char *_appkey, _lora_band = _lora_band::EU868, _lora_class = _lora_class::CLASS_A);
4646

4747
void init();
4848
unsigned long getTime();
@@ -72,6 +72,7 @@ class LoRaConnectionHandler : public LPWANConnectionHandler {
7272
LoRaModem modem;
7373
const char *appeui, *appkey;
7474
_lora_band band;
75+
_lora_class deviceClass;
7576
unsigned long lastConnectionTickTime;
7677

7778
int connectionTickTimeInterval;

0 commit comments

Comments
 (0)