I have an RFID reader/scanner that I bought from this site E-Gizmo and they have a manual here: Low Cost RFID Reader Manual. I've been trying to get it to work with java and so far, I have almost zero idea how to do this.
what I want to do is to have a class running on the background(threading+Listener? not sure.) that waits for the RFID and store the content of the tag into a variable(String).
so far, I got my class to read the physical port of the device. Here is my code.
package Data;
import com.fazecast.jSerialComm.*;
import java.util.Scanner;
public class ComControl{
public static void main (String argsp[]){
SerialPort ports[] = SerialPort.getCommPorts();
for(SerialPort port: ports){
System.out.println(port.getDescriptivePortName());
}
Scanner i = new Scanner(System.in);
int x = i.nextInt();
SerialPort port = ports[x-1];
if(port.openPort()){
System.out.println("Port is open");
}else{
System.out.println("Port is not available");
return;
}
port.setComPortParameters(9600, 8, 0, 0);
port.setComPortTimeouts(SerialPort.TIMEOUT_READ_SEMI_BLOCKING, 0, 0);
Scanner data = new Scanner(port.getInputStream());
//I just had to give it a try or guess..
do{
System.out.print(data.nextLine());
}while(x<99);
}
}
Ive been browsing around and so far, I havnt found any newbie friendly guides on how to get my device to work with java.
what I currently have in my tools are jSerialComm-1.3.10.jar
and comm-2.0.jar
any hints, guides, or probably code that might help?
I have used JSSC with great success before, it is imo the best serial library for java, I have always had trouble with rxtx:
Linked is an example of how to use the lib for your comms with the scanner