/** \brief Handler for DAO timer event. \note This function is executed in task context, called by the scheduler. */ void icmpv6rpl_timer_DAO_task() { uint32_t daoPeriod; // send DAO sendDAO(); // arm the DAO timer with this new value daoPeriod = icmpv6rpl_vars.daoPeriod - 0x80 + (openrandom_get16b()&0xff); opentimers_setPeriod( icmpv6rpl_vars.timerIdDAO, TIME_MS, daoPeriod ); }
/** \brief Handler for DAO timer event. \note This function is executed in task context, called by the scheduler. */ void icmpv6rpl_timer_DAO_task() { // update the delayDAO icmpv6rpl_vars.delayDAO = (icmpv6rpl_vars.delayDAO+1)%5; // check whether we need to send DAO if (icmpv6rpl_vars.delayDAO==0) { // send DAO sendDAO(); // pick a new pseudo-random periodDAO icmpv6rpl_vars.periodDAO = TIMER_DAO_TIMEOUT+(openrandom_get16b()&0xff); // arm the DAO timer with this new value opentimers_setPeriod( icmpv6rpl_vars.timerIdDAO, TIME_MS, icmpv6rpl_vars.periodDAO ); } }