|
1 /* |
|
2 * Copyright (c) 2005-2009 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 |
|
20 |
|
21 #ifndef BTGPSREQUESTHANDLER_H |
|
22 #define BTGPSREQUESTHANDLER_H |
|
23 |
|
24 // INCLUDES |
|
25 |
|
26 #include <e32std.h> |
|
27 #include <e32base.h> |
|
28 #include <lbspositioninfo.h> |
|
29 #include "BTGPSLocationFixListener.h" |
|
30 #include "BTGPSDeviceListener.h" |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 |
|
34 class CBTGPSConstantsManager; |
|
35 class CBTGPSConnectManager; |
|
36 class CBTGPSInitManager; |
|
37 class CBTGPSRequestManager; |
|
38 class CBTGPSSettingManager; |
|
39 class CBTGPSDeviceManager; |
|
40 class CBTGPSPsyConnectionManager; |
|
41 class MBTGPSPositionerExt; |
|
42 class CBTGPSFix; |
|
43 class CBTGPSNokDeviceHandler; |
|
44 class CBTGPSModuleStatusHandler; |
|
45 class CBTGPSEnvChangeHandler; |
|
46 class CBTGPSPowerManager; |
|
47 class CBTGPSDeviceListManager; |
|
48 |
|
49 // CLASS DECLARATION |
|
50 |
|
51 /** |
|
52 * Singleton CBTGPSRequestHandler controls the operation of the PSY. |
|
53 * The request handler is the singleton object of PSY and it owns other manager |
|
54 * objects. |
|
55 * |
|
56 * |
|
57 */ |
|
58 class CBTGPSRequestHandler : |
|
59 public CBase, |
|
60 private MBTGPSLocationFixListener, |
|
61 private MBTGPSDeviceListener |
|
62 { |
|
63 public: // Constructors and destructor |
|
64 |
|
65 /** |
|
66 * Singleton can be only created through GetInstanceL. |
|
67 */ |
|
68 static CBTGPSRequestHandler* GetInstanceL(); |
|
69 |
|
70 public: // New functions |
|
71 |
|
72 /** |
|
73 * Return reference of singleton. This funciton will panic if |
|
74 * singleton has not been constructed. |
|
75 * @return Reference to request handler singleton objects. |
|
76 */ |
|
77 static CBTGPSRequestHandler& Instance(); |
|
78 |
|
79 /** |
|
80 * Get reference to Constants Manager |
|
81 * @return Reference to contants manager. |
|
82 */ |
|
83 static CBTGPSConstantsManager& ConstantsManager(); |
|
84 |
|
85 /** |
|
86 * Starts the location retrieval from GPS device |
|
87 * @param aPSY Reference to the CBTGPSPositioner |
|
88 */ |
|
89 void AcquireLocation(MBTGPSPositionerExt* aPSY); |
|
90 |
|
91 /** |
|
92 * Cancels the location retrieval |
|
93 * @param aPSY Reference to the CBTGPSPositioner |
|
94 */ |
|
95 void CancelAcquireLocation(MBTGPSPositionerExt* aPSY); |
|
96 |
|
97 /** |
|
98 * Registeres the PSY instance to the request handler |
|
99 * @param aPSY Reference to the CBTGPSPositioner |
|
100 */ |
|
101 void RegisterPSYL(MBTGPSPositionerExt* aPSY); |
|
102 |
|
103 /** |
|
104 * Unregisteres the PSY instance to the request handler |
|
105 * @param aPSY Reference to the CBTGPSPositioner |
|
106 */ |
|
107 void UnregisterPSY(MBTGPSPositionerExt* aPSY); |
|
108 |
|
109 /** |
|
110 * Starts the tracking session |
|
111 * @param aPSY Reference to the CBTGPSPositioner starting the session |
|
112 * @param aInterval The location retrieval interval. |
|
113 */ |
|
114 void TrackingSessionStartL(MBTGPSPositionerExt* aPSY, |
|
115 const TTimeIntervalMicroSeconds& aInterval); |
|
116 |
|
117 /** |
|
118 * Stops the tracking session |
|
119 * @param aPSY Reference to the CBTGPSPositioner stopping the session |
|
120 */ |
|
121 void TrackingSessionStop(MBTGPSPositionerExt* aPSY); |
|
122 |
|
123 /** |
|
124 * Returns the fix that fulfills the requirements aAcceptPartial |
|
125 * and aStatus. |
|
126 * @param aFix A reference to the pointer to fix |
|
127 * @param aMaxAge The criteria for maximum age for the fix |
|
128 * @param aAcceptPartial The criteria for partial update |
|
129 * @return KErrNone if the fix fulfills the requirements, |
|
130 * otherwise KErrNotFound. |
|
131 */ |
|
132 TInt LastLocation( |
|
133 const CBTGPSFix*& aFix, |
|
134 const TTime& aMaxAge, |
|
135 const TBool aAcceptPartial); |
|
136 |
|
137 private: // New functions |
|
138 /** |
|
139 * Acquire location(leave function) |
|
140 */ |
|
141 void AcquireLocationL(MBTGPSPositionerExt* aPSY); |
|
142 |
|
143 /** |
|
144 * Complete request |
|
145 */ |
|
146 void CompleteRequest( |
|
147 MBTGPSPositionerExt& aPSY, |
|
148 TInt aErr); |
|
149 |
|
150 /** |
|
151 * Completes all pending requests. |
|
152 * @param aStatus The status to complete with. |
|
153 */ |
|
154 void CompleteAllRequests(TInt aErr); |
|
155 |
|
156 /** |
|
157 * Reports the device status to the MLFW |
|
158 * @param aStatus The device status |
|
159 */ |
|
160 void DeviceStatus(TInt aStatus); |
|
161 |
|
162 /** |
|
163 * Returns the device status |
|
164 * @return The device status |
|
165 */ |
|
166 TInt GetDeviceStatus(); |
|
167 |
|
168 /** |
|
169 * From MBTGPSLocationFixListener |
|
170 */ |
|
171 void HandleLocationFixUpdate(const CBTGPSFix& aFix); |
|
172 |
|
173 /** |
|
174 * From MBTGPSDeviceListener |
|
175 */ |
|
176 virtual void BTDeviceStatusChanged( |
|
177 TInt aConnectStatus, |
|
178 TInt aDeviceType, |
|
179 TInt aErr=KErrNone); |
|
180 |
|
181 private: // Construction and destruction |
|
182 |
|
183 /** |
|
184 * Two-phased constructor. |
|
185 */ |
|
186 static CBTGPSRequestHandler* NewL(); |
|
187 |
|
188 /** |
|
189 * C++ default constructor. |
|
190 */ |
|
191 CBTGPSRequestHandler(); |
|
192 |
|
193 /** |
|
194 * By default Symbian 2nd phase constructor is private. |
|
195 */ |
|
196 void ConstructL(); |
|
197 |
|
198 /** |
|
199 * Destructor. |
|
200 */ |
|
201 virtual ~CBTGPSRequestHandler(); |
|
202 |
|
203 |
|
204 private: // Data |
|
205 |
|
206 //Constants manager |
|
207 CBTGPSConstantsManager* iConstantsManager; |
|
208 |
|
209 //Setting manager |
|
210 CBTGPSSettingManager* iSettingManager; |
|
211 |
|
212 //BT Device Manager |
|
213 CBTGPSDeviceManager* iDeviceManager; |
|
214 |
|
215 //BT GPS connection manager |
|
216 CBTGPSConnectManager* iConnectManager; |
|
217 |
|
218 //BT GPS init manager |
|
219 CBTGPSInitManager* iInitManager; |
|
220 |
|
221 //PSY connection manager |
|
222 CBTGPSPsyConnectionManager* iPsyConnectionManager; |
|
223 |
|
224 //Location Request Manager |
|
225 CBTGPSRequestManager* iRequestManager; |
|
226 |
|
227 //Nok device handler |
|
228 CBTGPSNokDeviceHandler* iNokDeviceHandler; |
|
229 |
|
230 //Module status handler |
|
231 CBTGPSModuleStatusHandler* iModuleStatusHandler; |
|
232 |
|
233 //Power manager |
|
234 CBTGPSPowerManager* iPowerManager; |
|
235 |
|
236 //Enviornment change handler |
|
237 CBTGPSEnvChangeHandler* iEnvChangeHandler; |
|
238 |
|
239 //Device List Manager |
|
240 CBTGPSDeviceListManager* iDeviceListManager; |
|
241 |
|
242 }; |
|
243 |
|
244 #endif // BTGPSREQUESTHANDLER_H |
|
245 |
|
246 // End of File |