method that returns the next wakeup time

This commit is contained in:
Fredrik Osterlind 2012-01-26 16:14:20 +01:00
parent caade67d62
commit 207fddddf0

View file

@ -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. * 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);*/ /*logger.info("Rescheduled wakeup from " + executeMoteEvent.getTime() + " to " + time);*/
executeMoteEvent.remove(); executeMoteEvent.remove();
} }
simulation.scheduleEvent(executeMoteEvent, time); simulation.scheduleEvent(executeMoteEvent, time);
return true; return true;
} }