24
|
1 |
// Copyright (c) 2005-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 |
//
|
|
15 |
|
|
16 |
#include "Te_DataTestStepBase.h"
|
|
17 |
#include "Te_Data.h"
|
|
18 |
|
|
19 |
_LIT(KMmtsyName,"MM");
|
|
20 |
_LIT(KPhoneName,"GsmPhone1");
|
|
21 |
_LIT(KTestLocalNumber,"TestLocalPhoneSimNumber");
|
|
22 |
_LIT(KTestRemoteNumber,"TestRemotePhoneSimNumber");
|
|
23 |
_LIT(KTestGoodNumber,"TestGoodPhoneNumber");
|
|
24 |
_LIT(KGoodNumber,"1789");
|
|
25 |
_LIT(KLocalNumber, "01632960000") ;
|
|
26 |
_LIT(KRemoteNumber, "01632960000") ;
|
|
27 |
_LIT(KTSDataConfigFile,"Te_data.ini");
|
|
28 |
|
|
29 |
TVerdict CTestDataStep::doTestStepPreambleL()
|
|
30 |
{
|
|
31 |
__UHEAP_MARK;
|
|
32 |
|
|
33 |
TInt ret = iTelServer.Connect();
|
|
34 |
if (ret!=KErrNone)
|
|
35 |
{
|
|
36 |
INFO_PRINTF1(_L("Failed to connect to telephony server"));
|
|
37 |
User::Leave(ret);
|
|
38 |
}
|
|
39 |
ret=iTelServer.LoadPhoneModule(KMmtsyName);
|
|
40 |
if (ret!=KErrNone)
|
|
41 |
{
|
|
42 |
INFO_PRINTF1(_L("Failed to load phone module"));
|
|
43 |
iTelServer.Close();
|
|
44 |
User::Leave(ret);
|
|
45 |
}
|
|
46 |
ret=iPhone.Open(iTelServer,KPhoneName) ;
|
|
47 |
if (ret!=KErrNone)
|
|
48 |
{
|
|
49 |
INFO_PRINTF1(_L("Failed open phone module"));
|
|
50 |
iTelServer.UnloadPhoneModule(KMmtsyName);
|
|
51 |
iTelServer.Close();
|
|
52 |
User::Leave(ret);
|
|
53 |
}
|
|
54 |
//
|
|
55 |
// This test requires a mobile phone to be connected to the serial port
|
|
56 |
// specified in the .cfg file for the initialise below to work
|
|
57 |
//
|
|
58 |
ret=iPhone.Initialise();
|
|
59 |
if (ret!=KErrNone)
|
|
60 |
{
|
|
61 |
INFO_PRINTF2(_L("Failed to initialise the phone (%d)"), ret);
|
|
62 |
iPhone.Close();
|
|
63 |
iTelServer.UnloadPhoneModule(KMmtsyName);
|
|
64 |
iTelServer.Close();
|
|
65 |
User::Leave(ret);
|
|
66 |
}
|
|
67 |
RPhone::TCaps oPhoneCaps;
|
|
68 |
ret = iPhone.GetCaps(oPhoneCaps) ;
|
|
69 |
if ((KErrNone != ret) || !(oPhoneCaps.iFlags & RPhone::KCapsData))
|
|
70 |
{
|
|
71 |
INFO_PRINTF2(_L("This phone does not support data calls (caps=0x%x)"), oPhoneCaps.iFlags);
|
|
72 |
iPhone.Close();
|
|
73 |
iTelServer.UnloadPhoneModule(KMmtsyName);
|
|
74 |
iTelServer.Close();
|
|
75 |
User::Leave(ret);
|
|
76 |
}
|
|
77 |
|
|
78 |
return TestStepResult();
|
|
79 |
}
|
|
80 |
|
|
81 |
TVerdict CTestDataStep::doTestStepPostambleL()
|
|
82 |
{
|
|
83 |
iPhone.Close();
|
|
84 |
iTelServer.UnloadPhoneModule(KMmtsyName);
|
|
85 |
iTelServer.Close(); // disconnect from etel
|
|
86 |
|
|
87 |
__UHEAP_MARKEND;
|
|
88 |
return TestStepResult();
|
|
89 |
}
|
|
90 |
|
|
91 |
void CTestDataStep::WaitWithTimeoutL(TRequestStatus& aStatus, TInt aNumberOfMicroSeconds)
|
|
92 |
/**
|
|
93 |
* Timeout function
|
|
94 |
*/
|
|
95 |
{
|
|
96 |
TRequestStatus timerStatus;
|
|
97 |
RTimer timer ;
|
|
98 |
if(KErrNone != timer.CreateLocal())
|
|
99 |
return ;
|
|
100 |
CleanupClosePushL(timer);
|
|
101 |
|
|
102 |
timer.After(timerStatus,aNumberOfMicroSeconds);
|
|
103 |
|
|
104 |
User::WaitForRequest(aStatus, timerStatus);
|
|
105 |
if (timerStatus == KRequestPending)
|
|
106 |
{
|
|
107 |
timer.Cancel();
|
|
108 |
User::WaitForRequest(timerStatus);
|
|
109 |
}
|
|
110 |
else
|
|
111 |
{
|
|
112 |
INFO_PRINTF1(_L("Time is over!!!")) ;
|
|
113 |
}
|
|
114 |
|
|
115 |
CleanupStack::PopAndDestroy(); // timer
|
|
116 |
}
|
|
117 |
|
|
118 |
//
|
|
119 |
// CTestDataStep Implementation
|
|
120 |
//
|
|
121 |
|
|
122 |
|
|
123 |
CTestDataStep::CTestDataStep()
|
|
124 |
{}
|
|
125 |
|
|
126 |
|
|
127 |
void CTestDataStep::CleanUp(TAny *aPtr)
|
|
128 |
/**
|
|
129 |
* Calls iLine.Close() & iCall.Close in leave case.
|
|
130 |
* @param this poiter pass cleanup stack when calls the function
|
|
131 |
*/
|
|
132 |
{
|
|
133 |
CTestDataStep* ptr = ((CTestDataStep*)aPtr) ;
|
|
134 |
ptr->iDataCall.Close() ;
|
|
135 |
ptr->iLine.Close() ;
|
|
136 |
}
|
|
137 |
|
|
138 |
|
|
139 |
CTestDataStep::operator TCleanupItem()
|
|
140 |
/**
|
|
141 |
* Makes TCleanupItem from current instance of CTestDataStep
|
|
142 |
*/
|
|
143 |
{
|
|
144 |
return TCleanupItem(CTestDataStep::CleanUp,this);
|
|
145 |
}
|
|
146 |
|
|
147 |
void CTestDataStep::TestGetCallCapabilitiesL(RCall& aCall)
|
|
148 |
/**
|
|
149 |
* @test GT83-TDATA-016.01 Test retrieval of the call's capabilities. Display the call's capabilities to screen
|
|
150 |
*/
|
|
151 |
{
|
|
152 |
INFO_PRINTF1(_L("======Start test Test Call Capabilities"));
|
|
153 |
|
|
154 |
// Call Capabilities
|
|
155 |
RCall::TCaps callCaps;
|
|
156 |
TRAPD(ret, (ret=aCall.GetCaps(callCaps)));
|
|
157 |
CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-016.01 - *** Failed RCall::GetCaps() ***")) ;
|
|
158 |
if (ret==KErrNone)
|
|
159 |
Print_TCapsEnum(callCaps) ;
|
|
160 |
|
|
161 |
INFO_PRINTF1(_L("======End test ====="));
|
|
162 |
|
|
163 |
}
|
|
164 |
|
|
165 |
void CTestDataStep::TestLineCapabilitiesL(RMobileLine& aLine)
|
|
166 |
/**
|
|
167 |
* @test GT83-TDATA-002.01 Test retrieval of a data line's capabilities. Display the capabilities to screen
|
|
168 |
*/
|
|
169 |
{
|
|
170 |
INFO_PRINTF1(_L("======Start test Test Line Capabilities"));
|
|
171 |
|
|
172 |
// Line Capabilities
|
|
173 |
RLine::TCaps lineCaps;
|
|
174 |
TInt ret=aLine.GetCaps(lineCaps);
|
|
175 |
CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-002.01 - *** Failed RMobileLine::GetCaps() *** ")) ;
|
|
176 |
if (ret==KErrNone)
|
|
177 |
{
|
|
178 |
if ((lineCaps.iFlags&RLine::KCapsData) !=0)
|
|
179 |
{
|
|
180 |
INFO_PRINTF1(_L("This line supports Data connections"));
|
|
181 |
}
|
|
182 |
if ((lineCaps.iFlags&RLine::KCapsFax) !=0)
|
|
183 |
{
|
|
184 |
INFO_PRINTF1(_L("This line supports Fax connections"));
|
|
185 |
}
|
|
186 |
if ((lineCaps.iFlags&RLine::KCapsVoice) !=0)
|
|
187 |
{
|
|
188 |
INFO_PRINTF1(_L("This line supports Voice connections"));
|
|
189 |
}
|
|
190 |
if ((lineCaps.iFlags&RLine::KCapsEventIncomingCall) !=0)
|
|
191 |
{
|
|
192 |
INFO_PRINTF1(_L("This line supports Incoming Call Notification requests"));
|
|
193 |
}
|
|
194 |
}
|
|
195 |
INFO_PRINTF1(_L("======End test ====="));
|
|
196 |
}
|
|
197 |
|
|
198 |
|
|
199 |
void CTestDataStep::GetPhoneNumberL(TDes& aNum, EPhoneNumbers aPhoneType)
|
|
200 |
/** Returns string with number for outgoing call.
|
|
201 |
For.ex Good number is 1234 Vodaphone test line - recorded message.
|
|
202 |
Function tries to read value of switch /modem, otherwise it use defualt value.
|
|
203 |
@return phone number string
|
|
204 |
@note have to be updated to read information from cmd line or config. file
|
|
205 |
*/
|
|
206 |
{
|
|
207 |
// TPtrC oNum ;
|
|
208 |
|
|
209 |
// Read Te_data.ini and extract phone numbers.
|
|
210 |
CConfigParams* testConfigParams;
|
|
211 |
|
|
212 |
TBool configfileexist = EFalse;
|
|
213 |
|
|
214 |
testConfigParams = CConfigParams::NewL(KTSDataConfigFile());
|
|
215 |
CleanupStack::PushL(testConfigParams);
|
|
216 |
|
|
217 |
const TPtrC goodnumber = testConfigParams->FindAlphaVar(KTestGoodNumber, KNullDesC);
|
|
218 |
const TPtrC localnumber = testConfigParams->FindAlphaVar(KTestLocalNumber, KNullDesC);
|
|
219 |
const TPtrC remotenumber = testConfigParams->FindAlphaVar(KTestRemoteNumber, KNullDesC);
|
|
220 |
if(testConfigParams->ConfigFileExist())
|
|
221 |
{
|
|
222 |
configfileexist = ETrue;
|
|
223 |
}
|
|
224 |
switch(aPhoneType)
|
|
225 |
{
|
|
226 |
case EGood:
|
|
227 |
// if(GetStringFromConfig(KPhoneNumbersSection, KSwitchGood, oNum))
|
|
228 |
// {
|
|
229 |
// aNum.Copy(oNum) ;
|
|
230 |
// }
|
|
231 |
if(configfileexist)
|
|
232 |
{
|
|
233 |
aNum.Copy(goodnumber) ;
|
|
234 |
}
|
|
235 |
else
|
|
236 |
{
|
|
237 |
aNum.Copy(KGoodNumber) ;
|
|
238 |
}
|
|
239 |
break;
|
|
240 |
|
|
241 |
case ERemote:
|
|
242 |
// if(GetStringFromConfig(KPhoneNumbersSection, KRemoteNumber, oNum))
|
|
243 |
// {
|
|
244 |
// aNum.Copy(oNum) ;
|
|
245 |
// }
|
|
246 |
if(configfileexist)
|
|
247 |
{
|
|
248 |
aNum.Copy(remotenumber) ;
|
|
249 |
}
|
|
250 |
else
|
|
251 |
{
|
|
252 |
aNum.Copy(KRemoteNumber) ;
|
|
253 |
}
|
|
254 |
break;
|
|
255 |
|
|
256 |
case ELocal:
|
|
257 |
// if(GetStringFromConfig(KPhoneNumbersSection, KLocalNumber, oNum))
|
|
258 |
// {
|
|
259 |
// aNum.Copy(oNum) ;
|
|
260 |
// }
|
|
261 |
if(configfileexist)
|
|
262 |
{
|
|
263 |
aNum.Copy(localnumber) ;
|
|
264 |
}
|
|
265 |
else
|
|
266 |
{
|
|
267 |
aNum.Copy(KLocalNumber) ;
|
|
268 |
}
|
|
269 |
break;
|
|
270 |
|
|
271 |
default:
|
|
272 |
aNum.Copy(KGoodNumber) ;
|
|
273 |
break;
|
|
274 |
}
|
|
275 |
CleanupStack::PopAndDestroy(testConfigParams);
|
|
276 |
}
|
|
277 |
|
|
278 |
void CTestDataStep::TestLineCapabilitiesL()
|
|
279 |
/**
|
|
280 |
* @test GT83-TVOICE-002.01 Test retrieval of a voice line's capabilities. Display the capabilities to screen
|
|
281 |
*/
|
|
282 |
{
|
|
283 |
INFO_PRINTF1(_L("======Start test Test Line Capabilities"));
|
|
284 |
|
|
285 |
// Line Capabilities
|
|
286 |
RLine::TCaps lineCaps;
|
|
287 |
TInt ret=iLine.GetCaps(lineCaps);
|
|
288 |
CHECKPOINT(ret, KErrNone, _L("GT83-TVOICE-002.01 - *** Failed RMobileLine::GetCaps() *** ")) ;
|
|
289 |
if (ret!=KErrNone)
|
|
290 |
{
|
|
291 |
if ((lineCaps.iFlags&RLine::KCapsData) !=0)
|
|
292 |
{
|
|
293 |
INFO_PRINTF1(_L("This line supports Data connections"));
|
|
294 |
}
|
|
295 |
if ((lineCaps.iFlags&RLine::KCapsFax) !=0)
|
|
296 |
{
|
|
297 |
INFO_PRINTF1(_L("This line supports Fax connections"));
|
|
298 |
}
|
|
299 |
if ((lineCaps.iFlags&RLine::KCapsVoice) !=0)
|
|
300 |
{
|
|
301 |
INFO_PRINTF1(_L("This line supports Voice connections"));
|
|
302 |
}
|
|
303 |
if ((lineCaps.iFlags&RLine::KCapsEventIncomingCall) !=0)
|
|
304 |
{
|
|
305 |
INFO_PRINTF1(_L("This line supports Incoming Call Notification requests"));
|
|
306 |
}
|
|
307 |
}
|
|
308 |
INFO_PRINTF1(_L("======End test ====="));
|
|
309 |
}
|
|
310 |
|
|
311 |
|
|
312 |
void CTestDataStep::Print_RCall_TStatus(RCall::TStatus& aArg)
|
|
313 |
|
|
314 |
/** Display value of enum RCall::TStatus to screen.
|
|
315 |
* @param value to print
|
|
316 |
*/
|
|
317 |
{
|
|
318 |
switch(aArg)
|
|
319 |
{
|
|
320 |
case RCall::EStatusUnknown:
|
|
321 |
INFO_PRINTF1(_L("Value of enum is RCall::EStatusUnknown")) ;
|
|
322 |
break ;
|
|
323 |
case RCall::EStatusIdle:
|
|
324 |
INFO_PRINTF1(_L("Value of enum is RCall::EStatusIdle")) ;
|
|
325 |
break ;
|
|
326 |
case RCall::EStatusDialling:
|
|
327 |
INFO_PRINTF1(_L("Value of enum is RCall::EStatusDialling")) ;
|
|
328 |
break ;
|
|
329 |
case RCall::EStatusRinging:
|
|
330 |
INFO_PRINTF1(_L("Value of enum is RCall::EStatusRinging")) ;
|
|
331 |
break ;
|
|
332 |
case RCall::EStatusAnswering:
|
|
333 |
INFO_PRINTF1(_L("Value of enum is RCall::EStatusAnswering")) ;
|
|
334 |
break ;
|
|
335 |
case RCall::EStatusConnecting:
|
|
336 |
INFO_PRINTF1(_L("Value of enum is RCall::EStatusConnecting")) ;
|
|
337 |
break ;
|
|
338 |
case RCall::EStatusConnected:
|
|
339 |
INFO_PRINTF1(_L("Value of enum is RCall::EStatusConnected")) ;
|
|
340 |
break ;
|
|
341 |
case RCall::EStatusHangingUp:
|
|
342 |
INFO_PRINTF1(_L("Value of enum is RCall::EStatusHangingUp")) ;
|
|
343 |
break ;
|
|
344 |
}
|
|
345 |
}
|
|
346 |
|
|
347 |
void CTestDataStep::Print_TCapsEnum(RCall::TCaps& aArg)
|
|
348 |
/** Display value of enum RCall::TCapsEnum to screen.
|
|
349 |
* @param value to print
|
|
350 |
*/
|
|
351 |
{
|
|
352 |
if(aArg.iFlags & RCall::KCapsData)
|
|
353 |
{
|
|
354 |
INFO_PRINTF1(_L("Has a flag TCapsEnum::KCapsData")) ;
|
|
355 |
}
|
|
356 |
if(aArg.iFlags & RCall::KCapsFax)
|
|
357 |
{
|
|
358 |
INFO_PRINTF1(_L("Has a flag TCapsEnum::KCapsFax")) ;
|
|
359 |
}
|
|
360 |
if(aArg.iFlags & RCall::KCapsVoice)
|
|
361 |
{
|
|
362 |
INFO_PRINTF1(_L("Has a flag TCapsEnum::KCapsVoice")) ;
|
|
363 |
}
|
|
364 |
if(aArg.iFlags & RCall::KCapsDial)
|
|
365 |
{
|
|
366 |
INFO_PRINTF1(_L("Has a flag TCapsEnum::KCapsDial")) ;
|
|
367 |
}
|
|
368 |
if(aArg.iFlags & RCall::KCapsConnect)
|
|
369 |
{
|
|
370 |
INFO_PRINTF1(_L("Has a flag TCapsEnum::KCapsConnect")) ;
|
|
371 |
}
|
|
372 |
if(aArg.iFlags & RCall::KCapsHangUp)
|
|
373 |
{
|
|
374 |
INFO_PRINTF1(_L("Has a flag TCapsEnum::KCapsHangUp")) ;
|
|
375 |
}
|
|
376 |
if(aArg.iFlags & RCall::KCapsAnswer)
|
|
377 |
{
|
|
378 |
INFO_PRINTF1(_L("Has a flag TCapsEnum::KCapsAnswer")) ;
|
|
379 |
}
|
|
380 |
if(aArg.iFlags & RCall::KCapsLoanDataPort)
|
|
381 |
{
|
|
382 |
INFO_PRINTF1(_L("Has a flag TCapsEnum::KCapsLoanDataPort")) ;
|
|
383 |
}
|
|
384 |
if(aArg.iFlags & RCall::KCapsRecoverDataPort)
|
|
385 |
{
|
|
386 |
INFO_PRINTF1(_L("Has a flag TCapsEnum::KCapsRecoverDataPort")) ;
|
|
387 |
}
|
|
388 |
}
|