author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 24 Nov 2009 08:56:33 +0200 | |
changeset 33 | 50974a8b132e |
parent 19 | 989d2f495d90 |
permissions | -rw-r--r-- |
19 | 1 |
/* |
2 |
* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: ?Description |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
||
21 |
// INCLUDE FILES |
|
22 |
#include <e32svr.h> |
|
23 |
#include <StifParser.h> |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
24 |
#include <StifTestInterface.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
25 |
#include <liwservicehandler.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
26 |
#include <liwbufferextension.h> |
19 | 27 |
|
28 |
||
29 |
#include "tprovidertest.h" |
|
30 |
#include "txmlconvertor.h" |
|
31 |
||
32 |
#include <f32file.h> |
|
33 |
#include <e32des16.h> |
|
34 |
#include <e32base.h> |
|
35 |
||
36 |
#include "tprovidertestobserver.h" |
|
37 |
#include "txmlconvertor.h" |
|
38 |
_LIT8(KErrorCode,"ErrorCode"); |
|
39 |
||
40 |
void CProviderTest::Delete() |
|
41 |
{ |
|
42 |
||
43 |
} |
|
44 |
||
45 |
// ----------------------------------------------------------------------------- |
|
46 |
// Csapi_getheader:RunMethodL |
|
47 |
// Run specified method. Contains also table of test mothods and their names. |
|
48 |
// ----------------------------------------------------------------------------- |
|
49 |
// |
|
50 |
TInt CProviderTest::RunMethodL( |
|
51 |
CStifItemParser& aItem ) |
|
52 |
{ |
|
53 |
||
54 |
static TStifFunctionInfo const KFunctions[] = |
|
55 |
{ |
|
56 |
||
57 |
ENTRY( "CheckInputArgumentType", CProviderTest::CheckInputArgumentType ), |
|
58 |
ENTRY( "TestInvalidInterface", CProviderTest::TestInvalidInterface ), |
|
59 |
||
60 |
}; |
|
61 |
||
62 |
const TInt count = sizeof( KFunctions ) / |
|
63 |
sizeof( TStifFunctionInfo ); |
|
64 |
||
65 |
return RunInternalL( KFunctions, count, aItem ); |
|
66 |
||
67 |
} |
|
68 |
||
69 |
||
70 |
||
71 |
||
72 |
// ----------------------------------------------------------------------------- |
|
73 |
// CAppManagerTest:CheckInputArgumentType |
|
74 |
// |
|
75 |
// ----------------------------------------------------------------------------- |
|
76 |
// |
|
77 |
TInt CProviderTest::CheckInputArgumentType( CStifItemParser& aItem ) |
|
78 |
{ |
|
79 |
__UHEAP_MARK; |
|
80 |
TPtrC16 serice16; |
|
81 |
TPtrC16 Interface16; |
|
82 |
TPtrC16 command16; |
|
83 |
TInt servicecmdpptions; |
|
84 |
TPtrC16 callback; |
|
85 |
TPtrC16 nextcmd; |
|
86 |
||
87 |
TInt expected; |
|
88 |
TInt err; |
|
89 |
CProviderObserver* callbackobj = NULL; |
|
90 |
||
91 |
TInt result =KErrNone ;// KErrGeneral; // 0 means pass and -1 means Fail |
|
92 |
||
93 |
||
94 |
aItem.GetNextString(serice16); |
|
95 |
aItem.GetNextString(Interface16); |
|
96 |
||
97 |
||
98 |
/*-------------------------------------------------------------------------------------------*/ |
|
99 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
100 |
CleanupStack::PushL(iServiceHandler);//1 |
|
101 |
||
102 |
//Take the Interface name and provider from cfg file |
|
103 |
TBuf8<30> interface8; |
|
104 |
TBuf8<30> service8; |
|
105 |
interface8.Copy(Interface16); |
|
106 |
service8.Copy(serice16); |
|
107 |
||
108 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1,interface8,service8); |
|
109 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
110 |
CleanupStack::PushL(crit);//2 |
|
111 |
||
112 |
||
113 |
RCriteriaArray critArray; |
|
114 |
critArray.AppendL(crit); |
|
115 |
CleanupClosePushL(critArray);//3 |
|
116 |
||
117 |
iServiceHandler->AttachL(critArray); |
|
118 |
||
119 |
CLiwGenericParamList* output = CLiwGenericParamList::NewL(); |
|
120 |
CleanupStack::PushL(output);//4 |
|
121 |
CLiwGenericParamList* input = CLiwGenericParamList::NewL(); |
|
122 |
CleanupStack::PushL(input);//5 |
|
123 |
||
124 |
iServiceHandler->ExecuteServiceCmdL(*crit, *input, *output); |
|
125 |
||
126 |
// Create the Instance of SAPI class and the Input Param and output Param |
|
127 |
TInt pos = 0; |
|
128 |
MLiwInterface* Interface = NULL; |
|
129 |
output->FindFirst(pos,interface8 ); |
|
130 |
if(pos != KErrNotFound) |
|
131 |
{ |
|
132 |
Interface = (*output)[pos].Value().AsInterface(); |
|
133 |
} |
|
134 |
output->Reset(); |
|
135 |
||
136 |
CleanupClosePushL(*Interface);//6 |
|
137 |
input->Reset(); |
|
138 |
do |
|
139 |
{ |
|
140 |
aItem.GetNextString(command16); |
|
141 |
aItem.GetNextInt(servicecmdpptions); |
|
142 |
aItem.GetNextString(callback); |
|
143 |
||
144 |
||
145 |
if (FillInputParmaeterList( aItem, input) == KErrNone ) |
|
146 |
{ |
|
147 |
||
148 |
||
149 |
//Call Service |
|
150 |
PrintInputParameterList(input); |
|
151 |
TBuf8<30> command8; |
|
152 |
command8.Copy(command16); |
|
153 |
||
154 |
if(callback.CompareF(_L("NULL"))==0) |
|
155 |
{ |
|
156 |
//without call back |
|
157 |
Interface->ExecuteCmdL(command8,*input,*output,servicecmdpptions, NULL); |
|
158 |
||
159 |
} |
|
160 |
else |
|
161 |
||
162 |
{ |
|
163 |
//need to change the observer |
|
164 |
callbackobj = CProviderObserver::NewL(); |
|
165 |
//CleanupStack::PushL( callbackobj); |
|
166 |
Interface->ExecuteCmdL(command8,*input,*output,servicecmdpptions, callbackobj); |
|
167 |
//CleanupStack::PopAndDestroy( ); |
|
168 |
} |
|
169 |
||
170 |
aItem.GetNextInt(expected); |
|
171 |
const TLiwGenericParam* p= NULL; |
|
172 |
p = output->FindFirst(pos, KErrorCode); // Finding Error Code |
|
173 |
if(p) |
|
174 |
{ |
|
175 |
err = p->Value().AsTInt32(); |
|
176 |
||
177 |
if(err == 0 ) |
|
178 |
{ |
|
179 |
// Requested Accepted by the provider |
|
180 |
if( (callback != NULL) && (KLiwOptASyncronous == servicecmdpptions) ) |
|
181 |
{ |
|
182 |
// need to wait for callback |
|
183 |
CActiveSchedulerWait* wait = new CActiveSchedulerWait(); |
|
184 |
CleanupStack::PushL( wait); |
|
185 |
callbackobj->SetWait( wait ); |
|
186 |
wait->Start(); |
|
187 |
CleanupStack::PopAndDestroy();//Active Wait Scheduler |
|
188 |
} |
|
189 |
||
190 |
} |
|
191 |
||
192 |
input->Reset(); |
|
193 |
output->Reset(); |
|
194 |
||
195 |
if(expected != err) |
|
196 |
{ |
|
197 |
result = KErrGeneral; |
|
198 |
} |
|
199 |
} |
|
200 |
else |
|
201 |
result = KErrNone; |
|
202 |
} |
|
203 |
else |
|
204 |
{ |
|
205 |
//Input Parameter List is not properly entered in Cfg file |
|
206 |
//PrintInputParameterList(input); |
|
207 |
result = KErrGeneral; |
|
208 |
} |
|
209 |
||
210 |
output->Reset(); |
|
211 |
input->Reset(); |
|
212 |
delete callbackobj; |
|
213 |
callbackobj = NULL; |
|
214 |
||
215 |
if( result ) |
|
216 |
{ |
|
217 |
CleanupStack::PopAndDestroy( ); |
|
218 |
CleanupStack::PopAndDestroy( ); |
|
219 |
CleanupStack::PopAndDestroy( ); |
|
220 |
CleanupStack::PopAndDestroy( ); |
|
221 |
CleanupStack::PopAndDestroy( ); |
|
222 |
CleanupStack::PopAndDestroy( ); |
|
223 |
return result; |
|
224 |
} |
|
225 |
||
226 |
||
227 |
||
228 |
aItem.GetNextString(nextcmd); |
|
229 |
||
230 |
}while( nextcmd.CompareF(_L("Done") ) != 0); |
|
231 |
||
232 |
CleanupStack::PopAndDestroy( ); |
|
233 |
CleanupStack::PopAndDestroy( ); |
|
234 |
CleanupStack::PopAndDestroy( ); |
|
235 |
CleanupStack::PopAndDestroy( ); |
|
236 |
CleanupStack::PopAndDestroy( ); |
|
237 |
CleanupStack::PopAndDestroy( ); |
|
238 |
||
239 |
__UHEAP_MARKEND; |
|
240 |
||
241 |
return result; |
|
242 |
} |
|
243 |
||
244 |
||
245 |
||
246 |
||
247 |
||
248 |
||
249 |
TInt CProviderTest::FillInputParmaeterList( CStifItemParser& aItem , CLiwGenericParamList* input ) |
|
250 |
||
251 |
{ |
|
252 |
||
253 |
TInt intValue; |
|
254 |
TPtrC16 value16; |
|
255 |
TBuf8<40> value8; |
|
256 |
TLiwVariant value; |
|
257 |
TLiwGenericParam valueParam; |
|
258 |
TBuf8<40> next8 ; |
|
259 |
TPtrC next16; |
|
260 |
TPtrC16 dataType; |
|
261 |
int flag = 0; |
|
262 |
||
263 |
aItem.GetNextString(next16); |
|
264 |
while( next16.CompareF(_L("Finish"))!= 0) |
|
265 |
{ |
|
266 |
aItem.GetNextString(dataType); |
|
267 |
//Convert variable name into 8 bit key |
|
268 |
next8.Copy(next16); |
|
269 |
||
270 |
if( (next16.CompareF(_L("StartTime") )== 0) || (next16.CompareF(_L("EndTime") )== 0)) |
|
271 |
{ |
|
272 |
flag = 1; |
|
273 |
} |
|
274 |
||
275 |
if(dataType.CompareF(_L("Int") )== 0) |
|
276 |
{ |
|
277 |
//Value should be Integer |
|
278 |
aItem.GetNextInt(intValue); |
|
279 |
value.SetL((TInt32)intValue); |
|
280 |
valueParam.SetNameAndValueL(next8, value); |
|
281 |
input->AppendL(valueParam); |
|
282 |
value.Reset(); |
|
283 |
valueParam.Reset(); |
|
284 |
} |
|
285 |
||
286 |
else if ( dataType.CompareF(_L("String") ) == 0) |
|
287 |
{ |
|
288 |
//Value should be 8 bit |
|
289 |
aItem.GetNextString(value16); |
|
290 |
value8.Copy(value16); |
|
291 |
value.SetL(value8); |
|
292 |
valueParam.SetNameAndValueL(next8, value); |
|
293 |
input->AppendL(valueParam); |
|
294 |
value.Reset(); |
|
295 |
valueParam.Reset(); |
|
296 |
} |
|
297 |
else if ( dataType.CompareF(_L("UnicodeString") ) == 0) |
|
298 |
{ |
|
299 |
//Value should be 16 bit string |
|
300 |
aItem.GetNextString(value16); |
|
301 |
value.SetL(value16); |
|
302 |
valueParam.SetNameAndValueL(next8, value); |
|
303 |
input->AppendL(valueParam); |
|
304 |
value.Reset(); |
|
305 |
valueParam.Reset(); |
|
306 |
} |
|
307 |
else if ( dataType.CompareF(_L("Map")) == 0) |
|
308 |
{ |
|
309 |
//Value should be map |
|
310 |
CLiwDefaultMap *map = CLiwDefaultMap::NewL(); |
|
311 |
value.SetL(map); |
|
312 |
valueParam.SetNameAndValueL(next8, value); |
|
313 |
input->AppendL(valueParam); |
|
314 |
map->DecRef(); |
|
315 |
value.Reset(); |
|
316 |
valueParam.Reset(); |
|
317 |
||
318 |
if( FillMap(aItem,map) !=KErrNone) |
|
319 |
return KErrGeneral; |
|
320 |
||
321 |
} |
|
322 |
else if ( dataType.CompareF(_L("List")) == 0) |
|
323 |
{ |
|
324 |
//Value should be map |
|
325 |
CLiwDefaultList *list = CLiwDefaultList::NewL(); |
|
326 |
value.SetL(list); |
|
327 |
valueParam.SetNameAndValueL(next8, value); |
|
328 |
input->AppendL(valueParam); |
|
329 |
list->DecRef(); |
|
330 |
value.Reset(); |
|
331 |
valueParam.Reset(); |
|
332 |
||
333 |
if( FillList(aItem,list) !=KErrNone) |
|
334 |
return KErrGeneral; |
|
335 |
} |
|
336 |
else |
|
337 |
{ |
|
338 |
return KErrGeneral; |
|
339 |
} |
|
340 |
aItem.GetNextString(next16); |
|
341 |
}//While loop |
|
342 |
||
343 |
||
344 |
return KErrNone; |
|
345 |
||
346 |
} |
|
347 |
||
348 |
||
349 |
||
350 |
||
351 |
||
352 |
TInt CProviderTest::FillMap( CStifItemParser& aItem , CLiwDefaultMap* aMap ) |
|
353 |
||
354 |
{ |
|
355 |
||
356 |
TInt intValue; |
|
357 |
TPtrC16 value16; |
|
358 |
TBuf8<40> value8; |
|
359 |
TLiwVariant value; |
|
360 |
TBuf8<40> next8 ; |
|
361 |
TPtrC next16; |
|
362 |
TPtrC16 dataType; |
|
363 |
int flag = 0; |
|
364 |
||
365 |
aItem.GetNextString(next16); |
|
366 |
while( next16.CompareF(_L("End"))!= 0) |
|
367 |
{ |
|
368 |
aItem.GetNextString(dataType); |
|
369 |
//Convert variable name into 8 bit key |
|
370 |
next8.Copy(next16); |
|
371 |
||
372 |
if( (next16.CompareF(_L("StartTime") )== 0) || (next16.CompareF(_L("EndTime") )== 0) || (next16.CompareF(_L("AlarmTime") )== 0) |
|
373 |
|| (next16.CompareF(_L("StartRange") )== 0) || (next16.CompareF(_L("EndRange") )== 0)) |
|
374 |
flag = 1; |
|
375 |
||
376 |
if(dataType.CompareF(_L("Int") )== 0) |
|
377 |
{ |
|
378 |
//Value should be Integer |
|
379 |
aItem.GetNextInt(intValue); |
|
380 |
value.SetL((TInt32)intValue); |
|
381 |
aMap->InsertL(next8,value); |
|
382 |
value.Reset(); |
|
383 |
} |
|
384 |
||
385 |
else if ( dataType.CompareF(_L("String") ) == 0) |
|
386 |
{ |
|
387 |
//Value should be 8 bit |
|
388 |
aItem.GetNextString(value16); |
|
389 |
value8.Copy(value16); |
|
390 |
value.SetL(value8); |
|
391 |
aMap->InsertL(next8,value); |
|
392 |
value.Reset(); |
|
393 |
} |
|
394 |
else if ( dataType.CompareF(_L("UnicodeString") ) == 0) |
|
395 |
{ |
|
396 |
if( flag == 1) |
|
397 |
{ |
|
398 |
aItem.GetNextString(value16); |
|
399 |
TTime time; |
|
400 |
time.Set(value16); |
|
401 |
value.SetL(time); |
|
402 |
aMap->InsertL(next8,value); |
|
403 |
flag = 0; |
|
404 |
value.Reset(); |
|
405 |
} |
|
406 |
else |
|
407 |
{ |
|
408 |
//Value should be 16 bit string |
|
409 |
aItem.GetNextString(value16); |
|
410 |
value.SetL(value16); |
|
411 |
aMap->InsertL(next8,value); |
|
412 |
value.Reset(); |
|
413 |
} |
|
414 |
} |
|
415 |
else if ( dataType.CompareF(_L("Map")) == 0) |
|
416 |
{ |
|
417 |
//Value should be map |
|
418 |
CLiwDefaultMap *map = CLiwDefaultMap::NewL(); |
|
419 |
value.SetL(map); |
|
420 |
aMap->InsertL(next8,value); |
|
421 |
map->DecRef(); |
|
422 |
value.Reset(); |
|
423 |
||
424 |
if( FillMap(aItem,map) !=KErrNone) |
|
425 |
return KErrGeneral; |
|
426 |
||
427 |
} |
|
428 |
else if ( dataType.CompareF(_L("List")) == 0) |
|
429 |
{ |
|
430 |
//Value should be map |
|
431 |
CLiwDefaultList *list = CLiwDefaultList::NewL(); |
|
432 |
value.SetL(list); |
|
433 |
aMap->InsertL(next8,value); |
|
434 |
list->DecRef(); |
|
435 |
value.Reset(); |
|
436 |
||
437 |
||
438 |
if( FillList(aItem,list) !=KErrNone) |
|
439 |
return KErrGeneral; |
|
440 |
} |
|
441 |
||
442 |
else if ( dataType.CompareF(_L("Bool") ) == 0) |
|
443 |
{ |
|
444 |
//Value should be 8 bit |
|
445 |
aItem.GetNextInt(intValue); |
|
446 |
TBool boolean(intValue); |
|
447 |
value.SetL(boolean); |
|
448 |
aMap->InsertL(next8,value); |
|
449 |
value.Reset(); |
|
450 |
} |
|
451 |
||
452 |
||
453 |
else |
|
454 |
{ |
|
455 |
return KErrGeneral; |
|
456 |
} |
|
457 |
aItem.GetNextString(next16); |
|
458 |
}//While loop |
|
459 |
||
460 |
||
461 |
return KErrNone; |
|
462 |
||
463 |
} |
|
464 |
||
465 |
||
466 |
||
467 |
TInt CProviderTest::FillList( CStifItemParser& aItem , CLiwDefaultList* aList ) |
|
468 |
||
469 |
{ |
|
470 |
||
471 |
TInt intValue; |
|
472 |
TPtrC16 value16; |
|
473 |
TBuf8<40> value8; |
|
474 |
TLiwVariant value; |
|
475 |
TBuf8<40> next8 ; |
|
476 |
TPtrC next16; |
|
477 |
TPtrC16 dataType; |
|
478 |
||
479 |
aItem.GetNextString(dataType); |
|
480 |
while( dataType.CompareF(_L("End"))!= 0) |
|
481 |
{ |
|
482 |
//aItem.GetNextString(dataType); |
|
483 |
||
484 |
if(dataType.CompareF(_L("Int") )== 0) |
|
485 |
{ |
|
486 |
//Value should be Integer |
|
487 |
aItem.GetNextInt(intValue); |
|
488 |
value.SetL((TInt32)intValue); |
|
489 |
aList->AppendL(value); |
|
490 |
value.Reset(); |
|
491 |
} |
|
492 |
||
493 |
else if ( dataType.CompareF(_L("String") ) == 0) |
|
494 |
{ |
|
495 |
//Value should be 8 bit |
|
496 |
aItem.GetNextString(value16); |
|
497 |
value8.Copy(value16); |
|
498 |
value.SetL(value8); |
|
499 |
aList->AppendL(value); |
|
500 |
value.Reset(); |
|
501 |
} |
|
502 |
else if ( dataType.CompareF(_L("UnicodeString") ) == 0) |
|
503 |
{ |
|
504 |
//Value should be 16 bit string |
|
505 |
aItem.GetNextString(value16); |
|
506 |
value.SetL(value16); |
|
507 |
aList->AppendL(value); |
|
508 |
value.Reset(); |
|
509 |
} |
|
510 |
else if ( dataType.CompareF(_L("Map")) == 0) |
|
511 |
{ |
|
512 |
//Value should be map |
|
513 |
CLiwDefaultMap *map = CLiwDefaultMap::NewL(); |
|
514 |
value.SetL(map); |
|
515 |
aList->AppendL(value); |
|
516 |
map->DecRef(); |
|
517 |
value.Reset(); |
|
518 |
||
519 |
if( FillMap(aItem,map) !=KErrNone) |
|
520 |
return KErrGeneral; |
|
521 |
||
522 |
} |
|
523 |
else if ( dataType.CompareF(_L("List")) == 0) |
|
524 |
{ |
|
525 |
//Value should be List |
|
526 |
CLiwDefaultList *list = CLiwDefaultList::NewL(); |
|
527 |
value.SetL(list); |
|
528 |
aList->AppendL(value); |
|
529 |
list->DecRef(); |
|
530 |
value.Reset(); |
|
531 |
||
532 |
if( FillList(aItem,list) !=KErrNone) |
|
533 |
return KErrGeneral; |
|
534 |
||
535 |
} |
|
536 |
else |
|
537 |
{ |
|
538 |
return KErrGeneral; |
|
539 |
} |
|
540 |
aItem.GetNextString(dataType); |
|
541 |
}//While loop |
|
542 |
||
543 |
||
544 |
return KErrNone; |
|
545 |
||
546 |
} |
|
547 |
||
548 |
||
549 |
void CProviderTest::PrintInputParameterList( CLiwGenericParamList* input ) |
|
550 |
{ |
|
551 |
||
552 |
// Show the Input List |
|
553 |
RFs fs; |
|
554 |
RFile file; |
|
555 |
User::LeaveIfError(fs.Connect()); |
|
556 |
||
557 |
CleanupClosePushL(fs);//1 |
|
558 |
TInt errfile=0; |
|
559 |
TEntry entry; |
|
560 |
||
561 |
||
562 |
||
563 |
if( fs.Entry(_L("c:\\Data\\Provider\\"),entry) != KErrNone) |
|
564 |
{ |
|
565 |
TInt ret = fs.MkDir(_L("c:\\Data\\Provider\\")); |
|
566 |
} |
|
567 |
||
568 |
TBuf<100> flname(_L("c:\\Data\\Provider\\InputList.xml")); |
|
569 |
||
570 |
errfile =file.Replace(fs,flname, EFileWrite | EFileStreamText); |
|
571 |
CleanupClosePushL(file);//2 |
|
572 |
||
573 |
||
574 |
/*------------------------------------------------------------------------------*/ |
|
575 |
//Generate Xml file |
|
576 |
TPtrC filebuf; |
|
577 |
||
578 |
||
579 |
CXmlConvertor* convertor = CXmlConvertor::NewL(); |
|
580 |
CleanupStack::PushL(convertor); |
|
581 |
convertor->BuildOutputTreeL(*input,filebuf); |
|
582 |
||
583 |
HBufC8* heapBuffer = HBufC8::NewL(filebuf.Length()); |
|
584 |
TPtr8 filebuf8(heapBuffer->Des()); |
|
585 |
filebuf8.Copy(filebuf); |
|
586 |
||
587 |
file.Write(filebuf8); |
|
588 |
||
589 |
delete heapBuffer; |
|
590 |
CleanupStack::PopAndDestroy(); |
|
591 |
||
592 |
/*------------------------------------------------------------------------------*/ |
|
593 |
||
594 |
||
595 |
CleanupStack::PopAndDestroy();//File 1 |
|
596 |
CleanupStack::PopAndDestroy();//File Session 2 |
|
597 |
} |
|
598 |
||
599 |
_LIT8(KTestService, "Service.Calendar"); |
|
600 |
_LIT8(KTestInvalidInterface, "InvalifInterface"); |
|
601 |
||
602 |
int CProviderTest::TestInvalidInterface( CStifItemParser& /*aItem*/ ) |
|
603 |
{ |
|
604 |
__UHEAP_MARK; |
|
605 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
606 |
||
607 |
CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); |
|
608 |
CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); |
|
609 |
||
610 |
||
611 |
TInt err = KErrNone; |
|
612 |
RCriteriaArray interest; |
|
613 |
CleanupClosePushL(interest); |
|
614 |
||
615 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KTestInvalidInterface,KTestService); |
|
616 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
617 |
CleanupStack::PushL(crit); |
|
618 |
interest.AppendL(crit); |
|
619 |
||
620 |
iServiceHandler->AttachL(interest); |
|
621 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inparam, *outparam); |
|
622 |
||
623 |
TInt pos = 0; |
|
624 |
||
625 |
outparam->FindFirst( pos, KTestInvalidInterface ); |
|
626 |
if(pos != KErrNotFound) |
|
627 |
{ |
|
628 |
err = KErrGeneral; |
|
629 |
} |
|
630 |
CleanupStack::PopAndDestroy(crit); |
|
631 |
CleanupStack::PopAndDestroy(&interest); |
|
632 |
||
633 |
outparam->Reset(); |
|
634 |
inparam->Reset(); |
|
635 |
||
636 |
if(err == 1000) |
|
637 |
err = KErrNone; |
|
638 |
||
639 |
delete iServiceHandler; |
|
640 |
__UHEAP_MARKEND; |
|
641 |
||
642 |
return err; |
|
643 |
} |
|
644 |
||
645 |
||
646 |
||
647 |
||
648 |
//Output parameter processing |
|
649 |
||
650 |
// ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
651 |
// None |
|
652 |
||
653 |
// End of File |