1
2
3
4
5 package oshi.jna.platform.mac;
6
7 import com.sun.jna.Native;
8 import com.sun.jna.NativeLong;
9 import com.sun.jna.Structure;
10 import com.sun.jna.Structure.FieldOrder;
11 import com.sun.jna.ptr.NativeLongByReference;
12
13 import oshi.util.Util;
14
15
16
17
18
19 public interface IOKit extends com.sun.jna.platform.mac.IOKit {
20
21 IOKit INSTANCE = Native.load("IOKit", IOKit.class);
22
23
24
25
26
27
28
29 @FieldOrder({ "major", "minor", "build", "reserved", "release" })
30 class SMCKeyDataVers extends Structure {
31 public byte major;
32 public byte minor;
33 public byte build;
34 public byte reserved;
35 public short release;
36 }
37
38
39
40
41 @FieldOrder({ "version", "length", "cpuPLimit", "gpuPLimit", "memPLimit" })
42 class SMCKeyDataPLimitData extends Structure {
43 public short version;
44 public short length;
45 public int cpuPLimit;
46 public int gpuPLimit;
47 public int memPLimit;
48 }
49
50
51
52
53 @FieldOrder({ "dataSize", "dataType", "dataAttributes" })
54 class SMCKeyDataKeyInfo extends Structure {
55 public int dataSize;
56 public int dataType;
57 public byte dataAttributes;
58 }
59
60
61
62
63 @FieldOrder({ "key", "vers", "pLimitData", "keyInfo", "result", "status", "data8", "data32", "bytes" })
64 class SMCKeyData extends Structure implements AutoCloseable {
65 public int key;
66 public SMCKeyDataVers vers;
67 public SMCKeyDataPLimitData pLimitData;
68 public SMCKeyDataKeyInfo keyInfo;
69 public byte result;
70 public byte status;
71 public byte data8;
72 public int data32;
73 public byte[] bytes = new byte[32];
74
75 @Override
76 public void close() {
77 Util.freeMemory(getPointer());
78 }
79 }
80
81
82
83
84 @FieldOrder({ "key", "dataSize", "dataType", "bytes" })
85 class SMCVal extends Structure implements AutoCloseable {
86 public byte[] key = new byte[5];
87 public int dataSize;
88 public byte[] dataType = new byte[5];
89 public byte[] bytes = new byte[32];
90
91 @Override
92 public void close() {
93 Util.freeMemory(getPointer());
94 }
95 }
96
97
98
99
100 int IOConnectCallStructMethod(IOConnect connection, int selector, Structure inputStructure,
101 NativeLong structureInputSize, Structure outputStructure, NativeLongByReference structureOutputSize);
102 }