2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
20 * @brief This is the header file for the %Battery class.
22 * This header file contains the declarations of the %Battery class.
26 #ifndef _FSYS_BATTERY_H_
27 #define _FSYS_BATTERY_H_
29 #include <FBaseObject.h>
30 #include <FSysPowerManager.h>
32 namespace Tizen { namespace System
38 * @brief <i>[Deprecated]</i> This class provides methods to get information related to the battery charge.
42 * @deprecated This class is deprecated. Instead of using this class, use the PowerManager class.
43 * @final This class is not intended for extension.
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.
49 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/system/battery_status.htm">Battery Status</a>.
55 * @page CompGetCurrentLevelInPercentage Compatibility for current battery level
56 * @section CompGetCurrentLevelInPercentageIssue Issues
57 * Implementation of this method in %Tizen API versions prior to 2.1 has the following issue: @n
59 * -# GetCurrentLevelInPercentage() is moved to PowerManager class.
61 * @section CompGetCurrentLevelInPercentageResolution Resolutions
62 * The issue mentioned above is resolved in %Tizen API version 2.1 as follows: @n
64 * -# GetCurrentLevelInPercentage() is provided by PowerManager class.
70 * @page CompGetCurrentLevel Compatibility for current battery level
71 * @section CompGetCurrentLevelIssue Issues
72 * Implementation of this method in %Tizen API versions prior to 2.1 has the following issue: @n
74 * -# CompGetCurrentLevel() is moved to PowerManager class.
76 * @section CompGetCurrentLevelResolution Resolutions
77 * The issue mentioned above is resolved in %Tizen API version 2.1 as follows: @n
79 * -# GetCurrentLevel() is supported by PowerManager class.
85 * @page CompIsCharging Compatibility for current battery level
86 * @section CompIsChargingIssue Issues
87 * Implementation of this method in %Tizen API versions prior to 2.1 has the following issue: @n
89 * -# IsCharging() is moved to PowerManager class.
91 * @section CompIsChargingResolution Resolutions
92 * The issue mentioned above is resolved in %Tizen API version 2.1 as follows: @n
94 * -# IsCharging() is supported by PowerManager class.
98 class _OSP_EXPORT_ Battery
99 : public Tizen::Base::Object
106 * Gets the current charge remaining in the battery as a percentage.
108 * @deprecated This method is deprecated. Instead of using this method, use the PowerManager::GetCurrentBatteryLevelInPercentage() method.
111 * @compatibility This method has compatibility issues with OSP compatible applications. @n
112 * For more information, see @ref CompGetCurrentLevelInPercentage "here".
113 * @return An error code
114 * @param[out] level The percentage of the charge remaining in the battery
115 * @exception E_SUCCESS The method is successful.
116 * @exception E_INVALID_STATE The battery service is not available.
117 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
118 * @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).
122 static result GetCurrentLevelInPercentage(int& level);
127 * Gets the current charging level of the battery.
129 * @deprecated This method is deprecated. Instead of using this method, use the PowerManager::GetCurrentBatteryLevel() method.
132 * @compatibility This method has compatibility issues with OSP compatible applications. @n
133 * For more information, see @ref CompGetCurrentLevel "here".
134 * @return An error code
135 * @param[out] level A value from the enumerator BatteryLevel indicating the current charging level
136 * @exception E_SUCCESS The method is successful.
137 * @exception E_INVALID_STATE The battery service is not available.
138 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
142 static result GetCurrentLevel(BatteryLevel& level);
147 * Checks whether the battery is currently charging.
149 * @deprecated This method is deprecated. Instead of using this method, use the PowerManager::IsCharging() method.
152 * @compatibility This method has compatibility issues with OSP compatible applications. @n
153 * For more information, see @ref CompIsCharging "here".
154 * @return An error code
155 * @param[out] charging Set to @c true if the charging cable is connected to the phone, @n
157 * @exception E_SUCCESS The method is successful.
158 * @exception E_INVALID_STATE The battery service is not available.
159 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
163 static result IsCharging(bool& charging);
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.
172 * This is the destructor for this class.
173 * This destructor overrides Tizen::Base::Object::~Object(). @n
175 virtual ~Battery(void);
178 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
180 Battery(const Battery& value);
183 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
185 Battery& operator =(const Battery& value);
188 friend class _BatteryImpl;
193 #endif // _FSYS_BATTERY_H_