sync with tizen_2.0
[platform/framework/native/appfw.git] / src / system / inc / FSys_PowerManagerImpl.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17
18 /**
19  * @file                FSys_PowerManagerImpl.h
20  * @brief               This is the header file for the _PowerManagerImpl class.
21  */
22
23
24 #ifndef _FSYS_INTERNAL_POWERMANAGER_IMPL_H_
25 #define _FSYS_INTERNAL_POWERMANAGER_IMPL_H_
26
27 #include <FOspConfig.h>
28 #include <FBaseObject.h>
29 #include <FSysPowerManager.h>
30 #include <FSys_IPowerManagerEventListener.h>
31
32 namespace Tizen { namespace System
33 {
34
35 class IScreenEventListener;
36 class IChargingEventListener;
37 class IBatteryEventListener;
38
39 /**
40  * @class               _PowerManagerImpl
41  * @brief               This class provides methods for power management.
42  *
43  */
44 class _OSP_EXPORT_ _PowerManagerImpl
45         : public Tizen::Base::Object
46 {
47
48 public:
49         static int      GetScreenBrightness(void);
50         static bool     GetScreenState(void);
51         static result   InitBatteryEvent(void);
52         static bool     IsScreenOn(void);
53         static result   KeepCpuAwake(bool enable);
54         static result   KeepScreenOnState(bool keepOn, bool dimming = true);
55         static result   OnBackground(void);
56         static result   OnForeground(void);
57         static result   RestoreScreenBrightness(void);
58         static result   SetScreenBrightness(int brightness);
59         static result   SetBatteryEventListener(IBatteryEventListener* pListener);
60         static void     SetChargingEventListener(IChargingEventListener& listener);
61         static void     SetScreenEventListener(IScreenEventListener& listener);
62         static result   TurnScreenOff(void);
63         static result   TurnScreenOn(void);
64
65         static result   PowerControl(int deviceId, int level);
66         static bool     IsActive(void);
67
68         static int GetCurrentBatteryLevelInPercentage(void);
69         static BatteryLevel GetCurrentBatteryLevel(void);
70         static bool IsCharging(void);
71
72         static result Add_IPowerManagerEventListener(_IPowerManagerEventListener* listener);
73         static result Remove_IPowerManagerEventListener(_IPowerManagerEventListener* listener);
74
75         static _PowerManagerImpl* GetInstance(PowerManager& powerManager);
76         static const _PowerManagerImpl* GetInstance(const PowerManager& powerManager);
77         
78
79 private:
80         
81         _PowerManagerImpl(void);
82         virtual ~_PowerManagerImpl(void);
83
84         static void     Init();
85         static void     Term();
86
87         static bool     _InitPowerManager;
88 };
89
90 } }
91
92 #endif //_FSYS_INTERNAL_POWERMANAGER_IMPL_H_