|
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: Class definition of CDiagRootSuite |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // CLASS DECLARATION |
|
20 #include "diagrootsuite.h" |
|
21 |
|
22 // SYSTEM INCLUDE FILES |
|
23 #include <DiagSuiteExecParam.h> // TDiagSuiteExecParam |
|
24 #include <DiagSuiteObserver.h> // MDiagSuiteObserver |
|
25 |
|
26 // USER INCLUDE FILES |
|
27 #include "diagframework.pan" // panic codes. |
|
28 #include "diagrootsuite.h" // CDiagRootSuite |
|
29 |
|
30 using namespace DiagFwInternal; |
|
31 |
|
32 // ======== LOCAL FUNCTIONS ======== |
|
33 /** |
|
34 * Compares two plug-ins by order. Used for RArray InsertInOrderAllowRepeats |
|
35 * @param aFirst - first plug-in |
|
36 * @param aSecond - second plug-in |
|
37 * @return positive if aFirst > aSecond |
|
38 * 0 if same. |
|
39 * negative if aFirst < aSecond |
|
40 */ |
|
41 static TInt ComparePluginByOrder( const MDiagPlugin& aFirst, |
|
42 const MDiagPlugin& aSecond ) |
|
43 { |
|
44 return aFirst.Order() - aSecond.Order(); |
|
45 } |
|
46 |
|
47 |
|
48 // ======== MEMBER FUNCTIONS ======== |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // CDiagRootSuite::ConstructL() |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 void CDiagRootSuite::ConstructL() |
|
55 { |
|
56 } |
|
57 |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 // CDiagRootSuite::NewL() |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 CDiagRootSuite* CDiagRootSuite::NewL() |
|
64 { |
|
65 CDiagRootSuite* self = CDiagRootSuite::NewLC(); |
|
66 CleanupStack::Pop( self ); |
|
67 return self; |
|
68 } |
|
69 |
|
70 |
|
71 // --------------------------------------------------------------------------- |
|
72 // CDiagRootSuite::NewLC() |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 CDiagRootSuite* CDiagRootSuite::NewLC() |
|
76 { |
|
77 CDiagRootSuite* self = new( ELeave )CDiagRootSuite(); |
|
78 CleanupStack::PushL( self ); |
|
79 self->ConstructL(); |
|
80 return self; |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // CDiagRootSuite::CDiagRootSuite |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 CDiagRootSuite::CDiagRootSuite() |
|
88 : iChildren() |
|
89 { |
|
90 } |
|
91 |
|
92 // --------------------------------------------------------------------------- |
|
93 // CDiagRootSuite::~CDiagRootSuite |
|
94 // --------------------------------------------------------------------------- |
|
95 // |
|
96 CDiagRootSuite::~CDiagRootSuite() |
|
97 { |
|
98 iChildren.Close(); |
|
99 } |
|
100 |
|
101 |
|
102 // --------------------------------------------------------------------------- |
|
103 // from MDiagPlugin |
|
104 // CDiagRootSuite::GetPluginNameL |
|
105 // --------------------------------------------------------------------------- |
|
106 // |
|
107 HBufC* CDiagRootSuite::GetPluginNameL( TNameLayoutType /* aLayoutType */) const |
|
108 { |
|
109 _LIT( KRootSuitePluginName, "*Root Suite" ); |
|
110 return KRootSuitePluginName().AllocL(); |
|
111 } |
|
112 |
|
113 // --------------------------------------------------------------------------- |
|
114 // from MDiagPlugin |
|
115 // CDiagRootSuite::ServiceLogicalName |
|
116 // --------------------------------------------------------------------------- |
|
117 // |
|
118 const TDesC& CDiagRootSuite::ServiceLogicalName() const |
|
119 { |
|
120 _LIT( KRootSuiteServiceName, "" ); |
|
121 return KRootSuiteServiceName(); |
|
122 } |
|
123 |
|
124 // --------------------------------------------------------------------------- |
|
125 // From MDiagPlugin |
|
126 // CDiagRootSuite::GetLogicalDependenciesL |
|
127 // --------------------------------------------------------------------------- |
|
128 // |
|
129 void CDiagRootSuite::GetLogicalDependenciesL( CPtrCArray& /* aArray */ ) const |
|
130 { |
|
131 } |
|
132 |
|
133 |
|
134 // --------------------------------------------------------------------------- |
|
135 // From MDiagPlugin |
|
136 // CDiagRootSuite::Type |
|
137 // --------------------------------------------------------------------------- |
|
138 // |
|
139 MDiagPlugin::TPluginType CDiagRootSuite::Type() const |
|
140 { |
|
141 return ETypeSuitePlugin; |
|
142 } |
|
143 |
|
144 // --------------------------------------------------------------------------- |
|
145 // From MDiagPlugin |
|
146 // CDiagRootSuite::CreateIconL |
|
147 // --------------------------------------------------------------------------- |
|
148 // |
|
149 CGulIcon* CDiagRootSuite::CreateIconL() const |
|
150 { |
|
151 return NULL; |
|
152 } |
|
153 |
|
154 |
|
155 // --------------------------------------------------------------------------- |
|
156 // From MDiagPlugin |
|
157 // CDiagRootSuite::IsVisible |
|
158 // --------------------------------------------------------------------------- |
|
159 // |
|
160 TBool CDiagRootSuite::IsVisible() const |
|
161 { |
|
162 return EFalse; |
|
163 } |
|
164 |
|
165 // --------------------------------------------------------------------------- |
|
166 // From MDiagPlugin |
|
167 // CDiagRootSuite::IsSupported |
|
168 // --------------------------------------------------------------------------- |
|
169 // |
|
170 TBool CDiagRootSuite::IsSupported() const |
|
171 { |
|
172 return ETrue; |
|
173 } |
|
174 |
|
175 // --------------------------------------------------------------------------- |
|
176 // From MDiagPlugin |
|
177 // CDiagRootSuite::GetTitleL |
|
178 // --------------------------------------------------------------------------- |
|
179 // |
|
180 HBufC* CDiagRootSuite::GetTitleL() const |
|
181 { |
|
182 // This should never be displayed to the end user. |
|
183 _LIT( KRootSuitePluginTitle, "*Root Suite Title" ); |
|
184 return KRootSuitePluginTitle().AllocL(); |
|
185 } |
|
186 |
|
187 // --------------------------------------------------------------------------- |
|
188 // From MDiagPlugin |
|
189 // CDiagRootSuite::GetDescriptionL |
|
190 // --------------------------------------------------------------------------- |
|
191 // |
|
192 HBufC* CDiagRootSuite::GetDescriptionL() const |
|
193 { |
|
194 // This should never be displayed to the end user. |
|
195 _LIT( KRootSuitePluginDesc, "*Root Suite Desc" ); |
|
196 return KRootSuitePluginDesc().AllocL(); |
|
197 } |
|
198 |
|
199 // --------------------------------------------------------------------------- |
|
200 // From MDiagPlugin |
|
201 // CDiagRootSuite::Uid |
|
202 // --------------------------------------------------------------------------- |
|
203 // |
|
204 TUid CDiagRootSuite::Uid() const |
|
205 { |
|
206 return TUid::Uid( 0 ); |
|
207 } |
|
208 |
|
209 |
|
210 |
|
211 // --------------------------------------------------------------------------- |
|
212 // From MDiagPlugin |
|
213 // CDiagRootSuite::ParentUid |
|
214 // --------------------------------------------------------------------------- |
|
215 // |
|
216 TUid CDiagRootSuite::ParentUid() const |
|
217 { |
|
218 return TUid::Uid( 0 ); |
|
219 } |
|
220 |
|
221 |
|
222 // --------------------------------------------------------------------------- |
|
223 // From MDiagPlugin |
|
224 // CDiagRootSuite::SetDtorIdKey |
|
225 // --------------------------------------------------------------------------- |
|
226 // |
|
227 void CDiagRootSuite::SetDtorIdKey( TUid /* aDtorIdKey */ ) |
|
228 { |
|
229 } |
|
230 |
|
231 |
|
232 // --------------------------------------------------------------------------- |
|
233 // From MDiagPlugin |
|
234 // CDiagRootSuite::CustomOperationL |
|
235 // --------------------------------------------------------------------------- |
|
236 // |
|
237 TAny* CDiagRootSuite::CustomOperationL( TUid /*aUid*/, TAny* /*aParam*/ ) |
|
238 { |
|
239 User::Leave( KErrNotSupported ); |
|
240 return NULL; |
|
241 } |
|
242 |
|
243 // --------------------------------------------------------------------------- |
|
244 // From MDiagPlugin |
|
245 // CDiagRootSuite::GetCustomL |
|
246 // --------------------------------------------------------------------------- |
|
247 // |
|
248 TAny* CDiagRootSuite::GetCustomL( TUid /* aUid */, TAny* /*aParam*/ ) |
|
249 { |
|
250 User::Leave( KErrNotSupported ); |
|
251 return NULL; |
|
252 } |
|
253 |
|
254 |
|
255 // --------------------------------------------------------------------------- |
|
256 // From MDiagTestPlugin |
|
257 // CDiagRootSuite::TestSessionBeginL |
|
258 // --------------------------------------------------------------------------- |
|
259 // |
|
260 void CDiagRootSuite::TestSessionBeginL( MDiagEngineCommon& /* aEngine */, |
|
261 TBool /* aSkipDependencyCheck */, |
|
262 TAny* /* aCustomParams */ ) |
|
263 { |
|
264 // nothing to do |
|
265 } |
|
266 |
|
267 // --------------------------------------------------------------------------- |
|
268 // From MDiagTestPlugin |
|
269 // CDiagRootSuite::CleanupL |
|
270 // --------------------------------------------------------------------------- |
|
271 // |
|
272 void CDiagRootSuite::TestSessionEndL( MDiagEngineCommon& /* aEngine */, |
|
273 TBool /* aSkipDependencyCheck */, |
|
274 TAny* /* aCustomParams */ ) |
|
275 { |
|
276 // nothing to do |
|
277 } |
|
278 |
|
279 |
|
280 |
|
281 // --------------------------------------------------------------------------- |
|
282 // From MDiagPlugin |
|
283 // CDiagRootSuite::Order |
|
284 // --------------------------------------------------------------------------- |
|
285 // |
|
286 TUint CDiagRootSuite::Order() const |
|
287 { |
|
288 return 0; |
|
289 } |
|
290 |
|
291 |
|
292 // --------------------------------------------------------------------------- |
|
293 // From MDiagSuitePlugin |
|
294 // CDiagRootSuite::GetChildrenL |
|
295 // --------------------------------------------------------------------------- |
|
296 // |
|
297 void CDiagRootSuite::GetChildrenL( RPointerArray<MDiagPlugin>& aChildren, |
|
298 TSortOrder aOrder ) const |
|
299 { |
|
300 if ( aOrder != ENotSorted && aOrder != ESortByPosition ) |
|
301 User::Leave( KErrArgument ); |
|
302 |
|
303 for ( TInt i = 0; i < iChildren.Count(); i++ ) |
|
304 { |
|
305 aChildren.AppendL( iChildren[i] ); |
|
306 } |
|
307 } |
|
308 |
|
309 // --------------------------------------------------------------------------- |
|
310 // From MDiagSuitePlugin |
|
311 // CDiagRootSuite::AddChildL |
|
312 // --------------------------------------------------------------------------- |
|
313 // |
|
314 void CDiagRootSuite::AddChildL( MDiagPlugin* aChild ) |
|
315 { |
|
316 TLinearOrder<MDiagPlugin> order( *ComparePluginByOrder ); |
|
317 User::LeaveIfError( iChildren.InsertInOrderAllowRepeats( aChild, order ) ); |
|
318 } |
|
319 |
|
320 // --------------------------------------------------------------------------- |
|
321 // From MDiagSuitePlugin |
|
322 // CDiagRootSuite::PrepareChildrenExecutionL |
|
323 // --------------------------------------------------------------------------- |
|
324 // |
|
325 void CDiagRootSuite::PrepareChildrenExecutionL( TDiagSuiteExecParam* aParam, |
|
326 TBool /* aSkipDependencyCheck */, |
|
327 TBool /* aDependencyExecution */ ) |
|
328 { |
|
329 aParam->Observer().ContinueExecutionL( *this ); |
|
330 delete aParam; |
|
331 } |
|
332 |
|
333 // --------------------------------------------------------------------------- |
|
334 // From MDiagSuitePlugin |
|
335 // CDiagRootSuite::FinalizeExecutionL |
|
336 // --------------------------------------------------------------------------- |
|
337 // |
|
338 void CDiagRootSuite::FinalizeChildrenExecutionL( TDiagSuiteExecParam* aParam, |
|
339 TBool /* aSkipDependencyCheck */, |
|
340 TBool /* aDependencyExecution */ ) |
|
341 { |
|
342 aParam->Observer().ContinueExecutionL( *this ); |
|
343 delete aParam; |
|
344 } |
|
345 |
|
346 |
|
347 // --------------------------------------------------------------------------- |
|
348 // From MDiagSuitePlugin |
|
349 // CDiagRootSuite::GetChildrenUidsL |
|
350 // --------------------------------------------------------------------------- |
|
351 // |
|
352 void CDiagRootSuite::GetChildrenUidsL( RArray<TUid>& aUids, |
|
353 TSortOrder aOrder ) const |
|
354 { |
|
355 if ( aOrder != ENotSorted && aOrder != ESortByPosition ) |
|
356 User::Leave( KErrArgument ); |
|
357 |
|
358 for ( TInt i = 0; i < iChildren.Count(); i++ ) |
|
359 { |
|
360 aUids.AppendL( iChildren[i]->Uid() ); |
|
361 } |
|
362 } |
|
363 |
|
364 // --------------------------------------------------------------------------- |
|
365 // From MDiagSuitePlugin |
|
366 // CDiagRootSuite::ExecutionStopL |
|
367 // --------------------------------------------------------------------------- |
|
368 // |
|
369 void CDiagRootSuite::ExecutionStopL( TStopReason /* aReason */ ) |
|
370 { |
|
371 } |
|
372 |
|
373 // End of File |
|
374 |