aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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) {