diff -r ebc84c812384 -r 46218c8b8afa Symbian3/PDK/Source/GUID-078E6232-31FA-5582-84B8-F5E3E4B14A05.dita --- a/Symbian3/PDK/Source/GUID-078E6232-31FA-5582-84B8-F5E3E4B14A05.dita Thu Mar 11 15:24:26 2010 +0000 +++ b/Symbian3/PDK/Source/GUID-078E6232-31FA-5582-84B8-F5E3E4B14A05.dita Thu Mar 11 18:02:22 2010 +0000 @@ -1,46 +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 - } + + + + + +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:

+
    +
  • a function Beat() that +is called if the heartbeat timer is in synchronisation with the system clock

  • +
  • a function Synchronize() that +is called if the heartbeat timer has got out of synchronisation with the system +clock

  • +
+

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