Skip to content

Commit

Permalink
correct state update for new clients to existing vehicle connection.
Browse files Browse the repository at this point in the history
  • Loading branch information
m4gr3d committed Mar 27, 2015
1 parent 89bc7f3 commit 1ba29fc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Binary file modified ClientLib/mobile/libs/AidlLib.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.droidplanner.services.android.location.FusedLocation;
import org.droidplanner.services.android.utils.AndroidApWarningParser;
import org.droidplanner.services.android.utils.analytics.GAUtils;
import org.droidplanner.services.android.utils.file.IO.CameraInfoLoader;
import org.droidplanner.services.android.utils.prefs.DroidPlannerPrefs;

import java.util.List;
Expand Down Expand Up @@ -134,6 +133,13 @@ public void connect(String appId, DroneEventsListener listener) throws Connectio
mavClient.openConnection();
} else {
listener.onDroneEvent(DroneInterfaces.DroneEventsType.CONNECTED, drone);

if (drone.isConnectionAlive())
listener.onDroneEvent(DroneInterfaces.DroneEventsType.HEARTBEAT_FIRST, drone);
else
listener.onDroneEvent(DroneInterfaces.DroneEventsType.HEARTBEAT_TIMEOUT, drone);


notifyConnected(appId, listener);
}

Expand All @@ -152,7 +158,7 @@ private void disconnect() {
}
}

public int getConnectedAppsCount(){
public int getConnectedAppsCount() {
return connectedApps.size();
}

Expand Down Expand Up @@ -406,11 +412,11 @@ public ConnectionParameter getConnectionParameter() {

@Override
public void onMessageLogged(int mavSeverity, String message) {
if(connectedApps.isEmpty())
if (connectedApps.isEmpty())
return;

final int logLevel;
switch(mavSeverity){
switch (mavSeverity) {
case MAV_SEVERITY.MAV_SEVERITY_ALERT:
case MAV_SEVERITY.MAV_SEVERITY_CRITICAL:
case MAV_SEVERITY.MAV_SEVERITY_EMERGENCY:
Expand All @@ -436,7 +442,7 @@ public void onMessageLogged(int mavSeverity, String message) {
break;
}

for(DroneEventsListener listener: connectedApps.values()){
for (DroneEventsListener listener : connectedApps.values()) {
listener.onMessageLogged(logLevel, message);
}
}
Expand Down

0 comments on commit 1ba29fc

Please sign in to comment.