|
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_SimVoiceTest.h" |
|
17 |
|
18 CSimVoiceTest::CSimVoiceTest() |
|
19 { |
|
20 SetTestStepName(_L("VoiceTest")); |
|
21 } |
|
22 |
|
23 TVerdict CSimVoiceTest::doTestStepL() |
|
24 { |
|
25 INFO_PRINTF1(_L("BeginVoiceTest")); |
|
26 |
|
27 CreateConfigFileL(_L("c:\\config3.txt")); |
|
28 SetTestNumberL(0); |
|
29 |
|
30 TInt ret = iPhone.Open(iTelServer,KPhoneName); |
|
31 INFO_PRINTF2(_L("Result: %d"),ret); |
|
32 TESTL(ret == KErrNone); |
|
33 INFO_PRINTF1(_L("Opened phone object")); |
|
34 |
|
35 TESTL(iPhone.Initialise()==KErrNone); |
|
36 INFO_PRINTF1(_L("Opened phone object")); |
|
37 |
|
38 TESTL(iLine.Open(iPhone,KVoiceLineName)==KErrNone); |
|
39 INFO_PRINTF1(_L("Opened Line object")); |
|
40 |
|
41 TName callName; |
|
42 TESTL(iCall.OpenNewCall(iLine,callName)==KErrNone); |
|
43 INFO_PRINTF1(_L("Opened Call object")); |
|
44 |
|
45 iLine.Close(); |
|
46 iCall.Close(); |
|
47 |
|
48 TESTL(iLine.Open(iPhone,KVoiceLineName)==KErrNone); |
|
49 INFO_PRINTF1(_L("Opened Line object")); |
|
50 |
|
51 TName callName2; |
|
52 TESTL(iCall.OpenNewCall(iLine,callName2)==KErrNone); |
|
53 INFO_PRINTF1(_L("Opened Call object")); |
|
54 |
|
55 INFO_PRINTF1(_L("Test Idle Call State")); |
|
56 RMobileCall::TMobileCallStatus callStatus; |
|
57 TESTL(iCall.GetMobileCallStatus(callStatus)==KErrNone); |
|
58 TESTL(callStatus==RMobileCall::EStatusIdle); |
|
59 |
|
60 INFO_PRINTF1(_L("Test Idle Line State")); |
|
61 RMobileCall::TMobileCallStatus lineStatus; |
|
62 TESTL(iLine.GetMobileLineStatus(lineStatus)==KErrNone); |
|
63 TESTL(lineStatus==RMobileCall::EStatusIdle); |
|
64 |
|
65 INFO_PRINTF1(_L("Test Call and Line Caps")); |
|
66 RCall::TCaps callCaps; |
|
67 TESTL(iCall.GetCaps(callCaps)==KErrNone); |
|
68 TESTL(callCaps.iFlags==KCallCaps); |
|
69 RLine::TCaps lineCaps; |
|
70 TESTL(iLine.GetCaps(lineCaps)==KErrNone); |
|
71 TESTL(lineCaps.iFlags==KLineCaps); |
|
72 RMobileCall::TMobileCallCapsV1 mobileCallCaps; |
|
73 RMobileCall::TMobileCallCapsV1Pckg mobileCallCapsPckg(mobileCallCaps); |
|
74 TESTL(iCall.GetMobileCallCaps(mobileCallCapsPckg)==KErrNone); |
|
75 TESTL(mobileCallCaps.iCallControlCaps==KCallCaps); |
|
76 TESTL(mobileCallCaps.iCallEventCaps==0); |
|
77 |
|
78 TRequestStatus reqStatus0, reqStatus1, reqStatus2, reqStatus3, reqStatus4; |
|
79 iCall.NotifyMobileCallStatusChange(reqStatus0,callStatus); |
|
80 iLine.NotifyMobileLineStatusChange(reqStatus1,lineStatus); |
|
81 |
|
82 INFO_PRINTF2(_L("Dialling %S "),&KTelephoneNumber); |
|
83 iCall.Dial(reqStatus2,KTelephoneNumber); |
|
84 |
|
85 User::WaitForRequest(reqStatus0); // Wait for the Call Status Change notification |
|
86 TESTL(reqStatus0==KErrNone); |
|
87 TESTL(callStatus==RMobileCall::EStatusDialling); |
|
88 INFO_PRINTF1(_L("...Call State is Dialling")); |
|
89 CHECKPOINTL(reqStatus0.Int(),KErrNone,CHP_VOICE_CASE("A.1")); |
|
90 |
|
91 User::WaitForRequest(reqStatus1); // Wait for the Line Status Change notification |
|
92 TESTL(reqStatus1==KErrNone); |
|
93 TESTL(lineStatus==RMobileCall::EStatusDialling); |
|
94 INFO_PRINTF1(_L("...Line State is Dialling")); |
|
95 |
|
96 iCall.NotifyMobileCallStatusChange(reqStatus0,callStatus); |
|
97 iLine.NotifyMobileLineStatusChange(reqStatus1,lineStatus); |
|
98 |
|
99 User::WaitForRequest(reqStatus0); // Wait for the Call Status Change notification |
|
100 TESTL(reqStatus0==KErrNone); |
|
101 TESTL(callStatus==RMobileCall::EStatusConnecting); |
|
102 INFO_PRINTF1(_L("...Call State is Connecting")); |
|
103 |
|
104 User::WaitForRequest(reqStatus1); // Wait for the Line Status Change notification |
|
105 TESTL(reqStatus1==KErrNone); |
|
106 TESTL(lineStatus==RMobileCall::EStatusConnecting); |
|
107 INFO_PRINTF1(_L("...Line State is Connecting")); |
|
108 |
|
109 iCall.NotifyCapsChange(reqStatus3,callCaps); |
|
110 iCall.NotifyMobileCallCapsChange(reqStatus4,mobileCallCapsPckg); |
|
111 |
|
112 iCall.NotifyMobileCallStatusChange(reqStatus0,callStatus); |
|
113 iLine.NotifyMobileLineStatusChange(reqStatus1,lineStatus); |
|
114 |
|
115 User::WaitForRequest(reqStatus2); |
|
116 TESTL(reqStatus2==KErrNone); |
|
117 User::WaitForRequest(reqStatus0); |
|
118 User::WaitForRequest(reqStatus1); |
|
119 TESTL(reqStatus0==KErrNone); |
|
120 TESTL(reqStatus1==KErrNone); |
|
121 TESTL(lineStatus==RMobileCall::EStatusConnected); |
|
122 TESTL(callStatus==RMobileCall::EStatusConnected); |
|
123 INFO_PRINTF1(_L("Connected")); |
|
124 |
|
125 INFO_PRINTF1(_L("Test Caps have changed dynamically")); |
|
126 User::WaitForRequest(reqStatus3); |
|
127 User::WaitForRequest(reqStatus4); |
|
128 TESTL(callCaps.iFlags & RCall::KCapsVoice); |
|
129 TESTL(callCaps.iFlags & RCall::KCapsHangUp); |
|
130 TESTL(mobileCallCaps.iCallEventCaps==0); |
|
131 |
|
132 INFO_PRINTF1(_L("Test Call Hold")); |
|
133 iCall.Hold(reqStatus0); |
|
134 User::WaitForRequest(reqStatus0); |
|
135 TESTL(reqStatus0==KErrNone); |
|
136 TESTL(iCall.GetMobileCallStatus(callStatus)==KErrNone); |
|
137 TESTL(callStatus==RMobileCall::EStatusHold); |
|
138 CHECKPOINTL(reqStatus0.Int(),KErrNone,CHP_VOICE_CASE("A.3")); |
|
139 |
|
140 INFO_PRINTF1(_L("Test Call Resume")); |
|
141 iCall.Resume(reqStatus0); |
|
142 User::WaitForRequest(reqStatus0); |
|
143 TESTL(reqStatus0==KErrNone); |
|
144 TESTL(iCall.GetMobileCallStatus(callStatus)==KErrNone); |
|
145 TESTL(callStatus==RMobileCall::EStatusConnected); |
|
146 CHECKPOINTL(reqStatus0.Int(),KErrNone,CHP_VOICE_CASE("A.122")); |
|
147 |
|
148 INFO_PRINTF1(_L("Test Call Swap")); |
|
149 iCall.Swap(reqStatus0); |
|
150 User::WaitForRequest(reqStatus0); |
|
151 TESTL(reqStatus0==KErrNone); |
|
152 TESTL(iCall.GetMobileCallStatus(callStatus)==KErrNone); |
|
153 TESTL(callStatus==RMobileCall::EStatusHold); |
|
154 iCall.Swap(reqStatus0); |
|
155 User::WaitForRequest(reqStatus0); |
|
156 TESTL(reqStatus0==KErrNone); |
|
157 TESTL(iCall.GetMobileCallStatus(callStatus)==KErrNone); |
|
158 TESTL(callStatus==RMobileCall::EStatusConnected); |
|
159 |
|
160 RCall::THookStatus lineHookStatus; |
|
161 RCall::THookStatus callHookStatus; |
|
162 iCall.NotifyHookChange(reqStatus0,callHookStatus); |
|
163 iLine.NotifyHookChange(reqStatus1,lineHookStatus); |
|
164 INFO_PRINTF1(_L("Hanging up...")); |
|
165 TESTL(iCall.HangUp()==KErrNone); |
|
166 User::WaitForRequest(reqStatus0); |
|
167 User::WaitForRequest(reqStatus1); |
|
168 TESTL(callHookStatus==RCall::EHookStatusOn); |
|
169 TESTL(lineHookStatus==RCall::EHookStatusOn); |
|
170 CHECKPOINTL(reqStatus0.Int(),KErrNone,CHP_VOICE_CASE("A.2")); |
|
171 INFO_PRINTF1(_L("Disconnected")); |
|
172 |
|
173 TRequestStatus reqStatus = KErrNotReady; |
|
174 TName incomingCallName; |
|
175 TName callAdded; |
|
176 iLine.NotifyIncomingCall(reqStatus, incomingCallName); |
|
177 iLine.NotifyCallAdded(reqStatus0,callAdded); |
|
178 iLine.NotifyCapsChange(reqStatus1,lineCaps); |
|
179 |
|
180 TInt state = 999; |
|
181 INFO_PRINTF1(_L("Testing the Publish & Subscribe...")); |
|
182 RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyIncomingVoiceCall, state); |
|
183 |
|
184 User::WaitForRequest(reqStatus); |
|
185 if(reqStatus!=KErrNone) |
|
186 { |
|
187 INFO_PRINTF1(_L("Incoming voice call test failed...")); |
|
188 TESTL(reqStatus==KErrNone); // Force a failure... |
|
189 } |
|
190 |
|
191 User::WaitForRequest(reqStatus0); |
|
192 TESTL(reqStatus==KErrNone); |
|
193 TESTL(callAdded==incomingCallName); |
|
194 CHECKPOINTL(reqStatus.Int(),KErrNone,CHP_VOICE_CASE("A.4")); |
|
195 |
|
196 User::WaitForRequest(reqStatus1); |
|
197 TESTL(reqStatus1==KErrNone); |
|
198 TESTL(lineCaps.iFlags==RLine::KCapsVoice); |
|
199 |
|
200 TESTL(iCallAnswer.OpenExistingCall(iLine,incomingCallName)==KErrNone); |
|
201 |
|
202 INFO_PRINTF1(_L("Answering incoming call...")); |
|
203 ret = iCallAnswer.AnswerIncomingCall(); |
|
204 CHECKPOINTL(ret,KErrNone,CHP_VOICE_CASE("A.5")); |
|
205 INFO_PRINTF1(_L("Connected")); |
|
206 |
|
207 INFO_PRINTF1(_L("Hanging up...")); |
|
208 TESTL(iCallAnswer.HangUp()==KErrNone); |
|
209 INFO_PRINTF1(_L("Disconnected")); |
|
210 |
|
211 INFO_PRINTF1(_L("Closing objects...")); |
|
212 |
|
213 iCallAnswer.Close(); |
|
214 |
|
215 iCall.Close(); |
|
216 iLine.Close(); |
|
217 iPhone.Close(); |
|
218 ASSERT(RThread().RequestCount()==0); |
|
219 |
|
220 return TestStepResult(); |
|
221 } |
|
222 |