method that returns the next wakeup time
This commit is contained in:
parent
caade67d62
commit
207fddddf0
1 changed files with 11 additions and 0 deletions
|
@ -97,6 +97,16 @@ public abstract class AbstractWakeupMote implements Mote {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Next wakeup time, or -1 if not scheduled
|
||||
*/
|
||||
public long getNextWakeupTime() {
|
||||
if (!executeMoteEvent.isScheduled()) {
|
||||
return -1;
|
||||
}
|
||||
return executeMoteEvent.getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute mote software at given time, or earlier.
|
||||
*
|
||||
|
@ -126,6 +136,7 @@ public abstract class AbstractWakeupMote implements Mote {
|
|||
/*logger.info("Rescheduled wakeup from " + executeMoteEvent.getTime() + " to " + time);*/
|
||||
executeMoteEvent.remove();
|
||||
}
|
||||
|
||||
simulation.scheduleEvent(executeMoteEvent, time);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue