61495a4d9afcc2a9f0f90665ea851436516e356d
[framework/web/wrt-plugins-common.git] / src / modules / API / Power / IBattery.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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 #ifndef WRTDEVICEAPIS_POWER_IBATTERY_H_
17 #define WRTDEVICEAPIS_POWER_IBATTERY_H_
18
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>
24
25 namespace WrtDeviceApis {
26 namespace Power {
27 namespace Api {
28
29 /**
30  * Represents battery unit on the device.
31  */
32 class IBattery : private DPL::Noncopyable
33 {
34   public:
35     virtual ~IBattery() = 0;
36
37     /**
38      * Gets information whether battery is charging.
39      * @return True if battery is charging, false otherwsie.
40      * @throw PlatformException If platform error occurs.
41      */
42     virtual bool isCharging() const = 0;
43
44     /**
45      * Gets remaining charge level (in percents).
46      * @return Percent of remaining charge level.
47      * @throw PlatformException If platform error occurs.
48      */
49     virtual unsigned int getRemaining() const = 0;
50
51     /**
52      * Adds on battery being charged event emitter.
53      * @param emitter On battery being charged event emitter.
54      * @throw PlatformException If platform error occurs.
55      */
56     virtual void addOnCharging(const EventChargingEmitterPtr& emitter) = 0;
57
58     /**
59      * Removes charging event emitter.
60      * @param id Id of an event emitter.
61      */
62     virtual void removeOnCharging(EventChargingEmitter::IdType id) = 0;
63
64     /**
65      * Adds battery level remaining event emitter.
66      * @param emitter Battery level remaining event emitter.
67      * @throw PlatformException If platform error occurs.
68      */
69     virtual void addOnRemaining(const EventRemainingEmitterPtr& emitter) = 0;
70
71     /**
72      * Removes remaining event emitter.
73      * @param id Id of an event emitter.
74      */
75     virtual void removeOnRemaining(EventRemainingEmitter::IdType id) = 0;
76
77     /**
78      * Adds battery on low level event emitter.
79      * @param emitter Battery on low level event emitter.
80      * @throw PlatformException If platform error occurs.
81      */
82     virtual void addOnLow(const EventLowEmitterPtr& emitter) = 0;
83
84     /**
85      * Removes on low level event emitter.
86      * @param id Id of an event emitter.
87      */
88     virtual void removeOnLow(EventLowEmitter::IdType id) = 0;
89 };
90
91 typedef DPL::SharedPtr<IBattery> IBatteryPtr;
92
93 } // Api
94 } // Power
95 } // WrtDeviceApis
96
97 #endif // WRTDEVICEAPIS_POWER_IBATTERY_H_