aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java
diff options
context:
space:
mode:
authorYuriy Piskarev <yuriy.piskarev@gmail.com>2023-08-24 14:16:17 +0300
committerGitHub <noreply@github.com>2023-08-24 14:16:17 +0300
commitae406c7b49a72de24d81fd74386d9638342c90ee (patch)
tree6fbcf557375b98e926c78af9c757e62c79d72a1b /src/main/java/org/traccar/protocol/T800xProtocolDecoder.java
parent56ff656c908b19feb2fa3dcffa48cc3bcdfe9b3b (diff)
parent9aeedc90da24848ff97227d6f281eb4d1e1506ef (diff)
downloadtrackermap-server-ae406c7b49a72de24d81fd74386d9638342c90ee.tar.gz
trackermap-server-ae406c7b49a72de24d81fd74386d9638342c90ee.tar.bz2
trackermap-server-ae406c7b49a72de24d81fd74386d9638342c90ee.zip
Merge branch 'traccar:master' into master
Diffstat (limited to 'src/main/java/org/traccar/protocol/T800xProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/T800xProtocolDecoder.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java b/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java
index d554c2999..4ddea730c 100644
--- a/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2021 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2023 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.
@@ -20,7 +20,9 @@ import io.netty.buffer.ByteBufUtil;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
-import org.traccar.DeviceSession;
+import org.traccar.config.Keys;
+import org.traccar.helper.model.AttributeUtil;
+import org.traccar.session.DeviceSession;
import org.traccar.NetworkMessage;
import org.traccar.Protocol;
import org.traccar.helper.BcdUtil;
@@ -58,6 +60,7 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
public static final int MSG_DRIVER_BEHAVIOR_1 = 0x05; // 0x2626
public static final int MSG_DRIVER_BEHAVIOR_2 = 0x06; // 0x2626
public static final int MSG_BLE = 0x10;
+ public static final int MSG_NETWORK_2 = 0x11;
public static final int MSG_GPS_2 = 0x13;
public static final int MSG_ALARM_2 = 0x14;
public static final int MSG_COMMAND = 0x81;
@@ -167,7 +170,7 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
return decodePosition(channel, deviceSession, buf, type, index, imei);
- } else if (type == MSG_NETWORK && header == 0x2727) {
+ } else if (type == MSG_NETWORK && header == 0x2727 || type == MSG_NETWORK_2) {
Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
@@ -397,6 +400,7 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
int alarm = buf.readUnsignedByte();
position.set(Position.KEY_ALARM, header != 0x2727 ? decodeAlarm1(alarm) : decodeAlarm2(alarm));
+ position.set("alarmCode", alarm);
if (header != 0x2727) {
@@ -467,6 +471,7 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
int inputStatus = buf.readUnsignedShort();
position.set(Position.KEY_IGNITION, BitUtil.check(inputStatus, 2));
position.set(Position.KEY_RSSI, BitUtil.between(inputStatus, 4, 11));
+ position.set(Position.KEY_INPUT, inputStatus);
buf.readUnsignedShort(); // ignition on upload interval
buf.readUnsignedInt(); // ignition off upload interval
@@ -510,7 +515,9 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
}
}
- if (type == MSG_ALARM || type == MSG_ALARM_2) {
+ boolean acknowledgement = AttributeUtil.lookup(
+ getCacheManager(), Keys.PROTOCOL_ACK.withPrefix(getProtocolName()), deviceSession.getDeviceId());
+ if (acknowledgement || type == MSG_ALARM || type == MSG_ALARM_2) {
sendResponse(channel, header, type, index, imei, alarm);
}