Beispiel #1
0
 /** @return Vehicle flight time in seconds. */
 public long getFlightTime() {
   State droneState = getAttribute(AttributeType.STATE);
   if (droneState != null && droneState.isFlying()) {
     // calc delta time since last checked
     elapsedFlightTime += SystemClock.elapsedRealtime() - startTime;
     startTime = SystemClock.elapsedRealtime();
   }
   return elapsedFlightTime / 1000;
 }
 private void setupButtonsByFlightState() {
   final State droneState = getDrone().getAttribute(AttributeType.STATE);
   if (droneState != null && droneState.isConnected()) {
     if (droneState.isArmed()) {
       if (droneState.isFlying()) {
         setupButtonsForFlying();
       } else {
         setupButtonsForArmed();
       }
     } else {
       setupButtonsForDisarmed();
     }
   } else {
     setupButtonsForDisconnected();
   }
 }
 @Override
 public boolean isSlidingUpPanelEnabled(Drone drone) {
   final State droneState = drone.getAttribute(AttributeType.STATE);
   return droneState.isConnected() && droneState.isArmed() && droneState.isFlying();
 }