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 OhmHardware {
19
20 private static final String HARDWARE = "Hardware";
21
22
23
24
25 public enum IdentifierProperty {
26 IDENTIFIER;
27 }
28
29 private OhmHardware() {
30 }
31
32
33
34
35
36
37
38
39
40 public static WmiResult<IdentifierProperty> queryHwIdentifier(WmiQueryHandler h, String typeToQuery,
41 String typeName) {
42 StringBuilder sb = new StringBuilder(HARDWARE);
43 sb.append(" WHERE ").append(typeToQuery).append("Type=\"").append(typeName).append('\"');
44 WmiQuery<IdentifierProperty> cpuIdentifierQuery = new WmiQuery<>(WmiUtil.OHM_NAMESPACE, sb.toString(),
45 IdentifierProperty.class);
46 return h.queryWMI(cpuIdentifierQuery, false);
47 }
48 }