23 #include <hwrmpower.h> |
23 #include <hwrmpower.h> |
24 |
24 |
25 #include "perfmon.hrh" |
25 #include "perfmon.hrh" |
26 |
26 |
27 // HWRM reporting interval multiplier |
27 // HWRM reporting interval multiplier |
28 const TInt KSampleIntervalMultiple = 1; |
28 const TInt KHWRMSampleIntervalMultiple = 1; |
29 const TInt KReportingDuration = 0; // Infinite duration |
29 const TInt KHWRMReportingDuration = 0; // Infinite duration |
30 |
30 |
31 class CPerfMonPowerListener : public CBase, public MHWRMBatteryPowerObserver |
31 class CPerfMonPowerListenerImpl; |
|
32 |
|
33 class CPerfMonPowerListener : public CBase |
32 { |
34 { |
33 public: |
35 public: |
34 static CPerfMonPowerListener* NewL(); |
36 static CPerfMonPowerListener* NewL(); |
35 ~CPerfMonPowerListener(); |
37 ~CPerfMonPowerListener(); |
36 |
38 |
37 private: |
39 private: |
38 CPerfMonPowerListener(); |
40 CPerfMonPowerListener(); |
39 void ConstructL(); |
41 void ConstructL(); |
40 |
42 |
|
43 public: |
|
44 // Is power monitoring feature suported by platform |
|
45 static inline TBool IsSupported() { return iIsSupported; }; |
|
46 |
|
47 // Start monitoring power data |
|
48 TInt Activate(); |
|
49 // Stop monitoring power data |
|
50 void DeActivate(); |
|
51 |
|
52 // Get average power since last read. |
|
53 TInt GetPower(); |
|
54 // Maximum power value since measurement started |
|
55 TInt GetMaxPower(); |
|
56 |
|
57 private: |
|
58 static TBool iIsSupported; |
|
59 CPerfMonPowerListenerImpl* iPowerListenerImpl; |
|
60 }; |
|
61 |
|
62 |
|
63 |
|
64 class CPerfMonPowerListenerImpl : public CBase, public MHWRMBatteryPowerObserver |
|
65 { |
|
66 public: |
|
67 static CPerfMonPowerListenerImpl* NewL(); |
|
68 ~CPerfMonPowerListenerImpl(); |
|
69 |
|
70 private: |
|
71 CPerfMonPowerListenerImpl(); |
|
72 void ConstructL(); |
|
73 |
41 // Handling central repository max reporting period key |
74 // Handling central repository max reporting period key |
42 void GetReportingPeriodL(); |
75 TInt GetReportingPeriodL(); |
43 void SetReportingPeriodL(TInt aDuration); |
76 void SetReportingPeriodL(TInt aDuration); |
44 |
77 |
45 public: |
78 public: |
46 static TBool IsSupported(); |
|
47 |
|
48 // Start monitoring power values |
79 // Start monitoring power values |
49 TInt Activate(); |
80 TInt Activate(); |
50 // Stop monitoring power values |
81 // Stop monitoring power values |
51 void DeActivate(); |
82 void DeActivate(); |
52 |
83 |