A behavior that is executed every specified period based on the physical layer clock.
If the PHY supports a more accurate clock than the local clock used by the TickerBehavior, then this behavior may be used instead of the TickerBehavior. Moreover, this becomes important for use in slotted protocols, if the PHY clock is synchronized across the network.
The onTick() method of this behavior is called at intervals defined by the period.
Constructor and description |
---|
PhyTickerBehavior
(long millis) Creates a behavior that is executed every specified period. |
Type Params | Return Type | Name and description |
---|---|---|
|
void |
action() This method calls onTick() once every specified period. |
|
boolean |
done() Returns true once stop() is called, false otherwise. |
|
protected long |
getPhyTime() |
|
int |
getTickCount() Returns the number of times the onTick() method of this behavior has been called (including any ongoing call). |
|
void |
onStart() Computes the wakeup time for the first execution of this behavior. |
|
void |
onTick() This method is called once every specified period. |
|
void |
reset() Resets the behavior, allowing it to be used again. |
|
void |
stop() Terminates the behavior. |
Methods inherited from class | Name |
---|---|
class Behavior |
println, reset, onStart, done, block, block, action, restart, onEnd, agent, isBlocked, agentForService, agentForService, agentsForService, agentsForService, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
class Object |
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Creates a behavior that is executed every specified period.
millis
- period in milliseconds.This method calls onTick() once every specified period.
Returns true once stop() is called, false otherwise.
Returns the number of times the onTick() method of this behavior has been called (including any ongoing call).
Computes the wakeup time for the first execution of this behavior.
This method is called once every specified period. The method is usually overridden by a behavior.
Resets the behavior, allowing it to be used again.
Terminates the behavior.
Copyright 2013-19, Acoustic Research Laboratory, National University of Singapore, and Subnero Pte Ltd