diff options
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) { |