|
1 /* |
|
2 * Copyright (c) 2009 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 PERFMON_POWERLISTENER_H |
|
20 #define PERFMON_POWERLISTENER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <hwrmpower.h> |
|
24 |
|
25 #include "perfmon.hrh" |
|
26 |
|
27 // HWRM reporting interval multiplier |
|
28 const TInt KSampleIntervalMultiple = 1; |
|
29 const TInt KReportingDuration = 0; // Infinite duration |
|
30 |
|
31 class CPerfMonPowerListener : public CBase, public MHWRMBatteryPowerObserver |
|
32 { |
|
33 public: |
|
34 static CPerfMonPowerListener* NewL(); |
|
35 ~CPerfMonPowerListener(); |
|
36 |
|
37 private: |
|
38 CPerfMonPowerListener(); |
|
39 void ConstructL(); |
|
40 |
|
41 // Handling central repository max reporting period key |
|
42 void GetReportingPeriodL(); |
|
43 void SetReportingPeriodL(TInt aDuration); |
|
44 |
|
45 public: |
|
46 static TBool IsSupported(); |
|
47 |
|
48 // Start monitoring power values |
|
49 TInt Activate(); |
|
50 // Stop monitoring power values |
|
51 void DeActivate(); |
|
52 |
|
53 // Get average power since last read. |
|
54 TInt GetPower(); |
|
55 // Maximum power value since measurement started |
|
56 inline TInt GetMaxPower() { return iMaxPower; } |
|
57 |
|
58 virtual void PowerMeasurement(TInt aErrCode, CHWRMPower::TBatteryPowerMeasurementData& aMeasurement); |
|
59 |
|
60 private: |
|
61 CHWRMPower* iHWRMPower; |
|
62 RArray<TInt> iPowerBuffer; |
|
63 TInt iLastPowerAvg; |
|
64 TInt iMaxPower; |
|
65 |
|
66 TInt iOriginalMaxReportingPeriod; |
|
67 }; |
|
68 |
|
69 #endif |