1 /* |
|
2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Specific class for WIM tests |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <stiftestinterface.h> |
|
23 #include "wim.h" |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS =============================== |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // CWIM::CWIM |
|
32 // C++ default constructor can NOT contain any code, that |
|
33 // might leave. |
|
34 // ----------------------------------------------------------------------------- |
|
35 // |
|
36 CWIM::CWIM( |
|
37 CTestModuleIf& aTestModuleIf ): |
|
38 CCore( aTestModuleIf ) |
|
39 { |
|
40 // Initial values |
|
41 } |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CWIM::ConstructL |
|
45 // Symbian 2nd phase constructor can leave. |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 void CWIM::ConstructL() |
|
49 { |
|
50 #if ( NCP_COMMON_S60_VERSION_SUPPORT == S60_VERSION_32 ) |
|
51 BaseConstructL(); |
|
52 #else |
|
53 BaseConstructL( this ); |
|
54 #endif |
|
55 |
|
56 iWIMLog = CStifLogger::NewL( KSSLogPath, |
|
57 KSSLogFile, |
|
58 CStifLogger::ETxt, |
|
59 CStifLogger::EFile, |
|
60 EFalse ); |
|
61 |
|
62 InitializeIscControlL(KIscControlTestCaseFileWIM); |
|
63 |
|
64 _LIT8(KSS, "CWIM: ConstructL"); |
|
65 iWIMLog->Log((TDesC8)KSS ); |
|
66 |
|
67 } |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // CWIM::NewL |
|
71 // Two-phased constructor. |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 CWIM* CWIM::NewL( |
|
75 CTestModuleIf& aTestModuleIf ) |
|
76 { |
|
77 CWIM* self = new (ELeave) CWIM( aTestModuleIf ); |
|
78 |
|
79 CleanupStack::PushL((CScriptBase*)self ); |
|
80 self->ConstructL(); |
|
81 CleanupStack::Pop( self ); |
|
82 |
|
83 return self; |
|
84 |
|
85 } |
|
86 |
|
87 // Destructor |
|
88 CWIM::~CWIM() |
|
89 { |
|
90 |
|
91 // Delete resources allocated from test methods |
|
92 Delete(); |
|
93 |
|
94 // Delete logger |
|
95 delete iWIMLog; |
|
96 |
|
97 } |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CWIM::RouteCompletion |
|
101 // Completes a request or notification via the specific Tsy object, based on |
|
102 // IPC number and data package |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 EXPORT_C void CWIM::RouteCompletion |
|
106 ( |
|
107 TInt aIpc, |
|
108 CMmDataPackage* aDataPackage, |
|
109 |
|
110 TInt aResult |
|
111 ) |
|
112 { |
|
113 |
|
114 |
|
115 // Process the ISI msg according to IPC requested. |
|
116 _LIT8(KResult, "CWIM::RouteCompletion result: %d"); |
|
117 iWIMLog->Log((TDesC8)KResult, aResult ); |
|
118 |
|
119 if ( !iHandleSpecifiedRequests ) |
|
120 { |
|
121 switch(aIpc) |
|
122 { |
|
123 case ECustomPowerSimOnIPC: |
|
124 { |
|
125 CompletePoweringSimOn( aResult ); |
|
126 break; |
|
127 } |
|
128 case ECustomPowerSimOffIPC: |
|
129 { |
|
130 CompletePoweringSimOff( aResult ); |
|
131 break; |
|
132 } |
|
133 case ECustomSimWarmResetIPC: |
|
134 { |
|
135 CompleteSIMWarmReset( aResult ); |
|
136 break; |
|
137 } |
|
138 case ECustomGetATRIPC: |
|
139 { |
|
140 CompleteGetAnswerToResetStatus( aResult, aDataPackage ); |
|
141 break; |
|
142 } |
|
143 case ECustomGetSimCardReaderStatusIPC: |
|
144 { |
|
145 CompleteGetSIMCardReaderStatus( aResult, aDataPackage ); |
|
146 break; |
|
147 } |
|
148 case ECustomSendAPDUReqV2IPC: |
|
149 { |
|
150 CompleteSendAPDU( aResult, aDataPackage ); |
|
151 break; |
|
152 } |
|
153 case ECustomSendAPDUReqIPC: |
|
154 { |
|
155 CompleteSendAPDURequest( aResult, aDataPackage ); |
|
156 break; |
|
157 } |
|
158 |
|
159 default: |
|
160 { |
|
161 _LIT8(KDefault, "CWIM::RouteCompletion default"); |
|
162 iWIMLog->Log((TDesC8)KDefault ); |
|
163 break; |
|
164 } |
|
165 } |
|
166 } |
|
167 else |
|
168 { |
|
169 TBool isIPCHandled = EFalse; |
|
170 switch(aIpc) |
|
171 { |
|
172 case ECustomPowerSimOnIPC: |
|
173 { |
|
174 if ( 0 == iSavedIPCNameForComparison.Compare |
|
175 ( _L( "ECustomPowerSimOnIPC" ) ) ) |
|
176 { |
|
177 CompletePoweringSimOn( aResult ); |
|
178 CCore::GetNextExpectedCompleteIPC(); |
|
179 isIPCHandled = ETrue; |
|
180 } |
|
181 break; |
|
182 } |
|
183 |
|
184 case ECustomPowerSimOffIPC: |
|
185 { |
|
186 if ( 0 == iSavedIPCNameForComparison.Compare |
|
187 ( _L( "ECustomPowerSimOffIPC" ) ) ) |
|
188 { |
|
189 CompletePoweringSimOff( aResult ); |
|
190 CCore::GetNextExpectedCompleteIPC(); |
|
191 isIPCHandled = ETrue; |
|
192 } |
|
193 break; |
|
194 } |
|
195 |
|
196 case ECustomSimWarmResetIPC: |
|
197 { |
|
198 if ( 0 == iSavedIPCNameForComparison.Compare |
|
199 ( _L( "ECustomSimWarmResetIPC" ) ) ) |
|
200 { |
|
201 CompleteSIMWarmReset( aResult ); |
|
202 CCore::GetNextExpectedCompleteIPC(); |
|
203 isIPCHandled = ETrue; |
|
204 } |
|
205 break; |
|
206 } |
|
207 |
|
208 case ECustomGetATRIPC: |
|
209 { |
|
210 if ( 0 == iSavedIPCNameForComparison.Compare |
|
211 ( _L( "ECustomGetATRIPC" ) ) ) |
|
212 { |
|
213 CompleteGetAnswerToResetStatus( aResult, aDataPackage ); |
|
214 CCore::GetNextExpectedCompleteIPC(); |
|
215 isIPCHandled = ETrue; |
|
216 } |
|
217 break; |
|
218 } |
|
219 |
|
220 case ECustomGetSimCardReaderStatusIPC: |
|
221 { |
|
222 if ( 0 == iSavedIPCNameForComparison.Compare |
|
223 ( _L( "ECustomGetSimCardReaderStatusIPC" ) ) ) |
|
224 { |
|
225 CompleteGetSIMCardReaderStatus( aResult, aDataPackage ); |
|
226 CCore::GetNextExpectedCompleteIPC(); |
|
227 isIPCHandled = ETrue; |
|
228 } |
|
229 break; |
|
230 } |
|
231 |
|
232 case ECustomSendAPDUReqV2IPC: |
|
233 { |
|
234 if ( 0 == iSavedIPCNameForComparison.Compare |
|
235 ( _L( "ECustomSendAPDUReqV2IPC" ) ) ) |
|
236 { |
|
237 CompleteSendAPDU( aResult, aDataPackage ); |
|
238 CCore::GetNextExpectedCompleteIPC(); |
|
239 isIPCHandled = ETrue; |
|
240 } |
|
241 break; |
|
242 } |
|
243 |
|
244 case ECustomSendAPDUReqIPC: |
|
245 { |
|
246 if ( 0 == iSavedIPCNameForComparison.Compare |
|
247 ( _L( "ECustomSendAPDUReqIPC" ) ) ) |
|
248 { |
|
249 CompleteSendAPDURequest( aResult, aDataPackage ); |
|
250 CCore::GetNextExpectedCompleteIPC(); |
|
251 isIPCHandled = ETrue; |
|
252 } |
|
253 break; |
|
254 } |
|
255 |
|
256 default: |
|
257 { |
|
258 _LIT8(KDefault, "CWIM::RouteCompletion default"); |
|
259 iWIMLog->Log((TDesC8)KDefault ); |
|
260 break; |
|
261 } |
|
262 } |
|
263 |
|
264 // Check whether the IPC received should had been exactly the expected one. |
|
265 // If not the KErrGeneral is set. |
|
266 if( ( iNextIPCMustBeSameAsNextExpected ) && |
|
267 ( !isIPCHandled ) ) |
|
268 { |
|
269 aResult = KErrUnknown; |
|
270 Signal( aResult ); |
|
271 } |
|
272 } |
|
273 } |
|
274 |
|
275 |
|
276 |
|
277 |
|
278 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
279 |
|
280 // ----------------------------------------------------------------------------- |
|
281 // LibEntryL is a polymorphic Dll entry point. |
|
282 // Returns: CScriptBase: New CScriptBase derived object |
|
283 // ----------------------------------------------------------------------------- |
|
284 // |
|
285 EXPORT_C CScriptBase* LibEntryL( |
|
286 CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework |
|
287 { |
|
288 |
|
289 return ( CScriptBase* ) CWIM::NewL( aTestModuleIf ); |
|
290 |
|
291 } |
|
292 |
|
293 // End of File |
|