Sahel Vafa
Sahel Vafa

Reputation: 26

How to disable Trickle Timer in Contiki-NG?

I have one question for you. I want to disable the trickle timer in the rpl-mrhof.c file. I defined one flag name as Trickle_flag. I want to disable the Trickle timer in my program when the Trickle_flag is equal to 1 and the DIO transmissions will be suppressed. When the Trickle_flag is equal to 0 the DIO transmissions will be continued. I want to stop all node's DIO transmissions. Any idea how to change the trickle function?

Upvotes: 1

Views: 177

Answers (1)

kfx
kfx

Reputation: 8537

The correct way how to disable a trickle timer is to call the trickle_timer_stop(tt) macro, where tt is the timer to stop. See the documentation of this macro.

Stopping DIO transmissions is a different question though. The Contiki RPL implementation was developed before the Trickle timer library existed, so it does not use the Trickle timer API, but instead implements the Trickle timers internally, through callback timers (struct ctimer). Don't use ctimer_stop(&instance->dio_timer) for this either, it will not give reliable results, as the rpl_reset_dio_timer function may be called by some events, which will restart the timer. Your best approach is filter out the DIO messages before they are sent, instead of messing with the Trickle timers in a way that's not expected by the developers of the code. You can add an if statement to dio_output based on the flag value, for example, to return immediately if the DIO suppression flag is set.

Upvotes: 0

Related Questions