/** * 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); } }
/** 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); } }
/** * 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); } }
/** * 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()); } }
/** Utility method to notify the mavlink listeners about a successful connection. */ protected void reportConnect(long connectionTime) { for (MavLinkConnectionListener listener : mListeners.values()) { listener.onConnect(connectionTime); } }
protected void reportConnecting() { for (MavLinkConnectionListener listener : mListeners.values()) { listener.onStartingConnection(); } }