1
2
3
4
5 package oshi.driver.windows.wmi;
6
7 import java.util.Objects;
8
9 import com.sun.jna.platform.win32.COM.WbemcliUtil.WmiQuery;
10 import com.sun.jna.platform.win32.COM.WbemcliUtil.WmiResult;
11
12 import oshi.annotation.concurrent.ThreadSafe;
13 import oshi.util.platform.windows.WmiQueryHandler;
14
15
16
17
18 @ThreadSafe
19 public final class Win32PhysicalMemory {
20
21 private static final String WIN32_PHYSICAL_MEMORY = "Win32_PhysicalMemory";
22
23
24
25
26 public enum PhysicalMemoryProperty {
27 BANKLABEL, CAPACITY, SPEED, MANUFACTURER, PARTNUMBER, SMBIOSMEMORYTYPE, SERIALNUMBER
28 }
29
30
31
32
33 public enum PhysicalMemoryPropertyWin8 {
34 BANKLABEL, CAPACITY, SPEED, MANUFACTURER, MEMORYTYPE, PARTNUMBER, SERIALNUMBER
35 }
36
37 private Win32PhysicalMemory() {
38 }
39
40
41
42
43
44
45 public static WmiResult<PhysicalMemoryProperty> queryphysicalMemory() {
46 WmiQuery<PhysicalMemoryProperty> physicalMemoryQuery = new WmiQuery<>(WIN32_PHYSICAL_MEMORY,
47 PhysicalMemoryProperty.class);
48 return Objects.requireNonNull(WmiQueryHandler.createInstance()).queryWMI(physicalMemoryQuery);
49 }
50
51
52
53
54
55
56 public static WmiResult<PhysicalMemoryPropertyWin8> queryphysicalMemoryWin8() {
57 WmiQuery<PhysicalMemoryPropertyWin8> physicalMemoryQuery = new WmiQuery<>(WIN32_PHYSICAL_MEMORY,
58 PhysicalMemoryPropertyWin8.class);
59 return Objects.requireNonNull(WmiQueryHandler.createInstance()).queryWMI(physicalMemoryQuery);
60 }
61 }