Fixed Klocworks issues
[platform/framework/native/appfw.git] / inc / FSysBattery.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @if OSPCOMPAT
19  * @file        FSysBattery.h
20  * @brief       This is the header file for the %Battery class.
21  *
22  * This header file contains the declarations of the %Battery class.
23  * @endif
24  */
25
26 #ifndef _FSYS_BATTERY_H_
27 #define _FSYS_BATTERY_H_
28
29 #include <FBaseObject.h>
30 #include <FSysPowerManager.h>
31
32 namespace Tizen { namespace System
33 {
34
35 /**
36  * @if OSPCOMPAT
37  * @class       Battery
38  * @brief       <i>[Deprecated]</i> This class provides methods to get information related to the battery charge.
39  *
40  * @since       2.0
41  *
42  * @deprecated  This class is deprecated. Instead of using this class, use the PowerManager class.
43  * @final       This class is not intended for extension.
44  *
45  * The %Battery class provides methods to get the status related to battery levels and
46  * determine whether the battery is currently being charged.
47  * You cannot create an instance of this class directly.
48  *
49  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/system/battery_status.htm">Battery Status</a>.
50  * @endif
51  */
52
53 class _OSP_EXPORT_ Battery
54         : public Tizen::Base::Object
55 {
56
57 public:
58         /**
59          * @cond OSPDEPREC
60          * Gets the current charge remaining in the battery as a percentage.
61          *
62          * @deprecated  This method is deprecated. Instead of using this method, use the PowerManager::GetCurrentBatteryLevelInPercentage() method.
63          * @since       2.0
64          * @if OSPCOMPAT
65          * @brief       <i>[Deprecated] [Compatibility] </i>
66          * @compatibility       This method has compatibility issues with OSP compatible applications. @n
67          *                                      For more information, see @ref CompGetCurrentLevelInPercentage "here".
68          * @endif
69          * @return      An error code
70          * @param[out]  level   The percentage of the charge remaining in the battery
71          * @exception   E_SUCCESS       The method is successful.
72          * @exception   E_INVALID_STATE The battery service is not available.
73          * @exception   E_SYSTEM        The method cannot proceed due to a severe system error.
74          * @remarks The resolution of the level is @c 1% since 2.0. The range of the level is @c 0 (Minimum) to @c 100 (Maximum).
75          * @endcond
76          */
77         static result GetCurrentLevelInPercentage(int& level);
78
79         /**
80          * @if OSPCOMPAT
81          * @page        CompGetCurrentLevelInPercentage Compatibility for current battery level
82          * @section     CompGetCurrentLevelInPercentageIssue Issues
83          * Implementation of this method in %Tizen API versions prior to 2.1 has the following issue: @n
84          *
85          * - GetCurrentLevelInPercentage() is moved to PowerManager class.
86          *
87          * @section     CompGetCurrentLevelInPercentageResolution Resolutions
88          * The issue mentioned above is resolved in %Tizen API version 2.1 as follows: @n
89          *
90          * - GetCurrentLevelInPercentage() is provided by PowerManager class.
91          * @endif
92          */
93
94         /**
95          * @cond OSPDEPREC
96          * Gets the current charging level of the battery.
97          *
98          * @deprecated  This method is deprecated. Instead of using this method, use the PowerManager::GetCurrentBatteryLevel() method.
99          * @since       2.0
100          * @if OSPCOMPAT
101          * @brief       <i>[Deprecated] [Compatibility] </i>
102          * @compatibility       This method has compatibility issues with OSP compatible applications. @n
103          *                                      For more information, see @ref CompGetCurrentLevel "here".
104          * @endif
105          * @return      An error code
106          * @param[out]  level           A value from the enumerator BatteryLevel indicating the current charging level
107          * @exception   E_SUCCESS       The method is successful.
108          * @exception   E_INVALID_STATE The battery service is not available.
109          * @exception   E_SYSTEM        The method cannot proceed due to a severe system error.
110          * @endcond
111          */
112         static result GetCurrentLevel(BatteryLevel& level);
113
114         /**
115          * @if OSPCOMPAT
116          * @page        CompGetCurrentLevel Compatibility for current battery level
117          * @section     CompGetCurrentLevelIssue Issues
118          * Implementation of this method in %Tizen API versions prior to 2.1 has the following issue: @n
119          *
120          * - CompGetCurrentLevel() is moved to PowerManager class.
121          *
122          * @section     CompGetCurrentLevelResolution Resolutions
123          * The issue mentioned above is resolved in %Tizen API version 2.1 as follows: @n
124          *
125          * - GetCurrentLevel() is supported by PowerManager class.
126          * @endif
127          */
128
129         /**
130          * @cond OSPDEPREC
131          * Checks whether the battery is currently charging.
132          *
133          * @deprecated  This method is deprecated. Instead of using this method, use the PowerManager::IsCharging() method.
134          * @since       2.0
135          * @if OSPCOMPAT
136          * @brief       <i>[Deprecated] [Compatibility] </i>
137          * @compatibility       This method has compatibility issues with OSP compatible applications. @n
138          *                                      For more information, see @ref CompIsCharging "here".
139          * @endif
140          * @return      An error code
141          * @param[out]  charging        Set to @c true if the charging cable is connected to the phone, @n
142          *                              else @c false
143          * @exception   E_SUCCESS       The method is successful.
144          * @exception   E_INVALID_STATE The battery service is not available.
145          * @exception   E_SYSTEM        The method cannot proceed due to a severe system error.
146          * @endcond
147          */
148         static result IsCharging(bool& charging);
149
150         /**
151          * @if OSPCOMPAT
152          * @page        CompIsCharging Compatibility for current battery level
153          * @section     CompIsChargingIssue Issues
154          * Implementation of this method in %Tizen API versions prior to 2.1 has the following issue: @n
155          *
156          * - IsCharging() is moved to PowerManager class.
157          *
158          * @section     CompIsChargingResolution Resolutions
159          * The issue mentioned above is resolved in %Tizen API version 2.1 as follows: @n
160          *
161          * - IsCharging() is supported by PowerManager class.
162          * @endif
163          */
164
165 private:
166         /**
167          * This is the default constructor for this class. This default constructor is intentionally declared as private so that only the platform can create an instance.
168          */
169         Battery(void);
170
171         /**
172          * This is the destructor for this class. 
173          * This destructor overrides Tizen::Base::Object::~Object(). @n
174          */
175         virtual ~Battery(void);
176
177         /**
178          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
179          */
180         Battery(const Battery& value);
181
182         /**
183          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
184          */
185         Battery& operator =(const Battery& value);
186
187 private:
188         friend class _BatteryImpl;
189 }; // Battery
190
191 } } // Tizen::System
192
193 #endif // _FSYS_BATTERY_H_