2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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.
18 * @file FSys_PowerManagerImpl.h
19 * @brief This is the header file for the _PowerManagerImpl class.
23 #ifndef _FSYS_INTERNAL_POWERMANAGER_IMPL_H_
24 #define _FSYS_INTERNAL_POWERMANAGER_IMPL_H_
26 #include <FOspConfig.h>
27 #include <FBaseObject.h>
28 #include <FSysPowerManager.h>
29 #include <FSys_IPowerManagerEventListener.h>
31 namespace Tizen { namespace System
34 class IScreenEventListener;
35 class IChargingEventListener;
36 class IBatteryEventListener;
39 * @class _PowerManagerImpl
40 * @brief This class provides methods for power management.
43 class _OSP_EXPORT_ _PowerManagerImpl
44 : public Tizen::Base::Object
48 static int GetScreenBrightness(void);
49 static bool GetScreenState(void);
50 static result InitBatteryEvent(void);
51 static bool IsScreenOn(void);
52 static result KeepCpuAwake(bool enable);
53 static result KeepScreenOnState(bool keepOn, bool dimming = true);
54 static result OnBackground(void);
55 static result OnForeground(void);
56 static result RestoreScreenBrightness(void);
57 static result SetScreenBrightness(int brightness);
58 static result SetBatteryEventListener(IBatteryEventListener* pListener);
60 static void SetChargingEventListener(IChargingEventListener& listener);
61 static result AddChargingEventListener(IChargingEventListener& listener, bool isSet = false);
62 static result RemoveChargingEventListener(IChargingEventListener& listener);
64 static void SetScreenEventListener(IScreenEventListener& listener);
65 static result AddScreenEventListener(IScreenEventListener& listener, bool isSet = false);
66 static result RemoveScreenEventListener(IScreenEventListener& listener);
67 static result TurnScreenOff(void);
68 static result TurnScreenOn(void);
70 static result AddBootEventListener(IBootEventListener& listener);
71 static result RemoveBootEventListener(IBootEventListener& listener);
73 static result PowerControl(int deviceId, int level);
74 static bool IsActive(void);
76 static int GetCurrentBatteryLevelInPercentage(void);
77 static BatteryLevel GetCurrentBatteryLevel(void);
78 static bool IsCharging(void);
80 static result Add_IPowerManagerEventListener(_IPowerManagerEventListener* listener);
81 static result Remove_IPowerManagerEventListener(_IPowerManagerEventListener* listener);
83 static _PowerManagerImpl* GetInstance(PowerManager& powerManager);
84 static const _PowerManagerImpl* GetInstance(const PowerManager& powerManager);
89 _PowerManagerImpl(void);
90 virtual ~_PowerManagerImpl(void);
95 static bool _InitPowerManager;
100 #endif //_FSYS_INTERNAL_POWERMANAGER_IMPL_H_