Ejemplo n.º 1
0
 public synchronized void serialEvent(SerialPortEvent serialEvent) {
   if (serialEvent.isRXCHAR()) {
     try {
       byte[] buf = port.readBytes(serialEvent.getEventValue());
       if (buf.length > 0) {
         String msg = new String(buf);
         char[] chars = msg.toCharArray();
         message(chars, chars.length);
       }
     } catch (SerialPortException e) {
       errorMessage("serialEvent", e);
     }
   }
 }