1
2
3
4
5 package oshi.driver.windows.wmi;
6
7 import com.sun.jna.platform.win32.COM.WbemcliUtil.WmiQuery;
8 import com.sun.jna.platform.win32.COM.WbemcliUtil.WmiResult;
9
10 import oshi.annotation.concurrent.ThreadSafe;
11 import oshi.util.platform.windows.WmiQueryHandler;
12 import oshi.util.platform.windows.WmiUtil;
13
14
15
16
17 @ThreadSafe
18 public final class OhmSensor {
19
20 private static final String SENSOR = "Sensor";
21
22
23
24
25 public enum ValueProperty {
26 VALUE;
27 }
28
29 private OhmSensor() {
30 }
31
32
33
34
35
36
37
38
39
40 public static WmiResult<ValueProperty> querySensorValue(WmiQueryHandler h, String identifier, String sensorType) {
41 StringBuilder sb = new StringBuilder(SENSOR);
42 sb.append(" WHERE Parent = \"").append(identifier);
43 sb.append("\" AND SensorType=\"").append(sensorType).append('\"');
44 WmiQuery<ValueProperty> ohmSensorQuery = new WmiQuery<>(WmiUtil.OHM_NAMESPACE, sb.toString(),
45 ValueProperty.class);
46 return h.queryWMI(ohmSensorQuery, false);
47 }
48 }