Class LinuxPowerSource

java.lang.Object
oshi.hardware.common.AbstractPowerSource
oshi.hardware.common.platform.linux.LinuxPowerSource
All Implemented Interfaces:
PowerSource
Direct Known Subclasses:
LinuxPowerSourceJNA

@ThreadSafe public class LinuxPowerSource extends AbstractPowerSource
A Power Source
  • Constructor Details

    • LinuxPowerSource

      public LinuxPowerSource(String psName, String psDeviceName, double psRemainingCapacityPercent, double psTimeRemainingEstimated, double psTimeRemainingInstant, double psPowerUsageRate, double psVoltage, double psAmperage, boolean psPowerOnLine, boolean psCharging, boolean psDischarging, PowerSource.CapacityUnits psCapacityUnits, int psCurrentCapacity, int psMaxCapacity, int psDesignCapacity, int psCycleCount, String psChemistry, LocalDate psManufactureDate, String psManufacturer, String psSerialNumber, double psTemperature)
      Creates a LinuxPowerSource with the given parameters.
      Parameters:
      psName - power source name
      psDeviceName - device name
      psRemainingCapacityPercent - remaining capacity percentage
      psTimeRemainingEstimated - estimated time remaining
      psTimeRemainingInstant - instant time remaining
      psPowerUsageRate - power usage rate
      psVoltage - voltage
      psAmperage - amperage
      psPowerOnLine - whether on AC power
      psCharging - whether charging
      psDischarging - whether discharging
      psCapacityUnits - capacity units
      psCurrentCapacity - current capacity
      psMaxCapacity - max capacity
      psDesignCapacity - design capacity
      psCycleCount - cycle count
      psChemistry - chemistry
      psManufactureDate - manufacture date
      psManufacturer - manufacturer
      psSerialNumber - serial number
      psTemperature - temperature
    • LinuxPowerSource

      protected LinuxPowerSource(LinuxPowerSource src)
      Copy constructor.
      Parameters:
      src - the source to copy from
  • Method Details

    • queryPowerSources

      protected List<PowerSource> queryPowerSources()
      Description copied from class: AbstractPowerSource
      Returns a fresh list of power sources for this platform, used by AbstractPowerSource.updateAttributes(). Each concrete subclass implements this by delegating to its own static getPowerSources() factory method.
      Specified by:
      queryPowerSources in class AbstractPowerSource
      Returns:
      A list of PowerSource objects representing batteries, etc.
    • getPowerSources

      public static List<PowerSource> getPowerSources()
      Gets Battery Information
      Returns:
      An array of PowerSource objects representing batteries, etc.
    • buildPowerSource

      protected static LinuxPowerSource buildPowerSource(String name, Map<LinuxPowerSource.Prop, String> props)
      Builds a LinuxPowerSource from parsed uevent properties.
      Parameters:
      name - the power supply name
      props - the parsed properties map
      Returns:
      a new LinuxPowerSource instance