Пример #1
0
 private void storeData(byte[] bs) {
   try {
     fifo_out.add(bs);
   } catch (InterruptedException e) {
     logger.error("The program has failed to backup data " + new String(bs));
   }
 }
Пример #2
0
 @Override
 public void write(byte[] bs) throws SerialPortException {
   try {
     if (fifo_out.getSize() > 0) {
       flush();
     }
     writeNative(bs);
   } catch (Exception e) {
     storeData(bs);
     logger.warn(
         "Failed to write "
             + new String(bs)
             + " "
             + bs.length
             + " octects on "
             + this.getPort_name());
     pending(500);
     flush();
   }
 }
Пример #3
0
 @Override
 public void flush() throws SerialPortException {
   if (fifo_out.getSize() > 0) {
     writeNative(fifo_out.removeAll());
   }
 }