Class AbstractSensors
java.lang.Object
oshi.hardware.common.AbstractSensors
- All Implemented Interfaces:
Sensors
- Direct Known Subclasses:
AixSensors, BsdSensors, FreeBsdSensors, SolarisSensors, WindowsSensors
Sensors from WMI or Open Hardware Monitor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleCPU TemperaturedoubleCPU Voltageint[]Fan speedsprotected abstract doubleQueries the CPU temperature.protected abstract doubleQueries the CPU voltage.protected abstract int[]Queries the fan speeds.toString()
-
Constructor Details
-
AbstractSensors
protected AbstractSensors()Default constructor.
-
-
Method Details
-
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. 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.namesandoshi.os.linux.sensors.cputemperature.typesin 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: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.
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:SensorsCPU Voltage- Specified by:
getCpuVoltagein interfaceSensors- 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
-