Ejemplo n.º 1
0
 private void handleData() throws IOException {
   if (iavailable < 1) {
     return;
   }
   for (i = 0; i < iavailable; i++) {
     receivedPacket = parser.mavlink_parse_char(readData[i] & 0x00ff);
     if (receivedPacket != null) {
       saveToLog(receivedPacket);
       MAVLinkMessage msg = receivedPacket.unpack();
       listner.onReceiveMessage(msg);
     }
   }
 }
Ejemplo n.º 2
0
  @Override
  public void run() {
    super.run();
    try {
      openConnection();
      if (logEnabled) {
        logWriter = FileStream.getTLogFileStream();
        logBuffer = ByteBuffer.allocate(Long.SIZE / Byte.SIZE);
        logBuffer.order(ByteOrder.BIG_ENDIAN);
      }

      while (connected) {
        readDataBlock();
        handleData();
      }
      closeConnection();
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
    listner.onDisconnect();
  }