From 1089b4bd2c9721f88a898c69385ae3fcac4b6cbe Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 29 Jun 2022 19:02:15 -0700 Subject: Fix P61 battery decoding --- src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/main/java/org/traccar/protocol') diff --git a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java index ebd58ed5c..4cb4b420d 100644 --- a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 - 2021 Anton Tananaev (anton@traccar.org) + * Copyright 2012 - 2022 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -360,15 +360,16 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder { .number("d*,") .number("(x{1,2}),") // report type .number("d{1,2},") // count + .number("d*,").optional() // reserved .expression(PATTERN_LOCATION.pattern()) .groupBegin() - .number("(d{1,7}.d)?,").optional() // odometer + .number("(?:(d{1,7}.d)|0)?,").optional() // odometer .number("(d{1,3})?,") // battery .or() .number("(d{1,7}.d)?,") // odometer .groupEnd() .number("(dddd)(dd)(dd)") // date (yyyymmdd) - .number("(dd)(dd)(dd)") // time (hhmmss) + .number("(dd)(dd)(dd)") // time (hhmmss) .text(",") .number("(xxxx)") // count number .text("$").optional() -- cgit v1.2.3