|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "CHeartBeatTimer.h" |
|
19 #include "MHeartBeatObserver.h" |
|
20 #include "SearchServerConfiguration.h" |
|
21 |
|
22 CHeartBeatTimer* CHeartBeatTimer::NewL(MHeartBeatObserver* aObserver) |
|
23 { |
|
24 CHeartBeatTimer* object = new ( ELeave ) CHeartBeatTimer(aObserver); |
|
25 CleanupStack::PushL(object); |
|
26 object->ConstructL(); |
|
27 CleanupStack::Pop(object); |
|
28 return object; |
|
29 } |
|
30 |
|
31 CHeartBeatTimer::CHeartBeatTimer(MHeartBeatObserver* aObserver) |
|
32 : CTimer(CActive::EPriorityStandard) |
|
33 { |
|
34 iObserver = aObserver; |
|
35 } |
|
36 |
|
37 CHeartBeatTimer::~CHeartBeatTimer() |
|
38 { |
|
39 Cancel(); |
|
40 } |
|
41 |
|
42 void CHeartBeatTimer::StopTimer() |
|
43 { |
|
44 Cancel(); |
|
45 } |
|
46 |
|
47 void CHeartBeatTimer::ContinueTimer() |
|
48 { |
|
49 Cancel(); |
|
50 After(HEARTBEAT_PERIOD_USEC); |
|
51 } |
|
52 |
|
53 void CHeartBeatTimer::ConstructL() |
|
54 { |
|
55 CTimer::ConstructL(); |
|
56 CActiveScheduler::Add(this); |
|
57 After(HEARTBEAT_PERIOD_USEC); |
|
58 } |
|
59 |
|
60 void CHeartBeatTimer::RunL() |
|
61 { |
|
62 if (iObserver) |
|
63 iObserver->HandleHeartBeatL(); |
|
64 After(HEARTBEAT_PERIOD_USEC); |
|
65 } |