aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/HuaShengProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-07-26 01:39:50 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-07-26 01:39:50 +1200
commit2c48057bd628c523fbfad0559b3a1627daa46e47 (patch)
treea4e3c8d2233607e91249851fb6a3096af6425585 /src/org/traccar/protocol/HuaShengProtocolDecoder.java
parent4064f864e20d3d40025a94e10cf56084d2c78287 (diff)
downloadtrackermap-server-2c48057bd628c523fbfad0559b3a1627daa46e47.tar.gz
trackermap-server-2c48057bd628c523fbfad0559b3a1627daa46e47.tar.bz2
trackermap-server-2c48057bd628c523fbfad0559b3a1627daa46e47.zip
Fix HuaSheng decoder response
Diffstat (limited to 'src/org/traccar/protocol/HuaShengProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/HuaShengProtocolDecoder.java10
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;