Merge pull request #2608 from osmandapp/testing_hardy
speedAlarm: pass maxSpeed and speed
This commit is contained in:
commit
769cd136b0
4 changed files with 12 additions and 11 deletions
|
@ -199,7 +199,7 @@ public class TestVoiceActivity extends OsmandActionBarActivity {
|
||||||
addButton(ll, "Passing favorite 'Brewery'", builder(p).arrivedAtFavorite("Brewery"));
|
addButton(ll, "Passing favorite 'Brewery'", builder(p).arrivedAtFavorite("Brewery"));
|
||||||
addButton(ll, "Passing POI 'Museum'", builder(p).arrivedAtPoi("Museum"));
|
addButton(ll, "Passing POI 'Museum'", builder(p).arrivedAtPoi("Museum"));
|
||||||
|
|
||||||
addButton(ll, "You are exceeding the speed limit", builder(p).speedAlarm());
|
addButton(ll, "You are exceeding the speed limit", builder(p).speedAlarm(50, 65f));
|
||||||
addButton(ll, "Attention, speed camera", builder(p).attention("SPEED_CAMERA"));
|
addButton(ll, "Attention, speed camera", builder(p).attention("SPEED_CAMERA"));
|
||||||
addButton(ll, "Attention, border control", builder(p).attention("BORDER_CONTROL"));
|
addButton(ll, "Attention, border control", builder(p).attention("BORDER_CONTROL"));
|
||||||
addButton(ll, "Attention, railroad crossing", builder(p).attention("RAILWAY"));
|
addButton(ll, "Attention, railroad crossing", builder(p).attention("RAILWAY"));
|
||||||
|
|
|
@ -170,7 +170,7 @@ public class WaypointHelper {
|
||||||
float delta = app.getSettings().SPEED_LIMIT_EXCEED.get() / 3.6f;
|
float delta = app.getSettings().SPEED_LIMIT_EXCEED.get() / 3.6f;
|
||||||
AlarmInfo speedAlarm = createSpeedAlarm(mc, mxspeed, lastProjection, delta);
|
AlarmInfo speedAlarm = createSpeedAlarm(mc, mxspeed, lastProjection, delta);
|
||||||
if (speedAlarm != null) {
|
if (speedAlarm != null) {
|
||||||
getVoiceRouter().announceSpeedAlarm();
|
getVoiceRouter().announceSpeedAlarm(speedAlarm.getIntValue(), lastProjection.getSpeed());
|
||||||
}
|
}
|
||||||
AlarmInfo mostImportant = speedAlarm;
|
AlarmInfo mostImportant = speedAlarm;
|
||||||
int value = speedAlarm != null ? speedAlarm.updateDistanceAndGetPriority(0, 0) : Integer.MAX_VALUE;
|
int value = speedAlarm != null ? speedAlarm.updateDistanceAndGetPriority(0, 0) : Integer.MAX_VALUE;
|
||||||
|
@ -271,7 +271,7 @@ public class WaypointHelper {
|
||||||
float delta = app.getSettings().SPEED_LIMIT_EXCEED.get() / 3.6f;
|
float delta = app.getSettings().SPEED_LIMIT_EXCEED.get() / 3.6f;
|
||||||
AlarmInfo speedAlarm = createSpeedAlarm(mc, mxspeed, loc, delta);
|
AlarmInfo speedAlarm = createSpeedAlarm(mc, mxspeed, loc, delta);
|
||||||
if (speedAlarm != null) {
|
if (speedAlarm != null) {
|
||||||
getVoiceRouter().announceSpeedAlarm();
|
getVoiceRouter().announceSpeedAlarm(speedAlarm.getIntValue(), loc.getSpeed());
|
||||||
return speedAlarm;
|
return speedAlarm;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < ro.getPointsLength(); i++) {
|
for (int i = 0; i < ro.getPointsLength(); i++) {
|
||||||
|
@ -286,7 +286,7 @@ public class WaypointHelper {
|
||||||
long ms = System.currentTimeMillis();
|
long ms = System.currentTimeMillis();
|
||||||
if (ms - announcedAlarmTime > 50 * 1000) {
|
if (ms - announcedAlarmTime > 50 * 1000) {
|
||||||
announcedAlarmTime = ms;
|
announcedAlarmTime = ms;
|
||||||
getVoiceRouter().announceAlarm(info.getType());
|
getVoiceRouter().announceAlarm(info, loc.getSpeed());
|
||||||
}
|
}
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
@ -381,7 +381,7 @@ public class WaypointHelper {
|
||||||
ait.add(((AlarmInfo) pw.point).getType());
|
ait.add(((AlarmInfo) pw.point).getType());
|
||||||
}
|
}
|
||||||
for (AlarmInfoType t : ait) {
|
for (AlarmInfoType t : ait) {
|
||||||
app.getRoutingHelper().getVoiceRouter().announceAlarm(t);
|
app.getRoutingHelper().getVoiceRouter().announceAlarm(new AlarmInfo(t, -1), lastKnownLocation.getSpeed());
|
||||||
}
|
}
|
||||||
} else if (type == FAVORITES) {
|
} else if (type == FAVORITES) {
|
||||||
getVoiceRouter().approachFavorite(lastKnownLocation, approachPoints);
|
getVoiceRouter().approachFavorite(lastKnownLocation, approachPoints);
|
||||||
|
|
|
@ -329,9 +329,10 @@ public class VoiceRouter {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void announceAlarm(AlarmInfoType type) {
|
public void announceAlarm(AlarmInfo info, float speed) {
|
||||||
|
AlarmInfoType type = info.getType();
|
||||||
if (type == AlarmInfoType.SPEED_LIMIT) {
|
if (type == AlarmInfoType.SPEED_LIMIT) {
|
||||||
announceSpeedAlarm();
|
announceSpeedAlarm(info.getIntValue(), speed);
|
||||||
} else if (type == AlarmInfoType.SPEED_CAMERA) {
|
} else if (type == AlarmInfoType.SPEED_CAMERA) {
|
||||||
if (router.getSettings().SPEAK_SPEED_CAMERA.get()) {
|
if (router.getSettings().SPEAK_SPEED_CAMERA.get()) {
|
||||||
CommandBuilder p = getNewCommandPlayerToPlay();
|
CommandBuilder p = getNewCommandPlayerToPlay();
|
||||||
|
@ -363,7 +364,7 @@ public class VoiceRouter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void announceSpeedAlarm() {
|
public void announceSpeedAlarm(int maxSpeed, float speed) {
|
||||||
long ms = System.currentTimeMillis();
|
long ms = System.currentTimeMillis();
|
||||||
if (waitAnnouncedSpeedLimit == 0) {
|
if (waitAnnouncedSpeedLimit == 0) {
|
||||||
// wait 10 seconds before announcement
|
// wait 10 seconds before announcement
|
||||||
|
@ -380,7 +381,7 @@ public class VoiceRouter {
|
||||||
notifyOnVoiceMessage();
|
notifyOnVoiceMessage();
|
||||||
lastAnnouncedSpeedLimit = ms;
|
lastAnnouncedSpeedLimit = ms;
|
||||||
waitAnnouncedSpeedLimit = 0;
|
waitAnnouncedSpeedLimit = 0;
|
||||||
p.speedAlarm().play();
|
p.speedAlarm(maxSpeed, speed).play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,8 +130,8 @@ public class CommandBuilder {
|
||||||
return alt(prepareStruct(C_MAKE_UT, streetName), prepareStruct(C_MAKE_UT));
|
return alt(prepareStruct(C_MAKE_UT, streetName), prepareStruct(C_MAKE_UT));
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommandBuilder speedAlarm(){
|
public CommandBuilder speedAlarm(int maxSpeed, float speed){
|
||||||
return addCommand(C_SPEAD_ALARM);
|
return addCommand(C_SPEAD_ALARM, maxSpeed, speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommandBuilder attention(String type){
|
public CommandBuilder attention(String type){
|
||||||
|
|
Loading…
Reference in a new issue