1 /*
2 * Copyright 2016-2025 The OSHI Project Contributors
3 * SPDX-License-Identifier: MIT
4 */
5 package oshi.hardware;
6
7 import oshi.annotation.concurrent.ThreadSafe;
8
9 /**
10 * Sensors include hardware sensors to monitor temperature, fan speed, and other information.
11 * <p>
12 * Drivers may or may not exist to collect this data depending on the installed hardware and Operating System. In
13 * addition, software-hardware communication may suffer intermittent errors when attempting to access this information.
14 * Users should expect, test for, and handle zero values and/or empty arrays which will result if the OS is unable to
15 * provide the information.
16 * <p>
17 * Windows information is generally retrieved via Windows Management Instrumentation (WMI). Unfortunately, most hardware
18 * providers do not publish sensor values to WMI. OSHI attempts to retrieve values from
19 * <a href="https://github.com/LibreHardwareMonitor/LibreHardwareMonitor">LibreHardwareMonitor</a> if the optional
20 * <a href="https://github.com/pandalxb/jLibreHardwareMonitor">jLibreHardwareMonitor</a> dependency is included.
21 * Otherwise, OSHI attempts to retrieve values from <a href="https://openhardwaremonitor.org/">Open Hardware Monitor</a>
22 * if it is running. Otherwise, OSHI retrieves via the Microsoft API, which may require elevated permissions and still
23 * may provide no results or unchanging results depending on the motherboard manufacturer.
24 */
25 @ThreadSafe
26 public interface Sensors {
27 /**
28 * CPU Temperature
29 *
30 * @return CPU Temperature in degrees Celsius if available, 0 or {@link Double#NaN} otherwise.
31 * <p>
32 * See notes on {@link Sensors}.
33 */
34 double getCpuTemperature();
35
36 /**
37 * Fan speeds
38 *
39 * @return Speed in rpm for all fans. May return empty array if no fans detected or 0 fan speed if unable to measure
40 * fan speed.
41 */
42 int[] getFanSpeeds();
43
44 /**
45 * CPU Voltage
46 *
47 * @return CPU Voltage in Volts if available, 0 otherwise.
48 */
49 double getCpuVoltage();
50 }