diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-03-27 07:15:36 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-03-27 07:15:36 +1300 |
commit | b9b2217b2acd3d3e0a202ea0be59bb88e45a4da8 (patch) | |
tree | 435eff5d3a50607689c9320c8454a253fe0856bf /src/org/traccar/protocol | |
parent | a959b3d754a2bd9e0f8a3b73b01061c88fe46053 (diff) | |
download | traccar-server-b9b2217b2acd3d3e0a202ea0be59bb88e45a4da8.tar.gz traccar-server-b9b2217b2acd3d3e0a202ea0be59bb88e45a4da8.tar.bz2 traccar-server-b9b2217b2acd3d3e0a202ea0be59bb88e45a4da8.zip |
Fix EGTS decoding issues
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r-- | src/org/traccar/protocol/EgtsProtocolDecoder.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/EgtsProtocolDecoder.java b/src/org/traccar/protocol/EgtsProtocolDecoder.java index fe82a51ed..e13f18fed 100644 --- a/src/org/traccar/protocol/EgtsProtocolDecoder.java +++ b/src/org/traccar/protocol/EgtsProtocolDecoder.java @@ -162,10 +162,12 @@ public class EgtsProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedShort(); // home dispatcher identifier } if (BitUtil.check(flags, 1)) { - getDeviceSession(channel, remoteAddress, buf.readBytes(15).toString(StandardCharsets.US_ASCII)); + getDeviceSession( + channel, remoteAddress, buf.readBytes(15).toString(StandardCharsets.US_ASCII).trim()); } if (BitUtil.check(flags, 2)) { - getDeviceSession(channel, remoteAddress, buf.readBytes(16).toString(StandardCharsets.US_ASCII)); + getDeviceSession( + channel, remoteAddress, buf.readBytes(16).toString(StandardCharsets.US_ASCII).trim()); } if (BitUtil.check(flags, 3)) { buf.skipBytes(3); // language identifier @@ -177,7 +179,8 @@ public class EgtsProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedShort(); // buffer size } if (BitUtil.check(flags, 7)) { - getDeviceSession(channel, remoteAddress, buf.readBytes(15).toString(StandardCharsets.US_ASCII)); + getDeviceSession( + channel, remoteAddress, buf.readBytes(15).toString(StandardCharsets.US_ASCII).trim()); } response = ChannelBuffers.dynamicBuffer(ByteOrder.LITTLE_ENDIAN, 0); @@ -241,7 +244,7 @@ public class EgtsProtocolDecoder extends BaseProtocolDecoder { buf.readerIndex(end); } - if (deviceSession != null) { + if (serviceType == SERVICE_TELEDATA && deviceSession != null) { positions.add(position); } } |