From db427d338bbd284203badb36b25504c7f152b5ea Mon Sep 17 00:00:00 2001 From: Olivier Girondel Date: Wed, 26 Sep 2018 00:34:51 +0200 Subject: Decode negative latitudes and longitudes (fix #4064) --- src/org/traccar/protocol/GpsmtaProtocolDecoder.java | 6 +++--- test/org/traccar/protocol/GpsmtaProtocolDecoderTest.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/org/traccar/protocol/GpsmtaProtocolDecoder.java b/src/org/traccar/protocol/GpsmtaProtocolDecoder.java index 1d80178cb..a8f74b876 100644 --- a/src/org/traccar/protocol/GpsmtaProtocolDecoder.java +++ b/src/org/traccar/protocol/GpsmtaProtocolDecoder.java @@ -36,8 +36,8 @@ public class GpsmtaProtocolDecoder extends BaseProtocolDecoder { private static final Pattern PATTERN = new PatternBuilder() .expression("([^ ]+) ") // uid .number("(d+) ") // time (unix time) - .number("(d+.d+) ") // latitude - .number("(d+.d+) ") // longitude + .number("-?(d+.d+) ") // latitude + .number("-?(d+.d+) ") // longitude .number("(d+) ") // speed .number("(d+) ") // course .number("(d+) ") // accuracy @@ -45,7 +45,7 @@ public class GpsmtaProtocolDecoder extends BaseProtocolDecoder { .number("(d+) ") // flags .number("(d+) ") // battery .number("(d+) ") // temperature - .number("(d)") // changing status + .number("(d)") // charging status .any() .compile(); diff --git a/test/org/traccar/protocol/GpsmtaProtocolDecoderTest.java b/test/org/traccar/protocol/GpsmtaProtocolDecoderTest.java index 316003757..27922bdbc 100644 --- a/test/org/traccar/protocol/GpsmtaProtocolDecoderTest.java +++ b/test/org/traccar/protocol/GpsmtaProtocolDecoderTest.java @@ -17,7 +17,7 @@ public class GpsmtaProtocolDecoderTest extends ProtocolTest { "864528021249771 1446116686 49.85073 24.004438 0 217 6 338 00 59 27 0 0")); verifyPosition(decoder, text( - "359144048138856 1442932957 49.85064 24.003979 1 0 40 0 10 110 26 0 0")); + "359144048138856 1442932957 -49.85064 -24.003979 1 0 40 0 10 110 26 0 0")); } -- cgit v1.2.3