Added command to announce back on route

This commit is contained in:
Denis 2014-10-08 19:31:14 +03:00
parent fa0a23450b
commit 416f824455
3 changed files with 19 additions and 2 deletions

View file

@ -72,6 +72,8 @@ public class RoutingHelper {
private RouteCalculationProgressCallback progressRoute;
private boolean announceBackOnRoute = false;
// private ProgressBar progress;
// private Handler progressHandler;
@ -272,6 +274,7 @@ public class RoutingHelper {
}
if(dist > 350) {
voiceRouter.announceOffRoute(dist);
announceBackOnRoute = true;
}
}
// 3. Identify wrong movement direction
@ -321,6 +324,10 @@ public class RoutingHelper {
if(!thread.isParamsChanged()) {
thread.stopCalculation();
}
if (announceBackOnRoute){
voiceRouter.announceBackOnRoute();
announceBackOnRoute = false;
}
}
}

View file

@ -222,6 +222,13 @@ public class VoiceRouter {
}
}
public void announceBackOnRoute() {
CommandBuilder p = getNewCommandPlayerToPlay();
if (p != null) {
p.backOnRoute().play();
}
}
public void announceWaypoint(List<LocationPointWrapper> points) {
CommandBuilder p = getNewCommandPlayerToPlay();
if (p == null){

View file

@ -37,6 +37,7 @@ public class CommandBuilder {
protected static final String C_SPEAD_ALARM = "speed_alarm"; //$NON-NLS-1$
protected static final String C_ATTENTION = "attention"; //$NON-NLS-1$
protected static final String C_OFF_ROUTE = "off_route"; //$NON-NLS-1$
protected static final String C_BACK_ON_ROUTE ="back_on_route"; //$NON-NLS-1$
protected static final String C_BEAR_LEFT = "bear_left"; //$NON-NLS-1$
@ -133,8 +134,10 @@ public class CommandBuilder {
public CommandBuilder offRoute(double dist){
return addCommand(C_OFF_ROUTE, dist);
}
public CommandBuilder backOnRoute(){
return addCommand(C_BACK_ON_ROUTE);
}
public CommandBuilder makeUT(double dist, Term streetName){
return alt(prepareStruct(C_MAKE_UT, dist, streetName), prepareStruct(C_MAKE_UT, dist));