author | ivan.fildichev@opencode.com |
Thu, 18 Nov 2010 15:42:16 +0200 | |
branch | opencode |
changeset 88 | 5e27cc612ac7 |
parent 85 | 96b4f933d69a |
permissions | -rw-r--r-- |
35
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
1 |
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
2 |
// All rights reserved. |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
3 |
// This component and the accompanying materials are made available |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
4 |
// under the terms of "Eclipse Public License v1.0" |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
5 |
// which accompanies this distribution, and is available |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
7 |
// |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
8 |
// Initial Contributors: |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
9 |
// Nokia Corporation - initial contribution. |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
10 |
// |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
11 |
// Contributors: |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
12 |
// |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
13 |
// Description: |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
14 |
// |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
15 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
16 |
#include "ussdtestclient.h" |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
17 |
#include <ctsy/mmtsy_names.h> |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
18 |
#include <e32debug.h> |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
19 |
#include <e32math.h> |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
20 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
21 |
CCTsyUssdMessagingTestClient::CCTsyUssdMessagingTestClient() |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
22 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
23 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
24 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
25 |
/** |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
26 |
@SYMTestCaseID |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
27 |
@SYMComponent telephony_ctsy |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
28 |
@SYMTestCaseDesc Test support in CTSY for RMobileUssdMessaging::ReceiveMessage |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
29 |
@SYMTestPriority High |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
30 |
@SYMTestActions Invokes RMobileUssdMessaging::ReceiveMessage |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
31 |
@SYMTestExpectedResults Pass |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
32 |
@SYMTestType CT |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
33 |
*/ |
85 | 34 |
TInt CCTsyUssdMessagingTestClient::ReceiveMessageL(TBool aAcceptDialogue, TBool aReceiveTimeout, TReal aAfterTimePeriod, TBool aMO) |
35
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
35 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
36 |
// Create a cleanup stack object |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
37 |
CTrapCleanup* cleanup=CTrapCleanup::New(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
38 |
if (cleanup==NULL) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
39 |
return KErrNoMemory; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
40 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
41 |
RTelServer server; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
42 |
RMobilePhone phone; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
43 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
44 |
TInt ret = server.Connect(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
45 |
if (ret != KErrNone) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
46 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
47 |
server.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
48 |
return ret; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
49 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
50 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
51 |
ret = phone.Open(server,KMmTsyPhoneName); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
52 |
if (ret != KErrNone) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
53 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
54 |
server.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
55 |
phone.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
56 |
return ret; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
57 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
58 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
59 |
TRequestStatus requestStatus; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
60 |
RMobileUssdMessaging::TGsmUssdMessageData name; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
61 |
RMobileUssdMessaging::TMobileUssdAttributesV1 attributes; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
62 |
TPckg<RMobileUssdMessaging::TMobileUssdAttributesV1> msgAttributes(attributes); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
63 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
64 |
RMobileUssdMessaging ussdMessaging; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
65 |
ret = ussdMessaging.Open(phone); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
66 |
if (ret != KErrNone) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
67 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
68 |
server.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
69 |
phone.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
70 |
return ret; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
71 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
72 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
73 |
//RDebug::Printf("%x >> ReceiveMessage", User::Identity()); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
74 |
ussdMessaging.ReceiveMessage(requestStatus, name, msgAttributes); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
75 |
//RDebug::Printf("%x << ReceiveMessage", User::Identity()); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
76 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
77 |
if (aReceiveTimeout) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
78 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
79 |
// This section of code and the aReceiveTimeout parameter apply |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
80 |
// to the TestReceiveMessageWithTestClient0016L test |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
81 |
// (BA-CTSY-USSDM-URM-0020). |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
82 |
// This test verifies that the second client does not recieve |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
83 |
// a message. As part of the test spec we must call close on |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
84 |
// the RMobileUssdMessaging object. |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
85 |
// Rather than adding a whole ActiveScheduler framework to this |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
86 |
// executable we've put in a wait and check loop. We can't use |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
87 |
// User::WaitForRequest as this would block. We don't want to |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
88 |
// block as we are checking that an event which |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
89 |
// *does not occur* rather than checking for an event which |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
90 |
// does occur. |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
91 |
for (TInt i=0; i<50; ++i) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
92 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
93 |
User::After(100000); // 0.1s |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
94 |
if (requestStatus.Int() != KRequestPending) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
95 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
96 |
break; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
97 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
98 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
99 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
100 |
if (requestStatus.Int() == KRequestPending) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
101 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
102 |
ussdMessaging.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
103 |
phone.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
104 |
server.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
105 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
106 |
delete cleanup; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
107 |
return KRequestPending; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
108 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
109 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
110 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
111 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
112 |
//RDebug::Printf("%x >> WaitForRequest", User::Identity()); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
113 |
User::WaitForRequest(requestStatus); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
114 |
//RDebug::Printf("%x << WaitForRequest", User::Identity()); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
115 |
//RDebug::Printf("%x requestStatus = %d", User::Identity(), requestStatus.Int()); |
85 | 116 |
|
35
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
117 |
if (aAfterTimePeriod) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
118 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
119 |
//RDebug::Printf("%x Waiting for %f seconds", User::Identity(), aAfterTimePeriod); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
120 |
// Wait, mimic a bad client taking too long... |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
121 |
User::After(aAfterTimePeriod * 1000000); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
122 |
} |
85 | 123 |
|
124 |
if(EFalse == aMO) |
|
125 |
//network initiated dialog |
|
35
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
126 |
{ |
85 | 127 |
//RDebug::Printf("NI Dialog"); |
128 |
if (aAcceptDialogue) |
|
129 |
{ |
|
130 |
//RDebug::Printf("%x >> AcceptIncomingDialogue", User::Identity()); |
|
131 |
// Client wants the dialogue |
|
132 |
ret = ussdMessaging.AcceptIncomingDialogue(); |
|
133 |
//RDebug::Printf("%x << AcceptIncomingDialogue", User::Identity()); |
|
134 |
} |
|
135 |
else |
|
136 |
{ |
|
137 |
// Client not interested |
|
138 |
//RDebug::Printf("%x >> RejectIncomingDialogue", User::Identity()); |
|
139 |
ret = ussdMessaging.RejectIncomingDialogue(); |
|
140 |
//RDebug::Printf("%x << RejectIncomingDialogue", User::Identity()); |
|
141 |
} |
|
35
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
142 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
143 |
else |
85 | 144 |
{ |
145 |
//RDebug::Printf("MO Dialogue"); |
|
146 |
ret = requestStatus.Int(); |
|
147 |
} |
|
148 |
//RDebug::Printf("%x Received Message: %S", User::Identity(), &name); |
|
35
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
149 |
User::After(2 * 1000000); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
150 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
151 |
ussdMessaging.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
152 |
phone.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
153 |
server.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
154 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
155 |
delete cleanup; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
156 |
return ret; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
157 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
158 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
159 |
TInt CCTsyUssdMessagingTestClient::SendMessageL() |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
160 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
161 |
// Create a cleanup stack object |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
162 |
CTrapCleanup* cleanup=CTrapCleanup::New(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
163 |
if (cleanup==NULL) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
164 |
return KErrNoMemory; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
165 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
166 |
RTelServer server; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
167 |
RMobilePhone phone; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
168 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
169 |
TInt ret = server.Connect(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
170 |
if (ret != KErrNone) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
171 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
172 |
server.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
173 |
return ret; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
174 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
175 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
176 |
ret = phone.Open(server,KMmTsyPhoneName); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
177 |
if (ret != KErrNone) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
178 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
179 |
server.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
180 |
phone.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
181 |
return ret; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
182 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
183 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
184 |
TRequestStatus requestStatus; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
185 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
186 |
TUint32 flags = 100; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
187 |
RMobileUssdMessaging::TMobileUssdDataFormat format = RMobileUssdMessaging::EFormatUnspecified; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
188 |
RMobileUssdMessaging::TMobileUssdMessageType type = RMobileUssdMessaging::EUssdMORequest; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
189 |
TUint8 dcs = 200; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
190 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
191 |
RMobileUssdMessaging::TMobileUssdAttributesV1 attributes; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
192 |
TPckg<RMobileUssdMessaging::TMobileUssdAttributesV1> msgAttributes(attributes); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
193 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
194 |
attributes.iFlags = flags; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
195 |
attributes.iFormat = format; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
196 |
attributes.iType = type; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
197 |
attributes.iDcs = dcs; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
198 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
199 |
TName name = _L("Name1"); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
200 |
TPckg<TName> msgData(name); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
201 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
202 |
RMobileUssdMessaging ussdMessaging; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
203 |
ret = ussdMessaging.Open(phone); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
204 |
if (ret != KErrNone) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
205 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
206 |
server.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
207 |
phone.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
208 |
return ret; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
209 |
} |
85 | 210 |
|
35
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
211 |
ussdMessaging.SendMessage(requestStatus, msgData, msgAttributes); |
85 | 212 |
User::WaitForRequest(requestStatus); |
35
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
213 |
ret = requestStatus.Int(); |
85 | 214 |
|
35
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
215 |
User::After(2 * 1000000); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
216 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
217 |
ussdMessaging.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
218 |
phone.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
219 |
server.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
220 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
221 |
delete cleanup; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
222 |
return KErrNone; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
223 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
224 |
|
85 | 225 |
TInt CCTsyUssdMessagingTestClient::SendMessageDefaultHandlerL() |
226 |
{ |
|
227 |
// Create a cleanup stack object |
|
228 |
CTrapCleanup* cleanup=CTrapCleanup::New(); |
|
229 |
if (cleanup==NULL) |
|
230 |
return KErrNoMemory; |
|
231 |
||
232 |
RTelServer server; |
|
233 |
RMobilePhone phone; |
|
234 |
||
235 |
TInt ret = server.Connect(); |
|
236 |
if (ret != KErrNone) |
|
237 |
{ |
|
238 |
server.Close(); |
|
239 |
return ret; |
|
240 |
} |
|
241 |
||
242 |
RDebug::Printf(">> server.Connect() SUCCESS!"); |
|
243 |
ret = phone.Open(server,KMmTsyPhoneName); |
|
244 |
if (ret != KErrNone) |
|
245 |
{ |
|
246 |
server.Close(); |
|
247 |
phone.Close(); |
|
248 |
return ret; |
|
249 |
} |
|
250 |
RDebug::Printf(">> phone.Open() SUCCESS!"); |
|
251 |
TRequestStatus requestStatus; |
|
252 |
||
253 |
TUint32 flags = 100; |
|
254 |
RMobileUssdMessaging::TMobileUssdDataFormat format = RMobileUssdMessaging::EFormatUnspecified; |
|
255 |
RMobileUssdMessaging::TMobileUssdMessageType type = RMobileUssdMessaging::EUssdMORequest; |
|
256 |
TUint8 dcs = 200; |
|
257 |
||
258 |
RMobileUssdMessaging::TMobileUssdAttributesV1 attributes; |
|
259 |
TPckg<RMobileUssdMessaging::TMobileUssdAttributesV1> msgAttributes(attributes); |
|
260 |
||
261 |
attributes.iFlags = flags; |
|
262 |
attributes.iFormat = format; |
|
263 |
attributes.iType = type; |
|
264 |
attributes.iDcs = dcs; |
|
265 |
||
266 |
TName name = _L("Name1"); |
|
267 |
TPckg<TName> msgData(name); |
|
268 |
||
269 |
RMobileUssdMessaging ussdMessaging; |
|
270 |
ret = ussdMessaging.Open(phone); |
|
271 |
if (ret != KErrNone) |
|
272 |
{ |
|
273 |
server.Close(); |
|
274 |
phone.Close(); |
|
275 |
return ret; |
|
276 |
} |
|
277 |
RDebug::Printf(">> ussdMessaging.Open() SUCCESS!"); |
|
278 |
||
279 |
ussdMessaging.SendMessage(requestStatus, msgData, msgAttributes, RMobileUssdMessaging::ETransferToDefaultHandler); |
|
280 |
User::WaitForRequest(requestStatus); |
|
281 |
ret = requestStatus.Int(); |
|
282 |
RDebug::Printf(">> ret = %d", ret); |
|
283 |
||
284 |
User::After(2 * 1000000); |
|
285 |
||
286 |
ussdMessaging.Close(); |
|
287 |
phone.Close(); |
|
288 |
server.Close(); |
|
289 |
||
290 |
delete cleanup; |
|
291 |
return ret; |
|
292 |
} |
|
35
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
293 |
TInt CCTsyUssdMessagingTestClient::RandomLoopL() |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
294 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
295 |
// Create a cleanup stack object |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
296 |
CTrapCleanup* cleanup=CTrapCleanup::New(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
297 |
if (cleanup==NULL) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
298 |
return KErrNoMemory; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
299 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
300 |
RTelServer server; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
301 |
RMobilePhone phone; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
302 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
303 |
TInt ret = server.Connect(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
304 |
if (ret != KErrNone) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
305 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
306 |
server.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
307 |
return ret; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
308 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
309 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
310 |
ret = phone.Open(server,KMmTsyPhoneName); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
311 |
if (ret != KErrNone) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
312 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
313 |
server.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
314 |
phone.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
315 |
return ret; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
316 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
317 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
318 |
TRequestStatus requestStatus; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
319 |
RMobileUssdMessaging::TGsmUssdMessageData name; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
320 |
RMobileUssdMessaging::TMobileUssdAttributesV1 attributes; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
321 |
TPckg<RMobileUssdMessaging::TMobileUssdAttributesV1> msgAttributes(attributes); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
322 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
323 |
RMobileUssdMessaging ussdMessaging; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
324 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
325 |
FOREVER |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
326 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
327 |
ret = ussdMessaging.Open(phone); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
328 |
if (ret != KErrNone) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
329 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
330 |
server.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
331 |
phone.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
332 |
return ret; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
333 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
334 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
335 |
//RDebug::Printf("%x >> ReceiveMessage", User::Identity()); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
336 |
ussdMessaging.ReceiveMessage(requestStatus, name, msgAttributes); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
337 |
//RDebug::Printf("%x << ReceiveMessage", User::Identity()); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
338 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
339 |
if (ProbabilityPercent(50)) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
340 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
341 |
for (TInt i=0; i<10; ++i) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
342 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
343 |
User::After(100000); // 0.1s |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
344 |
if (requestStatus.Int() != KRequestPending) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
345 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
346 |
break; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
347 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
348 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
349 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
350 |
else |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
351 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
352 |
User::WaitForRequest(requestStatus); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
353 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
354 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
355 |
if (requestStatus.Int() == KErrNone) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
356 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
357 |
if (ProbabilityPercent(50)) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
358 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
359 |
TInt timeout = RandomNumber(1000000); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
360 |
User::After(timeout); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
361 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
362 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
363 |
if (ProbabilityPercent(50)) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
364 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
365 |
ret = ussdMessaging.AcceptIncomingDialogue(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
366 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
367 |
else |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
368 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
369 |
ret = ussdMessaging.RejectIncomingDialogue(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
370 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
371 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
372 |
else |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
373 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
374 |
ussdMessaging.CancelAsyncRequest(EMobileUssdMessagingReceiveMessage); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
375 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
376 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
377 |
ussdMessaging.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
378 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
379 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
380 |
phone.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
381 |
server.Close(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
382 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
383 |
delete cleanup; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
384 |
return ret; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
385 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
386 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
387 |
TBool CCTsyUssdMessagingTestClient::ProbabilityPercent(TInt aPercentTrue) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
388 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
389 |
TInt random = RandomNumber(100); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
390 |
return aPercentTrue < random; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
391 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
392 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
393 |
// Not properly random but good enough... |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
394 |
TInt CCTsyUssdMessagingTestClient::RandomNumber(TInt aMax) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
395 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
396 |
TUint32 rand = Math::Random() % aMax; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
397 |
return rand; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
398 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
399 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
400 |
_LIT(KReceiveOption,"-R"); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
401 |
_LIT(KReceiveTimeoutOption,"-RTimeout"); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
402 |
_LIT(KSendOption,"-S"); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
403 |
_LIT(KAcceptOption,"-A"); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
404 |
_LIT(KTimerOption,"-T"); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
405 |
_LIT(KRandomOption,"-Random"); |
85 | 406 |
_LIT(KDefaultOption,"-D"); |
407 |
_LIT(KMOOption,"-M"); |
|
35
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
408 |
TInt ParseCommandLine(TReal& aAfterTimePeriod) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
409 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
410 |
TBuf<256> c; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
411 |
User::CommandLine(c); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
412 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
413 |
TLex l(c); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
414 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
415 |
// Get options |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
416 |
TInt option = 0; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
417 |
aAfterTimePeriod = 0; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
418 |
TPtrC nextToken; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
419 |
for (;;) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
420 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
421 |
nextToken.Set(l.NextToken()); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
422 |
if (nextToken == KReceiveOption) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
423 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
424 |
option |= EOptionReceive; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
425 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
426 |
else if (nextToken == KReceiveTimeoutOption) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
427 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
428 |
option |= EOptionReceiveTimeout; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
429 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
430 |
else if (nextToken == KSendOption) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
431 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
432 |
option |= EOptionSend; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
433 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
434 |
else if (nextToken == KAcceptOption) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
435 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
436 |
option |= EOptionAccept; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
437 |
} |
85 | 438 |
else if (nextToken == KDefaultOption) |
439 |
{ |
|
440 |
option |= EOptionDefault; |
|
441 |
} |
|
442 |
else if (nextToken == KMOOption) |
|
443 |
{ |
|
444 |
option |= EOptionMO; |
|
445 |
} |
|
35
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
446 |
else if (nextToken == KTimerOption) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
447 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
448 |
nextToken.Set(l.NextToken()); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
449 |
if (nextToken != KNullDesC) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
450 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
451 |
TLex sl(nextToken); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
452 |
if (sl.Val(aAfterTimePeriod)!=KErrNone) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
453 |
aAfterTimePeriod = 0.0; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
454 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
455 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
456 |
else if (nextToken == KRandomOption) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
457 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
458 |
option |= EOptionRandom; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
459 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
460 |
else |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
461 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
462 |
break; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
463 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
464 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
465 |
return option; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
466 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
467 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
468 |
TInt E32Main() |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
469 |
/** |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
470 |
Executable entrypoint calls test functions within heap check. |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
471 |
*/ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
472 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
473 |
//__UHEAP_MARK; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
474 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
475 |
CTrapCleanup* cleanup=CTrapCleanup::New(); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
476 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
477 |
TReal afterTimePeriod; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
478 |
TInt option = ParseCommandLine(afterTimePeriod); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
479 |
TInt err = KErrNone; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
480 |
TInt ret = KErrNone; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
481 |
CCTsyUssdMessagingTestClient ussdClient; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
482 |
if (option & EOptionReceive) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
483 |
{ |
85 | 484 |
TRAPD(err, ret = ussdClient.ReceiveMessageL((option & EOptionAccept), (option & EOptionReceiveTimeout), afterTimePeriod, (option & EOptionMO))); |
35
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
485 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
486 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
487 |
if (option & EOptionSend) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
488 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
489 |
TRAPD(err, ret = ussdClient.SendMessageL()); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
490 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
491 |
|
85 | 492 |
if (option & EOptionDefault) |
493 |
{ |
|
494 |
TRAPD(err, ret = ussdClient.SendMessageDefaultHandlerL()); |
|
495 |
} |
|
496 |
||
35
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
497 |
if (option & EOptionRandom) |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
498 |
{ |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
499 |
TRAPD(err, ret = ussdClient.RandomLoopL()); |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
500 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
501 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
502 |
delete cleanup; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
503 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
504 |
//__UHEAP_MARKEND; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
505 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
506 |
return err ? err : ret; |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
507 |
} |
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
508 |
|
6fbc08ed9c42
opencode: Added USSD test client to CTSY component tests
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
diff
changeset
|
509 |