|
1 /* |
|
2 * Copyright (c) 2007-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 CHARGING_STATUS_OBSERVER |
|
20 #define CHARGING_STATUS_OBSERVER |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32property.h> |
|
24 #include <e32base.h> |
|
25 #include <hwrmpowerstatesdkpskeys.h> |
|
26 #include <etelmm.h> |
|
27 |
|
28 // CLASS DECLARATION |
|
29 |
|
30 /** |
|
31 * MChargingStatusNotifier |
|
32 * Interface class for NotifyChargingStatus() |
|
33 */ |
|
34 class MChargingStatusNotifier |
|
35 { |
|
36 public: |
|
37 |
|
38 /** |
|
39 * Notifier for charging status changes |
|
40 * |
|
41 * @param aError error code |
|
42 * @param aBatteryInfo data structure of contents of the battery status |
|
43 */ |
|
44 virtual void NotifyChargingStatus( TInt aErrorCode, |
|
45 RMobilePhone::TMobilePhoneBatteryInfoV1 aBatteryInfo ) = 0; |
|
46 }; |
|
47 |
|
48 // CLASS DECLARATION |
|
49 |
|
50 /** |
|
51 * CChargingStatusObserver is used to provide battery charging status from HWRM |
|
52 * to CTSY |
|
53 */ |
|
54 NONSHARABLE_CLASS( CChargingStatusObserver ) : public CActive |
|
55 { |
|
56 public: |
|
57 |
|
58 /** |
|
59 * Two-phased constructor |
|
60 * |
|
61 * @param aChargingStatusNotifier reference to interface class |
|
62 * MChargingStatusNotifier |
|
63 * @return Pointer to the created object |
|
64 */ |
|
65 static CChargingStatusObserver* NewL( |
|
66 MChargingStatusNotifier& aChargingStatusNotifier ); |
|
67 |
|
68 /** |
|
69 * Two-phased constructor |
|
70 * |
|
71 * @param aChargingStatusNotifier reference to interface class |
|
72 * MChargingStatusNotifier |
|
73 * @return Pointer to the created object |
|
74 */ |
|
75 static CChargingStatusObserver* NewLC( |
|
76 MChargingStatusNotifier& aChargingStatusNotifier ); |
|
77 |
|
78 /** |
|
79 * Destructor |
|
80 */ |
|
81 ~CChargingStatusObserver(); |
|
82 |
|
83 /** |
|
84 * Handles GetChargingStatus request completion event |
|
85 */ |
|
86 void RunL(); |
|
87 |
|
88 /** |
|
89 * Cancellation of an outstanding request |
|
90 */ |
|
91 void DoCancel(); |
|
92 |
|
93 /** |
|
94 * Get charging status |
|
95 */ |
|
96 void GetChargingStatus(); |
|
97 |
|
98 private: |
|
99 |
|
100 /** |
|
101 * By default Symbian 2nd phase constructor is private |
|
102 */ |
|
103 void ConstructL(); |
|
104 |
|
105 /** |
|
106 * Constructor |
|
107 * |
|
108 * @param aChargingStatusNotifier reference to interface class |
|
109 * MChargingStatusNotifier |
|
110 */ |
|
111 CChargingStatusObserver( |
|
112 MChargingStatusNotifier& aChargingStatusNotifier ); |
|
113 |
|
114 private: |
|
115 |
|
116 /** |
|
117 * Property for charging status |
|
118 */ |
|
119 RProperty iChargingStatus; |
|
120 |
|
121 /** |
|
122 * Reference to ChargingStatusNotifier object |
|
123 */ |
|
124 MChargingStatusNotifier& iChargingStatusNotifier; |
|
125 }; |
|
126 |
|
127 |
|
128 #endif /*CHARGING_STATUS_OBSERVER*/ |
|
129 |
|
130 // End of File |