|
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: This is the implementation module for the Diagnostics Battery Charger |
|
15 * Cable Test plugin |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 |
|
22 // Class Declaration |
|
23 #include "diagbatterychargercableplugin.h" |
|
24 |
|
25 // System includes |
|
26 #include <StringLoader.h> // StringLoader |
|
27 #include <avkon.hrh> // command definitions |
|
28 #include <DiagFrameworkDebug.h> // debug macros |
|
29 #include <DiagTestExecParam.h> // TDiagTestExecParam |
|
30 #include <DiagEngineCommon.h> // MDiagEngineCommon |
|
31 #include <devdiagbatterychargercabletestpluginrsc.rsg> // resource defintions |
|
32 |
|
33 // User includes |
|
34 #include "diagbatterychargercableengine.h" // CDiagBatteryChargerCableTestEngine |
|
35 #include "diagbatterychargercabletestplugin.hrh" // UIDs and Command Ids |
|
36 |
|
37 |
|
38 #include <AknDialog.h> // ADO & Platformization Changes |
|
39 #include <aknmessagequerydialog.h> // ADO & Platformization Changes |
|
40 #include <DiagCommonDialog.h> // for EDiagCommonDialogConfirmCancelAll |
|
41 // EXTERNAL DATA STRUCTURES |
|
42 |
|
43 // EXTERNAL FUNCTION PROTOTYPES |
|
44 |
|
45 // CONSTANTS |
|
46 const TUint KTotalNumOfSteps = 2; |
|
47 const TUid KDiagBatteryChargerCableTestPluginUid = { _IMPLEMENTATION_UID }; |
|
48 _LIT( KDiagBatteryChargerCableTestPluginResourceFileName, "z:DevDiagBatteryChargerCableTestPluginRsc.rsc" ); |
|
49 |
|
50 // MACROS |
|
51 |
|
52 // LOCAL CONSTANTS AND MACROS |
|
53 |
|
54 // MODULE DATA STRUCTURES |
|
55 |
|
56 // LOCAL FUNCTION PROTOTYPES |
|
57 |
|
58 // FORWARD DECLARATIONS |
|
59 |
|
60 // ============================= LOCAL FUNCTIONS ============================== |
|
61 |
|
62 // ========================= MEMBER FUNCTIONS ================================ |
|
63 |
|
64 // ---------------------------------------------------------------------------- |
|
65 // Standard C++ Constructor |
|
66 // ---------------------------------------------------------------------------- |
|
67 // |
|
68 CDiagBatteryChargerCableTestPlugin::CDiagBatteryChargerCableTestPlugin |
|
69 ( CDiagPluginConstructionParam* aParam ) |
|
70 : CDiagTestPluginBase( aParam ) |
|
71 { |
|
72 // nothing to do here |
|
73 } |
|
74 |
|
75 |
|
76 // --------------------------------------------------------------------------- |
|
77 // Symbian OS default constructor |
|
78 // --------------------------------------------------------------------------- |
|
79 MDiagPlugin* CDiagBatteryChargerCableTestPlugin::NewL( TAny* aInitParams ) |
|
80 { |
|
81 CDiagPluginConstructionParam* param = |
|
82 static_cast<CDiagPluginConstructionParam*>(aInitParams); |
|
83 |
|
84 CleanupStack::PushL( param ); |
|
85 CDiagBatteryChargerCableTestPlugin* self = |
|
86 new( ELeave ) CDiagBatteryChargerCableTestPlugin (param); |
|
87 CleanupStack::Pop( param ); |
|
88 |
|
89 CleanupStack::PushL( self ); |
|
90 self->ConstructL(); |
|
91 CleanupStack::Pop(self); |
|
92 |
|
93 return self; |
|
94 } |
|
95 |
|
96 |
|
97 |
|
98 // --------------------------------------------------------------------------- |
|
99 // Symbian OS second phased constructor |
|
100 // --------------------------------------------------------------------------- |
|
101 void CDiagBatteryChargerCableTestPlugin::ConstructL() |
|
102 { |
|
103 BaseConstructL ( KDiagBatteryChargerCableTestPluginResourceFileName ); |
|
104 } |
|
105 |
|
106 |
|
107 // ---------------------------------------------------------------------------- |
|
108 // Destructor |
|
109 // ---------------------------------------------------------------------------- |
|
110 CDiagBatteryChargerCableTestPlugin::~CDiagBatteryChargerCableTestPlugin() |
|
111 { |
|
112 // StopAndCleanupL() called by base class, whcih calls |
|
113 // Cancel() -> DoCancel() |
|
114 // DoStopAndCleanupL() |
|
115 // Not much to do here. |
|
116 } |
|
117 |
|
118 |
|
119 // --------------------------------------------------------------------------- |
|
120 // From class CDiagTestPluginBase. |
|
121 // Returns whether the plugin should be displayed or not. |
|
122 // --------------------------------------------------------------------------- |
|
123 |
|
124 TBool CDiagBatteryChargerCableTestPlugin::IsVisible() const |
|
125 { |
|
126 return ETrue; |
|
127 } |
|
128 |
|
129 |
|
130 // --------------------------------------------------------------------------- |
|
131 // From class CDiagTestPluginBase. |
|
132 // Returns the plugin's level of interactivity. |
|
133 // --------------------------------------------------------------------------- |
|
134 MDiagTestPlugin::TRunMode CDiagBatteryChargerCableTestPlugin::RunMode() const |
|
135 { |
|
136 return EInteractiveDialog; |
|
137 } |
|
138 |
|
139 // --------------------------------------------------------------------------- |
|
140 // From class CDiagTestPluginBase. |
|
141 // Returns the total number of execution steps for the plugin. |
|
142 // --------------------------------------------------------------------------- |
|
143 TUint CDiagBatteryChargerCableTestPlugin::TotalSteps() const |
|
144 { |
|
145 return KTotalNumOfSteps; |
|
146 } |
|
147 |
|
148 // --------------------------------------------------------------------------- |
|
149 // From MDiagPlugin |
|
150 // CDiagBatteryChargerCableTestPlugin::GetPluginNameL |
|
151 // --------------------------------------------------------------------------- |
|
152 HBufC* CDiagBatteryChargerCableTestPlugin::GetPluginNameL( |
|
153 TNameLayoutType aLayoutType ) const |
|
154 { |
|
155 switch ( aLayoutType ) |
|
156 { |
|
157 case ENameLayoutHeadingPane: |
|
158 return StringLoader::LoadL( R_DIAG_BATTERY_CHARGER_CABLE_TEST_HEADING_PANE ); |
|
159 |
|
160 case ENameLayoutPopupInfoPane: |
|
161 return StringLoader::LoadL( R_DIAG_BATTERY_CHARGER_CABLE_TEST_POPUP_INFO_PANE ); |
|
162 |
|
163 case ENameLayoutTitlePane: |
|
164 return StringLoader::LoadL( R_DIAG_BATTERY_CHARGER_CABLE_TEST_TITLE_PANE ); |
|
165 |
|
166 case ENameLayoutListSingleGraphic: |
|
167 return StringLoader::LoadL( R_DIAG_BATTERY_CHARGER_CABLE_TEST_SINGLE_GRAPHIC ); |
|
168 |
|
169 case ENameLayoutListSingle: |
|
170 return StringLoader::LoadL ( R_DIAG_BATTERY_CHARGER_CABLE_TEST_SINGLE ); |
|
171 |
|
172 default: |
|
173 { |
|
174 LOGSTRING2( "CDiagBatteryChargerCableTestPlugin::GetPluginNameL: " |
|
175 L"ERROR: Unsupported layout type %d", aLayoutType ) |
|
176 __ASSERT_DEBUG( 0, User::Invariant() ); |
|
177 |
|
178 return StringLoader::LoadL ( R_DIAG_BATTERY_CHARGER_CABLE_TEST_SINGLE ); |
|
179 } |
|
180 } |
|
181 } |
|
182 |
|
183 // --------------------------------------------------------------------------- |
|
184 // From class CDiagTestPluginBase. |
|
185 // Returns the plugin's UID. |
|
186 // --------------------------------------------------------------------------- |
|
187 TUid CDiagBatteryChargerCableTestPlugin::Uid() const |
|
188 { |
|
189 return KDiagBatteryChargerCableTestPluginUid; |
|
190 } |
|
191 |
|
192 |
|
193 // --------------------------------------------------------------------------- |
|
194 // From class CActive. |
|
195 // Active object run handler. |
|
196 // --------------------------------------------------------------------------- |
|
197 void CDiagBatteryChargerCableTestPlugin::RunL() |
|
198 { |
|
199 } |
|
200 |
|
201 // --------------------------------------------------------------------------- |
|
202 // From class CActive. |
|
203 // Active object cancel. |
|
204 // --------------------------------------------------------------------------- |
|
205 void CDiagBatteryChargerCableTestPlugin::DoCancel() |
|
206 { |
|
207 } |
|
208 |
|
209 // --------------------------------------------------------------------------- |
|
210 // From class CDiagTestPluginBase. |
|
211 // Called from the base class to begin test execution. |
|
212 // --------------------------------------------------------------------------- |
|
213 void CDiagBatteryChargerCableTestPlugin::DoRunTestL() |
|
214 { |
|
215 LOGSTRING( "CDiagBatteryChargerCableTestPlugin Test execution begins" ) |
|
216 |
|
217 // Run Battery Charger Cable Test |
|
218 ASSERT( iEngine == NULL ); |
|
219 |
|
220 iEngine = CDiagBatteryChargerCableTestEngine::NewL(*this, |
|
221 SinglePluginExecution() ); |
|
222 |
|
223 |
|
224 // ADO & Platformization Changes |
|
225 TInt aButtonId; |
|
226 |
|
227 ShowMessageQueryL(R_DIAG_MESSAGEQUERY_TITLE_BATTERY_CHARGER,aButtonId); |
|
228 |
|
229 if(aButtonId == EBatteryTestConnectBatteryChargerCancel) |
|
230 { |
|
231 CompleteTestL( CDiagResultsDatabaseItem::ESkipped ); |
|
232 return; |
|
233 } |
|
234 |
|
235 if(aButtonId == EBatteryTestConnectBatteryChargerSkip) |
|
236 { |
|
237 TInt confirmResult = 0; |
|
238 |
|
239 CAknDialog* dlg = ExecutionParam().Engine(). |
|
240 CreateCommonDialogLC( EDiagCommonDialogConfirmSkipAll, NULL ); |
|
241 |
|
242 if ( !RunWaitingDialogL( dlg, confirmResult ) ) |
|
243 { |
|
244 return; |
|
245 } |
|
246 |
|
247 if (confirmResult) |
|
248 { |
|
249 return; |
|
250 } |
|
251 } |
|
252 // Changes Ends |
|
253 iEngine->RunBatteryChargerTestL(); |
|
254 } |
|
255 |
|
256 // --------------------------------------------------------------------------- |
|
257 // From CDiagTestPluginBase |
|
258 // CDiagBatteryChargerCableTestPlugin::DoStopAndCleanupL() |
|
259 // --------------------------------------------------------------------------- |
|
260 void CDiagBatteryChargerCableTestPlugin::DoStopAndCleanupL() |
|
261 { |
|
262 delete iEngine; |
|
263 iEngine = NULL; |
|
264 } |
|
265 |
|
266 // --------------------------------------------------------------------------- |
|
267 // The engine class uses this interface to inform the plug-in class about the |
|
268 // test result. |
|
269 // --------------------------------------------------------------------------- |
|
270 void CDiagBatteryChargerCableTestPlugin::ReportTestResultL( |
|
271 CDiagResultsDatabaseItem::TResult aResult) |
|
272 { |
|
273 CompleteTestL( aResult ); |
|
274 } |
|
275 |
|
276 |
|
277 // --------------------------------------------------------------------------- |
|
278 // The engine class uses this callback on the plugin class to ask the user if |
|
279 // the entire test execution needs to be cancelled. |
|
280 // --------------------------------------------------------------------------- |
|
281 TBool CDiagBatteryChargerCableTestPlugin::AskCancelExecutionL(TInt& aUserResponse) |
|
282 { |
|
283 CAknDialog* cancelDialog = ExecutionParam().Engine(). |
|
284 CreateCommonDialogLC( EDiagCommonDialogConfirmCancelAll, NULL ); |
|
285 |
|
286 return RunWaitingDialogL( cancelDialog, aUserResponse ); |
|
287 } |
|
288 // ADO & Platformization Changes |
|
289 TBool CDiagBatteryChargerCableTestPlugin::ShowMessageQueryL( TInt aResourceId, TInt &aButtonId ) |
|
290 { |
|
291 LOGSTRING( "CDiagAudioPlugin::ShowMessageQueryL IN" ) |
|
292 CAknMessageQueryDialog* dlg = NULL; |
|
293 TBool result = EFalse; |
|
294 |
|
295 // Create CAknMessageQueryDialog instance |
|
296 dlg = new ( ELeave ) CAknMessageQueryDialog(); |
|
297 |
|
298 dlg->PrepareLC( aResourceId ); |
|
299 |
|
300 CEikButtonGroupContainer& cba = dlg->ButtonGroupContainer(); |
|
301 |
|
302 switch ( aResourceId ) |
|
303 { |
|
304 case R_DIAG_MESSAGEQUERY_TITLE_BATTERY_CHARGER: |
|
305 { |
|
306 if ( SinglePluginExecution() ) |
|
307 { |
|
308 cba.SetCommandSetL( R_CBA_CONNECT_AND_PRESS_OK_SINGLE_EXECUTION ); |
|
309 } |
|
310 else |
|
311 { |
|
312 cba.SetCommandSetL( R_CBA_CONNECT_AND_PRESS_OK_SKIP_GROUP_EXECUTION ); |
|
313 } |
|
314 } |
|
315 break; |
|
316 |
|
317 default: |
|
318 break; |
|
319 } |
|
320 |
|
321 result = RunWaitingDialogL( dlg, aButtonId ); |
|
322 |
|
323 LOGSTRING3( "CDiagAudioPlugin::ShowMessageQueryL() OUT aButtonId=%d result=%d", aButtonId, result ); |
|
324 return result; |
|
325 } |
|
326 // End of File |
|
327 |