serial port - how to convert rfid tag data (askii) to string in JAVA -


i'm using (id12 innovations) rfid read raspberry pi. using pi4j java library , it's serial example, i'm able read data (5002cf13c6) i'm not sure data is! suppose number (0002948115).

here's code:

// create instance of serial communications class final serial serial = serialfactory.createinstance();  // create , register serial data listener serial.addlistener(new serialdatalistener() { @override public void datareceived(serialdataevent event) {     //-----------     system.out.print("\n" + event.getdata());     //----------- }  });  try {     // open default serial port provided on gpio header     serial.open("/dev/ttyama0", 9600);      // continuous loop keep program running until user terminates program     (;;) {         try {          } catch (illegalstateexception ex) {             ex.printstacktrace();         }         try {             // wait 1 second before continuing             thread.sleep(1000);         } catch (interruptedexception ex) {             logger.getlogger(rfid.class.getname()).log(level.severe, null, ex);         }     }  } catch (serialportexception ex) {     system.out.println("e: rfid setup failed : " + ex.getmessage()); } 

what should event.getdata() in order able read real data?

event.getdata(), returning id12 chip saying on serial port. data 10 character string representation of hexadecimal number, followed 2 character checksum.

the behavior specified in id12 datasheet, can found on google, or here: http://dlnmh9ip6v2uc.cloudfront.net/datasheets/sensors/id/id-2la,%20id-12la,%20id-20la(2013-4-10).pdf . in linked pdf, page 4.

if parsing data in java, please supply actual read data, , corresponding expected values belonging read data.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -