58
|
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: CDiagVibratePugin derives from CDiagTestPluginBase and
|
|
15 |
* is the access point to run the vibrate test.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef __DIAGVIBRATEPLUGIN_H__
|
|
21 |
#define __DIAGVIBRATEPLUGIN_H__
|
|
22 |
|
|
23 |
// INCLUDES
|
|
24 |
#include <DiagTestPluginBase.h> //CDiagTestPluginBase
|
|
25 |
#include <AknProgressDialog.h> //MProgressDialogCallback
|
|
26 |
|
|
27 |
#include "diagvibratepluginobserver.h" //MDiagVibratePluginObserver
|
|
28 |
|
|
29 |
// CONSTANTS
|
|
30 |
|
|
31 |
// MACROS
|
|
32 |
|
|
33 |
// DATA TYPES
|
|
34 |
|
|
35 |
// FUNCTION PROTOTYPES
|
|
36 |
|
|
37 |
// FORWARD DECLARATIONS
|
|
38 |
class CDiagVibratePluginEngine;
|
|
39 |
|
|
40 |
// CLASS DEFINITION
|
|
41 |
class CDiagVibratePlugin : public CDiagTestPluginBase,
|
|
42 |
public MDiagVibratePluginObserver,
|
|
43 |
public MProgressDialogCallback
|
|
44 |
|
|
45 |
{
|
|
46 |
public: // Constructors and destructor
|
|
47 |
|
|
48 |
/**
|
|
49 |
* Symbian OS two-phased constructor
|
|
50 |
* @return MDiagPlugin*
|
|
51 |
*/
|
|
52 |
static MDiagPlugin* NewL( TAny* aInitParams );
|
|
53 |
|
|
54 |
/**
|
|
55 |
* Destructor
|
|
56 |
*/
|
|
57 |
virtual ~CDiagVibratePlugin();
|
|
58 |
|
|
59 |
public: // From CDiagTestPluginBase
|
|
60 |
|
|
61 |
/**
|
|
62 |
* @see CDiagTestPluginBase::Visible()
|
|
63 |
*/
|
|
64 |
virtual TBool IsVisible() const;
|
|
65 |
|
|
66 |
/**
|
|
67 |
* @see CDiagTestPluginBase::RunMode()
|
|
68 |
*/
|
|
69 |
virtual TRunMode RunMode() const;
|
|
70 |
|
|
71 |
/**
|
|
72 |
* @see CDiagTestPluginBase::TotalSteps()
|
|
73 |
*/
|
|
74 |
virtual TUint TotalSteps() const;
|
|
75 |
|
|
76 |
/**
|
|
77 |
* @see CDiagTestPluginBase::GetPluginNameL
|
|
78 |
*/
|
|
79 |
virtual HBufC* GetPluginNameL( TNameLayoutType aLayoutType ) const;
|
|
80 |
|
|
81 |
/**
|
|
82 |
* @see CDiagTestPluginBase::Uid
|
|
83 |
*/
|
|
84 |
virtual TUid Uid() const;
|
|
85 |
|
|
86 |
public: // from MDiagVibratePluginObserver
|
|
87 |
|
|
88 |
/**
|
|
89 |
* Inform vibrate status changes
|
|
90 |
*
|
|
91 |
* @param aStatus Status of the vibrate engine
|
|
92 |
*/
|
|
93 |
virtual void VibraStatusChanged( TVibrateStatus aStatus );
|
|
94 |
|
|
95 |
private: // from CDiagTestPluginBase
|
|
96 |
|
|
97 |
/**
|
|
98 |
* Handle plug-in execution.
|
|
99 |
* @see CDiagTestPluginBase::DoRunTestL
|
|
100 |
*/
|
|
101 |
void DoRunTestL();
|
|
102 |
|
|
103 |
/**
|
|
104 |
* Clean up
|
|
105 |
* @see CDiagTestPluginBase::DoStopAndCleanupL
|
|
106 |
*/
|
|
107 |
void DoStopAndCleanupL();
|
|
108 |
|
|
109 |
private: // from CActive
|
|
110 |
|
|
111 |
/**
|
|
112 |
* Handle active object completion event
|
|
113 |
*/
|
|
114 |
virtual void RunL();
|
|
115 |
|
|
116 |
/**
|
|
117 |
* Handle RunL leaves
|
|
118 |
*/
|
|
119 |
virtual TInt RunError( TInt aError );
|
|
120 |
|
|
121 |
/**
|
|
122 |
* Handle cancel
|
|
123 |
*/
|
|
124 |
virtual void DoCancel();
|
|
125 |
|
|
126 |
private: // from MProgressDialogCallback
|
|
127 |
|
|
128 |
/**
|
|
129 |
* Called when the progress dialog is dismissed.
|
|
130 |
*
|
|
131 |
* @param aButtonId - indicate which button made dialog to dismiss
|
|
132 |
*/
|
|
133 |
virtual void DialogDismissedL( TInt aButtonId );
|
|
134 |
|
|
135 |
private:
|
|
136 |
|
|
137 |
/**
|
|
138 |
* C++ default constructor.
|
|
139 |
*/
|
|
140 |
CDiagVibratePlugin( CDiagPluginConstructionParam* aInitParams );
|
|
141 |
|
|
142 |
/**
|
|
143 |
* Symbian OS default constructor.
|
|
144 |
*
|
|
145 |
*/
|
|
146 |
void ConstructL();
|
|
147 |
|
|
148 |
private: // data
|
|
149 |
|
|
150 |
/** enum for the vibrate plugin internal state */
|
|
151 |
enum TState
|
|
152 |
{
|
|
153 |
EStateUnknown = 0,
|
|
154 |
EStateFailed,
|
|
155 |
EStateCancelled,
|
|
156 |
EStateSkipped,
|
|
157 |
EStateIdle,
|
|
158 |
EStateVibrating,
|
|
159 |
EStateUserQuery,
|
|
160 |
EStateBlocked,
|
|
161 |
EStateRestart
|
|
162 |
};
|
|
163 |
|
|
164 |
private: // private functions
|
|
165 |
|
|
166 |
/**
|
|
167 |
* Makes sure vibrate is enabled in the profile
|
|
168 |
*/
|
|
169 |
TInt SetVibrateSettingOnL();
|
|
170 |
|
|
171 |
/**
|
|
172 |
* Sets the vibration setting to its original value
|
|
173 |
*/
|
|
174 |
void SetVibrateSettingToOriginalValueL();
|
|
175 |
|
|
176 |
/**
|
|
177 |
* Checks if the charger is connected
|
|
178 |
*/
|
|
179 |
TBool IsChargerConnected() const;
|
|
180 |
|
|
181 |
/**
|
|
182 |
* Sets the state
|
|
183 |
* @param aState State to be set
|
|
184 |
*/
|
|
185 |
void SetState( CDiagVibratePlugin::TState aState );
|
|
186 |
|
|
187 |
/**
|
|
188 |
* Displays disconnect charger dlg
|
|
189 |
* @return TBool
|
|
190 |
*/
|
|
191 |
TBool DisplayDisconnectChargerQueryL();
|
|
192 |
|
|
193 |
/**
|
|
194 |
* Displays vibrating progress dialog
|
|
195 |
*/
|
|
196 |
void ShowVibratingNoteL();
|
|
197 |
|
|
198 |
/**
|
|
199 |
* Gets vibration time in seconds from CR
|
|
200 |
*/
|
|
201 |
void ReadVibrationTimeL();
|
|
202 |
|
|
203 |
/*
|
|
204 |
* confirmation query for activating the vibration in profile.
|
|
205 |
*/
|
|
206 |
TInt ShowActivateConfNoteL();
|
|
207 |
|
|
208 |
private: // data
|
|
209 |
|
|
210 |
/**
|
|
211 |
* Vibrate plugin engine
|
|
212 |
* own
|
|
213 |
*/
|
|
214 |
CDiagVibratePluginEngine* iEngine;
|
|
215 |
|
|
216 |
/**
|
|
217 |
* Progress Dialog
|
|
218 |
* own
|
|
219 |
*/
|
|
220 |
CAknProgressDialog* iProgressDialog;
|
|
221 |
|
|
222 |
/**
|
|
223 |
* State of the vibrate plugin
|
|
224 |
*/
|
|
225 |
TState iState;
|
|
226 |
|
|
227 |
/**
|
|
228 |
* Indicates if the profile vibrate setting was
|
|
229 |
* temporalily set active
|
|
230 |
*/
|
|
231 |
TBool iVibrateSettingUpdated;
|
|
232 |
|
|
233 |
/**
|
|
234 |
* Original profile vibrate setting
|
|
235 |
*/
|
|
236 |
TBool iOrigVibrateSetting;
|
|
237 |
|
|
238 |
/**
|
|
239 |
* Vibration time in seconds
|
|
240 |
*/
|
|
241 |
TInt iVibrationTime;
|
|
242 |
|
|
243 |
};
|
|
244 |
|
|
245 |
#endif // __DIAGVIBRATEPLUGIN_H__
|
|
246 |
|
|
247 |
// End of File
|