1 /* |
|
2 * Copyright (c) 2002-2006 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: Core is base class for all polymorfic dlls use |
|
15 * to implement test cases |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #ifndef SIMATKCORE_H |
|
23 #define SIMATKCORE_H |
|
24 |
|
25 // INCLUDES |
|
26 #include <testscripterinternal.h> |
|
27 #include <etelmm.h> |
|
28 #include <satcs.h> |
|
29 |
|
30 // CONSTANTS |
|
31 |
|
32 // Logging path and file |
|
33 _LIT( KCoreLogPath, "c:\\logs\\testframework\\" ); |
|
34 _LIT( KCoreLogFile, "SimAtkTestTool.txt" ); |
|
35 |
|
36 // Notifys list |
|
37 |
|
38 |
|
39 // DATA TYPES |
|
40 |
|
41 // SatIpc is used to identify the Sat notifications |
|
42 typedef TInt TSatIpc; |
|
43 |
|
44 // Structure that contain the string and ipc presentation of notify |
|
45 struct TSatNotify |
|
46 { |
|
47 const TText* iNotifyString; |
|
48 const TSatIpc iIpc; |
|
49 }; |
|
50 |
|
51 // CONSTANTS |
|
52 |
|
53 // Array of notifications |
|
54 TSatNotify const KNotifyList[] = |
|
55 { |
|
56 { _S("ESatNotifyCloseChannelPCmd"), ESatNotifyCloseChannelPCmd }, |
|
57 { _S("ESatNotifyGetChannelStatusPCmd"), ESatNotifyGetChannelStatusPCmd }, |
|
58 { _S("ESatNotifyGetInkeyPCmd"), ESatNotifyGetInkeyPCmd }, |
|
59 { _S("ESatNotifyGetInputPCmd"), ESatNotifyGetInputPCmd }, |
|
60 { _S("ESatNotifyGetReaderStatusPCmd"), ESatNotifyGetReaderStatusPCmd }, |
|
61 { _S("ESatNotifyLanguageNotificationPCmd"), ESatNotifyLanguageNotificationPCmd }, |
|
62 { _S("ESatNotifyPlayTonePCmd"), ESatNotifyPlayTonePCmd }, |
|
63 { _S("ESatNotifyPollingIntervalPCmd"), ESatNotifyPollingIntervalPCmd }, |
|
64 { _S("ESatNotifyPollingOffPCmd"), ESatNotifyPollingOffPCmd }, |
|
65 { _S("ESatNotifyPowerOffCardPCmd"), ESatNotifyPowerOffCardPCmd }, |
|
66 { _S("ESatNotifyPowerOnCardPCmd"), ESatNotifyPowerOnCardPCmd }, |
|
67 { _S("ESatNotifyProactiveSimSessionEnd"), ESatNotifyProactiveSimSessionEnd }, |
|
68 { _S("ESatNotifyProactiveSimSessionStart"), ESatNotifyProactiveSimSessionStart }, |
|
69 { _S("ESatNotifyReceiveDataPCmd"), ESatNotifyReceiveDataPCmd }, |
|
70 { _S("ESatNotifySelectItemPCmd"), ESatNotifySelectItemPCmd }, |
|
71 { _S("ESatNotifyDisplayTextPCmd"), ESatNotifyDisplayTextPCmd }, |
|
72 { _S("ESatNotifySetUpEventListPCmd"), ESatNotifySetUpEventListPCmd }, |
|
73 { _S("ESatNotifySetUpMenuPCmd"), ESatNotifySetUpMenuPCmd }, |
|
74 { _S("ESatNotifyTimerExpiration"), ESatNotifyTimerExpiration }, |
|
75 { _S("ESatNotifyTimerMgmtPCmd"), ESatNotifyTimerMgmtPCmd }, |
|
76 { _S("ESatNotifyTsyStateUpdated"), ESatNotifyTsyStateUpdated }, |
|
77 { _S("ESatNotifyRefreshRequiredParam"), ESatNotifyRefreshRequiredParam }, |
|
78 { _S("ESatNotifyRefreshRequired"), ESatNotifyRefreshRequired }, |
|
79 { _S("ESatNotifyRefreshPCmd"), ESatNotifyRefreshPCmd }, |
|
80 { _S("ESatNotifyLaunchBrowserPCmd"), ESatNotifyLaunchBrowserPCmd }, |
|
81 { _S("ESatNotifyLocalInfoPCmd"), ESatNotifyLocalInfoPCmd }, |
|
82 { _S("ESatNotifyOpenChannelPCmd"), ESatNotifyOpenChannelPCmd }, |
|
83 { _S("ESatNotifyPerformCardApduPCmd"), ESatNotifyPerformCardApduPCmd }, |
|
84 { _S("ESatNotifyRunAtCommandPCmd"), ESatNotifyRunAtCommandPCmd }, |
|
85 { _S("ESatNotifySendDataPCmd"), ESatNotifySendDataPCmd }, |
|
86 { _S("ESatNotifySendDtmfPCmd"), ESatNotifySendDtmfPCmd }, |
|
87 { _S("ESatNotifySendSmPCmd"), ESatNotifySendSmPCmd }, |
|
88 { _S("ESatNotifySendSsPCmd"), ESatNotifySendSsPCmd }, |
|
89 { _S("ESatNotifySendUssdPCmd"), ESatNotifySendUssdPCmd }, |
|
90 { _S("ESatNotifyServiceSearchPCmd"), ESatNotifyServiceSearchPCmd }, |
|
91 { _S("ESatNotifySetUpCallPCmd"), ESatNotifySetUpCallPCmd }, |
|
92 { _S("ESatNotifySetUpIdleModeTextPCmd"), ESatNotifySetUpIdleModeTextPCmd }, |
|
93 { _S("ESatNotifyCallControlRequest"), ESatNotifyCallControlRequest }, |
|
94 { _S("ESatNotifyCbDownload"), ESatNotifyCbDownload }, |
|
95 { _S("ESatNotifyMoSmControlRequest"), ESatNotifyMoSmControlRequest }, |
|
96 { _S("ESatNotifySmsPpDownload"), ESatNotifySmsPpDownload } |
|
97 }; |
|
98 |
|
99 const TUint KNotifyListSize = static_cast<TUint> |
|
100 ( sizeof( KNotifyList ) / sizeof( TSatNotify ) ) ; |
|
101 |
|
102 |
|
103 // FORWARD DECLARATIONS |
|
104 class CSimAtk; |
|
105 |
|
106 // CLASS DECLARATION |
|
107 |
|
108 /** |
|
109 * CSimAtkCore test class for STIF Test Framework TestScripter. |
|
110 * Base class for all sub classe |
|
111 * @lib SimAtkCore.dll |
|
112 */ |
|
113 class CSimAtkCore : public CScriptBase |
|
114 { |
|
115 public: // Enumerations |
|
116 |
|
117 /** |
|
118 * An enum object type. Enumarates required classed |
|
119 * for Notify class. |
|
120 */ |
|
121 enum TObjectType |
|
122 { |
|
123 ECore, /**< TObjectType 0 ECore. */ |
|
124 ESimAtk, /**< TObjectType 1 ESimAtk. */ |
|
125 }; |
|
126 |
|
127 |
|
128 public: // Constructors and destructor |
|
129 |
|
130 /** |
|
131 * Two-phased constructor. |
|
132 */ |
|
133 IMPORT_C static CSimAtkCore* NewL( CTestModuleIf& aTestModuleIf ); |
|
134 |
|
135 /** |
|
136 * Destructor. |
|
137 */ |
|
138 IMPORT_C virtual ~CSimAtkCore(); |
|
139 |
|
140 |
|
141 public: // New methods |
|
142 |
|
143 /** |
|
144 * Core functions, enumerates notify type from scripted |
|
145 * parameter. |
|
146 * @param aNotifyString String that shall be mapped |
|
147 * @param aIsNotify Output which is set true if aNotifyString |
|
148 * contained notification and false when it was a cancellation |
|
149 * @return IPC or KErrNotSupported when string was a notify. |
|
150 * KErrNone if string was cancellation |
|
151 */ |
|
152 IMPORT_C virtual TSatIpc MapStringToIpc( |
|
153 const TDesC& aNotifyString, |
|
154 TBool& aIsNotify ); |
|
155 |
|
156 /** |
|
157 * Core functions, enumerates notify string from Ipc. |
|
158 * @param aNotifyIpc Ipc that shall be mapped |
|
159 * @return Notify string or NullDesc when ipc remain unidentified |
|
160 */ |
|
161 IMPORT_C virtual TPtrC MapIpcToString( |
|
162 const TSatIpc aNotifyIpc ); |
|
163 |
|
164 /** |
|
165 * This sets asyncronous method call |
|
166 * @param aStatus reference to recuest status |
|
167 * @param aNotifyIpc IPC of notify to be notified |
|
168 * @return Symbian OS Error code |
|
169 */ |
|
170 IMPORT_C virtual TInt Notify( TRequestStatus& aStatus, |
|
171 const TSatIpc& aNotifyIpc ); |
|
172 |
|
173 /** |
|
174 * This cancels async method call |
|
175 * @param aNotifyIpc IPC of notify to be cancelled |
|
176 * @return none |
|
177 */ |
|
178 IMPORT_C virtual void NotifyCancel( const TSatIpc& aNotifyIpc ); |
|
179 |
|
180 /** |
|
181 * Set parameters from subclass to base class if base class |
|
182 * implementation is used. |
|
183 * @param aString reference to parameter reed from the script |
|
184 * @return none |
|
185 */ |
|
186 IMPORT_C void SetString( const TDesC& aString ); |
|
187 |
|
188 |
|
189 public: // Functions from base classes |
|
190 |
|
191 /** |
|
192 * Function direct script calls to correct functions. |
|
193 * @param aItem Script line containing method name and parameters |
|
194 * @return Symbian OS error code |
|
195 */ |
|
196 IMPORT_C virtual TInt RunMethodL( CStifItemParser& aItem ); |
|
197 |
|
198 |
|
199 protected: // New methods |
|
200 |
|
201 /** |
|
202 * Close functio to close required services after test is done |
|
203 * @param none |
|
204 * @return Symbian OS Error code |
|
205 */ |
|
206 IMPORT_C virtual TInt Close( CStifItemParser& aItem ); |
|
207 |
|
208 /** |
|
209 * Open function for required services |
|
210 * @param none |
|
211 * @return Symbian Error code |
|
212 */ |
|
213 IMPORT_C virtual TInt Open( CStifItemParser& aItem ); |
|
214 |
|
215 /** |
|
216 * Sets object type by casting class |
|
217 * @param aType enum to current class |
|
218 * @param aModule pointer to any class this parameter is cast to |
|
219 * refered class |
|
220 * @return none |
|
221 */ |
|
222 IMPORT_C virtual void SetObjectType( TObjectType aType, |
|
223 TAny* aModule ); |
|
224 |
|
225 |
|
226 protected: // Constructors |
|
227 |
|
228 /** |
|
229 * Constructor |
|
230 * @param aTestModuleIf reference to test module |
|
231 * @return base class object |
|
232 */ |
|
233 IMPORT_C CSimAtkCore( CTestModuleIf& aTestModuleIf ); |
|
234 |
|
235 /** |
|
236 * By default Symbian 2nd phase constructor is non public. |
|
237 */ |
|
238 IMPORT_C void ConstructL(); |
|
239 |
|
240 |
|
241 protected: // Functions from base classes |
|
242 |
|
243 /** |
|
244 * Internal fuction to run specified method |
|
245 * @param aFunction function available |
|
246 * @param aCount number of functions |
|
247 * @param aItem reference to parser class holding parameter data |
|
248 * @return Symbian Os Error Code |
|
249 */ |
|
250 IMPORT_C virtual TInt RunInternalL( |
|
251 TStifFunctionInfo const aFunctions[], TInt aCount, |
|
252 CStifItemParser& aItem ); |
|
253 |
|
254 |
|
255 private: |
|
256 |
|
257 /** |
|
258 * Connect function connects to needed servers |
|
259 * @param aItem reference to Parser class holding parameter data |
|
260 * @return Symbian OS Error code |
|
261 */ |
|
262 TInt Connect( CStifItemParser& aItem ); |
|
263 |
|
264 /** |
|
265 * Load function load required services and files |
|
266 * @param aItem reference to Parser class holding parameter data |
|
267 * @return Symbian OS Error code |
|
268 */ |
|
269 TInt Load( CStifItemParser& aItem ); |
|
270 |
|
271 /** |
|
272 * Return enum of the current class |
|
273 * @param none |
|
274 * @return enum to current class |
|
275 */ |
|
276 TInt ObjectType(); |
|
277 |
|
278 /** |
|
279 * Function direct script calls to correct functions. |
|
280 * @param ACount number of functions |
|
281 * @return Pointer to Stif function Info |
|
282 */ |
|
283 const TStifFunctionInfo* RunMethodCases( TInt& aCount ); |
|
284 |
|
285 /** |
|
286 * Basic set function to set various data |
|
287 * @param aItem reference to Parser class holding parameter data |
|
288 * @return Symbian OS Error code |
|
289 */ |
|
290 TInt Set( CStifItemParser& aItem ); |
|
291 |
|
292 /** |
|
293 * UnLoad function unload required services and files |
|
294 * @param aItem reference to Parser class holding parameter data |
|
295 * @return Symbian OS Error code |
|
296 */ |
|
297 TInt Unload( CStifItemParser& aItem ); |
|
298 |
|
299 |
|
300 protected: // Data |
|
301 |
|
302 /** |
|
303 * RTelService object |
|
304 */ |
|
305 RTelServer iRtel; |
|
306 |
|
307 /** |
|
308 * RCommServer object |
|
309 */ |
|
310 RCommServ iRcomm; |
|
311 |
|
312 /** |
|
313 * RMobile phone object |
|
314 */ |
|
315 RMobilePhone iRphone; |
|
316 |
|
317 /** |
|
318 * Pointer to logger |
|
319 */ |
|
320 CStifLogger* iCoreLog; |
|
321 |
|
322 |
|
323 private: // Data |
|
324 |
|
325 /** |
|
326 * Pointer to string holding parameter from sub class |
|
327 * if base class implementation is needed |
|
328 */ |
|
329 TPtrC iString; |
|
330 |
|
331 /** |
|
332 * Enumerale to object type |
|
333 */ |
|
334 TObjectType iObjectType; |
|
335 |
|
336 /** |
|
337 * Pointer to CSimAtk class |
|
338 */ |
|
339 CSimAtk* iSimAtk; |
|
340 |
|
341 /** |
|
342 * Search optimization |
|
343 */ |
|
344 TInt iLastIndex; |
|
345 }; |
|
346 |
|
347 #endif // SIMATKCORE_H |
|
348 |
|
349 // End of File |
|