|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CLOCATIONPROVIDER_H |
|
20 #define CLOCATIONPROVIDER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <lbs.h> |
|
25 #include <jni.h> |
|
26 #include "locationfunctionserver.h" |
|
27 |
|
28 namespace java |
|
29 { |
|
30 namespace location |
|
31 { |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class LocationFunctionServer; |
|
35 class CPositioner; |
|
36 class CTrackingPositioner; |
|
37 class CPosGlobalPrivacyDb; |
|
38 class CDelayStateChangeTimer; |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 /** |
|
43 * Handles LocationProvider operations. |
|
44 */ |
|
45 class CLocationProvider: public CActive |
|
46 { |
|
47 public: |
|
48 // Constructors and destructor |
|
49 |
|
50 /** |
|
51 * Two-phased constructor. |
|
52 */ |
|
53 static void NewL(LocationFunctionServer* aFunctionSource, TInt* aHandle); |
|
54 |
|
55 /** |
|
56 * Destructor. |
|
57 */ |
|
58 ~CLocationProvider(); |
|
59 |
|
60 public: |
|
61 // New functions |
|
62 |
|
63 static void StaticCreatePositionerL(JNIEnv* aJni, jobject aPositioner, |
|
64 CLocationProvider* aSelf, TInt* aHandle, |
|
65 LocationFunctionServer* aFunctionSource); |
|
66 |
|
67 void SelectModuleL(TInt aHacc, TInt aVacc, TInt aRespTime, TInt aPower, |
|
68 TInt aRequiredFlags, TInt* aLocationMethod); |
|
69 |
|
70 protected: |
|
71 // Functions from base classes |
|
72 |
|
73 /** |
|
74 * From CBase |
|
75 */ |
|
76 void RunL(); |
|
77 |
|
78 /** |
|
79 * From CBase |
|
80 */ |
|
81 void DoCancel(); |
|
82 |
|
83 private: |
|
84 |
|
85 /** |
|
86 * C++ default constructor. |
|
87 */ |
|
88 CLocationProvider(LocationFunctionServer* aEventSource); |
|
89 |
|
90 /** |
|
91 * By default Symbian 2nd phase constructor is private. |
|
92 */ |
|
93 void ConstructL(); |
|
94 |
|
95 private: |
|
96 |
|
97 CPositioner* CreatePositionerL(); |
|
98 |
|
99 static TBool CheckRequirements(const TPositionQuality& aQuality, |
|
100 TPositionModuleInfo::TCapabilities aCaps, TInt aHacc, TInt aVacc, |
|
101 TInt aRespTime, TInt aPower, TInt aRequiredFlags); |
|
102 |
|
103 void RequestModuleStatus(); |
|
104 |
|
105 TInt StatusToState(TPositionModuleStatus& aStatus); |
|
106 |
|
107 void ChangeState(TInt aState); |
|
108 |
|
109 TBool AllLocationRequestsDeniedL(); |
|
110 |
|
111 public: |
|
112 CTrackingPositioner* iTrackingPositioner; |
|
113 |
|
114 // JNI Environment Data |
|
115 JNIEnv* mJni; |
|
116 jobject mPeer; |
|
117 |
|
118 // Location Updated Callback JNI Method ID |
|
119 jmethodID mStateChangMethod; |
|
120 |
|
121 private: |
|
122 // Data |
|
123 LocationFunctionServer* mFunctionServer; |
|
124 RPositionServer iPositionServer; |
|
125 TPositionModuleId iModuleId; |
|
126 TPositionModuleInfo::TCapabilities iCapabilities; |
|
127 TPositionModuleStatusEvent iStatusEvent; |
|
128 TInt iState; |
|
129 TInt iNewState; |
|
130 CDelayStateChangeTimer* iStateTimer; |
|
131 private: |
|
132 friend class CDelayStateChangeTimer; |
|
133 }; |
|
134 |
|
135 } |
|
136 } |
|
137 #endif // CLOCATIONPROVIDER_H |
|
138 // End of File |