2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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.
16 #ifndef WRTDEVICEAPIS_POWER_IBATTERY_H_
17 #define WRTDEVICEAPIS_POWER_IBATTERY_H_
19 #include <dpl/noncopyable.h>
20 #include <dpl/shared_ptr.h>
21 #include <Power/EventCharging.h>
22 #include <Power/EventRemaining.h>
23 #include <Power/EventLow.h>
25 namespace WrtDeviceApis {
30 * Represents battery unit on the device.
32 class IBattery : private DPL::Noncopyable
35 virtual ~IBattery() = 0;
38 * Gets information whether battery is charging.
39 * @return True if battery is charging, false otherwsie.
40 * @throw PlatformException If platform error occurs.
42 virtual bool isCharging() const = 0;
45 * Gets remaining charge level (in percents).
46 * @return Percent of remaining charge level.
47 * @throw PlatformException If platform error occurs.
49 virtual unsigned int getRemaining() const = 0;
52 * Adds on battery being charged event emitter.
53 * @param emitter On battery being charged event emitter.
54 * @throw PlatformException If platform error occurs.
56 virtual void addOnCharging(const EventChargingEmitterPtr& emitter) = 0;
59 * Removes charging event emitter.
60 * @param id Id of an event emitter.
62 virtual void removeOnCharging(EventChargingEmitter::IdType id) = 0;
65 * Adds battery level remaining event emitter.
66 * @param emitter Battery level remaining event emitter.
67 * @throw PlatformException If platform error occurs.
69 virtual void addOnRemaining(const EventRemainingEmitterPtr& emitter) = 0;
72 * Removes remaining event emitter.
73 * @param id Id of an event emitter.
75 virtual void removeOnRemaining(EventRemainingEmitter::IdType id) = 0;
78 * Adds battery on low level event emitter.
79 * @param emitter Battery on low level event emitter.
80 * @throw PlatformException If platform error occurs.
82 virtual void addOnLow(const EventLowEmitterPtr& emitter) = 0;
85 * Removes on low level event emitter.
86 * @param id Id of an event emitter.
88 virtual void removeOnLow(EventLowEmitter::IdType id) = 0;
91 typedef DPL::SharedPtr<IBattery> IBatteryPtr;
97 #endif // WRTDEVICEAPIS_POWER_IBATTERY_H_