author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 24 Nov 2009 08:56:33 +0200 | |
changeset 33 | 50974a8b132e |
parent 32 | 8d692d9f828f |
child 50 | 5dae2c62e9b6 |
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: implements interface class for location sapi |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include <e32base.h> |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
19 |
#include <liwcommon.h> |
19 | 20 |
#include <lbs.h> |
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
21 |
#include <lbsrequestor.h> |
19 | 22 |
|
23 |
#include <lbscommon.h> |
|
24 |
#include <lbssatellite.h> |
|
25 |
#include "locationinterface.h" |
|
26 |
#include "locationcb.h" |
|
27 |
#include "locationservice.h" |
|
28 |
#include "locationerrormessage.hrh" |
|
29 |
using namespace LIW; |
|
30 |
||
31 |
||
32 |
||
33 |
//Error code for bad time |
|
34 |
const TInt KErrBadTime = -125; |
|
35 |
||
36 |
/** |
|
37 |
* destructor |
|
38 |
*/ |
|
39 |
||
40 |
||
41 |
||
42 |
CLocationInterface :: ~CLocationInterface() |
|
43 |
{ |
|
44 |
||
45 |
delete iLocationService ; |
|
46 |
||
47 |
||
48 |
||
49 |
for(TInt iter = 0 ; iter < iHandleCB.Count() ; ++iter) |
|
50 |
{ |
|
51 |
delete iHandleCB[iter] ; |
|
52 |
} |
|
53 |
iHandleCB.Close(); |
|
32 | 54 |
delete iGenericPosition ; |
19 | 55 |
|
56 |
||
57 |
} |
|
58 |
||
59 |
/** |
|
60 |
* Default constructor |
|
61 |
*/ |
|
62 |
||
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
63 |
CLocationInterface::CLocationInterface() |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
64 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
65 |
//No Implementation Required Here |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
66 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
67 |
void CLocationInterface::ConstructL() |
19 | 68 |
{ |
32 | 69 |
iGenericPosition = HPositionGenericInfo::NewL() ; |
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
70 |
|
32 | 71 |
if ( !iGenericPosition ) |
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
72 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
73 |
User::Leave( KErrNoMemory ) ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
74 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
75 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
76 |
iLocationService = CLocationService::NewL() ; |
32 | 77 |
//User::LeaveIfError( iLocationService->GetModuleInfo( iModuleInfo ) ); |
78 |
//User::LeaveIfError( this->SetSupportedFields() ); |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
79 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
80 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
81 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
82 |
/** |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
83 |
* This function is a static method to create iLocatinInterface object |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
84 |
* return pointer to constructed object else paincs with symbian painc |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
85 |
* code |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
86 |
*/ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
87 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
88 |
CLocationInterface* CLocationInterface::NewL() |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
89 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
90 |
CLocationInterface* self = new(ELeave)CLocationInterface(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
91 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
92 |
CleanupStack::PushL( self ) ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
93 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
94 |
self->ConstructL(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
95 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
96 |
CleanupStack::Pop( self ) ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
97 |
return self; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
98 |
|
19 | 99 |
} |
100 |
TInt CLocationInterface::ConvertToSapiError(TInt aSymbianErr) |
|
101 |
{ |
|
102 |
TInt sapiErr(SErrGeneralError); |
|
103 |
switch (aSymbianErr) |
|
104 |
{ |
|
105 |
//case EPosLmInvalidArgument: |
|
106 |
case KErrBadName: |
|
107 |
case KErrPositionIncalculable : |
|
108 |
case KErrArgument: |
|
109 |
{ |
|
110 |
sapiErr = SErrBadArgumentType; |
|
111 |
break; |
|
112 |
} |
|
113 |
case KErrNotSupported: |
|
114 |
{ |
|
115 |
sapiErr = SErrServiceNotSupported; |
|
116 |
break; |
|
117 |
} |
|
118 |
case KErrInUse: |
|
119 |
{ |
|
120 |
sapiErr = SErrServiceInUse; |
|
121 |
break; |
|
122 |
} |
|
123 |
case KErrTimedOut: |
|
124 |
{ |
|
125 |
sapiErr = SErrServiceTimedOut; |
|
126 |
break; |
|
127 |
||
128 |
} |
|
129 |
case KErrAccessDenied: |
|
130 |
{ |
|
131 |
sapiErr = SErrAccessDenied; |
|
132 |
break; |
|
133 |
} |
|
134 |
case KErrNone: |
|
135 |
{ |
|
136 |
sapiErr = SErrNone; |
|
137 |
break; |
|
138 |
} |
|
139 |
||
140 |
case KErrNotFound: |
|
141 |
{ |
|
142 |
sapiErr = SErrNotFound; |
|
143 |
break; |
|
144 |
} |
|
145 |
||
146 |
case SErrMissingArgument: |
|
147 |
{ |
|
148 |
sapiErr = SErrMissingArgument; |
|
149 |
break; |
|
150 |
} |
|
32 | 151 |
case SErrServiceNotReady: |
152 |
{ |
|
153 |
sapiErr = SErrServiceNotReady; |
|
154 |
break; |
|
155 |
} |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
156 |
default: |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
157 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
158 |
sapiErr = SErrGeneralError; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
159 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
160 |
} |
19 | 161 |
return sapiErr; |
162 |
||
163 |
||
164 |
} |
|
165 |
/** |
|
166 |
* CLocationInterface::CmdExecuteL, this method is called by CLocationInterface::HandleCmdL() |
|
167 |
* to catch any leaves that might occur during execution of a LiwCommand.This is an private |
|
168 |
* method of this class. |
|
169 |
*/ |
|
170 |
||
171 |
void CLocationInterface::CmdExecuteL( |
|
172 |
const TDesC8& aCmdName, |
|
173 |
const CLiwGenericParamList& aInParamList , |
|
174 |
CLiwGenericParamList& aOutParamList, |
|
175 |
TUint aCmdOptions, |
|
176 |
MLiwNotifyCallback* aCallback ) |
|
177 |
{ |
|
178 |
||
179 |
||
180 |
aOutParamList.Reset() ; |
|
181 |
||
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
182 |
/* |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
183 |
* To indicate position based parsing for all the parameters |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
184 |
*/ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
185 |
TBool posBasedFlag = EFalse; |
19 | 186 |
if( aCmdOptions & KLiwOptCancel ) // for cancel asynchronous request |
187 |
{ |
|
188 |
||
189 |
TInt ret = 0 ; |
|
190 |
||
191 |
const TLiwGenericParam *transidparam = aInParamList.FindFirst(ret , KTransactionId) ; |
|
192 |
||
193 |
if( !transidparam ) |
|
194 |
{ |
|
195 |
//Possibility of position based parsing |
|
196 |
||
197 |
TInt argCount = aInParamList.Count(); |
|
198 |
if( argCount >= 1 ) |
|
199 |
{ |
|
200 |
transidparam = &aInParamList[Index0]; |
|
201 |
} |
|
202 |
if ( !transidparam ) |
|
203 |
{ |
|
204 |
aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, |
|
205 |
TLiwVariant(KCancelTransactionIdMissing))); |
|
206 |
User::Leave( KErrArgument ); |
|
207 |
} |
|
208 |
||
209 |
} |
|
210 |
||
211 |
TInt32 transid = (transidparam->Value()).AsTInt32() ; |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
212 |
//Get Callback object curresponding to this transaction Id |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
213 |
MLiwNotifyCallback* callBack = NULL; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
214 |
TInt ncalls = iHandleCB.Count() ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
215 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
216 |
for (TInt iter = 0; iter < ncalls; ++iter) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
217 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
218 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
219 |
if (iHandleCB[iter]) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
220 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
221 |
if (iHandleCB[iter]->GetTransactionId() == transid) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
222 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
223 |
//Get the callback object associated with this Transaction Id |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
224 |
callBack = iHandleCB[iter]->GetCallBackobj(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
225 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
226 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
227 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
228 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
229 |
} |
19 | 230 |
if (!callBack) |
231 |
{ |
|
232 |
aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, |
|
233 |
TLiwVariant(KCancelInvalidTransactionId))); |
|
234 |
User::Leave(KErrNotFound); |
|
235 |
} |
|
236 |
||
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
237 |
//Cancel the exisiting request |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
238 |
User::LeaveIfError(iLocationService->CancelService(transid)); |
19 | 239 |
|
240 |
//Send notification about the cancelled state to consumer |
|
241 |
callBack->HandleNotifyL(transid , KLiwEventCanceled , |
|
242 |
aOutParamList, aInParamList) ; |
|
243 |
||
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
244 |
} |
19 | 245 |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
246 |
//LastKnownLocation Request is made by consumer |
27
44bb89c96acb
Revision: 200941
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
247 |
else if( !(aCmdName.CompareF( KCmdLastLocation )) ) |
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
248 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
249 |
//Extract Update options from input List |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
250 |
User::LeaveIfError(iLocationService->GetLastKnownLoc(iPosition)) ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
251 |
TUint category1 = EBasicInfo; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
252 |
|
32 | 253 |
iGenericPosition->SetPosition(iPosition); |
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
254 |
GetLocationInfo(aOutParamList, category1) ; |
19 | 255 |
|
256 |
} |
|
257 |
||
258 |
||
259 |
//GetLocation request is made by consumer |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
260 |
else if( !( aCmdName.CompareF( KCmdGetLocation ) ) ) |
19 | 261 |
{ |
262 |
TInt ret =KErrNone ; |
|
263 |
//Extract category of Location Information user is interested in |
|
264 |
TInt index = 0; |
|
265 |
TPtrC posInfoCategory(KLocationBasicinfo); |
|
266 |
TInt32 transid = aCallback->GetTransactionID() ; |
|
267 |
//This flag indicates whether user has supplied a value for category of |
|
268 |
//location information or not |
|
269 |
TBool infoFlag = FALSE; |
|
270 |
||
271 |
const TLiwGenericParam *smapparam = aInParamList.FindFirst(index , KLocationInfoCategory) ; |
|
272 |
||
273 |
||
274 |
||
275 |
//if smapparam is NULL still there exist possibility of position based parsing |
|
276 |
if ( !smapparam ) |
|
277 |
{ |
|
278 |
TInt count = aInParamList.Count(); |
|
279 |
if (count >= 1) |
|
280 |
{ |
|
281 |
smapparam = &aInParamList[Index0]; |
|
282 |
||
283 |
if (smapparam && ( smapparam->Name() == KNullDesC8 ) ) |
|
284 |
{ |
|
285 |
TLiwVariant variant = smapparam->Value(); |
|
286 |
||
287 |
if( variant.TypeId() != LIW::EVariantTypeDesC ) |
|
288 |
{ |
|
289 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
290 |
TLiwVariant( KGetLocationWrongInfoType ) ) ); |
|
291 |
User::Leave( KErrArgument ); |
|
292 |
//Leave with error code |
|
293 |
} |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
294 |
//indicates that position based parsing has been done |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
295 |
posBasedFlag = ETrue; |
19 | 296 |
posInfoCategory.Set( variant.AsDes() ); |
297 |
||
298 |
//Set infoFlag to indicate user has supplied category of location information |
|
299 |
infoFlag = TRUE; |
|
300 |
||
301 |
||
302 |
} |
|
303 |
||
304 |
} |
|
305 |
} |
|
306 |
if(KErrNotFound != index) |
|
307 |
{ |
|
308 |
TLiwVariant variant = smapparam->Value(); |
|
309 |
if( variant.TypeId() != LIW::EVariantTypeDesC ) |
|
310 |
{ |
|
311 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
312 |
TLiwVariant( KGetLocationWrongInfoType ) ) ); |
|
313 |
User::Leave( KErrArgument ); |
|
314 |
//Leave with error code |
|
315 |
} |
|
316 |
posInfoCategory.Set( variant.AsDes() ); |
|
317 |
//Set infoFlag to indicate user has supplied category of location information |
|
318 |
infoFlag = TRUE; |
|
319 |
} |
|
320 |
||
321 |
//if callback is given for this command then it will be a async request |
|
322 |
if( aCallback && ( KLiwOptASyncronous & aCmdOptions ) ) |
|
323 |
{ |
|
324 |
||
325 |
//Extract Update options from input List |
|
326 |
||
327 |
index = 0; |
|
328 |
const TLiwGenericParam *smapparam = aInParamList.FindFirst(index , KUpdateOptionMap) ; |
|
329 |
TPositionUpdateOptions *updateoptions = NULL ; |
|
330 |
TPositionUpdateOptions updateOptionVal; |
|
331 |
TUint category = EBasicInfo ; |
|
332 |
//Check for possibility of position based parsing |
|
333 |
if ( !smapparam ) |
|
334 |
{ |
|
335 |
TInt count = aInParamList.Count(); |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
336 |
if ( count >= 2 && posBasedFlag ) |
19 | 337 |
{ |
338 |
smapparam = &aInParamList[Index1]; |
|
339 |
if (smapparam) |
|
340 |
{ |
|
341 |
const CLiwMap *updateOptionMap = (smapparam->Value() ).AsMap() ; |
|
342 |
if( !updateOptionMap ) |
|
343 |
{ |
|
344 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
345 |
TLiwVariant( KGetLocationWrongupdateMap ) ) ); |
|
346 |
User::Leave( KErrArgument ); |
|
347 |
} |
|
348 |
TInt error = SetUpdateOption(updateOptionVal,updateOptionMap); |
|
349 |
if( KErrBadTime == error ) |
|
350 |
{ |
|
351 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
352 |
TLiwVariant( KGetLocationNegativeTime ) ) ); |
|
353 |
User::Leave( KErrArgument ); |
|
354 |
||
355 |
} |
|
356 |
updateoptions = &updateOptionVal ; |
|
357 |
||
358 |
||
359 |
} |
|
360 |
||
361 |
} |
|
362 |
} |
|
363 |
||
364 |
if(KErrNotFound != index) |
|
365 |
{ |
|
366 |
const CLiwMap *updateOptionMap = (smapparam->Value() ).AsMap() ; |
|
367 |
if( !updateOptionMap ) |
|
368 |
{ |
|
369 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
370 |
TLiwVariant( KGetLocationWrongupdateMap ) ) ); |
|
371 |
User::Leave( KErrArgument ); |
|
372 |
} |
|
373 |
||
374 |
TInt error = SetUpdateOption(updateOptionVal,updateOptionMap); |
|
375 |
if( KErrBadTime == error ) |
|
376 |
{ |
|
377 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
378 |
TLiwVariant( KGetLocationNegativeTime ) ) ); |
|
379 |
||
380 |
User::Leave( KErrArgument ); |
|
381 |
||
382 |
} |
|
383 |
||
384 |
else if( KErrArgument == error ) |
|
385 |
{ |
|
386 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
387 |
TLiwVariant( KGetLocationBadUpdateOptions ) ) ); |
|
388 |
||
389 |
||
390 |
User::Leave( KErrArgument ); |
|
391 |
||
392 |
} |
|
393 |
||
394 |
||
395 |
updateoptions = &updateOptionVal ; |
|
396 |
} |
|
397 |
||
398 |
||
399 |
if ( posInfoCategory == KLocationGenericInfo ) |
|
400 |
{ |
|
401 |
category = EGenericInfo ; |
|
402 |
} |
|
403 |
else if ( ( posInfoCategory != KLocationBasicinfo ) && ( infoFlag ) ) |
|
404 |
{ |
|
405 |
//this indicates a wrong supplied location info category by the user |
|
406 |
aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, |
|
407 |
TLiwVariant(KGetLocationCategoryInfo))); |
|
408 |
User::Leave(KErrArgument); |
|
409 |
} |
|
410 |
||
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
411 |
//Extract EnableHighAccuracy param |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
412 |
index = 0; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
413 |
const TLiwGenericParam* highaccparam = |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
414 |
aInParamList.FindFirst(index , KEnableHighAccuracy) ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
415 |
TBool enableHighAcc = false; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
416 |
if ( KErrNotFound == index ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
417 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
418 |
highaccparam = 0; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
419 |
TInt count = aInParamList.Count(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
420 |
if ( count >= 3 && posBasedFlag ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
421 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
422 |
//Possiblity of Position based parsing |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
423 |
highaccparam = &aInParamList[Index2]; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
424 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
425 |
} |
19 | 426 |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
427 |
if( highaccparam ) |
19 | 428 |
{ |
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
429 |
if((highaccparam->Value().TypeId()) == EVariantTypeTBool) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
430 |
enableHighAcc = highaccparam->Value().AsTBool(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
431 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
432 |
else |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
433 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
434 |
aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
435 |
TLiwVariant(KGetLocationBadEnableHighAcc) ) ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
436 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
437 |
User::Leave(KErrArgument); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
438 |
} |
19 | 439 |
} |
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
440 |
LocationInterfaceCB* callback = |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
441 |
LocationInterfaceCB::NewL(aCallback, |
32 | 442 |
&aInParamList, /*&iModuleInfo,*/ transid) ; |
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
443 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
444 |
CleanupStack :: PushL(callback) ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
445 |
callback->SetRequestType(KGetLocationCB) ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
446 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
447 |
iLocationService->GetLocationL(callback ,category, |
32 | 448 |
NULL,updateoptions,enableHighAcc) ; |
19 | 449 |
//Store the allocatioed address |
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
450 |
iHandleCB.Append(callback); |
19 | 451 |
//Append Transcationid to out list |
452 |
aOutParamList.AppendL(TLiwGenericParam(KTransactionId, TLiwVariant(transid))); |
|
453 |
CleanupStack :: Pop(callback) ; |
|
454 |
||
455 |
} |
|
456 |
||
457 |
// Command is synchronous GetLocationCall |
|
458 |
else |
|
459 |
{ |
|
460 |
TPosition pos ; |
|
461 |
||
462 |
//Extract Update options from input List |
|
463 |
||
464 |
index = 0; |
|
465 |
const TLiwGenericParam *smapparam = aInParamList.FindFirst(index , KUpdateOptionMap) ; |
|
466 |
TUint category = EBasicInfo ; |
|
467 |
TPositionUpdateOptions updateOptionVal; |
|
468 |
const TPositionUpdateOptions* updateOptions = NULL ; |
|
469 |
//if a smapparam is NULL there exist possibility of position based parsing |
|
470 |
if ( !smapparam ) |
|
471 |
{ |
|
472 |
TInt count = aInParamList.Count(); |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
473 |
if (count >= 2 && posBasedFlag) |
19 | 474 |
{ |
475 |
smapparam = &aInParamList[Index1]; |
|
476 |
if (smapparam) |
|
477 |
{ |
|
478 |
const CLiwMap *updateOptionMap = (smapparam->Value() ).AsMap() ; |
|
479 |
if( !updateOptionMap ) |
|
480 |
{ |
|
481 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
482 |
TLiwVariant( KGetLocationWrongupdateMap ) ) ); |
|
483 |
||
484 |
User::Leave( KErrArgument ); |
|
485 |
} |
|
486 |
TInt error = SetUpdateOption(updateOptionVal,updateOptionMap); |
|
487 |
if( KErrBadTime == error ) |
|
488 |
{ |
|
489 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
490 |
TLiwVariant( KGetLocationNegativeTime ) ) ); |
|
491 |
||
492 |
User::Leave( KErrArgument ); |
|
493 |
||
494 |
} |
|
495 |
else if( KErrArgument == error ) |
|
496 |
{ |
|
497 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
498 |
TLiwVariant( KGetLocationBadUpdateOptions ) ) ); |
|
499 |
||
500 |
User::Leave( KErrArgument ); |
|
501 |
||
502 |
} |
|
503 |
||
504 |
||
505 |
updateOptions = &updateOptionVal ; |
|
506 |
||
507 |
||
508 |
} |
|
509 |
||
510 |
} |
|
511 |
} |
|
512 |
||
513 |
||
514 |
if( KErrNotFound != index) |
|
515 |
{ |
|
516 |
||
517 |
const CLiwMap *updateOptionMap = (smapparam->Value()).AsMap() ; |
|
518 |
if( !updateOptionMap ) |
|
519 |
{ |
|
520 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
521 |
TLiwVariant( KGetLocationWrongupdateMap ) ) ); |
|
522 |
||
523 |
User::Leave( KErrArgument ); |
|
524 |
} |
|
525 |
||
526 |
TInt error = SetUpdateOption(updateOptionVal,updateOptionMap); |
|
527 |
if( KErrBadTime == error ) |
|
528 |
{ |
|
529 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
530 |
TLiwVariant( KGetLocationNegativeTime ) ) ); |
|
531 |
||
532 |
User::Leave( KErrArgument ); |
|
533 |
||
534 |
} |
|
535 |
else if( KErrArgument == error ) |
|
536 |
{ |
|
537 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
538 |
TLiwVariant( KGetLocationBadUpdateOptions ) ) ); |
|
539 |
||
540 |
User::Leave( KErrArgument ); |
|
541 |
||
542 |
} |
|
543 |
updateOptions = &updateOptionVal ; |
|
544 |
||
545 |
} |
|
546 |
||
547 |
if ( posInfoCategory == KLocationGenericInfo ) |
|
548 |
{ |
|
549 |
category = EGenericInfo ; |
|
550 |
} |
|
551 |
else if( posInfoCategory != KLocationBasicinfo ) |
|
552 |
{ |
|
553 |
//this indicates a wrong supplied location info category by the user |
|
554 |
aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, |
|
555 |
TLiwVariant(KGetLocationCategoryInfo))); |
|
556 |
User::Leave(KErrArgument); |
|
557 |
} |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
558 |
//Extract Enable High accuracy param |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
559 |
index = 0; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
560 |
const TLiwGenericParam* highaccparam = |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
561 |
aInParamList.FindFirst(index , |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
562 |
KEnableHighAccuracy) ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
563 |
TBool enableHighAcc = false; |
19 | 564 |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
565 |
if ( KErrNotFound == index ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
566 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
567 |
highaccparam = 0; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
568 |
TInt count = aInParamList.Count(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
569 |
if (count >= 3 && posBasedFlag) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
570 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
571 |
//Position based parsing to be done |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
572 |
highaccparam = &aInParamList[Index2]; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
573 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
574 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
575 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
576 |
if( highaccparam ) |
19 | 577 |
{ |
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
578 |
if((highaccparam->Value().TypeId()) == EVariantTypeTBool) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
579 |
enableHighAcc = highaccparam->Value().AsTBool(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
580 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
581 |
else |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
582 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
583 |
aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
584 |
TLiwVariant(KGetLocationBadEnableHighAcc) ) ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
585 |
User::Leave(KErrArgument); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
586 |
} |
19 | 587 |
} |
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
588 |
|
32 | 589 |
iLocationService->GetLocationL(iGenericPosition, |
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
590 |
updateOptions,enableHighAcc) ; |
19 | 591 |
GetLocationInfo(aOutParamList,category) ; |
592 |
||
593 |
||
594 |
||
595 |
} //End of Synchronous getlocationcall |
|
596 |
||
597 |
||
598 |
||
599 |
} //End of KCmdGetLocation |
|
600 |
||
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
601 |
else if( ( !(aCmdName.CompareF( KCmdTraceLocation )) ) && ( aCallback ) && ( KLiwOptASyncronous & aCmdOptions ) ) //Trace request is made by consumer |
19 | 602 |
{ |
603 |
||
604 |
TInt ret = KErrNone ; |
|
605 |
TInt32 transid = aCallback->GetTransactionID() ; |
|
606 |
TInt index = 0; |
|
607 |
TPtrC posInfoCategory(KLocationBasicinfo); |
|
608 |
||
609 |
||
610 |
||
611 |
const TLiwGenericParam *smapparam = aInParamList.FindFirst(index , KLocationInfoCategory) ; |
|
612 |
||
613 |
//if smapparam is NULL still there exist possibility of position based parsing |
|
614 |
if ( !smapparam ) |
|
615 |
{ |
|
616 |
TInt count = aInParamList.Count(); |
|
617 |
if (count >= 1) |
|
618 |
{ |
|
619 |
smapparam = &aInParamList[Index0]; |
|
620 |
if (smapparam && ( smapparam->Name() == KNullDesC8 ) ) |
|
621 |
{ |
|
622 |
TLiwVariant variant = smapparam->Value(); |
|
623 |
if( variant.TypeId() != LIW::EVariantTypeDesC ) |
|
624 |
{ |
|
625 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
626 |
TLiwVariant( KTraceWrongInfoType ) ) ); |
|
627 |
User::Leave( KErrArgument ); |
|
628 |
//Leave with error code |
|
629 |
} |
|
630 |
posInfoCategory.Set( variant.AsDes() ); |
|
631 |
||
632 |
||
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
633 |
posBasedFlag = ETrue; |
19 | 634 |
} |
635 |
||
636 |
} |
|
637 |
} |
|
638 |
||
639 |
if(KErrNotFound != index) |
|
640 |
{ |
|
641 |
//Extract location category information if specified by user |
|
642 |
TLiwVariant variant = smapparam->Value(); |
|
643 |
if( variant.TypeId() != LIW::EVariantTypeDesC ) |
|
644 |
{ |
|
645 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
646 |
TLiwVariant( KTraceWrongInfoType ) ) ); |
|
647 |
User::Leave( KErrArgument ); |
|
648 |
//Leave with error code |
|
649 |
} |
|
650 |
posInfoCategory.Set( variant.AsDes() ); |
|
651 |
||
652 |
||
653 |
} |
|
654 |
||
655 |
||
656 |
||
657 |
||
658 |
||
659 |
//Default posinfo Category is basic info |
|
660 |
TUint catergory = EBasicInfo ; |
|
661 |
TPositionUpdateOptions updateOptionVal; |
|
662 |
TPositionUpdateOptions* updateOption = NULL ; |
|
663 |
||
664 |
index = 0; |
|
665 |
smapparam = aInParamList.FindFirst(index , KUpdateOptionMap) ; |
|
666 |
//if a smapparam is NULL there exist possibility of position based parsing |
|
667 |
if ( !smapparam ) |
|
668 |
{ |
|
669 |
TInt count = aInParamList.Count(); |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
670 |
if (count >= 2 && posBasedFlag) |
19 | 671 |
{ |
672 |
smapparam = &aInParamList[Index1]; |
|
673 |
if (smapparam) |
|
674 |
{ |
|
675 |
const CLiwMap *updateOptionMap = (smapparam->Value() ).AsMap() ; |
|
676 |
if( !updateOptionMap ) |
|
677 |
{ |
|
678 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
679 |
TLiwVariant( KTraceWrongupdateMap ) ) ); |
|
680 |
||
681 |
User::Leave( KErrArgument ); |
|
682 |
} |
|
683 |
||
684 |
TInt error = SetUpdateOption(updateOptionVal,updateOptionMap); |
|
685 |
if( KErrBadTime == error ) |
|
686 |
{ |
|
687 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
688 |
TLiwVariant( KTraceNegativeTime ) ) ); |
|
689 |
User::Leave( KErrArgument ); |
|
690 |
||
691 |
} |
|
692 |
else if( KErrArgument == error ) |
|
693 |
{ |
|
694 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
695 |
TLiwVariant( KTraceBadUpdateOptions ) ) ); |
|
696 |
||
697 |
||
698 |
||
699 |
User::Leave( KErrArgument ); |
|
700 |
||
701 |
} |
|
702 |
updateOption = &updateOptionVal ; |
|
703 |
||
704 |
||
705 |
} |
|
706 |
||
707 |
} |
|
708 |
} |
|
709 |
||
710 |
||
711 |
//Extract Update options from input List |
|
712 |
if(KErrNotFound != index) |
|
713 |
{ |
|
714 |
const CLiwMap *updateOptionMap = (smapparam->Value()).AsMap() ; |
|
715 |
if( !updateOptionMap ) |
|
716 |
{ |
|
717 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
718 |
TLiwVariant( KGetLocationWrongupdateMap ) ) ); |
|
719 |
||
720 |
User::Leave( KErrArgument ); |
|
721 |
} |
|
722 |
||
723 |
TInt error = SetUpdateOption(updateOptionVal,updateOptionMap); |
|
724 |
if( KErrBadTime == error ) |
|
725 |
{ |
|
726 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
727 |
TLiwVariant( KTraceNegativeTime ) ) ); |
|
728 |
User::Leave( KErrArgument ); |
|
729 |
||
730 |
} |
|
731 |
else if( KErrArgument == error ) |
|
732 |
{ |
|
733 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
734 |
TLiwVariant( KTraceBadUpdateOptions ) ) ); |
|
735 |
||
736 |
User::Leave( KErrArgument ); |
|
737 |
||
738 |
} |
|
739 |
||
740 |
updateOption = &updateOptionVal ; |
|
741 |
} |
|
742 |
||
743 |
||
744 |
//Now set the category of info required before sending request to core dll |
|
745 |
||
746 |
if ( posInfoCategory == KLocationGenericInfo ) |
|
747 |
{ |
|
748 |
catergory = EGenericInfo ; |
|
749 |
} |
|
750 |
else if( posInfoCategory != KLocationBasicinfo ) |
|
751 |
{ |
|
752 |
//this indicates a wrong supplied location info category by the user |
|
753 |
aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, |
|
754 |
TLiwVariant(KTraceCategoryInfo))); |
|
755 |
||
756 |
User::Leave(KErrArgument); |
|
757 |
} |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
758 |
//Extract Enable High accuracy param |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
759 |
index = 0; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
760 |
const TLiwGenericParam* highaccparam = aInParamList.FindFirst(index , |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
761 |
KEnableHighAccuracy) ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
762 |
TBool enableHighAcc = false; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
763 |
if ( KErrNotFound == index ) |
19 | 764 |
{ |
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
765 |
highaccparam = 0; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
766 |
TInt count = aInParamList.Count(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
767 |
if (count >= 3 && posBasedFlag) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
768 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
769 |
//Possibility of Position based parsing |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
770 |
highaccparam = &aInParamList[Index2]; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
771 |
} |
19 | 772 |
} |
773 |
||
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
774 |
if( highaccparam ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
775 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
776 |
if((highaccparam->Value().TypeId()) == EVariantTypeTBool) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
777 |
enableHighAcc = highaccparam->Value().AsTBool(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
778 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
779 |
else |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
780 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
781 |
aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
782 |
TLiwVariant(KGetLocationBadEnableHighAcc) ) ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
783 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
784 |
User::Leave(KErrArgument); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
785 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
786 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
787 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
788 |
LocationInterfaceCB* callback = |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
789 |
LocationInterfaceCB::NewL(aCallback, |
32 | 790 |
&aOutParamList,/* &iModuleInfo,*/ transid) ; |
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
791 |
CleanupStack :: PushL(callback) ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
792 |
callback->SetRequestType(KTraceCB) ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
793 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
794 |
|
32 | 795 |
iLocationService->TraceL( callback, catergory,NULL, |
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
796 |
updateOption,enableHighAcc ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
797 |
iHandleCB.Append(callback); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
798 |
aOutParamList.AppendL(TLiwGenericParam(KTransactionId, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
799 |
TLiwVariant(transid))) ; //Append Transcationid to out list |
19 | 800 |
|
801 |
CleanupStack :: Pop(callback) ; |
|
802 |
||
803 |
} //End of KCmdTraceLocation |
|
804 |
||
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
805 |
else if(!( aCmdName.CompareF( KCmdCancelRequest ) ) ) //Cancel request is made by consumer |
19 | 806 |
{ |
807 |
||
808 |
TInt index = 0 ; |
|
809 |
TInt count = aInParamList.Count(); |
|
810 |
||
811 |
const TLiwGenericParam *genericParam = aInParamList.FindFirst(index , KCancelType) ; |
|
812 |
||
813 |
if(!genericParam) |
|
814 |
{ |
|
815 |
//still exist possibility of position based parsing |
|
816 |
||
817 |
if ( count == 1 ) |
|
818 |
{ |
|
819 |
genericParam = &aInParamList[Index0]; |
|
820 |
} |
|
821 |
||
822 |
} |
|
823 |
||
824 |
//Now genericParam must contain the Canceltype argument |
|
825 |
if (!genericParam) |
|
826 |
{ |
|
827 |
aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, |
|
828 |
TLiwVariant(KCancelMissingType))); |
|
829 |
||
830 |
User::Leave(SErrMissingArgument); |
|
831 |
} |
|
832 |
||
833 |
||
834 |
TLiwVariant variant = genericParam->Value(); |
|
835 |
if( variant.TypeId() != LIW::EVariantTypeDesC ) |
|
836 |
{ |
|
837 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
838 |
TLiwVariant( KCancelTypeMisMatch ) ) ); |
|
839 |
User::Leave( KErrArgument ); |
|
840 |
//Leave with error code |
|
841 |
} |
|
842 |
TPtrC requesttype = variant.AsDes() ; |
|
843 |
TInt ret = KErrGeneral ; |
|
844 |
||
845 |
if(requesttype == KRequestTrace ) |
|
846 |
{ |
|
847 |
||
848 |
ret = iLocationService->CancelOnGoingService(ECancelTrace) ; |
|
849 |
||
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
850 |
if (KErrNone == ret) |
19 | 851 |
{ |
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
852 |
TInt ncal = iHandleCB.Count() ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
853 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
854 |
for (TInt iter = 0; iter < ncal; ++iter) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
855 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
856 |
if (iHandleCB[iter]) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
857 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
858 |
if(iHandleCB[iter]->GetRequestType() == KTraceCB) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
859 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
860 |
delete iHandleCB[iter]; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
861 |
iHandleCB[iter] = NULL; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
862 |
break; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
863 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
864 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
865 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
866 |
|
19 | 867 |
} |
868 |
} |
|
869 |
else if(requesttype == KRequestGetLoc ) |
|
870 |
{ |
|
871 |
||
872 |
ret = iLocationService->CancelOnGoingService(ECancelGetLocation) ; |
|
873 |
||
874 |
if(!ret) |
|
875 |
{ |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
876 |
TInt ncal1 = iHandleCB.Count() ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
877 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
878 |
for (TInt iter = 0; iter < ncal1; ++iter) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
879 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
880 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
881 |
if (iHandleCB[iter]) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
882 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
883 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
884 |
if(iHandleCB[iter]->GetRequestType() == KGetLocationCB) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
885 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
886 |
delete iHandleCB[iter]; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
887 |
iHandleCB[iter] = NULL; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
888 |
break; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
889 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
890 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
891 |
} |
19 | 892 |
} |
893 |
||
894 |
} |
|
895 |
||
896 |
else //Invalid command |
|
897 |
{ |
|
898 |
aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, |
|
899 |
TLiwVariant(KCancelWrongType))); |
|
900 |
||
901 |
User::Leave(KErrArgument); |
|
902 |
} |
|
903 |
||
904 |
||
905 |
User::LeaveIfError(ret); |
|
906 |
||
907 |
} //End of KCmdCancelRequest |
|
908 |
||
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
909 |
else if(( !aCmdName.CompareF(KRequestCalculate) ) ) |
19 | 910 |
{ |
911 |
TInt index = 0 ; |
|
912 |
//Flag set to 0 indicate no position based parsing need to be done |
|
913 |
// for subsequent parameters |
|
914 |
TInt paramparsingFlag = 0; |
|
915 |
const TLiwGenericParam *genericParam = aInParamList.FindFirst(index ,KMathRequest) ; |
|
916 |
||
917 |
if(!genericParam) |
|
918 |
{ |
|
919 |
||
920 |
genericParam = &aInParamList[Index0]; |
|
921 |
paramparsingFlag = 1; |
|
922 |
if( !genericParam ) |
|
923 |
{ |
|
924 |
aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, |
|
925 |
TLiwVariant(KMissingMathrequest))); |
|
926 |
User::Leave(KErrArgument); |
|
927 |
} |
|
928 |
||
929 |
||
930 |
} |
|
931 |
||
932 |
TLiwVariant variant = genericParam->Value(); |
|
933 |
if( variant.TypeId() != EVariantTypeDesC ) |
|
934 |
{ |
|
935 |
aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, |
|
936 |
TLiwVariant(KWrongMathrequest))); |
|
937 |
User::Leave(KErrArgument); |
|
938 |
||
939 |
} |
|
940 |
TPtrC requesttype = variant.AsDes() ; |
|
941 |
TInt ret ; |
|
942 |
||
943 |
||
944 |
if( requesttype == KRequestDistance ) |
|
945 |
{ |
|
946 |
TInt mathindex = 0 ; |
|
947 |
||
948 |
// calculation |
|
949 |
const TLiwGenericParam *smapparam = aInParamList.FindFirst(mathindex , KDistanceParmSource) ; |
|
950 |
//if smapparam is NULL still exist possibility of position based parsing |
|
951 |
if ( (!smapparam) && (paramparsingFlag) ) |
|
952 |
{ |
|
953 |
smapparam = &aInParamList[Index1]; |
|
954 |
} |
|
955 |
||
956 |
||
957 |
mathindex = 0 ; |
|
958 |
const TLiwGenericParam *dmapparam = aInParamList.FindFirst(mathindex , KDistanceParmDestination) ; |
|
959 |
if ( (!dmapparam) && (paramparsingFlag) ) |
|
960 |
{ |
|
961 |
dmapparam = &aInParamList[Index2]; |
|
962 |
} |
|
963 |
if(!smapparam || !dmapparam) |
|
964 |
{ |
|
965 |
aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, |
|
966 |
TLiwVariant(KMissingParamCord))); |
|
967 |
User::Leave(KErrArgument); |
|
968 |
} |
|
969 |
||
970 |
TLiwVariant mapVariant= smapparam->Value() ; |
|
971 |
const CLiwMap *map = mapVariant.AsMap() ; |
|
972 |
if( !map ) |
|
973 |
{ |
|
974 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
975 |
TLiwVariant( KCalWrongSource ) ) ); |
|
976 |
||
977 |
||
978 |
User::Leave( KErrArgument ); |
|
979 |
} |
|
980 |
TCoordinate source , destination ; |
|
981 |
||
982 |
FillCoordinatesL(source , map) ; //Extract source coordinates |
|
983 |
||
984 |
mapVariant = dmapparam->Value() ; |
|
985 |
map = mapVariant.AsMap() ; |
|
986 |
if( !map ) |
|
987 |
{ |
|
988 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
989 |
TLiwVariant( KCalWrongDest ) ) ); |
|
990 |
||
991 |
||
992 |
User::Leave( KErrArgument ); |
|
993 |
} |
|
994 |
||
995 |
FillCoordinatesL(destination , map) ; |
|
996 |
||
997 |
inpparam distance ; |
|
998 |
||
999 |
distance.source = source ; |
|
1000 |
distance.destination = destination ; |
|
1001 |
distance.servicechoice = EDistance ; |
|
1002 |
||
1003 |
||
1004 |
ret = iLocationService->MathOperation(distance) ; //Calculate distance using core class |
|
1005 |
||
1006 |
||
1007 |
//success/failure code to the outputlist |
|
1008 |
//TLiwGenericParam errorParm(KErrorCode , TLiwVariant((TInt32)ret)) ; |
|
1009 |
//aOutParamList.AppendL(errorParm) ; |
|
1010 |
User::LeaveIfError(ret); |
|
1011 |
TReal32 resultvalue = distance.result; |
|
1012 |
||
1013 |
if ( KErrNone == ret ) |
|
1014 |
{ |
|
1015 |
TLiwGenericParam opresult(KMathOpResult,TLiwVariant((TReal)resultvalue)); |
|
1016 |
aOutParamList.AppendL(opresult) ; |
|
1017 |
} |
|
1018 |
||
1019 |
} //End of KRequestDistance |
|
1020 |
||
1021 |
else if ( requesttype == KRequestBearingTo) |
|
1022 |
{ |
|
1023 |
TInt mathindex = 0 ; |
|
1024 |
||
1025 |
// calculation |
|
1026 |
const TLiwGenericParam *smapparam = aInParamList.FindFirst(mathindex , KDistanceParmSource) ; |
|
1027 |
//if smapparam is NULL still exist possibility of position based parsing |
|
1028 |
if ( (!smapparam) && (paramparsingFlag) ) |
|
1029 |
{ |
|
1030 |
smapparam = &aInParamList[Index1]; |
|
1031 |
} |
|
1032 |
||
1033 |
mathindex = 0 ; |
|
1034 |
const TLiwGenericParam *dmapparam = aInParamList.FindFirst(mathindex , KDistanceParmDestination) ; |
|
1035 |
if ( (!dmapparam) && (paramparsingFlag) ) |
|
1036 |
{ |
|
1037 |
dmapparam = &aInParamList[Index2]; |
|
1038 |
} |
|
1039 |
||
1040 |
if(!smapparam || !dmapparam) |
|
1041 |
{ |
|
1042 |
aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, |
|
1043 |
TLiwVariant(KMissingParamCord))); |
|
1044 |
User::Leave(KErrArgument); |
|
1045 |
} |
|
1046 |
||
1047 |
TLiwVariant mapVariant= smapparam->Value() ; |
|
1048 |
const CLiwMap *map = mapVariant.AsMap() ; |
|
1049 |
if( !map ) |
|
1050 |
{ |
|
1051 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
1052 |
TLiwVariant( KCalWrongSource ) ) ); |
|
1053 |
||
1054 |
||
1055 |
User::Leave( KErrArgument ); |
|
1056 |
} |
|
1057 |
TCoordinate source , destination ; |
|
1058 |
||
1059 |
FillCoordinatesL(source , map) ; //Extract source coordinates |
|
1060 |
||
1061 |
mapVariant = dmapparam->Value() ; |
|
1062 |
map = mapVariant.AsMap() ; |
|
1063 |
if( !map ) |
|
1064 |
{ |
|
1065 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
1066 |
TLiwVariant( KCalWrongDest ) ) ); |
|
1067 |
||
1068 |
||
1069 |
User::Leave( KErrArgument ); |
|
1070 |
} |
|
1071 |
||
1072 |
FillCoordinatesL(destination , map) ; |
|
1073 |
||
1074 |
inpparam bearingTo ; |
|
1075 |
||
1076 |
bearingTo.source = source ; |
|
1077 |
bearingTo.destination = destination ; |
|
1078 |
bearingTo.servicechoice = EBearingTo ; |
|
1079 |
||
1080 |
ret = iLocationService->MathOperation(bearingTo) ; |
|
1081 |
||
1082 |
||
1083 |
||
1084 |
User::LeaveIfError(ret); |
|
1085 |
TReal32 resultvalue = bearingTo.result; |
|
1086 |
||
1087 |
if ( KErrNone == ret ) |
|
1088 |
{ |
|
1089 |
TLiwGenericParam opresult(KMathOpResult,TLiwVariant((TReal)resultvalue)); |
|
1090 |
aOutParamList.AppendL(opresult) ; |
|
1091 |
} |
|
1092 |
} //End of KRequestBearingto |
|
1093 |
else if ( requesttype == KRequestMove ) |
|
1094 |
{ |
|
1095 |
TInt mathindex = 0; |
|
1096 |
||
1097 |
// Extracting source coordinate from input parameter List |
|
1098 |
const TLiwGenericParam *smapparam = aInParamList.FindFirst(mathindex , KDistanceParmSource) ; |
|
1099 |
if ( (!smapparam) && (paramparsingFlag) ) |
|
1100 |
{ |
|
1101 |
smapparam = &aInParamList[Index1]; |
|
1102 |
} |
|
1103 |
||
1104 |
||
1105 |
||
1106 |
if( !smapparam ) |
|
1107 |
{ |
|
1108 |
aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, |
|
1109 |
TLiwVariant(KMissingParamCord))); |
|
1110 |
User::Leave( SErrMissingArgument ); |
|
1111 |
} |
|
1112 |
||
1113 |
TLiwVariant mapVariant= smapparam->Value() ; |
|
1114 |
const CLiwMap *map = mapVariant.AsMap() ; |
|
1115 |
if( !map ) |
|
1116 |
{ |
|
1117 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, |
|
1118 |
TLiwVariant( KCalWrongSource ) ) ); |
|
1119 |
||
1120 |
||
1121 |
User::Leave( KErrArgument ); |
|
1122 |
} |
|
1123 |
TCoordinate source ; |
|
1124 |
||
1125 |
FillCoordinatesL(source , map) ; |
|
1126 |
||
1127 |
mathindex = 0; |
|
1128 |
//Extracting distance by which coordinate should be moved |
|
1129 |
const TLiwGenericParam *distanceParam = aInParamList.FindFirst(mathindex,KDistanceMove) ; |
|
1130 |
if ( (!distanceParam) && (paramparsingFlag) ) |
|
1131 |
{ |
|
1132 |
distanceParam = &aInParamList[Index2]; |
|
1133 |
if ( !distanceParam ) |
|
1134 |
{ |
|
1135 |
aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, |
|
1136 |
TLiwVariant(KMissingDistanceParam))); |
|
1137 |
User::Leave( SErrMissingArgument ); |
|
1138 |
} |
|
1139 |
} |
|
1140 |
if( !distanceParam ) |
|
1141 |
{ |
|
1142 |
aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, |
|
1143 |
TLiwVariant(KMissingDistanceParam))); |
|
1144 |
User::Leave( SErrMissingArgument ); |
|
1145 |
} |
|
1146 |
TLiwVariant distanceVariant = distanceParam->Value(); |
|
1147 |
if( ( distanceVariant.TypeId() != EVariantTypeTReal ) ) |
|
1148 |
{ |
|
1149 |
if ( ( distanceVariant.TypeId() != EVariantTypeTInt32 ) ) |
|
1150 |
{ |
|
1151 |
aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, |
|
1152 |
TLiwVariant(KCaluclateMoveDistance))); |
|
1153 |
User::Leave(KErrArgument); |
|
1154 |
} |
|
1155 |
||
1156 |
} |
|
1157 |
||
1158 |
const TReal64 distanceValue = distanceVariant.AsTReal(); |
|
1159 |
||
1160 |
||
1161 |
//Extracting bearing by which coordinate should be moved |
|
1162 |
mathindex = 0; |
|
1163 |
||
1164 |
const TLiwGenericParam *bearingParam = aInParamList.FindFirst(mathindex,KBearingMove); |
|
1165 |
if ( (!bearingParam) && (paramparsingFlag) ) |
|
1166 |
{ |
|
1167 |
bearingParam = &aInParamList[Index3]; |
|
1168 |
if ( !bearingParam ) |
|
1169 |
{ |
|
1170 |
aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, |
|
1171 |
TLiwVariant(KMissingBearingParam))); |
|
1172 |
User::Leave( SErrMissingArgument ); |
|
1173 |
} |
|
1174 |
} |
|
1175 |
||
1176 |
if( !bearingParam ) |
|
1177 |
{ |
|
1178 |
aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, |
|
1179 |
TLiwVariant(KMissingBearingParam))); |
|
1180 |
User::Leave( SErrMissingArgument ); |
|
1181 |
||
1182 |
} |
|
1183 |
TLiwVariant bearingVariant = bearingParam->Value(); |
|
1184 |
if( ( bearingVariant.TypeId() != EVariantTypeTReal ) ) |
|
1185 |
{ |
|
1186 |
if ( ( bearingVariant.TypeId() != EVariantTypeTInt32 ) ) |
|
1187 |
{ |
|
1188 |
aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, |
|
1189 |
TLiwVariant(KCaluclateMoveBearing))); |
|
1190 |
User::Leave(KErrArgument); |
|
1191 |
} |
|
1192 |
||
1193 |
} |
|
1194 |
||
1195 |
const TReal32 bearingValue = bearingVariant.AsTReal(); |
|
1196 |
||
1197 |
||
1198 |
||
1199 |
||
1200 |
||
1201 |
inpparam moveParam ; |
|
1202 |
||
1203 |
moveParam.source = source ; |
|
1204 |
||
1205 |
||
1206 |
moveParam.servicechoice = EMove ; |
|
1207 |
||
1208 |
moveParam.bearing = bearingValue; |
|
1209 |
moveParam.distance = distanceValue; |
|
1210 |
||
1211 |
//Move Coordinates |
|
1212 |
ret = iLocationService->MathOperation(moveParam) ; |
|
1213 |
||
1214 |
if ( KErrNone == ret ) |
|
1215 |
{ |
|
1216 |
TReal64 inputParamLongitude = moveParam.source.Longitude(); |
|
1217 |
TReal64 inputParamLatitude = moveParam.source.Latitude(); |
|
1218 |
TReal64 inputParamAltitude = moveParam.source.Altitude(); |
|
1219 |
||
1220 |
//Appending translated coordinate to outputParamList |
|
1221 |
CLiwDefaultMap *result = CLiwDefaultMap::NewL() ; |
|
1222 |
CleanupStack :: PushL(result) ; |
|
1223 |
||
1224 |
//Inserting longitude, Latitude and altitude |
|
1225 |
result->InsertL(KLongitudeKey , TLiwVariant((TReal)inputParamLongitude )) ; |
|
1226 |
result->InsertL(KLatitudeKey , TLiwVariant((TReal)inputParamLatitude)) ; |
|
1227 |
result->InsertL(KAltitudeKey , TLiwVariant((TReal)inputParamAltitude)) ; |
|
1228 |
TLiwVariant resVar(result) ; |
|
1229 |
||
1230 |
TLiwGenericParam outParm(KLocationMap , TLiwVariant(result)) ; |
|
1231 |
||
1232 |
aOutParamList.AppendL(outParm) ; |
|
1233 |
result->DecRef(); |
|
1234 |
||
1235 |
||
1236 |
||
1237 |
||
1238 |
//success/failure code to the outputlist |
|
1239 |
TLiwGenericParam errorParm(KErrorCode , TLiwVariant((TInt32)ret)) ; |
|
1240 |
aOutParamList.AppendL(errorParm) ; |
|
1241 |
CleanupStack :: Pop(result) ; |
|
1242 |
||
1243 |
}//End of Move |
|
1244 |
else |
|
1245 |
{ |
|
1246 |
/*TLiwGenericParam errorParm(KErrorCode , TLiwVariant((TInt32)ret)) ; |
|
1247 |
aOutParamList.AppendL(errorParm) ;*/ |
|
1248 |
User::LeaveIfError(ret); |
|
1249 |
||
1250 |
} |
|
1251 |
||
1252 |
} |
|
1253 |
||
1254 |
||
1255 |
else |
|
1256 |
{ |
|
1257 |
aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, |
|
1258 |
TLiwVariant(KWrongMathrequest))); |
|
1259 |
User::Leave(KErrArgument); |
|
1260 |
} |
|
1261 |
||
1262 |
} |
|
1263 |
else//bad command |
|
1264 |
{ |
|
1265 |
aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, |
|
1266 |
TLiwVariant(KCmdNotFound))); |
|
1267 |
User::Leave(KErrNotSupported); |
|
1268 |
||
1269 |
} |
|
1270 |
||
1271 |
||
1272 |
||
1273 |
} |
|
1274 |
||
1275 |
/** |
|
1276 |
* CLocationInterface :: SetSupportedFields fills iGenericPosInfo as per the capability of the |
|
1277 |
* positioning module used |
|
1278 |
*/ |
|
1279 |
||
1280 |
||
1281 |
/** |
|
1282 |
* CLocationInterface :: GetLocationInfo an internal utility funtionin, gets all the location information |
|
1283 |
* which is supported by this Module |
|
1284 |
*/ |
|
1285 |
||
1286 |
||
1287 |
void CLocationInterface :: GetLocationInfo( CLiwGenericParamList& aOutParamList,TInt aPosInfoCategory) |
|
1288 |
{ |
|
1289 |
TPosition pos ; |
|
32 | 1290 |
iGenericPosition->GetPosition(pos) ; //Now populate outparam list with latitude, longitude and altitude data |
19 | 1291 |
|
1292 |
CLiwDefaultMap *Result = CLiwDefaultMap::NewL() ; |
|
1293 |
||
1294 |
CleanupStack :: PushL(Result) ; |
|
1295 |
TReal64 Val = pos.Longitude() ; |
|
1296 |
||
1297 |
//Inserting latitude , longitude , altitude . |
|
1298 |
Result->InsertL(KLongitudeKey , TLiwVariant((TReal)Val)) ; |
|
1299 |
||
1300 |
Val = pos.Latitude() ; |
|
1301 |
Result->InsertL(KLatitudeKey , TLiwVariant((TReal)Val)) ; |
|
1302 |
||
1303 |
TReal32 altitude = pos.Altitude() ; |
|
1304 |
||
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1305 |
if (!(Math::IsNaN(altitude))) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1306 |
{ |
19 | 1307 |
Result->InsertL(KAltitudeKey , TLiwVariant((TReal)altitude)) ; |
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1308 |
} |
19 | 1309 |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1310 |
TReal32 Val1; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1311 |
Val1 = pos.HorizontalAccuracy(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1312 |
if (!(Math::IsNaN(Val1))) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1313 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1314 |
Result->InsertL(KHorAccuracy, TLiwVariant((TReal)Val1)) ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1315 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1316 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1317 |
Val1 = pos.VerticalAccuracy(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1318 |
if (!(Math::IsNaN(Val1))) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1319 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1320 |
Result->InsertL(KVerAccuracy, TLiwVariant((TReal)Val1)) ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1321 |
} |
19 | 1322 |
TLiwVariant MapVariant(Result) ; |
1323 |
||
1324 |
||
32 | 1325 |
//TPositionModuleInfo :: TCapabilities currCapability = iModuleInfo.Capabilities() ; |
19 | 1326 |
|
1327 |
if ( aPosInfoCategory == EGenericPositionInfo ) |
|
1328 |
{ |
|
32 | 1329 |
|
19 | 1330 |
TReal32 speedinfo = 0 ; |
1331 |
||
32 | 1332 |
if(!iGenericPosition->GetValue(EPositionFieldHorizontalSpeed , speedinfo)) //Extract speed |
19 | 1333 |
{ |
1334 |
Result->InsertL(KPositionFieldHorizontalSpeed ,TLiwVariant((TReal) speedinfo)) ; |
|
1335 |
} |
|
1336 |
||
1337 |
||
1338 |
||
32 | 1339 |
if(!iGenericPosition->GetValue(EPositionFieldHorizontalSpeedError , speedinfo) ) |
19 | 1340 |
{ |
1341 |
Result->InsertL(KPositionFieldHorizontalSpeedError ,TLiwVariant((TReal) speedinfo)) ; |
|
1342 |
} |
|
1343 |
||
1344 |
/*if(!iGenericPosInfo->GetValue(EPositionFieldVerticalSpeed , speedinfo)) |
|
1345 |
{ |
|
1346 |
Result->InsertL(KPositionFieldVerticalSpeed ,TLiwVariant((TReal) speedinfo)) ; |
|
1347 |
||
1348 |
} |
|
1349 |
||
1350 |
if(!iGenericPosInfo->GetValue(EPositionFieldVerticalSpeedError ,speedinfo)) |
|
1351 |
{ |
|
1352 |
Result->InsertL(KPositionFieldVerticalSpeedError ,TLiwVariant((TReal) speedinfo)) ; |
|
1353 |
}*/ |
|
1354 |
||
1355 |
||
1356 |
||
1357 |
||
32 | 1358 |
TInt8 satinfo = 0; |
19 | 1359 |
|
32 | 1360 |
if(!iGenericPosition->GetValue(EPositionFieldSatelliteNumInView , satinfo)) |
1361 |
{ |
|
1362 |
Result->InsertL(KPositionFieldSatelliteNumInView ,TLiwVariant((TReal) satinfo)) ; |
|
1363 |
} |
|
1364 |
if(!iGenericPosition->GetValue(EPositionFieldSatelliteNumUsed , satinfo)) |
|
1365 |
{ |
|
1366 |
Result->InsertL(KPositionFieldSatelliteNumUsed ,TLiwVariant((TReal) satinfo)) ; |
|
1367 |
} |
|
1368 |
||
19 | 1369 |
|
32 | 1370 |
|
19 | 1371 |
TReal32 direcinfo = 0; |
1372 |
||
1373 |
||
32 | 1374 |
if(!iGenericPosition->GetValue(EPositionFieldTrueCourse , direcinfo) ) |
19 | 1375 |
{ |
1376 |
Result->InsertL(KPositionFieldTrueCourse ,TLiwVariant((TReal) direcinfo)) ; |
|
1377 |
} |
|
1378 |
||
1379 |
||
32 | 1380 |
if(!iGenericPosition->GetValue(EPositionFieldTrueCourseError , direcinfo) ) |
19 | 1381 |
{ |
1382 |
Result->InsertL(KPositionFieldTrueCourseError ,TLiwVariant((TReal) direcinfo)) ; |
|
1383 |
} |
|
1384 |
||
1385 |
||
32 | 1386 |
if(!iGenericPosition->GetValue(EPositionFieldMagneticCourseError , direcinfo) ) |
19 | 1387 |
{ |
1388 |
Result->InsertL(KPositionFieldMagneticCourseError ,TLiwVariant((TReal) direcinfo)) ; |
|
1389 |
} |
|
1390 |
||
1391 |
||
32 | 1392 |
if(!iGenericPosition->GetValue(EPositionFieldMagneticCourse , direcinfo) ) |
19 | 1393 |
{ |
1394 |
Result->InsertL(KPositionFieldMagneticCourse ,TLiwVariant((TReal) direcinfo)) ; |
|
1395 |
} |
|
32 | 1396 |
|
19 | 1397 |
|
1398 |
||
32 | 1399 |
|
1400 |
TReal32 compassinfo ; |
|
19 | 1401 |
|
32 | 1402 |
|
1403 |
if(!iGenericPosition->GetValue(EPositionFieldHeading , compassinfo) ) |
|
1404 |
{ |
|
1405 |
Result->InsertL(KPositionFieldHeading ,TLiwVariant((TReal) compassinfo)) ; |
|
1406 |
} |
|
19 | 1407 |
|
1408 |
||
32 | 1409 |
if(!iGenericPosition->GetValue(EPositionFieldHeadingError , compassinfo) ) |
1410 |
{ |
|
1411 |
Result->InsertL(KPositionFieldHeadingError ,TLiwVariant((TReal) compassinfo)) ; |
|
1412 |
} |
|
19 | 1413 |
|
1414 |
||
32 | 1415 |
if(!iGenericPosition->GetValue(EPositionFieldMagneticHeading , compassinfo) ) |
1416 |
{ |
|
1417 |
Result->InsertL(KPositionFieldMagneticHeading ,TLiwVariant((TReal) compassinfo)) ; |
|
1418 |
} |
|
19 | 1419 |
|
1420 |
||
1421 |
||
32 | 1422 |
if(!iGenericPosition->GetValue(EPositionFieldMagneticHeadingError , compassinfo) ) |
1423 |
{ |
|
1424 |
Result->InsertL(KPositionFieldMagneticHeadingError ,TLiwVariant((TReal) compassinfo)) ; |
|
19 | 1425 |
|
32 | 1426 |
} |
19 | 1427 |
} |
1428 |
||
1429 |
||
1430 |
aOutParamList.AppendL(TLiwGenericParam ( KLocationMap, TLiwVariant(Result))) ; |
|
1431 |
Result->DecRef(); |
|
1432 |
CleanupStack :: Pop(Result) ; |
|
1433 |
||
1434 |
} |
|
1435 |
||
1436 |
||
1437 |
||
1438 |
||
1439 |
/** |
|
1440 |
* Function : ExecuteCmdL , called directly by consumer, parses the input parameters and |
|
1441 |
* then calls appropriate method on iLocationService object |
|
1442 |
*/ |
|
1443 |
||
1444 |
||
1445 |
void CLocationInterface :: ExecuteCmdL( const TDesC8& aCmdName, |
|
1446 |
const CLiwGenericParamList& aInParamList , |
|
1447 |
CLiwGenericParamList& aOutParamList, |
|
1448 |
TUint aCmdOptions, |
|
1449 |
MLiwNotifyCallback* aCallback ) |
|
1450 |
{ |
|
1451 |
||
1452 |
TRAPD(error , CmdExecuteL(aCmdName , aInParamList , aOutParamList , aCmdOptions , aCallback)) ; |
|
1453 |
||
1454 |
||
1455 |
TInt sapierror = ConvertToSapiError(error); |
|
1456 |
aOutParamList.AppendL(TLiwGenericParam(KErrorCode , TLiwVariant((TInt32)sapierror))) ; |
|
1457 |
||
1458 |
||
1459 |
||
1460 |
} |
|
1461 |
||
1462 |
||
1463 |
||
1464 |
||
1465 |
/** |
|
1466 |
* Internal function which is used to extract the coordinates from CLiwMap passed by consumer |
|
1467 |
*/ |
|
1468 |
||
1469 |
void CLocationInterface :: FillCoordinatesL ( TCoordinate& aCoordinate , const CLiwMap* aMap ) |
|
1470 |
{ |
|
1471 |
TLiwVariant longitudevar ; |
|
1472 |
TLiwVariant latitudevar ; |
|
1473 |
TLiwVariant altitudevar ; |
|
1474 |
||
1475 |
||
1476 |
||
1477 |
if( !aMap->FindL(KLongitudeKey , longitudevar) ) |
|
1478 |
User::Leave( SErrMissingArgument ); |
|
1479 |
||
1480 |
if( !aMap->FindL(KLatitudeKey , latitudevar) ) |
|
1481 |
User::Leave( SErrMissingArgument ); |
|
1482 |
||
1483 |
||
1484 |
if( !aMap->FindL(KAltitudeKey , altitudevar ) ) |
|
1485 |
User::Leave( SErrMissingArgument ); |
|
1486 |
||
1487 |
||
1488 |
TReal64 latitude = 0,longitude = 0,altitude = 0; |
|
1489 |
if ( ( latitudevar.TypeId() == EVariantTypeTReal ) || ( latitudevar.TypeId() == EVariantTypeTInt32 ) ) |
|
1490 |
{ |
|
1491 |
latitude = (TReal64)latitudevar.AsTReal() ; |
|
1492 |
} |
|
1493 |
else |
|
1494 |
User::Leave( KErrArgument ); |
|
1495 |
||
1496 |
if ( ( longitudevar.TypeId() == EVariantTypeTReal ) || ( longitudevar.TypeId() == EVariantTypeTInt32 ) ) |
|
1497 |
{ |
|
1498 |
longitude = (TReal64)longitudevar.AsTReal() ; |
|
1499 |
} |
|
1500 |
else |
|
1501 |
User::Leave( KErrArgument ); |
|
1502 |
||
1503 |
if ( ( altitudevar.TypeId() == EVariantTypeTReal ) || ( altitudevar.TypeId() == EVariantTypeTInt32 ) ) |
|
1504 |
{ |
|
1505 |
altitude = (TReal64)altitudevar.AsTReal() ; |
|
1506 |
} |
|
1507 |
else |
|
1508 |
User::Leave( KErrArgument ); |
|
1509 |
||
1510 |
||
1511 |
||
1512 |
||
1513 |
aCoordinate.SetCoordinate( latitude , longitude , altitude) ; |
|
1514 |
||
1515 |
||
1516 |
} |
|
1517 |
||
1518 |
/** |
|
1519 |
* CLocationInterface ::SetUpdateOption extracts updates options from input CLiwMap into TpositonUpdatedOptions |
|
1520 |
* This is an internal utility function |
|
1521 |
*/ |
|
1522 |
TInt CLocationInterface ::SetUpdateOption(TPositionUpdateOptions& aPositionUpdateoption,const CLiwMap* aUpdatemap) |
|
1523 |
{ |
|
1524 |
||
1525 |
TLiwVariant options ; |
|
1526 |
||
1527 |
||
1528 |
||
1529 |
//Extrace Update interval |
|
1530 |
if(aUpdatemap->FindL(KUpdateOptionInterval,options)) |
|
1531 |
{ |
|
1532 |
if( ( options.TypeId() == LIW::EVariantTypeTInt32 ) || ( options.TypeId() == LIW::EVariantTypeTReal ) ) |
|
1533 |
{ |
|
1534 |
TInt interval = options.AsTInt32(); |
|
1535 |
if( interval < 0 ) |
|
1536 |
{ |
|
1537 |
return KErrBadTime; |
|
1538 |
} |
|
1539 |
aPositionUpdateoption.SetUpdateInterval(TTimeIntervalMicroSeconds(interval)); |
|
1540 |
} |
|
1541 |
else |
|
1542 |
{ |
|
1543 |
return KErrArgument; |
|
1544 |
||
1545 |
} |
|
1546 |
||
1547 |
} |
|
1548 |
else//set the default value |
|
1549 |
{ |
|
1550 |
aPositionUpdateoption.SetUpdateInterval(TTimeIntervalMicroSeconds(KLocUpdateInterval)); |
|
1551 |
||
1552 |
} |
|
1553 |
||
1554 |
//Update time out |
|
1555 |
if(aUpdatemap->FindL(KUpdateOptionTimeOut,options)) |
|
1556 |
{ |
|
1557 |
if( ( options.TypeId() == LIW::EVariantTypeTInt32 ) || ( options.TypeId() == LIW::EVariantTypeTReal ) ) |
|
1558 |
{ |
|
1559 |
TInt timeOut = options.AsTInt32(); |
|
1560 |
if( timeOut < 0 ) |
|
1561 |
{ |
|
1562 |
return KErrBadTime; |
|
1563 |
} |
|
1564 |
aPositionUpdateoption.SetUpdateTimeOut(TTimeIntervalMicroSeconds(timeOut)); |
|
1565 |
} |
|
1566 |
else |
|
1567 |
{ |
|
1568 |
return KErrArgument; |
|
1569 |
} |
|
1570 |
||
1571 |
} |
|
1572 |
else//set the default value |
|
1573 |
{ |
|
1574 |
aPositionUpdateoption.SetUpdateTimeOut(TTimeIntervalMicroSeconds(KLocUpdateTimeOut)); |
|
1575 |
||
1576 |
} |
|
1577 |
||
1578 |
//Update maxage specifies |
|
1579 |
if(aUpdatemap->FindL(KUpdateOptionMaxAge,options)) |
|
1580 |
{ |
|
1581 |
if( ( options.TypeId() == LIW::EVariantTypeTInt32 ) || ( options.TypeId() == LIW::EVariantTypeTReal ) ) |
|
1582 |
{ |
|
1583 |
TInt maxAge = options.AsTInt32(); |
|
1584 |
if( maxAge < 0 ) |
|
1585 |
{ |
|
1586 |
return KErrBadTime; |
|
1587 |
} |
|
1588 |
||
1589 |
aPositionUpdateoption.SetMaxUpdateAge(TTimeIntervalMicroSeconds(maxAge)); |
|
1590 |
} |
|
1591 |
else |
|
1592 |
{ |
|
1593 |
return KErrArgument; |
|
1594 |
} |
|
1595 |
||
1596 |
} |
|
1597 |
else//set the default value |
|
1598 |
{ |
|
1599 |
aPositionUpdateoption.SetMaxUpdateAge(TTimeIntervalMicroSeconds(KLocMaxAge)); |
|
1600 |
||
1601 |
} |
|
1602 |
//Partial Updates |
|
1603 |
if(aUpdatemap->FindL(KPartialUpdates , options )) |
|
1604 |
{ |
|
1605 |
if( options.TypeId() != LIW::EVariantTypeTBool ) |
|
1606 |
{ |
|
1607 |
return KErrArgument; |
|
1608 |
} |
|
1609 |
||
1610 |
TBool partialUpdates = options.AsTBool() ; |
|
1611 |
aPositionUpdateoption.SetAcceptPartialUpdates(partialUpdates) ; |
|
1612 |
} |
|
1613 |
else//set the default value |
|
1614 |
{ |
|
1615 |
aPositionUpdateoption.SetAcceptPartialUpdates(FALSE) ; |
|
1616 |
||
1617 |
||
1618 |
} |
|
1619 |
||
1620 |
return KErrNone; |
|
1621 |
||
1622 |
} |
|
1623 |