Class WindowsSensors
java.lang.Object
oshi.hardware.common.AbstractSensors
oshi.hardware.common.platform.windows.WindowsSensors
- All Implemented Interfaces:
Sensors
Abstract base shared by the Windows Sensors implementations (JNA and FFM). Holds the Open Hardware Monitor / Libre
Hardware Monitor / WMI fallback orchestration, the reflection-based Libre Hardware Monitor queries (which are
backend-agnostic), and the WMI/OHM result processing. The native driver queries are provided by the subclasses.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleQueries the CPU temperature.doubleQueries the CPU voltage.int[]Queries the fan speeds.protected abstract WmiResult<OhmSensor.ValueProperty> queryOhmCpuSensor(String typeToQuery, String typeName, String sensorType, boolean searchCpu) Queries an Open Hardware Monitor CPU sensor via the backend-specific WMI handler.protected abstract WmiResult<Win32Fan.SpeedProperty> Queries fan speeds from WMIWin32_Fan.protected abstract WmiResult<MSAcpiThermalZoneTemperature.TemperatureProperty> Queries the current temperature from WMIMSAcpi_ThermalZoneTemperature.protected abstract WmiResult<Win32Processor.VoltProperty> Queries CPU voltage from WMIWin32_Processor.protected static StringselectOhmCpuIdentifier(WmiResult<OhmHardware.IdentifierProperty> ohmHardware, boolean searchCpu) Selects the CPU hardware identifier from an Open Hardware Monitor identifier result.Methods inherited from class AbstractSensors
getCpuTemperature, getCpuVoltage, getFanSpeeds, toStringModifier and TypeMethodDescriptiondoubleCPU TemperaturedoubleCPU Voltageint[]Fan speedstoString()
-
Field Details
-
COM_EXCEPTION_MSG
- See Also:
-
-
Constructor Details
-
WindowsSensors
public WindowsSensors()
-
-
Method Details
-
queryCpuTemperature
public double queryCpuTemperature()Description copied from class:AbstractSensorsQueries the CPU temperature.- Specified by:
queryCpuTemperaturein classAbstractSensors- Returns:
- the CPU temperature in degrees Celsius
-
queryFanSpeeds
public int[] queryFanSpeeds()Description copied from class:AbstractSensorsQueries the fan speeds.- Specified by:
queryFanSpeedsin classAbstractSensors- Returns:
- an array of fan speeds in RPM
-
queryCpuVoltage
public double queryCpuVoltage()Description copied from class:AbstractSensorsQueries the CPU voltage.- Specified by:
queryCpuVoltagein classAbstractSensors- Returns:
- the CPU voltage in Volts
-
selectOhmCpuIdentifier
protected static String selectOhmCpuIdentifier(WmiResult<OhmHardware.IdentifierProperty> ohmHardware, boolean searchCpu) Selects the CPU hardware identifier from an Open Hardware Monitor identifier result. WhensearchCpuis set, the first identifier containingcpuis used; otherwise (or if none match) the first identifier is returned.- Parameters:
ohmHardware- the OHM hardware identifier resultsearchCpu- whether to search for an identifier containingcpu- Returns:
- the selected identifier (possibly empty)
-
queryOhmCpuSensor
protected abstract WmiResult<OhmSensor.ValueProperty> queryOhmCpuSensor(String typeToQuery, String typeName, String sensorType, boolean searchCpu) Queries an Open Hardware Monitor CPU sensor via the backend-specific WMI handler.- Parameters:
typeToQuery- the OHM hardware type to querytypeName- the OHM hardware type namesensorType- the sensor typesearchCpu- whether to search for acpuidentifier (vs. using the first)- Returns:
- the sensor values, or
nullif unavailable
-
queryWmiTemperature
protected abstract WmiResult<MSAcpiThermalZoneTemperature.TemperatureProperty> queryWmiTemperature()Queries the current temperature from WMIMSAcpi_ThermalZoneTemperature.- Returns:
- the WMI temperature result
-
queryWmiFanSpeed
Queries fan speeds from WMIWin32_Fan.- Returns:
- the WMI fan speed result
-
queryWmiVoltage
Queries CPU voltage from WMIWin32_Processor.- Returns:
- the WMI voltage result
-