Example #1
0
  /**
   * Utility method to notify the mavlink listeners about received messages.
   *
   * @param packet received mavlink packet
   */
  private void reportReceivedPacket(MAVLinkPacket packet) {
    if (mListeners.isEmpty()) return;

    for (MavLinkConnectionListener listener : mListeners.values()) {
      listener.onReceivePacket(packet);
    }
  }
Example #2
0
  /** Utility method to notify the mavlink listeners about a connection disconnect. */
  protected void reportDisconnect(long disconnectTime) {
    if (mListeners.isEmpty()) return;

    for (MavLinkConnectionListener listener : mListeners.values()) {
      listener.onDisconnect(disconnectTime);
    }
  }
Example #3
0
  /**
   * Utility method to notify the mavlink listeners about communication errors.
   *
   * @param errMsg
   */
  protected void reportComError(String errMsg) {
    if (mListeners.isEmpty()) return;

    for (MavLinkConnectionListener listener : mListeners.values()) {
      listener.onComError(errMsg);
    }
  }
Example #4
0
  /**
   * Adds a listener to the mavlink connection.
   *
   * @param listener
   * @param tag Listener tag
   */
  public void addMavLinkConnectionListener(String tag, MavLinkConnectionListener listener) {
    mListeners.put(tag, listener);

    if (getConnectionStatus() == MAVLINK_CONNECTED) {
      listener.onConnect(mConnectionTime.get());
    }
  }
Example #5
0
 /** Utility method to notify the mavlink listeners about a successful connection. */
 protected void reportConnect(long connectionTime) {
   for (MavLinkConnectionListener listener : mListeners.values()) {
     listener.onConnect(connectionTime);
   }
 }
Example #6
0
 protected void reportConnecting() {
   for (MavLinkConnectionListener listener : mListeners.values()) {
     listener.onStartingConnection();
   }
 }