From 500d7361f023c15bd06cbe2836c5af1d12285583 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 18 Jan 2018 01:06:42 +1300 Subject: Add location to Galileo responses --- src/org/traccar/protocol/GalileoProtocolDecoder.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') 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) { -- cgit v1.2.3