|
1 // Copyright (c) 1997-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 // This file implements a two fax reception test scenario. |
|
15 // See CDataCall.cpp for fully documented test scenario. |
|
16 // |
|
17 // |
|
18 |
|
19 /** |
|
20 @file |
|
21 */ |
|
22 |
|
23 #include <e32test.h> |
|
24 #include <etelmm.h> |
|
25 #include <faxstd.h> |
|
26 #include "Te_LoopBackctwofaxrx.h" |
|
27 #include "../../hayes/TSYCONFG.H" // for KInternetAccessPoint |
|
28 |
|
29 // |
|
30 // Test-side class |
|
31 // With the assistance of the base class, this class must start the emulator |
|
32 // and drive the ETel API. |
|
33 // |
|
34 CTestDriveTwoFaxRx* CTestDriveTwoFaxRx::NewL(const TScriptList aScriptListEntry) |
|
35 { |
|
36 CTestDriveTwoFaxRx* aA=new(ELeave) CTestDriveTwoFaxRx(aScriptListEntry); |
|
37 CleanupStack::PushL(aA); |
|
38 aA->ConstructL(); |
|
39 CleanupStack::Pop(); |
|
40 return aA; |
|
41 } |
|
42 |
|
43 CTestDriveTwoFaxRx::CTestDriveTwoFaxRx(const TScriptList aScriptListEntry) : iScriptListEntry(aScriptListEntry) |
|
44 {} |
|
45 |
|
46 TInt CTestDriveTwoFaxRx::RunTestL() |
|
47 { |
|
48 iCurrentScript=iScriptListEntry; |
|
49 return StartEmulatorL(); |
|
50 } |
|
51 |
|
52 TInt CTestDriveTwoFaxRx::DriveETelApiL() |
|
53 // |
|
54 // This function contains the real meat of the Client-side test code |
|
55 // |
|
56 { |
|
57 _LIT(KFaxLineName,"Fax"); |
|
58 |
|
59 RLine faxLine; |
|
60 INFO_PRINTF1(_L("Opening Fax Line\n")); |
|
61 TESTL(faxLine.Open(iPhone,KFaxLineName)==KErrNone); |
|
62 |
|
63 TRequestStatus stat1,stat2,reqStatus; |
|
64 RMobilePhone::TMMTableSettings tableSettings; |
|
65 tableSettings.iLocId=KInternetAccessPoint; |
|
66 RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings); |
|
67 iPhone.InitialiseMM(reqStatus , tableSettingsPckg); |
|
68 User::WaitForRequest(reqStatus); |
|
69 TESTL(reqStatus == KErrNone); |
|
70 |
|
71 // Now wait for an incoming fax call... |
|
72 INFO_PRINTF1(_L("Waiting for an incoming fax call\n")); |
|
73 TName callName; |
|
74 faxLine.NotifyIncomingCall(stat1,callName); |
|
75 User::WaitForRequest(stat1); |
|
76 TESTL(stat1==KErrNone); |
|
77 |
|
78 RCall faxCall; |
|
79 INFO_PRINTF1(_L("Opening Fax Call to answer\n")); |
|
80 TESTL(faxCall.OpenNewCall(faxLine)==KErrNone); |
|
81 |
|
82 INFO_PRINTF1(_L("Answering a Fax Call\n")); |
|
83 RCall::TFaxSessionSettings faxSessionSettings; |
|
84 faxSessionSettings.iMode=RCall::EReceive; |
|
85 faxSessionSettings.iFaxRetrieveType=RCall::EFaxOnDemand; |
|
86 faxSessionSettings.iFaxClass=EClassAuto; |
|
87 faxSessionSettings.iFaxId.Zero(); |
|
88 faxSessionSettings.iMaxSpeed=14400; |
|
89 faxSessionSettings.iMinSpeed=12000; |
|
90 faxSessionSettings.iRxResolution=EFaxNormal; |
|
91 faxSessionSettings.iRxCompression=EModifiedHuffman; |
|
92 faxCall.SetFaxSettings(faxSessionSettings); |
|
93 faxCall.AnswerIncomingCall(stat2); |
|
94 User::WaitForRequest(stat2); |
|
95 TESTL(stat2==KFaxErrReceiveTimeout); // We don't actually send any data |
|
96 User::After(300000L); |
|
97 TESTL(faxCall.HangUp()==KErrNone); |
|
98 faxCall.Close(); |
|
99 |
|
100 // Now wait for a second incoming fax call... |
|
101 INFO_PRINTF1(_L("Waiting for a second incoming fax call\n")); |
|
102 TName callName2; |
|
103 faxLine.NotifyIncomingCall(stat1,callName2); |
|
104 User::WaitForRequest(stat1); |
|
105 TESTL(stat1==KErrNone); |
|
106 |
|
107 RCall faxCall2; |
|
108 INFO_PRINTF1(_L("Opening Fax Call to answer\n")); |
|
109 TESTL(faxCall2.OpenNewCall(faxLine)==KErrNone); |
|
110 |
|
111 INFO_PRINTF1(_L("Answering a Fax Call\n")); |
|
112 faxSessionSettings.iMode=RCall::EReceive; |
|
113 faxSessionSettings.iFaxRetrieveType=RCall::EFaxOnDemand; |
|
114 faxSessionSettings.iFaxClass=EClassAuto; |
|
115 faxSessionSettings.iFaxId.Zero(); |
|
116 faxSessionSettings.iMaxSpeed=14400; |
|
117 faxSessionSettings.iMinSpeed=12000; |
|
118 faxSessionSettings.iRxResolution=EFaxNormal; |
|
119 faxSessionSettings.iRxCompression=EModifiedHuffman; |
|
120 faxCall2.SetFaxSettings(faxSessionSettings); |
|
121 faxCall2.AnswerIncomingCall(stat2); |
|
122 User::WaitForRequest(stat2); |
|
123 TESTL(stat2==KFaxErrReceiveTimeout); // We don't actually send any data |
|
124 User::After(300000L); |
|
125 TESTL(faxCall2.HangUp()==KErrNone); |
|
126 faxCall2.Close(); |
|
127 |
|
128 faxLine.Close(); |
|
129 return KErrNone; |
|
130 } |
|
131 |
|
132 // |
|
133 // Emulator-side class |
|
134 // With the assistance of the base class, this class must run the designated script |
|
135 // |
|
136 CTestTwoFaxRx* CTestTwoFaxRx::NewL(const TScript* aScript) |
|
137 { |
|
138 CTestTwoFaxRx* aA=new(ELeave) CTestTwoFaxRx(aScript); |
|
139 CleanupStack::PushL(aA); |
|
140 aA->ConstructL(); |
|
141 CleanupStack::Pop(); |
|
142 return aA; |
|
143 } |
|
144 |
|
145 CTestTwoFaxRx::CTestTwoFaxRx(const TScript* aScript) : iScript(aScript) |
|
146 {} |
|
147 |
|
148 void CTestTwoFaxRx::ConstructL() |
|
149 { |
|
150 CATScriptEng::ConstructL(); |
|
151 } |
|
152 |
|
153 TInt CTestTwoFaxRx::Start() |
|
154 { |
|
155 StartScript(iScript); |
|
156 return KErrNone; |
|
157 } |
|
158 |
|
159 void CTestTwoFaxRx::SpecificAlgorithmL(TInt /* aParam */) |
|
160 { |
|
161 } |
|
162 |
|
163 void CTestTwoFaxRx::Complete(TInt aError) |
|
164 { |
|
165 iReturnValue=aError; |
|
166 CActiveScheduler::Stop(); |
|
167 } |