Lora: Add clear method to LoRaWANTimer.

This function must be called by the callback registered in init.
It clears the timer_id to prevent abusive use of the stop methods on expired timer.
pull/14422/head
Vincent Coubard 2021-03-11 20:59:45 +00:00
parent eec320c991
commit 4885739c4e
2 changed files with 12 additions and 0 deletions

View File

@ -64,3 +64,8 @@ void LoRaWANTimeHandler::stop(timer_event_t &obj)
_queue->cancel(obj.timer_id);
obj.timer_id = 0;
}
void LoRaWANTimeHandler::clear(timer_event_t &obj)
{
obj.timer_id = 0;
}

View File

@ -76,6 +76,13 @@ public:
*/
void stop(timer_event_t &obj);
/** Clear timer state so it is not inadvertently canceled. This function
* must be called by the callback registered in init.
*
* @param [in] obj The structure containing the timer object parameters.
*/
void clear(timer_event_t &obj);
private:
events::EventQueue *_queue;
};