Class Device

All Implemented Interfaces:
Runnable

public class Device extends JposDevice implements Runnable
JposDevice based implementation of JavaPOS POSPower device service implementation for the battery power devices in Windows laptops, notebooks and tablets.

This implementation uses the following WIN32 API functions:

  • GetSystemPowerStatus,
  • SetSuspendState
and the Windows program shutdown.exe.

Here a full list of all device specific properties that can be changed via jpos.xml:

  • PollDelay: Minimum time between status requests, in milliseconds. Status requests will be used to monitor the device state. Default: 1000.
  • SecondsToFinish: Number of seconds between shutdown activation and shutdown. Will be used with command line parameter "-t" of the shutdown command. Default: 1.
  • Constructor Details

    • Device

      public Device(String id)
      The device implementation. See parent for further details.
      Parameters:
      id - Device ID, not used by POSPower implementation. Can be any value.
  • Method Details

    • checkProperties

      public void checkProperties(jpos.config.JposEntry entry) throws jpos.JposException
      Description copied from class: JposBaseDevice
      Checks whether a JposEntry belongs to a predefined property value an if so, sets the corresponding driver value
      Overrides:
      checkProperties in class JposBaseDevice
      Parameters:
      entry - Entry to be checked, contains value to be set
      Throws:
      jpos.JposException - if a property value is invalid
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • changeDefaults

      public void changeDefaults(POSPowerProperties props)
      Description copied from class: JposDevice
      Change defaults of properties. Must be implemented within derived classed that support POS power services.
      Overrides:
      changeDefaults in class JposDevice
      Parameters:
      props - Property set for setting the propperty defaults
    • getPOSPowerProperties

      public POSPowerProperties getPOSPowerProperties(int index)
      Description copied from class: JposDevice
      Returns device implementation of POSPowerProperties.
      Overrides:
      getPOSPowerProperties in class JposDevice
      Parameters:
      index - Device index, see constructor of JposCommonProperties.
      Returns:
      Instance of POSPowerProperties that matches the requirements of the corresponding device service.