java - listen for RFID scanner and print data -
i have rfid reader/scanner bought site e-gizmo , have manual here: low cost rfid reader manual. i've been trying work java , far, have 0 idea how this.
what want have class running on background(threading+listener? not sure.) waits rfid , store content of tag variable(string).
so far, got class read physical port of device. here 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 = new scanner(system.in); int x = i.nextint(); serialport port = ports[x-1]; if(port.openport()){ system.out.println("port open"); }else{ system.out.println("port 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 had give try or guess.. do{ system.out.print(data.nextline()); }while(x<99); } }
ive been browsing around , far, havnt found newbie friendly guides on how device work java.
what have in tools jserialcomm-1.3.10.jar
, comm-2.0.jar
any hints, guides, or code might help?
i have used jssc great success before, imo best serial library java, have had trouble rxtx:
linked example of how use lib comms scanner
Comments
Post a Comment