diff options
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r-- | src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java b/src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java index 074523a76..82c616245 100644 --- a/src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java @@ -275,10 +275,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { .or().text(" ") .groupEnd("?").text(",") .number("(d+)?,") // rfid - .groupBegin() // ext accessories - .number("([01])") // charging - .number("(d)?") // belt status - .groupEnd("?") + .number("([01])(d)?").optional() // charge and belt status .expression("[^,]*,") .number("(d+)?,") // battery .expression("([^,]*)[,;]") // alert @@ -360,7 +357,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_DRIVER_UNIQUE_ID, parser.next()); if (parser.hasNext()) { - position.set(Position.KEY_CHARGE, parser.nextInt() == 1); + position.set(Position.KEY_CHARGE, parser.nextInt() > 0); } if (parser.hasNext()) { position.set("belt", parser.nextInt()); |