diff options
author | Anton Tananaev <anton@traccar.org> | 2023-12-29 07:57:17 -0800 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-12-29 07:57:17 -0800 |
commit | 30b74bc637b4f1165e040c23324f3504897d2b97 (patch) | |
tree | d3bde7c95c56242f2f31446244c57a5a038ebe59 /src/main | |
parent | 3b9333bec68898b08894b999b6f95c39e7e21f08 (diff) | |
download | trackermap-server-30b74bc637b4f1165e040c23324f3504897d2b97.tar.gz trackermap-server-30b74bc637b4f1165e040c23324f3504897d2b97.tar.bz2 trackermap-server-30b74bc637b4f1165e040c23324f3504897d2b97.zip |
Decode RST 4G driver id
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/traccar/protocol/RstProtocolDecoder.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/RstProtocolDecoder.java b/src/main/java/org/traccar/protocol/RstProtocolDecoder.java index d53675b7f..2493f0d9f 100644 --- a/src/main/java/org/traccar/protocol/RstProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/RstProtocolDecoder.java @@ -42,7 +42,7 @@ public class RstProtocolDecoder extends BaseProtocolDecoder { .expression("(.{5});") // firmware .number("(d{9});") // serial number .number("(d+);") // index - .number("d+;") // type + .number("(d+);") // type .groupBegin() .number("(dd)-(dd)-(dddd) ") // event date .number("(dd):(dd):(dd);") // event time @@ -69,8 +69,10 @@ public class RstProtocolDecoder extends BaseProtocolDecoder { .number("x{4};") // sensors .number("(xx);") // status 1 .number("(xx);") // status 2 + .expression("(.*)") // additional data .groupEnd("?") .any() + .text("FIM;") .compile(); @Override @@ -87,6 +89,7 @@ public class RstProtocolDecoder extends BaseProtocolDecoder { String firmware = parser.next(); String serial = parser.next(); int index = parser.nextInt(); + int type = parser.nextInt(); if (channel != null) { String response = "RST;A;" + model + ";" + firmware + ";" + serial + ";" + index + ";6;FIM;"; @@ -133,6 +136,11 @@ public class RstProtocolDecoder extends BaseProtocolDecoder { position.set(Position.PREFIX_TEMP + 1, (int) parser.nextHexInt().byteValue()); position.set(Position.KEY_STATUS, (parser.nextHexInt() << 8) + parser.nextHexInt()); + String[] values = parser.next().split(";"); + if (type == 55) { + position.set(Position.KEY_DRIVER_UNIQUE_ID, values[0]); + } + return position; } else { |