From e3a309155a39d97bffe0e781a66070ef9e38a52f Mon Sep 17 00:00:00 2001 From: Abdelrahman Mousa <109462679+sherbinator@users.noreply.github.com> Date: Thu, 5 Oct 2023 22:07:48 +0200 Subject: (Bugfix-T800X Protocol) Fix messages response for 0x2323 --- .../java/org/traccar/protocol/T800xProtocolDecoder.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java b/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java index a1093fc32..3353bc57d 100644 --- a/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java @@ -163,7 +163,12 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder { boolean positionType = type == MSG_GPS || type == MSG_GPS_2 || type == MSG_ALARM || type == MSG_ALARM_2; if (!positionType) { - sendResponse(channel, header, type, index, imei, 0); + + if (header == 0x2323) { + sendResponse(channel, header, type, 0x0001, imei, 0); + } else { + sendResponse(channel, header, type, index, imei, 0); + } } if (positionType) { @@ -518,7 +523,12 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder { 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); + + if (header == 0x2323) { + sendResponse(channel, header, type, 0x0001, imei, alarm); + } else { + sendResponse(channel, header, type, index, imei, alarm); + } } return position; -- cgit v1.2.3 From 47897420cd24c99a74d8b9d84cc289a3f260d3df Mon Sep 17 00:00:00 2001 From: Abdelrahman Mousa <109462679+sherbinator@users.noreply.github.com> Date: Fri, 6 Oct 2023 15:12:44 +0200 Subject: (Refactor-T800X Protocol) messages response for 0x2323 --- .../java/org/traccar/protocol/T800xProtocolDecoder.java | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java b/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java index 3353bc57d..ac1108a64 100644 --- a/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java @@ -163,12 +163,8 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder { boolean positionType = type == MSG_GPS || type == MSG_GPS_2 || type == MSG_ALARM || type == MSG_ALARM_2; if (!positionType) { - - if (header == 0x2323) { - sendResponse(channel, header, type, 0x0001, imei, 0); - } else { - sendResponse(channel, header, type, index, imei, 0); - } + var serial = header == 0x2323 ? 0x0001 : index; + sendResponse(channel, header, type, serial, imei, 0); } if (positionType) { @@ -523,12 +519,8 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder { boolean acknowledgement = AttributeUtil.lookup( getCacheManager(), Keys.PROTOCOL_ACK.withPrefix(getProtocolName()), deviceSession.getDeviceId()); if (acknowledgement || type == MSG_ALARM || type == MSG_ALARM_2) { - - if (header == 0x2323) { - sendResponse(channel, header, type, 0x0001, imei, alarm); - } else { - sendResponse(channel, header, type, index, imei, alarm); - } + var serial = header == 0x2323 ? 0x0001 : index; + sendResponse(channel, header, type, serial, imei, alarm); } return position; -- cgit v1.2.3