From 2c49e03702b7a9959eed87b8d5b2ae48c380025d Mon Sep 17 00:00:00 2001 From: Edward Valley Date: Fri, 12 Jul 2019 19:01:01 -0400 Subject: Allow to know if last position was found --- src/main/java/org/traccar/BaseProtocolDecoder.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/traccar/BaseProtocolDecoder.java b/src/main/java/org/traccar/BaseProtocolDecoder.java index aa5be612e..f0642f509 100644 --- a/src/main/java/org/traccar/BaseProtocolDecoder.java +++ b/src/main/java/org/traccar/BaseProtocolDecoder.java @@ -184,7 +184,9 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder { } } - public void getLastLocation(Position position, Date deviceTime) { + public boolean getLastLocation(Position position, Date deviceTime) { + boolean found = false; + if (position.getDeviceId() != 0) { position.setOutdated(true); @@ -198,6 +200,7 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder { position.setSpeed(last.getSpeed()); position.setCourse(last.getCourse()); position.setAccuracy(last.getAccuracy()); + found = true; } else { position.setFixTime(new Date(0)); } @@ -208,6 +211,8 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder { position.setDeviceTime(new Date()); } } + + return found; } @Override -- cgit v1.2.3