aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
index 40b05cbab..335dcd796 100644
--- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
@@ -44,6 +44,7 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
}
public static final int MSG_GENERAL_RESPONSE = 0x8001;
+ public static final int MSG_GENERAL_RESPONSE_2 = 0x4401;
public static final int MSG_TERMINAL_REGISTER = 0x0100;
public static final int MSG_TERMINAL_REGISTER_RESPONSE = 0x8100;
public static final int MSG_TERMINAL_CONTROL = 0x8105;
@@ -82,6 +83,17 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
}
}
+ private void sendGeneralResponse2(
+ Channel channel, SocketAddress remoteAddress, ByteBuf id, int index) {
+ if (channel != null) {
+ ByteBuf response = Unpooled.buffer();
+ response.writeShort(index);
+ response.writeByte(RESULT_SUCCESS);
+ channel.writeAndFlush(new NetworkMessage(
+ formatMessage(MSG_GENERAL_RESPONSE_2, id, response), remoteAddress));
+ }
+ }
+
private String decodeAlarm(long value) {
if (BitUtil.check(value, 0)) {
return Position.ALARM_SOS;
@@ -123,7 +135,7 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // start marker
int type = buf.readUnsignedShort();
- buf.readUnsignedShort(); // body length
+ int attribute = buf.readUnsignedShort();
ByteBuf id = buf.readSlice(6); // phone number
int index;
if (type == MSG_LOCATION_REPORT_2 || type == MSG_LOCATION_REPORT_BLIND) {
@@ -162,6 +174,10 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
} else if (type == MSG_LOCATION_REPORT_2 || type == MSG_LOCATION_REPORT_BLIND) {
+ if (BitUtil.check(attribute, 15)) {
+ sendGeneralResponse2(channel, remoteAddress, id, index);
+ }
+
return decodeLocation2(deviceSession, buf, type);
} else if (type == MSG_LOCATION_BATCH) {