Skip to content

Commit 97f1680

Browse files
Hasnain Virktheotherjimmy
authored andcommitted
[IOTCELL-270] Detaching TxNextPacketTimer
TxNextPacketTimer callback was being used for testing only (compliance testing to be precise). Now there are independent methods and direct calls to automatic timers for the compliance testing so there is no particular need for this timer anymore.
1 parent 05e2d29 commit 97f1680

File tree

5 files changed

+1
-70
lines changed

5 files changed

+1
-70
lines changed

features/lorawan/LoRaWANStack.cpp

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ lora_mac_status_t LoRaWANStack::initialize_mac_layer(EventQueue *queue)
200200
LoRaMacPrimitives.MacMcpsConfirm = callback(this, &LoRaWANStack::mcps_confirm);
201201
LoRaMacPrimitives.MacMcpsIndication = callback(this, &LoRaWANStack::mcps_indication);
202202
LoRaMacPrimitives.MacMlmeConfirm = callback(this, &LoRaWANStack::mlme_confirm);
203-
LoRaMacCallbacks.TxNextPacketTimerEvent = callback(this, &LoRaWANStack::on_tx_next_packet_timer_event);
204203
LoRaMacInitialization(&LoRaMacPrimitives, &LoRaMacCallbacks, &lora_phy, queue);
205204

206205
mib_req.type = LORA_MIB_ADR;
@@ -363,40 +362,6 @@ lora_mac_status_t LoRaWANStack::send_frame_to_mac()
363362
return status;
364363
}
365364

366-
/**
367-
* Function executed on TxNextPacket Timeout event
368-
*/
369-
void LoRaWANStack::on_tx_next_packet_timer_event(void)
370-
{
371-
lora_mac_mib_request_confirm_t mib_req;
372-
mib_req.type = LORA_MIB_NETWORK_JOINED;
373-
374-
if (mib_get_request(&mib_req) != LORA_MAC_STATUS_OK) {
375-
// This should never happen
376-
MBED_ASSERT("LoRaWAN Stack corrupted.");
377-
}
378-
379-
// If is_network_joined flag is false, it means device haven't
380-
// joined the network yet via OTAA
381-
if (!mib_req.param.is_network_joined) {
382-
set_device_state(DEVICE_STATE_JOINING);
383-
lora_state_machine();
384-
return;
385-
}
386-
387-
// If compliance test is running, then we jump to send compliance test frame.
388-
if (_compliance_test.running == true) {
389-
set_device_state(DEVICE_STATE_COMPLIANCE_TEST);
390-
lora_state_machine();
391-
} else {
392-
// Otherwise, either device have joined the network or ABP is in use.
393-
// In case of ABP, we already have DevAddr, NwkSkey, AppSkey
394-
// so we jump to send state directly
395-
set_device_state(DEVICE_STATE_SEND);
396-
lora_state_machine();
397-
}
398-
}
399-
400365
lora_mac_status_t LoRaWANStack::set_confirmed_msg_retry(uint8_t count)
401366
{
402367
if (count >= MAX_CONFIRMED_MSG_RETRIES) {

features/lorawan/LoRaWANStack.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -306,12 +306,6 @@ class LoRaWANStack: private mbed::NonCopyable<LoRaWANStack> {
306306
*/
307307
lora_mac_status_t send_frame_to_mac();
308308

309-
/**
310-
* Callback function for transmission based on user defined timer.
311-
* Used only for testing when duty cycle is off.
312-
*/
313-
void on_tx_next_packet_timer_event(void);
314-
315309
/**
316310
* Callback function for MCPS confirm. Mac layer calls this function once
317311
* an MCPS confirmation is received. This method translates Mac layer data

features/lorawan/lorastack/mac/LoRaMac.cpp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -329,11 +329,6 @@ uint32_t LoRaMacState = LORAMAC_IDLE;
329329
*/
330330
static TimerEvent_t MacStateCheckTimer;
331331

332-
/**
333-
* Timer to handle the application data transmission duty cycle
334-
*/
335-
static TimerEvent_t TxNextPacketTimer;
336-
337332
/*!
338333
* LoRaMac upper layer event functions
339334
*/
@@ -470,11 +465,6 @@ static void OnMacStateCheckTimerEvent( void );
470465
*/
471466
static void OnTxDelayedTimerEvent( void );
472467

473-
/**
474-
* \brief Function to be executed when next Tx is possible
475-
*/
476-
static void OnNextTx( void );
477-
478468
/*!
479469
* \brief Function executed on first Rx window timer event
480470
*/
@@ -647,7 +637,6 @@ static void handle_rx2_timer_event(void);
647637
static void handle_ack_timeout(void);
648638
static void handle_delayed_tx_timer_event(void);
649639
static void handle_mac_state_check_timer_event(void);
650-
static void handle_next_tx_timer_event(void);
651640

652641
/***************************************************************************
653642
* ISRs - Handlers *
@@ -694,16 +683,6 @@ static void handle_mac_state_check_timer_event(void)
694683
ev_queue->call(OnMacStateCheckTimerEvent);
695684
}
696685

697-
static void handle_next_tx_timer_event(void)
698-
{
699-
// Validate if the MAC is in a correct state
700-
if ((LoRaMacState & LORAMAC_TX_RUNNING) == LORAMAC_TX_RUNNING) {
701-
return;
702-
}
703-
704-
ev_queue->call(OnNextTx);
705-
}
706-
707686
static void handle_delayed_tx_timer_event(void)
708687
{
709688
ev_queue->call(OnTxDelayedTimerEvent);
@@ -1547,12 +1526,6 @@ static void OnMacStateCheckTimerEvent( void )
15471526
}
15481527
}
15491528

1550-
static void OnNextTx( void )
1551-
{
1552-
TimerStop( &TxNextPacketTimer );
1553-
LoRaMacCallbacks->TxNextPacketTimerEvent( );
1554-
}
1555-
15561529
LoRaMacStatus_t LoRaMacSetTxTimer( uint32_t TxDutyCycleTime )
15571530
{
15581531
TimerSetValue(&TxNextPacketTimer, TxDutyCycleTime);
@@ -2603,7 +2576,6 @@ LoRaMacStatus_t LoRaMacInitialization(LoRaMacPrimitives_t *primitives,
26032576
TimerInit(&RxWindowTimer1, handle_rx1_timer_event);
26042577
TimerInit(&RxWindowTimer2, handle_rx2_timer_event);
26052578
TimerInit(&AckTimeoutTimer, handle_ack_timeout);
2606-
TimerInit(&TxNextPacketTimer, handle_next_tx_timer_event);
26072579

26082580
// Store the current initialization time
26092581
LoRaMacInitializationTime = TimerGetCurrentTime();

features/lorawan/lorastack/mac/LoRaMac.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ LoRaMacStatus_t LoRaMacMcpsRequest( McpsReq_t *mcpsRequest );
331331
*/
332332
radio_events_t *GetPhyEventHandlers();
333333

334+
334335
/**
335336
* \brief LoRaMAC set tx timer.
336337
*

features/lorawan/system/lorawan_data_structures.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1635,7 +1635,6 @@ typedef struct sLoRaMacCallback
16351635
*/
16361636
uint8_t ( *GetBatteryLevel )( void );
16371637

1638-
mbed::Callback<void()> TxNextPacketTimerEvent;
16391638
}LoRaMacCallback_t;
16401639

16411640
/**

0 commit comments

Comments
 (0)