re-sort code for appproach/reach waypoint/faorites/poi prompts to facilitate debugging

This commit is contained in:
sonora 2014-10-30 06:34:14 +01:00
parent ab0651aedc
commit b88aca8be4
2 changed files with 58 additions and 57 deletions

View file

@ -229,6 +229,38 @@ public class VoiceRouter {
}
}
public void approachWaypoint(Location location, List<LocationPointWrapper> points){
CommandBuilder p = getNewCommandPlayerToPlay();
if (p == null){
return;
}
double[] dist = new double[1];
makeSound();
String text = getText(location, points, dist);
p.goAhead(dist[0], null).andArriveAtWayPoint(text).play();
}
public void approachFavorite(Location location, List<LocationPointWrapper> points){
CommandBuilder p = getNewCommandPlayerToPlay();
if (p == null){
return;
}
double[] dist = new double[1];
makeSound();
String text = getText(location, points, dist);
p.goAhead(dist[0], null).andArriveAtFavorite(text).play();
}
public void approachPoi(Location location, List<LocationPointWrapper> points){
CommandBuilder p = getNewCommandPlayerToPlay();
if (p == null){
return;
}
double[] dist = new double[1];
String text = getText(location, points, dist);
p.goAhead(dist[0], null).andArriveAtPoiWaypoint(text).play();
}
public void announceWaypoint(List<LocationPointWrapper> points) {
CommandBuilder p = getNewCommandPlayerToPlay();
if (p == null){
@ -258,38 +290,6 @@ public class VoiceRouter {
p.arrivedAtPoi(text).play();
}
public void approachFavorite(Location location, List<LocationPointWrapper> points){
CommandBuilder p = getNewCommandPlayerToPlay();
if (p == null){
return;
}
double[] dist = new double[1];
makeSound();
String text = getText(location, points, dist);
p.goAhead(dist[0], null).andArriveAtFavorite(text).play();
}
public void approachWaypoint(Location location, List<LocationPointWrapper> points){
CommandBuilder p = getNewCommandPlayerToPlay();
if (p == null){
return;
}
double[] dist = new double[1];
makeSound();
String text = getText(location, points, dist);
p.goAhead(dist[0], null).andArriveAtWayPoint(text).play();
}
public void approachPoi(Location location, List<LocationPointWrapper> points){
CommandBuilder p = getNewCommandPlayerToPlay();
if (p == null){
return;
}
double[] dist = new double[1];
String text = getText(location, points, dist);
p.goAhead(dist[0], null).andArriveAtPoiWaypoint(text).play();
}
protected String getText(Location location, List<LocationPointWrapper> points, double[] dist) {
String text = "";
for (LocationPointWrapper point : points) {
@ -740,12 +740,13 @@ public class VoiceRouter {
}
}
public void arrivedWayPoint(String name) {
CommandBuilder play = getNewCommandPlayerToPlay();
if(play != null){
play.arrivedAtWayPoint(getSpeakablePointName(name)).play();
}
}
// This is not needed, used are only arrivedIntermediatePoint (for points on the route) or announceWaypoint (for points near the route=)
//public void arrivedWayPoint(String name) {
// CommandBuilder play = getNewCommandPlayerToPlay();
// if(play != null){
// play.arrivedAtWayPoint(getSpeakablePointName(name)).play();
// }
//}
public void onApplicationTerminate(Context ctx) {
if (player != null) {

View file

@ -186,22 +186,34 @@ public class CommandBuilder {
return alt(prepareStruct(C_REACHED_DESTINATION, name), prepareStruct(C_REACHED_DESTINATION));
}
public CommandBuilder andArriveAtIntermediatePoint(String name){
return alt(prepareStruct(C_AND_ARRIVE_INTERMEDIATE, name), prepareStruct(C_AND_ARRIVE_INTERMEDIATE));
}
public CommandBuilder arrivedAtIntermediatePoint(String name) {
return alt(prepareStruct(C_REACHED_INTERMEDIATE, name), prepareStruct(C_REACHED_INTERMEDIATE));
}
public CommandBuilder andArriveAtIntermediatePoint(String name){
return alt(prepareStruct(C_AND_ARRIVE_INTERMEDIATE, name), prepareStruct(C_AND_ARRIVE_INTERMEDIATE));
public CommandBuilder andArriveAtWayPoint(String name){
return addCommand(C_AND_ARRIVE_WAYPOINT, name);
}
public CommandBuilder arrivedAtWayPoint(String name) {
return addCommand(C_REACHED_WAYPOINT, name);
}
public CommandBuilder andArriveAtFavorite(String name) {
return addCommand(C_AND_ARRIVE_FAVORITE, name);
}
public CommandBuilder arrivedAtFavorite(String name) {
return addCommand(C_REACHED_FAVORITE, name);
}
public CommandBuilder andArriveAtPoiWaypoint(String name) {
return addCommand(C_AND_ARRIVE_POI_WAYPOINT, name);
}
public CommandBuilder arrivedAtPoi(String name) {
return addCommand(C_REACHED_POI, name);
}
@ -242,16 +254,4 @@ public class CommandBuilder {
alreadyExecuted = true;
return this.commandPlayer.execute(listStruct);
}
public CommandBuilder andArriveAtWayPoint(String name){
return addCommand(C_AND_ARRIVE_WAYPOINT, name);
}
public CommandBuilder andArriveAtPoiWaypoint(String name) {
return addCommand(C_AND_ARRIVE_POI_WAYPOINT, name);
}
public CommandBuilder andArriveAtFavorite(String name) {
return addCommand(C_AND_ARRIVE_FAVORITE, name);
}
}