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