|
1 /* |
|
2 * Copyright (c) 2002-2004 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: Base class of all other test classes |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <e32svr.h> |
|
22 #include <stifparser.h> |
|
23 #include <stiftestinterface.h> |
|
24 #include "cmmstaticutility.h" |
|
25 #include "core.h" |
|
26 #include "nwe.h" |
|
27 |
|
28 |
|
29 |
|
30 // ============================ MEMBER FUNCTIONS =============================== |
|
31 |
|
32 // ----------------------------------------------------------------------------- |
|
33 // CCore::Delete |
|
34 // Delete here all resources allocated and opened from test methods. |
|
35 // Called from destructor. |
|
36 // ----------------------------------------------------------------------------- |
|
37 // |
|
38 void CCore::Delete() |
|
39 { |
|
40 |
|
41 } |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CCore::RunMethodL |
|
45 // Run specified method. Contains also table of test mothods and their names. |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 TInt CCore::RunMethodL( |
|
49 CStifItemParser& /*aItem*/ ) |
|
50 { |
|
51 |
|
52 return( KErrNone ); |
|
53 |
|
54 } |
|
55 |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // CCore::RouteCompletion |
|
59 // Completes a request or notification via the specific Tsy object, based on |
|
60 // IPC number and data package |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 EXPORT_C void CCore::RouteCompletion |
|
64 ( |
|
65 TInt /*aIpc*/, |
|
66 CMmDataPackage* /*aDataPackage*/, |
|
67 TInt /*aResult*/ |
|
68 ) |
|
69 { |
|
70 _LIT8(KCore, "CORE: In RouteCompletion"); |
|
71 iCoreLog->Log((TDesC8)KCore); |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CCore::Notify |
|
76 // Calls correct Notify |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 EXPORT_C void CCore::Notify( TNotifyList& aNotifyList ) |
|
80 { |
|
81 _LIT8(KCoreNotify, "CORE: Notify"); |
|
82 iCoreLog->Log((TDesC8)KCoreNotify); |
|
83 |
|
84 switch( ObjectType() ) |
|
85 { |
|
86 case CCore::ECore: |
|
87 { |
|
88 |
|
89 break; |
|
90 } |
|
91 case CCore::ENWE: |
|
92 { |
|
93 iNWE->NotifyNWE( aNotifyList ); |
|
94 break; |
|
95 } |
|
96 default: |
|
97 { |
|
98 // Should never enter this block |
|
99 _LIT8(KDefault, "Default block in CCore::Notify"); |
|
100 iCoreLog->Log((TDesC8)KDefault); |
|
101 break; |
|
102 } |
|
103 } |
|
104 //return ret; |
|
105 } |
|
106 |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // CCore::HandleRequest |
|
110 // Forwards a request to DOS layer |
|
111 // ----------------------------------------------------------------------------- |
|
112 // |
|
113 EXPORT_C TInt CCore::HandleRequestL |
|
114 ( |
|
115 const TInt aIpc, |
|
116 const CMmDataPackage* aDataPackage |
|
117 ) |
|
118 { |
|
119 TInt ret( KErrNone ); |
|
120 |
|
121 _LIT8(KHandleRequest, "CCore::HandleRequest: %d"); |
|
122 iCoreLog->Log((TDesC8)KHandleRequest, aIpc); |
|
123 |
|
124 ret = iMessageManager->HandleRequestL( aIpc, aDataPackage ); |
|
125 |
|
126 return ret; |
|
127 } |
|
128 |
|
129 // ----------------------------------------------------------------------------- |
|
130 // CCore::HandleRequest |
|
131 // Forwards a request to DOS layer |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 EXPORT_C TInt CCore::HandleRequestL |
|
135 ( |
|
136 const TInt aIpc |
|
137 ) |
|
138 { |
|
139 TInt ret( KErrNone ); |
|
140 |
|
141 _LIT8(KHandleRequest, "CCore::HandleRequest: %d"); |
|
142 iCoreLog->Log((TDesC8)KHandleRequest, aIpc); |
|
143 |
|
144 ret = iMessageManager->HandleRequestL( aIpc ); |
|
145 |
|
146 return ret; |
|
147 } |
|
148 |
|
149 |
|
150 // ----------------------------------------------------------------------------- |
|
151 // CCore::SetObjectType |
|
152 // SetObjectType method function. |
|
153 // ----------------------------------------------------------------------------- |
|
154 // |
|
155 EXPORT_C void CCore::SetObjectType ( TObjectType aType, TAny* aModule ) |
|
156 { |
|
157 |
|
158 _LIT8(KSetObjectType, "CORE: In SetObjectType"); |
|
159 iCoreLog->Log((TDesC8)KSetObjectType); |
|
160 // Stores object type |
|
161 iObjectType = aType; |
|
162 |
|
163 // Stores pointer to object ( this must cast to right type ) |
|
164 iObject = aModule; |
|
165 |
|
166 switch( iObjectType ) |
|
167 { |
|
168 case EVoice: |
|
169 { |
|
170 iVoice = reinterpret_cast <CVoice*>( aModule ); |
|
171 break; |
|
172 } |
|
173 case ENWE: |
|
174 { |
|
175 iNWE = reinterpret_cast <CNWE*>( aModule ); |
|
176 break; |
|
177 } |
|
178 |
|
179 default: |
|
180 { |
|
181 break; |
|
182 } |
|
183 } |
|
184 } |
|
185 |
|
186 // ----------------------------------------------------------------------------- |
|
187 // CCore::ObjectType |
|
188 // ObjectType method function. |
|
189 // returns derived object type |
|
190 // ----------------------------------------------------------------------------- |
|
191 // |
|
192 TInt CCore::ObjectType() |
|
193 { |
|
194 _LIT8(KObjectType, "CCore::ObjectType %d"); |
|
195 iCoreLog->Log((TDesC8)KObjectType, iObjectType); |
|
196 return iObjectType; |
|
197 |
|
198 } |
|
199 |
|
200 |
|
201 // ----------------------------------------------------------------------------- |
|
202 // CCore::RunIscTestCase |
|
203 // Start ISC Test Control test case |
|
204 // (other items were commented in a header). |
|
205 // ----------------------------------------------------------------------------- |
|
206 // |
|
207 EXPORT_C TInt CCore::RunIscTestCase( CStifItemParser& aItem ) |
|
208 { |
|
209 TInt testCaseId(0); |
|
210 TInt ret = aItem.GetNextInt(testCaseId); |
|
211 if (KErrNone == ret) |
|
212 { |
|
213 RunIscControlTestCase(1, testCaseId); |
|
214 } |
|
215 return ret; |
|
216 } |
|
217 |
|
218 |
|
219 // ----------------------------------------------------------------------------- |
|
220 // CCore::SyncIscTestCase |
|
221 // Syncronize with ISC Test Control |
|
222 // (other items were commented in a header). |
|
223 // ----------------------------------------------------------------------------- |
|
224 // |
|
225 EXPORT_C TInt CCore::SyncIscTestCase( void ) |
|
226 { |
|
227 SyncIscControl(); |
|
228 return KErrNone; |
|
229 } |
|
230 |
|
231 // ----------------------------------------------------------------------------- |
|
232 // CCore::RunIscTestCaseIgnoreXMLsWhenRealCellmoInUseFlagIsDefined |
|
233 // Start ISC Test Control test case when REAL_CELLMO_IN_USE is defined. |
|
234 // (other items were commented in a header). |
|
235 // ----------------------------------------------------------------------------- |
|
236 // |
|
237 EXPORT_C TInt CCore::RunIscTestCaseIgnoreXMLsWhenRealCellmoInUseFlagIsDefined( CStifItemParser& aItem ) |
|
238 { |
|
239 #ifdef REAL_CELLMO_IN_USE |
|
240 CStifItemParser& aItemForCompilation = aItem; // Get rid of compiler warning |
|
241 |
|
242 return KErrNone; |
|
243 #else |
|
244 // Real CellMo is not in use - Run Isc Test Case. |
|
245 TInt testCaseId(0); |
|
246 TInt ret = aItem.GetNextInt(testCaseId); |
|
247 if (KErrNone == ret) |
|
248 { |
|
249 RunIscControlTestCase(1, testCaseId); |
|
250 } |
|
251 return ret; |
|
252 #endif // REAL_CELLMO_IN_USE |
|
253 } |
|
254 |
|
255 |
|
256 // ----------------------------------------------------------------------------- |
|
257 // CCore::SyncIscTestCaseDoNotSyncIfRealCellmoInUseFlagIsDefined |
|
258 // Syncronize with ISC Test Control when REAL_CELLMO_IN_USE is not defined. |
|
259 // (other items were commented in a header). |
|
260 // ----------------------------------------------------------------------------- |
|
261 // |
|
262 EXPORT_C TInt CCore::SyncIscTestCaseDoNotSyncIfRealCellmoInUseFlagIsDefined( void ) |
|
263 { |
|
264 #ifdef REAL_CELLMO_IN_USE |
|
265 return KErrNone; |
|
266 #else |
|
267 // Real CellMo is not in use - Sync Isc Control. |
|
268 SyncIscControl(); |
|
269 return KErrNone; |
|
270 #endif // REAL_CELLMO_IN_USE |
|
271 } |
|
272 |
|
273 // ----------------------------------------------------------------------------- |
|
274 // CCore::HandleSpecifiedRequests |
|
275 // Sets iHandleSpecifiedRequests EFalse/ETrue |
|
276 // ----------------------------------------------------------------------------- |
|
277 // |
|
278 EXPORT_C TInt CCore::HandleSpecifiedRequests( CStifItemParser& aItem ) |
|
279 { |
|
280 _LIT8 (KHandleSpecifiedRequests, "CCore::HandleSpecifiedRequests" ); |
|
281 iCoreLog->Log((TDesC8)KHandleSpecifiedRequests); |
|
282 |
|
283 iHandleSpecifiedRequests = EFalse; |
|
284 |
|
285 TPtrC string; |
|
286 aItem.GetNextString ( string ); |
|
287 if ( _L("YES") == string ) |
|
288 { |
|
289 iHandleSpecifiedRequests = ETrue; |
|
290 } |
|
291 return KErrNone; |
|
292 } |
|
293 |
|
294 // ----------------------------------------------------------------------------- |
|
295 // CCore::InitializeIPCRequestTable |
|
296 // Initializes iSavedIPCNameForComparisonTable and iSavedIPCNameForComparison |
|
297 // ----------------------------------------------------------------------------- |
|
298 // |
|
299 EXPORT_C TInt CCore::InitializeIPCRequestTable( void ) |
|
300 { |
|
301 _LIT8 (KInitializeIPCRequestTable, "CCore::InitializeIPCRequestTable" ); |
|
302 iCoreLog->Log((TDesC8)KInitializeIPCRequestTable); |
|
303 |
|
304 TInt counter; |
|
305 |
|
306 iSavedIPCNameForComparison.Zero(); |
|
307 |
|
308 for ( counter = 0; counter < 150; counter++ ) |
|
309 { |
|
310 iSavedIPCNameForComparisonTable[ counter ].Zero(); |
|
311 } |
|
312 return KErrNone; |
|
313 } |
|
314 |
|
315 // ----------------------------------------------------------------------------- |
|
316 // CCore::SetExpectedCompleteIPC |
|
317 // Sets expected complete IPCs into table iSavedIPCNameForComparisonTable |
|
318 // ----------------------------------------------------------------------------- |
|
319 // |
|
320 EXPORT_C TInt CCore::SetExpectedCompleteIPC( CStifItemParser& aItem ) |
|
321 { |
|
322 _LIT8 (KSetExpectedCompleteIPC, "CCore::SetExpectedCompleteIPC" ); |
|
323 iCoreLog->Log((TDesC8)KSetExpectedCompleteIPC); |
|
324 |
|
325 TInt counter = 0; |
|
326 TPtrC string; |
|
327 aItem.GetNextString ( string ); |
|
328 |
|
329 for ( counter = 0; counter < 150; counter++ ) |
|
330 { |
|
331 // Save the first string if it not saved yet |
|
332 if ( ( 0 == iSavedIPCNameForComparison.Compare ( _L( "" ) ) ) && |
|
333 ( 0 == counter ) ) |
|
334 { |
|
335 iSavedIPCNameForComparison.Append( string ); |
|
336 } |
|
337 |
|
338 // Check the next free position and store the string into it. |
|
339 if ( 0 == iSavedIPCNameForComparisonTable[ counter ].Compare ( _L( "" ) ) ) |
|
340 { |
|
341 iSavedIPCNameForComparisonTable[ counter ].Append( string ); |
|
342 counter = 150; |
|
343 } |
|
344 } |
|
345 return KErrNone; |
|
346 } |
|
347 |
|
348 // ----------------------------------------------------------------------------- |
|
349 // CCore::GetNextExpectedCompleteIPC |
|
350 // Gets expected complete IPCs from table iSavedIPCNameForComparisonTable |
|
351 // ----------------------------------------------------------------------------- |
|
352 // |
|
353 EXPORT_C TInt CCore::GetNextExpectedCompleteIPC( void ) |
|
354 { |
|
355 _LIT8 (KGetNextExpectedCompleteIPC, "CCore::GetNextExpectedCompleteIPC" ); |
|
356 iCoreLog->Log((TDesC8)KGetNextExpectedCompleteIPC); |
|
357 |
|
358 TInt counter = 0; |
|
359 TPtrC string; |
|
360 |
|
361 for ( counter = 0; counter < 150; counter++ ) |
|
362 { |
|
363 // |
|
364 if ( iSavedIPCNameForComparison == iSavedIPCNameForComparisonTable[ counter ] ) |
|
365 { |
|
366 iSavedIPCNameForComparisonTable[ counter ].Zero(); |
|
367 // Get next IPC |
|
368 counter++; |
|
369 if ( 0 != iSavedIPCNameForComparisonTable[ counter ].Compare ( _L( "" ) ) ) |
|
370 { |
|
371 iSavedIPCNameForComparison = iSavedIPCNameForComparisonTable[ counter ]; |
|
372 } |
|
373 else |
|
374 // If there's no elements left in the table the comparison string is |
|
375 // initialized. |
|
376 { |
|
377 iSavedIPCNameForComparison.Zero(); |
|
378 } |
|
379 counter = 150; |
|
380 } |
|
381 } |
|
382 |
|
383 return KErrNone; |
|
384 } |
|
385 |
|
386 // ----------------------------------------------------------------------------- |
|
387 // CCore::SetOperInfoAPAC |
|
388 // Setting Nokia_TSY's operator info IsOperinfoApac EFalse/ETrue |
|
389 // ----------------------------------------------------------------------------- |
|
390 // |
|
391 EXPORT_C TInt CCore::SetOperInfoAPAC( CStifItemParser& aItem ) |
|
392 { |
|
393 _LIT8 (KSetOperInfoAPAC, "CCore::SetOperInfoAPAC" ); |
|
394 iCoreLog->Log((TDesC8)KSetOperInfoAPAC); |
|
395 |
|
396 TPtrC string; |
|
397 aItem.GetNextString ( string ); |
|
398 |
|
399 if ( _L("OperInfoAPAC") == string ) |
|
400 { |
|
401 CMmStaticUtility::SetOperinfoApac ( ETrue ); |
|
402 } |
|
403 else |
|
404 { |
|
405 CMmStaticUtility::SetOperinfoApac ( EFalse ); |
|
406 } |
|
407 return KErrNone; |
|
408 } |
|
409 |
|
410 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
411 // None |
|
412 |
|
413 // End of File |
|
414 |