aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-12-12 17:35:48 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2020-12-12 17:35:48 -0800
commit825cafeac2d43dd4410cd1393cbaf62c953fb287 (patch)
treee7768bab2076a9ab06b38f99363e667af7905bb1 /src/main/java/org/traccar/protocol/T800xProtocolDecoder.java
parent3bd12b312914fa046b4732c368ad05538aa4e829 (diff)
downloadtrackermap-server-825cafeac2d43dd4410cd1393cbaf62c953fb287.tar.gz
trackermap-server-825cafeac2d43dd4410cd1393cbaf62c953fb287.tar.bz2
trackermap-server-825cafeac2d43dd4410cd1393cbaf62c953fb287.zip
Support driver id and AD
Diffstat (limited to 'src/main/java/org/traccar/protocol/T800xProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/T800xProtocolDecoder.java34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java b/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java
index 5822d6b8f..bbf52bd5f 100644
--- a/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java
@@ -55,6 +55,7 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
public static final int MSG_HEARTBEAT = 0x03;
public static final int MSG_ALARM = 0x04;
public static final int MSG_NETWORK = 0x05;
+ public static final int MSG_BLE = 0x10;
public static final int MSG_COMMAND = 0x81;
private void sendResponse(Channel channel, short header, int type, int index, ByteBuf imei, int alarm) {
@@ -158,6 +159,10 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
return position;
+ } else if (type == MSG_BLE) {
+
+ return decodeBle(channel, deviceSession, buf, type, index, imei);
+
} else if (type == MSG_COMMAND) {
Position position = new Position(getProtocolName());
@@ -176,6 +181,27 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
return null;
}
+ private Position decodeBle(
+ Channel channel, DeviceSession deviceSession, ByteBuf buf, int type, int index, ByteBuf imei) {
+
+ Position position = new Position(getProtocolName());
+ position.setDeviceId(deviceSession.getDeviceId());
+
+ getLastLocation(position, readDate(buf));
+
+ position.set(Position.KEY_IGNITION, buf.readUnsignedByte() > 0);
+
+ int dataCode = buf.readUnsignedShort();
+
+ if (dataCode == 3) {
+ position.set(Position.KEY_DRIVER_UNIQUE_ID, ByteBufUtil.hexDump(buf.readSlice(6)));
+ }
+
+ sendResponse(channel, header, type, index, imei, 0);
+
+ return position;
+ }
+
private Position decodePosition(
Channel channel, DeviceSession deviceSession, ByteBuf buf, int type, int index, ByteBuf imei) {
@@ -214,8 +240,12 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
}
if (header != 0x2626) {
- position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort());
- position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShort());
+ for (int i = 1; i <= 2; i++) {
+ String value = ByteBufUtil.hexDump(buf.readSlice(2));
+ if (!value.equals("ffff")) {
+ position.set(Position.PREFIX_ADC + i, Integer.parseInt(value) * 0.01);
+ }
+ }
}
}