Example #1
0
 public void newRouteIsCalculated(boolean newRoute) {
   CommandBuilder play = getNewCommandPlayerToPlay();
   if (play != null) {
     if (!newRoute) {
       // suppress "route recalculated" prompt for GPX-routing, it makes no sense
       // suppress "route recalculated" prompt for 60sec (this workaround now outdated after more
       // intelligent route recalculation and directional voice prompt suppression)
       // if (router.getCurrentGPXRoute() == null && (System.currentTimeMillis() -
       // lastTimeRouteRecalcAnnounced > 60000)) {
       if (router.getCurrentGPXRoute() == null) {
         play.routeRecalculated(router.getLeftDistance()).play();
         currentStatus = STATUS_UNKNOWN;
         // lastTimeRouteRecalcAnnounced = System.currentTimeMillis();
       }
     } else {
       play.newRouteCalculated(router.getLeftDistance()).play();
       currentStatus = STATUS_UNKNOWN;
     }
   } else if (player == null) {
     pendingCommand =
         new VoiceCommandPending(
             !newRoute
                 ? VoiceCommandPending.ROUTE_RECALCULATED
                 : VoiceCommandPending.ROUTE_CALCULATED,
             this);
     currentStatus = STATUS_UNKNOWN;
   }
   nextRouteDirection = null;
 }
Example #2
0
 private boolean playMakeUTwp() {
   CommandBuilder play = getNewCommandPlayerToPlay();
   if (play != null) {
     play.makeUTwp().play();
     return true;
   }
   return false;
 }
Example #3
0
 private boolean playGoAheadToIntermediate() {
   CommandBuilder play = getNewCommandPlayerToPlay();
   if (play != null) {
     play.goAhead(router.getLeftDistanceNextIntermediate()).andArriveAtIntermediatePoint().play();
     return true;
   }
   return false;
 }
Example #4
0
 private boolean playGoAheadToDestination() {
   CommandBuilder play = getNewCommandPlayerToPlay();
   if (play != null) {
     play.goAhead(router.getLeftDistance()).andArriveAtDestination().play();
     return true;
   }
   return false;
 }
Example #5
0
 public void play(CommandBuilder newCommand) {
   int left = voiceRouter.router.getLeftDistance();
   if (left > 0) {
     if (type == ROUTE_CALCULATED) {
       newCommand.newRouteCalculated(left).play();
     } else if (type == ROUTE_RECALCULATED) {
       newCommand.routeRecalculated(left).play();
     }
   }
 }
Example #6
0
 private void playPrepareTurn(RouteDirectionInfo next, int dist) {
   CommandBuilder play = getNewCommandPlayerToPlay();
   if (play != null) {
     String tParam = getTurnType(next.getTurnType());
     if (tParam != null) {
       play.prepareTurn(tParam, dist).play();
     } else if (next.getTurnType().isRoundAbout()) {
       play.prepareRoundAbout(dist).play();
     } else if (next.getTurnType().getValue().equals(TurnType.TU)
         || next.getTurnType().getValue().equals(TurnType.TRU)) {
       play.prepareMakeUT(dist).play();
     }
   }
 }
Example #7
0
 private void playMakeTurnIn(
     RouteDirectionInfo next, int dist, RouteDirectionInfo pronounceNextNext) {
   CommandBuilder play = getNewCommandPlayerToPlay();
   if (play != null) {
     String tParam = getTurnType(next.getTurnType());
     boolean isPlay = true;
     if (tParam != null) {
       play.turn(tParam, dist);
     } else if (next.getTurnType().isRoundAbout()) {
       play.roundAbout(dist, next.getTurnType().getTurnAngle(), next.getTurnType().getExitOut());
     } else if (next.getTurnType().getValue().equals(TurnType.TU)
         || next.getTurnType().getValue().equals(TurnType.TRU)) {
       play.makeUT(dist);
     } else {
       isPlay = false;
     }
     // small preparation to next after next
     if (pronounceNextNext != null) {
       TurnType t = pronounceNextNext.getTurnType();
       isPlay = true;
       if (next.getTurnType().getValue().equals(TurnType.C) && !TurnType.C.equals(t.getValue())) {
         play.goAhead(dist);
       }
       if (TurnType.TL.equals(t.getValue())
           || TurnType.TSHL.equals(t.getValue())
           || TurnType.TSLL.equals(t.getValue())
           || TurnType.TU.equals(t.getValue())
           || TurnType.KL.equals(t.getValue())) {
         play.then().bearLeft();
       } else if (TurnType.TR.equals(t.getValue())
           || TurnType.TSHR.equals(t.getValue())
           || TurnType.TSLR.equals(t.getValue())
           || TurnType.KR.equals(t.getValue())) {
         play.then().bearRight();
       }
     }
     if (isPlay) {
       play.play();
     }
   }
 }
Example #8
0
 public void arrivedIntermediatePoint() {
   CommandBuilder play = getNewCommandPlayerToPlay();
   if (play != null) {
     play.arrivedAtIntermediatePoint().play();
   }
 }
Example #9
0
 public void arrivedDestinationPoint() {
   CommandBuilder play = getNewCommandPlayerToPlay();
   if (play != null) {
     play.arrivedAtDestination().play();
   }
 }
Example #10
0
 public void gpsLocationLost() {
   CommandBuilder play = getNewCommandPlayerToPlay();
   if (play != null) {
     play.gpsLocationLost().play();
   }
 }
Example #11
0
 private void playMakeTurn(RouteDirectionInfo next, RouteDirectionInfo nextNext) {
   CommandBuilder play = getNewCommandPlayerToPlay();
   if (play != null) {
     String tParam = getTurnType(next.getTurnType());
     boolean isplay = true;
     if (tParam != null) {
       play.turn(tParam);
     } else if (next.getTurnType().isRoundAbout()) {
       play.roundAbout(next.getTurnType().getTurnAngle(), next.getTurnType().getExitOut());
     } else if (next.getTurnType().getValue().equals(TurnType.TU)
         || next.getTurnType().getValue().equals(TurnType.TRU)) {
       play.makeUT();
       // do not say it
       //				} else if(next.getTurnType().getValue().equals(TurnType.C)){
       //					play.goAhead();
     } else {
       isplay = false;
     }
     // add turn after next
     if (nextNext != null) {
       String t2Param = getTurnType(nextNext.getTurnType());
       if (t2Param != null) {
         if (isplay) {
           play.then();
         }
         play.turn(t2Param, next.distance);
       } else if (nextNext.getTurnType().isRoundAbout()) {
         if (isplay) {
           play.then();
         }
         play.roundAbout(
             next.distance,
             nextNext.getTurnType().getTurnAngle(),
             nextNext.getTurnType().getExitOut());
       } else if (nextNext.getTurnType().getValue().equals(TurnType.TU)) {
         if (isplay) {
           play.then();
         }
         play.makeUT(next.distance);
       }
       isplay = true;
     }
     if (isplay) {
       play.play();
     }
   }
 }
Example #12
0
 private void playGoAhead(int dist) {
   CommandBuilder play = getNewCommandPlayerToPlay();
   if (play != null) {
     play.goAhead(dist).play();
   }
 }