1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 package org.ximtec.igesture.io.wacom;
28
29
30
31 import java.awt.Point;
32 import java.util.logging.Logger;
33
34 import org.ximtec.igesture.io.wacom.Wintab32.ORIENTATION;
35 import org.ximtec.igesture.io.wacom.Wintab32.PACKET;
36 import org.ximtec.igesture.io.wacom.Wintab32.ROTATION;
37
38
39
40
41
42
43
44
45
46
47
48
49 public class Win32TabletProxy {
50
51 private static final Logger LOGGER = Logger.getLogger(Win32TabletProxy.class
52 .getName());
53
54
55
56 private WacomUtils tabletUtils = new WacomUtils();
57 private PACKET lastPacket = null;
58
59 public Win32TabletProxy(){
60 LOGGER.info("Init...");
61 tabletUtils.open();
62 }
63
64 public boolean isExtraDataSupported(){
65 return tabletUtils.isDataSupported(14)||tabletUtils.isDataSupported(16)||
66 tabletUtils.isDataSupported(17)||tabletUtils.isDataSupported(18);
67 }
68
69
70
71
72
73 public void getNextPacket() {
74 lastPacket = tabletUtils.getOnePacket();
75 }
76
77
78
79
80
81 public PACKET getLastPacket() {
82
83 return lastPacket;
84 }
85
86
87
88
89
90
91 public long getTimeStamp() {
92 if (lastPacket!=null)
93 return lastPacket.pkTime;
94 else
95 return 0;
96 }
97
98
99
100
101
102
103
104
105 public int getPressure() {
106 if (lastPacket!=null)
107 return lastPacket.pkNormalPressure;
108 else
109 return -1;
110 }
111
112
113
114
115
116
117 public int getTangentPressure() {
118 if (lastPacket!=null)
119 return lastPacket.pkTangentPressure;
120 else
121 return -1;
122 }
123
124
125
126
127
128
129 public int getzval() {
130 if (lastPacket!=null)
131 return lastPacket.pkZ;
132 else
133 return -1;
134 }
135
136
137
138
139
140
141
142
143 public ORIENTATION getOrientation() {
144 if (lastPacket!=null)
145 return lastPacket.pkOrientation;
146 else
147 return null;
148 }
149
150
151
152
153
154
155
156 public ROTATION getRotation() {
157 if (lastPacket!=null){
158 return lastPacket.pkRotation;
159 }else
160 return null;
161 }
162
163
164
165
166
167
168
169 public Point getLastCursorLocation() {
170 if (lastPacket!=null)
171 return new Point(lastPacket.pkX, lastPacket.pkY);
172 else
173 return null;
174 }
175
176
177 public int buttonPressed(){
178 return lastPacket.pkButtons;
179 }
180
181 }