2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
21 * @brief This is the header file for the %Battery class.
23 * This header file contains the declarations of the %Battery class.
27 #ifndef _FSYS_BATTERY_H_
28 #define _FSYS_BATTERY_H_
30 #include <FBaseObject.h>
31 #include <FSysPowerManager.h>
33 namespace Tizen { namespace System
40 * @brief <i>[Deprecated]</i> This class provides methods to get information related to the battery charge.
44 * @deprecated This class is deprecated. Instead of using this class, use the PowerManager class.
45 * @final This class is not intended for extension.
47 * The %Battery class provides methods to get the status related to battery levels and
48 * determine whether the battery is currently being charged.
49 * You cannot create an instance of this class directly.
51 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/system/battery_status.htm">Battery Status</a>.
55 class _OSP_EXPORT_ Battery
56 : public Tizen::Base::Object
61 * Gets the current charge remaining in the battery as a percentage.
63 * @deprecated This method is deprecated. Instead of using this method, use the PowerManager::GetCurrentBatteryLevelInPercentage() method.
66 * @return An error code
67 * @param[out] level The percentage of the charge remaining in the battery
68 * @exception E_SUCCESS The method is successful.
69 * @exception E_INVALID_STATE The battery service is not available.
70 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
71 * @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).
73 static result GetCurrentLevelInPercentage(int& level);
76 * Gets the current charging level of the battery.
78 * @deprecated This method is deprecated. Instead of using this method, use the PowerManager::GetCurrentBatteryLevel() method.
81 * @return An error code
82 * @param[out] level A value from the enumerator BatteryLevel indicating the current charging level
83 * @exception E_SUCCESS The method is successful.
84 * @exception E_INVALID_STATE The battery service is not available.
85 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
87 static result GetCurrentLevel(BatteryLevel& level);
90 * Checks whether the battery is currently charging.
92 * @deprecated This method is deprecated. Instead of using this method, use the PowerManager::IsCharging() method.
95 * @return An error code
96 * @param[out] charging Set to @c true if the charging cable is connected to the phone, @n
98 * @exception E_SUCCESS The method is successful.
99 * @exception E_INVALID_STATE The battery service is not available.
100 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
102 static result IsCharging(bool& charging);
106 * 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.
111 * This is the destructor for this class.
112 * This destructor overrides Tizen::Base::Object::~Object(). @n
114 virtual ~Battery(void);
117 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
119 Battery(const Battery& value);
122 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
124 Battery& operator =(const Battery& value);
127 friend class _BatteryImpl;
132 #endif // _FSYS_BATTERY_H_