-
Notifications
You must be signed in to change notification settings - Fork 0
/
Capabilities.java
executable file
·133 lines (113 loc) · 4.32 KB
/
Capabilities.java
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import com.digitalpersona.uareu.*;
public class Capabilities
extends JPanel
implements ActionListener
{
private static final long serialVersionUID = 3;
private static final String ACT_BACK = "back";
private JDialog m_dlgParent;
private Capabilities(Reader reader){
final int vgap = 5;
final int width = 380;
BoxLayout layout = new BoxLayout(this, BoxLayout.Y_AXIS);
setLayout(layout);
JTextArea textReader = new JTextArea(22, 1);
textReader.setEditable(false);
JScrollPane paneReader = new JScrollPane(textReader);
add(paneReader);
Dimension dmSize = paneReader.getPreferredSize();
dmSize.width = width;
paneReader.setPreferredSize(dmSize);
add(Box.createVerticalStrut(vgap));
JButton btnBack = new JButton("Back");
btnBack.setActionCommand(ACT_BACK);
btnBack.addActionListener(this);
add(btnBack);
add(Box.createVerticalStrut(vgap));
setOpaque(true);
//print out description
Reader.Description rd = reader.GetDescription();
String str = String.format("Vendor name: %s\n", rd.id.vendor_name);
textReader.append(str);
str = String.format("Product name: %s\n", rd.id.product_name);
textReader.append(str);
str = String.format("Serial number: %s\n", rd.serial_number);
textReader.append(str);
str = String.format("USB VID: %s\n", rd.id.vendor_id);
textReader.append(str);
str = String.format("USB PID: %s\n", rd.id.product_id);
textReader.append(str);
str = String.format("USB BCD revision: %s\n", rd.version.bcd_revision);
textReader.append(str);
str = String.format("HW version: %d.%d.%d\n", rd.version.hardware_version.major, rd.version.hardware_version.minor, rd.version.hardware_version.maintenance);
textReader.append(str);
str = String.format("FW version: %d.%d.%d\n", rd.version.firmware_version.major, rd.version.firmware_version.minor, rd.version.firmware_version.maintenance);
textReader.append(str);
try{
//open reader
reader.Open(Reader.Priority.COOPERATIVE);
//acquire capabilities
Reader.Capabilities rc = reader.GetCapabilities();
//close reader
reader.Close();
//print out capabilities
textReader.append("\n");
str = String.format("can capture image: %b\n", rc.can_capture);
textReader.append(str);
str = String.format("can stream image: %b\n", rc.can_stream);
textReader.append(str);
str = String.format("can extract features: %b\n", rc.can_extract_features);
textReader.append(str);
str = String.format("can match: %b\n", rc.can_match);
textReader.append(str);
str = String.format("can identify: %b\n", rc.can_identify);
textReader.append(str);
str = String.format("has fingerprint storage: %b\n", rc.has_fingerprint_storage);
textReader.append(str);
str = String.format("indicator type: %d\n", rc.indicator_type);
textReader.append(str);
str = String.format("has power management: %b\n", rc.has_power_management);
textReader.append(str);
str = String.format("has calibration: %b\n", rc.has_calibration);
textReader.append(str);
str = String.format("PIV compliant: %b\n", rc.piv_compliant);
textReader.append(str);
for(int i = 0; i < rc.resolutions.length; i++){
str = String.format("resolution: %d dpi\n", rc.resolutions[i]);
textReader.append(str);
}
}
catch(UareUException e){
MessageBox.DpError("Reader.GetCapabilities()", e);
}
}
public void actionPerformed(ActionEvent e){
if(e.getActionCommand().equals(ACT_BACK)){
m_dlgParent.setVisible(false);
}
}
private void doModal(JDialog dlgParent){
m_dlgParent = dlgParent;
m_dlgParent.setContentPane(this);
m_dlgParent.pack();
m_dlgParent.setLocationRelativeTo(null);
m_dlgParent.toFront();
m_dlgParent.setVisible(true);
m_dlgParent.dispose();
}
public static void Show(Reader reader){
JDialog dlg = new JDialog((JDialog)null, "Reader capabilities", true);
Capabilities capabilities = new Capabilities(reader);
capabilities.doModal(dlg);
}
}