public class

PowerManager

extends Object
java.lang.Object
   ↳ com.datalogic.device.power.PowerManager

Class Overview

This class provides access to battery life related methods of the device.

Summary

Public Constructors
PowerManager()
This is the constructor of PowerManager.
Public Methods
int activateWakeup(WakeupSource source)
This function allows setting a wakeup source.
int clearWakeup(WakeupSource source)
This function allows clearing a wakeup source from those previously set.
RebootReason getRebootReason()
This function allows to know the reason of last device power-off.
SuspendTimeout getSuspendTimeout(boolean externalPower)
This function allows to get the device screen off timeout before automatic suspension.
WakeupSource getWakeupReason()
This function allows to know the source of the last wakeup.
boolean isWakeupActive(WakeupSource source)
This function allows to know if a wakeup source is currently active.
boolean isWakeupSupported(WakeupSource source)
This function allows to know if a wakeup source is configurable on a target device.
int reboot(BootType resetType)
Reset the device.
int setSuspendTimeout(SuspendTimeout timeout, boolean externalPower)
This function allows to set the device timeout before automatic suspension.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public PowerManager ()

Added in revision 1

This is the constructor of PowerManager.

Throws
DeviceException in case of error.

Public Methods

public int activateWakeup (WakeupSource source)

Added in revision 1

This function allows setting a wakeup source. If the source is already set, no action is performed.

Parameters
source The WakeupSource that should activate the device from sleep and needs to be enabled.
Returns
  • int SUCCESS in case of success, otherwise a possible error code, matching one of the DeviceException error constants.
Throws
DeviceException in case of error, when exceptions are enabled through the ErrorManager singleton.
See Also

public int clearWakeup (WakeupSource source)

Added in revision 1

This function allows clearing a wakeup source from those previously set. If the source was not set, no action is performed.

Parameters
source The WakeupSource that should no longer wake up the device anymore.
Returns
  • int SUCCESS in case of success, otherwise a possible error code, matching one of the DeviceException error constants.
Throws
DeviceException in case of error, when exceptions are enabled through the ErrorManager singleton.
See Also

public RebootReason getRebootReason ()

Added in revision 13

This function allows to know the reason of last device power-off.

Returns
  • The RebootReason related to the reason of last device power-off event.

public SuspendTimeout getSuspendTimeout (boolean externalPower)

Added in revision 1

This function allows to get the device screen off timeout before automatic suspension.

Parameters
externalPower The boolean value indicating if the requested timeout is the one running while powered externally or while the only power source is the internal battery.
Returns
Throws
DeviceException in case of error, when exceptions are enabled through the ErrorManager singleton.

public WakeupSource getWakeupReason ()

Added in revision 1

This function allows to know the source of the last wakeup.

Returns
  • The value of the last wakeup source as a WakeupSource, null in case no wake up source woke up the device.
Throws
DeviceException in case of error, when exceptions are enabled through the ErrorManager singleton.
See Also

public boolean isWakeupActive (WakeupSource source)

Added in revision 1

This function allows to know if a wakeup source is currently active.

Parameters
source The WakeupSource that should be checked, whether is currently active or not.
Returns
  • boolean true if the source is active, false otherwise.
Throws
DeviceException in case of error, when exceptions are enabled through the ErrorManager singleton.
See Also

public boolean isWakeupSupported (WakeupSource source)

Added in revision 1

This function allows to know if a wakeup source is configurable on a target device.

Parameters
source The WakeupSource that should be checked, whether is supported or not.
Returns
  • boolean true if the source can be enabled or disabled, false otherwise.
See Also

public int reboot (BootType resetType)

Added in revision 1

Reset the device. The device will be turned off, then turned on.

Parameters
resetType The BootType type of reboot to perform.
Returns
  • int SUCCESS in case of success, otherwise a possible error code, matching one of the DeviceException error constants.
Throws
DeviceException in case of error, when exceptions are enabled through the ErrorManager singleton.
See Also

public int setSuspendTimeout (SuspendTimeout timeout, boolean externalPower)

Added in revision 1

This function allows to set the device timeout before automatic suspension.

Parameters
timeout The SuspendTimeout value of the timeout.
externalPower The boolean value indicating if the timeout is meant for external AC power or for internal battery.
Returns
  • int SUCCESS in case of success, otherwise a possible error code, matching one of the DeviceException error constants.
Throws
DeviceException in case of error, when exceptions are enabled through the ErrorManager singleton.