diff options
Diffstat (limited to 'nci/jni/PowerSwitch.cpp')
-rwxr-xr-x | nci/jni/PowerSwitch.cpp | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/nci/jni/PowerSwitch.cpp b/nci/jni/PowerSwitch.cpp index e5faaae..ba1a96b 100755 --- a/nci/jni/PowerSwitch.cpp +++ b/nci/jni/PowerSwitch.cpp @@ -8,6 +8,7 @@ ** Proprietary and confidential. ** *****************************************************************************/ +#include "OverrideLog.h" #include "PowerSwitch.h" #include "NfcJniUtil.h" #include "config.h" @@ -28,7 +29,7 @@ PowerSwitch PowerSwitch::sPowerSwitch; ** Function: PowerSwitch ** ** Description: Initialize member variables. -** +** ** Returns: None ** *******************************************************************************/ @@ -40,13 +41,13 @@ PowerSwitch::PowerSwitch () { } - + /******************************************************************************* ** ** Function: ~PowerSwitch ** ** Description: Release all resources. -** +** ** Returns: None ** *******************************************************************************/ @@ -60,7 +61,7 @@ PowerSwitch::~PowerSwitch () ** Function: getInstance ** ** Description: Get the singleton of this object. -** +** ** Returns: Reference to this object. ** *******************************************************************************/ @@ -75,7 +76,7 @@ PowerSwitch& PowerSwitch::getInstance () ** Function: initialize ** ** Description: Initialize member variables. -** +** ** Returns: None ** *******************************************************************************/ @@ -93,12 +94,12 @@ void PowerSwitch::initialize (PowerLevel level) mCurrDeviceMgtPowerState = NFA_DM_PWR_MODE_FULL; mCurrLevel = level; break; - + case UNKNOWN_LEVEL: mCurrDeviceMgtPowerState = NFA_DM_PWR_STATE_UNKNOWN; mCurrLevel = level; break; - + default: ALOGE ("%s: not handled", fn); break; @@ -108,10 +109,10 @@ void PowerSwitch::initialize (PowerLevel level) /******************************************************************************* ** -** Function: getLevel +** Function: getLevel ** ** Description: Get the current power level of the controller. -** +** ** Returns: Power level. ** *******************************************************************************/ @@ -120,14 +121,14 @@ PowerSwitch::PowerLevel PowerSwitch::getLevel () return mCurrLevel; } - + /******************************************************************************* ** ** Function: setLevel ** ** Description: Set the controller's power level. ** level: power level. -** +** ** Returns: True if ok. ** *******************************************************************************/ @@ -146,7 +147,7 @@ bool PowerSwitch::setLevel (PowerLevel newLevel) if (mCurrDeviceMgtPowerState == NFA_DM_PWR_MODE_OFF_SLEEP) retval = setPowerOffSleepState (false); break; - + case LOW_POWER: case POWER_OFF: if (isPowerOffSleepFeatureEnabled()) @@ -157,7 +158,7 @@ bool PowerSwitch::setLevel (PowerLevel newLevel) retval = true; } break; - + default: ALOGE ("%s: not handled", fn); break; @@ -202,7 +203,7 @@ bool PowerSwitch::setScreenState(bool state) ** ** Description: Adjust controller's power-off-sleep state. ** sleep: whether to enter sleep state. -** +** ** Returns: True if ok. ** *******************************************************************************/ @@ -245,12 +246,12 @@ bool PowerSwitch::setPowerOffSleepState (bool sleep) } else { - ALOGE ("%s: power is not ON; curr device mgt power state=%s (%u)", fn, + ALOGE ("%s: power is not ON; curr device mgt power state=%s (%u)", fn, deviceMgtPowerStateToString (mCurrDeviceMgtPowerState), mCurrDeviceMgtPowerState); goto TheEnd; } } - else //exit power-off-sleep state + else //exit power-off-sleep state { //make sure the current power state is OFF if (mCurrDeviceMgtPowerState != NFA_DM_PWR_MODE_FULL) @@ -264,7 +265,7 @@ bool PowerSwitch::setPowerOffSleepState (bool sleep) mPowerStateEvent.wait (); if (mCurrDeviceMgtPowerState != NFA_DM_PWR_MODE_FULL) { - ALOGE ("%s: unable to full power; curr device mgt power stat=%s (%u)", fn, + ALOGE ("%s: unable to full power; curr device mgt power stat=%s (%u)", fn, deviceMgtPowerStateToString (mCurrDeviceMgtPowerState), mCurrDeviceMgtPowerState); goto TheEnd; } @@ -279,7 +280,7 @@ bool PowerSwitch::setPowerOffSleepState (bool sleep) } else { - ALOGE ("%s: not in power-off state; curr device mgt power state=%s (%u)", fn, + ALOGE ("%s: not in power-off state; curr device mgt power state=%s (%u)", fn, deviceMgtPowerStateToString (mCurrDeviceMgtPowerState), mCurrDeviceMgtPowerState); goto TheEnd; } @@ -296,9 +297,9 @@ TheEnd: ** ** Function: deviceMgtPowerStateToString ** -** Description: Decode power level to a string. +** Description: Decode power level to a string. ** deviceMgtPowerState: power level. -** +** ** Returns: Text representation of power level. ** *******************************************************************************/ @@ -322,7 +323,7 @@ const char* PowerSwitch::deviceMgtPowerStateToString (UINT8 deviceMgtPowerState) ** ** Description: Decode power level to a string. ** level: power level. -** +** ** Returns: Text representation of power level. ** *******************************************************************************/ @@ -349,7 +350,7 @@ const char* PowerSwitch::powerLevelToString (PowerLevel level) ** Function: abort ** ** Description: Abort and unblock currrent operation. -** +** ** Returns: None ** *******************************************************************************/ @@ -369,7 +370,7 @@ void PowerSwitch::abort () ** Description: Callback function for the stack. ** event: event ID. ** eventData: event's data. -** +** ** Returns: None ** *******************************************************************************/ @@ -382,7 +383,7 @@ void PowerSwitch::deviceManagementCallback (UINT8 event, tNFA_DM_CBACK_DATA* eve case NFA_DM_PWR_MODE_CHANGE_EVT: { tNFA_DM_PWR_MODE_CHANGE& power_mode = eventData->power_mode; - ALOGD ("%s: NFA_DM_PWR_MODE_CHANGE_EVT; status=%u; device mgt power mode=%s (%u)", fn, + ALOGD ("%s: NFA_DM_PWR_MODE_CHANGE_EVT; status=%u; device mgt power mode=%s (%u)", fn, power_mode.status, sPowerSwitch.deviceMgtPowerStateToString (power_mode.power_mode), power_mode.power_mode); SyncEventGuard guard (sPowerSwitch.mPowerStateEvent); if (power_mode.status == NFA_STATUS_OK) @@ -399,12 +400,12 @@ void PowerSwitch::deviceManagementCallback (UINT8 event, tNFA_DM_CBACK_DATA* eve ** Function: isPowerOffSleepFeatureEnabled ** ** Description: Whether power-off-sleep feature is enabled in .conf file. -** +** ** Returns: True if feature is enabled. ** *******************************************************************************/ bool PowerSwitch::isPowerOffSleepFeatureEnabled () { - return mDesiredScreenOffPowerState == 0; + return mDesiredScreenOffPowerState == 0; } |