author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 26 Oct 2009 08:20:53 +0200 | |
changeset 16 | 44bb89c96acb |
parent 10 | fc9cf246af83 |
child 19 | 8d692d9f828f |
permissions | -rw-r--r-- |
5 | 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 core implementation. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#ifndef C_LOCINTERFACE_H |
|
19 |
#define C_LOCINTERFACE_H |
|
20 |
||
21 |
||
22 |
#include <LiwCommon.h> |
|
23 |
#include "locationcb.h" |
|
24 |
#include "locationservice.h" |
|
25 |
#include "serviceerrno.h" |
|
26 |
||
27 |
||
28 |
// CONSTANTS |
|
29 |
const TInt KMaxSupportedFields = 25 ; |
|
30 |
||
31 |
||
32 |
||
33 |
//Second |
|
34 |
const TInt KLocSecond = 1000000; |
|
35 |
||
36 |
//Update interval |
|
37 |
const TInt KLocUpdateInterval = KLocSecond; |
|
38 |
||
39 |
//Update time out |
|
40 |
const TInt KLocUpdateTimeOut = 15*KLocSecond; |
|
41 |
||
42 |
//MaxAge |
|
43 |
const TInt KLocMaxAge = 0; |
|
44 |
||
45 |
||
46 |
/** |
|
47 |
* Various command for Location service |
|
48 |
*/ |
|
49 |
||
50 |
_LIT8( KCmdGetLocation , "GetLocation" ) ; |
|
51 |
_LIT8( KCmdTraceLocation, "Trace" ) ; |
|
52 |
_LIT8( KCmdCancelRequest, "CancelNotification" ) ; |
|
53 |
||
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
54 |
_LIT8(KCmdLastLocation,"GetLastPosition"); |
5 | 55 |
_LIT( KRequestTrace ,"TraceCancel") ; |
56 |
_LIT( KRequestGetLoc , "GetLocCancel" ) ; |
|
57 |
_LIT8( KRequestCalculate , "Calculate") ; |
|
58 |
||
59 |
_LIT8( KMathRequest , "MathRequest") ; |
|
60 |
_LIT8( KCancelType , "CancelRequestType") ; |
|
61 |
||
62 |
/** |
|
63 |
* Error Indntifier in Output parameter list |
|
64 |
*/ |
|
65 |
_LIT8(KErrorCode , "ErrorCode") ; |
|
66 |
||
67 |
/** |
|
68 |
* Error string |
|
69 |
*/ |
|
70 |
_LIT8(KErrorMessage,"ErrorMessage"); |
|
71 |
||
72 |
/** |
|
73 |
* Location SAPI result parmater identifiers |
|
74 |
*/ |
|
75 |
_LIT8(KLocationMap , "ReturnValue") ; |
|
76 |
||
77 |
/** |
|
78 |
* Update Options |
|
79 |
*/ |
|
80 |
_LIT8(KUpdateOptionMap,"Updateoptions"); |
|
81 |
_LIT8(KUpdateOptionInterval,"UpdateInterval"); |
|
82 |
_LIT8(KUpdateOptionTimeOut,"UpdateTimeOut"); |
|
83 |
_LIT8(KUpdateOptionMaxAge,"UpdateMaxAge"); |
|
84 |
_LIT8(KPartialUpdates , "PartialUpdates"); |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
85 |
/** |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
86 |
* EnableHighAccuracy parameter |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
87 |
*/ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
88 |
_LIT8(KEnableHighAccuracy,"EnableHighAccuracy"); |
5 | 89 |
|
90 |
/** |
|
91 |
* Class of Location Information ;user is |
|
92 |
* looking for |
|
93 |
*/ |
|
94 |
_LIT8(KLocationInfoCategory,"LocationInformationClass"); |
|
95 |
_LIT(KLocationBasicinfo,"BasicLocationInformation"); |
|
96 |
_LIT(KLocationGenericInfo,"GenericLocationInfo"); |
|
97 |
||
98 |
/** |
|
99 |
* Math operations request identifiers |
|
100 |
*/ |
|
101 |
_LIT( KRequestDistance , "FindDistance") ; |
|
102 |
_LIT(KRequestBearingTo,"FindBearingTo"); |
|
103 |
_LIT(KRequestMove,"MoveCoordinates"); |
|
104 |
_LIT8(KDistanceParmSource , "DistanceParamSource") ; |
|
105 |
_LIT8(KDistanceMove , "MoveByThisDistance"); |
|
106 |
_LIT8(KBearingMove , "MoveByThisBearing"); |
|
107 |
_LIT8(KDistanceParmDestination , "DistanceParamDestination") ; |
|
108 |
_LIT8(KMathOpResult,"ReturnValue"); |
|
109 |
||
110 |
||
111 |
/** |
|
112 |
* Speed informations which will be part of outparamlist |
|
113 |
*/ |
|
114 |
||
115 |
_LIT8(KPositionFieldHorizontalSpeed , "HorizontalSpeed") ; |
|
116 |
_LIT8(KPositionFieldVerticalSpeed , "VeritcalSpeed") ; |
|
117 |
_LIT8(KPositionFieldHorizontalSpeedError , "HorizontalSpeedError") ; |
|
118 |
_LIT8(KPositionFieldVerticalSpeedError , "VeritcalSpeedError") ; |
|
119 |
||
120 |
/** |
|
121 |
* Satellite information which be part of outparm list |
|
122 |
*/ |
|
123 |
_LIT8(KPositionFieldSatelliteNumInView , "SatelliteNumView") ; |
|
124 |
_LIT8(KPositionFieldSatelliteNumUsed , "SatelliteNumViewUsed") ; |
|
125 |
_LIT8(KPositionFieldSatelliteTime , "SatelliteTime") ; |
|
126 |
||
127 |
/** |
|
128 |
* Compass information which will be part of outparmlist |
|
129 |
*/ |
|
130 |
_LIT8(KPositionFieldHeading , "Heading") ; |
|
131 |
_LIT8(KPositionFieldHeadingError , "HeadingError") ; |
|
132 |
_LIT8(KPositionFieldMagneticHeading , "MagneticHeading") ; |
|
133 |
_LIT8(KPositionFieldMagneticHeadingError , "MagneticHeadingError") ; |
|
134 |
||
135 |
/** |
|
136 |
* Direction course information which will be part of outparm list |
|
137 |
*/ |
|
138 |
_LIT8(KPositionFieldTrueCourse , "TrueCourse") ; |
|
139 |
_LIT8(KPositionFieldTrueCourseError , "TrueCourseError") ; |
|
140 |
_LIT8(KPositionFieldMagneticCourse , "MagneticCourse") ; |
|
141 |
_LIT8(KPositionFieldMagneticCourseError , "MagneticCourseError") ; |
|
142 |
||
143 |
||
144 |
/** |
|
145 |
* Enum specifier for postion Info Category |
|
146 |
* |
|
147 |
*/ |
|
148 |
enum TPositionCategory |
|
149 |
{ |
|
150 |
EBasicPositionInfo = 0, |
|
151 |
EGenericPositionInfo = 1 |
|
152 |
}; |
|
153 |
||
154 |
/** |
|
155 |
* Transaction id, which will be part of outparamlist for asynchronous request |
|
156 |
*/ |
|
157 |
_LIT8(KTransactionId, "TransactionID"); |
|
158 |
||
159 |
/** |
|
160 |
* This is an interface class for Location SAPI This class implements ExecuteCmdL() method |
|
161 |
* ExecuteCmdL() method is called directly by consumer after descovering the service |
|
162 |
*/ |
|
163 |
||
164 |
class CLocationInterface : public CBase ,public MLiwInterface |
|
165 |
{ |
|
166 |
public: |
|
167 |
enum TIndex |
|
168 |
{ |
|
169 |
Index0 = 0, |
|
170 |
Index1, |
|
171 |
Index2, |
|
172 |
Index3 |
|
173 |
}; |
|
174 |
/** |
|
175 |
* A static method for creating CLocationInterface object |
|
176 |
*/ |
|
177 |
static CLocationInterface *NewL() ; |
|
178 |
||
179 |
||
180 |
/** |
|
181 |
* Default destructor |
|
182 |
*/ |
|
183 |
virtual ~CLocationInterface() ; |
|
184 |
||
185 |
/** |
|
186 |
* ExecuteCmdL parses the input parameters and then calls an appropriate method on iLocationServic |
|
187 |
* |
|
188 |
* @param aCmdName the name of the service command which the consumer wants to invoke |
|
189 |
* @param aInParamList the input parameter list, can be empty list |
|
190 |
* @param [in,out] aOutParamList the output parameter list, can be empty lis. The |
|
191 |
* service provider can use the output parameter list to fill in necessary return values |
|
192 |
* @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh. |
|
193 |
* @param aCallback callback to be registered by consumer application |
|
194 |
* |
|
195 |
* @see TLiwServiceCmdOptions |
|
196 |
* @see CLiwGenericParamList |
|
197 |
* @see MLiwNotifyCallback |
|
198 |
*/ |
|
199 |
virtual void ExecuteCmdL( const TDesC8& aCmdName, |
|
200 |
const CLiwGenericParamList& aInParamList, |
|
201 |
CLiwGenericParamList& aOutParamList, |
|
202 |
TUint aCmdOptions = 0, |
|
203 |
MLiwNotifyCallback* aCallback = 0 ); |
|
204 |
static TInt ConvertToSapiError(TInt aSymbianErrorCode); |
|
205 |
||
206 |
/** |
|
207 |
* Close function called by consumer when it wants to delete the interface |
|
208 |
*/ |
|
209 |
virtual void Close() {delete this;} |
|
210 |
||
211 |
private : |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
212 |
|
5 | 213 |
|
214 |
/** |
|
215 |
* Internal private function which extracts coordinate information from CLiwMap |
|
216 |
* passed by consumer, this is required for math operations |
|
217 |
* |
|
218 |
* @param aCoordinate which will contain extracted coordinate info from map |
|
219 |
* @param input map containing cooridinate information |
|
220 |
*/ |
|
221 |
void FillCoordinatesL( TCoordinate &aCoordinate , const CLiwMap *aMap ) ; |
|
222 |
||
223 |
/** |
|
224 |
* SetUpdateOption construct a TPositionUpdateOptions object from the map containing |
|
225 |
* different field of update optiin. |
|
226 |
* |
|
227 |
* @param aPositionUpdateoption object to be constructed |
|
228 |
* @param aUpdatemap map containing values of different field of update option. |
|
229 |
* return -1 if negative value for timeinterval is given |
|
230 |
*/ |
|
231 |
TInt SetUpdateOption(TPositionUpdateOptions& aPositionUpdateoption,const CLiwMap* aUpdatemap); |
|
232 |
||
233 |
private : |
|
234 |
/** |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
235 |
* By default Symbian 2nd phase constructor is private. |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
236 |
* |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
237 |
*/ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
238 |
void ConstructL(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
239 |
/** |
5 | 240 |
*Default constructor |
241 |
*/ |
|
242 |
||
243 |
CLocationInterface() ; |
|
244 |
||
245 |
/** |
|
246 |
* Internal CmdExecute function which parses the input parameters |
|
247 |
* this function is called by ExecuteCmdL() function |
|
248 |
* |
|
249 |
* @param aCmdName the name of the service command which the consumer wants to invoke |
|
250 |
* @param aInParamList the input parameter list, can be empty list |
|
251 |
* @param [in,out] aOutParamList the output parameter list, can be empty lis. The |
|
252 |
* service provider can use the output parameter list to fill in necessary return values |
|
253 |
* @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh. |
|
254 |
* @param aCallback callback to be registered by consumer application |
|
255 |
* @see TLiwServiceCmdOptions |
|
256 |
* @see CLiwGenericParamList |
|
257 |
* @see MLiwNotifyCallback |
|
258 |
* |
|
259 |
*/ |
|
260 |
||
261 |
||
262 |
void CmdExecuteL( |
|
263 |
const TDesC8& aCmdName, |
|
264 |
const CLiwGenericParamList& aInParamList , |
|
265 |
CLiwGenericParamList& aOutParamList, |
|
266 |
TUint aCmdOptions, |
|
267 |
MLiwNotifyCallback* aCallback); |
|
268 |
||
269 |
/** |
|
270 |
* Internal utility function which fills iGenericPosinfo accoriding to capability of |
|
271 |
* Positioning module used for location estimation |
|
272 |
*/ |
|
273 |
||
274 |
TInt SetSupportedFields() ; |
|
275 |
||
276 |
/** |
|
277 |
* Internal utility function which gets all location information which module supports |
|
278 |
* |
|
279 |
* @param aOutParamList output list which is populated with location informatio |
|
280 |
* @param aPosInfoCategory position category (Basic or Generic) |
|
281 |
*/ |
|
282 |
||
283 |
void GetLocationInfo( CLiwGenericParamList& aOutParamList,TInt aPosInfoCategory) ; |
|
284 |
||
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
285 |
|
5 | 286 |
|
287 |
/** |
|
288 |
* Handle to core location class for performing location operations |
|
289 |
*/ |
|
290 |
CLocationService *iLocationService ; |
|
291 |
||
292 |
/** |
|
293 |
* Registration table for callbacks |
|
294 |
*/ |
|
295 |
RPointerArray<LocationInterfaceCB> iHandleCB; |
|
296 |
||
297 |
||
298 |
/** |
|
299 |
* Member variable which holds all the Generic position information |
|
300 |
*/ |
|
301 |
||
302 |
HPositionGenericInfo *iGenericPosInfo ; |
|
303 |
||
304 |
/** |
|
305 |
* Class member which contains module information which is used for location esitmation |
|
306 |
*/ |
|
307 |
TPositionModuleInfo iModuleInfo ; |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
308 |
/** |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
309 |
* Class member which is used to obtain updates of Last Known Position |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
310 |
*/ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
311 |
TPosition iPosition; |
5 | 312 |
|
313 |
/** |
|
314 |
* Class member which contains all the field ids of all the supported Hposition info fields |
|
315 |
*/ |
|
316 |
||
317 |
TPositionFieldId iFieldList[KMaxSupportedFields] ; |
|
318 |
||
319 |
||
320 |
||
321 |
}; |
|
322 |
||
323 |
||
324 |
#endif //C_LOCINTERFACE_H |