Hi all
Please help me
When a node in smac select your scheduler in function "void
SMAC::setMySched(Packet *pkt)"
Then it execute follow instruction
"mhCounter_[0]->sched(CLKTICK2SEC(listenTime_));"
My question is :
1- in the follow function in this instruction "TimerHandler::sched(time)"
after time seconds what expire function is running????
2- What is meaining TIMER_IDLE,TIMER_PENDINIG and TIMER_HANDLING?
In the void SmacCounterTimer::sched(double time) {
// the cycle timer assumes that all time shall be scheduled
with time "left to sleep"
// and not the absolute time for a given state (sleep, sync
or data). Thus inorder
// to schedule for a sleep state, need to schedule with
aggregate time CYCLETIME
// (sleeptime+synctime+dadatime).
// Similarly for sync state, schedule with listenTime_
(synctime+datattime)
// This is implemented to be in step with the counter used
in actual smac.
tts_ = time; // time before it goes to sleep again
stime_ = Scheduler::instance().clock();
if (time <= CLKTICK2SEC(cycleTime_) && time >
CLKTICK2SEC(listenTime_)) { // in sleep state
value_ = sleepTime_;
if (status_ == TIMER_IDLE)
TimerHandler::sched(time -
CLKTICK2SEC(listenTime_));
else
TimerHandler::resched(time -
CLKTICK2SEC(listenTime_));
} else if ( time <= CLKTICK2SEC(listenTime_) && time >
CLKTICK2SEC(dataTime_)) { // in sync state
value_ = syncTime_;
printf("\ndididididididid\n");
if (status_ == TIMER_IDLE)
TimerHandler::sched(time -
CLKTICK2SEC(dataTime_));
else
TimerHandler::resched(time -
CLKTICK2SEC(dataTime_));
} else { // in data state
assert(time <= CLKTICK2SEC(dataTime_));
value_ = dataTime_;
if (status_ == TIMER_IDLE)
TimerHandler::sched(time);
else
TimerHandler::resched(time);
}
}
The second question is:
In the SMAC protocol when receiving packet from network function smac::recv
is call
Then how to handleRecvTimer function is call??
I'm waiting for your reply
Thanks in advanced
Bye
--
Amin Irandoost