25
|
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: .
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef DEVDIAGRUNTIMEREQSINFO_H
|
|
20 |
#define DEVDIAGRUNTIMEREQSINFO_H
|
|
21 |
|
|
22 |
// System Include Files
|
|
23 |
#include <e32base.h> // CActive
|
|
24 |
#include <e32def.h> // TInt, TUint, TInt64
|
|
25 |
#include <e32std.h> // TTime, TCallBack
|
|
26 |
#include <etel.h> // RTelServer
|
|
27 |
#include <etel3rdparty.h> // CTelephony Packages
|
|
28 |
#include <etelmm.h> // RMobilePhone
|
|
29 |
|
|
30 |
// Forward Declarations
|
|
31 |
class RFs;
|
|
32 |
class RDiagResultsDatabase;
|
|
33 |
|
|
34 |
/**
|
|
35 |
* Phone Doctor Application Runtime Requirements Information
|
|
36 |
* This class checks the current status of diagnostics requirements,
|
|
37 |
* which must be satisfied before the Phone Doctor Application may run tests.
|
|
38 |
*
|
|
39 |
* @lib euser.lib
|
|
40 |
* @lib centralrepository.lib
|
|
41 |
*/
|
|
42 |
class CDevDiagRuntimeReqsInfo : public CActive
|
|
43 |
{
|
|
44 |
|
|
45 |
public: // Data Types
|
|
46 |
|
|
47 |
/**
|
|
48 |
* Error codes indicating the results of the runtime requirements checks.
|
|
49 |
*/
|
|
50 |
enum TResult
|
|
51 |
{
|
|
52 |
EResultOk = 0,
|
|
53 |
EResultErrLowDisk,
|
|
54 |
EResultErrLowBattery,
|
|
55 |
};
|
|
56 |
|
|
57 |
|
|
58 |
public: // New Functions
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Two-phased constructor.
|
|
62 |
*
|
|
63 |
* @param aFs A reference to a connected file system object.
|
|
64 |
* @param aDb A reference to a connection results database session.
|
|
65 |
* @param aCallback A general callback that indicates when checking the
|
|
66 |
* runtime requirements has finished.
|
|
67 |
* @return A pointer to a new instance of CDevDiagRuntimeReqsInfo.
|
|
68 |
*/
|
|
69 |
static CDevDiagRuntimeReqsInfo* NewL( RFs& aFs,
|
|
70 |
RDiagResultsDatabase& aDb,
|
|
71 |
TCallBack aCallback );
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Destructor.
|
|
75 |
*/
|
|
76 |
virtual ~CDevDiagRuntimeReqsInfo();
|
|
77 |
|
|
78 |
/**
|
|
79 |
* Checks if the diagnostics runtime requirements are satisfied. This
|
|
80 |
* is an asynchronous request which will complete with a callback.
|
|
81 |
*
|
|
82 |
* @param aResumingTests If ETrue, then runtime checks which do not apply
|
|
83 |
* to resumed test execution will be skipped.
|
|
84 |
*/
|
|
85 |
void CheckRuntimeRequirementsL( TBool aResumingTests );
|
|
86 |
|
|
87 |
/**
|
|
88 |
* Returns the runtime requirements result, which indicates if the runtime
|
|
89 |
* requirements were satisfied.
|
|
90 |
*
|
|
91 |
* @return The runtime requirements result.
|
|
92 |
*/
|
|
93 |
TResult Result() const;
|
|
94 |
|
|
95 |
/**
|
|
96 |
* Displays the dialog associated with the result of the runtime checks.
|
|
97 |
*
|
|
98 |
* @return The command the dialog is dismissed with.
|
|
99 |
*/
|
|
100 |
TInt DisplayDialogL() const;
|
|
101 |
|
|
102 |
|
|
103 |
private: // Data Types
|
|
104 |
|
|
105 |
/**
|
|
106 |
* The state of the runtime requirements. This is used to handle
|
|
107 |
* completion of the asynchronous requests.
|
|
108 |
*/
|
|
109 |
enum TState
|
|
110 |
{
|
|
111 |
EStateInitial = 0,
|
|
112 |
EStateCheckingBattery,
|
|
113 |
EStateComplete
|
|
114 |
};
|
|
115 |
|
|
116 |
|
|
117 |
private: // New Functions
|
|
118 |
|
|
119 |
/**
|
|
120 |
* C++ constructor.
|
|
121 |
*
|
|
122 |
* @param aFs A reference to a connected file system object.
|
|
123 |
* @param aDb A reference to a connection results database session.
|
|
124 |
* @param aCallback A general callback that indicates when checking the
|
|
125 |
* runtime requirements has finished.
|
|
126 |
*/
|
|
127 |
CDevDiagRuntimeReqsInfo( RFs& aFs,
|
|
128 |
RDiagResultsDatabase& aDb,
|
|
129 |
TCallBack aCallback );
|
|
130 |
|
|
131 |
/**
|
|
132 |
* Two-phased constructor.
|
|
133 |
*/
|
|
134 |
void ConstructL();
|
|
135 |
|
|
136 |
/**
|
|
137 |
* Reads the runtime requirements values from the central repository and
|
|
138 |
* stores them to the object.
|
|
139 |
*/
|
|
140 |
void ReadCentralRepositoryValuesL();
|
|
141 |
|
|
142 |
|
|
143 |
/**
|
|
144 |
* Checks if there is enough free estimated disk space to log test
|
|
145 |
* results. Updates the member data with the disk space information.
|
|
146 |
*/
|
|
147 |
void CheckDiskSpaceL();
|
|
148 |
|
|
149 |
/**
|
|
150 |
* Checks if the phone's battery level is adequate to run tests. Updates
|
|
151 |
* the member data with the battery level information.
|
|
152 |
*/
|
|
153 |
void CheckBatteryLevelL();
|
|
154 |
|
|
155 |
/**
|
|
156 |
* This is a utility function to handle the common checking for completion
|
|
157 |
* of the runtime requirements checks. If a runtime check failed, this
|
|
158 |
* will set the object active so that the runtime checking completes.
|
|
159 |
*
|
|
160 |
* @return ETrue if checking is done, EFalse if checking should continue.
|
|
161 |
*/
|
|
162 |
TBool CheckCompletion();
|
|
163 |
|
|
164 |
/**
|
|
165 |
* Utility function to display a message dialog associated with the
|
|
166 |
* specified resource.
|
|
167 |
*
|
|
168 |
* @param aResource The resource of the message query dialog to display.
|
|
169 |
* @return The button pressed to dismiss the dialog.
|
|
170 |
*/
|
|
171 |
static TInt DisplayMessageQueryDialogL( TInt aResource );
|
|
172 |
|
|
173 |
|
|
174 |
private: // From base class CActive
|
|
175 |
|
|
176 |
/**
|
|
177 |
* From CActive.
|
|
178 |
* This function is called when an active request completes.
|
|
179 |
*/
|
|
180 |
virtual void RunL();
|
|
181 |
|
|
182 |
/**
|
|
183 |
* From CActive.
|
|
184 |
* This function is called to cancel any outstanding asynchronous
|
|
185 |
* requests.
|
|
186 |
*/
|
|
187 |
virtual void DoCancel();
|
|
188 |
|
|
189 |
/**
|
|
190 |
* From CActive.
|
|
191 |
* This function is called when RunL leaves
|
|
192 |
*
|
|
193 |
*/
|
|
194 |
virtual TInt RunError( TInt aError );
|
|
195 |
|
|
196 |
private: // Data
|
|
197 |
|
|
198 |
/**
|
|
199 |
* A reference to a connected file server session, used to check the disk
|
|
200 |
* space.
|
|
201 |
*/
|
|
202 |
RFs& iFs;
|
|
203 |
|
|
204 |
/**
|
|
205 |
* A reference to a connected results database session, used to get
|
|
206 |
* information about the maximum executions.
|
|
207 |
*/
|
|
208 |
RDiagResultsDatabase& iDb;
|
|
209 |
|
|
210 |
/**
|
|
211 |
* A general callback that indicates when checking the runtime
|
|
212 |
* requirements has finished.
|
|
213 |
*/
|
|
214 |
TCallBack iCallback;
|
|
215 |
|
|
216 |
/**
|
|
217 |
* A telephony object used to check some of the runtime requirements
|
|
218 |
* checks.
|
|
219 |
* Own.
|
|
220 |
*/
|
|
221 |
CTelephony* iTelephony;
|
|
222 |
|
|
223 |
/**
|
|
224 |
* A battery info object used to satisfy the runtime requirement check for
|
|
225 |
* minimum battery level.
|
|
226 |
*/
|
|
227 |
CTelephony::TBatteryInfoV1 iBatteryInfo;
|
|
228 |
|
|
229 |
/**
|
|
230 |
* A package object for the battery information.
|
|
231 |
*/
|
|
232 |
CTelephony::TBatteryInfoV1Pckg iBatteryInfoPackage;
|
|
233 |
|
|
234 |
/**
|
|
235 |
* Indicates if the runtime requirements are being checked for resumed
|
|
236 |
* test execution. If ETrue, then runtime checks which do not apply to
|
|
237 |
* resumed test execution will be skipped.
|
|
238 |
*/
|
|
239 |
TBool iResumingTests;
|
|
240 |
|
|
241 |
/**
|
|
242 |
* The runtime requirements status, which will contain error code values
|
|
243 |
* to indicate if the runtime requirements are satisfied.
|
|
244 |
*/
|
|
245 |
TResult iResult;
|
|
246 |
|
|
247 |
/**
|
|
248 |
* The state, which is used when handling asynchronous requests.
|
|
249 |
*/
|
|
250 |
TState iState;
|
|
251 |
|
|
252 |
/**
|
|
253 |
* The current battery level.
|
|
254 |
*/
|
|
255 |
TInt iBatteryLevel;
|
|
256 |
|
|
257 |
/**
|
|
258 |
* The minimum required battery level.
|
|
259 |
*/
|
|
260 |
TInt iMinBatteryLevel;
|
|
261 |
|
|
262 |
/**
|
|
263 |
* The current amount of free disk space (in bytes).
|
|
264 |
*/
|
|
265 |
TInt64 iDiskSpaceFree;
|
|
266 |
|
|
267 |
/**
|
|
268 |
* The minimum required free disk space (in bytes).
|
|
269 |
*/
|
|
270 |
TInt64 iMinDiskSpaceFree;
|
|
271 |
|
|
272 |
|
|
273 |
};
|
|
274 |
|
|
275 |
#endif // DEVDIAGRUNTIMEREQSINFO_H
|