|
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 the License "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 POWEROBSERVER_H |
|
20 #define POWEROBSERVER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <etel3rdparty.h> |
|
25 #include <npscript.h> |
|
26 #include "SystemInfoObserver.h" |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CSystemInfoPlugin; |
|
30 |
|
31 // CONSTANTS |
|
32 |
|
33 // State enum and member variable |
|
34 |
|
35 // CLASS DECLARATIONS |
|
36 /** |
|
37 * CPowerObserver. |
|
38 * Interface to information about power and battery. |
|
39 * @lib npSystemInfoPlugin.lib |
|
40 * @since S60 v3.2 |
|
41 */ |
|
42 NONSHARABLE_CLASS(CPowerObserver) : public CBase, public MSystemInfoObserverClient |
|
43 { |
|
44 public: |
|
45 /** |
|
46 * Two-phased constructor. |
|
47 */ |
|
48 static CPowerObserver* NewL( CSystemInfoPlugin* aPlugin ); |
|
49 |
|
50 /** |
|
51 * Destructor. |
|
52 */ |
|
53 virtual ~CPowerObserver(); |
|
54 |
|
55 public: |
|
56 enum TIdPowerItem |
|
57 { |
|
58 EIdBatteryInfo, |
|
59 EIdIndicator // charger connected indicator |
|
60 }; |
|
61 |
|
62 /** |
|
63 * Request power values change notification. |
|
64 * @since 3.2 |
|
65 * @param name of the callback |
|
66 * @return void |
|
67 */ |
|
68 void RequestNotificationL( TIdPowerItem aId, HBufC8* aFunctionName ); |
|
69 |
|
70 public: |
|
71 /** |
|
72 * Called to get battery charge level. |
|
73 * @since 3.2 |
|
74 * @param void |
|
75 * @return charge level |
|
76 */ |
|
77 TInt ChargeLevel() const; |
|
78 |
|
79 /** |
|
80 * Called to get charger connected flag. |
|
81 * @since 3.2 |
|
82 * @param void |
|
83 * @return 1 if charger connected, 0 if not connected |
|
84 */ |
|
85 TInt ChargerConnected() const; |
|
86 |
|
87 public: |
|
88 // from MSystemInfoObserverClient |
|
89 virtual void SubscribeL( TInt aId, TRequestStatus& aStatus ); |
|
90 virtual void UpdateL( TInt aId ); |
|
91 virtual void Cancel( TInt aId ); |
|
92 virtual void Close( TInt aId ); |
|
93 |
|
94 private: |
|
95 /** |
|
96 * C++ default constructor. |
|
97 */ |
|
98 CPowerObserver( CSystemInfoPlugin* aPlugin ); |
|
99 |
|
100 /** |
|
101 * By default Symbian 2nd phase constructor is private. |
|
102 * @param none |
|
103 * @return void |
|
104 */ |
|
105 void ConstructL(); |
|
106 |
|
107 public: |
|
108 CSystemInfoPlugin* iSystemInfoPlugin; |
|
109 CTelephony* iTelephony; // owned |
|
110 CTelephony* iTelephony2; // owned |
|
111 |
|
112 // battery |
|
113 CTelephony::TBatteryInfoV1Pckg iBatteryInfoPckg; |
|
114 CTelephony::TBatteryInfoV1 iBatteryInfo; |
|
115 CSystemInfoObserver* iBatteryInfoObserver; // owned |
|
116 HBufC8* iBatteryInfoChangedFunction; |
|
117 TInt iBatteryInfoStarted; |
|
118 |
|
119 // charger |
|
120 CTelephony::TIndicatorV1Pckg iIndicatorPckg; |
|
121 CTelephony::TIndicatorV1 iIndicator; |
|
122 CSystemInfoObserver* iIndicatorObserver; // owned |
|
123 HBufC8* iIndicatorChangedFunction; |
|
124 TInt iIndicatorStarted; |
|
125 }; |
|
126 |
|
127 #endif // POWEROBSERVER_H |
|
128 |
|
129 // End of File |