예제 #1
0
파일: Serial.java 프로젝트: roboard/86Duino
 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);
     }
   }
 }