|
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: CSysApBatteryInfoController class declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef SYSAPBATTERYINFOCONTROLLER_H |
|
20 #define SYSAPBATTERYINFOCONTROLLER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 class CBSUtil; |
|
25 class CBatteryPopupControl; |
|
26 |
|
27 /** |
|
28 * Controller for enhanced battery information. |
|
29 * |
|
30 * @lib None. |
|
31 * @since S60 5.0 |
|
32 */ |
|
33 class CSysApBatteryInfoController : public CBase |
|
34 { |
|
35 |
|
36 /** |
|
37 * States for battery information. |
|
38 */ |
|
39 enum TBatteryInfoState |
|
40 { |
|
41 /** |
|
42 * Battery capacity is below defined threshold. |
|
43 * The battery information is displayed every time when |
|
44 * the battery capacity decreases. |
|
45 */ |
|
46 EBatteryInfoBelowThreshold, |
|
47 |
|
48 /** |
|
49 * Battery capacity is above defined threshold. |
|
50 * The battery information is not shown |
|
51 */ |
|
52 EBatteryInfoAboveThreshold, |
|
53 |
|
54 /** |
|
55 * Battery status is low or empty. |
|
56 * The battery information is not shown. |
|
57 */ |
|
58 EBatteryInfoStatusLow |
|
59 }; |
|
60 |
|
61 public: |
|
62 /** |
|
63 * Symbian two-phase controller. |
|
64 * |
|
65 * @since S60 5.0 |
|
66 * @param aThreshold battery capacity percentage after which enhanced battery information |
|
67 * is displayed. |
|
68 */ |
|
69 static CSysApBatteryInfoController* NewL( TInt aThreshold ); |
|
70 |
|
71 /** |
|
72 * Destructor. |
|
73 */ |
|
74 virtual ~CSysApBatteryInfoController(); |
|
75 |
|
76 /** |
|
77 * Power menu has been displayed. |
|
78 * Displays the enhanced battery information. |
|
79 * |
|
80 * @since S60 5.0 |
|
81 */ |
|
82 void PowerMenuShownL(); |
|
83 |
|
84 /** |
|
85 * Battery level indicator has been updated. |
|
86 * Displays the enhanced battery information if needed. |
|
87 * |
|
88 * @since S60 5.0 |
|
89 */ |
|
90 void BatteryLevelUpdatedL(); |
|
91 |
|
92 /** |
|
93 * Battery status has been updated. |
|
94 * Stops displaying the battery information even if the battery level |
|
95 * is below the threshold value and continues to decrease. |
|
96 * |
|
97 * @since S60 5.0 |
|
98 * @param aValue battery status |
|
99 * |
|
100 * @see KHWRMBatteryStatus |
|
101 */ |
|
102 void BatteryStatusUpdated( const TInt aValue ); |
|
103 |
|
104 private: |
|
105 |
|
106 /** |
|
107 * C++ default constructor. |
|
108 */ |
|
109 CSysApBatteryInfoController(); |
|
110 |
|
111 /** |
|
112 * Constructor. |
|
113 */ |
|
114 CSysApBatteryInfoController( TInt aThreshold ); |
|
115 |
|
116 /** |
|
117 * Symbian 2nd-phase constructor. |
|
118 */ |
|
119 void ConstructL(); |
|
120 |
|
121 /** |
|
122 * Displays the battery pane popup. |
|
123 */ |
|
124 void ShowBatteryPreviewPopupL( TInt aCapacity ); |
|
125 |
|
126 private: // data |
|
127 |
|
128 /** |
|
129 * Battery State utility. |
|
130 * Own. |
|
131 */ |
|
132 CBSUtil* iBsUtil; |
|
133 |
|
134 /** |
|
135 * Battery capacity percentage which is currently shown. |
|
136 */ |
|
137 TInt iCurrentCapacity; |
|
138 |
|
139 /** |
|
140 * Battery capacity percentage after which the enhanced battery |
|
141 * information is shown for the first time. |
|
142 */ |
|
143 TInt iThresholdCapacity; |
|
144 |
|
145 /** |
|
146 * Battery info state. |
|
147 */ |
|
148 TBatteryInfoState iBatteryInfoState; |
|
149 |
|
150 /** |
|
151 * Battery popup control. |
|
152 * Own. |
|
153 */ |
|
154 CBatteryPopupControl* iBatteryPopup; |
|
155 }; |
|
156 |
|
157 |
|
158 #endif // SYSAPBATTERYINFOCONTROLLER_H |