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 trying to retrieve Signal Strength information while a fax is being received
|
|
15 |
// This file implements simultaneous retrieval of signal strength information and an incoming
|
|
16 |
// fax. Also, the test is repeated with retrieval of signal strength information and an incoming
|
|
17 |
// data call.
|
|
18 |
// See CDataCall.cpp for fully documented test scenario.
|
|
19 |
//
|
|
20 |
//
|
|
21 |
|
|
22 |
/**
|
|
23 |
@file
|
|
24 |
*/
|
|
25 |
|
|
26 |
#include <e32test.h>
|
|
27 |
#include <etelmm.h>
|
|
28 |
#include <et_clsvr.h>
|
|
29 |
|
|
30 |
|
|
31 |
#include "Te_LoopBackcssfax.h"
|
|
32 |
#include "../../hayes/TSYCONFG.H" // for KInternetAccessPoint
|
|
33 |
|
|
34 |
//
|
|
35 |
// Test-side class
|
|
36 |
// With the assistance of the base class, this class must start the emulator
|
|
37 |
// and drive the ETel API.
|
|
38 |
//
|
|
39 |
CTestDriveSsFax* CTestDriveSsFax::NewL(const TScriptList aScriptListEntry)
|
|
40 |
{
|
|
41 |
CTestDriveSsFax* aA=new(ELeave) CTestDriveSsFax(aScriptListEntry);
|
|
42 |
CleanupStack::PushL(aA);
|
|
43 |
aA->ConstructL();
|
|
44 |
CleanupStack::Pop();
|
|
45 |
return aA;
|
|
46 |
}
|
|
47 |
|
|
48 |
CTestDriveSsFax::CTestDriveSsFax(const TScriptList aScriptListEntry) : iScriptListEntry(aScriptListEntry)
|
|
49 |
{}
|
|
50 |
|
|
51 |
TInt CTestDriveSsFax::RunTestL()
|
|
52 |
{
|
|
53 |
iCurrentScript=iScriptListEntry;
|
|
54 |
return StartEmulatorL();
|
|
55 |
}
|
|
56 |
|
|
57 |
TInt CTestDriveSsFax::DriveETelApiL()
|
|
58 |
//
|
|
59 |
// This function contains the real meat of the Client-side test code
|
|
60 |
//
|
|
61 |
{
|
|
62 |
_LIT(KFaxLineName,"Fax");
|
|
63 |
_LIT(KMmPhoneName,"GsmPhone1");
|
|
64 |
|
|
65 |
RMobilePhone mmPhone;
|
|
66 |
INFO_PRINTF1(_L("Opening Multimode Phone\n"));
|
|
67 |
TESTL(mmPhone.Open(iServer,KMmPhoneName)==KErrNone);
|
|
68 |
|
|
69 |
RLine faxLine;
|
|
70 |
INFO_PRINTF1(_L("Opening Fax Line\n"));
|
|
71 |
TESTL(faxLine.Open(iPhone,KFaxLineName)==KErrNone);
|
|
72 |
RCall faxCall;
|
|
73 |
INFO_PRINTF1(_L("Opening New fax Call\n"));
|
|
74 |
TESTL(faxCall.OpenNewCall(faxLine)==KErrNone);
|
|
75 |
|
|
76 |
TRequestStatus stat1,stat2,reqStatus;
|
|
77 |
RMobilePhone::TMMTableSettings tableSettings;
|
|
78 |
tableSettings.iLocId=KInternetAccessPoint;
|
|
79 |
RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings);
|
|
80 |
iPhone.InitialiseMM(reqStatus , tableSettingsPckg);
|
|
81 |
User::WaitForRequest(reqStatus);
|
|
82 |
TESTL(reqStatus == KErrNone);
|
|
83 |
|
|
84 |
// Now wait for an incoming fax call...
|
|
85 |
INFO_PRINTF1(_L("Answering a Fax Call\n"));
|
|
86 |
RCall::TFaxSessionSettings faxSessionSettings;
|
|
87 |
faxSessionSettings.iMode=RCall::EReceive;
|
|
88 |
faxSessionSettings.iFaxRetrieveType=RCall::EFaxOnDemand;
|
|
89 |
faxSessionSettings.iFaxClass=EClassAuto;
|
|
90 |
faxSessionSettings.iFaxId.Zero();
|
|
91 |
faxSessionSettings.iMaxSpeed=14400;
|
|
92 |
faxSessionSettings.iMinSpeed=12000;
|
|
93 |
faxSessionSettings.iRxResolution=EFaxNormal;
|
|
94 |
faxSessionSettings.iRxCompression=EModifiedHuffman;
|
|
95 |
faxCall.SetFaxSettings(faxSessionSettings);
|
|
96 |
faxCall.AnswerIncomingCall(stat2);
|
|
97 |
User::After(2000000L); // Wait for a 2secs to make sure the port is "access denied"
|
|
98 |
|
|
99 |
INFO_PRINTF1(_L("Get Signal Strength\n"));
|
|
100 |
TInt32 signalStrength;
|
|
101 |
TInt8 bar=0;
|
|
102 |
mmPhone.GetSignalStrength(stat1,signalStrength,bar);
|
|
103 |
User::WaitForRequest(stat1);
|
|
104 |
TESTL(stat1==KErrAccessDenied); // The port is "access denied" by this time
|
|
105 |
|
|
106 |
User::WaitForRequest(stat2);
|
|
107 |
User::After(300000L);
|
|
108 |
TESTL(faxCall.HangUp()==KErrNone);
|
|
109 |
|
|
110 |
mmPhone.Close();
|
|
111 |
faxLine.Close();
|
|
112 |
faxCall.Close();
|
|
113 |
return KErrNone;
|
|
114 |
}
|
|
115 |
|
|
116 |
//
|
|
117 |
// Emulator-side class
|
|
118 |
// With the assistance of the base class, this class must run the designated script
|
|
119 |
//
|
|
120 |
CTestSsFax* CTestSsFax::NewL(const TScript* aScript)
|
|
121 |
{
|
|
122 |
CTestSsFax* aA=new(ELeave) CTestSsFax(aScript);
|
|
123 |
CleanupStack::PushL(aA);
|
|
124 |
aA->ConstructL();
|
|
125 |
CleanupStack::Pop();
|
|
126 |
return aA;
|
|
127 |
}
|
|
128 |
|
|
129 |
CTestSsFax::CTestSsFax(const TScript* aScript) : iScript(aScript)
|
|
130 |
{}
|
|
131 |
|
|
132 |
void CTestSsFax::ConstructL()
|
|
133 |
{
|
|
134 |
CATScriptEng::ConstructL();
|
|
135 |
}
|
|
136 |
|
|
137 |
TInt CTestSsFax::Start()
|
|
138 |
{
|
|
139 |
StartScript(iScript);
|
|
140 |
return KErrNone;
|
|
141 |
}
|
|
142 |
|
|
143 |
void CTestSsFax::SpecificAlgorithmL(TInt /* aParam */)
|
|
144 |
{
|
|
145 |
}
|
|
146 |
|
|
147 |
void CTestSsFax::Complete(TInt aError)
|
|
148 |
{
|
|
149 |
iReturnValue=aError;
|
|
150 |
CActiveScheduler::Stop();
|
|
151 |
}
|
|
152 |
|
|
153 |
//
|
|
154 |
// Test-side class
|
|
155 |
// With the assistance of the base class, this class must start the emulator
|
|
156 |
// and drive the ETel API.
|
|
157 |
//
|
|
158 |
|
|
159 |
class RSpecialCall : public RCall
|
|
160 |
{
|
|
161 |
public:
|
|
162 |
void RecoverDataPortAsync(TRequestStatus& aStatus);
|
|
163 |
};
|
|
164 |
|
|
165 |
void RSpecialCall::RecoverDataPortAsync(TRequestStatus& aStatus)
|
|
166 |
{
|
|
167 |
Blank(EEtelCallRecoverDataPort,aStatus);
|
|
168 |
}
|
|
169 |
|
|
170 |
CTestDriveSSData* CTestDriveSSData::NewL(const TScriptList aScriptListEntry)
|
|
171 |
{
|
|
172 |
CTestDriveSSData* aA=new(ELeave) CTestDriveSSData(aScriptListEntry);
|
|
173 |
CleanupStack::PushL(aA);
|
|
174 |
aA->ConstructL();
|
|
175 |
CleanupStack::Pop();
|
|
176 |
return aA;
|
|
177 |
}
|
|
178 |
|
|
179 |
CTestDriveSSData::CTestDriveSSData(const TScriptList aScriptListEntry) : iScriptListEntry(aScriptListEntry)
|
|
180 |
{}
|
|
181 |
|
|
182 |
TInt CTestDriveSSData::RunTestL()
|
|
183 |
{
|
|
184 |
iCurrentScript=iScriptListEntry;
|
|
185 |
return StartEmulatorL();
|
|
186 |
}
|
|
187 |
|
|
188 |
TInt CTestDriveSSData::DriveETelApiL()
|
|
189 |
//
|
|
190 |
// This function contains the real meat of the Client-side test code
|
|
191 |
//
|
|
192 |
{
|
|
193 |
_LIT(KDataLineName,"Data");
|
|
194 |
_LIT(KMmPhoneName,"GsmPhone1");
|
|
195 |
|
|
196 |
RMobilePhone mmPhone;
|
|
197 |
INFO_PRINTF1(_L("Opening Multimode Phone\n"));
|
|
198 |
TESTL(mmPhone.Open(iServer,KMmPhoneName)==KErrNone);
|
|
199 |
|
|
200 |
RLine line;
|
|
201 |
INFO_PRINTF1(_L("Opening Data Line\n"));
|
|
202 |
TESTL(line.Open(iPhone,KDataLineName)==KErrNone);
|
|
203 |
|
|
204 |
INFO_PRINTF1(_L("Opening New Data Call\n"));
|
|
205 |
RSpecialCall call;
|
|
206 |
TESTL(call.OpenNewCall(line)==KErrNone);
|
|
207 |
|
|
208 |
TRequestStatus stat,stat1,reqStatus;
|
|
209 |
|
|
210 |
RMobilePhone::TMMTableSettings tableSettings;
|
|
211 |
tableSettings.iLocId=KInternetAccessPoint;
|
|
212 |
RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings);
|
|
213 |
iPhone.InitialiseMM(reqStatus , tableSettingsPckg);
|
|
214 |
User::WaitForRequest(reqStatus);
|
|
215 |
TESTL(reqStatus == KErrNone);
|
|
216 |
|
|
217 |
_LIT(KDialString,"+1234");
|
|
218 |
TInt status = call.Dial(KDialString);
|
|
219 |
TESTL(status == KErrNone);
|
|
220 |
|
|
221 |
TInt32 signalStrength;
|
|
222 |
TInt8 bar = 0;
|
|
223 |
mmPhone.GetSignalStrength(stat1,signalStrength,bar);
|
|
224 |
|
|
225 |
RCall::TCommPort commPort;
|
|
226 |
TESTL(call.LoanDataPort(commPort)==KErrNone);
|
|
227 |
|
|
228 |
RCommServ cs;
|
|
229 |
TESTL(cs.Connect()==KErrNone);
|
|
230 |
|
|
231 |
RComm port;
|
|
232 |
TESTL(port.Open(cs,commPort.iPort,ECommShared)==KErrNone);
|
|
233 |
|
|
234 |
port.Write(stat,KDataSsWriteTestData);
|
|
235 |
User::WaitForRequest(stat);
|
|
236 |
TESTL(stat.Int()==KErrNone);
|
|
237 |
|
|
238 |
//-- a small delay between successive writes to the COM port
|
|
239 |
//-- I had to insert it to fix mistiming between script execution and sending AT-commands to modem
|
|
240 |
User::After(500000);
|
|
241 |
|
|
242 |
port.Write(stat,KDataSsWriteTestData);
|
|
243 |
User::WaitForRequest(stat);
|
|
244 |
TESTL(stat.Int()==KErrNone);
|
|
245 |
|
|
246 |
port.Close();
|
|
247 |
cs.Close();
|
|
248 |
|
|
249 |
call.RecoverDataPort();
|
|
250 |
|
|
251 |
User::After(500000L);
|
|
252 |
|
|
253 |
User::WaitForRequest(stat1); // Result of GetSignalStrength()
|
|
254 |
TESTL(stat1==KErrAccessDenied);
|
|
255 |
|
|
256 |
TESTL(call.HangUp()==KErrNone);
|
|
257 |
|
|
258 |
mmPhone.Close();
|
|
259 |
line.Close();
|
|
260 |
call.Close();
|
|
261 |
return KErrNone;
|
|
262 |
}
|
|
263 |
|
|
264 |
//
|
|
265 |
// Emulator-side class
|
|
266 |
// With the assistance of the base class, this class must run the designated script
|
|
267 |
//
|
|
268 |
CTestSSData* CTestSSData::NewL(const TScript* aScript)
|
|
269 |
{
|
|
270 |
CTestSSData* aA=new(ELeave) CTestSSData(aScript);
|
|
271 |
CleanupStack::PushL(aA);
|
|
272 |
aA->ConstructL();
|
|
273 |
CleanupStack::Pop();
|
|
274 |
return aA;
|
|
275 |
}
|
|
276 |
|
|
277 |
CTestSSData::CTestSSData(const TScript* aScript) : iScript(aScript)
|
|
278 |
{}
|
|
279 |
|
|
280 |
void CTestSSData::ConstructL()
|
|
281 |
{
|
|
282 |
CATScriptEng::ConstructL();
|
|
283 |
}
|
|
284 |
|
|
285 |
TInt CTestSSData::Start()
|
|
286 |
{
|
|
287 |
StartScript(iScript);
|
|
288 |
return KErrNone;
|
|
289 |
}
|
|
290 |
|
|
291 |
void CTestSSData::SpecificAlgorithmL(TInt /* aParam */)
|
|
292 |
{
|
|
293 |
}
|
|
294 |
|
|
295 |
void CTestSSData::Complete(TInt aError)
|
|
296 |
{
|
|
297 |
iReturnValue=aError;
|
|
298 |
CActiveScheduler::Stop();
|
|
299 |
}
|