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