|
1 /* |
|
2 * Copyright (c) 2008 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: Timer used to delay state changes |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "cdelaystatechangetimer.h" |
|
21 #include "clocationprovider.h" |
|
22 |
|
23 using namespace java::location; |
|
24 |
|
25 // CONSTANTS |
|
26 |
|
27 // ============================ MEMBER FUNCTIONS =============================== |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CDelayStateChangeTimer::CDelayStateChangeTimer |
|
31 // C++ default constructor can NOT contain any code, that |
|
32 // might leave. |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 CDelayStateChangeTimer::CDelayStateChangeTimer( |
|
36 CLocationProvider* aLocationProvider) : |
|
37 CTimer(EPriorityNormal), iLocationProvider(aLocationProvider) |
|
38 { |
|
39 CActiveScheduler::Add(this); |
|
40 } |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // CDelayStateChangeTimer::NewL |
|
44 // Two-phased constructor. |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 CDelayStateChangeTimer* CDelayStateChangeTimer::NewL( |
|
48 CLocationProvider* aLocationProvider) |
|
49 { |
|
50 CDelayStateChangeTimer* self = |
|
51 new(ELeave) CDelayStateChangeTimer(aLocationProvider); |
|
52 CleanupStack::PushL(self); |
|
53 self->ConstructL(); |
|
54 CleanupStack::Pop(self); |
|
55 return self; |
|
56 } |
|
57 |
|
58 // Destructor |
|
59 CDelayStateChangeTimer::~CDelayStateChangeTimer() |
|
60 { |
|
61 Cancel(); |
|
62 } |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // CDelayStateChangeTimer::ChangeStateAfter |
|
66 // (other items were commented in a header). |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 void CDelayStateChangeTimer::ChangeStateAfter( |
|
70 const TTimeIntervalMicroSeconds32& aInterval, TInt aNewState) |
|
71 { |
|
72 iNewState = aNewState; |
|
73 CTimer::After(aInterval); |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CDelayStateChangeTimer::RunL |
|
78 // (other items were commented in a header). |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 void CDelayStateChangeTimer::RunL() |
|
82 { |
|
83 iLocationProvider->ChangeState(iNewState); |
|
84 } |
|
85 |
|
86 // End of File |