aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/BaseProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-13 11:12:18 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-13 11:12:18 +1300
commit43a64fc359f8acf08f97d70ebdb93dafa607dc08 (patch)
tree52da0b19c3da83a57348f603e7dd6467b6717b96 /src/org/traccar/BaseProtocolDecoder.java
parente997c2642b35350241614acaef6d606e37223fe6 (diff)
downloadtrackermap-server-43a64fc359f8acf08f97d70ebdb93dafa607dc08.tar.gz
trackermap-server-43a64fc359f8acf08f97d70ebdb93dafa607dc08.tar.bz2
trackermap-server-43a64fc359f8acf08f97d70ebdb93dafa607dc08.zip
Remove data model and fix some issues
Diffstat (limited to 'src/org/traccar/BaseProtocolDecoder.java')
-rw-r--r--src/org/traccar/BaseProtocolDecoder.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/org/traccar/BaseProtocolDecoder.java b/src/org/traccar/BaseProtocolDecoder.java
index c47c0dc69..f5b549e24 100644
--- a/src/org/traccar/BaseProtocolDecoder.java
+++ b/src/org/traccar/BaseProtocolDecoder.java
@@ -16,9 +16,12 @@
package org.traccar;
import java.net.SocketAddress;
+import java.util.Date;
+
import org.jboss.netty.channel.Channel;
import org.traccar.helper.Log;
import org.traccar.model.Device;
+import org.traccar.model.Position;
public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder {
@@ -71,4 +74,19 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder {
this.protocol = protocol;
}
+ public void initPositionDetails(Position position) {
+ Position last = Context.getConnectionManager().getLastPosition(getDeviceId());
+ if (last != null) {
+ position.setFixTime(last.getFixTime());
+ position.setValid(last.getValid());
+ position.setLatitude(last.getLatitude());
+ position.setLongitude(last.getLongitude());
+ position.setAltitude(last.getAltitude());
+ position.setSpeed(last.getSpeed());
+ position.setCourse(last.getCourse());
+ } else {
+ position.setFixTime(new Date(0));
+ }
+ }
+
}