[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.
pull/6087/head
Hasnain Virk 2017-12-18 14:36:33 +02:00 committed by Jimmy Brisson
parent 05e2d29238
commit 97f1680586
5 changed files with 1 additions and 70 deletions

View File

@ -200,7 +200,6 @@ lora_mac_status_t LoRaWANStack::initialize_mac_layer(EventQueue *queue)
LoRaMacPrimitives.MacMcpsConfirm = callback(this, &LoRaWANStack::mcps_confirm);
LoRaMacPrimitives.MacMcpsIndication = callback(this, &LoRaWANStack::mcps_indication);
LoRaMacPrimitives.MacMlmeConfirm = callback(this, &LoRaWANStack::mlme_confirm);
LoRaMacCallbacks.TxNextPacketTimerEvent = callback(this, &LoRaWANStack::on_tx_next_packet_timer_event);
LoRaMacInitialization(&LoRaMacPrimitives, &LoRaMacCallbacks, &lora_phy, queue);
mib_req.type = LORA_MIB_ADR;
@ -363,40 +362,6 @@ lora_mac_status_t LoRaWANStack::send_frame_to_mac()
return status;
}
/**
* Function executed on TxNextPacket Timeout event
*/
void LoRaWANStack::on_tx_next_packet_timer_event(void)
{
lora_mac_mib_request_confirm_t mib_req;
mib_req.type = LORA_MIB_NETWORK_JOINED;
if (mib_get_request(&mib_req) != LORA_MAC_STATUS_OK) {
// This should never happen
MBED_ASSERT("LoRaWAN Stack corrupted.");
}
// If is_network_joined flag is false, it means device haven't
// joined the network yet via OTAA
if (!mib_req.param.is_network_joined) {
set_device_state(DEVICE_STATE_JOINING);
lora_state_machine();
return;
}
// If compliance test is running, then we jump to send compliance test frame.
if (_compliance_test.running == true) {
set_device_state(DEVICE_STATE_COMPLIANCE_TEST);
lora_state_machine();
} else {
// Otherwise, either device have joined the network or ABP is in use.
// In case of ABP, we already have DevAddr, NwkSkey, AppSkey
// so we jump to send state directly
set_device_state(DEVICE_STATE_SEND);
lora_state_machine();
}
}
lora_mac_status_t LoRaWANStack::set_confirmed_msg_retry(uint8_t count)
{
if (count >= MAX_CONFIRMED_MSG_RETRIES) {

View File

@ -306,12 +306,6 @@ private:
*/
lora_mac_status_t send_frame_to_mac();
/**
* Callback function for transmission based on user defined timer.
* Used only for testing when duty cycle is off.
*/
void on_tx_next_packet_timer_event(void);
/**
* Callback function for MCPS confirm. Mac layer calls this function once
* an MCPS confirmation is received. This method translates Mac layer data

View File

@ -329,11 +329,6 @@ uint32_t LoRaMacState = LORAMAC_IDLE;
*/
static TimerEvent_t MacStateCheckTimer;
/**
* Timer to handle the application data transmission duty cycle
*/
static TimerEvent_t TxNextPacketTimer;
/*!
* LoRaMac upper layer event functions
*/
@ -470,11 +465,6 @@ static void OnMacStateCheckTimerEvent( void );
*/
static void OnTxDelayedTimerEvent( void );
/**
* \brief Function to be executed when next Tx is possible
*/
static void OnNextTx( void );
/*!
* \brief Function executed on first Rx window timer event
*/
@ -647,7 +637,6 @@ static void handle_rx2_timer_event(void);
static void handle_ack_timeout(void);
static void handle_delayed_tx_timer_event(void);
static void handle_mac_state_check_timer_event(void);
static void handle_next_tx_timer_event(void);
/***************************************************************************
* ISRs - Handlers *
@ -694,16 +683,6 @@ static void handle_mac_state_check_timer_event(void)
ev_queue->call(OnMacStateCheckTimerEvent);
}
static void handle_next_tx_timer_event(void)
{
// Validate if the MAC is in a correct state
if ((LoRaMacState & LORAMAC_TX_RUNNING) == LORAMAC_TX_RUNNING) {
return;
}
ev_queue->call(OnNextTx);
}
static void handle_delayed_tx_timer_event(void)
{
ev_queue->call(OnTxDelayedTimerEvent);
@ -1547,12 +1526,6 @@ static void OnMacStateCheckTimerEvent( void )
}
}
static void OnNextTx( void )
{
TimerStop( &TxNextPacketTimer );
LoRaMacCallbacks->TxNextPacketTimerEvent( );
}
LoRaMacStatus_t LoRaMacSetTxTimer( uint32_t TxDutyCycleTime )
{
TimerSetValue(&TxNextPacketTimer, TxDutyCycleTime);
@ -2603,7 +2576,6 @@ LoRaMacStatus_t LoRaMacInitialization(LoRaMacPrimitives_t *primitives,
TimerInit(&RxWindowTimer1, handle_rx1_timer_event);
TimerInit(&RxWindowTimer2, handle_rx2_timer_event);
TimerInit(&AckTimeoutTimer, handle_ack_timeout);
TimerInit(&TxNextPacketTimer, handle_next_tx_timer_event);
// Store the current initialization time
LoRaMacInitializationTime = TimerGetCurrentTime();

View File

@ -331,6 +331,7 @@ LoRaMacStatus_t LoRaMacMcpsRequest( McpsReq_t *mcpsRequest );
*/
radio_events_t *GetPhyEventHandlers();
/**
* \brief LoRaMAC set tx timer.
*

View File

@ -1635,7 +1635,6 @@ typedef struct sLoRaMacCallback
*/
uint8_t ( *GetBatteryLevel )( void );
mbed::Callback<void()> TxNextPacketTimerEvent;
}LoRaMacCallback_t;
/**