|
1 // Copyright (c) 2004-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 // Telephony Fax Test server test code. |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 #include "faxdefn.h" |
|
24 #include "FAXSET.H" |
|
25 #include "CFAX32.H" |
|
26 |
|
27 #include "TE_FaxServer.h" |
|
28 #include "TE_FaxTest.h" |
|
29 |
|
30 |
|
31 _LIT(KServerName,"TE_Fax"); |
|
32 |
|
33 |
|
34 /** |
|
35 * Called inside the MainL() function to create and start the CTestServer |
|
36 * derived server. |
|
37 * |
|
38 * @return Instance of the test server |
|
39 */ |
|
40 CFaxTestServer* CFaxTestServer::NewL() |
|
41 { |
|
42 CFaxTestServer* server = new(ELeave) CFaxTestServer(); |
|
43 CleanupStack::PushL(server); |
|
44 // CServer base class call |
|
45 server->StartL(KServerName); |
|
46 CleanupStack::Pop(server); |
|
47 return server; |
|
48 } // CFaxTestIntServer::NewL |
|
49 |
|
50 |
|
51 /** |
|
52 * Much simpler, uses the new Rendezvous() call to sync with the client. |
|
53 */ |
|
54 LOCAL_C void MainL() |
|
55 { |
|
56 // |
|
57 // Start an active scheduler... |
|
58 // |
|
59 CActiveScheduler* scheduler = new(ELeave) CActiveScheduler; |
|
60 CleanupStack::PushL(scheduler); |
|
61 CActiveScheduler::Install(scheduler); |
|
62 |
|
63 // |
|
64 // Create the CTestServer derived server... |
|
65 // |
|
66 CFaxTestServer* server = NULL; |
|
67 |
|
68 TRAPD(err, server = CFaxTestServer::NewL()); |
|
69 if (err == KErrNone) |
|
70 { |
|
71 // |
|
72 // Sync with the client and enter the active scheduler |
|
73 // |
|
74 RProcess::Rendezvous(KErrNone); |
|
75 scheduler->Start(); |
|
76 } |
|
77 |
|
78 // |
|
79 // Clean up... |
|
80 // |
|
81 CleanupStack::Pop(scheduler); |
|
82 delete server; |
|
83 delete scheduler; |
|
84 } // MainL |
|
85 /** |
|
86 * @return Standard Epoc error code on exit. |
|
87 */ |
|
88 GLDEF_C TInt E32Main() |
|
89 { |
|
90 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
91 |
|
92 if (cleanup == NULL) |
|
93 { |
|
94 return KErrNoMemory; |
|
95 } |
|
96 |
|
97 TRAPD(err, MainL()); |
|
98 |
|
99 delete cleanup; |
|
100 |
|
101 return err; |
|
102 } // E32Main |
|
103 |
|
104 |
|
105 /** |
|
106 * Implementation of CTestServer pure virtual. |
|
107 * |
|
108 * @return A CTestStep derived instance. |
|
109 */ |
|
110 CTestStep* CFaxTestServer::CreateTestStep(const TDesC& aStepName) |
|
111 { |
|
112 CTestStep* testStep = NULL; |
|
113 |
|
114 // |
|
115 // Create the required test step... |
|
116 // |
|
117 if (aStepName == _L("TestFaxDefinition")) |
|
118 { |
|
119 testStep = new CFaxTestFaxDefinition(); |
|
120 } |
|
121 |
|
122 if (aStepName == _L("TestFaxStorage")) |
|
123 { |
|
124 testStep = new CFaxTestFaxStorage(); |
|
125 } |
|
126 |
|
127 if (aStepName == _L("TestFaxCoding")) |
|
128 { |
|
129 testStep = new CFaxTestFaxCoding(); |
|
130 } |
|
131 |
|
132 if (aStepName == _L("TestFaxHeaderDefinition")) |
|
133 { |
|
134 testStep = new CFaxTestFaxHeaderDefinition(); |
|
135 } |
|
136 |
|
137 if (aStepName == _L("TestTransmitFax01")) |
|
138 { |
|
139 testStep = new CFaxTestTransmitFax01(); |
|
140 } |
|
141 |
|
142 if (aStepName == _L("TestTransmitFax02")) |
|
143 { |
|
144 testStep = new CFaxTestTransmitFax02(); |
|
145 } |
|
146 |
|
147 if (aStepName == _L("TestTransmitFax03")) |
|
148 { |
|
149 testStep = new CFaxTestTransmitFax03(); |
|
150 } |
|
151 |
|
152 if (aStepName == _L("TestTransmitFax04")) |
|
153 { |
|
154 testStep = new CFaxTestTransmitFax04(); |
|
155 } |
|
156 |
|
157 if (aStepName == _L("TestTransmitFax05")) |
|
158 { |
|
159 testStep = new CFaxTestTransmitFax05(); |
|
160 } |
|
161 |
|
162 if (aStepName == _L("TestTransmitFax06")) |
|
163 { |
|
164 testStep = new CFaxTestTransmitFax06(); |
|
165 } |
|
166 |
|
167 if (aStepName == _L("TestReceiveFax01")) |
|
168 { |
|
169 testStep = new CFaxTestReceiveFax01(); |
|
170 } |
|
171 |
|
172 if (aStepName == _L("TestReceiveFax02")) |
|
173 { |
|
174 testStep = new CFaxTestReceiveFax02(); |
|
175 } |
|
176 |
|
177 if (aStepName == _L("TestReceiveFax03")) |
|
178 { |
|
179 testStep = new CFaxTestReceiveFax03(); |
|
180 } |
|
181 |
|
182 if (aStepName == _L("TestReceiveFax04")) |
|
183 { |
|
184 testStep = new CFaxTestReceiveFax04(); |
|
185 } |
|
186 |
|
187 if (aStepName == _L("TestReceiveFax05")) |
|
188 { |
|
189 testStep = new CFaxTestReceiveFax05(); |
|
190 } |
|
191 |
|
192 if (aStepName == _L("TestReceiveFax06")) |
|
193 { |
|
194 testStep = new CFaxTestReceiveFax06(); |
|
195 } |
|
196 |
|
197 return testStep; |
|
198 } // CFaxTestServer::CreateTestStep |