aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/EgtsProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-05-10 19:06:13 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2018-05-10 19:06:13 -0700
commita97c12829e99b63f1951bffc658c37ec180e5379 (patch)
tree53854a69be66633701e8a64f8ec30174815d3291 /src/org/traccar/protocol/EgtsProtocolDecoder.java
parentecbb40a86bb32005a734fd2da33890f4fd076901 (diff)
downloadtrackermap-server-a97c12829e99b63f1951bffc658c37ec180e5379.tar.gz
trackermap-server-a97c12829e99b63f1951bffc658c37ec180e5379.tar.bz2
trackermap-server-a97c12829e99b63f1951bffc658c37ec180e5379.zip
Fix EGTS auth response
Diffstat (limited to 'src/org/traccar/protocol/EgtsProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/EgtsProtocolDecoder.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/EgtsProtocolDecoder.java b/src/org/traccar/protocol/EgtsProtocolDecoder.java
index 420701e6c..6ac7af440 100644
--- a/src/org/traccar/protocol/EgtsProtocolDecoder.java
+++ b/src/org/traccar/protocol/EgtsProtocolDecoder.java
@@ -81,9 +81,13 @@ public class EgtsProtocolDecoder extends BaseProtocolDecoder {
data.writeBytes(content);
ChannelBuffer record = ChannelBuffers.dynamicBuffer(ByteOrder.LITTLE_ENDIAN, 0);
+ if (packetType == PT_RESPONSE) {
+ record.writeShort(index);
+ record.writeByte(0); // success
+ }
record.writeShort(data.readableBytes());
- record.writeShort(index);
- record.writeByte(1 << 6); // flags
+ record.writeShort(0);
+ record.writeByte(0); // flags (possibly 1 << 6)
record.writeByte(serviceType);
record.writeByte(serviceType);
record.writeBytes(data);
@@ -113,6 +117,7 @@ public class EgtsProtocolDecoder extends BaseProtocolDecoder {
ChannelBuffer buf = (ChannelBuffer) msg;
+ int index = buf.getUnsignedShort(buf.readerIndex() + 5 + 2);
buf.skipBytes(buf.getUnsignedByte(buf.readerIndex() + 3));
List<Position> positions = new LinkedList<>();
@@ -120,7 +125,7 @@ public class EgtsProtocolDecoder extends BaseProtocolDecoder {
while (buf.readableBytes() > 2) {
int length = buf.readUnsignedShort();
- int index = buf.readUnsignedShort();
+ int recordIndex = buf.readUnsignedShort();
int recordFlags = buf.readUnsignedByte();
if (BitUtil.check(recordFlags, 0)) {
@@ -146,7 +151,7 @@ public class EgtsProtocolDecoder extends BaseProtocolDecoder {
}
ChannelBuffer response = ChannelBuffers.dynamicBuffer(ByteOrder.LITTLE_ENDIAN, 0);
- response.writeShort(index);
+ response.writeShort(recordIndex);
response.writeByte(0); // success
sendResponse(channel, PT_RESPONSE, index, serviceType, MSG_RECORD_RESPONSE, response);
@@ -186,7 +191,7 @@ public class EgtsProtocolDecoder extends BaseProtocolDecoder {
response = ChannelBuffers.dynamicBuffer(ByteOrder.LITTLE_ENDIAN, 0);
response.writeByte(0); // success
- sendResponse(channel, PT_APPDATA, index, serviceType, MSG_RESULT_CODE, response);
+ sendResponse(channel, PT_APPDATA, 0, serviceType, MSG_RESULT_CODE, response);
} else if (type == MSG_POS_DATA) {