我已尝试针对uareu 4500指纹设备测试我的示例代码,并且我在连接阅读器和断开连接时收到警报,但是当手指放在传感器上时却没有。当使用c ++代码测试时,读者可以很好地工作,但不能使用java代码。请任何建议。 请找到以下代码:
package application1;
import com.digitalpersona.onetouch.DPFPGlobal;
import com.digitalpersona.onetouch.capture.DPFPCapture;
import com.digitalpersona.onetouch.capture.DPFPCapturePriority;
import com.digitalpersona.onetouch.capture.event.DPFPDataEvent;
import com.digitalpersona.onetouch.capture.event.DPFPErrorEvent;
import com.digitalpersona.onetouch.capture.event.DPFPErrorListener;
import com.digitalpersona.onetouch.capture.event.DPFPImageQualityEvent;
import com.digitalpersona.onetouch.capture.event.DPFPImageQualityListener;
import com.digitalpersona.onetouch.capture.event.DPFPReaderStatusEvent;
import com.digitalpersona.onetouch.capture.event.DPFPReaderStatusListener;
import com.digitalpersona.onetouch.capture.event.DPFPSensorEvent;
import com.digitalpersona.onetouch.capture.event.DPFPSensorListener;
import com.digitalpersona.onetouch.readers.DPFPReadersCollection;
import javax.swing.JOptionPane;
/**
*
* @author uncle-samba
*/
public class Application1 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
DPFPReadersCollection readers = DPFPGlobal.getReadersFactory().getReaders();
DPFPCapture capture = DPFPGlobal.getCaptureFactory().createCapture();
capture.setReaderSerialNumber(readers.get(0).getSerialNumber());
capture.setPriority(DPFPCapturePriority.CAPTURE_PRIORITY_HIGH);
capture.startCapture();
capture.addDataListener((DPFPDataEvent dpfpde) -> {
JOptionPane.showMessageDialog(null, "Data Aquired", "Data Aquired", JOptionPane.INFORMATION_MESSAGE);
});
capture.addErrorListener(new DPFPErrorListener() {
@Override
public void errorOccured(DPFPErrorEvent dpfpee) {
JOptionPane.showMessageDialog(null, "Error: "+ dpfpee.getError().getErrorText(), "Error Occured", JOptionPane.ERROR_MESSAGE);
}
@Override
public void exceptionCaught(DPFPErrorEvent dpfpee) {
JOptionPane.showMessageDialog(null, "Error: "+ dpfpee.getError().getErrorText(), "Exception Caught", JOptionPane.ERROR_MESSAGE);
}
});
capture.addImageQualityListener(new DPFPImageQualityListener() {
@Override
public void onImageQuality(DPFPImageQualityEvent dpfpq) {
JOptionPane.showMessageDialog(null, "Image Quality", "onImageQuality", JOptionPane.INFORMATION_MESSAGE);
}
});
capture.addReaderStatusListener(new DPFPReaderStatusListener() {
@Override
public void readerConnected(DPFPReaderStatusEvent dpfprs) {
JOptionPane.showMessageDialog(null, "Reader Connected", "Reader Status", JOptionPane.INFORMATION_MESSAGE);
}
@Override
public void readerDisconnected(DPFPReaderStatusEvent dpfprs) {
JOptionPane.showMessageDialog(null, "Reader disconnected", "Reader Status", JOptionPane.INFORMATION_MESSAGE);
}
});
capture.addSensorListener(new DPFPSensorListener() {
@Override
public void fingerTouched(DPFPSensorEvent dpfpse) {
JOptionPane.showMessageDialog(null, "Finger Touched", "Sensor", JOptionPane.INFORMATION_MESSAGE);
}
@Override
public void fingerGone(DPFPSensorEvent dpfpse) {
JOptionPane.showMessageDialog(null, "Finger Gone", "Sensor", JOptionPane.INFORMATION_MESSAGE);
}
@Override
public void imageAcquired(DPFPSensorEvent dpfpse) {
JOptionPane.showMessageDialog(null, "Image Aquired", "Sensor", JOptionPane.INFORMATION_MESSAGE);
}
});
}
}