diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-01-18 01:06:42 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-01-18 10:07:52 +1300 |
commit | 500d7361f023c15bd06cbe2836c5af1d12285583 (patch) | |
tree | debd4ecfce4794e57aa55f6df288fd7c82258e4e /src/org/traccar/protocol/GalileoProtocolDecoder.java | |
parent | a1320c0d021df77f0a73f6663eddd9e286273634 (diff) | |
download | trackermap-server-500d7361f023c15bd06cbe2836c5af1d12285583.tar.gz trackermap-server-500d7361f023c15bd06cbe2836c5af1d12285583.tar.bz2 trackermap-server-500d7361f023c15bd06cbe2836c5af1d12285583.zip |
Add location to Galileo responses
Diffstat (limited to 'src/org/traccar/protocol/GalileoProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/GalileoProtocolDecoder.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/org/traccar/protocol/GalileoProtocolDecoder.java b/src/org/traccar/protocol/GalileoProtocolDecoder.java index 2e997a270..494111e2c 100644 --- a/src/org/traccar/protocol/GalileoProtocolDecoder.java +++ b/src/org/traccar/protocol/GalileoProtocolDecoder.java @@ -253,7 +253,6 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder { while (buf.readerIndex() < length) { - // Check if new message started int tag = buf.readUnsignedByte(); if (tags.contains(tag)) { if (hasLocation && position.getFixTime() != null) { @@ -261,7 +260,7 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder { } tags.clear(); hasLocation = false; - position = new Position(); + position = new Position(); // new position starts } tags.add(tag); @@ -279,13 +278,6 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder { } - if (hasLocation && position.getFixTime() != null) { - positions.add(position); - } else if (position.getAttributes().containsKey(Position.KEY_RESULT)) { - getLastLocation(position, null); - positions.add(position); - } - if (deviceSession == null) { deviceSession = getDeviceSession(channel, remoteAddress); if (deviceSession == null) { @@ -293,6 +285,14 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder { } } + if (hasLocation && position.getFixTime() != null) { + positions.add(position); + } else if (position.getAttributes().containsKey(Position.KEY_RESULT)) { + position.setDeviceId(deviceSession.getDeviceId()); + getLastLocation(position, null); + positions.add(position); + } + sendReply(channel, buf.readUnsignedShort()); for (Position p : positions) { |