|
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // This file implements various tests for incoming call handling. |
|
15 // See CDataCall.cpp for fully documented test scenario. |
|
16 // |
|
17 // |
|
18 |
|
19 /** |
|
20 @file |
|
21 */ |
|
22 |
|
23 #include <e32test.h> |
|
24 #include <mmretrieve.h> |
|
25 #include <etelmm.h> |
|
26 #include <faxstd.h> |
|
27 #include "Te_LoopBackcincall.h" |
|
28 #include "../../hayes/TSYCONFG.H" // for KInternetAccessPoint |
|
29 |
|
30 // |
|
31 // Test-side class |
|
32 // With the assistance of the base class, this class must start the emulator |
|
33 // and drive the ETel API. |
|
34 // |
|
35 CTestDriveInCall* CTestDriveInCall::NewL(const TScriptList aScriptListEntry) |
|
36 { |
|
37 CTestDriveInCall* aA = new (ELeave) CTestDriveInCall(aScriptListEntry); |
|
38 CleanupStack::PushL(aA); |
|
39 aA->ConstructL(); |
|
40 CleanupStack::Pop(); |
|
41 return (aA); |
|
42 } |
|
43 |
|
44 CTestDriveInCall::CTestDriveInCall(const TScriptList aScriptListEntry) : |
|
45 iScriptListEntry(aScriptListEntry) |
|
46 {} |
|
47 |
|
48 TInt CTestDriveInCall::RunTestL() |
|
49 { |
|
50 iCurrentScript = iScriptListEntry; |
|
51 return (StartEmulatorL()); |
|
52 } |
|
53 |
|
54 TInt CTestDriveInCall::DriveETelApiL() |
|
55 // |
|
56 // This function contains the real meat of the Client-side test code |
|
57 // |
|
58 { |
|
59 _LIT(KVoiceLineName, "Voice"); |
|
60 _LIT(KDataLineName, "Data"); |
|
61 _LIT(KFaxLineName, "Fax"); |
|
62 |
|
63 RLine voiceLine; |
|
64 INFO_PRINTF1(_L("Opening Voice Line\n")); |
|
65 TESTL(voiceLine.Open(iPhone,KVoiceLineName) == KErrNone); |
|
66 RCall voiceCall; |
|
67 INFO_PRINTF1(_L("Opening New Voice Call\n")); |
|
68 TESTL(voiceCall.OpenNewCall(voiceLine) == KErrNone); |
|
69 |
|
70 RLine dataLine; |
|
71 INFO_PRINTF1(_L("Opening Data Line\n")); |
|
72 TESTL(dataLine.Open(iPhone,KDataLineName) == KErrNone); |
|
73 RCall dataCall; |
|
74 INFO_PRINTF1(_L("Opening New Data Call\n")); |
|
75 TESTL(dataCall.OpenNewCall(dataLine) == KErrNone); |
|
76 |
|
77 RLine faxLine; |
|
78 INFO_PRINTF1(_L("Opening Fax Line\n")); |
|
79 TESTL(faxLine.Open(iPhone,KFaxLineName) == KErrNone); |
|
80 RCall faxCall; |
|
81 INFO_PRINTF1(_L("Opening New Fax Call\n")); |
|
82 TESTL(faxCall.OpenNewCall(faxLine) == KErrNone); |
|
83 |
|
84 TRequestStatus stat1, stat2, stat3, reqStatus; |
|
85 |
|
86 RMobilePhone::TMMTableSettings tableSettings; |
|
87 tableSettings.iLocId=KInternetAccessPoint; |
|
88 RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings); |
|
89 iPhone.InitialiseMM(reqStatus , tableSettingsPckg); |
|
90 User::WaitForRequest(reqStatus); |
|
91 TESTL(reqStatus == KErrNone); |
|
92 |
|
93 // Now wait for an incoming voice call... |
|
94 INFO_PRINTF1(_L("Answering a Voice Call...\n")); |
|
95 voiceCall.AnswerIncomingCall(stat1); |
|
96 dataCall.AnswerIncomingCall(stat2); |
|
97 faxCall.AnswerIncomingCall(stat3); |
|
98 User::WaitForRequest(stat1); |
|
99 TESTL(stat1 == KErrNone); |
|
100 dataCall.AnswerIncomingCallCancel(); |
|
101 faxCall.AnswerIncomingCallCancel(); |
|
102 User::WaitForRequest(stat2); |
|
103 User::WaitForRequest(stat3); |
|
104 User::After(1000000L); |
|
105 INFO_PRINTF1(_L("Hangup a Voice Call...\n")); |
|
106 TESTL(voiceCall.HangUp() == KErrNone); |
|
107 |
|
108 // Now wait for an incoming fax call... |
|
109 INFO_PRINTF1(_L("Answering a Fax Call...\n")); |
|
110 RCall::TFaxSessionSettings faxSessionSettings; |
|
111 faxSessionSettings.iMode = RCall::EReceive; |
|
112 faxSessionSettings.iFaxRetrieveType = RCall::EFaxOnDemand; |
|
113 faxSessionSettings.iFaxClass = EClassAuto; |
|
114 faxSessionSettings.iFaxId.Zero(); |
|
115 faxSessionSettings.iMaxSpeed = 14400; |
|
116 faxSessionSettings.iMinSpeed = 12000; |
|
117 faxSessionSettings.iRxResolution = EFaxNormal; |
|
118 faxSessionSettings.iRxCompression = EModifiedHuffman; |
|
119 faxCall.SetFaxSettings(faxSessionSettings); |
|
120 |
|
121 faxCall.AnswerIncomingCall(stat3); |
|
122 User::WaitForRequest(stat3); |
|
123 TESTL(stat3 == KFaxErrReceiveTimeout); // We don't actually send any data |
|
124 User::After(300000L); |
|
125 INFO_PRINTF1(_L("Hangup a Fax Call...\n")); |
|
126 TESTL(faxCall.HangUp() == KErrNone); |
|
127 |
|
128 // Now wait for an incoming data call... |
|
129 INFO_PRINTF1(_L("Answering a Data Call\n")); |
|
130 TESTL(dataCall.AnswerIncomingCall() == KErrNone); |
|
131 User::After(300000L); |
|
132 TESTL(dataCall.HangUp() == KErrNone); |
|
133 |
|
134 // Get the FaxSettings before closing the line and call |
|
135 TInt ret = faxCall.GetFaxSettings(faxSessionSettings); |
|
136 TEST_CHECKL(ret, KErrNone, _L("*** Failed to get fax setttings ***")); |
|
137 |
|
138 faxCall.Close(); |
|
139 faxLine.Close(); |
|
140 dataCall.Close(); |
|
141 dataLine.Close(); |
|
142 voiceCall.Close(); |
|
143 voiceLine.Close(); |
|
144 |
|
145 return (KErrNone); |
|
146 } |
|
147 |
|
148 // |
|
149 // Emulator-side class |
|
150 // With the assistance of the base class, this class must run the designated script |
|
151 // |
|
152 CTestInCall* CTestInCall::NewL(const TScript* aScript) |
|
153 { |
|
154 CTestInCall* aA = new (ELeave) CTestInCall(aScript); |
|
155 CleanupStack::PushL(aA); |
|
156 aA->ConstructL(); |
|
157 CleanupStack::Pop(); |
|
158 return (aA); |
|
159 } |
|
160 |
|
161 CTestInCall::CTestInCall(const TScript* aScript) : |
|
162 iScript(aScript) |
|
163 {} |
|
164 |
|
165 void CTestInCall::ConstructL() |
|
166 { |
|
167 CATScriptEng::ConstructL(); |
|
168 } |
|
169 |
|
170 TInt CTestInCall::Start() |
|
171 { |
|
172 StartScript(iScript); |
|
173 return (KErrNone); |
|
174 } |
|
175 |
|
176 void CTestInCall::SpecificAlgorithmL(TInt /* aParam */) |
|
177 { |
|
178 } |
|
179 |
|
180 void CTestInCall::Complete(TInt aError) |
|
181 { |
|
182 iReturnValue = aError; |
|
183 CActiveScheduler::Stop(); |
|
184 } |