Class AbstractSensors

java.lang.Object
oshi.hardware.common.AbstractSensors
All Implemented Interfaces:
Sensors

@ThreadSafe
public abstract class AbstractSensors
extends java.lang.Object
implements Sensors
Sensors from WMI or Open Hardware Monitor
  • Constructor Summary

    Constructors 
    Constructor Description
    AbstractSensors()  
  • Method Summary

    Modifier and Type Method Description
    double getCpuTemperature()
    CPU Temperature
    double getCpuVoltage()
    CPU Voltage
    int[] getFanSpeeds()
    Fan speeds
    protected abstract double queryCpuTemperature()  
    protected abstract double queryCpuVoltage()  
    protected abstract int[] queryFanSpeeds()  
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

  • 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 otherwise.

      On Windows, if not running Open Hardware Monitor, requires elevated permissions and hardware BIOS that supports publishing to WMI. In this case, returns the temperature of the "Thermal Zone" which may be different than CPU temperature obtained from other sources. In addition, some motherboards may only refresh this value on certain events.

    • queryCpuTemperature

      protected abstract double queryCpuTemperature()
    • 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.
    • queryFanSpeeds

      protected abstract int[] queryFanSpeeds()
    • 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.
    • queryCpuVoltage

      protected abstract double queryCpuVoltage()
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object