Skip to content

Commit

Permalink
Update android-client to use new MavsdkServer
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasVautherin committed May 11, 2020
1 parent d002f5d commit 2e342f9
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class MapsActivity extends AppCompatActivity implements OnMapReadyCallbac
private MapsViewModel viewModel;
private Symbol currentPositionMarker;

private MavsdkServer mavsdkServer = new MavsdkServer();
private System drone;
private final List<Circle> waypoints = new ArrayList<>();
private final List<Disposable> disposables = new ArrayList<>();
Expand Down Expand Up @@ -88,12 +89,8 @@ public void onResume() {
viewModel.currentPositionLiveData.observe(this, currentPositionObserver);
viewModel.currentMissionPlanLiveData.observe(this, currentMissionPlanObserver);

new Thread(() -> {
MavsdkServer mavsdkServer = new MavsdkServer();
mavsdkServer.run("udp://:14540", 50020);
}).start();

drone = new System(BACKEND_IP_ADDRESS, 50020);
int mavsdkServerPort = mavsdkServer.run();
drone = new System(BACKEND_IP_ADDRESS, mavsdkServerPort);

disposables.add(drone.getTelemetry().getFlightMode().distinct()
.subscribe(flightMode -> logger.debug("flight mode: " + flightMode)));
Expand All @@ -118,6 +115,7 @@ public void onPause() {

drone.dispose();
drone = null;
mavsdkServer.stop();
}

@Override
Expand Down

0 comments on commit 2e342f9

Please sign in to comment.