|
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 header for the Diagnostics USB Cable Test Engine |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef DIAGUSBCABLETESTENGINE_H |
|
20 #define DIAGUSBCABLETESTENGINE_H |
|
21 |
|
22 |
|
23 // INCLUDES |
|
24 #include <DiagResultsDatabaseItem.h> // CDiagResultsDatabaseItem |
|
25 #include <usbman.h> // RUsb |
|
26 |
|
27 #include "diagusbcabletestcallbackinterface.h" // MDiagUSBTestCallBackInterface |
|
28 |
|
29 //CONSTANTS |
|
30 |
|
31 // MACROS |
|
32 |
|
33 // DATA TYPES |
|
34 |
|
35 // FUNCTION PROTOTYPES |
|
36 |
|
37 // FORWARD DECLARATIONS |
|
38 class CDiagPluginWaitingDialogWrapper; |
|
39 class CRepository; |
|
40 |
|
41 // CLASS DEFINITION |
|
42 |
|
43 /** |
|
44 * This is the engine class of the USB cable test plugin. |
|
45 */ |
|
46 class CDiagUSBCableTestEngine : public CActive |
|
47 { |
|
48 public: //public constructor and destructor. |
|
49 |
|
50 /** |
|
51 * Symbian two phase constructor |
|
52 */ |
|
53 static CDiagUSBCableTestEngine* NewL(MDiagUSBTestCallBackInterface& aInterface, |
|
54 TBool aIsSinglePluginExecution); |
|
55 |
|
56 /** |
|
57 * Destructor |
|
58 */ |
|
59 ~CDiagUSBCableTestEngine(); |
|
60 |
|
61 public: // public interfaces |
|
62 |
|
63 /** |
|
64 * The plugin class starts the USB cable test using this function |
|
65 */ |
|
66 void RunUSBCableTestL(); |
|
67 |
|
68 private: // private constructors |
|
69 |
|
70 /** |
|
71 * C++ constructor |
|
72 */ |
|
73 CDiagUSBCableTestEngine(MDiagUSBTestCallBackInterface& aInterface, |
|
74 TBool aIsSinglePluginExecution); |
|
75 |
|
76 /** |
|
77 * Symbian second phase constructor. |
|
78 */ |
|
79 void ConstructL(); |
|
80 |
|
81 private: // private internal functions |
|
82 |
|
83 /** |
|
84 * This is an internal function to end the test execution and report result to the |
|
85 * plug-in class. |
|
86 */ |
|
87 void ReportResultToPluginL(CDiagResultsDatabaseItem::TResult aResult); |
|
88 |
|
89 /** |
|
90 * This function detects the USB cable status. |
|
91 */ |
|
92 TBool CheckIfUSBCableDetectedL(); |
|
93 |
|
94 /** |
|
95 * Ask user to connect charger and press OK |
|
96 * @param aUserResponse - Dialog response will be returned via this parameter. |
|
97 * @return ETrue - If dialog was dismissed by end user. |
|
98 * EFalse - If dialog was deleted. |
|
99 */ |
|
100 TBool ConnectAndPressOkL( TInt& aUserResponse ); |
|
101 |
|
102 /** |
|
103 * Ask user to remove all cables and press OK |
|
104 * @param aUserResponse - Dialog response will be returned via this parameter. |
|
105 * @return ETrue - If dialog was dismissed by end user. |
|
106 * EFalse - If dialog was deleted. |
|
107 */ |
|
108 TBool RemoveAllCablesL( TInt& aUserResponse ); |
|
109 |
|
110 /** |
|
111 * Display "No cable detected. Try again?" prompt |
|
112 * @param aUserResponse - Dialog response will be returned via this parameter. |
|
113 * @return ETrue - If dialog was dismissed by end user. |
|
114 * EFalse - If dialog was deleted. |
|
115 */ |
|
116 TBool AskIfRetryL( TInt& aUserResponse ); |
|
117 |
|
118 /** |
|
119 * Displays a query dialog with header |
|
120 * @param aDialogResourceId - Resource ID of the dialog to display |
|
121 * @param aUserResponse - Dialog response will be returned via this parameter. |
|
122 * @return ETrue - If dialog was dismissed by end user. |
|
123 * EFalse - If dialog was deleted. |
|
124 */ |
|
125 TBool DisplayQueryDialogWithHeaderL( TInt aDialogResourceId, |
|
126 TInt& aUserResponse ); |
|
127 |
|
128 protected: // from CActive |
|
129 /** |
|
130 * Handle active object completion event, used to handle internal trigger in our plug-in |
|
131 */ |
|
132 void RunL(); |
|
133 |
|
134 /** |
|
135 * Handle cancel |
|
136 */ |
|
137 void DoCancel(); |
|
138 |
|
139 |
|
140 private: // Data |
|
141 |
|
142 /** |
|
143 * Reference to the callback interface between the engine class and plugin class |
|
144 */ |
|
145 MDiagUSBTestCallBackInterface& iInterface; |
|
146 |
|
147 /** |
|
148 * Wrapper to display waiting dialog. This helps to identify if the dialog |
|
149 * was dismissed by end-user or by object deletion. |
|
150 * Ownership: This class. |
|
151 */ |
|
152 CDiagPluginWaitingDialogWrapper* iWaitingDialogWrapper; |
|
153 |
|
154 /** |
|
155 * Instance of the session to the USB manager. |
|
156 */ |
|
157 RUsb iUsbManager; |
|
158 |
|
159 /** |
|
160 * Instance of the central repository handle. Own |
|
161 */ |
|
162 CRepository *iCenRep; |
|
163 |
|
164 /** |
|
165 * Boolean flag to remember if the cenrep is modified by the test plugin. |
|
166 */ |
|
167 TBool iCenrepModified; |
|
168 |
|
169 /** |
|
170 * This flag indicates if the plugin is run in single test execution mode. |
|
171 */ |
|
172 TBool iIsSinglePluginExecution; |
|
173 |
|
174 }; |
|
175 |
|
176 #endif //DIAGUSBCABLETESTENGINE_H |
|
177 |
|
178 // End of File |