From 4581380113a7edf67936a0d567fc469de709e508 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Wed, 26 May 2021 02:19:11 +0200 Subject: Adjust code style --- src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/main/java/org') 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()); -- cgit v1.2.3