aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
index 5ebc721dd..a502755fd 100644
--- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
@@ -47,6 +47,7 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
public static final int MSG_TERMINAL_CONTROL = 0x8105;
public static final int MSG_TERMINAL_AUTH = 0x0102;
public static final int MSG_LOCATION_REPORT = 0x0200;
+ public static final int MSG_LOCATION_REPORT_2 = 0x5501;
public static final int MSG_LOCATION_BATCH = 0x0704;
public static final int MSG_OIL_CONTROL = 0XA006;
@@ -117,7 +118,12 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
int type = buf.readUnsignedShort();
buf.readUnsignedShort(); // body length
ByteBuf id = buf.readSlice(6); // phone number
- int index = buf.readUnsignedShort();
+ int index;
+ if (type == MSG_LOCATION_REPORT_2) {
+ index = buf.readUnsignedByte();
+ } else {
+ index = buf.readUnsignedShort();
+ }
DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, ByteBufUtil.hexDump(id));
if (deviceSession == null) {
@@ -147,6 +153,10 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
return decodeLocation(deviceSession, buf);
+ } else if (type == MSG_LOCATION_REPORT_2) {
+
+ return decodeLocation2(deviceSession, buf);
+
} else if (type == MSG_LOCATION_BATCH) {
return decodeLocationBatch(deviceSession, buf);
@@ -279,6 +289,16 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
return position;
}
+ private Position decodeLocation2(DeviceSession deviceSession, ByteBuf buf) {
+
+ Position position = new Position(getProtocolName());
+ position.setDeviceId(deviceSession.getDeviceId());
+
+ Jt600ProtocolDecoder.decodeBinaryLocation(buf, position);
+
+ return position;
+ }
+
private List<Position> decodeLocationBatch(DeviceSession deviceSession, ByteBuf buf) {
List<Position> positions = new LinkedList<>();