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 |
_LIT8( KCmdSetIdentity, "SetIdentity");
|
|
54 |
|
|
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");
|
|
85 |
|
|
86 |
/**
|
|
87 |
* Class of Location Information ;user is
|
|
88 |
* looking for
|
|
89 |
*/
|
|
90 |
_LIT8(KLocationInfoCategory,"LocationInformationClass");
|
|
91 |
_LIT(KLocationBasicinfo,"BasicLocationInformation");
|
|
92 |
_LIT(KLocationGenericInfo,"GenericLocationInfo");
|
|
93 |
|
|
94 |
/**
|
|
95 |
* Math operations request identifiers
|
|
96 |
*/
|
|
97 |
_LIT( KRequestDistance , "FindDistance") ;
|
|
98 |
_LIT(KRequestBearingTo,"FindBearingTo");
|
|
99 |
_LIT(KRequestMove,"MoveCoordinates");
|
|
100 |
_LIT8(KDistanceParmSource , "DistanceParamSource") ;
|
|
101 |
_LIT8(KDistanceMove , "MoveByThisDistance");
|
|
102 |
_LIT8(KBearingMove , "MoveByThisBearing");
|
|
103 |
_LIT8(KDistanceParmDestination , "DistanceParamDestination") ;
|
|
104 |
_LIT8(KMathOpResult,"ReturnValue");
|
|
105 |
|
|
106 |
|
|
107 |
/**
|
|
108 |
* Speed informations which will be part of outparamlist
|
|
109 |
*/
|
|
110 |
|
|
111 |
_LIT8(KPositionFieldHorizontalSpeed , "HorizontalSpeed") ;
|
|
112 |
_LIT8(KPositionFieldVerticalSpeed , "VeritcalSpeed") ;
|
|
113 |
_LIT8(KPositionFieldHorizontalSpeedError , "HorizontalSpeedError") ;
|
|
114 |
_LIT8(KPositionFieldVerticalSpeedError , "VeritcalSpeedError") ;
|
|
115 |
|
|
116 |
/**
|
|
117 |
* Satellite information which be part of outparm list
|
|
118 |
*/
|
|
119 |
_LIT8(KPositionFieldSatelliteNumInView , "SatelliteNumView") ;
|
|
120 |
_LIT8(KPositionFieldSatelliteNumUsed , "SatelliteNumViewUsed") ;
|
|
121 |
_LIT8(KPositionFieldSatelliteTime , "SatelliteTime") ;
|
|
122 |
|
|
123 |
/**
|
|
124 |
* Compass information which will be part of outparmlist
|
|
125 |
*/
|
|
126 |
_LIT8(KPositionFieldHeading , "Heading") ;
|
|
127 |
_LIT8(KPositionFieldHeadingError , "HeadingError") ;
|
|
128 |
_LIT8(KPositionFieldMagneticHeading , "MagneticHeading") ;
|
|
129 |
_LIT8(KPositionFieldMagneticHeadingError , "MagneticHeadingError") ;
|
|
130 |
|
|
131 |
/**
|
|
132 |
* Direction course information which will be part of outparm list
|
|
133 |
*/
|
|
134 |
_LIT8(KPositionFieldTrueCourse , "TrueCourse") ;
|
|
135 |
_LIT8(KPositionFieldTrueCourseError , "TrueCourseError") ;
|
|
136 |
_LIT8(KPositionFieldMagneticCourse , "MagneticCourse") ;
|
|
137 |
_LIT8(KPositionFieldMagneticCourseError , "MagneticCourseError") ;
|
|
138 |
|
|
139 |
/**
|
|
140 |
* NMEA information which will be part of outparam list
|
|
141 |
*/
|
|
142 |
|
|
143 |
_LIT8(KPositionFieldNMEASentences , "NMEASentence") ;
|
|
144 |
_LIT8(KPositionFieldNMEASentencesStart , "NMEASentenceStart") ;
|
|
145 |
|
|
146 |
/**
|
|
147 |
* Enum specifier for postion Info Category
|
|
148 |
*
|
|
149 |
*/
|
|
150 |
enum TPositionCategory
|
|
151 |
{
|
|
152 |
EBasicPositionInfo = 0,
|
|
153 |
EGenericPositionInfo = 1
|
|
154 |
};
|
|
155 |
|
|
156 |
/**
|
|
157 |
* Transaction id, which will be part of outparamlist for asynchronous request
|
|
158 |
*/
|
|
159 |
_LIT8(KTransactionId, "TransactionID");
|
|
160 |
|
|
161 |
/**
|
|
162 |
* This is an interface class for Location SAPI This class implements ExecuteCmdL() method
|
|
163 |
* ExecuteCmdL() method is called directly by consumer after descovering the service
|
|
164 |
*/
|
|
165 |
|
|
166 |
class CLocationInterface : public CBase ,public MLiwInterface
|
|
167 |
{
|
|
168 |
public:
|
|
169 |
enum TIndex
|
|
170 |
{
|
|
171 |
Index0 = 0,
|
|
172 |
Index1,
|
|
173 |
Index2,
|
|
174 |
Index3
|
|
175 |
};
|
|
176 |
/**
|
|
177 |
* A static method for creating CLocationInterface object
|
|
178 |
*/
|
|
179 |
static CLocationInterface *NewL() ;
|
|
180 |
|
|
181 |
|
|
182 |
/**
|
|
183 |
* Default destructor
|
|
184 |
*/
|
|
185 |
virtual ~CLocationInterface() ;
|
|
186 |
|
|
187 |
/**
|
|
188 |
* ExecuteCmdL parses the input parameters and then calls an appropriate method on iLocationServic
|
|
189 |
*
|
|
190 |
* @param aCmdName the name of the service command which the consumer wants to invoke
|
|
191 |
* @param aInParamList the input parameter list, can be empty list
|
|
192 |
* @param [in,out] aOutParamList the output parameter list, can be empty lis. The
|
|
193 |
* service provider can use the output parameter list to fill in necessary return values
|
|
194 |
* @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh.
|
|
195 |
* @param aCallback callback to be registered by consumer application
|
|
196 |
*
|
|
197 |
* @see TLiwServiceCmdOptions
|
|
198 |
* @see CLiwGenericParamList
|
|
199 |
* @see MLiwNotifyCallback
|
|
200 |
*/
|
|
201 |
virtual void ExecuteCmdL( const TDesC8& aCmdName,
|
|
202 |
const CLiwGenericParamList& aInParamList,
|
|
203 |
CLiwGenericParamList& aOutParamList,
|
|
204 |
TUint aCmdOptions = 0,
|
|
205 |
MLiwNotifyCallback* aCallback = 0 );
|
|
206 |
static TInt ConvertToSapiError(TInt aSymbianErrorCode);
|
|
207 |
|
|
208 |
/**
|
|
209 |
* Close function called by consumer when it wants to delete the interface
|
|
210 |
*/
|
|
211 |
virtual void Close() {delete this;}
|
|
212 |
|
|
213 |
private :
|
|
214 |
static void ConvertPosToGenricListL( TPosition &aPos , CLiwGenericParamList &aOutList ) ;
|
|
215 |
|
|
216 |
/**
|
|
217 |
* Internal private function which extracts coordinate information from CLiwMap
|
|
218 |
* passed by consumer, this is required for math operations
|
|
219 |
*
|
|
220 |
* @param aCoordinate which will contain extracted coordinate info from map
|
|
221 |
* @param input map containing cooridinate information
|
|
222 |
*/
|
|
223 |
void FillCoordinatesL( TCoordinate &aCoordinate , const CLiwMap *aMap ) ;
|
|
224 |
|
|
225 |
/**
|
|
226 |
* SetUpdateOption construct a TPositionUpdateOptions object from the map containing
|
|
227 |
* different field of update optiin.
|
|
228 |
*
|
|
229 |
* @param aPositionUpdateoption object to be constructed
|
|
230 |
* @param aUpdatemap map containing values of different field of update option.
|
|
231 |
* return -1 if negative value for timeinterval is given
|
|
232 |
*/
|
|
233 |
TInt SetUpdateOption(TPositionUpdateOptions& aPositionUpdateoption,const CLiwMap* aUpdatemap);
|
|
234 |
|
|
235 |
private :
|
|
236 |
/**
|
|
237 |
*Default constructor
|
|
238 |
*/
|
|
239 |
|
|
240 |
CLocationInterface() ;
|
|
241 |
|
|
242 |
/**
|
|
243 |
* Internal CmdExecute function which parses the input parameters
|
|
244 |
* this function is called by ExecuteCmdL() function
|
|
245 |
*
|
|
246 |
* @param aCmdName the name of the service command which the consumer wants to invoke
|
|
247 |
* @param aInParamList the input parameter list, can be empty list
|
|
248 |
* @param [in,out] aOutParamList the output parameter list, can be empty lis. The
|
|
249 |
* service provider can use the output parameter list to fill in necessary return values
|
|
250 |
* @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh.
|
|
251 |
* @param aCallback callback to be registered by consumer application
|
|
252 |
* @see TLiwServiceCmdOptions
|
|
253 |
* @see CLiwGenericParamList
|
|
254 |
* @see MLiwNotifyCallback
|
|
255 |
*
|
|
256 |
*/
|
|
257 |
|
|
258 |
|
|
259 |
void CmdExecuteL(
|
|
260 |
const TDesC8& aCmdName,
|
|
261 |
const CLiwGenericParamList& aInParamList ,
|
|
262 |
CLiwGenericParamList& aOutParamList,
|
|
263 |
TUint aCmdOptions,
|
|
264 |
MLiwNotifyCallback* aCallback);
|
|
265 |
|
|
266 |
/**
|
|
267 |
* Internal utility function which fills iGenericPosinfo accoriding to capability of
|
|
268 |
* Positioning module used for location estimation
|
|
269 |
*/
|
|
270 |
|
|
271 |
TInt SetSupportedFields() ;
|
|
272 |
|
|
273 |
/**
|
|
274 |
* Internal utility function which gets all location information which module supports
|
|
275 |
*
|
|
276 |
* @param aOutParamList output list which is populated with location informatio
|
|
277 |
* @param aPosInfoCategory position category (Basic or Generic)
|
|
278 |
*/
|
|
279 |
|
|
280 |
void GetLocationInfo( CLiwGenericParamList& aOutParamList,TInt aPosInfoCategory) ;
|
|
281 |
|
|
282 |
/**
|
|
283 |
* Internal function which cancels the asynchronous using transaction id of the
|
|
284 |
* async request
|
|
285 |
*
|
|
286 |
* @param aTransactionId Transaction id of the asynchronous request to be cancelled
|
|
287 |
*/
|
|
288 |
|
|
289 |
MLiwNotifyCallback* RequestCancel(TInt32 aTransactionId/*,MLiwNotifyCallback** aCallBack*/) ;
|
|
290 |
|
|
291 |
|
|
292 |
/**
|
|
293 |
* Handle to core location class for performing location operations
|
|
294 |
*/
|
|
295 |
CLocationService *iLocationService ;
|
|
296 |
|
|
297 |
/**
|
|
298 |
* Registration table for callbacks
|
|
299 |
*/
|
|
300 |
RPointerArray<LocationInterfaceCB> iHandleCB;
|
|
301 |
|
|
302 |
|
|
303 |
/**
|
|
304 |
* Member variable which holds all the Generic position information
|
|
305 |
*/
|
|
306 |
|
|
307 |
HPositionGenericInfo *iGenericPosInfo ;
|
|
308 |
|
|
309 |
/**
|
|
310 |
* Class member which contains module information which is used for location esitmation
|
|
311 |
*/
|
|
312 |
TPositionModuleInfo iModuleInfo ;
|
|
313 |
|
|
314 |
/**
|
|
315 |
* Class member which contains all the field ids of all the supported Hposition info fields
|
|
316 |
*/
|
|
317 |
|
|
318 |
TPositionFieldId iFieldList[KMaxSupportedFields] ;
|
|
319 |
|
|
320 |
|
|
321 |
|
|
322 |
};
|
|
323 |
|
|
324 |
|
|
325 |
#endif //C_LOCINTERFACE_H |