|
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_SimBasicVoiceTest.h" |
|
17 |
|
18 CSimBasicVoiceTest::CSimBasicVoiceTest() |
|
19 { |
|
20 SetTestStepName(_L("BasicVoiceTest")); |
|
21 } |
|
22 |
|
23 TVerdict CSimBasicVoiceTest::doTestStepL() |
|
24 { |
|
25 INFO_PRINTF1(_L("BeginBasicVoiceTest")); |
|
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 INFO_PRINTF1(_L("Test Idle Call State")); |
|
46 RMobileCall::TMobileCallStatus callStatus; |
|
47 TESTL(iCall.GetMobileCallStatus(callStatus)==KErrNone); |
|
48 TESTL(callStatus==RMobileCall::EStatusIdle); |
|
49 |
|
50 INFO_PRINTF1(_L("Test Idle Line State")); |
|
51 RMobileCall::TMobileCallStatus lineStatus; |
|
52 TESTL(iLine.GetMobileLineStatus(lineStatus)==KErrNone); |
|
53 TESTL(lineStatus==RMobileCall::EStatusIdle); |
|
54 |
|
55 TRequestStatus reqStatus0, reqStatus1, reqStatus2; |
|
56 iCall.NotifyMobileCallStatusChange(reqStatus0,callStatus); |
|
57 iLine.NotifyMobileLineStatusChange(reqStatus1,lineStatus); |
|
58 |
|
59 INFO_PRINTF2(_L("Dialling %S "),&KTelephoneNumber); |
|
60 iCall.Dial(reqStatus2,KTelephoneNumber); |
|
61 |
|
62 User::WaitForRequest(reqStatus0); // Wait for the Call Status Change notification |
|
63 TESTL(reqStatus0==KErrNone); |
|
64 TESTL(callStatus==RMobileCall::EStatusDialling); |
|
65 INFO_PRINTF1(_L("...Call State is Dialling")); |
|
66 |
|
67 User::WaitForRequest(reqStatus1); // Wait for the Line Status Change notification |
|
68 TESTL(reqStatus1==KErrNone); |
|
69 TESTL(lineStatus==RMobileCall::EStatusDialling); |
|
70 INFO_PRINTF1(_L("...Line State is Dialling")); |
|
71 |
|
72 iCall.NotifyMobileCallStatusChange(reqStatus0,callStatus); |
|
73 iLine.NotifyMobileLineStatusChange(reqStatus1,lineStatus); |
|
74 |
|
75 User::WaitForRequest(reqStatus0); // Wait for the Call Status Change notification |
|
76 TESTL(reqStatus0==KErrNone); |
|
77 TESTL(callStatus==RMobileCall::EStatusConnecting); |
|
78 INFO_PRINTF1(_L("...Call State is Connecting")); |
|
79 |
|
80 User::WaitForRequest(reqStatus1); // Wait for the Line Status Change notification |
|
81 TESTL(reqStatus1==KErrNone); |
|
82 TESTL(lineStatus==RMobileCall::EStatusConnecting); |
|
83 INFO_PRINTF1(_L("...Line State is Connecting")); |
|
84 |
|
85 iCall.NotifyMobileCallStatusChange(reqStatus0,callStatus); |
|
86 iLine.NotifyMobileLineStatusChange(reqStatus1,lineStatus); |
|
87 |
|
88 User::WaitForRequest(reqStatus2); |
|
89 TESTL(reqStatus2==KErrNone); |
|
90 User::WaitForRequest(reqStatus0); |
|
91 User::WaitForRequest(reqStatus1); |
|
92 TESTL(reqStatus0==KErrNone); |
|
93 TESTL(reqStatus1==KErrNone); |
|
94 TESTL(lineStatus==RMobileCall::EStatusConnected); |
|
95 TESTL(callStatus==RMobileCall::EStatusConnected); |
|
96 INFO_PRINTF1(_L("Connected")); |
|
97 |
|
98 INFO_PRINTF1(_L("Hanging up...")); |
|
99 TESTL(iCall.HangUp()==KErrNone); |
|
100 INFO_PRINTF1(_L("Disconnected")); |
|
101 |
|
102 iCall.Close(); |
|
103 iLine.Close(); |
|
104 iPhone.Close(); |
|
105 ASSERT(RThread().RequestCount()==0); |
|
106 |
|
107 return TestStepResult(); |
|
108 } |
|
109 |