|
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_SimDtmfTest.h" |
|
17 |
|
18 CSimDtmfTest::CSimDtmfTest() |
|
19 { |
|
20 SetTestStepName(_L("DtmfTest")); |
|
21 } |
|
22 |
|
23 TVerdict CSimDtmfTest::doTestStepL() |
|
24 { |
|
25 INFO_PRINTF1(_L("BeginDtmfTest")); |
|
26 |
|
27 CreateConfigFileL(_L("c:\\config3.txt")); |
|
28 SetTestNumberL(0); |
|
29 |
|
30 _LIT(KDtmfString0,"45p6789ABCDp"); |
|
31 _LIT(KDtmfString1,"01w23"); |
|
32 |
|
33 TInt ret = iPhone.Open(iTelServer,KPhoneName); |
|
34 INFO_PRINTF2(_L("Result: %d"),ret); |
|
35 TESTL(ret == KErrNone); |
|
36 INFO_PRINTF1(_L("Opened phone object")); |
|
37 |
|
38 TESTL(iPhone.Initialise()==KErrNone); |
|
39 INFO_PRINTF1(_L("Opened phone object")); |
|
40 |
|
41 TESTL(iLine.Open(iPhone,KVoiceLineName)==KErrNone); |
|
42 INFO_PRINTF1(_L("Opened Line object")); |
|
43 |
|
44 TName callName; |
|
45 TESTL(iCall.OpenNewCall(iLine,callName)==KErrNone); |
|
46 INFO_PRINTF1(_L("Opened Call object")); |
|
47 |
|
48 TRequestStatus reqStatus0, reqStatus1; |
|
49 |
|
50 INFO_PRINTF2(_L("Dialling %S "),&KTelephoneNumber); |
|
51 iCall.Dial(reqStatus0,KTelephoneNumber); |
|
52 User::WaitForRequest(reqStatus0); // Wait for the Call Status Change notification |
|
53 TESTL(reqStatus0==KErrNone); |
|
54 INFO_PRINTF1(_L("...Call is Connected")); |
|
55 |
|
56 INFO_PRINTF1(_L("Testing an erroneous DTMF String Tx Continue")); |
|
57 TESTL(iPhone.ContinueDTMFStringSending(ETrue)==KErrNotReady); |
|
58 |
|
59 INFO_PRINTF1(_L("Test DTMF Caps")); |
|
60 TUint32 dtmfCaps; |
|
61 TESTL(iPhone.GetDTMFCaps(dtmfCaps)==KErrNone); |
|
62 TESTL(dtmfCaps==(RMobilePhone::KCapsSendDTMFString |
|
63 | RMobilePhone::KCapsSendDTMFSingleTone)); |
|
64 |
|
65 INFO_PRINTF1(_L("Test Send DTMF String")); |
|
66 iPhone.SendDTMFTones(reqStatus0,KDtmfString0); |
|
67 User::After(1000000); |
|
68 TChar character('1'); |
|
69 TESTL(iPhone.StartDTMFTone(character)==KErrInUse); |
|
70 User::After(1000000); |
|
71 TESTL(iPhone.StopDTMFTone()==KErrInUse); |
|
72 User::WaitForRequest(reqStatus0); |
|
73 TESTL(reqStatus0==KErrNone); |
|
74 |
|
75 INFO_PRINTF1(_L("Test Start & Stop DTMF Tone")); |
|
76 ret = iPhone.StartDTMFTone(character); |
|
77 CHECKPOINTL(ret,KErrNone,CHP_VOICE_CASE("A.8")); |
|
78 |
|
79 User::After(1000000); |
|
80 ret = iPhone.StopDTMFTone(); |
|
81 CHECKPOINTL(ret,KErrNone,CHP_VOICE_CASE("A.9")); |
|
82 |
|
83 INFO_PRINTF1(_L("Test Send DTMF String with wait & continue")); |
|
84 iPhone.NotifyStopInDTMFString(reqStatus1); |
|
85 iPhone.SendDTMFTones(reqStatus0,KDtmfString1); |
|
86 User::WaitForRequest(reqStatus1); |
|
87 TESTL(reqStatus1==KErrNone); |
|
88 |
|
89 ret = iPhone.ContinueDTMFStringSending(ETrue); |
|
90 CHECKPOINTL(ret,KErrNone,CHP_VOICE_CASE("A.11")); |
|
91 |
|
92 User::WaitForRequest(reqStatus0); |
|
93 TESTL(reqStatus0==KErrNone); |
|
94 CHECKPOINTL(reqStatus0,KErrNone,CHP_VOICE_CASE("A.10")); |
|
95 |
|
96 INFO_PRINTF1(_L("Test Send DTMF String with wait & terminate")); |
|
97 iPhone.NotifyStopInDTMFString(reqStatus1); |
|
98 iPhone.SendDTMFTones(reqStatus0,KDtmfString1); |
|
99 User::WaitForRequest(reqStatus1); |
|
100 TESTL(reqStatus1==KErrNone); |
|
101 ret = iPhone.ContinueDTMFStringSending(EFalse); |
|
102 CHECKPOINTL(ret,KErrNone,CHP_VOICE_CASE("A.12")); |
|
103 User::WaitForRequest(reqStatus0); |
|
104 TESTL(reqStatus0==KErrAccessDenied); |
|
105 |
|
106 INFO_PRINTF1(_L("Test Send DTMF String terminated early by a call closure")); |
|
107 iPhone.SendDTMFTones(reqStatus0,KDtmfString0); |
|
108 User::After(1000000); |
|
109 INFO_PRINTF1(_L("Hanging up...")); |
|
110 TESTL(iCall.HangUp()==KErrNone); |
|
111 User::WaitForRequest(reqStatus0); |
|
112 TESTL(reqStatus0==KErrEtelNoCarrier); |
|
113 CHECKPOINTL(reqStatus0,KErrEtelNoCarrier,CHP_VOICE_CASE("A.13")); |
|
114 |
|
115 INFO_PRINTF1(_L("Test Sending DTMF Strings while there is no active call.")); |
|
116 ret = iPhone.ContinueDTMFStringSending(ETrue); |
|
117 CHECKPOINTL(ret,KErrNotReady,CHP_VOICE_CASE("A.14")); |
|
118 |
|
119 iPhone.SendDTMFTones(reqStatus0,KDtmfString0); |
|
120 User::WaitForRequest(reqStatus0); |
|
121 TESTL(reqStatus0==KErrEtelCallNotActive); |
|
122 CHECKPOINTL(reqStatus0,KErrEtelCallNotActive,CHP_VOICE_CASE("A.15")); |
|
123 |
|
124 iCall.Close(); |
|
125 iLine.Close(); |
|
126 iPhone.Close(); |
|
127 ASSERT(RThread().RequestCount()==0); |
|
128 |
|
129 return TestStepResult(); |
|
130 } |
|
131 |