1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-29 13:26:50 +01:00

make use of onSetNavigationInfo() in osmand receiver.

This is not implemented anywhere, purely preparing for further experiments
This commit is contained in:
Andreas Shimokawa 2021-10-20 22:37:57 +02:00
parent 48dee7486f
commit d7e2f1ff8c

View File

@ -24,6 +24,8 @@ import org.slf4j.LoggerFactory;
import java.util.List;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.model.NavigationInfoSpec;
import nodomain.freeyourgadget.gadgetbridge.util.GB;
public class OsmandEventReceiver {
@ -35,6 +37,8 @@ public class OsmandEventReceiver {
private final Application app;
private IOsmAndAidlInterface mIOsmAndAidlInterface;
private NavigationInfoSpec navigationInfoSpec = new NavigationInfoSpec();
private final IOsmAndAidlCallback.Stub mIOsmAndAidlCallback = new IOsmAndAidlCallback.Stub() {
@Override
public void onSearchComplete(List<SearchResult> resultSet) {
@ -54,6 +58,10 @@ public class OsmandEventReceiver {
@Override
public void updateNavigationInfo(ADirectionInfo directionInfo) {
navigationInfoSpec.nextAction = directionInfo.getTurnType();
navigationInfoSpec.distanceToTurn = directionInfo.getDistanceTo();
GBApplication.deviceService().onSetNavigationInfo(navigationInfoSpec);
LOG.error("Distance: " + directionInfo.getDistanceTo() + " turnType: " + directionInfo.getTurnType());
}
@ -64,10 +72,12 @@ public class OsmandEventReceiver {
@Override
public void onVoiceRouterNotify(OnVoiceNavigationParams params) {
List<String> played = params.getPlayed();
for (String play : played) {
LOG.error("played: " + play);
for (String instuction : played) {
navigationInfoSpec.instruction = instuction;
LOG.error("instruction: " + instuction);
// only first one for now
break;
}
}
@Override