Class FreeBsdPowerSource

java.lang.Object
oshi.hardware.common.AbstractPowerSource
oshi.hardware.common.platform.unix.freebsd.FreeBsdPowerSource
All Implemented Interfaces:
PowerSource

public abstract class FreeBsdPowerSource extends AbstractPowerSource
Shared FreeBSD power-source logic. Subclasses provide the sysctl backend (JNA or FFM) via queryBattery(String, BiFunction, PowerSourceFactory).
  • Constructor Details

    • FreeBsdPowerSource

      protected FreeBsdPowerSource(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)
  • Method Details

    • queryBattery

      protected static <T extends FreeBsdPowerSource> List<PowerSource> queryBattery(String name, BiFunction<String,Integer,Integer> sysctlInt, FreeBsdPowerSource.PowerSourceFactory<T> factory)
      Queries battery information and constructs a power source instance using the provided sysctl accessor and factory.
      Type Parameters:
      T - the concrete power source type
      Parameters:
      name - the battery name (e.g. "BAT0")
      sysctlInt - reads an integer sysctl given (name, default)
      factory - constructs the platform-specific instance
      Returns:
      a list containing the power source