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_SimVoiceTestStepBase.h"
|
|
17 |
|
|
18 |
TVerdict CSimVoiceTestStepBase::doTestStepPreambleL()
|
|
19 |
{
|
|
20 |
__UHEAP_MARK;
|
|
21 |
|
|
22 |
TInt ret = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTestNumber, 0);
|
|
23 |
if (ret != KErrNone)
|
|
24 |
{
|
|
25 |
INFO_PRINTF1(_L("Failed resetting"));
|
|
26 |
User::Leave(ret);
|
|
27 |
}
|
|
28 |
|
|
29 |
ret = iTelServer.Connect();
|
|
30 |
if (ret!=KErrNone)
|
|
31 |
{
|
|
32 |
INFO_PRINTF1(_L("Failed to connect to telephony server"));
|
|
33 |
User::Leave(ret);
|
|
34 |
}
|
|
35 |
ret=iTelServer.LoadPhoneModule(KSimtsyName);
|
|
36 |
if (ret!=KErrNone)
|
|
37 |
{
|
|
38 |
INFO_PRINTF1(_L("Failed to load phone module"));
|
|
39 |
iTelServer.Close();
|
|
40 |
User::Leave(ret);
|
|
41 |
}
|
|
42 |
|
|
43 |
ret=iPhone.Open(iTelServer,KPhoneName) ;
|
|
44 |
if (ret!=KErrNone)
|
|
45 |
{
|
|
46 |
INFO_PRINTF1(_L("Failed to open phone module"));
|
|
47 |
iTelServer.UnloadPhoneModule(KSimtsyName);
|
|
48 |
iTelServer.Close();
|
|
49 |
User::Leave(ret);
|
|
50 |
}
|
|
51 |
ret=iPhone.Initialise();
|
|
52 |
if (ret!=KErrNone)
|
|
53 |
{
|
|
54 |
INFO_PRINTF1(_L("Failed to initialise the phone"));
|
|
55 |
iPhone.Close();
|
|
56 |
iTelServer.UnloadPhoneModule(KSimtsyName);
|
|
57 |
iTelServer.Close();
|
|
58 |
User::Leave(ret);
|
|
59 |
}
|
|
60 |
|
|
61 |
RPhone::TCaps phoneCaps;
|
|
62 |
ret = iPhone.GetCaps(phoneCaps) ;
|
|
63 |
if ((KErrNone != ret) || !(phoneCaps.iFlags & RPhone::KCapsVoice))
|
|
64 |
{
|
|
65 |
INFO_PRINTF2(_L("This phone does not support Voice Calls (caps=0x%x)"), phoneCaps.iFlags);
|
|
66 |
iPhone.Close();
|
|
67 |
iTelServer.UnloadPhoneModule(KSimtsyName);
|
|
68 |
iTelServer.Close();
|
|
69 |
User::Leave(ret);
|
|
70 |
}
|
|
71 |
|
|
72 |
return TestStepResult();
|
|
73 |
}
|
|
74 |
|
|
75 |
TVerdict CSimVoiceTestStepBase::doTestStepPostambleL()
|
|
76 |
{
|
|
77 |
iPhone.Close();
|
|
78 |
iTelServer.UnloadPhoneModule(KSimtsyName);
|
|
79 |
iTelServer.Close();
|
|
80 |
|
|
81 |
__UHEAP_MARKEND;
|
|
82 |
return TestStepResult();
|
|
83 |
}
|
|
84 |
|
|
85 |
void CSimVoiceTestStepBase::SetState(TInt aState)
|
|
86 |
{
|
|
87 |
iState = aState;
|
|
88 |
}
|
|
89 |
|
|
90 |
void CSimVoiceTestStepBase::WaitWithTimeout(TRequestStatus& aStatus, TInt aNumberOfMicroSeconds)
|
|
91 |
/**
|
|
92 |
* Timeout function
|
|
93 |
*/
|
|
94 |
{
|
|
95 |
TRequestStatus timerStatus;
|
|
96 |
RTimer timer ;
|
|
97 |
timer.CreateLocal() ;
|
|
98 |
timer.After(timerStatus,aNumberOfMicroSeconds);
|
|
99 |
|
|
100 |
User::WaitForRequest(aStatus, timerStatus);
|
|
101 |
if (timerStatus == KRequestPending)
|
|
102 |
{
|
|
103 |
timer.Cancel();
|
|
104 |
User::WaitForRequest(timerStatus);
|
|
105 |
}
|
|
106 |
else
|
|
107 |
{
|
|
108 |
INFO_PRINTF1(_L("Time is over!!!")) ;
|
|
109 |
}
|
|
110 |
timer.Close() ;
|
|
111 |
}
|
|
112 |
|
|
113 |
|
|
114 |
void CSimVoiceTestStepBase::GetGoodNumber(TDes& aNum)
|
|
115 |
/**Returns string with number for outgoing call.
|
|
116 |
* For.ex Good number is 179 Vodaphone test line - recorded message.
|
|
117 |
* Function tries to read value of switch /modem, otherwise it use defualt value.
|
|
118 |
* @return phone number string
|
|
119 |
* @note have to be updated to read information from cmd line or config. file
|
|
120 |
*/
|
|
121 |
{
|
|
122 |
aNum.Copy(KGoodNumber) ;
|
|
123 |
}
|
|
124 |
|
|
125 |
TInt CSimVoiceTestStepBase::CallMeDear()
|
|
126 |
/**
|
|
127 |
* Asks for incomming call
|
|
128 |
* @return KErrNone if could make it
|
|
129 |
*/
|
|
130 |
{
|
|
131 |
TInt ret = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyIncomingVoiceCall, iState);
|
|
132 |
INFO_PRINTF2(_L("Set Incoming Call Publish & Subscribe property result: %d"),ret) ;
|
|
133 |
return ret;
|
|
134 |
}
|
|
135 |
|
|
136 |
TInt CSimVoiceTestStepBase::HangMeUpDear()
|
|
137 |
/**
|
|
138 |
* Asks for remote hangup
|
|
139 |
* @return KErrNone if could make it
|
|
140 |
*/
|
|
141 |
{
|
|
142 |
TInt ret = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyRemoteHangup, iState);
|
|
143 |
INFO_PRINTF2(_L("Set Remote Hangup Publish & Subscribe property result: %d"),ret) ;
|
|
144 |
return ret;
|
|
145 |
}
|
|
146 |
|
|
147 |
void CSimVoiceTestStepBase::Print_RCall_TStatus(RCall::TStatus& aArg)
|
|
148 |
|
|
149 |
/** Display value of enum RCall::TStatus to screen.
|
|
150 |
* @param value to print
|
|
151 |
*/
|
|
152 |
{
|
|
153 |
switch(aArg)
|
|
154 |
{
|
|
155 |
case RCall::EStatusUnknown:
|
|
156 |
INFO_PRINTF1(_L("Value of enum is RCall::EStatusUnknown")) ;
|
|
157 |
break ;
|
|
158 |
case RCall::EStatusIdle:
|
|
159 |
INFO_PRINTF1(_L("Value of enum is RCall::EStatusIdle")) ;
|
|
160 |
break ;
|
|
161 |
case RCall::EStatusDialling:
|
|
162 |
INFO_PRINTF1(_L("Value of enum is RCall::EStatusDialling")) ;
|
|
163 |
break ;
|
|
164 |
case RCall::EStatusRinging:
|
|
165 |
INFO_PRINTF1(_L("Value of enum is RCall::EStatusRinging")) ;
|
|
166 |
break ;
|
|
167 |
case RCall::EStatusAnswering:
|
|
168 |
INFO_PRINTF1(_L("Value of enum is RCall::EStatusAnswering")) ;
|
|
169 |
break ;
|
|
170 |
case RCall::EStatusConnecting:
|
|
171 |
INFO_PRINTF1(_L("Value of enum is RCall::EStatusConnecting")) ;
|
|
172 |
break ;
|
|
173 |
case RCall::EStatusConnected:
|
|
174 |
INFO_PRINTF1(_L("Value of enum is RCall::EStatusConnected")) ;
|
|
175 |
break ;
|
|
176 |
case RCall::EStatusHangingUp:
|
|
177 |
INFO_PRINTF1(_L("Value of enum is RCall::EStatusHangingUp")) ;
|
|
178 |
break ;
|
|
179 |
}
|
|
180 |
}
|
|
181 |
|
|
182 |
void CSimVoiceTestStepBase::Print_RLine_TCapsFlags(RLine::TCapsFlags& aArg)
|
|
183 |
/** Display value of enum RLine::TCapsFlags to screen.
|
|
184 |
* @param value to print
|
|
185 |
*/
|
|
186 |
{
|
|
187 |
if(aArg & RLine::KCapsData)
|
|
188 |
{
|
|
189 |
INFO_PRINTF1(_L("value is TCapsFlags::KCapsData")) ;
|
|
190 |
}
|
|
191 |
if(aArg & RLine::KCapsFax)
|
|
192 |
{
|
|
193 |
INFO_PRINTF1(_L("value is TCapsFlags::KCapsFax")) ;
|
|
194 |
}
|
|
195 |
if(aArg & RLine::KCapsVoice)
|
|
196 |
{
|
|
197 |
INFO_PRINTF1(_L("value is TCapsFlags::KCapsVoice")) ;
|
|
198 |
}
|
|
199 |
if(aArg & RLine::KCapsEventIncomingCall)
|
|
200 |
{
|
|
201 |
INFO_PRINTF1(_L("value is TCapsFlags::KCapsEventIncomingCall")) ;
|
|
202 |
}
|
|
203 |
}
|
|
204 |
|
|
205 |
void CSimVoiceTestStepBase::Print_TCapsEnum(RCall::TCaps& aArg)
|
|
206 |
/** Display value of enum RCall::TCapsEnum to screen.
|
|
207 |
* @param value to print
|
|
208 |
*/
|
|
209 |
{
|
|
210 |
if(aArg.iFlags & RCall::KCapsData)
|
|
211 |
{
|
|
212 |
INFO_PRINTF1(_L("Has a flag TCapsEnum::KCapsData")) ;
|
|
213 |
}
|
|
214 |
if(aArg.iFlags & RCall::KCapsFax)
|
|
215 |
{
|
|
216 |
INFO_PRINTF1(_L("Has a flag TCapsEnum::KCapsFax")) ;
|
|
217 |
}
|
|
218 |
if(aArg.iFlags & RCall::KCapsVoice)
|
|
219 |
{
|
|
220 |
INFO_PRINTF1(_L("Has a flag TCapsEnum::KCapsVoice")) ;
|
|
221 |
}
|
|
222 |
if(aArg.iFlags & RCall::KCapsDial)
|
|
223 |
{
|
|
224 |
INFO_PRINTF1(_L("Has a flag TCapsEnum::KCapsDial")) ;
|
|
225 |
}
|
|
226 |
if(aArg.iFlags & RCall::KCapsConnect)
|
|
227 |
{
|
|
228 |
INFO_PRINTF1(_L("Has a flag TCapsEnum::KCapsConnect")) ;
|
|
229 |
}
|
|
230 |
if(aArg.iFlags & RCall::KCapsHangUp)
|
|
231 |
{
|
|
232 |
INFO_PRINTF1(_L("Has a flag TCapsEnum::KCapsHangUp")) ;
|
|
233 |
}
|
|
234 |
if(aArg.iFlags & RCall::KCapsAnswer)
|
|
235 |
{
|
|
236 |
INFO_PRINTF1(_L("Has a flag TCapsEnum::KCapsAnswer")) ;
|
|
237 |
}
|
|
238 |
if(aArg.iFlags & RCall::KCapsLoanDataPort)
|
|
239 |
{
|
|
240 |
INFO_PRINTF1(_L("Has a flag TCapsEnum::KCapsLoanDataPort")) ;
|
|
241 |
}
|
|
242 |
if(aArg.iFlags & RCall::KCapsRecoverDataPort)
|
|
243 |
{
|
|
244 |
INFO_PRINTF1(_L("Has a flag TCapsEnum::KCapsRecoverDataPort")) ;
|
|
245 |
}
|
|
246 |
}
|
|
247 |
|
|
248 |
void CSimVoiceTestStepBase::TestGetCallCapabilitiesL(RMobileCall& aCall)
|
|
249 |
/**
|
|
250 |
* call's capabilities to screen
|
|
251 |
* @test GT83-TVOICE-016.01 "Test retrieval of the current call status when the call's status is ""Unknown"""
|
|
252 |
* @test GT83-TVOICE-032.01 Test retrieval of the voice call's dynamic call control and call event capabilities. Display the call's capabilities to screen
|
|
253 |
*/
|
|
254 |
{
|
|
255 |
INFO_PRINTF1(_L("Test Call Capabilities"));
|
|
256 |
|
|
257 |
// Call Capabilities
|
|
258 |
RCall::TCaps callCaps;
|
|
259 |
TRAPD(ret, ret=aCall.GetCaps(callCaps));
|
|
260 |
CHECKPOINT(ret, KErrNone, _L("GT83-TVOICE-017.01")) ;
|
|
261 |
if (ret!=KErrNone)
|
|
262 |
{
|
|
263 |
INFO_PRINTF1(_L("Get Line Capabilities is NOT supported"));
|
|
264 |
}
|
|
265 |
else
|
|
266 |
{
|
|
267 |
Print_TCapsEnum(callCaps) ;
|
|
268 |
}
|
|
269 |
// Get the mobile call capabilities
|
|
270 |
RMobileCall::TMobileCallCapsV1 mobileCallCaps;
|
|
271 |
RMobileCall::TMobileCallCapsV1Pckg mobileCallCapsPckg(mobileCallCaps);
|
|
272 |
|
|
273 |
ret=aCall.GetMobileCallCaps(mobileCallCapsPckg);
|
|
274 |
CHECKPOINT(ret, KErrNone, _L("GT83-TVOICE-032.01.01")) ;
|
|
275 |
|
|
276 |
if (ret==KErrNotSupported)
|
|
277 |
{
|
|
278 |
INFO_PRINTF1(_L("Get Mobile Call Capabilities is NOT Supported"));
|
|
279 |
}
|
|
280 |
|
|
281 |
if (ret==KErrNone)
|
|
282 |
{
|
|
283 |
INFO_PRINTF1(_L("Get Mobile Call Capabilities is Successful"));
|
|
284 |
PrintCallCaps(mobileCallCaps.iCallControlCaps);
|
|
285 |
}
|
|
286 |
}
|
|
287 |
|
|
288 |
void CSimVoiceTestStepBase::PrintCallCaps(TUint32 aCaps)
|
|
289 |
{
|
|
290 |
if ((aCaps&RCall::KCapsData) !=0)
|
|
291 |
{
|
|
292 |
INFO_PRINTF1(_L("This call supports Data calls"));
|
|
293 |
}
|
|
294 |
if ((aCaps&RCall::KCapsFax) !=0)
|
|
295 |
INFO_PRINTF1(_L("This call supports Fax calls"));
|
|
296 |
if ((aCaps&RCall::KCapsVoice) !=0)
|
|
297 |
INFO_PRINTF1(_L("This call supports Voice calls"));
|
|
298 |
if ((aCaps&RCall::KCapsDial) !=0)
|
|
299 |
INFO_PRINTF1(_L("The Dial Request is currently a valid action"));
|
|
300 |
if ((aCaps&RCall::KCapsConnect) !=0)
|
|
301 |
INFO_PRINTF1(_L("The Connect Request is currently a valid action"));
|
|
302 |
if ((aCaps&RCall::KCapsHangUp) !=0)
|
|
303 |
INFO_PRINTF1(_L("The HangUp Request is currently a valid action"));
|
|
304 |
if ((aCaps&RCall::KCapsAnswer) !=0)
|
|
305 |
INFO_PRINTF1(_L("The Answer Request is currently a valid action"));
|
|
306 |
if ((aCaps&RCall::KCapsLoanDataPort) !=0)
|
|
307 |
INFO_PRINTF1(_L("The LoanDataPort Request is currently a valid action"));
|
|
308 |
if ((aCaps&RCall::KCapsRecoverDataPort) !=0)
|
|
309 |
INFO_PRINTF1(_L("The RecoverDataPort Request is currently a valid action"));
|
|
310 |
}
|
|
311 |
|
|
312 |
void CSimVoiceTestStepBase::TestLineCapabilitiesL()
|
|
313 |
/**
|
|
314 |
* @test GT83-TVOICE-002.01 Test retrieval of a voice line's capabilities. Display the capabilities to screen
|
|
315 |
*/
|
|
316 |
{
|
|
317 |
INFO_PRINTF1(_L("Test Line Capabilities"));
|
|
318 |
|
|
319 |
// Line Capabilities
|
|
320 |
RLine::TCaps lineCaps;
|
|
321 |
TInt ret=iLine.GetCaps(lineCaps);
|
|
322 |
CHECKPOINT(ret, KErrNone, _L("GT83-TVOICE-002.01")) ;
|
|
323 |
if (ret!=KErrNone)
|
|
324 |
{
|
|
325 |
INFO_PRINTF1(_L("Get Line Capabilities is NOT supported"));
|
|
326 |
}
|
|
327 |
else
|
|
328 |
{
|
|
329 |
if ((lineCaps.iFlags&RLine::KCapsData) !=0)
|
|
330 |
{
|
|
331 |
INFO_PRINTF1(_L("This line supports Data connections"));
|
|
332 |
}
|
|
333 |
if ((lineCaps.iFlags&RLine::KCapsFax) !=0)
|
|
334 |
{
|
|
335 |
INFO_PRINTF1(_L("This line supports Fax connections"));
|
|
336 |
}
|
|
337 |
if ((lineCaps.iFlags&RLine::KCapsVoice) !=0)
|
|
338 |
{
|
|
339 |
INFO_PRINTF1(_L("This line supports Voice connections"));
|
|
340 |
}
|
|
341 |
if ((lineCaps.iFlags&RLine::KCapsEventIncomingCall) !=0)
|
|
342 |
{
|
|
343 |
INFO_PRINTF1(_L("This line supports Incoming Call Notification requests"));
|
|
344 |
}
|
|
345 |
}
|
|
346 |
}
|
|
347 |
|
|
348 |
void CSimVoiceTestStepBase::Print_TMobilePhoneModeCaps(RMobilePhone::TMobilePhoneModeCaps& aArg)
|
|
349 |
/** Display value of enum RMobilePhone::TMobilePhoneModeCaps to screen.
|
|
350 |
* @param value to print
|
|
351 |
*/
|
|
352 |
{
|
|
353 |
if(aArg & RMobilePhone::KCapsGsmSupported)
|
|
354 |
{
|
|
355 |
INFO_PRINTF1(_L("Has a flag TMobilePhoneModeCaps::KCapsGsmSupported")) ;
|
|
356 |
}
|
|
357 |
if(aArg & RMobilePhone::KCapsGprsSupported)
|
|
358 |
{
|
|
359 |
INFO_PRINTF1(_L("Has a flag TMobilePhoneModeCaps::KCapsGprsSupported")) ;
|
|
360 |
}
|
|
361 |
if(aArg & RMobilePhone::KCapsAmpsSupported)
|
|
362 |
{
|
|
363 |
INFO_PRINTF1(_L("Has a flag TMobilePhoneModeCaps::KCapsAmpsSupported")) ;
|
|
364 |
}
|
|
365 |
if(aArg & RMobilePhone::KCapsCdma95Supported)
|
|
366 |
{
|
|
367 |
INFO_PRINTF1(_L("Has a flag TMobilePhoneModeCaps::KCapsCdma95Supported")) ;
|
|
368 |
}
|
|
369 |
if(aArg & RMobilePhone::KCapsCdma2000Supported)
|
|
370 |
{
|
|
371 |
INFO_PRINTF1(_L("Has a flag TMobilePhoneModeCaps::KCapsCdma2000Supported")) ;
|
|
372 |
}
|
|
373 |
if(aArg & RMobilePhone::KCapsWcdmaSupported)
|
|
374 |
{
|
|
375 |
INFO_PRINTF1(_L("Has a flag TMobilePhoneModeCaps::KCapsWcdmaSupported")) ;
|
|
376 |
}
|
|
377 |
}
|