Class AbstractSensors

java.lang.Object
oshi.hardware.common.AbstractSensors
All Implemented Interfaces:
Sensors
Direct Known Subclasses:
AixSensors, BsdSensors, FreeBsdSensors, SolarisSensors, WindowsSensors

@ThreadSafe public abstract class AbstractSensors extends Object implements Sensors
Sensors from WMI or Open Hardware Monitor
  • Constructor Details

    • AbstractSensors

      protected AbstractSensors()
      Default constructor.
  • Method Details

    • getCpuTemperature

      public double getCpuTemperature()
      Description copied from interface: Sensors
      CPU Temperature
      Specified by:
      getCpuTemperature in interface Sensors
      Returns:
      CPU Temperature in degrees Celsius if available, 0 or Double.NaN otherwise. Callers should check for both zero and NaN to detect unavailable data.

      On Windows, requires the optional jLibreHardwareMonitor dependency for reliable values. Without it, results may be zero or unchanging depending on the motherboard manufacturer.

      On Linux, values are read from hwmon sensors or thermal zones. The sensor names and priority can be configured via oshi.os.linux.sensors.hwmon.names and oshi.os.linux.sensors.cputemperature.types in the configuration.

    • queryCpuTemperature

      protected abstract double queryCpuTemperature()
      Queries the CPU temperature.
      Returns:
      the CPU temperature in degrees Celsius
    • getFanSpeeds

      public int[] getFanSpeeds()
      Description copied from interface: Sensors
      Fan speeds
      Specified by:
      getFanSpeeds in interface Sensors
      Returns:
      Speed in rpm for all fans. May return empty array if no fans detected or 0 fan speed if unable to measure fan speed.

      On Windows, requires the optional jLibreHardwareMonitor dependency for reliable values.

    • queryFanSpeeds

      protected abstract int[] queryFanSpeeds()
      Queries the fan speeds.
      Returns:
      an array of fan speeds in RPM
    • getCpuVoltage

      public double getCpuVoltage()
      Description copied from interface: Sensors
      CPU Voltage
      Specified by:
      getCpuVoltage in interface Sensors
      Returns:
      CPU Voltage in Volts if available, 0 otherwise.

      On Windows, requires the optional jLibreHardwareMonitor dependency for reliable values.

    • queryCpuVoltage

      protected abstract double queryCpuVoltage()
      Queries the CPU voltage.
      Returns:
      the CPU voltage in Volts
    • toString

      public String toString()
      Overrides:
      toString in class Object