From 411af91e648433486818f56e713de7278d40cbdb Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 21 Mar 2019 19:14:36 -0700 Subject: Fix message response --- src/org/traccar/protocol/T800xProtocolDecoder.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/protocol/T800xProtocolDecoder.java b/src/org/traccar/protocol/T800xProtocolDecoder.java index 9db5b22f0..5a8ba0751 100644 --- a/src/org/traccar/protocol/T800xProtocolDecoder.java +++ b/src/org/traccar/protocol/T800xProtocolDecoder.java @@ -45,13 +45,13 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder { public static final int MSG_ALARM = 0x04; public static final int MSG_COMMAND = 0x81; - private void sendResponse(Channel channel, short header, int type, ByteBuf imei) { + private void sendResponse(Channel channel, short header, int type, int index, ByteBuf imei) { if (channel != null) { ByteBuf response = Unpooled.buffer(15); response.writeShort(header); response.writeByte(type); response.writeShort(response.capacity()); // length - response.writeShort(0x0001); // index + response.writeShort(index); response.writeBytes(imei); channel.writeAndFlush(new NetworkMessage(response, channel.remoteAddress())); } @@ -94,9 +94,7 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder { return null; } - if (type == MSG_LOGIN || type == MSG_ALARM || type == MSG_HEARTBEAT) { - sendResponse(channel, header, type, imei); - } + sendResponse(channel, header, type, index, imei); if (type == MSG_GPS || type == MSG_ALARM) { -- cgit v1.2.3