diff options
author | ninioe <ninioe@gmail.com> | 2016-08-01 16:12:47 +0300 |
---|---|---|
committer | ninioe <ninioe@gmail.com> | 2016-08-01 16:12:47 +0300 |
commit | 94781fa3ba35e494e309aee19a5e15c14d3193c1 (patch) | |
tree | a1e4a90e9a2fce3db8bc51981aeb8a23cced5e6d /src/org/traccar/protocol/HuaShengProtocolDecoder.java | |
parent | b4841fa0a6293c0b895cf6bb65c6c2d871c78397 (diff) | |
parent | e177e7d083a4dd3f64172802661bf658d26d1163 (diff) | |
download | trackermap-server-94781fa3ba35e494e309aee19a5e15c14d3193c1.tar.gz trackermap-server-94781fa3ba35e494e309aee19a5e15c14d3193c1.tar.bz2 trackermap-server-94781fa3ba35e494e309aee19a5e15c14d3193c1.zip |
Merge remote-tracking branch 'refs/remotes/tananaev/master'
Diffstat (limited to 'src/org/traccar/protocol/HuaShengProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/HuaShengProtocolDecoder.java | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/HuaShengProtocolDecoder.java b/src/org/traccar/protocol/HuaShengProtocolDecoder.java index 6901f37fb..e7c83d3b3 100644 --- a/src/org/traccar/protocol/HuaShengProtocolDecoder.java +++ b/src/org/traccar/protocol/HuaShengProtocolDecoder.java @@ -38,7 +38,7 @@ public class HuaShengProtocolDecoder extends BaseProtocolDecoder { public static final int MSG_LOGIN = 0xAA02; public static final int MSG_LOGIN_RSP = 0xFF03; - private static void sendResponse(Channel channel, int type, ChannelBuffer content) { + private static void sendResponse(Channel channel, int type, int index, ChannelBuffer content) { if (channel != null) { ChannelBuffer response = ChannelBuffers.dynamicBuffer(); response.writeByte(0xC0); @@ -46,7 +46,7 @@ public class HuaShengProtocolDecoder extends BaseProtocolDecoder { response.writeShort(12 + content.readableBytes()); response.writeShort(type); response.writeShort(0); - response.writeInt(1); + response.writeInt(index); response.writeBytes(content); response.writeByte(0xC0); channel.write(response); @@ -80,7 +80,7 @@ public class HuaShengProtocolDecoder extends BaseProtocolDecoder { if (deviceSession != null && channel != null) { ChannelBuffer content = ChannelBuffers.dynamicBuffer(); content.writeByte(0); // success - sendResponse(channel, MSG_LOGIN_RSP, content); + sendResponse(channel, MSG_LOGIN_RSP, index, content); } } else { buf.skipBytes(length); @@ -127,9 +127,7 @@ public class HuaShengProtocolDecoder extends BaseProtocolDecoder { buf.skipBytes(length); } - ChannelBuffer content = ChannelBuffers.dynamicBuffer(); - content.writeInt(index); - sendResponse(channel, MSG_POSITION_RSP, content); + sendResponse(channel, MSG_POSITION_RSP, index, ChannelBuffers.dynamicBuffer()); return position; |