|
1 /* |
|
2 * Copyright (c) 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 "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: Diagnostics Suite Plug-in Base class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef DIAGSUITEPLUGINBASE_H |
|
20 #define DIAGSUITEPLUGINBASE_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32cmn.h> // TUid |
|
24 #include <DiagSuitePlugin.h> // MDiagSuitePlugin |
|
25 #include <ConeResLoader.h> // RConeResourceLoader |
|
26 |
|
27 // FORWARD DECLARATIONSn |
|
28 class CDiagPluginConstructionParam; |
|
29 class CAknDialog; |
|
30 |
|
31 /** |
|
32 * Diagnostics Framework Suite Plugin Base Class |
|
33 * |
|
34 * This base class provides common implementation of Suite Plugin. |
|
35 * |
|
36 * @since S60 v5.0 |
|
37 */ |
|
38 class CDiagSuitePluginBase : public CActive, |
|
39 public MDiagSuitePlugin |
|
40 { |
|
41 public: |
|
42 /** |
|
43 * Destructor. |
|
44 */ |
|
45 IMPORT_C virtual ~CDiagSuitePluginBase(); |
|
46 |
|
47 protected: // new API for derived class. |
|
48 /** |
|
49 * C++ constructor |
|
50 * |
|
51 * @param aConstructionParam Construction parameters. |
|
52 */ |
|
53 IMPORT_C CDiagSuitePluginBase( CDiagPluginConstructionParam* aParam ); |
|
54 |
|
55 /** |
|
56 * Base class constructor |
|
57 * This initializes CDiagSuitePluginBase class. Derived class must call this |
|
58 * method in its ConstructL() method. |
|
59 * |
|
60 * @param aResourceFileName Drive and name of resource file in format |
|
61 * <path>:<rsc_file_name> |
|
62 */ |
|
63 IMPORT_C void BaseConstructL( const TDesC& aResourceFileName ); |
|
64 |
|
65 /** |
|
66 * Run a dialog that waits for response. It is highly recommended that |
|
67 * all plug-ins use this function to display dialogs since it can detect |
|
68 * deletion of dialogs. |
|
69 * |
|
70 * The difference from normal dialog RunLD is that this function returns |
|
71 * ETrue if dialog exited due to user response and |
|
72 * EFalse if it was by other means, such as object deletion or |
|
73 * by DismissWaitingDialog() method. |
|
74 * |
|
75 * !!!! NOTE THAT PLUG-IN MUST RETURN IMMEDIATELY WITHOUT ACCESSING !!!! |
|
76 * !!!! LOCAL VARIABLE OR LOCAL FUNCITONS WHEN THIS FUNCTION RETURNS !!!! |
|
77 * !!!! EFalse VALUE BECAUSE "THIS" POINTER MAY BE FREED ALREADY. !!!! |
|
78 * |
|
79 * The normal dialog response is returned via aDialogResponse reference. |
|
80 * This function can only display one dialog at a time. Calling it again |
|
81 * while it has not been returned will cause panic. |
|
82 * |
|
83 * @param aDialog - Pointer to dialog to run. If the dialog does not have |
|
84 * EEikDialogFlagWait flag set, it will panic with EDiagPluginBasePanicBadArgument |
|
85 * @param aDialogResponse - Response from the dialog. |
|
86 * For detailed values @see avkon.hrh "CBA constants". E.g. EAknSoftkeyYes |
|
87 * The only exception is that if cancel is pressed, it will be 0. |
|
88 * @return ETrue if dialog is exiting due to user response. |
|
89 * Efalse if dialog is dismissed withou user input. |
|
90 * If EFalse is returned, plug-in MUST NOT act on the response. |
|
91 * Also, since plug-in may have been deleted, |
|
92 */ |
|
93 IMPORT_C TBool RunWaitingDialogL( CAknDialog* aDialog, TInt& aDialogResponse ); |
|
94 |
|
95 /** |
|
96 * Dismiss the waiting dialog. This will cause the RunDialogLD() function to return with |
|
97 * aIsUserResponse = Efalse. If nothing is being displayed, this function |
|
98 * does nothing. |
|
99 */ |
|
100 IMPORT_C void DismissWaitingDialog(); |
|
101 |
|
102 /** |
|
103 * CCoeEnv |
|
104 * @return Reference to CCoeEnv. |
|
105 */ |
|
106 IMPORT_C CCoeEnv& CoeEnv(); |
|
107 |
|
108 public: // from MDiagPlugin |
|
109 /** |
|
110 * Get the name of the service that the plug-in provides. |
|
111 * |
|
112 * @return The name of the service. |
|
113 **/ |
|
114 IMPORT_C virtual const TDesC& ServiceLogicalName() const; |
|
115 |
|
116 /** |
|
117 * Get logical dependencies. One plug-in can have multiple dependencies |
|
118 * to other plug-ins. |
|
119 * |
|
120 * @param aArray An array of logical names. |
|
121 * @see ServiceLogicalName. |
|
122 **/ |
|
123 IMPORT_C virtual void GetLogicalDependenciesL( CPtrCArray& aArray ) const; |
|
124 |
|
125 /** |
|
126 * Return the type of the plug-in. |
|
127 * |
|
128 * @return The type. |
|
129 * @see TPluginType. |
|
130 **/ |
|
131 IMPORT_C virtual TPluginType Type() const; |
|
132 |
|
133 /** |
|
134 * Create an icon that represents the plug-in. |
|
135 * |
|
136 * @return An icon. |
|
137 **/ |
|
138 IMPORT_C virtual CGulIcon* CreateIconL() const; |
|
139 |
|
140 /** |
|
141 * Get the order number that this plug-in should appear in its parent list. |
|
142 * |
|
143 * @return TUint order number. |
|
144 **/ |
|
145 IMPORT_C virtual TUint Order() const; |
|
146 |
|
147 /** |
|
148 * @see MDiagPlugin::IsSupported |
|
149 **/ |
|
150 IMPORT_C virtual TBool IsSupported() const; |
|
151 |
|
152 /** |
|
153 * Get UID of the parent. |
|
154 * |
|
155 * @return The parent UID. |
|
156 **/ |
|
157 IMPORT_C virtual TUid ParentUid() const; |
|
158 |
|
159 /** |
|
160 * @see MDiagPlugin::SetDTorIdKey() |
|
161 */ |
|
162 IMPORT_C virtual void SetDtorIdKey( TUid aDtorIdKey ); |
|
163 |
|
164 /** |
|
165 * Get title of the plugin. Default implementation in CDiagSuitePluginBase |
|
166 * will leave with KErrNotSupported. If plug-in has a title, plug-ins |
|
167 * must override this method. |
|
168 * @see MDiagPlugin::GetTitleL() |
|
169 */ |
|
170 IMPORT_C virtual HBufC* GetTitleL() const; |
|
171 |
|
172 /** |
|
173 * Get description of the plugin. Default implementation in |
|
174 * CDiagSuitePluginBase will leave with KErrNotSupported. If plug-in |
|
175 * has a description, plug-ins must override this method. |
|
176 * @see MDiagPlugin::GetDescriptionL() |
|
177 */ |
|
178 IMPORT_C virtual HBufC* GetDescriptionL() const; |
|
179 |
|
180 /** |
|
181 * Reserved for future use/plugin's custom functionality. |
|
182 * |
|
183 * @param aUid Unique identifier of the operation. |
|
184 * @param aParam Custom parameter. |
|
185 * @return TAny pointer. Custom data. |
|
186 */ |
|
187 IMPORT_C virtual TAny* CustomOperationL( TUid aUid, TAny* aParam ); |
|
188 |
|
189 /** |
|
190 * Reserved for future use/plugin's custom functionality. |
|
191 * |
|
192 * @param aUid Unique identifier of the property |
|
193 * @param aParam Custom parameter. |
|
194 * @return TAny pointer. Custom data. |
|
195 */ |
|
196 IMPORT_C virtual TAny* GetCustomL( TUid aUid, TAny* aParam ); |
|
197 |
|
198 /** |
|
199 * Initialization Step. This method is called before any plugin are executed. |
|
200 * This can be used to clean up any left over data from previous execution |
|
201 * sessions. All plug-ins in execution plan will have a chance to clean |
|
202 * up before any plug-ins are run. This is a synchrouns method. |
|
203 * |
|
204 * @param aEngine - Reference to engine. |
|
205 * @param aSkipDependencyCheck - If ETrue, plug-in will be executed |
|
206 * even if dependencies are not executed. |
|
207 * @param aCustomParams Custom parameters for plug-ins. |
|
208 * It can used to pass arbitrary data from application to the plug-ins. |
|
209 * Owership is not transferred and plug-in must not delete |
|
210 * this parameter. |
|
211 **/ |
|
212 IMPORT_C virtual void TestSessionBeginL( MDiagEngineCommon& aEngine, |
|
213 TBool aSkipDependencyCheck, |
|
214 TAny* aCustomParams ); |
|
215 |
|
216 /** |
|
217 * Cleanup Step. This method is called after all plug-ins in the |
|
218 * execution plan is completed to clean up any left over data from |
|
219 * current sesison. This can be used to clean up any data that |
|
220 * provides dependent service created for its dependencies. |
|
221 * This is a synchrouns method. |
|
222 * |
|
223 * @param aEngine - Reference to engine. |
|
224 * @param aSkipDependencyCheck - If ETrue, plug-in as executed |
|
225 * even if dependencies are not executed. |
|
226 * @param aCustomParams Custom parameters for plug-ins. |
|
227 * It can used to pass arbitrary data from application to the plug-ins. |
|
228 * Owership is not transferred and plug-in must not delete |
|
229 * this parameter. |
|
230 **/ |
|
231 IMPORT_C virtual void TestSessionEndL( MDiagEngineCommon& aEngine, |
|
232 TBool aSkipDependencyCheck, |
|
233 TAny* aCustomParams ); |
|
234 |
|
235 |
|
236 public: // from MDiagSuitePlugin |
|
237 |
|
238 /** |
|
239 * Get children of this plug-in. The pointer array is guaranteed to |
|
240 * be sorted defined by TSortOrder. |
|
241 * |
|
242 * @param aChildren Children are appended into this array. |
|
243 * @param aOrder Sorting algorithm. |
|
244 **/ |
|
245 IMPORT_C virtual void GetChildrenL( RPointerArray<MDiagPlugin>& aChildren, |
|
246 TSortOrder aOrder ) const; |
|
247 |
|
248 /** |
|
249 * Add one child. Child can be either a test suite or a test plug-in. |
|
250 * |
|
251 * @param aChild - Child to be added. However, ownership is not |
|
252 * transferred here. |
|
253 **/ |
|
254 IMPORT_C virtual void AddChildL( MDiagPlugin* aChild ); |
|
255 |
|
256 /** |
|
257 * Get the Uids. The uid is used for database access. |
|
258 * Test suites return a list of their childrens' uids. |
|
259 * |
|
260 * @param aUids An UID array. |
|
261 * @param aOrder Sorting algorithm. |
|
262 **/ |
|
263 IMPORT_C virtual void GetChildrenUidsL( RArray<TUid>& aUids, |
|
264 TSortOrder aOrder ) const; |
|
265 |
|
266 /** |
|
267 * Called before one of its test plug-in is executed. Note that it will |
|
268 * not be called if two of its children plug-ins are executed in |
|
269 * sequence. |
|
270 * |
|
271 * @param aSkipDependencyCheck - If ETrue dependency is disabled |
|
272 * for this test session. |
|
273 * @param aDependencyExecution - If ETrue, this suite is being |
|
274 * executed to satisfy dependency. |
|
275 **/ |
|
276 IMPORT_C virtual void PrepareChildrenExecutionL( TDiagSuiteExecParam* aParam, |
|
277 TBool aSkipDependencyCheck, |
|
278 TBool aDependencyExecution ); |
|
279 |
|
280 /** |
|
281 * Called before test execution switches to another test suite. |
|
282 * |
|
283 * @param aExecParams Parameters for suite post execution |
|
284 * @param aSkipDependencyCheck - If ETrue dependency is disabled |
|
285 * for this test session. |
|
286 * @param aDependencyExecution - If ETrue, this suite is being |
|
287 * executed to satisfy dependency. |
|
288 **/ |
|
289 IMPORT_C virtual void FinalizeChildrenExecutionL( TDiagSuiteExecParam* aParam, |
|
290 TBool aSkipDependencyCheck, |
|
291 TBool aDependencyExecution ); |
|
292 |
|
293 /** |
|
294 * Cancels pre/post execution. Cancellation is expected to be synchronous. |
|
295 * Suite plug-in must not call ContinueExecutionL(). |
|
296 * |
|
297 * @param aReason - Reason why ExecutionStopL() is being called. |
|
298 **/ |
|
299 IMPORT_C virtual void ExecutionStopL( TStopReason aReason ); |
|
300 |
|
301 private: // Private Data Types |
|
302 class TPrivateData; |
|
303 |
|
304 private: // Private data |
|
305 /** |
|
306 * Plug-in constructor parameter. |
|
307 * Ownership: this |
|
308 */ |
|
309 CDiagPluginConstructionParam* iConstructionParam; |
|
310 |
|
311 /** |
|
312 * CCoeEnv. This is needed for handling resources. |
|
313 */ |
|
314 CCoeEnv& iCoeEnv; |
|
315 |
|
316 /** |
|
317 * Plug-in base's private data |
|
318 */ |
|
319 TPrivateData* iData; |
|
320 }; |
|
321 |
|
322 #endif // DIAGSUITEPLUGINBASE_H |
|
323 |
|
324 // End of File |
|
325 |