author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 11 May 2010 17:01:36 +0300 | |
branch | RCL_3 |
changeset 58 | ea43c23d28d2 |
parent 33 | 50974a8b132e |
child 65 | 0b68a1b0c15e |
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 |
||
248 |
||
249 |
// call callback of consumer |
|
250 |
if( KErrNone == aError ) |
|
251 |
{ |
|
252 |
HandleNotifyL ( 0, KLiwEventCompleted, *output,*input ); |
|
253 |
} |
|
254 |
else |
|
255 |
{ |
|
256 |
HandleNotifyL ( 0, KLiwEventError, *output,*input ); |
|
257 |
} |
|
258 |
||
259 |
CleanupStack::PopAndDestroy(); |
|
260 |
CleanupStack::PopAndDestroy(); |
|
261 |
||
262 |
||
263 |
||
264 |
} |
|
265 |
||
266 |
||
267 |
||
268 |
||
269 |
||
270 |
||
271 |
// ----------------------------------------------------------------------------- |
|
272 |
// Callback:: HandleNotifyL |
|
273 |
// Call Back Function Called by the Media Management SAPI.in Iteration 2 |
|
274 |
// ----------------------------------------------------------------------------- |
|
275 |
// |
|
276 |
||
277 |
||
278 |
||
279 |
TInt Callback:: HandleNotifyL(TInt aCmdId,TInt aEventId,CLiwGenericParamList& aOutParamList,const CLiwGenericParamList& aInParamList) |
|
280 |
{ |
|
281 |
||
282 |
arg->log->Log(_L("Enter in Handle notify")); |
|
283 |
if ( KLiwEventStarted == aEventId ) |
|
284 |
{ |
|
285 |
// Asynchronous request started |
|
286 |
} |
|
287 |
else if ( KLiwEventCanceled == aEventId ) |
|
288 |
{ |
|
289 |
// Asynchronous event canceled |
|
290 |
arg->returnCode = KErrCancel; |
|
291 |
CActiveScheduler :: Stop() ; |
|
292 |
return 0; |
|
293 |
} |
|
294 |
else |
|
295 |
{ |
|
296 |
||
297 |
TInt32 ErrCode; |
|
298 |
CLiwIterable* iIterable; |
|
299 |
TLiwVariant Map; |
|
300 |
const CLiwMap* MetaData; |
|
301 |
TInt pos = 0; |
|
302 |
//TBuf<200> aValue1[20][20]; // Hemae : very large value for stack |
|
303 |
TInt no_of_maps; |
|
304 |
||
305 |
// Traiverse the List and Fill in the Log Files |
|
306 |
const TLiwGenericParam* p = aOutParamList.FindFirst(pos, KErrorCode); // Finding Error Code |
|
307 |
if(p) |
|
308 |
{ |
|
309 |
ErrCode = p->Value().AsTInt32(); |
|
310 |
//arg->log->Log(_L("Got error Code")); |
|
311 |
} |
|
312 |
else |
|
313 |
{ |
|
314 |
arg->log->Log(_L(" Not able to Find the Error Code ")); |
|
315 |
arg->returnCode = KErrGeneral; |
|
316 |
CActiveScheduler :: Stop() ; |
|
317 |
return 0; |
|
318 |
//User::Exit( KErrGeneral ); |
|
319 |
} |
|
320 |
||
321 |
if(ErrCode < 0 ) // If any error comes in MG SAPI |
|
322 |
{ |
|
323 |
arg->log->Log(_L(" Error Occured in SAPI = %d"),ErrCode); |
|
324 |
arg->returnCode = KErrGeneral; |
|
325 |
CActiveScheduler :: Stop() ; |
|
326 |
return 0; |
|
327 |
//User::Exit( KErrGeneral ); |
|
328 |
} |
|
329 |
||
330 |
p = aOutParamList.FindFirst(pos, KResponse);// Finding out the response of Media Management |
|
331 |
if(!p) |
|
332 |
{ |
|
333 |
arg->log->Log(_L(" Not able to Find the Response ")); |
|
334 |
arg->returnCode = KErrGeneral; |
|
335 |
CActiveScheduler :: Stop() ; |
|
336 |
return 0; |
|
337 |
//User::Exit( KErrGeneral ); |
|
338 |
} |
|
339 |
else |
|
340 |
{ |
|
341 |
//arg->log->Log(_L(" Got the Response ")); |
|
342 |
iIterable = p->Value().AsIterable();// returning Iterator as Response |
|
343 |
TBuf8<30> Key;// Key In The Map |
|
344 |
TPtrC KeyValue;// value of that key |
|
345 |
TLiwVariant val;//just for extracting the value |
|
346 |
//-----------Loop for Iterator -------------------------------// |
|
347 |
TBuf<200> Output; |
|
348 |
int count =0; |
|
349 |
TBuf<30> string; |
|
350 |
TBuf<20> StringTime; |
|
351 |
TInt i; |
|
352 |
TInt value; |
|
353 |
TTime time; |
|
354 |
TPtrC temp; |
|
355 |
while(iIterable->NextL(Map))// Find the next value from Iterator |
|
356 |
{ |
|
357 |
||
358 |
Output.Copy(_L("File")); |
|
359 |
arg->log->Log(Output); |
|
360 |
MetaData = Map.AsMap();// Iterator return the map which contains meta data |
|
361 |
Output.Copy(_L("key")); |
|
362 |
Output.Append(_L(" ")); |
|
363 |
Output.Append(_L("KeyValue")); |
|
364 |
arg->log->Log(Output); |
|
365 |
||
366 |
for(i = 0 ; i <MetaData->Count(); i++ ) |
|
367 |
{ |
|
368 |
||
369 |
MetaData->AtL(i,Key); |
|
370 |
MetaData->FindL(Key, val); |
|
371 |
Output.Copy(Key); |
|
372 |
Output.Append(_L(" ")); |
|
373 |
if(EVariantTypeTInt32==val.TypeId()) |
|
374 |
{ |
|
375 |
value = val.AsTInt32(); |
|
376 |
string.Delete(0,string.Length()); |
|
377 |
string.AppendNum(value); |
|
378 |
//aValue1[count][i] = string; |
|
379 |
Output.Append(string); |
|
380 |
} |
|
381 |
else if(EVariantTypeTTime==val.TypeId()) |
|
382 |
{ |
|
383 |
time = val.AsTTime(); |
|
384 |
//dheeraj clear |
|
385 |
time.FormatL(StringTime, KTimeFormat); |
|
386 |
//aValue1[count][i] = StringTime; |
|
387 |
Output.Append(StringTime); |
|
388 |
// date format : 5/25/2005 12:40" |
|
389 |
} |
|
390 |
else |
|
391 |
{ |
|
392 |
val.Get(KeyValue); |
|
393 |
temp.Set( val.AsDes() ); |
|
394 |
//aValue1[count][i] = temp ; |
|
395 |
Output.Append(KeyValue); |
|
396 |
} |
|
397 |
||
398 |
arg->log->Log(Output); // printing Key Values in log files |
|
399 |
||
400 |
} |
|
401 |
count++; |
|
402 |
} |
|
403 |
||
404 |
/*arg->it->GetNextInt(no_of_maps); |
|
405 |
TPtrC expected_out[no_of_maps][20]; |
|
406 |
switch (arg->meta) |
|
407 |
{ |
|
408 |
case 1: |
|
409 |
TInt row,col; |
|
410 |
for (row=0; row <no_of_maps; row++) |
|
411 |
for (col=0 ;col<8;col++) |
|
412 |
arg->it->GetNextString(expected_out[row][col]); |
|
413 |
for (TInt i=0; i < row ; i++) |
|
414 |
for (TInt j=0; j<col ; j++) |
|
415 |
if (expected_out[i][j].CompareF(aValue1[i][j])!=0) |
|
416 |
User::Exit( KErrArgument ); |
|
417 |
break; |
|
418 |
||
419 |
case 2: ; |
|
420 |
||
421 |
||
422 |
}*/ |
|
423 |
||
424 |
||
425 |
} |
|
426 |
//------Loop for Iterator-----------------------------------------// |
|
427 |
arg->returnCode = KErrNone; |
|
428 |
CActiveScheduler :: Stop() ; |
|
429 |
return KErrNone; |
|
430 |
} |
|
58
ea43c23d28d2
Revision: 201016
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
431 |
return KErrNone; |
19 | 432 |
} |
433 |
||
434 |
// ----------------------------------------------------------------------------- |
|
435 |
// Thread Function For Sending the Asynch request to Media Management SAPI |
|
436 |
// ----------------------------------------------------------------------------- |
|
437 |
// |
|
438 |
||
439 |
TInt ThreadFunction (TAny *a) |
|
440 |
{ |
|
441 |
// Creating the Cleanup stack for this new thread |
|
442 |
CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
443 |
struct ParamPass* arg1 = (ParamPass*) a; |
|
58
ea43c23d28d2
Revision: 201016
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
444 |
TInt errorCode = KErrNone; |
19 | 445 |
TInt error = KErrNone; |
446 |
TRAP(error, errorCode = GetFilesAsynchL(a)); |
|
447 |
delete cleanup; |
|
448 |
if(error == KErrNone) |
|
449 |
{ |
|
450 |
if(errorCode<0) |
|
451 |
{ |
|
452 |
arg1->log->Log(_L(" Error in input ")); |
|
453 |
TBuf<30> string; |
|
454 |
string.AppendNum(errorCode); |
|
455 |
arg1->log->Log(string); |
|
456 |
// Hema : check here if the case is neagative or postive |
|
457 |
// then return proper error code |
|
458 |
return KErrNone; |
|
459 |
||
460 |
} |
|
461 |
else |
|
462 |
{ |
|
463 |
return KErrNone; |
|
464 |
} |
|
465 |
||
466 |
} |
|
467 |
||
468 |
return KErrGeneral; |
|
469 |
} |
|
470 |
||
471 |
||
472 |
||
473 |
||
474 |
TInt GetFilesAsynchL( TAny *a) |
|
475 |
{ |
|
476 |
TPtrC FileType16; |
|
477 |
TPtrC FilterField16; |
|
478 |
TPtrC StartVal; |
|
479 |
TPtrC EndVal; |
|
480 |
TPtrC SortField16; |
|
481 |
TInt order = 0; |
|
482 |
||
483 |
struct ParamPass *arg1 = (ParamPass *)a; |
|
484 |
||
485 |
arg1->log = CStifLogger::NewL( KMediaMgmtLogPath, |
|
486 |
KResultFile, |
|
487 |
CStifLogger::ETxt, |
|
488 |
CStifLogger::EFile, |
|
489 |
ETrue ); |
|
490 |
||
491 |
||
492 |
||
493 |
// Get All the Values From CFG |
|
494 |
if( arg1->it->GetNextString ( FileType16 ) != KErrNone ) |
|
495 |
{ |
|
496 |
arg1->log->Log(_L(" Failed to Get the File Type ") ); |
|
497 |
return KErrGeneral; |
|
498 |
} |
|
499 |
if( arg1->it->GetNextString ( FilterField16 ) != KErrNone ) |
|
500 |
{ |
|
501 |
arg1->log->Log(_L("Failed to Get the Filter Field of File ")) ; |
|
502 |
return KErrGeneral; |
|
503 |
} |
|
504 |
if( arg1->it->GetNextString ( StartVal ) != KErrNone ) |
|
505 |
{ |
|
506 |
arg1->log->Log(_L("Failed to Get the start value of Filter ")) ; |
|
507 |
return KErrGeneral; |
|
508 |
} |
|
509 |
if( arg1->it->GetNextString ( EndVal ) != KErrNone ) |
|
510 |
{ |
|
511 |
arg1->log->Log(_L("Failed to Get the End Value of Filter ")) ; |
|
512 |
return KErrGeneral; |
|
513 |
} |
|
514 |
if( arg1->it->GetNextString ( SortField16 ) != KErrNone ) |
|
515 |
{ |
|
516 |
arg1->log->Log(_L("Failed to Get the Sort Filed ")) ; |
|
517 |
return KErrGeneral; |
|
518 |
} |
|
519 |
||
520 |
if( arg1->it->GetNextInt(order) != KErrNone ) |
|
521 |
{ |
|
522 |
arg1->log->Log(_L("Failed to Get the Sorting Order ")) ; |
|
523 |
return KErrGeneral; |
|
524 |
} |
|
525 |
||
526 |
if (!FileType16.Compare(_L("Image")) || !FileType16.Compare(_L("Sound"))) |
|
527 |
||
528 |
arg1->meta = 1; |
|
529 |
||
530 |
||
531 |
// the below section for giving header to log files |
|
532 |
||
533 |
TBuf<200> TestCase; |
|
534 |
||
535 |
TestCase.Copy(_L("FileType ")); |
|
536 |
TestCase.Append(_L(" ")); |
|
537 |
||
538 |
TestCase.Append(_L("FilterField")); |
|
539 |
TestCase.Append(_L(" ")); |
|
540 |
||
541 |
||
542 |
TestCase.Append(_L("StartVal")); |
|
543 |
TestCase.Append(_L(" ")); |
|
544 |
||
545 |
||
546 |
TestCase.Append(_L("EndVal")); |
|
547 |
TestCase.Append(_L(" ")); |
|
548 |
||
549 |
||
550 |
TestCase.Append(_L("SortField")); |
|
551 |
TestCase.Append(_L(" ")); |
|
552 |
||
553 |
||
554 |
TestCase.Append(_L("order")); |
|
555 |
TestCase.Append(_L(" ")); |
|
556 |
||
557 |
||
558 |
||
559 |
arg1->log->Log(TestCase); |
|
560 |
||
561 |
TestCase.Copy(FileType16); |
|
562 |
TestCase.Append(_L(" ")); |
|
563 |
||
564 |
TestCase.Append(FilterField16); |
|
565 |
TestCase.Append(_L(" ")); |
|
566 |
||
567 |
||
568 |
TestCase.Append(StartVal); |
|
569 |
TestCase.Append(_L(" ")); |
|
570 |
||
571 |
||
572 |
TestCase.Append(EndVal); |
|
573 |
TestCase.Append(_L(" ")); |
|
574 |
||
575 |
||
576 |
TestCase.Append(SortField16); |
|
577 |
TestCase.Append(_L(" ")); |
|
578 |
||
579 |
if( 0 != order) |
|
580 |
TestCase.Append(_L("Descending")); |
|
581 |
else |
|
582 |
TestCase.Append(_L("Ascending")); |
|
583 |
||
584 |
TestCase.Append(_L(" ")); |
|
585 |
||
586 |
arg1->log->Log(TestCase); |
|
587 |
||
588 |
||
589 |
// Convert 16 Bit values into 8 bit as SAPI accept 8 bit Des |
|
590 |
TBuf8<30> FileType ; |
|
591 |
FileType.Copy(FileType16); |
|
592 |
||
593 |
TBuf8<30> FilterField ; |
|
594 |
FilterField.Copy(FilterField16); |
|
595 |
||
596 |
TBuf8<30> SortField ; |
|
597 |
SortField.Copy(SortField16); |
|
598 |
||
599 |
||
600 |
||
601 |
//Create the object of callback |
|
602 |
MMgOperationObserver* aCallBack = new (ELeave) Callback(arg1); |
|
603 |
CleanupStack::PushL(aCallBack); |
|
604 |
||
605 |
// Start Scheduler |
|
606 |
CActiveScheduler *Scheduler = new CActiveScheduler ; |
|
607 |
CActiveScheduler :: Install(Scheduler) ; |
|
608 |
CleanupStack::PushL(Scheduler); |
|
609 |
||
610 |
// Create the Instance of SAPI core class and |
|
611 |
//the Input Param and output Param |
|
612 |
CMgService* CoreObj = CMgService ::NewL() ; |
|
613 |
CleanupStack::PushL(CoreObj); |
|
614 |
||
615 |
//------- New Code Added ---------------------------------------------------// |
|
616 |
TMgServiceRequest reqArgument; |
|
617 |
||
618 |
||
619 |
if( 0 != FileType.CompareF( KMgNull8 ) ) |
|
620 |
reqArgument.iFileType.Set( FileType ); |
|
621 |
||
622 |
||
623 |
if( 0 != FilterField.CompareF( KMgNull8 ) ) |
|
624 |
reqArgument.iFilterField.Set( FilterField ); |
|
625 |
||
626 |
if( 0 != StartVal.CompareF( KMgNull ) ) |
|
627 |
reqArgument.iStartVal.Set( StartVal ); |
|
628 |
||
629 |
if( 0 != EndVal.CompareF( KMgNull ) ) |
|
630 |
reqArgument.iEndVal.Set( EndVal ); |
|
631 |
||
632 |
if( 0 != SortField.CompareF( KMgNull8 ) ) |
|
633 |
reqArgument.iSortField.Set( SortField ); |
|
634 |
||
635 |
if( 0 != order) |
|
636 |
{ |
|
637 |
reqArgument.iOrder.Set( _L8("Descending") ); |
|
638 |
} |
|
639 |
||
640 |
||
641 |
||
642 |
//--------------------------------------------------------------------------// |
|
643 |
||
644 |
||
645 |
||
646 |
||
647 |
TInt retcode = 0; |
|
648 |
||
649 |
// Calling SAPI :-))) |
|
650 |
||
651 |
||
652 |
TRAP( retcode , CoreObj->GetListL(reqArgument ,aCallBack) ); |
|
653 |
||
654 |
||
655 |
if(retcode < 0) |
|
656 |
{ |
|
657 |
||
658 |
||
659 |
CleanupStack::PopAndDestroy();//Remove callback |
|
660 |
CleanupStack::PopAndDestroy();//Remove scheduler |
|
661 |
CleanupStack::PopAndDestroy();//Remove core object |
|
662 |
return retcode; |
|
663 |
||
664 |
} |
|
665 |
||
666 |
CActiveScheduler :: Start() ; |
|
667 |
||
668 |
CleanupStack::PopAndDestroy();//Remove callback |
|
669 |
CleanupStack::PopAndDestroy();//Remove scheduler |
|
670 |
CleanupStack::PopAndDestroy();//Remove core object |
|
671 |
||
672 |
return arg1->returnCode; |
|
673 |
} |
|
674 |