diff -r 000000000000 -r 89d6a7a84779 Symbian3/SDK/Source/GUID-078E6232-31FA-5582-84B8-F5E3E4B14A05.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-078E6232-31FA-5582-84B8-F5E3E4B14A05.dita Thu Jan 21 18:18:20 2010 +0000 @@ -0,0 +1,46 @@ + + + + + +How +to start a heartbeat timerProvides code snippet to show you how to start a heartbeat timer. +

A heartbeat timer, CHeartbeat, invokes a function at regular +intervals. You must define a class that implements the MBeating interface +to define:

+ +

First, we define a class CHeartbeatRunner class that derives +from MBeating.

+class CHeartbeatRunner: public MBeating + { +public: + // Implement MBeating + void Beat(); + void Synchronize(); + + // Start timer + void StartTimer(); +private: + CHeartbeat* iHeartbeat; +}; +

Then, we can start the heartbeat timer. We pass the time interval for the +beats (allowable intervals are defined in 1/12s of a second by TTimerLockSpec), +and the object implementing MBeating.

+void CHeartbeatRunner::StartTimer() + { + iHeartbeat=CHeartbeat::NewL(0); // neutral priority + iHeartbeat->Start(ETwelveOClock,this); // 1 second intervals + } +
\ No newline at end of file