|
1 /* |
|
2 * Copyright (c) 2009-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: Implements helper class to handle location server tiimer related functionality |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "clocationservertimerhandler.h" |
|
19 #include "locationmanagerdebug.h" |
|
20 |
|
21 |
|
22 |
|
23 // -------------------------------------------------------------------------- |
|
24 // CLocationServerTimerHandler::CLocationServerTimerHandler |
|
25 // -------------------------------------------------------------------------- |
|
26 // |
|
27 CLocationServerTimerHandler::CLocationServerTimerHandler |
|
28 (MLocationServerTimerObserver& aLocationServerTimerObserver): |
|
29 CTimer(EPriorityStandard ), |
|
30 iLocationServerTimerObserver(aLocationServerTimerObserver), |
|
31 iLocationServerTimerType(MLocationServerTimerObserver::ELocGeneralPurpose) |
|
32 { |
|
33 } |
|
34 |
|
35 // -------------------------------------------------------------------------- |
|
36 // CLocationServerTimerHandler::~CLocationServerTimerHandler |
|
37 // -------------------------------------------------------------------------- |
|
38 // |
|
39 CLocationServerTimerHandler::~CLocationServerTimerHandler() |
|
40 { |
|
41 LOG ("CLocationServerTimerHandler::~CLocationServerTimerHandler(), begin"); |
|
42 Cancel(); |
|
43 LOG ("CLocationServerTimerHandler::~CLocationServerTimerHandler(), end"); |
|
44 } |
|
45 |
|
46 // -------------------------------------------------------------------------- |
|
47 // CLocationServerTimerHandler::NewL |
|
48 // -------------------------------------------------------------------------- |
|
49 // |
|
50 CLocationServerTimerHandler* CLocationServerTimerHandler::NewL(MLocationServerTimerObserver& aLocationServerTimerObserver) |
|
51 { |
|
52 CLocationServerTimerHandler* self = |
|
53 new( ELeave ) CLocationServerTimerHandler(aLocationServerTimerObserver); |
|
54 CleanupStack::PushL( self ); |
|
55 self->ConstructL(); |
|
56 CleanupStack::Pop(); |
|
57 return self; |
|
58 } |
|
59 |
|
60 |
|
61 // -------------------------------------------------------------------------- |
|
62 // CLocationServerTimerHandler::ConstructL |
|
63 // -------------------------------------------------------------------------- |
|
64 // |
|
65 void CLocationServerTimerHandler::ConstructL() |
|
66 { |
|
67 LOG ("CLocationServerTimerHandler::ConstructL(), begin"); |
|
68 CActiveScheduler::Add(this); |
|
69 CTimer::ConstructL(); |
|
70 LOG ("CLocationServerTimerHandler::ConstructL(), end"); |
|
71 } |
|
72 |
|
73 // -------------------------------------------------------------------------- |
|
74 // CLocationServerTimerHandler::StartTimer |
|
75 // -------------------------------------------------------------------------- |
|
76 // |
|
77 void CLocationServerTimerHandler::StartTimer(const TTimeIntervalMicroSeconds32 anInterval, |
|
78 const MLocationServerTimerObserver::TLocationServerTimerType aLocationServerTimerType) |
|
79 { |
|
80 LOG ("CLocationServerTimerHandler::StartTimer(), begin"); |
|
81 if(!IsActive()) |
|
82 { |
|
83 LOG1("Starting timer of type - %d", aLocationServerTimerType); |
|
84 // not active. |
|
85 iLocationServerTimerType = aLocationServerTimerType; |
|
86 After( anInterval ); |
|
87 } |
|
88 LOG ("CLocationServerTimerHandler::StartTimer(), end"); |
|
89 } |
|
90 |
|
91 |
|
92 // -------------------------------------------------------------------------- |
|
93 // CLocationServerTimerHandler::RunL |
|
94 // -------------------------------------------------------------------------- |
|
95 // |
|
96 void CLocationServerTimerHandler::RunL( ) |
|
97 { |
|
98 LOG ("CLocationServerTimerHandler::RunL(), begin"); |
|
99 TInt status = iStatus.Int(); |
|
100 LOG1("Error code - %d", status); |
|
101 iLocationServerTimerObserver.LocationServerTimerCallBackL |
|
102 (iLocationServerTimerType,status); |
|
103 LOG ("CLocationServerTimerHandler::RunL(), end"); |
|
104 } |
|
105 |
|
106 |
|
107 // End of file |
|
108 |