2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @file FSys_PowerManagerImpl.h
20 * @brief This is the header file for the _PowerManagerImpl class.
24 #ifndef _FSYS_INTERNAL_POWERMANAGER_IMPL_H_
25 #define _FSYS_INTERNAL_POWERMANAGER_IMPL_H_
27 #include <FOspConfig.h>
28 #include <FBaseObject.h>
29 #include <FSysPowerManager.h>
30 #include <FSys_IPowerManagerEventListener.h>
32 namespace Tizen { namespace System
35 class IScreenEventListener;
36 class IChargingEventListener;
37 class IBatteryEventListener;
40 * @class _PowerManagerImpl
41 * @brief This class provides methods for power management.
44 class _OSP_EXPORT_ _PowerManagerImpl
45 : public Tizen::Base::Object
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);
65 static result PowerControl(int deviceId, int level);
66 static bool IsActive(void);
68 static int GetCurrentBatteryLevelInPercentage(void);
69 static BatteryLevel GetCurrentBatteryLevel(void);
70 static bool IsCharging(void);
72 static result Add_IPowerManagerEventListener(_IPowerManagerEventListener* listener);
73 static result Remove_IPowerManagerEventListener(_IPowerManagerEventListener* listener);
75 static _PowerManagerImpl* GetInstance(PowerManager& powerManager);
76 static const _PowerManagerImpl* GetInstance(const PowerManager& powerManager);
81 _PowerManagerImpl(void);
82 virtual ~_PowerManagerImpl(void);
87 static bool _InitPowerManager;
92 #endif //_FSYS_INTERNAL_POWERMANAGER_IMPL_H_