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 |
child 58 | ea43c23d28d2 |
permissions | -rw-r--r-- |
19 | 1 |
/* |
2 |
* Copyright (c) 2002 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> |
19 | 25 |
#include <utf.h> |
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
26 |
#include "mediamgmt.h" |
19 | 27 |
#include "mgitemslist.h" |
28 |
using namespace LIW; |
|
29 |
||
30 |
||
31 |
_LIT8(KResponse,"Response"); |
|
32 |
_LIT8(KErrorCode,"ErrorCode"); |
|
33 |
||
34 |
_LIT8( KMgNull8, "NULL" ); |
|
35 |
_LIT16( KMgNull, "NULL"); |
|
36 |
_LIT(KTimeFormat,"%F%M/%D/%Y/%H:%T"); |
|
37 |
||
38 |
||
39 |
// EXTERNAL DATA STRUCTURES |
|
40 |
//extern ?external_data; |
|
41 |
||
42 |
// EXTERNAL FUNCTION PROTOTYPES |
|
43 |
//extern ?external_function( ?arg_type,?arg_type ); |
|
44 |
||
45 |
// CONSTANTS |
|
46 |
//const ?type ?constant_var = ?constant; |
|
47 |
||
48 |
// MACROS |
|
49 |
//#define ?macro ?macro_def |
|
50 |
||
51 |
// LOCAL CONSTANTS AND MACROS |
|
52 |
//const ?type ?constant_var = ?constant; |
|
53 |
//#define ?macro_name ?macro_def |
|
54 |
||
55 |
// MODULE DATA STRUCTURES |
|
56 |
//enum ?declaration |
|
57 |
//typedef ?declaration |
|
58 |
||
59 |
// LOCAL FUNCTION PROTOTYPES |
|
60 |
//?type ?function_name( ?arg_type, ?arg_type ); |
|
61 |
||
62 |
// FORWARD DECLARATIONS |
|
63 |
//class ?FORWARD_CLASSNAME; |
|
64 |
||
65 |
// ============================= LOCAL FUNCTIONS =============================== |
|
66 |
||
67 |
// ----------------------------------------------------------------------------- |
|
68 |
// ?function_name ?description. |
|
69 |
// ?description |
|
70 |
// Returns: ?value_1: ?description |
|
71 |
// ?value_n: ?description_line1 |
|
72 |
// ?description_line2 |
|
73 |
// ----------------------------------------------------------------------------- |
|
74 |
// |
|
75 |
/* |
|
76 |
?type ?function_name( |
|
77 |
?arg_type arg, // ?description |
|
78 |
?arg_type arg) // ?description |
|
79 |
{ |
|
80 |
||
81 |
?code // ?comment |
|
82 |
||
83 |
// ?comment |
|
84 |
?code |
|
85 |
} |
|
86 |
*/ |
|
87 |
||
88 |
// ============================ MEMBER FUNCTIONS =============================== |
|
89 |
||
90 |
// ----------------------------------------------------------------------------- |
|
91 |
// CMediaMgmt::Delete |
|
92 |
// Delete here all resources allocated and opened from test methods. |
|
93 |
// Called from destructor. |
|
94 |
// ----------------------------------------------------------------------------- |
|
95 |
// |
|
96 |
void CMediaMgmt::Delete() |
|
97 |
{ |
|
98 |
||
99 |
} |
|
100 |
||
101 |
// ----------------------------------------------------------------------------- |
|
102 |
// CMediaMgmt::RunMethodL |
|
103 |
// Run specified method. Contains also table of test mothods and their names. |
|
104 |
// ----------------------------------------------------------------------------- |
|
105 |
// |
|
106 |
TInt CMediaMgmt::RunMethodL( |
|
107 |
CStifItemParser& aItem ) |
|
108 |
{ |
|
109 |
||
110 |
static TStifFunctionInfo const KFunctions[] = |
|
111 |
{ |
|
112 |
// Copy this line for every implemented function. |
|
113 |
// First string is the function name used in TestScripter script file. |
|
114 |
// Second is the actual implementation member function. |
|
115 |
ENTRY( "GetFiles", CMediaMgmt::GetFilesL ), |
|
116 |
ENTRY( "GetFilesInfo", CMediaMgmt::GetFilesInfoL ), |
|
117 |
||
118 |
}; |
|
119 |
||
120 |
const TInt count = sizeof( KFunctions ) / |
|
121 |
sizeof( TStifFunctionInfo ); |
|
122 |
||
123 |
return RunInternalL( KFunctions, count, aItem ); |
|
124 |
||
125 |
} |
|
126 |
||
127 |
// ----------------------------------------------------------------------------- |
|
128 |
// CMediaMgmt::ExampleL |
|
129 |
// Example test method function. |
|
130 |
// (other items were commented in a header). |
|
131 |
// ----------------------------------------------------------------------------- |
|
132 |
// |
|
133 |
TInt CMediaMgmt::GetFilesL( CStifItemParser& aItem ) |
|
134 |
{ |
|
135 |
_LIT( KExample, "In GetFilesL" ); |
|
136 |
iLog->Log( KExample ); |
|
137 |
struct ParamPass* arg1 = new ParamPass(); |
|
138 |
arg1->it = &aItem; // Just stoing into global variables so that it can be used by thread |
|
139 |
arg1->log = iLog; // function |
|
140 |
arg1->CmdId = EMgGetFiles ; // Command For Get Files |
|
141 |
||
142 |
TRequestStatus Status = KRequestPending ; |
|
143 |
RThread FunctionThread ; |
|
144 |
||
145 |
//creating the thread , this thread is reponsible for sending the request to SAPI |
|
146 |
TInt ret = FunctionThread.Create( _L("FunctionThread"), ThreadFunction ,KDefaultStackSize , |
|
147 |
NULL ,( TAny * ) arg1); |
|
148 |
||
149 |
User::LeaveIfError(ret); |
|
150 |
FunctionThread.Logon(Status); |
|
151 |
FunctionThread.Resume() ; |
|
152 |
||
153 |
// Waiting for thread to die in other words we make asynch call to synch call :-)) |
|
154 |
User :: WaitForRequest (Status) ; |
|
155 |
||
156 |
||
157 |
FunctionThread.Close(); |
|
158 |
||
159 |
delete arg1; |
|
160 |
return Status.Int() ; |
|
161 |
} |
|
162 |
||
163 |
||
164 |
// ----------------------------------------------------------------------------- |
|
165 |
// CMediaMgmt::ExampleL |
|
166 |
// Example test method function. |
|
167 |
// (other items were commented in a header). |
|
168 |
// ----------------------------------------------------------------------------- |
|
169 |
// |
|
170 |
TInt CMediaMgmt::GetFilesInfoL( CStifItemParser& aItem ) |
|
171 |
{ |
|
172 |
_LIT( KExample, "In GetFilesInfoL" ); |
|
173 |
iLog->Log( KExample ); |
|
174 |
||
175 |
struct ParamPass* arg1 = new ParamPass(); |
|
176 |
arg1->it = &aItem; // Just stoing into global variables so that it can be used by thread |
|
177 |
arg1->log = iLog; // function |
|
178 |
arg1->CmdId = EMgGetFilesInfo ; // Command For Get Files Info |
|
179 |
||
180 |
TRequestStatus Status = KRequestPending ; |
|
181 |
RThread FunctionThread ; |
|
182 |
||
183 |
//creating the thread , this thread is reponsible for sending the request to SAPI |
|
184 |
TInt ret = FunctionThread.Create( _L("FunctionThread"), ThreadFunction ,KDefaultStackSize , |
|
185 |
NULL ,( TAny * ) arg1); |
|
186 |
||
187 |
User::LeaveIfError(ret); |
|
188 |
FunctionThread.Logon(Status); |
|
189 |
FunctionThread.Resume() ; |
|
190 |
||
191 |
// Waiting for thread to die in other words we make asynch call to synch call :-)) |
|
192 |
User :: WaitForRequest (Status) ; |
|
193 |
||
194 |
FunctionThread.Close(); |
|
195 |
||
196 |
delete arg1; |
|
197 |
return Status.Int() ; |
|
198 |
||
199 |
} |
|
200 |
||
201 |
||
202 |
||
203 |
// ----------------------------------------------------------------------------- |
|
204 |
// Callback:: MgNotify |
|
205 |
// Call Back Function Called by the Media Management SAPIin Iteration 1 |
|
206 |
// ----------------------------------------------------------------------------- |
|
207 |
// |
|
208 |
||
209 |
||
210 |
void Callback::MgNotifyL(TUint /*aTransactionID*/, |
|
211 |
MCLFItemListModel* aListModel, |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
212 |
CClfOperationObserver* aOperationObserver, |
19 | 213 |
TMgOperationEvent& aOperationEvent, |
214 |
const TInt& aError ) |
|
215 |
||
216 |
||
217 |
{ |
|
218 |
||
219 |
CLiwGenericParamList* output = CLiwGenericParamList::NewL(); |
|
220 |
CLiwGenericParamList* input = CLiwGenericParamList::NewL(); |
|
221 |
CleanupStack::PushL(output); |
|
222 |
CleanupStack::PushL(input); |
|
223 |
// Fill the Error code Inside Generic Param List |
|
224 |
TLiwVariant errCode; |
|
225 |
errCode.Set( aError ); |
|
226 |
TLiwGenericParam errTypeParam( KErrorCode, errCode ); |
|
227 |
output->AppendL( errTypeParam ); |
|
228 |
||
229 |
// if not error create the iterator class and put it into output list |
|
230 |
if( KErrNone == aError ) |
|
231 |
{ |
|
232 |
// Fill the Iterator in Generic Paaram List |
|
233 |
TLiwVariant response; |
|
234 |
||
235 |
// Iterator will accept the cmd Id and iListmodel and |
|
236 |
// it will become the owner of iListModel,Ownership of |
|
237 |
// Iterator is transfered to consumer |
|
238 |
||
239 |
CMgItemsList *iterator = CMgItemsList::NewL( aListModel, arg->CmdId ); |
|
240 |
||
241 |
||
242 |
response.Set( iterator ); |
|
243 |
TLiwGenericParam responseTypeParam( KResponse, response ); |
|
244 |
output->AppendL( responseTypeParam ); |
|
245 |
||
246 |
} |
|
247 |
else |
|
248 |
{ |
|
249 |
delete aListModel; |
|
250 |
aListModel = NULL; |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
251 |
delete aOperationObserver; |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
252 |
aOperationObserver = NULL; |
19 | 253 |
} |
254 |
||
255 |
||
256 |
// call callback of consumer |
|
257 |
if( KErrNone == aError ) |
|
258 |
{ |
|
259 |
HandleNotifyL ( 0, KLiwEventCompleted, *output,*input ); |
|
260 |
} |
|
261 |
else |
|
262 |
{ |
|
263 |
HandleNotifyL ( 0, KLiwEventError, *output,*input ); |
|
264 |
} |
|
265 |
||
266 |
CleanupStack::PopAndDestroy(); |
|
267 |
CleanupStack::PopAndDestroy(); |
|
268 |
||
269 |
||
270 |
||
271 |
} |
|
272 |
||
273 |
||
274 |
||
275 |
||
276 |
||
277 |
||
278 |
// ----------------------------------------------------------------------------- |
|
279 |
// Callback:: HandleNotifyL |
|
280 |
// Call Back Function Called by the Media Management SAPI.in Iteration 2 |
|
281 |
// ----------------------------------------------------------------------------- |
|
282 |
// |
|
283 |
||
284 |
||
285 |
||
286 |
TInt Callback:: HandleNotifyL(TInt aCmdId,TInt aEventId,CLiwGenericParamList& aOutParamList,const CLiwGenericParamList& aInParamList) |
|
287 |
{ |
|
288 |
||
289 |
arg->log->Log(_L("Enter in Handle notify")); |
|
290 |
if ( KLiwEventStarted == aEventId ) |
|
291 |
{ |
|
292 |
// Asynchronous request started |
|
293 |
} |
|
294 |
else if ( KLiwEventCanceled == aEventId ) |
|
295 |
{ |
|
296 |
// Asynchronous event canceled |
|
297 |
arg->returnCode = KErrCancel; |
|
298 |
CActiveScheduler :: Stop() ; |
|
299 |
return 0; |
|
300 |
} |
|
301 |
else |
|
302 |
{ |
|
303 |
||
304 |
TInt32 ErrCode; |
|
305 |
CLiwIterable* iIterable; |
|
306 |
TLiwVariant Map; |
|
307 |
const CLiwMap* MetaData; |
|
308 |
TInt pos = 0; |
|
309 |
//TBuf<200> aValue1[20][20]; // Hemae : very large value for stack |
|
310 |
TInt no_of_maps; |
|
311 |
||
312 |
// Traiverse the List and Fill in the Log Files |
|
313 |
const TLiwGenericParam* p = aOutParamList.FindFirst(pos, KErrorCode); // Finding Error Code |
|
314 |
if(p) |
|
315 |
{ |
|
316 |
ErrCode = p->Value().AsTInt32(); |
|
317 |
//arg->log->Log(_L("Got error Code")); |
|
318 |
} |
|
319 |
else |
|
320 |
{ |
|
321 |
arg->log->Log(_L(" Not able to Find the Error Code ")); |
|
322 |
arg->returnCode = KErrGeneral; |
|
323 |
CActiveScheduler :: Stop() ; |
|
324 |
return 0; |
|
325 |
//User::Exit( KErrGeneral ); |
|
326 |
} |
|
327 |
||
328 |
if(ErrCode < 0 ) // If any error comes in MG SAPI |
|
329 |
{ |
|
330 |
arg->log->Log(_L(" Error Occured in SAPI = %d"),ErrCode); |
|
331 |
arg->returnCode = KErrGeneral; |
|
332 |
CActiveScheduler :: Stop() ; |
|
333 |
return 0; |
|
334 |
//User::Exit( KErrGeneral ); |
|
335 |
} |
|
336 |
||
337 |
p = aOutParamList.FindFirst(pos, KResponse);// Finding out the response of Media Management |
|
338 |
if(!p) |
|
339 |
{ |
|
340 |
arg->log->Log(_L(" Not able to Find the Response ")); |
|
341 |
arg->returnCode = KErrGeneral; |
|
342 |
CActiveScheduler :: Stop() ; |
|
343 |
return 0; |
|
344 |
//User::Exit( KErrGeneral ); |
|
345 |
} |
|
346 |
else |
|
347 |
{ |
|
348 |
//arg->log->Log(_L(" Got the Response ")); |
|
349 |
iIterable = p->Value().AsIterable();// returning Iterator as Response |
|
350 |
TBuf8<30> Key;// Key In The Map |
|
351 |
TPtrC KeyValue;// value of that key |
|
352 |
TLiwVariant val;//just for extracting the value |
|
353 |
//-----------Loop for Iterator -------------------------------// |
|
354 |
TBuf<200> Output; |
|
355 |
int count =0; |
|
356 |
TBuf<30> string; |
|
357 |
TBuf<20> StringTime; |
|
358 |
TInt i; |
|
359 |
TInt value; |
|
360 |
TTime time; |
|
361 |
TPtrC temp; |
|
362 |
while(iIterable->NextL(Map))// Find the next value from Iterator |
|
363 |
{ |
|
364 |
||
365 |
Output.Copy(_L("File")); |
|
366 |
arg->log->Log(Output); |
|
367 |
MetaData = Map.AsMap();// Iterator return the map which contains meta data |
|
368 |
Output.Copy(_L("key")); |
|
369 |
Output.Append(_L(" ")); |
|
370 |
Output.Append(_L("KeyValue")); |
|
371 |
arg->log->Log(Output); |
|
372 |
||
373 |
for(i = 0 ; i <MetaData->Count(); i++ ) |
|
374 |
{ |
|
375 |
||
376 |
MetaData->AtL(i,Key); |
|
377 |
MetaData->FindL(Key, val); |
|
378 |
Output.Copy(Key); |
|
379 |
Output.Append(_L(" ")); |
|
380 |
if(EVariantTypeTInt32==val.TypeId()) |
|
381 |
{ |
|
382 |
value = val.AsTInt32(); |
|
383 |
string.Delete(0,string.Length()); |
|
384 |
string.AppendNum(value); |
|
385 |
//aValue1[count][i] = string; |
|
386 |
Output.Append(string); |
|
387 |
} |
|
388 |
else if(EVariantTypeTTime==val.TypeId()) |
|
389 |
{ |
|
390 |
time = val.AsTTime(); |
|
391 |
//dheeraj clear |
|
392 |
time.FormatL(StringTime, KTimeFormat); |
|
393 |
//aValue1[count][i] = StringTime; |
|
394 |
Output.Append(StringTime); |
|
395 |
// date format : 5/25/2005 12:40" |
|
396 |
} |
|
397 |
else |
|
398 |
{ |
|
399 |
val.Get(KeyValue); |
|
400 |
temp.Set( val.AsDes() ); |
|
401 |
//aValue1[count][i] = temp ; |
|
402 |
Output.Append(KeyValue); |
|
403 |
} |
|
404 |
||
405 |
arg->log->Log(Output); // printing Key Values in log files |
|
406 |
||
407 |
} |
|
408 |
count++; |
|
409 |
} |
|
410 |
||
411 |
/*arg->it->GetNextInt(no_of_maps); |
|
412 |
TPtrC expected_out[no_of_maps][20]; |
|
413 |
switch (arg->meta) |
|
414 |
{ |
|
415 |
case 1: |
|
416 |
TInt row,col; |
|
417 |
for (row=0; row <no_of_maps; row++) |
|
418 |
for (col=0 ;col<8;col++) |
|
419 |
arg->it->GetNextString(expected_out[row][col]); |
|
420 |
for (TInt i=0; i < row ; i++) |
|
421 |
for (TInt j=0; j<col ; j++) |
|
422 |
if (expected_out[i][j].CompareF(aValue1[i][j])!=0) |
|
423 |
User::Exit( KErrArgument ); |
|
424 |
break; |
|
425 |
||
426 |
case 2: ; |
|
427 |
||
428 |
||
429 |
}*/ |
|
430 |
||
431 |
||
432 |
} |
|
433 |
//------Loop for Iterator-----------------------------------------// |
|
434 |
arg->returnCode = KErrNone; |
|
435 |
CActiveScheduler :: Stop() ; |
|
436 |
return KErrNone; |
|
437 |
} |
|
438 |
||
439 |
} |
|
440 |
||
441 |
// ----------------------------------------------------------------------------- |
|
442 |
// Thread Function For Sending the Asynch request to Media Management SAPI |
|
443 |
// ----------------------------------------------------------------------------- |
|
444 |
// |
|
445 |
||
446 |
TInt ThreadFunction (TAny *a) |
|
447 |
{ |
|
448 |
// Creating the Cleanup stack for this new thread |
|
449 |
CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
450 |
struct ParamPass* arg1 = (ParamPass*) a; |
|
451 |
TInt errorCode; |
|
452 |
TInt error = KErrNone; |
|
453 |
TRAP(error, errorCode = GetFilesAsynchL(a)); |
|
454 |
delete cleanup; |
|
455 |
if(error == KErrNone) |
|
456 |
{ |
|
457 |
if(errorCode<0) |
|
458 |
{ |
|
459 |
arg1->log->Log(_L(" Error in input ")); |
|
460 |
TBuf<30> string; |
|
461 |
string.AppendNum(errorCode); |
|
462 |
arg1->log->Log(string); |
|
463 |
// Hema : check here if the case is neagative or postive |
|
464 |
// then return proper error code |
|
465 |
return KErrNone; |
|
466 |
||
467 |
} |
|
468 |
else |
|
469 |
{ |
|
470 |
return KErrNone; |
|
471 |
} |
|
472 |
||
473 |
} |
|
474 |
||
475 |
return KErrGeneral; |
|
476 |
} |
|
477 |
||
478 |
||
479 |
||
480 |
||
481 |
TInt GetFilesAsynchL( TAny *a) |
|
482 |
{ |
|
483 |
TPtrC FileType16; |
|
484 |
TPtrC FilterField16; |
|
485 |
TPtrC StartVal; |
|
486 |
TPtrC EndVal; |
|
487 |
TPtrC SortField16; |
|
488 |
TInt order = 0; |
|
489 |
||
490 |
struct ParamPass *arg1 = (ParamPass *)a; |
|
491 |
||
492 |
arg1->log = CStifLogger::NewL( KMediaMgmtLogPath, |
|
493 |
KResultFile, |
|
494 |
CStifLogger::ETxt, |
|
495 |
CStifLogger::EFile, |
|
496 |
ETrue ); |
|
497 |
||
498 |
||
499 |
||
500 |
// Get All the Values From CFG |
|
501 |
if( arg1->it->GetNextString ( FileType16 ) != KErrNone ) |
|
502 |
{ |
|
503 |
arg1->log->Log(_L(" Failed to Get the File Type ") ); |
|
504 |
return KErrGeneral; |
|
505 |
} |
|
506 |
if( arg1->it->GetNextString ( FilterField16 ) != KErrNone ) |
|
507 |
{ |
|
508 |
arg1->log->Log(_L("Failed to Get the Filter Field of File ")) ; |
|
509 |
return KErrGeneral; |
|
510 |
} |
|
511 |
if( arg1->it->GetNextString ( StartVal ) != KErrNone ) |
|
512 |
{ |
|
513 |
arg1->log->Log(_L("Failed to Get the start value of Filter ")) ; |
|
514 |
return KErrGeneral; |
|
515 |
} |
|
516 |
if( arg1->it->GetNextString ( EndVal ) != KErrNone ) |
|
517 |
{ |
|
518 |
arg1->log->Log(_L("Failed to Get the End Value of Filter ")) ; |
|
519 |
return KErrGeneral; |
|
520 |
} |
|
521 |
if( arg1->it->GetNextString ( SortField16 ) != KErrNone ) |
|
522 |
{ |
|
523 |
arg1->log->Log(_L("Failed to Get the Sort Filed ")) ; |
|
524 |
return KErrGeneral; |
|
525 |
} |
|
526 |
||
527 |
if( arg1->it->GetNextInt(order) != KErrNone ) |
|
528 |
{ |
|
529 |
arg1->log->Log(_L("Failed to Get the Sorting Order ")) ; |
|
530 |
return KErrGeneral; |
|
531 |
} |
|
532 |
||
533 |
if (!FileType16.Compare(_L("Image")) || !FileType16.Compare(_L("Sound"))) |
|
534 |
||
535 |
arg1->meta = 1; |
|
536 |
||
537 |
||
538 |
// the below section for giving header to log files |
|
539 |
||
540 |
TBuf<200> TestCase; |
|
541 |
||
542 |
TestCase.Copy(_L("FileType ")); |
|
543 |
TestCase.Append(_L(" ")); |
|
544 |
||
545 |
TestCase.Append(_L("FilterField")); |
|
546 |
TestCase.Append(_L(" ")); |
|
547 |
||
548 |
||
549 |
TestCase.Append(_L("StartVal")); |
|
550 |
TestCase.Append(_L(" ")); |
|
551 |
||
552 |
||
553 |
TestCase.Append(_L("EndVal")); |
|
554 |
TestCase.Append(_L(" ")); |
|
555 |
||
556 |
||
557 |
TestCase.Append(_L("SortField")); |
|
558 |
TestCase.Append(_L(" ")); |
|
559 |
||
560 |
||
561 |
TestCase.Append(_L("order")); |
|
562 |
TestCase.Append(_L(" ")); |
|
563 |
||
564 |
||
565 |
||
566 |
arg1->log->Log(TestCase); |
|
567 |
||
568 |
TestCase.Copy(FileType16); |
|
569 |
TestCase.Append(_L(" ")); |
|
570 |
||
571 |
TestCase.Append(FilterField16); |
|
572 |
TestCase.Append(_L(" ")); |
|
573 |
||
574 |
||
575 |
TestCase.Append(StartVal); |
|
576 |
TestCase.Append(_L(" ")); |
|
577 |
||
578 |
||
579 |
TestCase.Append(EndVal); |
|
580 |
TestCase.Append(_L(" ")); |
|
581 |
||
582 |
||
583 |
TestCase.Append(SortField16); |
|
584 |
TestCase.Append(_L(" ")); |
|
585 |
||
586 |
if( 0 != order) |
|
587 |
TestCase.Append(_L("Descending")); |
|
588 |
else |
|
589 |
TestCase.Append(_L("Ascending")); |
|
590 |
||
591 |
TestCase.Append(_L(" ")); |
|
592 |
||
593 |
arg1->log->Log(TestCase); |
|
594 |
||
595 |
||
596 |
// Convert 16 Bit values into 8 bit as SAPI accept 8 bit Des |
|
597 |
TBuf8<30> FileType ; |
|
598 |
FileType.Copy(FileType16); |
|
599 |
||
600 |
TBuf8<30> FilterField ; |
|
601 |
FilterField.Copy(FilterField16); |
|
602 |
||
603 |
TBuf8<30> SortField ; |
|
604 |
SortField.Copy(SortField16); |
|
605 |
||
606 |
||
607 |
||
608 |
//Create the object of callback |
|
609 |
MMgOperationObserver* aCallBack = new (ELeave) Callback(arg1); |
|
610 |
CleanupStack::PushL(aCallBack); |
|
611 |
||
612 |
// Start Scheduler |
|
613 |
CActiveScheduler *Scheduler = new CActiveScheduler ; |
|
614 |
CActiveScheduler :: Install(Scheduler) ; |
|
615 |
CleanupStack::PushL(Scheduler); |
|
616 |
||
617 |
// Create the Instance of SAPI core class and |
|
618 |
//the Input Param and output Param |
|
619 |
CMgService* CoreObj = CMgService ::NewL() ; |
|
620 |
CleanupStack::PushL(CoreObj); |
|
621 |
||
622 |
//------- New Code Added ---------------------------------------------------// |
|
623 |
TMgServiceRequest reqArgument; |
|
624 |
||
625 |
||
626 |
if( 0 != FileType.CompareF( KMgNull8 ) ) |
|
627 |
reqArgument.iFileType.Set( FileType ); |
|
628 |
||
629 |
||
630 |
if( 0 != FilterField.CompareF( KMgNull8 ) ) |
|
631 |
reqArgument.iFilterField.Set( FilterField ); |
|
632 |
||
633 |
if( 0 != StartVal.CompareF( KMgNull ) ) |
|
634 |
reqArgument.iStartVal.Set( StartVal ); |
|
635 |
||
636 |
if( 0 != EndVal.CompareF( KMgNull ) ) |
|
637 |
reqArgument.iEndVal.Set( EndVal ); |
|
638 |
||
639 |
if( 0 != SortField.CompareF( KMgNull8 ) ) |
|
640 |
reqArgument.iSortField.Set( SortField ); |
|
641 |
||
642 |
if( 0 != order) |
|
643 |
{ |
|
644 |
reqArgument.iOrder.Set( _L8("Descending") ); |
|
645 |
} |
|
646 |
||
647 |
||
648 |
||
649 |
//--------------------------------------------------------------------------// |
|
650 |
||
651 |
||
652 |
||
653 |
||
654 |
TInt retcode = 0; |
|
655 |
||
656 |
// Calling SAPI :-))) |
|
657 |
||
658 |
||
659 |
TRAP( retcode , CoreObj->GetListL(reqArgument ,aCallBack) ); |
|
660 |
||
661 |
||
662 |
if(retcode < 0) |
|
663 |
{ |
|
664 |
||
665 |
||
666 |
CleanupStack::PopAndDestroy();//Remove callback |
|
667 |
CleanupStack::PopAndDestroy();//Remove scheduler |
|
668 |
CleanupStack::PopAndDestroy();//Remove core object |
|
669 |
return retcode; |
|
670 |
||
671 |
} |
|
672 |
||
673 |
CActiveScheduler :: Start() ; |
|
674 |
||
675 |
CleanupStack::PopAndDestroy();//Remove callback |
|
676 |
CleanupStack::PopAndDestroy();//Remove scheduler |
|
677 |
CleanupStack::PopAndDestroy();//Remove core object |
|
678 |
||
679 |
return arg1->returnCode; |
|
680 |
} |
|
681 |