|
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 // Test performing a premature closure on a fax session and witness the TSY's response |
|
15 // This file implements tests performing a premature closure of a fax session. |
|
16 // See CDataCall.cpp for fully documented test scenario. |
|
17 // |
|
18 // |
|
19 |
|
20 /** |
|
21 @file |
|
22 */ |
|
23 |
|
24 #include <e32test.h> |
|
25 #include <etelmm.h> |
|
26 #include <faxstd.h> |
|
27 #include "Te_Loopbackcfaxpremclose.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 CTestDrivePremClose* CTestDrivePremClose::NewL(const TScriptList aScriptListEntry) |
|
36 { |
|
37 CTestDrivePremClose* aA=new(ELeave) CTestDrivePremClose(aScriptListEntry); |
|
38 CleanupStack::PushL(aA); |
|
39 aA->ConstructL(); |
|
40 CleanupStack::Pop(); |
|
41 return aA; |
|
42 } |
|
43 |
|
44 CTestDrivePremClose::CTestDrivePremClose(const TScriptList aScriptListEntry) : iScriptListEntry(aScriptListEntry) |
|
45 {} |
|
46 |
|
47 TInt CTestDrivePremClose::RunTestL() |
|
48 { |
|
49 iCurrentScript=iScriptListEntry; |
|
50 return StartEmulatorL(); |
|
51 } |
|
52 |
|
53 TInt CTestDrivePremClose::DriveETelApiL() |
|
54 // |
|
55 // This function contains the real meat of the Client-side test code |
|
56 // |
|
57 { |
|
58 _LIT(KFaxLineName,"Fax"); |
|
59 _LIT(KMmPhoneName, "GsmPhone1"); |
|
60 RMobilePhone mmPhone; |
|
61 INFO_PRINTF1(_L("Opening Multimode Phone\n")); |
|
62 TESTL(mmPhone.Open(iServer,KMmPhoneName)==KErrNone); |
|
63 |
|
64 RLine faxLine; |
|
65 INFO_PRINTF1(_L("Opening Fax Line\n")); |
|
66 TESTL(faxLine.Open(iPhone,KFaxLineName)==KErrNone); |
|
67 RCall faxCall; |
|
68 INFO_PRINTF1(_L("Opening New fax Call\n")); |
|
69 TESTL(faxCall.OpenNewCall(faxLine)==KErrNone); |
|
70 |
|
71 TRequestStatus stat1,stat2,reqStatus; |
|
72 RMobilePhone::TMMTableSettings tableSettings; |
|
73 tableSettings.iLocId=KInternetAccessPoint; |
|
74 RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings); |
|
75 iPhone.InitialiseMM(reqStatus , tableSettingsPckg); |
|
76 User::WaitForRequest(reqStatus); |
|
77 TESTL(reqStatus == KErrNone); |
|
78 |
|
79 // Now wait for an incoming fax call... |
|
80 INFO_PRINTF1(_L("Answering a Fax Call\n")); |
|
81 RCall::TFaxSessionSettings faxSessionSettings; |
|
82 faxSessionSettings.iMode=RCall::EReceive; |
|
83 faxSessionSettings.iFaxRetrieveType=RCall::EFaxOnDemand; |
|
84 faxSessionSettings.iFaxClass=EClassAuto; |
|
85 faxSessionSettings.iFaxId.Zero(); |
|
86 faxSessionSettings.iMaxSpeed=14400; |
|
87 faxSessionSettings.iMinSpeed=12000; |
|
88 faxSessionSettings.iRxResolution=EFaxNormal; |
|
89 faxSessionSettings.iRxCompression=EModifiedHuffman; |
|
90 faxCall.SetFaxSettings(faxSessionSettings); |
|
91 faxCall.AnswerIncomingCall(stat2); |
|
92 User::After(50000000L); |
|
93 if (stat2!=KRequestPending) |
|
94 User::WaitForRequest(stat2); |
|
95 |
|
96 faxCall.Close(); |
|
97 |
|
98 TInt32 signalStrength=0; |
|
99 TInt8 bar=0; |
|
100 mmPhone.GetSignalStrength(stat1,signalStrength,bar); |
|
101 User::WaitForRequest(stat1); |
|
102 INFO_PRINTF2(_L("Signal Strength = %d\n"), signalStrength); |
|
103 TESTL(stat1 == KErrNone); |
|
104 TESTL(signalStrength == -51); |
|
105 |
|
106 mmPhone.Close(); |
|
107 faxLine.Close(); |
|
108 return KErrNone; |
|
109 } |
|
110 |
|
111 // |
|
112 // Test-side class |
|
113 // With the assistance of the base class, this class must start the emulator |
|
114 // and drive the ETel API. |
|
115 // |
|
116 CTestDrivePremCloseB* CTestDrivePremCloseB::NewL(const TScriptList aScriptListEntry) |
|
117 { |
|
118 CTestDrivePremCloseB* aA=new(ELeave) CTestDrivePremCloseB(aScriptListEntry); |
|
119 CleanupStack::PushL(aA); |
|
120 aA->ConstructL(); |
|
121 CleanupStack::Pop(); |
|
122 return aA; |
|
123 } |
|
124 |
|
125 CTestDrivePremCloseB::CTestDrivePremCloseB(const TScriptList aScriptListEntry) : iScriptListEntry(aScriptListEntry) {} |
|
126 |
|
127 TInt CTestDrivePremCloseB::RunTestL() |
|
128 { |
|
129 iCurrentScript=iScriptListEntry; |
|
130 return StartEmulatorL(); |
|
131 } |
|
132 |
|
133 TInt CTestDrivePremCloseB::DriveETelApiL() |
|
134 // |
|
135 // This function contains the real meat of the Client-side test code |
|
136 // |
|
137 { |
|
138 _LIT(KFaxLineName,"Fax"); |
|
139 _LIT(KMmPhoneName,"MmPhone1"); |
|
140 |
|
141 RMobilePhone mmPhone; |
|
142 INFO_PRINTF1(_L("Opening Multimode Phone\n")); |
|
143 TESTL(mmPhone.Open(iServer,KMmPhoneName)==KErrNone); |
|
144 |
|
145 RLine faxLine; |
|
146 INFO_PRINTF1(_L("Opening Fax Line\n")); |
|
147 TESTL(faxLine.Open(iPhone,KFaxLineName)==KErrNone); |
|
148 RCall faxCall; |
|
149 INFO_PRINTF1(_L("Opening New fax Call\n")); |
|
150 TESTL(faxCall.OpenNewCall(faxLine)==KErrNone); |
|
151 |
|
152 TRequestStatus stat1,stat2,reqStatus; |
|
153 RMobilePhone::TMMTableSettings tableSettings; |
|
154 tableSettings.iLocId=KInternetAccessPoint; |
|
155 RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings); |
|
156 iPhone.InitialiseMM(reqStatus , tableSettingsPckg); |
|
157 User::WaitForRequest(reqStatus); |
|
158 TESTL(reqStatus == KErrNone); |
|
159 |
|
160 // Now wait for an incoming fax call... |
|
161 INFO_PRINTF1(_L("Answering a Fax Call\n")); |
|
162 RCall::TFaxSessionSettings faxSessionSettings; |
|
163 faxSessionSettings.iMode=RCall::EReceive; |
|
164 faxSessionSettings.iFaxRetrieveType=RCall::EFaxOnDemand; |
|
165 faxSessionSettings.iFaxClass=EClassAuto; |
|
166 faxSessionSettings.iFaxId.Zero(); |
|
167 faxSessionSettings.iMaxSpeed=14400; |
|
168 faxSessionSettings.iMinSpeed=12000; |
|
169 faxSessionSettings.iRxResolution=EFaxNormal; |
|
170 faxSessionSettings.iRxCompression=EModifiedHuffman; |
|
171 faxCall.SetFaxSettings(faxSessionSettings); |
|
172 faxCall.AnswerIncomingCall(stat2); |
|
173 User::After(38000000L); // Wait for 38 secs to make sure the port is "access denied" |
|
174 |
|
175 RFax fax; |
|
176 fax.Open(faxCall); |
|
177 fax.TerminateFaxSession(); |
|
178 fax.Close(); |
|
179 |
|
180 faxCall.Close(); |
|
181 |
|
182 TInt32 signalStrength; |
|
183 TInt8 bar=0; |
|
184 mmPhone.GetSignalStrength(stat1,signalStrength,bar); |
|
185 |
|
186 User::WaitForRequest(stat1); |
|
187 INFO_PRINTF2(_L("Signal Strength = %d\n"), signalStrength); |
|
188 TESTL(signalStrength == -51); |
|
189 TESTL(stat1 == KErrNone); |
|
190 |
|
191 mmPhone.Close(); |
|
192 faxLine.Close(); |
|
193 return KErrNone; |
|
194 } |
|
195 |
|
196 // |
|
197 // Emulator-side class |
|
198 // With the assistance of the base class, this class must run the designated script |
|
199 // |
|
200 CTestPremClose* CTestPremClose::NewL(const TScript* aScript) |
|
201 { |
|
202 CTestPremClose* aA=new(ELeave) CTestPremClose(aScript); |
|
203 CleanupStack::PushL(aA); |
|
204 aA->ConstructL(); |
|
205 CleanupStack::Pop(); |
|
206 return aA; |
|
207 } |
|
208 |
|
209 CTestPremClose::CTestPremClose(const TScript* aScript) : iScript(aScript) |
|
210 {} |
|
211 |
|
212 void CTestPremClose::ConstructL() |
|
213 { |
|
214 CATScriptEng::ConstructL(); |
|
215 } |
|
216 |
|
217 TInt CTestPremClose::Start() |
|
218 { |
|
219 StartScript(iScript); |
|
220 return KErrNone; |
|
221 } |
|
222 |
|
223 void CTestPremClose::SpecificAlgorithmL(TInt /* aParam */) |
|
224 { |
|
225 } |
|
226 |
|
227 void CTestPremClose::Complete(TInt aError) |
|
228 { |
|
229 iReturnValue=aError; |
|
230 CActiveScheduler::Stop(); |
|
231 } |