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