0
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2006 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: Specific class for SIM ATK TSY tests
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
// INCLUDE FILES
|
|
22 |
#include <stifparser.h>
|
|
23 |
#include "simatk.h"
|
|
24 |
#include "saticon.h"
|
|
25 |
#include "saterrors.h"
|
|
26 |
|
|
27 |
#include "commandgetinkey.h"
|
|
28 |
#include "commanddisplaytext.h"
|
|
29 |
#include "commandgetinput.h"
|
|
30 |
#include "commandsendss.h"
|
|
31 |
#include "commandsendsm.h"
|
|
32 |
#include "commandsetupcall.h"
|
|
33 |
#include "commandplaytone.h"
|
|
34 |
#include "commandsetupmenu.h"
|
|
35 |
#include "commandselectitem.h"
|
|
36 |
#include "satcallcontrol.h"
|
|
37 |
#include "satmosmscontrol.h"
|
|
38 |
#include "commandrefresh.h"
|
|
39 |
#include "commandsendussd.h"
|
|
40 |
#include "commandlocalinfo.h"
|
|
41 |
#include "commandsetupeventlist.h"
|
|
42 |
#include "commandsetupidlemodetext.h"
|
|
43 |
#include "commandopenchannel.h"
|
|
44 |
#include "commandsenddata.h"
|
|
45 |
#include "commandlaunchbrowser.h"
|
|
46 |
#include "commandsenddtmf.h"
|
|
47 |
#include "commandlanguagenotification.h"
|
|
48 |
#include "commandclosechannel.h"
|
|
49 |
#include "commandreceivedata.h"
|
|
50 |
#include "commandgetchannelstatus.h"
|
|
51 |
|
|
52 |
|
|
53 |
// CONSTANTS
|
|
54 |
_LIT( KCommandType, "CommandType" );
|
|
55 |
|
|
56 |
// Commands can omit SessionEnd procedure from script by setting this flag to 0
|
|
57 |
_LIT( KSessionEnd, "SessionEnd" );
|
|
58 |
|
|
59 |
|
|
60 |
// -----------------------------------------------------------------------------
|
|
61 |
// CSimAtk::Delete
|
|
62 |
// Delete here all resources allocated and opened from test methods.
|
|
63 |
// Called from destructor.
|
|
64 |
// -----------------------------------------------------------------------------
|
|
65 |
//
|
|
66 |
void CSimAtk::Delete()
|
|
67 |
{
|
|
68 |
iCoreLog->Log( _L( "CSimAtk::Delete" ) );
|
|
69 |
// No implementation required
|
|
70 |
}
|
|
71 |
|
|
72 |
// -----------------------------------------------------------------------------
|
|
73 |
// CSimAtk::RunMethodL
|
|
74 |
// Run specified method. Contains also table of test methods and their names.
|
|
75 |
// -----------------------------------------------------------------------------
|
|
76 |
//
|
|
77 |
TInt CSimAtk::RunMethodL
|
|
78 |
(
|
|
79 |
CStifItemParser& aItem
|
|
80 |
)
|
|
81 |
{
|
|
82 |
iCoreLog->Log( _L( "CSimAtk::RunMethodL" ) );
|
|
83 |
|
|
84 |
// Store parser
|
|
85 |
if ( !iParser )
|
|
86 |
{
|
|
87 |
iParser = &aItem;
|
|
88 |
}
|
|
89 |
|
|
90 |
static TStifFunctionInfo const KFunctions[] =
|
|
91 |
{
|
|
92 |
// Copy this line for every implemented function.
|
|
93 |
// First string is the function name used in TestScripter script file.
|
|
94 |
// Second is the actual implementation member function.
|
|
95 |
|
|
96 |
// Generic
|
|
97 |
ENTRY( "Open", CSimAtk::Open ),
|
|
98 |
ENTRY( "Close", CSimAtk::Close ),
|
|
99 |
ENTRY( "WaitForRequest", CSimAtk::WaitForRequest ),
|
|
100 |
ENTRY( "Delay", CSimAtk::Delay ),
|
|
101 |
// ISC Control
|
|
102 |
ENTRY( "LoadIscTests", CSimAtk::LoadIscTests ),
|
|
103 |
ENTRY( "RunIscTestCase", CSimAtk::RunIscTestCase ),
|
|
104 |
ENTRY( "SyncIscTestCase", CSimAtk::SyncIscTestCase ),
|
|
105 |
ENTRY( "CancelTestCase", CSimAtk::CancelTestCase ),
|
|
106 |
|
|
107 |
ENTRY( "CheckData", CSimAtk::CheckData ),
|
|
108 |
ENTRY( "CheckProactiveCommand", CSimAtk::CheckData ),
|
|
109 |
ENTRY( "CheckIcon", CSimAtk::CheckIcon ),
|
|
110 |
|
|
111 |
ENTRY( "SendResponse", CSimAtk::SendResponse ),
|
|
112 |
ENTRY( "SendEnvelope", CSimAtk::SendResponse ),
|
|
113 |
ENTRY( "SendTerminalResponse", CSimAtk::SendResponse )
|
|
114 |
};
|
|
115 |
|
|
116 |
const TInt count = sizeof( KFunctions ) /
|
|
117 |
sizeof( TStifFunctionInfo );
|
|
118 |
|
|
119 |
return RunInternalL( KFunctions, count, aItem );
|
|
120 |
}
|
|
121 |
|
|
122 |
// -----------------------------------------------------------------------------
|
|
123 |
// CSimAtk::Open
|
|
124 |
// Open method function.
|
|
125 |
// -----------------------------------------------------------------------------
|
|
126 |
//
|
|
127 |
TInt CSimAtk::Open
|
|
128 |
(
|
|
129 |
CStifItemParser& aItem
|
|
130 |
)
|
|
131 |
{
|
|
132 |
iCoreLog->Log( _L( "CSimAtk::Open" ) );
|
|
133 |
|
|
134 |
TInt ret( KErrNotFound );
|
|
135 |
TPtrC string;
|
|
136 |
aItem.GetString ( _L( "Open" ), string );
|
|
137 |
|
|
138 |
if ( _L( "SAT" ) == string )
|
|
139 |
{
|
|
140 |
ret = iSat.Open( iRphone );
|
|
141 |
iCoreLog->Log( _L( "CSimAtk::Open: SAT, return %d" ), ret );
|
|
142 |
}
|
|
143 |
else if ( _L( "IscControl" ) == string )
|
|
144 |
{
|
|
145 |
ret = iRIscTestControl.Connect();
|
|
146 |
iCoreLog->Log( _L( "CSimAtk::Open: IscControl, return %d" ), ret );
|
|
147 |
}
|
|
148 |
else if ( _L( "SmsMessaging" ) == string )
|
|
149 |
{
|
|
150 |
ret = iSmsMessaging.Open( iRphone );
|
|
151 |
iCoreLog->Log( _L( "CSimAtk::Open: SmsMessaging, return %d" ), ret );
|
|
152 |
}
|
|
153 |
else
|
|
154 |
{
|
|
155 |
// If any Open item not found in SimAtk,then checks Core.
|
|
156 |
CSimAtkCore::SetString( string );
|
|
157 |
ret = CSimAtkCore::Open( aItem );
|
|
158 |
}
|
|
159 |
|
|
160 |
return ret;
|
|
161 |
}
|
|
162 |
|
|
163 |
// -----------------------------------------------------------------------------
|
|
164 |
// CSimAtk::Close
|
|
165 |
// Close method function.
|
|
166 |
// -----------------------------------------------------------------------------
|
|
167 |
//
|
|
168 |
TInt CSimAtk::Close
|
|
169 |
(
|
|
170 |
CStifItemParser& aItem
|
|
171 |
)
|
|
172 |
{
|
|
173 |
iCoreLog->Log( _L( "CSimAtk::Close" ) );
|
|
174 |
TInt ret( KErrNotFound );
|
|
175 |
TPtrC string;
|
|
176 |
aItem.GetString ( _L( "Close" ), string );
|
|
177 |
|
|
178 |
if ( _L( "SAT" ) == string)
|
|
179 |
{
|
|
180 |
iSat.Close();
|
|
181 |
ret = KErrNone;
|
|
182 |
}
|
|
183 |
else if ( _L( "IscControl" ) == string)
|
|
184 |
{
|
|
185 |
iRIscTestControl.Close();
|
|
186 |
ret = KErrNone;
|
|
187 |
}
|
|
188 |
else if ( _L( "SmsMessaging" ) == string)
|
|
189 |
{
|
|
190 |
iSmsMessaging.Close();
|
|
191 |
ret = KErrNone;
|
|
192 |
}
|
|
193 |
else
|
|
194 |
{
|
|
195 |
// If any Close item not found in SimAtk, then checks Core.
|
|
196 |
CSimAtkCore::SetString( string );
|
|
197 |
ret = CSimAtkCore::Close( aItem );
|
|
198 |
}
|
|
199 |
|
|
200 |
return ret;
|
|
201 |
}
|
|
202 |
|
|
203 |
// -----------------------------------------------------------------------------
|
|
204 |
// CSimAtk::NotifySimAtkL
|
|
205 |
// Activates the notify
|
|
206 |
// (other items were commented in a header).
|
|
207 |
// -----------------------------------------------------------------------------
|
|
208 |
//
|
|
209 |
TInt CSimAtk::NotifySimAtkL
|
|
210 |
(
|
|
211 |
TRequestStatus& aReqStatus,
|
|
212 |
const TSatIpc& aNotifyIpc
|
|
213 |
)
|
|
214 |
{
|
|
215 |
iCoreLog->Log( _L( "CSimAtk::NotifySimAtk" ) );
|
|
216 |
|
|
217 |
TInt ret( KErrNone );
|
|
218 |
|
|
219 |
CSatBase* command = NULL;
|
|
220 |
|
|
221 |
TPtrC notifyName( MapIpcToString( aNotifyIpc ) );
|
|
222 |
|
|
223 |
TInt index ( 0 );
|
|
224 |
|
|
225 |
// Create test class only if it does not already exist
|
|
226 |
if ( KErrNotFound == FindIndex ( aNotifyIpc, index ) )
|
|
227 |
{
|
|
228 |
switch ( aNotifyIpc )
|
|
229 |
{
|
|
230 |
case ESatNotifyDisplayTextPCmd:
|
|
231 |
{
|
|
232 |
command = new (ELeave) CCommandDisplayText( aNotifyIpc, iSat,
|
|
233 |
*iParser, *iCoreLog );
|
|
234 |
break;
|
|
235 |
}
|
|
236 |
case ESatNotifyGetInkeyPCmd:
|
|
237 |
{
|
|
238 |
command = new (ELeave) CCommandGetInkey( aNotifyIpc, iSat,
|
|
239 |
*iParser, *iCoreLog );
|
|
240 |
break;
|
|
241 |
}
|
|
242 |
case ESatNotifyGetInputPCmd:
|
|
243 |
{
|
|
244 |
command = new (ELeave) CCommandGetInput( aNotifyIpc, iSat,
|
|
245 |
*iParser, *iCoreLog );
|
|
246 |
break;
|
|
247 |
}
|
|
248 |
case ESatNotifyPlayTonePCmd:
|
|
249 |
{
|
|
250 |
command = new (ELeave) CCommandPlayTone( aNotifyIpc, iSat,
|
|
251 |
*iParser, *iCoreLog );
|
|
252 |
break;
|
|
253 |
}
|
|
254 |
case ESatNotifyRefreshPCmd:
|
|
255 |
{
|
|
256 |
command = new (ELeave) CCommandRefresh( aNotifyIpc, iSat,
|
|
257 |
*iParser, *iCoreLog );
|
|
258 |
break;
|
|
259 |
}
|
|
260 |
case ESatNotifyRefreshRequiredParam:
|
|
261 |
{
|
|
262 |
command = new (ELeave) CCommandRefresh( aNotifyIpc, iSat,
|
|
263 |
*iParser, *iCoreLog );
|
|
264 |
break;
|
|
265 |
}
|
|
266 |
case ESatNotifySendSsPCmd:
|
|
267 |
{
|
|
268 |
command = new (ELeave) CCommandSendSs( aNotifyIpc, iSat,
|
|
269 |
*iParser, *iCoreLog );
|
|
270 |
|
|
271 |
// Set Cc pointer
|
|
272 |
CCommandSendUssd* ss
|
|
273 |
= static_cast<CCommandSendUssd*> ( command );
|
|
274 |
ss->SetCallControl( &iCallControl );
|
|
275 |
break;
|
|
276 |
}
|
|
277 |
case ESatNotifySendSmPCmd:
|
|
278 |
{
|
|
279 |
command = new (ELeave) CCommandSendSm( aNotifyIpc, iSat,
|
|
280 |
*iParser, *iCoreLog );
|
|
281 |
break;
|
|
282 |
}
|
|
283 |
case ESatNotifySetUpCallPCmd:
|
|
284 |
{
|
|
285 |
command = new (ELeave) CCommandSetUpCall( aNotifyIpc, iSat,
|
|
286 |
*iParser, *iCoreLog );
|
|
287 |
|
|
288 |
// Set Cc pointer
|
|
289 |
CCommandSendUssd* call
|
|
290 |
= static_cast<CCommandSendUssd*> ( command );
|
|
291 |
call->SetCallControl( &iCallControl );
|
|
292 |
break;
|
|
293 |
}
|
|
294 |
case ESatNotifySetUpMenuPCmd:
|
|
295 |
{
|
|
296 |
command = new (ELeave) CCommandSetUpMenu( aNotifyIpc, iSat,
|
|
297 |
*iParser, *iCoreLog );
|
|
298 |
break;
|
|
299 |
}
|
|
300 |
case ESatNotifySelectItemPCmd:
|
|
301 |
{
|
|
302 |
command = new (ELeave) CCommandSelectItem( aNotifyIpc, iSat,
|
|
303 |
*iParser, *iCoreLog );
|
|
304 |
break;
|
|
305 |
}
|
|
306 |
case ESatNotifySendUssdPCmd:
|
|
307 |
{
|
|
308 |
command = new (ELeave) CCommandSendUssd( aNotifyIpc, iSat,
|
|
309 |
*iParser, *iCoreLog );
|
|
310 |
|
|
311 |
// Set Cc pointer
|
|
312 |
CCommandSendUssd* ussd
|
|
313 |
= static_cast<CCommandSendUssd*> ( command );
|
|
314 |
ussd->SetCallControl( &iCallControl );
|
|
315 |
|
|
316 |
break;
|
|
317 |
}
|
|
318 |
case ESatNotifyLocalInfoPCmd:
|
|
319 |
{
|
|
320 |
command = new (ELeave) CCommandLocalInfo( aNotifyIpc, iSat,
|
|
321 |
*iParser, *iCoreLog );
|
|
322 |
break;
|
|
323 |
}
|
|
324 |
case ESatNotifySetUpEventListPCmd:
|
|
325 |
{
|
|
326 |
command = new (ELeave) CCommandSetUpEventList( aNotifyIpc,
|
|
327 |
iSat, *iParser, *iCoreLog );
|
|
328 |
break;
|
|
329 |
}
|
|
330 |
case ESatNotifySetUpIdleModeTextPCmd:
|
|
331 |
{
|
|
332 |
command = new (ELeave) CCommandSetUpIdleModeText( aNotifyIpc,
|
|
333 |
iSat, *iParser, *iCoreLog );
|
|
334 |
break;
|
|
335 |
}
|
|
336 |
case ESatNotifyOpenChannelPCmd:
|
|
337 |
{
|
|
338 |
command = new (ELeave) CCommandOpenChannel( aNotifyIpc, iSat,
|
|
339 |
*iParser, *iCoreLog );
|
|
340 |
break;
|
|
341 |
}
|
|
342 |
case ESatNotifySendDataPCmd:
|
|
343 |
{
|
|
344 |
command = new (ELeave) CCommandSendData( aNotifyIpc, iSat,
|
|
345 |
*iParser, *iCoreLog );
|
|
346 |
break;
|
|
347 |
}
|
|
348 |
case ESatNotifyLaunchBrowserPCmd:
|
|
349 |
{
|
|
350 |
command = new (ELeave) CCommandLaunchBrowser( aNotifyIpc, iSat,
|
|
351 |
*iParser, *iCoreLog );
|
|
352 |
break;
|
|
353 |
}
|
|
354 |
case ESatNotifySendDtmfPCmd:
|
|
355 |
{
|
|
356 |
command = new (ELeave) CCommandSendDtmf( aNotifyIpc, iSat,
|
|
357 |
*iParser, *iCoreLog );
|
|
358 |
break;
|
|
359 |
}
|
|
360 |
case ESatNotifyLanguageNotificationPCmd:
|
|
361 |
{
|
|
362 |
command = new (ELeave) CCommandLanguageNotification(
|
|
363 |
aNotifyIpc, iSat, *iParser, *iCoreLog );
|
|
364 |
break;
|
|
365 |
}
|
|
366 |
case ESatNotifyCloseChannelPCmd:
|
|
367 |
{
|
|
368 |
command = new (ELeave) CCommandCloseChannel( aNotifyIpc, iSat,
|
|
369 |
*iParser, *iCoreLog );
|
|
370 |
break;
|
|
371 |
}
|
|
372 |
case ESatNotifyReceiveDataPCmd:
|
|
373 |
{
|
|
374 |
command = new (ELeave) CCommandReceiveData( aNotifyIpc, iSat,
|
|
375 |
*iParser, *iCoreLog );
|
|
376 |
break;
|
|
377 |
}
|
|
378 |
case ESatNotifyGetChannelStatusPCmd:
|
|
379 |
{
|
|
380 |
command = new (ELeave) CCommandGetChannelStatus( aNotifyIpc,
|
|
381 |
iSat, *iParser, *iCoreLog );
|
|
382 |
break;
|
|
383 |
}
|
|
384 |
case ESatNotifyCallControlRequest:
|
|
385 |
{
|
|
386 |
command = new (ELeave) CSatCallControl( aNotifyIpc, iSat,
|
|
387 |
*iParser, *iCoreLog );
|
|
388 |
|
|
389 |
// Store pointer for SendSs/Ussd & Setup Call commands
|
|
390 |
iCallControl = command;
|
|
391 |
break;
|
|
392 |
}
|
|
393 |
case ESatNotifyMoSmControlRequest:
|
|
394 |
{
|
|
395 |
command = new (ELeave) CSatMoSmsControl( aNotifyIpc, iSat,
|
|
396 |
*iParser, *iCoreLog );
|
|
397 |
break;
|
|
398 |
}
|
|
399 |
case ESatNotifyProactiveSimSessionEnd:
|
|
400 |
{
|
|
401 |
// None. SimSessionEnd is notified automatically.
|
|
402 |
break;
|
|
403 |
}
|
|
404 |
default:
|
|
405 |
{
|
|
406 |
iCoreLog->Log( _L( "CSimAtk::NotifySimAtk %S not supported! \
|
|
407 |
Aborting..." ), ¬ifyName );
|
|
408 |
ret = KErrNotSupported;
|
|
409 |
CancelTestCase( ret );
|
|
410 |
break;
|
|
411 |
}
|
|
412 |
}
|
|
413 |
|
|
414 |
if ( KErrNone == ret )
|
|
415 |
{
|
|
416 |
// Put command to array
|
|
417 |
iArray->AppendL( command );
|
|
418 |
}
|
|
419 |
|
|
420 |
}
|
|
421 |
else
|
|
422 |
{
|
|
423 |
// Reusing existing test class
|
|
424 |
command = iArray->At( index );
|
|
425 |
}
|
|
426 |
|
|
427 |
|
|
428 |
// If command was created, notify SAT
|
|
429 |
if ( NULL != command )
|
|
430 |
{
|
|
431 |
// Notify the SAT about command and SimSessionEnd
|
|
432 |
iCoreLog->Log( _L( "CSimAtk::NotifySimAtk \
|
|
433 |
%S async method activated" ), ¬ifyName );
|
|
434 |
|
|
435 |
command->NotifySat( aReqStatus );
|
|
436 |
}
|
|
437 |
|
|
438 |
return ret;
|
|
439 |
}
|
|
440 |
|
|
441 |
// -----------------------------------------------------------------------------
|
|
442 |
// CSimAtk::NotifySimAtkCancel
|
|
443 |
// Cancels notifys
|
|
444 |
// (other items were commented in a header).
|
|
445 |
// -----------------------------------------------------------------------------
|
|
446 |
//
|
|
447 |
TInt CSimAtk::NotifySimAtkCancel
|
|
448 |
(
|
|
449 |
const TSatIpc& aNotify
|
|
450 |
)
|
|
451 |
{
|
|
452 |
iCoreLog->Log( _L( "CSimAtk::NotifySimAtkCancel" ) );
|
|
453 |
|
|
454 |
TInt ret( KErrNone );
|
|
455 |
TInt index ( 0 );
|
|
456 |
|
|
457 |
ret = FindIndex( aNotify, index );
|
|
458 |
|
|
459 |
if ( KErrNone == ret )
|
|
460 |
{
|
|
461 |
iArray->At( index )->CancelRequest();
|
|
462 |
|
|
463 |
iArray->Delete( index );
|
|
464 |
|
|
465 |
if ( ESatNotifyCallControlRequest == aNotify )
|
|
466 |
{
|
|
467 |
iCallControl = NULL;
|
|
468 |
}
|
|
469 |
|
|
470 |
iCoreLog->Log( _L( "CSimAtk::NotifySimAtkCancel \
|
|
471 |
Async method cancelled" ) );
|
|
472 |
}
|
|
473 |
else
|
|
474 |
{
|
|
475 |
iCoreLog->Log( _L( "CSimAtk::NotifySimAtkCancel \
|
|
476 |
Cancellation requested but command not found! Aborting..." ) );
|
|
477 |
|
|
478 |
CancelTestCase( ret );
|
|
479 |
}
|
|
480 |
|
|
481 |
return ret;
|
|
482 |
}
|
|
483 |
|
|
484 |
// -----------------------------------------------------------------------------
|
|
485 |
// CSimAtk::LoadIscTests
|
|
486 |
// Connects to ISC test control and loads XML file
|
|
487 |
// (other items were commented in a header).
|
|
488 |
// -----------------------------------------------------------------------------
|
|
489 |
//
|
|
490 |
TInt CSimAtk::LoadIscTests
|
|
491 |
(
|
|
492 |
CStifItemParser& aItem
|
|
493 |
)
|
|
494 |
{
|
|
495 |
iCoreLog->Log( _L( "CSimAtk::LoadIscTests" ) );
|
|
496 |
|
|
497 |
TPtrC string;
|
|
498 |
aItem.GetString ( _L( "LoadIscTests" ), string );
|
|
499 |
TInt ret( iRIscTestControl.LoadTestCases( string ) );
|
|
500 |
|
|
501 |
if ( KErrNone == ret )
|
|
502 |
{
|
|
503 |
iCoreLog->Log( _L( "CSimAtk::LoadIscTests:\
|
|
504 |
%S loaded successfully." ), &string );
|
|
505 |
}
|
|
506 |
else
|
|
507 |
{
|
|
508 |
iCoreLog->Log( _L( "CSimAtk::LoadIscTests \
|
|
509 |
Loading failed: %S " ), &string );
|
|
510 |
|
|
511 |
TPtrC errorString = MapErrorCodeToString( ret );
|
|
512 |
|
|
513 |
iCoreLog->Log( _L( "CSimAtk::LoadIscTests \
|
|
514 |
%S" ), &errorString );
|
|
515 |
}
|
|
516 |
|
|
517 |
return ret;
|
|
518 |
}
|
|
519 |
|
|
520 |
// -----------------------------------------------------------------------------
|
|
521 |
// CSimAtk::RunIscTestCase
|
|
522 |
// Starts the test procedure
|
|
523 |
// (other items were commented in a header).
|
|
524 |
// -----------------------------------------------------------------------------
|
|
525 |
//
|
|
526 |
TInt CSimAtk::RunIscTestCase
|
|
527 |
(
|
|
528 |
CStifItemParser& aItem
|
|
529 |
)
|
|
530 |
{
|
|
531 |
iCoreLog->Log( _L( "CSimAtk::RunIscTestCase" ) );
|
|
532 |
|
|
533 |
TInt ret( KErrNone );
|
|
534 |
|
|
535 |
// XML file ID
|
|
536 |
TInt xmlId(0);
|
|
537 |
if ( KErrNone == ( ret = aItem.GetInt( _L( "RunIscTestCase" ), xmlId ) ) )
|
|
538 |
{
|
|
539 |
// Test case ID
|
|
540 |
TInt testId(0);
|
|
541 |
if ( KErrNone == ( ret = aItem.GetNextInt( testId ) ) )
|
|
542 |
{
|
|
543 |
iCoreLog->Log( _L( "CSimAtk::RunIscTestCase: Id: %d" ), testId );
|
|
544 |
TInt test = ( xmlId << 20 ) | testId;
|
|
545 |
iRIscTestControl.RunTestCase( test, iIscStatus );
|
|
546 |
}
|
|
547 |
}
|
|
548 |
if ( KErrNone != ret )
|
|
549 |
{
|
|
550 |
iCoreLog->Log( _L( "CSimAtk::RunIscTestCase Running failed!" ) );
|
|
551 |
CancelTestCase( ret );
|
|
552 |
}
|
|
553 |
|
|
554 |
return ret;
|
|
555 |
}
|
|
556 |
|
|
557 |
// -----------------------------------------------------------------------------
|
|
558 |
// CSimAtk::WaitForStatus
|
|
559 |
// Halts the execution until an async req is completed.
|
|
560 |
// (other items were commented in a header).
|
|
561 |
// -----------------------------------------------------------------------------
|
|
562 |
//
|
|
563 |
TInt CSimAtk::WaitForRequest
|
|
564 |
(
|
|
565 |
CStifItemParser& /*aItem*/
|
|
566 |
)
|
|
567 |
{
|
|
568 |
iCoreLog->Log( _L( "CSimAtk::WaitForRequest" ) );
|
|
569 |
|
|
570 |
User::WaitForRequest( iIscStatus );
|
|
571 |
|
|
572 |
TInt errorStatus( iIscStatus.Int() );
|
|
573 |
|
|
574 |
if ( KErrNone == errorStatus && iNeedSessionEnd && iSessionEnd.TimedOut() )
|
|
575 |
{
|
|
576 |
errorStatus = KErrTimedOut;
|
|
577 |
}
|
|
578 |
|
|
579 |
if ( KErrNone != errorStatus )
|
|
580 |
{
|
|
581 |
CancelTestCase( errorStatus );
|
|
582 |
}
|
|
583 |
|
|
584 |
return errorStatus;
|
|
585 |
}
|
|
586 |
|
|
587 |
// -----------------------------------------------------------------------------
|
|
588 |
// CSimAtk::SyncIscTestCase
|
|
589 |
// Connects to ISC test control and loads XML file
|
|
590 |
// (other items were commented in a header).
|
|
591 |
// -----------------------------------------------------------------------------
|
|
592 |
//
|
|
593 |
TInt CSimAtk::SyncIscTestCase
|
|
594 |
(
|
|
595 |
CStifItemParser& /*aItem*/
|
|
596 |
)
|
|
597 |
{
|
|
598 |
TInt ret ( KErrNone );
|
|
599 |
|
|
600 |
iCoreLog->Log( _L( "CSimAtk::SyncIscTestCase" ) );
|
|
601 |
|
|
602 |
ret = iRIscTestControl.SyncTestCase();
|
|
603 |
|
|
604 |
iCoreLog->Log( _L( "CSimAtk::SyncIscTestCase \
|
|
605 |
Synch complete. Status: %d" ), ret );
|
|
606 |
|
|
607 |
if ( KErrNone != ret )
|
|
608 |
{
|
|
609 |
CancelTestCase( ret );
|
|
610 |
}
|
|
611 |
|
|
612 |
return ret;
|
|
613 |
}
|
|
614 |
|
|
615 |
// -----------------------------------------------------------------------------
|
|
616 |
// CSimAtk::CancelTestCase
|
|
617 |
// Test client originated test cancellation
|
|
618 |
// (other items were commented in a header).
|
|
619 |
// -----------------------------------------------------------------------------
|
|
620 |
//
|
|
621 |
TInt CSimAtk::CancelTestCase
|
|
622 |
(
|
|
623 |
const TInt aReason
|
|
624 |
)
|
|
625 |
{
|
|
626 |
TPtrC error( MapErrorCodeToString( aReason ) );
|
|
627 |
|
|
628 |
iCoreLog->Log( _L( "CSimAtk::CancelTestCase: %S" ), &error );
|
|
629 |
|
|
630 |
if ( iArray )
|
|
631 |
{
|
|
632 |
// Cancel all notifys and empty the array
|
|
633 |
for ( TInt i = 0 ; i < iArray->Count() ; i ++ )
|
|
634 |
{
|
|
635 |
iArray->At( i )->CancelRequest();
|
|
636 |
}
|
|
637 |
iArray->Reset();
|
|
638 |
|
|
639 |
iCallControl = NULL;
|
|
640 |
}
|
|
641 |
|
|
642 |
iSessionEnd.Cancel();
|
|
643 |
|
|
644 |
iRIscTestControl.CancelTestCase();
|
|
645 |
|
|
646 |
|
|
647 |
return KErrNone;
|
|
648 |
}
|
|
649 |
|
|
650 |
// -----------------------------------------------------------------------------
|
|
651 |
// CSimAtk::CancelTestCase
|
|
652 |
// Script originated test cancellation
|
|
653 |
// (other items were commented in a header).
|
|
654 |
// -----------------------------------------------------------------------------
|
|
655 |
//
|
|
656 |
TInt CSimAtk::CancelTestCase
|
|
657 |
(
|
|
658 |
CStifItemParser& /*aItem*/
|
|
659 |
)
|
|
660 |
{
|
|
661 |
iCoreLog->Log( _L( "CSimAtk::CancelTestCase" ) );
|
|
662 |
|
|
663 |
if ( iArray )
|
|
664 |
{
|
|
665 |
// Cancel all notifys and empty the array
|
|
666 |
for ( TInt i = 0 ; i < iArray->Count() ; i ++ )
|
|
667 |
{
|
|
668 |
iArray->At( i )->CancelRequest();
|
|
669 |
}
|
|
670 |
iArray->Reset();
|
|
671 |
|
|
672 |
iCallControl = NULL;
|
|
673 |
}
|
|
674 |
|
|
675 |
iRIscTestControl.CancelTestCase();
|
|
676 |
|
|
677 |
return KErrNone;
|
|
678 |
}
|
|
679 |
|
|
680 |
// -----------------------------------------------------------------------------
|
|
681 |
// CSimAtk::Delay
|
|
682 |
// Halt script execution for given time
|
|
683 |
// (other items were commented in a header).
|
|
684 |
// -----------------------------------------------------------------------------
|
|
685 |
//
|
|
686 |
TInt CSimAtk::Delay
|
|
687 |
(
|
|
688 |
CStifItemParser& aItem
|
|
689 |
)
|
|
690 |
{
|
|
691 |
iCoreLog->Log( _L( "CSimAtk::Delay" ) );
|
|
692 |
|
|
693 |
TInt delay(0);
|
|
694 |
aItem.GetNextInt( delay );
|
|
695 |
User::After( delay );
|
|
696 |
return KErrNone;
|
|
697 |
}
|
|
698 |
|
|
699 |
// -----------------------------------------------------------------------------
|
|
700 |
// CSimAtk::CheckData
|
|
701 |
// Verifies the validity of received data
|
|
702 |
// (other items were commented in a header).
|
|
703 |
// -----------------------------------------------------------------------------
|
|
704 |
//
|
|
705 |
TInt CSimAtk::CheckData
|
|
706 |
(
|
|
707 |
CStifItemParser& aItem
|
|
708 |
)
|
|
709 |
{
|
|
710 |
iCoreLog->Log( _L( "CSimAtk::CheckData" ) );
|
|
711 |
|
|
712 |
TInt ret( KErrNone );
|
|
713 |
TInt commandIndex;
|
|
714 |
|
|
715 |
if ( KErrNone == FindIndex( aItem, commandIndex ) )
|
|
716 |
{
|
|
717 |
ret = iArray->At( commandIndex )->CheckData();
|
|
718 |
}
|
|
719 |
else
|
|
720 |
{
|
|
721 |
iCoreLog->Log( _L( "CSimAtk::CheckData Unidentified command" ) );
|
|
722 |
ret = KErrGeneral;
|
|
723 |
}
|
|
724 |
|
|
725 |
// Proactive command data was invalid or unexpected command received
|
|
726 |
if (KErrNone != ret)
|
|
727 |
{
|
|
728 |
iCoreLog->Log( _L( "CSimAtk::CheckData \
|
|
729 |
Checking of data failed, aborting." ) );
|
|
730 |
CancelTestCase( ret );
|
|
731 |
}
|
|
732 |
|
|
733 |
return ret;
|
|
734 |
}
|
|
735 |
|
|
736 |
// -----------------------------------------------------------------------------
|
|
737 |
// CSimAtk::SendResponse
|
|
738 |
// Creates data packet from a script and sends it to Sim
|
|
739 |
// (other items were commented in a header).
|
|
740 |
// -----------------------------------------------------------------------------
|
|
741 |
//
|
|
742 |
TInt CSimAtk::SendResponse
|
|
743 |
(
|
|
744 |
CStifItemParser& aItem
|
|
745 |
)
|
|
746 |
{
|
|
747 |
iCoreLog->Log( _L( "CSimAtk::SendResponse" ) );
|
|
748 |
|
|
749 |
TInt ret( KErrNone );
|
|
750 |
TInt commandIndex;
|
|
751 |
|
|
752 |
if ( KErrNone == FindIndex( aItem, commandIndex ) )
|
|
753 |
{
|
|
754 |
// Find command from array
|
|
755 |
CSatCommandBase* proactiveCommand =
|
|
756 |
static_cast<CSatCommandBase*>(iArray->At( commandIndex ) );
|
|
757 |
|
|
758 |
// Check if notifying of SessionEnd is omitted from script. Needed
|
|
759 |
// by default
|
|
760 |
iNeedSessionEnd = ETrue;
|
|
761 |
aItem.GetInt( KSessionEnd, iNeedSessionEnd );
|
|
762 |
|
|
763 |
// In case of sending envelopes, SessionEnd has to be notified here
|
|
764 |
if ( iNeedSessionEnd && KRequestPending != iSessionEnd.Status() )
|
|
765 |
{
|
|
766 |
iSessionEnd.NotifySat();
|
|
767 |
}
|
|
768 |
|
|
769 |
ret = proactiveCommand->SendResponse();
|
|
770 |
|
|
771 |
if ( iNeedSessionEnd && KErrNone == ret )
|
|
772 |
{
|
|
773 |
// Sending OK, wait for a while for session end
|
|
774 |
ret = iSessionEnd.WaitSessionEnd();
|
|
775 |
}
|
|
776 |
|
|
777 |
switch ( ret )
|
|
778 |
{
|
|
779 |
case KErrNone:
|
|
780 |
{
|
|
781 |
iCoreLog->Log( _L( "CSimAtk::SendResponse \
|
|
782 |
Response sent successfully" ), ret );
|
|
783 |
break;
|
|
784 |
}
|
|
785 |
case KErrTimedOut:
|
|
786 |
{
|
|
787 |
// When there's data coming from SIM, SessionEnd is not
|
|
788 |
// completed and time out occurs. This is not error however,
|
|
789 |
// final check for SessionEnd status is made in WaitForRequest
|
|
790 |
ret = KErrNone;
|
|
791 |
|
|
792 |
iCoreLog->Log( _L( "CSimAtk::SendResponse \
|
|
793 |
SessionEnd Timed out" ) );
|
|
794 |
break;
|
|
795 |
}
|
|
796 |
default:
|
|
797 |
{
|
|
798 |
iCoreLog->Log( _L( "CSimAtk::SendResponse \
|
|
799 |
Command returned an error code %d!" ), ret );
|
|
800 |
break;
|
|
801 |
}
|
|
802 |
}
|
|
803 |
}
|
|
804 |
else
|
|
805 |
{
|
|
806 |
iCoreLog->Log( _L( "CSimAtk::SendResponse \
|
|
807 |
Unidentified command" ) );
|
|
808 |
ret = KErrGeneral;
|
|
809 |
}
|
|
810 |
|
|
811 |
if ( KErrNone != ret )
|
|
812 |
{
|
|
813 |
CancelTestCase( ret );
|
|
814 |
}
|
|
815 |
|
|
816 |
return ret;
|
|
817 |
}
|
|
818 |
|
|
819 |
// -----------------------------------------------------------------------------
|
|
820 |
// CSimAtk::CheckIcon
|
|
821 |
// Verifies the validity of provided icon info
|
|
822 |
// (other items were commented in a header).
|
|
823 |
// -----------------------------------------------------------------------------
|
|
824 |
//
|
|
825 |
TInt CSimAtk::CheckIcon
|
|
826 |
(
|
|
827 |
CStifItemParser& aItem
|
|
828 |
)
|
|
829 |
{
|
|
830 |
TInt ret( KErrNone );
|
|
831 |
|
|
832 |
// Try to load mandatory SimType parameter from script
|
|
833 |
TPtrC simType;
|
|
834 |
|
|
835 |
if ( KErrNone == aItem.GetString( KLoadIcon, simType ) )
|
|
836 |
{
|
|
837 |
TInt instanceNumber( 0 );
|
|
838 |
TInt recordId( 0 );
|
|
839 |
|
|
840 |
// Get instance number identifier
|
|
841 |
if ( KErrNone != aItem.GetNextInt( instanceNumber ) )
|
|
842 |
{
|
|
843 |
ret = KErrArgument;
|
|
844 |
}
|
|
845 |
// Get record id.
|
|
846 |
else if ( KErrNone != aItem.GetNextInt( recordId ) )
|
|
847 |
{
|
|
848 |
ret = KErrArgument;
|
|
849 |
}
|
|
850 |
else
|
|
851 |
{
|
|
852 |
CSatIcon satIcon( iSat, simType, recordId );
|
|
853 |
ret = satIcon.CheckIcon( iCoreLog, instanceNumber );
|
|
854 |
}
|
|
855 |
}
|
|
856 |
else
|
|
857 |
{
|
|
858 |
ret = KErrArgument;
|
|
859 |
}
|
|
860 |
|
|
861 |
if ( KErrNone != ret )
|
|
862 |
{
|
|
863 |
CancelTestCase( ret );
|
|
864 |
}
|
|
865 |
|
|
866 |
return ret;
|
|
867 |
}
|
|
868 |
|
|
869 |
// -----------------------------------------------------------------------------
|
|
870 |
// CSimAtk::FindIndex
|
|
871 |
// Finds the index of command in array based on the script parameter
|
|
872 |
// (other items were commented in a header).
|
|
873 |
// -----------------------------------------------------------------------------
|
|
874 |
//
|
|
875 |
TInt CSimAtk::FindIndex
|
|
876 |
(
|
|
877 |
CStifItemParser& aItem, // Reference to parser
|
|
878 |
TInt& aIndex // Index output
|
|
879 |
)
|
|
880 |
{
|
|
881 |
iCoreLog->Log( _L( "CSimAtk::FindIndex (by name)") );
|
|
882 |
|
|
883 |
TInt ret ( KErrNotFound );
|
|
884 |
TPtrC cmdName;
|
|
885 |
|
|
886 |
if ( iArray )
|
|
887 |
{
|
|
888 |
if ( KErrNone != aItem.GetString( KCommandType, cmdName ) )
|
|
889 |
{
|
|
890 |
// Script did not provide command type.
|
|
891 |
// Return index 0 (first element) as a default.
|
|
892 |
if ( 0 < iArray->Count() )
|
|
893 |
{
|
|
894 |
aIndex = 0;
|
|
895 |
ret = KErrNone;
|
|
896 |
}
|
|
897 |
}
|
|
898 |
else
|
|
899 |
{
|
|
900 |
// Script provided a command type. For example:
|
|
901 |
// "CommandType ESatNotifyDisplayTextPCmd"
|
|
902 |
// Loop throught the array and look for matching command type.
|
|
903 |
// If array contains several commands of same type, latest is.
|
|
904 |
// returned
|
|
905 |
TBool requestPending( EFalse ); // Not used
|
|
906 |
TSatIpc requestedCommand =
|
|
907 |
MapStringToIpc( cmdName, requestPending );
|
|
908 |
|
|
909 |
// Find command based on type
|
|
910 |
ret = FindIndex( requestedCommand, aIndex );
|
|
911 |
}
|
|
912 |
} // if (iArray)
|
|
913 |
else
|
|
914 |
{
|
|
915 |
// iArray is NULL
|
|
916 |
ret = KErrCorrupt;
|
|
917 |
}
|
|
918 |
|
|
919 |
return ret;
|
|
920 |
}
|
|
921 |
|
|
922 |
// -----------------------------------------------------------------------------
|
|
923 |
// CSimAtk::FindIndex
|
|
924 |
// Finds the index of command in array based on the ipc of the command
|
|
925 |
// (other items were commented in a header).
|
|
926 |
// -----------------------------------------------------------------------------
|
|
927 |
//
|
|
928 |
TInt CSimAtk::FindIndex
|
|
929 |
(
|
|
930 |
const TSatIpc& aRequestedIpc, // Requested type
|
|
931 |
TInt& aIndex // Index output
|
|
932 |
)
|
|
933 |
{
|
|
934 |
iCoreLog->Log( _L( "CSimAtk::FindIndex (by IPC)") );
|
|
935 |
TInt ret ( KErrNotFound );
|
|
936 |
|
|
937 |
if ( iArray )
|
|
938 |
{
|
|
939 |
TInt i = iArray->Count() - 1;
|
|
940 |
|
|
941 |
for ( ; KErrNotFound == ret && i >= 0 ; i-- )
|
|
942 |
{
|
|
943 |
if ( iArray->At( i )->MatchIpc( aRequestedIpc ) )
|
|
944 |
{
|
|
945 |
aIndex = i;
|
|
946 |
ret = KErrNone;
|
|
947 |
}
|
|
948 |
}
|
|
949 |
}
|
|
950 |
|
|
951 |
if ( KErrNone != ret )
|
|
952 |
{
|
|
953 |
TPtrC cmdName( MapIpcToString( aRequestedIpc ) );
|
|
954 |
iCoreLog->Log( _L( "CSimAtk::FindIndex \
|
|
955 |
%S not found!"), &cmdName );
|
|
956 |
}
|
|
957 |
|
|
958 |
return ret;
|
|
959 |
}
|
|
960 |
|
|
961 |
// -----------------------------------------------------------------------------
|
|
962 |
// CSimAtk::MapErrorCodeToString
|
|
963 |
//
|
|
964 |
// (other items were commented in a header).
|
|
965 |
// -----------------------------------------------------------------------------
|
|
966 |
//
|
|
967 |
const TPtrC CSimAtk::MapErrorCodeToString( const TInt& aErrorCode )
|
|
968 |
{
|
|
969 |
TPtrC errorString( KNullDesC );
|
|
970 |
|
|
971 |
for ( TUint8 i( 0 ) ; errorString == KNullDesC
|
|
972 |
&& i < KSatErrorListSize ; i++ )
|
|
973 |
{
|
|
974 |
if ( KSatErrorList[i].iErrorCode == aErrorCode )
|
|
975 |
{
|
|
976 |
errorString.Set( KSatErrorList[i].iErrorString );
|
|
977 |
}
|
|
978 |
}
|
|
979 |
|
|
980 |
if ( errorString == KNullDesC )
|
|
981 |
{
|
|
982 |
errorString.Set( _L( "Unidentified error code" ) );
|
|
983 |
|
|
984 |
iCoreLog->Log( _L( "CSimAtk::MapErrorCodeToString \
|
|
985 |
Error code %d" ), aErrorCode );
|
|
986 |
}
|
|
987 |
|
|
988 |
return errorString;
|
|
989 |
}
|
|
990 |
|
|
991 |
// End of File
|