Class WindowsSensors

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

@ThreadSafe public abstract class WindowsSensors extends AbstractSensors
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 Details

  • Constructor Details

    • WindowsSensors

      public WindowsSensors()
  • Method Details

    • queryCpuTemperature

      public double queryCpuTemperature()
      Description copied from class: AbstractSensors
      Queries the CPU temperature.
      Specified by:
      queryCpuTemperature in class AbstractSensors
      Returns:
      the CPU temperature in degrees Celsius
    • queryFanSpeeds

      public int[] queryFanSpeeds()
      Description copied from class: AbstractSensors
      Queries the fan speeds.
      Specified by:
      queryFanSpeeds in class AbstractSensors
      Returns:
      an array of fan speeds in RPM
    • queryCpuVoltage

      public double queryCpuVoltage()
      Description copied from class: AbstractSensors
      Queries the CPU voltage.
      Specified by:
      queryCpuVoltage in class AbstractSensors
      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. When searchCpu is set, the first identifier containing cpu is used; otherwise (or if none match) the first identifier is returned.
      Parameters:
      ohmHardware - the OHM hardware identifier result
      searchCpu - whether to search for an identifier containing cpu
      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 query
      typeName - the OHM hardware type name
      sensorType - the sensor type
      searchCpu - whether to search for a cpu identifier (vs. using the first)
      Returns:
      the sensor values, or null if unavailable
    • queryWmiTemperature

      protected abstract WmiResult<MSAcpiThermalZoneTemperature.TemperatureProperty> queryWmiTemperature()
      Queries the current temperature from WMI MSAcpi_ThermalZoneTemperature.
      Returns:
      the WMI temperature result
    • queryWmiFanSpeed

      protected abstract WmiResult<Win32Fan.SpeedProperty> queryWmiFanSpeed()
      Queries fan speeds from WMI Win32_Fan.
      Returns:
      the WMI fan speed result
    • queryWmiVoltage

      protected abstract WmiResult<Win32Processor.VoltProperty> queryWmiVoltage()
      Queries CPU voltage from WMI Win32_Processor.
      Returns:
      the WMI voltage result