aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-05-05 13:24:52 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-05-05 13:24:52 +1200
commit8f57a25d92d7cc3b738950b8d35058cd64786b1d (patch)
tree2198cabec3210a096596624c8e13e449cde6ec50 /src
parent4577c6f1196d6438bc367828800926451daf525c (diff)
downloadtrackermap-server-8f57a25d92d7cc3b738950b8d35058cd64786b1d.tar.gz
trackermap-server-8f57a25d92d7cc3b738950b8d35058cd64786b1d.tar.bz2
trackermap-server-8f57a25d92d7cc3b738950b8d35058cd64786b1d.zip
Response with matching header
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/protocol/T800xProtocolDecoder.java9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/T800xProtocolDecoder.java b/src/org/traccar/protocol/T800xProtocolDecoder.java
index a6a647f22..7bc780c83 100644
--- a/src/org/traccar/protocol/T800xProtocolDecoder.java
+++ b/src/org/traccar/protocol/T800xProtocolDecoder.java
@@ -49,11 +49,10 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
return ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, bytes).readFloat();
}
- private void sendResponse(Channel channel, int type, ChannelBuffer imei) {
+ private void sendResponse(Channel channel, short header, int type, ChannelBuffer imei) {
if (channel != null) {
ChannelBuffer response = ChannelBuffers.directBuffer(15);
- response.writeByte(0x23);
- response.writeByte(0x23); // header
+ response.writeShort(header);
response.writeByte(type);
response.writeShort(response.capacity()); // length
response.writeShort(0x0001); // index
@@ -87,7 +86,7 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
ChannelBuffer buf = (ChannelBuffer) msg;
- buf.skipBytes(2);
+ short header = buf.readShort();
int type = buf.readUnsignedByte();
buf.readUnsignedShort(); // length
int index = buf.readUnsignedShort();
@@ -100,7 +99,7 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
}
if (type == MSG_LOGIN || type == MSG_ALARM || type == MSG_HEARTBEAT) {
- sendResponse(channel, type, imei);
+ sendResponse(channel, header, type, imei);
}
if (type == MSG_GPS || type == MSG_ALARM) {