author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Thu, 27 Aug 2009 07:43:07 +0300 | |
changeset 22 | fc9cf246af83 |
parent 19 | 989d2f495d90 |
child 32 | 8d692d9f828f |
permissions | -rw-r--r-- |
19 | 1 |
/* |
2 |
* Copyright (c) 2006-2007 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 the License "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: Header file for location SAPI service implementation. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#ifndef LOCATIONSERVICE_H |
|
19 |
#define LOCATIONSERVICE_H |
|
20 |
||
21 |
#include <lbs.h> |
|
22 |
class CGetLoc; |
|
23 |
/** |
|
24 |
* Identity for location SAPI lib |
|
25 |
* This will be appended to requestor identity information stack received from the |
|
26 |
* client and will be passed onto location server |
|
27 |
*/ |
|
28 |
||
29 |
_LIT(KIdentity,"Location SAPI"); |
|
30 |
||
31 |
||
32 |
||
33 |
/** |
|
34 |
* Key for locating location information in CLiwGenericParamList |
|
35 |
*/ |
|
36 |
_LIT8(KLongitudeKey,"Longitude") ; |
|
37 |
_LIT8(KLatitudeKey , "Latitude") ; |
|
38 |
_LIT8(KAltitudeKey , "Altitude") ; |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
39 |
_LIT8(KHorAccuracy,"HorizontalAccuracy"); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
40 |
_LIT8(KVerAccuracy,"VerticalAccuracy"); |
19 | 41 |
|
42 |
_LIT(KUnknown,"Unknown"); |
|
43 |
||
44 |
/** |
|
45 |
* Default Update options |
|
46 |
*/ |
|
47 |
//Second |
|
48 |
const TInt KSSecond = 1000000; |
|
49 |
||
50 |
//Update interval |
|
51 |
const TInt KSUpdateInterval = KSSecond; |
|
52 |
||
53 |
//Update time out |
|
54 |
const TInt KSUpdateTimeOut = 15*KSSecond; |
|
55 |
||
56 |
//MaxAge |
|
57 |
const TInt KSMaxAge = 0; |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
58 |
const TInt KGetLocationReq = 0 ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
59 |
const TInt KTraceReq = 1 ; |
19 | 60 |
|
61 |
/** |
|
62 |
* Enums required for mathoperations |
|
63 |
*/ |
|
64 |
enum TMathOperationChoice |
|
65 |
{ |
|
66 |
EDistance = 0, |
|
67 |
EBearingTo = 1, |
|
68 |
EMove = 2 |
|
69 |
}; |
|
70 |
||
71 |
/** |
|
72 |
* Notification Type to be cancelled |
|
73 |
*/ |
|
74 |
enum TCancelParam |
|
75 |
{ |
|
76 |
ECancelGetLocation = 0, |
|
77 |
ECancelTrace = 1 |
|
78 |
}; |
|
79 |
/** |
|
80 |
* Enumeration used to identify category of location information user intends to |
|
81 |
* retrieve |
|
82 |
* Example: specifying EBasic user will get only longitude,latitude and altitude |
|
83 |
*/ |
|
84 |
enum TLocationInfoType |
|
85 |
{ |
|
86 |
EBasicInfo = 0, |
|
87 |
EGenericInfo = 1 |
|
88 |
}; |
|
89 |
||
90 |
/** |
|
91 |
* used by the caller of math operation to send input parameters |
|
92 |
* after computation MathOperation wil fill in result field of this |
|
93 |
* struct. |
|
94 |
*/ |
|
95 |
struct _INPPARM |
|
96 |
{ |
|
97 |
//specifies option for mathoperation |
|
98 |
TInt servicechoice; |
|
99 |
//result of the computation |
|
100 |
TReal32 result ; |
|
101 |
//Source Coordinate for math operation |
|
102 |
TCoordinate source; |
|
103 |
//Destination Coordinate for math operation |
|
104 |
TCoordinate destination ; |
|
105 |
//In case of find bearingto following two should be supplied by the consumer |
|
106 |
TReal32 bearing; |
|
107 |
TReal32 distance; |
|
108 |
||
109 |
}; |
|
110 |
||
111 |
typedef struct _INPPARM inpparam; |
|
112 |
||
113 |
||
114 |
||
115 |
/** |
|
116 |
* Location callback interface, its pure interface class, application need to |
|
117 |
* Write there own callback derriving from this class. |
|
118 |
* @Depenedency lbs.lib |
|
119 |
*/ |
|
120 |
||
121 |
class MLocationCallBack |
|
122 |
{ |
|
123 |
/** |
|
124 |
* Handles notifications caused by an asynchronous GetLocationL, |
|
125 |
* or by trace. |
|
126 |
* |
|
127 |
* @param aOutPos updated position got from location server |
|
128 |
* @return Success/Error code for the callback. |
|
129 |
* |
|
130 |
* @see HPositionGenericInfo in LbsPositionInfo.h for details |
|
131 |
* |
|
132 |
*/ |
|
133 |
public : |
|
134 |
virtual TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) = 0 ; |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
135 |
/* |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
136 |
* To be implemented by every class that derives from this. This function should return |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
137 |
* the Async Request type for which this callback is used. |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
138 |
*/ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
139 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
140 |
virtual TUint GetRequestType(void) = 0; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
141 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
142 |
/* |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
143 |
* To be implemented by every class that derives from this. This returns the |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
144 |
* TransactionId associated with the Async request for which this Callback |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
145 |
* object is used. |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
146 |
*/ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
147 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
148 |
virtual TInt32 GetTransactionId(void) = 0; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
149 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
150 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
151 |
virtual ~MLocationCallBack(){} |
19 | 152 |
}; |
153 |
||
154 |
||
155 |
/** |
|
156 |
* CLocationService class : This is a wrapper class for the Functionalities |
|
157 |
* offered by Location Retreival APIs. |
|
158 |
* In case of An Asynchronus request it has method which Instantiates and delegate |
|
159 |
* the job to another class which also opens new sub-session with |
|
160 |
* Location server. |
|
161 |
*/ |
|
162 |
||
163 |
||
164 |
class CLocationService : public CBase |
|
165 |
{ |
|
166 |
public : |
|
167 |
/** |
|
168 |
* Creates a new instance of a @ref CLocationService |
|
169 |
* @return The newly created CLocationService object |
|
170 |
*/ |
|
171 |
IMPORT_C static CLocationService *NewL() ; |
|
172 |
||
173 |
||
174 |
/* |
|
175 |
* @Destructor |
|
176 |
*/ |
|
177 |
virtual ~CLocationService() ; |
|
178 |
||
179 |
/** |
|
180 |
* Methods on the Core Location implementation |
|
181 |
*/ |
|
182 |
||
183 |
||
184 |
||
185 |
/** |
|
186 |
* Synchronous get location with update options returns current location of the user |
|
187 |
* |
|
188 |
* @param aPosinfobase input TPositionInfoBase object which will hold location details |
|
189 |
* @param aUpdateOpts updateoptions for synchronous calls |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
190 |
* @param aEnableHighAcc - Tells whether to use greater accuracy modules to obtain updates |
19 | 191 |
*/ |
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
192 |
IMPORT_C void GetLocationL( TPositionInfoBase* aPos , |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
193 |
const TPositionUpdateOptions* aUpdateOpts= NULL, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
194 |
TBool aEnableHighAcc = false ) ; |
19 | 195 |
|
196 |
||
197 |
/** |
|
198 |
* Gets the current location of user asynchronosly calls the users callback handle on reciving |
|
199 |
* location updates |
|
200 |
* @param aCallBack callback object after reciving the position updates |
|
201 |
* @param aLocationInfoCategory specifying one of the enumeration in TLocationInfoType. |
|
202 |
* @param aFieldIdList specifies field of HPositionGenericInfo that user intend to retrieve. |
|
203 |
* @param aUpdateoptions update options for asynchronous requests. |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
204 |
* @param aEnableHighAcc - Tells whether to use greater accuracy modules to obtain updates |
19 | 205 |
* @see Lsbcommon.h for details of TPositionFieldIdList and TPositionUpdateOptions |
206 |
*/ |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
207 |
IMPORT_C void GetLocationL( MLocationCallBack* aCallBackObj , |
19 | 208 |
TInt aLocationInfoCategory = 0, |
209 |
TPositionFieldIdList aFieldIdList = NULL , |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
210 |
const TPositionUpdateOptions* aUpdateopts = NULL, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
211 |
TBool aEnableHighAcc = false |
19 | 212 |
); |
213 |
||
214 |
/** |
|
215 |
* Gets module information of the Positioning module specified my aModuleId |
|
216 |
* |
|
217 |
* @param TPositionModuleId param to store the obtained module information |
|
218 |
* |
|
219 |
* @see lsbcommon.h for details of TPositionModuleInfoBase |
|
220 |
*/ |
|
221 |
IMPORT_C TInt GetModuleInfo( TPositionModuleInfoBase& aModuleInfo ) const ; |
|
222 |
||
223 |
/** |
|
224 |
* Performs mathoperations (move,distance,bearingto) by parsing contents of input param |
|
225 |
* |
|
226 |
* @param aInput input paramater for math opertaions |
|
227 |
* |
|
228 |
* @see inparam in this file for detailed math operation list |
|
229 |
*/ |
|
230 |
||
231 |
||
232 |
IMPORT_C TInt MathOperation( inpparam& aInput ); |
|
233 |
||
234 |
/** |
|
235 |
* Trace function traces users location changes any change in users current location is notificed |
|
236 |
* to user via call back function |
|
237 |
* |
|
238 |
* @param aCallBackObj callback object after reciving location updates |
|
239 |
* @param aLocationInfoCategory specifying one of the enumeration in TLocationInfoType. |
|
240 |
* @param aFiledList List of position fields that should be retrived |
|
241 |
* @param aUpdateOptions update options for trace |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
242 |
* @param aEnableHighAcc Tells whether to use greater accuracy modules to obtain updates |
19 | 243 |
* @see Lsbcommon.h for details of TPositionFieldIdList and TPositionUpdateOptions |
244 |
*/ |
|
245 |
||
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
246 |
IMPORT_C void TraceL(MLocationCallBack* aCallBackObj , |
19 | 247 |
TInt aLocationInfoCategory = 0, |
248 |
TPositionFieldIdList aFiledList = NULL , |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
249 |
const TPositionUpdateOptions* aUpateOptions= NULL, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
250 |
TBool aEnableHighAcc = false); |
19 | 251 |
|
252 |
||
253 |
/** |
|
254 |
* Method to cancell pending async request |
|
255 |
* |
|
256 |
* aCancelparam cancellation type (trace,getlocation) |
|
257 |
* |
|
258 |
* @see TCancelParam for cancellation options |
|
259 |
*/ |
|
260 |
||
261 |
IMPORT_C TInt CancelOnGoingService( TInt aCancelparam ) ; |
|
262 |
||
263 |
/** |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
264 |
* Method to cancel pending async request |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
265 |
* |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
266 |
* aTransId Transaction Id that was returned for an Async request |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
267 |
*/ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
268 |
IMPORT_C TInt CancelService( TInt aTransId); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
269 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
270 |
/** |
19 | 271 |
* Method to fetch last known location from location server |
272 |
*/ |
|
273 |
||
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
274 |
IMPORT_C TInt GetLastKnownLoc( TPosition& aResultPos ) ; |
19 | 275 |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
276 |
/** |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
277 |
* Method to obtain the High Accuracy module out of the |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
278 |
* currently available modules on the phone |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
279 |
*/ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
280 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
281 |
void GetHighAccuracyModuleL(TPositionModuleId* aModId); |
19 | 282 |
|
283 |
||
284 |
||
285 |
protected: |
|
286 |
/** |
|
287 |
* internal method to construct class members |
|
288 |
*/ |
|
289 |
void ConstructL() ; |
|
290 |
||
291 |
/** |
|
292 |
* Default constructor |
|
293 |
*/ |
|
294 |
CLocationService() ; |
|
295 |
||
296 |
||
297 |
private : |
|
298 |
||
299 |
/** |
|
300 |
* Subsession used to fetch location information |
|
301 |
*/ |
|
302 |
||
303 |
RPositioner iPositioner; |
|
304 |
||
305 |
/** |
|
306 |
* Session used for getting location information |
|
307 |
*/ |
|
308 |
||
309 |
RPositionServer iPosServer; |
|
310 |
||
311 |
/** |
|
312 |
* Registration table for callbacks |
|
313 |
*/ |
|
314 |
||
315 |
RPointerArray<CGetLoc> iRegTable; |
|
316 |
||
317 |
||
318 |
/** |
|
319 |
* Module indtifier used by location server for getting location information |
|
320 |
*/ |
|
321 |
TPositionModuleId iModuleId ; |
|
322 |
||
323 |
}; |
|
324 |
||
325 |
||
326 |
#endif // LOCATIONSERVICE_H |