tizen beta release
[framework/web/wrt-plugins-common.git] / src / modules / API / Power / IManager.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_IMANAGER_H_
17 #define WRTDEVICEAPIS_POWER_IMANAGER_H_
18
19 #include <cstddef>
20 #include <dpl/noncopyable.h>
21 #include <Power/IBattery.h>
22 #include <Power/IBacklight.h>
23
24 namespace WrtDeviceApis {
25 namespace Power {
26 namespace Api {
27
28 class IManager : private DPL::Noncopyable
29 {
30   public:
31     static IManager& getInstance();
32
33   public:
34     virtual ~IManager() = 0;
35
36     /**
37      * Gets interface to battery.
38      * @param index Index of battery to get (1-based).
39      * @return Interface to battery.
40      * @throw PlatformException If platform error occurs.
41      * @throw OutOfRangeException If index is greater than available batteries.
42      * @remarks Ownership over result (IBattery*) is NOT passed to caller.
43      */
44     virtual IBattery* getBattery(std::size_t index) const = 0;
45
46     /**
47      * Gets number of available batteries.
48      * @return Number of batteries.
49      */
50     virtual std::size_t getBatteriesCount() const = 0;
51
52     virtual IBacklightPtr getBacklight(void) = 0;
53
54     virtual std::size_t getBacklightCount() const = 0;
55
56     /**
57      * Release resources.
58      */
59     virtual void Release() = 0;
60
61   protected:
62     IManager();
63 };
64
65 } // Api
66 } // Power
67 } // WrtDeviceApis
68
69 #endif // WRTDEVICEAPIS_POWER_IMANAGER_H_