コード例 #1
0
ファイル: Drone.java プロジェクト: forgodsake/FUAV
 /** @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;
 }
コード例 #2
0
 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();
   }
 }
コード例 #3
0
 @Override
 public boolean isSlidingUpPanelEnabled(Drone drone) {
   final State droneState = drone.getAttribute(AttributeType.STATE);
   return droneState.isConnected() && droneState.isArmed() && droneState.isFlying();
 }