'\"! tbl | mmdoc '\"macro stdmacro .ie n \{\ . ds Cr \fB . ds Cb \fB .\} .el \{\ . ds Cr \f7 . ds Cb \f8 .\} .TH SoTimerSensor(3IV) .SH NAME SoTimerSensor \(em sensor that triggers callback repeatedly at regular intervals .SH INHERITS FROM SoSensor > SoTimerQueueSensor > SoTimerSensor .SH SYNOPSIS .ps -1 \*(Cr#include .sp .in 1i \f1Methods from class SoTimerSensor: .in 0.5i .sp .ta 20m .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Cr .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbSoTimerSensor\*(Cr() .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Cr .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbSoTimerSensor\*(Cr(SoSensorCB *func, void *data) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Cr .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(Cb~SoTimerSensor\*(Cr() .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crvoid .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbsetBaseTime\*(Cr(const SbTime &base) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crconst SbTime & .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbgetBaseTime\*(Cr() const .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crvoid .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbsetInterval\*(Cr(const SbTime &interval) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crconst SbTime & .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbgetInterval\*(Cr() const .sp .in 1i \f1Methods from class SoTimerQueueSensor: .in 0.5i .sp .ta 20m .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crconst SbTime & .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbgetTriggerTime\*(Cr() .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crvirtual void .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(Cbschedule\*(Cr() .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crvirtual void .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(Cbunschedule\*(Cr() .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crvirtual SbBool .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbisScheduled\*(Cr() .sp .in 1i \f1Methods from class SoSensor: .in 0.5i .sp .ta 20m .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crvoid .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbsetFunction\*(Cr(SoSensorCB *callbackFunction) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(CrSoSensorCB * .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbgetFunction\*(Cr() const .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crvoid .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbsetData\*(Cr(void *callbackData) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crvoid * .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbgetData\*(Cr() const .sp .SH DESCRIPTION Timer sensors trigger their callback function at regular intervals. For example, a timer might be setup to call its callback function every second on the second by setting the base time to \*(CbSbTime(0.0)\f1 and the interval \&to \*(CbSbTime(1.0)\f1. Timers are guaranteed to be triggered only once when the timer queue is processed, so if the application only processes the timer queue once every 5 seconds (because it is busy doing something else) \&the once-a-second sensor's callback will be called only once every 5 seconds. .sp Note also that \*(CbSoTimer\f1s always schedule themselves to be triggered the next even multiple of the interval time after the base time; \&so, for example, if the once-a-second sensor is triggered at time 2.9 (because the application way busy doing something at time 2.0 and didn't get around to processing the sensor queue for a while) it \&will reschedule itself to go off at time 3.0, not at time 3.9. If the base time was never set, the sensor would be scheduled for time 3.9. .SH METHODS .ta 20m .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Cr .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbSoTimerSensor\*(Cr() .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Cr .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbSoTimerSensor\*(Cr(SoSensorCB *func, void *data) .br .in 1i \f1Creation methods. The second method takes the callback function and data to be called when the sensor is triggered. .sp .in 0.5i .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Cr .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(Cb~SoTimerSensor\*(Cr() .br .in 1i \f1Destroys the sensor, freeing up any memory associated with it after unscheduling it. .sp .in 0.5i .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crvoid .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbsetBaseTime\*(Cr(const SbTime &base) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crconst SbTime & .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbgetBaseTime\*(Cr() const .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crvoid .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbsetInterval\*(Cr(const SbTime &interval) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crconst SbTime & .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbgetInterval\*(Cr() const .br .in 1i \f1Sets/gets the base time and the interval. The default base time is the time when the sensor is scheduled or rescheduled, and the default interval is 1/30th of a second. .sp .in 0.5i .SH SEE ALSO \*(CbSoOneShotSensor, SoAlarmSensor, SoTimerQueueSensor, SbTime