aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-11-30 21:23:46 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2021-11-30 21:23:46 -0800
commit97bca437b8e92d69a71e753d969a758064f7ddbd (patch)
tree3dc02be0d20a17495cef9ce5b3970b3e7b9979b0 /src/main/java
parent9bb414a077ec263de5bc89948c3c104d46c968e9 (diff)
downloadtrackermap-server-97bca437b8e92d69a71e753d969a758064f7ddbd.tar.gz
trackermap-server-97bca437b8e92d69a71e753d969a758064f7ddbd.tar.bz2
trackermap-server-97bca437b8e92d69a71e753d969a758064f7ddbd.zip
Support JT701D acknowledgement
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java
index 37c1674d4..dc4bd3486 100644
--- a/src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java
@@ -141,6 +141,8 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
int version = BitUtil.from(buf.readUnsignedByte(), 4);
buf.readUnsignedShort(); // length
+ boolean responseRequired = false;
+
while (buf.readableBytes() > 1) {
Position position = new Position(getProtocolName());
@@ -160,6 +162,9 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_ALARM, BitUtil.check(status, 2) ? Position.ALARM_GEOFENCE_EXIT : null);
position.set(Position.KEY_ALARM, BitUtil.check(status, 3) ? Position.ALARM_POWER_CUT : null);
position.set(Position.KEY_ALARM, BitUtil.check(status, 4) ? Position.ALARM_VIBRATION : null);
+ if (BitUtil.check(status, 5)) {
+ responseRequired = true;
+ }
position.set(Position.KEY_BLOCKED, BitUtil.check(status, 7));
position.set(Position.KEY_ALARM, BitUtil.check(status, 8 + 3) ? Position.ALARM_LOW_BATTERY : null);
position.set(Position.KEY_ALARM, BitUtil.check(status, 8 + 6) ? Position.ALARM_FAULT : null);
@@ -232,7 +237,15 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
}
- buf.readUnsignedByte(); // index
+ int index = buf.readUnsignedByte();
+
+ if (channel != null && responseRequired) {
+ if (protocolVersion < 0x19) {
+ channel.writeAndFlush(new NetworkMessage("(P35)", remoteAddress));
+ } else {
+ channel.writeAndFlush(new NetworkMessage("(P69,0," + index + ")", remoteAddress));
+ }
+ }
return positions;
}