Package oshi.hardware.common
Class AbstractSensors
- java.lang.Object
-
- oshi.hardware.common.AbstractSensors
-
- All Implemented Interfaces:
Sensors
- Direct Known Subclasses:
AixSensors,FreeBsdSensors,LinuxSensors,MacSensors,OpenBsdSensors,SolarisSensors,WindowsSensors
@ThreadSafe public abstract class AbstractSensors extends java.lang.Object implements Sensors
Sensors from WMI or Open Hardware Monitor
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.function.Supplier<java.lang.Double>cpuTemperatureprivate java.util.function.Supplier<java.lang.Double>cpuVoltageprivate java.util.function.Supplier<int[]>fanSpeeds
-
Constructor Summary
Constructors Constructor Description AbstractSensors()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description doublegetCpuTemperature()CPU TemperaturedoublegetCpuVoltage()CPU Voltageint[]getFanSpeeds()Fan speedsprotected abstract doublequeryCpuTemperature()protected abstract doublequeryCpuVoltage()protected abstract int[]queryFanSpeeds()java.lang.StringtoString()
-
-
-
Method Detail
-
getCpuTemperature
public double getCpuTemperature()
Description copied from interface:SensorsCPU Temperature- Specified by:
getCpuTemperaturein interfaceSensors- Returns:
- CPU Temperature in degrees Celsius if available, 0 or
Double.NaNotherwise.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:SensorsFan speeds- Specified by:
getFanSpeedsin interfaceSensors- 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:SensorsCPU Voltage- Specified by:
getCpuVoltagein interfaceSensors- Returns:
- CPU Voltage in Volts if available, 0 otherwise.
-
queryCpuVoltage
protected abstract double queryCpuVoltage()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-