| 1 |
NAME SoTimerSensor SoTimerSens "" { |
| 2 |
sensor that triggers callback repeatedly at regular intervals |
| 3 |
} |
| 4 |
INCLUDE sensors/SoTimerSensor.h |
| 5 |
DESC { |
| 6 |
Timer sensors trigger their callback function at regular intervals. |
| 7 |
For example, a timer might be setup to call its callback function |
| 8 |
every second on the second by setting the base time to \mSbTime(0.0)\. |
| 9 |
and the interval to \mSbTime(1.0)\.. Timers are guaranteed to be |
| 10 |
triggered only once when the timer queue is processed, so if the |
| 11 |
application only processes the timer queue once every 5 seconds |
| 12 |
(because it is busy doing something else) the once-a-second sensor's |
| 13 |
callback will be called only once every 5 seconds. |
| 14 |
\p |
| 15 |
Note also that \cSoTimer\.s always schedule themselves to be triggered the |
| 16 |
next even multiple of the interval time after the base time; so, for |
| 17 |
example, if the once-a-second sensor is triggered at time 2.9 (because |
| 18 |
the application way busy doing something at time 2.0 and didn't get |
| 19 |
around to processing the sensor queue for a while) it will reschedule |
| 20 |
itself to go off at time 3.0, not at time 3.9. If the base time was |
| 21 |
never set, the sensor would be scheduled for time 3.9. |
| 22 |
} |
| 23 |
|
| 24 |
METHOD "" SoTimerSensor() {} |
| 25 |
METHOD CreateCB SoTimerSensor(SoSensorCB *func, void *data) { |
| 26 |
Creation methods. The second method takes the callback function and |
| 27 |
data to be called when the sensor is triggered. |
| 28 |
} |
| 29 |
METHOD "" ~SoTimerSensor() { |
| 30 |
Destroys the sensor, freeing up any memory associated with it after |
| 31 |
unscheduling it. |
| 32 |
} |
| 33 |
METHOD "" void setBaseTime(const SbTime &base) {} |
| 34 |
METHOD "" const SbTime &getBaseTime() const {} |
| 35 |
METHOD "" void setInterval(const SbTime &interval) {} |
| 36 |
METHOD "" const SbTime &getInterval() const { |
| 37 |
Sets/gets the base time and the interval. The default base time is |
| 38 |
the time when the sensor is scheduled or rescheduled, and the default |
| 39 |
interval is 1/30th of a second. |
| 40 |
} |
| 41 |
|
| 42 |
ALSO { SoOneShotSensor, SoAlarmSensor, SoTimerQueueSensor, SbTime } |
| 43 |
|