I am trying to connect with a Biometric Fingerprint Attendance Device using a Java Program. The device I am using is a Pegasus T5 Fingerprint scanner. Unfortunately their SDK for this device (which can be downloaded here) covers only C#, .Net, and VB which I have no expertise. And when I have requested the manufacturers, they have replied that there is no Java SDK for the device. Even though I have no knowledge on any of those languages, I gave a try to understand the codes in the SDK to find out how the device is connecting and I saw that it is just making a connection with the device using the network ip and port number.
If you refer to the C# SDK of the device, you can see the example I saw on this at
frmEvent.cs which in the cmdStartMoniter_Click method, make the connection as follows.
bRet = bpc.StartEventCapture(0, util.pubIPAddrToLong(txtSourceIP.Text), Convert.ToInt32(txtPortNumber.Text));
And that refers to the method StartEventCapture as public virtual bool StartEventCapture(int dwCommType, int dwParam1, int dwParam2); which is in a .dll file as it appears and which I have lost my track as I have further knowledge on how to figure out the code.
However keeping that example I had seen in my head, as my next step I started researching for a global standard on how to connect, send and retrieve data with a Fingerprint Device which again I wasn't lucky enough to find a clear solution. But with some examples from some people who have been trying to deal with the same and the example I saw by myself, I tried to connect with the device by creating a Socket object but when I executed it, it only resulted with the java.net.ConnectException: Connection timed out: connect
There are four questions
- Is there any Java SDK for Biometric Fingerprint Attendance Devices which I can use for my device as well?
- Is there any general, standard way to connect, send and retrieve data from such device using Java?
- If connecting to the device via a
Socketis a solution, is there any specific, standard requests I should be sending to the device in order to receive a response from it? - If the attempt I have made is a way to do it, what I have I done wrong with it and how should I correct the problem?
This is the code I used to connect with the device.
String host = "192.168.168.100";
int port = Integer.parseInt("5005");
try {
Socket socket = new Socket(host, port);
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String line;
while (true){
line = in.readLine();
if (line != null){
System.out.println(line);
}
}
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}