author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 31 Aug 2010 16:06:03 +0300 | |
branch | RCL_3 |
changeset 44 | 0b68a1b0c15e |
parent 38 | ea43c23d28d2 |
child 45 | a9c0808a1095 |
permissions | -rw-r--r-- |
5 | 1 |
/* |
2 |
* Copyright (c) 2002 - 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: ?Description |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
||
21 |
// [INCLUDE FILES] - do not remove |
|
22 |
#include <e32svr.h> |
|
23 |
#include <StifParser.h> |
|
24 |
#include <Stiftestinterface.h> |
|
25 |
#include <LiwServicehandler.h> |
|
26 |
#include "landmarks_inputparams.h" |
|
27 |
||
28 |
using namespace LIW; |
|
29 |
||
30 |
_LIT(KLandmark, "Landmark" ); |
|
31 |
_LIT(KCategory, "Category" ); |
|
32 |
_LIT(KDatabase, "Database" ); |
|
33 |
_LIT(KMultiple, "Multiple" ); |
|
34 |
_LIT(KDefault, "Default" ); |
|
35 |
||
36 |
// ============================ MEMBER FUNCTIONS =============================== |
|
37 |
||
38 |
// ----------------------------------------------------------------------------- |
|
39 |
// Clandmarks_inputparams::Delete |
|
40 |
// Delete here all resources allocated and opened from test methods. |
|
41 |
// Called from destructor. |
|
42 |
// ----------------------------------------------------------------------------- |
|
43 |
// |
|
44 |
void Clandmarks_inputparams::Delete() |
|
45 |
{ |
|
46 |
iLandmarkIf->Close(); |
|
47 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, _L8("IDataSource"), _L8("Service.Landmarks")); |
|
48 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
49 |
RCriteriaArray a; |
|
50 |
CleanupClosePushL(a); |
|
51 |
a.AppendL(crit); |
|
52 |
iServiceHandler->DetachL(a); |
|
53 |
CleanupStack::PopAndDestroy(&a); |
|
54 |
CleanupStack::PopAndDestroy(crit); |
|
55 |
delete iServiceHandler; |
|
56 |
} |
|
57 |
||
58 |
void Clandmarks_inputparams::InitL() |
|
59 |
{ |
|
60 |
iServiceHandler = CLiwServiceHandler::NewL(); |
|
61 |
CLiwGenericParamList& inList = iServiceHandler->InParamListL(); |
|
62 |
CLiwGenericParamList& outList = iServiceHandler->OutParamListL(); |
|
63 |
||
64 |
||
65 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, _L8("IDataSource"), _L8("Service.Landmarks")); |
|
66 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
67 |
RCriteriaArray a; |
|
68 |
CleanupClosePushL(a); |
|
69 |
a.AppendL(crit); |
|
70 |
iServiceHandler->AttachL(a); |
|
71 |
iServiceHandler->ExecuteServiceCmdL(*crit,inList,outList); |
|
72 |
CleanupStack::PopAndDestroy(&a); |
|
73 |
CleanupStack::PopAndDestroy(crit); |
|
74 |
||
75 |
//retrieve the interface handle |
|
76 |
TInt index = 0; |
|
77 |
const TLiwGenericParam* outParam = outList.FindFirst(index,_L8("IDataSource")); |
|
78 |
||
79 |
if( outParam ) |
|
80 |
{ |
|
81 |
iLandmarkIf = outParam->Value().AsInterface(); |
|
82 |
} |
|
83 |
||
84 |
inList.Reset(); |
|
85 |
outList.Reset(); |
|
86 |
} |
|
87 |
// ----------------------------------------------------------------------------- |
|
88 |
// Clandmarks_inputparams::RunMethodL |
|
89 |
// Run specified method. Contains also table of test mothods and their names. |
|
90 |
// ----------------------------------------------------------------------------- |
|
91 |
// |
|
92 |
TInt Clandmarks_inputparams::RunMethodL( |
|
93 |
CStifItemParser& aItem ) |
|
94 |
{ |
|
95 |
||
96 |
static TStifFunctionInfo const KFunctions[] = |
|
97 |
{ |
|
98 |
// Copy this line for every implemented function. |
|
99 |
// First string is the function name used in TestScripter script file. |
|
100 |
// Second is the actual implementation member function. |
|
101 |
//ENTRY( "Example", Clandmarks_inputparams::ExampleL ), |
|
102 |
//ADD NEW ENTRY HERE |
|
103 |
// [test cases entries] - Do not remove |
|
104 |
ENTRY( "GetList", Clandmarks_inputparams::GetListL ), |
|
105 |
ENTRY( "Add", Clandmarks_inputparams::AddL ), |
|
106 |
ENTRY( "Delete", Clandmarks_inputparams::DeleteL ), |
|
107 |
ENTRY( "Import", Clandmarks_inputparams::ImportL ), |
|
108 |
ENTRY( "Export", Clandmarks_inputparams::ExportL ), |
|
109 |
ENTRY( "Organise", Clandmarks_inputparams::OrganiseL ), |
|
110 |
ENTRY( "Cancel", Clandmarks_inputparams::CancelL ), |
|
111 |
ENTRY( "Liw", Clandmarks_inputparams::LiwL ), |
|
112 |
}; |
|
113 |
||
114 |
const TInt count = sizeof( KFunctions ) / |
|
115 |
sizeof( TStifFunctionInfo ); |
|
116 |
||
117 |
return RunInternalL( KFunctions, count, aItem ); |
|
118 |
||
119 |
} |
|
120 |
||
121 |
// ----------------------------------------------------------------------------- |
|
122 |
// Clandmarks_inputparams::RunMethodL |
|
123 |
// Run specified method. Contains also table of test mothods and their names. |
|
124 |
// ----------------------------------------------------------------------------- |
|
125 |
// |
|
126 |
TInt Clandmarks_inputparams::HandleNotifyL( |
|
127 |
TInt aCmdId, |
|
128 |
TInt aEventId, |
|
129 |
CLiwGenericParamList& aEventParamList, |
|
130 |
const CLiwGenericParamList& aInParamList) |
|
131 |
{ |
|
132 |
return KErrNone; |
|
133 |
} |
|
134 |
// ----------------------------------------------------------------------------- |
|
135 |
// Clandmarks_inputparams::ExampleL |
|
136 |
// Example test method function. |
|
137 |
// (other items were commented in a header). |
|
138 |
// ----------------------------------------------------------------------------- |
|
139 |
// |
|
140 |
TInt Clandmarks_inputparams::GetListL( CStifItemParser& aItem ) |
|
141 |
{ |
|
142 |
||
143 |
// Print to UI |
|
144 |
_LIT( Klandmarks_inputparams, "landmarks_inputparams" ); |
|
145 |
_LIT( KExample, "In Example" ); |
|
146 |
TestModuleIf().Printf( 0, Klandmarks_inputparams, KExample ); |
|
147 |
// Print to log file |
|
148 |
iLog->Log( KExample ); |
|
149 |
TInt i = 0; |
|
150 |
TOperation oper = NoOp; |
|
151 |
TType type = NoType; |
|
152 |
TPtrC string; |
|
153 |
_LIT( KParam, "Param[%i]: %S" ); |
|
154 |
while ( aItem.GetNextString ( string ) == KErrNone ) |
|
155 |
{ |
|
156 |
TestModuleIf().Printf( i, Klandmarks_inputparams, |
|
157 |
KParam, i, &string ); |
|
158 |
if( string == KMultiple ) |
|
159 |
{ |
|
160 |
oper = Multiple; |
|
161 |
} |
|
162 |
if( string == KDefault ) |
|
163 |
{ |
|
164 |
oper = Default; |
|
165 |
} |
|
166 |
if( string == KLandmark ) |
|
167 |
{ |
|
168 |
type = Landmark; |
|
169 |
} |
|
170 |
if( string == KCategory ) |
|
171 |
{ |
|
172 |
type = Category; |
|
173 |
} |
|
174 |
if( string == KDatabase ) |
|
175 |
{ |
|
176 |
type = Database; |
|
177 |
} |
|
178 |
i++; |
|
179 |
} |
|
180 |
TInt err = KErrGeneral; |
|
181 |
||
182 |
switch( oper ) |
|
183 |
{ |
|
184 |
case Default: |
|
185 |
{ |
|
186 |
switch( type ) |
|
187 |
{ |
|
188 |
case Landmark: err = GetLandmarkDefL(); |
|
189 |
break; |
|
190 |
case Category: //err = GetCategoryDefL(); |
|
191 |
break; |
|
192 |
case Database: //err = GetDatabaseDefL(); |
|
193 |
break; |
|
194 |
} |
|
195 |
} |
|
196 |
break; |
|
197 |
default: |
|
198 |
{ |
|
199 |
switch( type ) |
|
200 |
{ |
|
201 |
case Landmark: err = GetLandmarkL(); |
|
202 |
break; |
|
203 |
case Category: err = GetCategoryL(); |
|
204 |
break; |
|
205 |
case Database: err = GetDatabaseL(); |
|
206 |
break; |
|
207 |
} |
|
208 |
} |
|
209 |
} |
|
210 |
return err; |
|
211 |
||
212 |
} |
|
213 |
||
214 |
TInt Clandmarks_inputparams::GetLandmarkL() |
|
215 |
{ |
|
216 |
//__UHEAP_MARK; |
|
217 |
InitL(); |
|
218 |
CLiwGenericParamList& inList = iServiceHandler->InParamListL(); |
|
219 |
CLiwGenericParamList& outList = iServiceHandler->OutParamListL(); |
|
220 |
inList.Reset(); |
|
221 |
outList.Reset(); |
|
222 |
||
223 |
//Type mandatory |
|
224 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(_L("Landmark")))); |
|
225 |
||
226 |
//Filter Optional |
|
227 |
CLiwDefaultMap* filter = CLiwDefaultMap::NewL(); |
|
228 |
CleanupStack::PushL(filter); |
|
229 |
||
230 |
filter->InsertL(_L8("DatabaseURI"),TLiwVariant(_L("c:eposlm.ldb"))); |
|
231 |
filter->InsertL(_L8("MaximumMatches"),TLiwVariant((TInt32)10)); |
|
232 |
filter->InsertL(_L8("PreviousMatchesOnly"),TLiwVariant((TBool)FALSE)); |
|
233 |
filter->InsertL(_L8("LandmarkName"),TLiwVariant(_L("A*"))); |
|
234 |
filter->InsertL(_L8("LandmarkDesc"),TLiwVariant(_L("D?"))); |
|
235 |
||
236 |
CLiwDefaultMap* position = CLiwDefaultMap::NewL(); |
|
237 |
CleanupStack::PushL(position); |
|
238 |
position->InsertL(_L8("Latitude"),TLiwVariant(14.23)); |
|
239 |
position->InsertL(_L8("Longitude"),TLiwVariant(85.31)); |
|
240 |
filter->InsertL(_L8("LandmarkPosition"),TLiwVariant(position)); |
|
241 |
||
242 |
||
243 |
filter->InsertL(_L8("CoverageRadiusOption"),TLiwVariant((TBool)FALSE)); |
|
244 |
filter->InsertL(_L8("CategoryName"),TLiwVariant(_L("Hotel"))); |
|
245 |
||
246 |
CLiwDefaultMap* area = CLiwDefaultMap::NewL(); |
|
247 |
CleanupStack::PushL(area); |
|
248 |
area->InsertL(_L8("NorthLatitude"),TLiwVariant(12.12)); |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
249 |
area->InsertL(_L8("SouthLatitude"),TLiwVariant(11.13)); |
5 | 250 |
area->InsertL(_L8("EastLongitude"),TLiwVariant(14.14)); |
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
251 |
area->InsertL(_L8("WestLongitude"),TLiwVariant(13.15)); |
5 | 252 |
filter->InsertL(_L8("BoundedArea"),TLiwVariant(area)); |
253 |
||
254 |
||
255 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(filter))); |
|
256 |
||
257 |
//Sort Optional |
|
258 |
CLiwDefaultMap* sort = CLiwDefaultMap::NewL(); |
|
259 |
CleanupStack::PushL(sort); |
|
260 |
||
261 |
sort->InsertL(_L8("Key"),TLiwVariant(_L("LandmarkName"))); |
|
262 |
sort->InsertL(_L8("Order"),TLiwVariant(_L("Ascending"))); |
|
263 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(sort))); |
|
264 |
||
265 |
||
266 |
||
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
267 |
iLandmarkIf->ExecuteCmdL(_L8("getList"),inList,outList,0,0); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
268 |
|
5 | 269 |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
270 |
CleanupStack::Pop(sort); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
271 |
sort->DecRef(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
272 |
CleanupStack::Pop(area); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
273 |
area->DecRef(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
274 |
CleanupStack::Pop(position); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
275 |
position->DecRef(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
276 |
CleanupStack::Pop(filter); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
277 |
filter->DecRef(); |
5 | 278 |
|
279 |
||
280 |
TInt index = 0; |
|
281 |
const TLiwGenericParam* outParam = outList.FindFirst(index,_L8("ErrorCode")); |
|
282 |
||
283 |
if( outParam ) |
|
284 |
{ |
|
285 |
index = outParam->Value().AsTInt32(); |
|
286 |
} |
|
287 |
inList.Reset(); |
|
288 |
outList.Reset(); |
|
289 |
Delete(); |
|
290 |
//__UHEAP_MARKEND; |
|
291 |
return index; |
|
292 |
} |
|
293 |
||
294 |
TInt Clandmarks_inputparams::GetLandmarkDefL() |
|
295 |
{ |
|
296 |
//__UHEAP_MARK; |
|
297 |
InitL(); |
|
298 |
CLiwGenericParamList& inList = iServiceHandler->InParamListL(); |
|
299 |
CLiwGenericParamList& outList = iServiceHandler->OutParamListL(); |
|
300 |
inList.Reset(); |
|
301 |
outList.Reset(); |
|
302 |
||
303 |
//Type mandatory |
|
304 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(_L("Landmark")))); |
|
305 |
||
306 |
//Filter Optional |
|
307 |
CLiwDefaultMap* filter = CLiwDefaultMap::NewL(); |
|
308 |
CleanupStack::PushL(filter); |
|
309 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(filter))); |
|
310 |
||
311 |
||
312 |
iLandmarkIf->ExecuteCmdL(_L8("GetList"),inList,outList,0,0); |
|
313 |
||
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
314 |
CleanupStack::Pop(filter); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
315 |
filter->DecRef(); |
5 | 316 |
|
317 |
||
318 |
TInt index = 0; |
|
319 |
const TLiwGenericParam* outParam = outList.FindFirst(index,_L8("ErrorCode")); |
|
320 |
||
321 |
if( outParam ) |
|
322 |
{ |
|
323 |
index = outParam->Value().AsTInt32(); |
|
324 |
} |
|
325 |
if( !index ) |
|
326 |
{ |
|
327 |
outParam = outList.FindFirst(index,_L8("ReturnValue")); |
|
328 |
CLiwIterable* iter = outParam->Value().AsIterable(); |
|
329 |
CheckAscending(Landmark,iter); |
|
330 |
} |
|
331 |
inList.Reset(); |
|
332 |
outList.Reset(); |
|
333 |
Delete(); |
|
334 |
//__UHEAP_MARKEND; |
|
335 |
return index; |
|
336 |
} |
|
337 |
||
338 |
TInt Clandmarks_inputparams::GetCategoryL() |
|
339 |
{ |
|
340 |
//__UHEAP_MARK; |
|
341 |
InitL(); |
|
342 |
CLiwGenericParamList& inList = iServiceHandler->InParamListL(); |
|
343 |
CLiwGenericParamList& outList = iServiceHandler->OutParamListL(); |
|
344 |
inList.Reset(); |
|
345 |
outList.Reset(); |
|
346 |
||
347 |
//Type mandatory |
|
348 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(_L("Category")))); |
|
349 |
||
350 |
//Filter Optional |
|
351 |
CLiwDefaultMap* filter = CLiwDefaultMap::NewL(); |
|
352 |
CleanupStack::PushL(filter); |
|
353 |
||
354 |
filter->InsertL(_L8("DatabaseURI"),TLiwVariant(_L("c:eposlm.ldb"))); |
|
355 |
filter->InsertL(_L8("MaximumMatches"),TLiwVariant((TInt32)10)); |
|
356 |
filter->InsertL(_L8("PreviousMatchesOnly"),TLiwVariant((TBool)FALSE)); |
|
357 |
filter->InsertL(_L8("CategoryName"),TLiwVariant(_L("A*"))); |
|
358 |
||
359 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(filter))); |
|
360 |
||
361 |
//Sort Optional |
|
362 |
CLiwDefaultMap* sort = CLiwDefaultMap::NewL(); |
|
363 |
CleanupStack::PushL(sort); |
|
364 |
||
365 |
sort->InsertL(_L8("Key"),TLiwVariant(_L("CategoryName"))); |
|
366 |
sort->InsertL(_L8("Order"),TLiwVariant(_L("Ascending"))); |
|
367 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(sort))); |
|
368 |
||
369 |
iLandmarkIf->ExecuteCmdL(_L8("GetList"),inList,outList,0,0); |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
370 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
371 |
CleanupStack::Pop(sort); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
372 |
sort->DecRef(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
373 |
CleanupStack::Pop(filter); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
374 |
filter->DecRef(); |
5 | 375 |
|
376 |
TInt index = 0; |
|
377 |
const TLiwGenericParam* outParam = outList.FindFirst(index,_L8("ErrorCode")); |
|
378 |
||
379 |
if( outParam ) |
|
380 |
{ |
|
381 |
index = outParam->Value().AsTInt32(); |
|
382 |
} |
|
383 |
inList.Reset(); |
|
384 |
outList.Reset(); |
|
385 |
||
386 |
Delete(); |
|
387 |
//__UHEAP_MARKEND; |
|
388 |
return index; |
|
389 |
} |
|
390 |
||
391 |
TInt Clandmarks_inputparams::GetDatabaseL() |
|
392 |
{ |
|
393 |
//__UHEAP_MARK; |
|
394 |
InitL(); |
|
395 |
CLiwGenericParamList& inList = iServiceHandler->InParamListL(); |
|
396 |
CLiwGenericParamList& outList = iServiceHandler->OutParamListL(); |
|
397 |
inList.Reset(); |
|
398 |
outList.Reset(); |
|
399 |
////__UHEAP_MARK; |
|
400 |
//Type mandatory |
|
401 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(_L("Database")))); |
|
402 |
||
403 |
//Filter Optional |
|
404 |
CLiwDefaultMap* filter = CLiwDefaultMap::NewL(); |
|
405 |
CleanupStack::PushL(filter); |
|
406 |
||
407 |
filter->InsertL(_L8("DbProtocol"),TLiwVariant(_L("file"))); |
|
408 |
||
409 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(filter))); |
|
410 |
||
411 |
//Sort Optional |
|
412 |
CLiwDefaultMap* sort = CLiwDefaultMap::NewL(); |
|
413 |
CleanupStack::PushL(sort); |
|
414 |
||
415 |
sort->InsertL(_L8("Key"),TLiwVariant(_L("DatabaseURI"))); |
|
416 |
sort->InsertL(_L8("Order"),TLiwVariant(_L("Ascending"))); |
|
417 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(sort))); |
|
418 |
||
419 |
||
420 |
||
421 |
iLandmarkIf->ExecuteCmdL(_L8("GetList"),inList,outList,0,0); |
|
422 |
||
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
423 |
CleanupStack::Pop(sort); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
424 |
sort->DecRef(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
425 |
CleanupStack::Pop(filter); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
426 |
filter->DecRef(); |
5 | 427 |
|
428 |
||
429 |
TInt index = 0; |
|
430 |
const TLiwGenericParam* outParam = outList.FindFirst(index,_L8("ErrorCode")); |
|
431 |
||
432 |
if( outParam ) |
|
433 |
{ |
|
434 |
index = outParam->Value().AsTInt32(); |
|
435 |
} |
|
436 |
inList.Reset(); |
|
437 |
outList.Reset(); |
|
438 |
Delete(); |
|
439 |
//__UHEAP_MARKEND; |
|
440 |
return index; |
|
441 |
} |
|
442 |
/// ----------------------------------------------------------------------------- |
|
443 |
// Clandmarks_inputparams::ExampleL |
|
444 |
// Example test method function. |
|
445 |
// (other items were commented in a header). |
|
446 |
// ----------------------------------------------------------------------------- |
|
447 |
// |
|
448 |
TInt Clandmarks_inputparams::AddL( CStifItemParser& aItem ) |
|
449 |
{ |
|
450 |
||
451 |
// Print to UI |
|
452 |
_LIT( Klandmarks_inputparams, "landmarks_inputparams" ); |
|
453 |
_LIT( KExample, "In Example" ); |
|
454 |
TestModuleIf().Printf( 0, Klandmarks_inputparams, KExample ); |
|
455 |
// Print to log file |
|
456 |
iLog->Log( KExample ); |
|
457 |
||
458 |
TInt i = 0; |
|
459 |
TBool isMultiple = EFalse; |
|
460 |
TBool isLandmark = EFalse; |
|
461 |
TPtrC string; |
|
462 |
_LIT( KParam, "Param[%i]: %S" ); |
|
463 |
while ( aItem.GetNextString ( string ) == KErrNone ) |
|
464 |
{ |
|
465 |
TestModuleIf().Printf( i, Klandmarks_inputparams, |
|
466 |
KParam, i, &string ); |
|
467 |
if( string == KMultiple ) |
|
468 |
{ |
|
469 |
isMultiple = ETrue; |
|
470 |
} |
|
471 |
if( isMultiple && string == KLandmark ) |
|
472 |
{ |
|
473 |
isLandmark = ETrue; |
|
474 |
} |
|
475 |
i++; |
|
476 |
} |
|
477 |
||
478 |
TInt err = KErrGeneral; |
|
479 |
||
480 |
if( string == KLandmark ) |
|
481 |
{ |
|
482 |
err = AddLandmarkL(); |
|
483 |
} |
|
484 |
if( string == KCategory ) |
|
485 |
{ |
|
486 |
err = AddCategoryL(); |
|
487 |
} |
|
488 |
||
489 |
TInt32 count = 0; |
|
490 |
if( isMultiple ) |
|
491 |
{ |
|
492 |
TLex lexstring(string); |
|
493 |
lexstring.Val(count); |
|
494 |
if( isLandmark ) |
|
495 |
{ |
|
496 |
err = AddLmL(count); |
|
497 |
} |
|
498 |
else |
|
499 |
{ |
|
500 |
err = AddCatL(count); |
|
501 |
} |
|
502 |
} |
|
503 |
return err; |
|
504 |
||
505 |
} |
|
506 |
||
507 |
TInt Clandmarks_inputparams::AddLmL( TInt32 count ) |
|
508 |
{ |
|
509 |
//__UHEAP_MARK; |
|
510 |
InitL(); |
|
511 |
TInt err = KErrGeneral; |
|
512 |
while( count ) |
|
513 |
{ |
|
514 |
err = KErrGeneral; |
|
515 |
CLiwGenericParamList& inList = iServiceHandler->InParamListL(); |
|
516 |
CLiwGenericParamList& outList = iServiceHandler->OutParamListL(); |
|
517 |
inList.Reset(); |
|
518 |
outList.Reset(); |
|
519 |
//Type mandatory |
|
520 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(_L("Landmark")))); |
|
521 |
||
522 |
//Data mandatory |
|
523 |
CLiwDefaultMap* data = CLiwDefaultMap::NewL(); |
|
524 |
CleanupStack::PushL(data); |
|
525 |
||
526 |
data->InsertL(_L8("DatabaseURI"),TLiwVariant(_L("c:eposlm.ldb"))); |
|
527 |
TBuf<256> lmName; |
|
528 |
lmName.Copy(_L("Lm")); |
|
529 |
TInt32 append = User::NTickCount(); |
|
530 |
lmName.AppendNum(append); |
|
531 |
data->InsertL(_L8("LandmarkName"),TLiwVariant(lmName)); |
|
532 |
||
533 |
data->InsertL(_L8("LandmarkDesc"),TLiwVariant(_L("Space"))); |
|
534 |
||
535 |
CLiwDefaultMap* position = CLiwDefaultMap::NewL(); |
|
536 |
CleanupStack::PushL(position); |
|
537 |
position->InsertL(_L8("Latitude"),TLiwVariant(14.23)); |
|
538 |
position->InsertL(_L8("Longitude"),TLiwVariant(85.31)); |
|
539 |
position->InsertL(_L8("Altitude"),TLiwVariant(8.31)); |
|
540 |
position->InsertL(_L8("HAccuracy"),TLiwVariant(8.51)); |
|
541 |
position->InsertL(_L8("VAccuracy"),TLiwVariant(0.85)); |
|
542 |
position->InsertL(_L8("TStamp"),TLiwVariant(853.1)); |
|
543 |
data->InsertL(_L8("LandmarkPosition"),TLiwVariant(position)); |
|
544 |
||
545 |
data->InsertL(_L8("CoverageRadius"),TLiwVariant(50.23)); |
|
546 |
||
547 |
CLiwDefaultMap* fields = CLiwDefaultMap::NewL(); |
|
548 |
CleanupStack::PushL(fields); |
|
549 |
fields->InsertL(_L8("Street"),TLiwVariant(_L("street"))); |
|
550 |
fields->InsertL(_L8("BuildingName"),TLiwVariant(_L("Building"))); |
|
551 |
fields->InsertL(_L8("District"),TLiwVariant(_L("district"))); |
|
552 |
fields->InsertL(_L8("City"),TLiwVariant(_L("city"))); |
|
553 |
fields->InsertL(_L8("AreaCode"),TLiwVariant(_L("area"))); |
|
554 |
fields->InsertL(_L8("Telephone"),TLiwVariant(_L("1234"))); |
|
555 |
fields->InsertL(_L8("Country"),TLiwVariant(_L("in"))); |
|
556 |
||
557 |
data->InsertL(_L8("LandmarkFields"),TLiwVariant(fields)); |
|
558 |
||
559 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(data))); |
|
560 |
||
561 |
iLandmarkIf->ExecuteCmdL(_L8("Add"),inList,outList,0,0); |
|
562 |
||
563 |
||
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
564 |
CleanupStack::Pop(fields); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
565 |
fields->DecRef(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
566 |
CleanupStack::Pop(position); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
567 |
position->DecRef(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
568 |
CleanupStack::Pop(data); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
569 |
data->DecRef(); |
5 | 570 |
|
571 |
TInt index = 0; |
|
572 |
const TLiwGenericParam* outParam = outList.FindFirst(index,_L8("ErrorCode")); |
|
573 |
||
574 |
if( outParam ) |
|
575 |
{ |
|
576 |
err = outParam->Value().AsTInt32(); |
|
577 |
} |
|
578 |
inList.Reset(); |
|
579 |
outList.Reset(); |
|
580 |
if( err ) |
|
581 |
{ |
|
582 |
User::Leave(err); |
|
583 |
} |
|
584 |
||
585 |
--count; |
|
586 |
} |
|
587 |
// Delete resources allocated from test methods |
|
588 |
Delete(); |
|
589 |
//__UHEAP_MARKEND; |
|
590 |
return err; |
|
591 |
||
592 |
} |
|
593 |
TInt Clandmarks_inputparams::AddCatL( TInt32 count ) |
|
594 |
{ |
|
595 |
return KErrNone; |
|
596 |
} |
|
597 |
TInt Clandmarks_inputparams::AddLandmarkL() |
|
598 |
{ |
|
599 |
//__UHEAP_MARK; |
|
600 |
InitL(); |
|
601 |
CLiwGenericParamList& inList = iServiceHandler->InParamListL(); |
|
602 |
CLiwGenericParamList& outList = iServiceHandler->OutParamListL(); |
|
603 |
inList.Reset(); |
|
604 |
outList.Reset(); |
|
605 |
//Type mandatory |
|
606 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(_L("Landmark")))); |
|
607 |
||
608 |
//Data mandatory |
|
609 |
CLiwDefaultMap* data = CLiwDefaultMap::NewL(); |
|
610 |
CleanupStack::PushL(data); |
|
611 |
||
612 |
data->InsertL(_L8("DatabaseURI"),TLiwVariant(_L("c:eposlm.ldb"))); |
|
613 |
data->InsertL(_L8("LandmarkName"),TLiwVariant(_L("Lm"))); |
|
614 |
/* |
|
615 |
CLiwDefaultList* category = CLiwDefaultList::NewL(); |
|
616 |
CleanupStack::PushL(category); |
|
617 |
category->AppendL(TLiwVariant(_L("0"))); |
|
618 |
data->InsertL(_L8("CategoryInfo"),TLiwVariant((category)));*/ |
|
619 |
||
620 |
data->InsertL(_L8("LandmarkDesc"),TLiwVariant(_L("Space"))); |
|
621 |
||
622 |
CLiwDefaultMap* position = CLiwDefaultMap::NewL(); |
|
623 |
CleanupStack::PushL(position); |
|
624 |
position->InsertL(_L8("Latitude"),TLiwVariant(14.23)); |
|
625 |
position->InsertL(_L8("Longitude"),TLiwVariant(85.31)); |
|
626 |
position->InsertL(_L8("Altitude"),TLiwVariant(8.31)); |
|
627 |
position->InsertL(_L8("HAccuracy"),TLiwVariant(8.51)); |
|
628 |
position->InsertL(_L8("VAccuracy"),TLiwVariant(0.85)); |
|
629 |
position->InsertL(_L8("TStamp"),TLiwVariant(853.1)); |
|
630 |
data->InsertL(_L8("LandmarkPosition"),TLiwVariant(position)); |
|
631 |
||
632 |
data->InsertL(_L8("CoverageRadius"),TLiwVariant(50.23)); |
|
633 |
data->InsertL(_L8("IconFile"),TLiwVariant(_L("try.mbm"))); |
|
634 |
data->InsertL(_L8("IconIndex"),TLiwVariant((TInt32)0)); |
|
635 |
data->InsertL(_L8("IconMaskIndex"),TLiwVariant((TInt32)0)); |
|
636 |
||
637 |
CLiwDefaultMap* fields = CLiwDefaultMap::NewL(); |
|
638 |
CleanupStack::PushL(fields); |
|
639 |
fields->InsertL(_L8("Street"),TLiwVariant(_L("street"))); |
|
640 |
fields->InsertL(_L8("BuildingName"),TLiwVariant(_L("Building"))); |
|
641 |
fields->InsertL(_L8("District"),TLiwVariant(_L("district"))); |
|
642 |
fields->InsertL(_L8("City"),TLiwVariant(_L("city"))); |
|
643 |
fields->InsertL(_L8("AreaCode"),TLiwVariant(_L("area"))); |
|
644 |
fields->InsertL(_L8("Telephone"),TLiwVariant(_L("1234"))); |
|
645 |
fields->InsertL(_L8("Country"),TLiwVariant(_L("in"))); |
|
646 |
||
647 |
data->InsertL(_L8("LandmarkFields"),TLiwVariant(fields)); |
|
648 |
||
649 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(data))); |
|
650 |
||
651 |
iLandmarkIf->ExecuteCmdL(_L8("Add"),inList,outList,0,0); |
|
652 |
||
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
653 |
CleanupStack::Pop(fields); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
654 |
fields->DecRef(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
655 |
CleanupStack::Pop(position); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
656 |
position->DecRef(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
657 |
CleanupStack::Pop(data); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
658 |
data->DecRef(); |
5 | 659 |
|
660 |
||
661 |
TInt index = 0; |
|
662 |
const TLiwGenericParam* outParam = outList.FindFirst(index,_L8("ErrorCode")); |
|
663 |
||
664 |
if( outParam ) |
|
665 |
{ |
|
666 |
index = outParam->Value().AsTInt32(); |
|
667 |
} |
|
668 |
inList.Reset(); |
|
669 |
outList.Reset(); |
|
670 |
// Delete resources allocated from test methods |
|
671 |
||
672 |
if( index == 1012 ) |
|
673 |
{ |
|
674 |
index = 0; |
|
675 |
} |
|
676 |
Delete(); |
|
677 |
//__UHEAP_MARKEND; |
|
678 |
if( index == 1002 ) |
|
679 |
{ |
|
680 |
index = 0; |
|
681 |
} |
|
682 |
return index; |
|
683 |
} |
|
684 |
TInt Clandmarks_inputparams::AddCategoryL() |
|
685 |
{ |
|
686 |
//__UHEAP_MARK; |
|
687 |
InitL(); |
|
688 |
CLiwGenericParamList& inList = iServiceHandler->InParamListL(); |
|
689 |
CLiwGenericParamList& outList = iServiceHandler->OutParamListL(); |
|
690 |
inList.Reset(); |
|
691 |
outList.Reset(); |
|
692 |
||
693 |
//Type mandatory |
|
694 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(_L("Category")))); |
|
695 |
||
696 |
//Data mandatory |
|
697 |
CLiwDefaultMap* data = CLiwDefaultMap::NewL(); |
|
698 |
CleanupStack::PushL(data); |
|
699 |
||
700 |
data->InsertL(_L8("DatabaseURI"),TLiwVariant(_L("c:eposlm.ldb"))); |
|
701 |
//unique category name |
|
702 |
TBuf<256> catName; |
|
703 |
catName.Copy(_L("Cat")); |
|
704 |
TInt32 append = User::NTickCount(); |
|
705 |
catName.AppendNum(append); |
|
706 |
data->InsertL(_L8("CategoryName"),TLiwVariant(catName)); |
|
707 |
data->InsertL(_L8("IconFile"),TLiwVariant(_L("try.mbm"))); |
|
708 |
data->InsertL(_L8("IconIndex"),TLiwVariant((TInt32)0)); |
|
709 |
data->InsertL(_L8("IconMaskIndex"),TLiwVariant((TInt32)0)); |
|
710 |
||
711 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(data))); |
|
712 |
||
713 |
iLandmarkIf->ExecuteCmdL(_L8("Add"),inList,outList,0,0); |
|
714 |
||
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
715 |
CleanupStack::Pop(data); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
716 |
data->DecRef(); |
5 | 717 |
|
718 |
||
719 |
TInt index = 0; |
|
720 |
const TLiwGenericParam* outParam = outList.FindFirst(index,_L8("ErrorCode")); |
|
721 |
||
722 |
if( outParam ) |
|
723 |
{ |
|
724 |
index = outParam->Value().AsTInt32(); |
|
725 |
} |
|
726 |
inList.Reset(); |
|
727 |
outList.Reset(); |
|
728 |
// Delete resources allocated from test methods |
|
729 |
Delete(); |
|
730 |
//__UHEAP_MARKEND; |
|
731 |
return index; |
|
732 |
} |
|
733 |
// ----------------------------------------------------------------------------- |
|
734 |
// Clandmarks_inputparams::ExampleL |
|
735 |
// Example test method function. |
|
736 |
// (other items were commented in a header). |
|
737 |
// ----------------------------------------------------------------------------- |
|
738 |
// |
|
739 |
TInt Clandmarks_inputparams::DeleteL( CStifItemParser& aItem ) |
|
740 |
{ |
|
741 |
||
742 |
// Print to UI |
|
743 |
_LIT( Klandmarks_inputparams, "landmarks_inputparams" ); |
|
744 |
_LIT( KExample, "In Example" ); |
|
745 |
TestModuleIf().Printf( 0, Klandmarks_inputparams, KExample ); |
|
746 |
// Print to log file |
|
747 |
iLog->Log( KExample ); |
|
748 |
||
749 |
TInt i = 0; |
|
750 |
TPtrC string; |
|
751 |
_LIT( KParam, "Param[%i]: %S" ); |
|
752 |
while ( aItem.GetNextString ( string ) == KErrNone ) |
|
753 |
{ |
|
754 |
TestModuleIf().Printf( i, Klandmarks_inputparams, |
|
755 |
KParam, i, &string ); |
|
756 |
i++; |
|
757 |
} |
|
758 |
||
759 |
TInt err = KErrGeneral; |
|
760 |
||
761 |
if( string == KLandmark ) |
|
762 |
{ |
|
763 |
err = DeleteLandmarkL(); |
|
764 |
} |
|
765 |
if( string == KCategory ) |
|
766 |
{ |
|
767 |
err = DeleteCategoryL(); |
|
768 |
} |
|
769 |
return err; |
|
770 |
} |
|
771 |
||
772 |
TInt Clandmarks_inputparams::DeleteLandmarkL() |
|
773 |
{ |
|
774 |
//__UHEAP_MARK; |
|
775 |
InitL(); |
|
776 |
CLiwGenericParamList& inList = iServiceHandler->InParamListL(); |
|
777 |
CLiwGenericParamList& outList = iServiceHandler->OutParamListL(); |
|
778 |
inList.Reset(); |
|
779 |
outList.Reset(); |
|
780 |
////__UHEAP_MARK; |
|
781 |
//Type mandatory |
|
782 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(_L("Landmark")))); |
|
783 |
||
784 |
//Data mandatory |
|
785 |
CLiwDefaultMap* data = CLiwDefaultMap::NewL(); |
|
786 |
CleanupStack::PushL(data); |
|
787 |
||
788 |
data->InsertL(_L8("DatabaseURI"),TLiwVariant(_L("c:eposlm.ldb"))); |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
789 |
data->InsertL(_L8("id"),TLiwVariant(_L("0"))); |
5 | 790 |
|
791 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(data))); |
|
792 |
||
793 |
iLandmarkIf->ExecuteCmdL(_L8("Delete"),inList,outList,0,0); |
|
794 |
||
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
795 |
CleanupStack::Pop(data); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
796 |
data->DecRef(); |
5 | 797 |
|
798 |
||
799 |
TInt index = 0; |
|
800 |
const TLiwGenericParam* outParam = outList.FindFirst(index,_L8("ErrorCode")); |
|
801 |
||
802 |
if( outParam ) |
|
803 |
{ |
|
804 |
index = outParam->Value().AsTInt32(); |
|
805 |
} |
|
806 |
inList.Reset(); |
|
807 |
outList.Reset(); |
|
808 |
Delete(); |
|
809 |
//__UHEAP_MARKEND; |
|
810 |
return index; |
|
811 |
} |
|
812 |
||
813 |
TInt Clandmarks_inputparams::DeleteCategoryL() |
|
814 |
{ |
|
815 |
//__UHEAP_MARK; |
|
816 |
InitL(); |
|
817 |
CLiwGenericParamList& inList = iServiceHandler->InParamListL(); |
|
818 |
CLiwGenericParamList& outList = iServiceHandler->OutParamListL(); |
|
819 |
inList.Reset(); |
|
820 |
outList.Reset(); |
|
821 |
////__UHEAP_MARK; |
|
822 |
//Type mandatory |
|
823 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(_L("Category")))); |
|
824 |
||
825 |
//Data mandatory |
|
826 |
CLiwDefaultMap* data = CLiwDefaultMap::NewL(); |
|
827 |
CleanupStack::PushL(data); |
|
828 |
||
829 |
data->InsertL(_L8("DatabaseURI"),TLiwVariant(_L("c:eposlm.ldb"))); |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
830 |
data->InsertL(_L8("id"),TLiwVariant(_L("0"))); |
5 | 831 |
|
832 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(data))); |
|
833 |
||
834 |
iLandmarkIf->ExecuteCmdL(_L8("Delete"),inList,outList,0,0); |
|
835 |
||
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
836 |
CleanupStack::Pop(data); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
837 |
data->DecRef(); |
5 | 838 |
|
839 |
||
840 |
TInt index = 0; |
|
841 |
const TLiwGenericParam* outParam = outList.FindFirst(index,_L8("ErrorCode")); |
|
842 |
||
843 |
if( outParam ) |
|
844 |
{ |
|
845 |
index = outParam->Value().AsTInt32(); |
|
846 |
} |
|
847 |
inList.Reset(); |
|
848 |
outList.Reset(); |
|
849 |
Delete(); |
|
850 |
//__UHEAP_MARKEND; |
|
851 |
return index; |
|
852 |
} |
|
853 |
// ----------------------------------------------------------------------------- |
|
854 |
// Clandmarks_inputparams::ExampleL |
|
855 |
// Example test method function. |
|
856 |
// (other items were commented in a header). |
|
857 |
// ----------------------------------------------------------------------------- |
|
858 |
// |
|
859 |
TInt Clandmarks_inputparams::ImportL( CStifItemParser& aItem ) |
|
860 |
{ |
|
861 |
||
862 |
// Print to UI |
|
863 |
_LIT( Klandmarks_inputparams, "landmarks_inputparams" ); |
|
864 |
_LIT( KExample, "In Example" ); |
|
865 |
TestModuleIf().Printf( 0, Klandmarks_inputparams, KExample ); |
|
866 |
// Print to log file |
|
867 |
iLog->Log( KExample ); |
|
868 |
||
869 |
TInt i = 0; |
|
870 |
TPtrC string; |
|
871 |
_LIT( KParam, "Param[%i]: %S" ); |
|
872 |
while ( aItem.GetNextString ( string ) == KErrNone ) |
|
873 |
{ |
|
874 |
TestModuleIf().Printf( i, Klandmarks_inputparams, |
|
875 |
KParam, i, &string ); |
|
876 |
i++; |
|
877 |
} |
|
878 |
||
879 |
//__UHEAP_MARK; |
|
880 |
InitL(); |
|
881 |
CLiwGenericParamList& inList = iServiceHandler->InParamListL(); |
|
882 |
CLiwGenericParamList& outList = iServiceHandler->OutParamListL(); |
|
883 |
inList.Reset(); |
|
884 |
outList.Reset(); |
|
885 |
////__UHEAP_MARK; |
|
886 |
//Type mandatory |
|
887 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(_L("Landmark")))); |
|
888 |
||
889 |
//Data mandatory |
|
890 |
CLiwDefaultMap* data = CLiwDefaultMap::NewL(); |
|
891 |
CleanupStack::PushL(data); |
|
892 |
||
893 |
data->InsertL(_L8("DatabaseURI"),TLiwVariant(_L("c:eposlm.ldb"))); |
|
894 |
data->InsertL(_L8("SourceFile"),TLiwVariant(_L("c:\\file.lmx"))); |
|
895 |
data->InsertL(_L8("MimeType"),TLiwVariant(_L("application/vnd.nokia.landmarkcollection+xml"))); |
|
896 |
||
897 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(data))); |
|
898 |
||
899 |
iLandmarkIf->ExecuteCmdL(_L8("Import"),inList,outList,0,0); |
|
900 |
||
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
901 |
CleanupStack::Pop(data); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
902 |
data->DecRef(); |
5 | 903 |
|
904 |
||
905 |
TInt index = 0; |
|
906 |
const TLiwGenericParam* outParam = outList.FindFirst(index,_L8("ErrorCode")); |
|
907 |
||
908 |
if( outParam ) |
|
909 |
{ |
|
910 |
index = outParam->Value().AsTInt32(); |
|
911 |
} |
|
912 |
inList.Reset(); |
|
913 |
outList.Reset(); |
|
914 |
Delete(); |
|
915 |
//__UHEAP_MARKEND; |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
916 |
if( index == 1012 ) |
5 | 917 |
{ |
918 |
index = 0; |
|
919 |
} |
|
920 |
return index; |
|
921 |
||
922 |
||
923 |
} |
|
924 |
||
925 |
// ----------------------------------------------------------------------------- |
|
926 |
// Clandmarks_inputparams::ExampleL |
|
927 |
// Example test method function. |
|
928 |
// (other items were commented in a header). |
|
929 |
// ----------------------------------------------------------------------------- |
|
930 |
// |
|
931 |
TInt Clandmarks_inputparams::ExportL( CStifItemParser& aItem ) |
|
932 |
{ |
|
933 |
||
934 |
// Print to UI |
|
935 |
_LIT( Klandmarks_inputparams, "landmarks_inputparams" ); |
|
936 |
_LIT( KExample, "In Example" ); |
|
937 |
TestModuleIf().Printf( 0, Klandmarks_inputparams, KExample ); |
|
938 |
// Print to log file |
|
939 |
iLog->Log( KExample ); |
|
940 |
||
941 |
TInt i = 0; |
|
942 |
TPtrC string; |
|
943 |
_LIT( KParam, "Param[%i]: %S" ); |
|
944 |
while ( aItem.GetNextString ( string ) == KErrNone ) |
|
945 |
{ |
|
946 |
TestModuleIf().Printf( i, Klandmarks_inputparams, |
|
947 |
KParam, i, &string ); |
|
948 |
i++; |
|
949 |
} |
|
950 |
||
951 |
//__UHEAP_MARK; |
|
952 |
InitL(); |
|
953 |
CLiwGenericParamList& inList = iServiceHandler->InParamListL(); |
|
954 |
CLiwGenericParamList& outList = iServiceHandler->OutParamListL(); |
|
955 |
inList.Reset(); |
|
956 |
outList.Reset(); |
|
957 |
////__UHEAP_MARK; |
|
958 |
//Type mandatory |
|
959 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(_L("Landmark")))); |
|
960 |
||
961 |
//Data mandatory |
|
962 |
CLiwDefaultMap* data = CLiwDefaultMap::NewL(); |
|
963 |
CleanupStack::PushL(data); |
|
964 |
||
965 |
data->InsertL(_L8("DatabaseURI"),TLiwVariant(_L("c:eposlm.ldb"))); |
|
966 |
TBuf<256> fileName; |
|
967 |
fileName.Copy(_L("Lm")); |
|
968 |
TInt32 append = User::NTickCount(); |
|
969 |
fileName.AppendNum(append); |
|
970 |
data->InsertL(_L8("DestinationFile"),TLiwVariant(fileName)); |
|
971 |
||
972 |
CLiwDefaultList* list = CLiwDefaultList::NewL(); |
|
973 |
CleanupStack::PushL(list); |
|
974 |
list->AppendL(TLiwVariant(_L("0"))); |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
975 |
data->InsertL(_L8("IdList"),TLiwVariant(list)); |
5 | 976 |
|
977 |
data->InsertL(_L8("MimeType"),TLiwVariant(_L("application/vnd.nokia.landmarkcollection+xml"))); |
|
978 |
||
979 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(data))); |
|
980 |
||
981 |
iLandmarkIf->ExecuteCmdL(_L8("Export"),inList,outList,0,0); |
|
982 |
||
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
983 |
CleanupStack::Pop(list); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
984 |
list->DecRef(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
985 |
CleanupStack::Pop(data); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
986 |
data->DecRef(); |
5 | 987 |
|
988 |
||
989 |
TInt index = 0; |
|
990 |
const TLiwGenericParam* outParam = outList.FindFirst(index,_L8("ErrorCode")); |
|
991 |
||
992 |
if( outParam ) |
|
993 |
{ |
|
994 |
index = outParam->Value().AsTInt32(); |
|
995 |
} |
|
996 |
inList.Reset(); |
|
997 |
outList.Reset(); |
|
998 |
Delete(); |
|
999 |
//__UHEAP_MARKEND; |
|
1000 |
if( index == 1012 ) |
|
1001 |
{ |
|
1002 |
index = 0; |
|
1003 |
} |
|
1004 |
return index; |
|
1005 |
||
1006 |
} |
|
1007 |
||
1008 |
// ----------------------------------------------------------------------------- |
|
1009 |
// Clandmarks_inputparams::ExampleL |
|
1010 |
// Example test method function. |
|
1011 |
// (other items were commented in a header). |
|
1012 |
// ----------------------------------------------------------------------------- |
|
1013 |
// |
|
1014 |
TInt Clandmarks_inputparams::OrganiseL( CStifItemParser& aItem ) |
|
1015 |
{ |
|
1016 |
||
1017 |
// Print to UI |
|
1018 |
_LIT( Klandmarks_inputparams, "landmarks_inputparams" ); |
|
1019 |
_LIT( KExample, "In Example" ); |
|
1020 |
TestModuleIf().Printf( 0, Klandmarks_inputparams, KExample ); |
|
1021 |
// Print to log file |
|
1022 |
iLog->Log( KExample ); |
|
1023 |
||
1024 |
TInt i = 0; |
|
1025 |
TPtrC string; |
|
1026 |
_LIT( KParam, "Param[%i]: %S" ); |
|
1027 |
while ( aItem.GetNextString ( string ) == KErrNone ) |
|
1028 |
{ |
|
1029 |
TestModuleIf().Printf( i, Klandmarks_inputparams, |
|
1030 |
KParam, i, &string ); |
|
1031 |
i++; |
|
1032 |
} |
|
1033 |
//__UHEAP_MARK; |
|
1034 |
InitL(); |
|
1035 |
CLiwGenericParamList& inList = iServiceHandler->InParamListL(); |
|
1036 |
CLiwGenericParamList& outList = iServiceHandler->OutParamListL(); |
|
1037 |
inList.Reset(); |
|
1038 |
outList.Reset(); |
|
1039 |
////__UHEAP_MARK; |
|
1040 |
//Type mandatory |
|
1041 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(_L("Landmark")))); |
|
1042 |
||
1043 |
//Data mandatory |
|
1044 |
CLiwDefaultMap* data = CLiwDefaultMap::NewL(); |
|
1045 |
CleanupStack::PushL(data); |
|
1046 |
||
1047 |
data->InsertL(_L8("DatabaseURI"),TLiwVariant(_L("c:eposlm.ldb"))); |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1048 |
data->InsertL(_L8("id"),TLiwVariant(_L("0"))); |
5 | 1049 |
|
1050 |
CLiwDefaultList* list = CLiwDefaultList::NewL(); |
|
1051 |
CleanupStack::PushL(list); |
|
1052 |
list->AppendL(TLiwVariant(_L("0"))); |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1053 |
data->InsertL(_L8("IdList"),TLiwVariant(list)); |
5 | 1054 |
|
1055 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(data))); |
|
1056 |
||
1057 |
//OperationType mandatory |
|
1058 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(_L("Associate")))); |
|
1059 |
||
1060 |
iLandmarkIf->ExecuteCmdL(_L8("Organise"),inList,outList,0,0); |
|
1061 |
||
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1062 |
CleanupStack::Pop(list); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1063 |
list->DecRef(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1064 |
CleanupStack::Pop(data); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1065 |
data->DecRef(); |
5 | 1066 |
|
1067 |
||
1068 |
TInt index = 0; |
|
1069 |
const TLiwGenericParam* outParam = outList.FindFirst(index,_L8("ErrorCode")); |
|
1070 |
||
1071 |
if( outParam ) |
|
1072 |
{ |
|
1073 |
index = outParam->Value().AsTInt32(); |
|
1074 |
} |
|
1075 |
inList.Reset(); |
|
1076 |
outList.Reset(); |
|
1077 |
Delete(); |
|
1078 |
//__UHEAP_MARKEND; |
|
1079 |
if( index == 1012 ) |
|
1080 |
{ |
|
1081 |
index = 0; |
|
1082 |
} |
|
1083 |
return index; |
|
1084 |
||
1085 |
} |
|
1086 |
||
1087 |
// ----------------------------------------------------------------------------- |
|
1088 |
// Clandmarks_inputparams::ExampleL |
|
1089 |
// Example test method function. |
|
1090 |
// (other items were commented in a header). |
|
1091 |
// ----------------------------------------------------------------------------- |
|
1092 |
// |
|
1093 |
TInt Clandmarks_inputparams::CancelL( CStifItemParser& aItem ) |
|
1094 |
{ |
|
1095 |
||
1096 |
// Print to UI |
|
1097 |
_LIT( Klandmarks_inputparams, "landmarks_inputparams" ); |
|
1098 |
_LIT( KExample, "In Example" ); |
|
1099 |
TestModuleIf().Printf( 0, Klandmarks_inputparams, KExample ); |
|
1100 |
// Print to log file |
|
1101 |
iLog->Log( KExample ); |
|
1102 |
||
1103 |
TInt i = 0; |
|
1104 |
TPtrC string; |
|
1105 |
_LIT( KParam, "Param[%i]: %S" ); |
|
1106 |
while ( aItem.GetNextString ( string ) == KErrNone ) |
|
1107 |
{ |
|
1108 |
TestModuleIf().Printf( i, Klandmarks_inputparams, |
|
1109 |
KParam, i, &string ); |
|
1110 |
i++; |
|
1111 |
} |
|
1112 |
//__UHEAP_MARK; |
|
1113 |
InitL(); |
|
1114 |
CLiwGenericParamList& inList = iServiceHandler->InParamListL(); |
|
1115 |
CLiwGenericParamList& outList = iServiceHandler->OutParamListL(); |
|
1116 |
inList.Reset(); |
|
1117 |
outList.Reset(); |
|
1118 |
////__UHEAP_MARK; |
|
1119 |
//Type mandatory |
|
1120 |
inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant((TInt32)0))); |
|
1121 |
||
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1122 |
iLandmarkIf->ExecuteCmdL(_L8("Cancel"),inList,outList,KLiwOptCancel,0); |
5 | 1123 |
|
1124 |
||
1125 |
TInt index = 0; |
|
1126 |
const TLiwGenericParam* outParam = outList.FindFirst(index,_L8("ErrorCode")); |
|
1127 |
||
1128 |
if( outParam ) |
|
1129 |
{ |
|
1130 |
index = outParam->Value().AsTInt32(); |
|
1131 |
} |
|
1132 |
inList.Reset(); |
|
1133 |
outList.Reset(); |
|
1134 |
Delete(); |
|
1135 |
//__UHEAP_MARKEND; |
|
1136 |
return index; |
|
1137 |
||
1138 |
} |
|
1139 |
||
1140 |
void OperationsL(CLiwMap* map) |
|
1141 |
{ |
|
1142 |
TLiwVariant var; |
|
1143 |
map->FindL(KNullDesC8,var); |
|
1144 |
//User::Leave(0); |
|
1145 |
var.Reset(); |
|
1146 |
} |
|
1147 |
||
1148 |
// ----------------------------------------------------------------------------- |
|
1149 |
// Clandmarks_inputparams::ExampleL |
|
1150 |
// Example test method function. |
|
1151 |
// (other items were commented in a header). |
|
1152 |
// ----------------------------------------------------------------------------- |
|
1153 |
// |
|
1154 |
TInt Clandmarks_inputparams::LiwL( CStifItemParser& aItem ) |
|
1155 |
{ |
|
1156 |
||
1157 |
// Print to UI |
|
1158 |
_LIT( Klandmarks_inputparams, "landmarks_inputparams" ); |
|
1159 |
_LIT( KExample, "In Example" ); |
|
1160 |
TestModuleIf().Printf( 0, Klandmarks_inputparams, KExample ); |
|
1161 |
// Print to log file |
|
1162 |
iLog->Log( KExample ); |
|
1163 |
||
1164 |
TInt i = 0; |
|
1165 |
TPtrC string; |
|
1166 |
_LIT( KParam, "Param[%i]: %S" ); |
|
1167 |
while ( aItem.GetNextString ( string ) == KErrNone ) |
|
1168 |
{ |
|
1169 |
TestModuleIf().Printf( i, Klandmarks_inputparams, |
|
1170 |
KParam, i, &string ); |
|
1171 |
i++; |
|
1172 |
} |
|
1173 |
//__UHEAP_MARK; |
|
1174 |
_LIT(KName,"Name"); |
|
1175 |
TLiwVariant variant(KName()); |
|
1176 |
CLiwGenericParamList* param = CLiwGenericParamList::NewLC(); |
|
1177 |
CLiwMap* map = CLiwDefaultMap::NewL(); |
|
1178 |
CleanupStack::PushL(map); |
|
1179 |
map->InsertL(KNullDesC8,variant); |
|
1180 |
TRAP_IGNORE(OperationsL(map)); |
|
1181 |
param->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(map))); |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1182 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1183 |
CleanupStack::Pop(map); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1184 |
map->DecRef(); |
5 | 1185 |
TLiwGenericParam outParam; |
1186 |
param->AtL(0,outParam); |
|
1187 |
const CLiwMap* outMap = outParam.Value().AsMap(); |
|
1188 |
CleanupStack::PopAndDestroy(param); |
|
1189 |
//__UHEAP_MARKEND; |
|
1190 |
return KErrNone; |
|
1191 |
} |
|
1192 |
||
1193 |
TInt Clandmarks_inputparams::CheckAscending(TType aType, CLiwIterable* aIter) |
|
1194 |
{ |
|
1195 |
HBufC* curr = NULL; |
|
1196 |
HBufC* prev = NULL; |
|
1197 |
TLiwVariant var; |
|
1198 |
while( aIter->NextL(var) ) |
|
1199 |
{ |
|
1200 |
const CLiwMap* map = var.AsMap(); |
|
1201 |
TLiwVariant variant; |
|
1202 |
if( map->FindL(_L8("LandmarkName"),variant ) ) |
|
1203 |
{ |
|
1204 |
curr = variant.AsDes().AllocL(); |
|
1205 |
||
1206 |
} |
|
1207 |
||
1208 |
if( prev ) |
|
1209 |
{ |
|
1210 |
TInt32 val = curr->Compare(*prev); |
|
1211 |
if( val < 0 ) |
|
1212 |
{ |
|
1213 |
delete curr; |
|
1214 |
delete prev; |
|
1215 |
return KErrGeneral; |
|
1216 |
} |
|
1217 |
delete prev; |
|
1218 |
} |
|
1219 |
prev = curr; |
|
1220 |
variant.Reset(); |
|
1221 |
var.Reset(); |
|
1222 |
} |
|
44
0b68a1b0c15e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
38
diff
changeset
|
1223 |
|
5 | 1224 |
} |
1225 |
||
1226 |
TInt Clandmarks_inputparams::CheckDescending(TType aType, CLiwIterable* aIter) |
|
1227 |
{ |
|
1228 |
HBufC* curr = NULL; |
|
1229 |
HBufC* prev = NULL; |
|
1230 |
TLiwVariant var; |
|
1231 |
while( aIter->NextL(var) ) |
|
1232 |
{ |
|
1233 |
const CLiwMap* map = var.AsMap(); |
|
1234 |
TLiwVariant variant; |
|
1235 |
if( map->FindL(_L8("LandmarkName"),variant ) ) |
|
1236 |
{ |
|
1237 |
curr = variant.AsDes().AllocL(); |
|
1238 |
||
1239 |
} |
|
1240 |
||
1241 |
if( prev ) |
|
1242 |
{ |
|
1243 |
TInt32 val = curr->Compare(*prev); |
|
1244 |
if( val > 0 ) |
|
1245 |
{ |
|
1246 |
delete curr; |
|
1247 |
delete prev; |
|
1248 |
return KErrGeneral; |
|
1249 |
} |
|
1250 |
delete prev; |
|
1251 |
} |
|
1252 |
prev = curr; |
|
1253 |
variant.Reset(); |
|
1254 |
var.Reset(); |
|
1255 |
} |
|
44
0b68a1b0c15e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
38
diff
changeset
|
1256 |
|
5 | 1257 |
} |
1258 |
// ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
1259 |
// None |
|
1260 |
||
1261 |
// [End of File] - Do not remove |