#include <power.h>
#include <pmapi.h>
#include <device.h>
-#include <dlog.h>
#include <algorithm>
#include <PlatformException.h>
-#include <Logger.h>
#include <JSUtil.h>
#include <vconf.h>
+#include <Logger.h>
using namespace DeviceAPI::Common;
using namespace std;
void PowerManager::onPlatformStateChangedCB(power_state_e state, void *user_data){
PowerManager* object = static_cast<PowerManager*>(user_data);
if(object == NULL){
- LOGE("User data is NULL");
+ LoggerE("User data is NULL");
return;
}
PowerState current(PowerState::SCREENOFF);
ret = power_lock_state( (power_state_e)native_state , 0);
if( POWER_ERROR_NONE!=ret ){
- LOGE("power_lock_state(%d) error %d",native_state, ret);
+ LoggerE("power_lock_state(%d) error %d",native_state, ret);
throw UnknownException("power_lock_state error");
}
break;
int maxBrightness;
ret = device_get_max_brightness(0, &maxBrightness);
if( DEVICE_ERROR_NONE!=ret) {
- LOGE("Platform error while getting max brightness: %d", ret);
+ LoggerE("Platform error while getting max brightness: %d", ret);
throw UnknownException("Platform error while getting max brightness");
}
LOGI("Succeeded setting the brightness to a max level: %d", maxBrightness);
ret = power_lock_state(POWER_STATE_NORMAL, 0);
if( POWER_ERROR_NONE!=ret ){
- LOGE("Platform error while locking state %d", ret);
+ LoggerE("Platform error while locking state %d", ret);
throw UnknownException("Platform error while locking state");
}
break;
}
case PowerState::SCREENOFF:
- LOGE("SCREEN_OFF state cannot be requested");
+ LoggerE("SCREEN_OFF state cannot be requested");
throw InvalidValuesException("SCREEN_OFF state cannot be requested");
default :
if( mBrightStateEnable ){
ret = device_set_brightness_from_settings(0);
if( DEVICE_ERROR_NONE!=ret){
- LOGE("Platform error while setting restore brightness %d", ret);
+ LoggerE("Platform error while setting restore brightness %d", ret);
throw UnknownException("Platform error while setting restore brightness");
}
}
int maxBrightness;
ret = device_get_max_brightness(0, &maxBrightness);
if( ret != 0 ){
- LOGE("Platform error while setting restore brightness: %d", ret);
+ LoggerE("Platform error while setting restore brightness: %d", ret);
throw UnknownException("Platform error while getting max brightness");
}
int nativeBrightness = (int)(brightness*maxBrightness);
ret = pm_change_state(LCD_OFF);
if( ret<0 ){
- LOGE("Platform error while changing screen state %d", ret);
+ LoggerE("Platform error while changing screen state %d", ret);
throw UnknownException("Platform error while changing screen state");
}
}
int ret;
ret = device_set_brightness_from_settings(0);
if( DEVICE_ERROR_NONE!=ret){
- LOGE("Platform error while restoring brightness %d", ret);
+ LoggerE("Platform error while restoring brightness %d", ret);
throw UnknownException("Platform error while restoring brightness");
}
}
int ret = device_set_brightness(0, brightness);
if( ret != 0){
- LOGE("Platform error while setting %d brightness: %d", brightness, ret);
+ LoggerE("Platform error while setting %d brightness: %d", brightness, ret);
throw UnknownException("Platform error while setting brightness.");
}
mCurrentBrightness = brightness;
ret = vconf_get_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, &brightness);
if( ret != 0 ){
- LOGE("Platform error while getting brightness: %d", ret);
+ LoggerE("Platform error while getting brightness: %d", ret);
throw UnknownException("Platform error while getting brightness");
}
- LOGE("VCONFKEY_SETAPPL_LCD_BRIGHTNESS %d", brightness);
+ LoggerE("VCONFKEY_SETAPPL_LCD_BRIGHTNESS %d", brightness);
return brightness;
}
restoreSettedBrightness();
}
catch( const BasePlatformException& err){
- LOGE("Error restore custom brightness %s", err.getMessage().c_str());
+ LoggerE("Error restore custom brightness %s", err.getMessage().c_str());
}
}
if( mCurrentState.mState == PowerState::SCREENNORMAL && PreviousState.mState == PowerState::SCREENOFF){