aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/EgtsProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/EgtsProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/EgtsProtocolDecoder.java11
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);
}
}