aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-01-31 22:53:51 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2020-01-31 22:53:51 -0800
commitfdf16e5ee51cf7537920d04e1fd4bffbdbd5fa42 (patch)
treee1f7c0220ffa91680c672778b57ed0de7cc0a6fe /src/main/java/org/traccar
parentc00fd59ecf8739e47a4f2460bbb4802f4cead1a1 (diff)
downloadtraccar-server-fdf16e5ee51cf7537920d04e1fd4bffbdbd5fa42.tar.gz
traccar-server-fdf16e5ee51cf7537920d04e1fd4bffbdbd5fa42.tar.bz2
traccar-server-fdf16e5ee51cf7537920d04e1fd4bffbdbd5fa42.zip
Respond with original length
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r--src/main/java/org/traccar/protocol/TopinProtocolDecoder.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/main/java/org/traccar/protocol/TopinProtocolDecoder.java b/src/main/java/org/traccar/protocol/TopinProtocolDecoder.java
index ea72b7cb8..0f22bc7fd 100644
--- a/src/main/java/org/traccar/protocol/TopinProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/TopinProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2019 Anton Tananaev (anton@traccar.org)
+ * Copyright 2019 - 2020 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,11 +44,11 @@ public class TopinProtocolDecoder extends BaseProtocolDecoder {
public static final int MSG_WIFI_OFFLINE = 0x17;
public static final int MSG_WIFI = 0x69;
- private void sendResponse(Channel channel, int type, ByteBuf content) {
+ private void sendResponse(Channel channel, int length, int type, ByteBuf content) {
if (channel != null) {
ByteBuf response = Unpooled.buffer();
response.writeShort(0x7878);
- response.writeByte(1 + content.readableBytes());
+ response.writeByte(length);
response.writeByte(type);
response.writeBytes(content);
response.writeByte('\r');
@@ -75,7 +75,7 @@ public class TopinProtocolDecoder extends BaseProtocolDecoder {
deviceSession = getDeviceSession(channel, remoteAddress, imei);
ByteBuf content = Unpooled.buffer();
content.writeByte(deviceSession != null ? 0x01 : 0x44);
- sendResponse(channel, type, content);
+ sendResponse(channel, length, type, content);
return null;
} else {
deviceSession = getDeviceSession(channel, remoteAddress);
@@ -95,7 +95,7 @@ public class TopinProtocolDecoder extends BaseProtocolDecoder {
ByteBuf content = Unpooled.buffer();
content.writeBytes(time);
- sendResponse(channel, type, content);
+ sendResponse(channel, length, type, content);
return position;
@@ -127,7 +127,7 @@ public class TopinProtocolDecoder extends BaseProtocolDecoder {
if (length >= 7) {
content.writeByte(signal);
}
- sendResponse(channel, type, content);
+ sendResponse(channel, length, type, content);
return position;
@@ -160,7 +160,7 @@ public class TopinProtocolDecoder extends BaseProtocolDecoder {
ByteBuf content = Unpooled.buffer();
content.writeBytes(time);
- sendResponse(channel, type, content);
+ sendResponse(channel, length, type, content);
return position;