diff options
author | Anton Tananaev <anton@traccar.org> | 2024-08-02 07:26:02 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2024-08-02 07:26:02 -0700 |
commit | 0e9ed16b31c3bb17bc76a1f793c013ed5c9c1e21 (patch) | |
tree | b2bf9f377d5a29ba117b8864608897ce22b24363 /src/main/java/org | |
parent | 5606aed5bd84ee5a7748c9e43935b8f39c30008d (diff) | |
download | trackermap-server-0e9ed16b31c3bb17bc76a1f793c013ed5c9c1e21.tar.gz trackermap-server-0e9ed16b31c3bb17bc76a1f793c013ed5c9c1e21.tar.bz2 trackermap-server-0e9ed16b31c3bb17bc76a1f793c013ed5c9c1e21.zip |
Support Megastek MT65Plus (fix #5376)upstream
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java b/src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java index c16a0752d..f8aaeb996 100644 --- a/src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java @@ -257,6 +257,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { .number("(x+)?,") // cid .number("(d+)?,") // gsm .groupBegin() + .number("(ddd),").optional() // heart rate .number("([01]{4})?,") // input .number("([01]{4})?,") // output .number("(d+)?,") // adc1 @@ -277,11 +278,13 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { .number("(-?d+.?d*)") // temperature 2 .or().text(" ") .groupEnd("?").text(",") + .groupBegin() .number("(d+)?,") // rfid .number("([01])(d)?").optional() // charge and belt status .expression("[^,]*,") .number("(d+)?,") // battery .expression("([^,]*)[,;]") // alert + .groupEnd("?") .any() .compile(); @@ -336,7 +339,8 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { } } - if (parser.hasNext(5)) { + if (parser.hasNext(6)) { + position.set(Position.KEY_HEART_RATE, parser.nextInt()); position.set(Position.KEY_INPUT, parser.nextBinInt(0)); position.set(Position.KEY_OUTPUT, parser.nextBinInt(0)); for (int i = 1; i <= 3; i++) { @@ -373,7 +377,9 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_BATTERY, Integer.parseInt(battery)); } - position.set(Position.KEY_ALARM, decodeAlarm(parser.next())); + if (parser.hasNext()) { + position.set(Position.KEY_ALARM, decodeAlarm(parser.next())); + } return position; } |