From 26a22bfb11e7e71ce06628ee397eb06b2a66d231 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 24 Nov 2018 10:07:50 +1300 Subject: Handle positive coordinates sign --- src/org/traccar/protocol/C2stekProtocolDecoder.java | 4 ++-- test/org/traccar/protocol/C2stekProtocolDecoderTest.java | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/org/traccar/protocol/C2stekProtocolDecoder.java b/src/org/traccar/protocol/C2stekProtocolDecoder.java index fd99990ce..6a31cb2f4 100644 --- a/src/org/traccar/protocol/C2stekProtocolDecoder.java +++ b/src/org/traccar/protocol/C2stekProtocolDecoder.java @@ -42,8 +42,8 @@ public class C2stekProtocolDecoder extends BaseProtocolDecoder { .number("(dd)(dd)(dd)#") // date (yymmdd) .number("(dd)(dd)(dd)#") // time (hhmmss) .number("([01])#") // valid - .number("(-?d+.d+)#") // latitude - .number("(-?d+.d+)#") // longitude + .number("([+-]?d+.d+)#") // latitude + .number("([+-]?d+.d+)#") // longitude .number("(d+.d+)#") // speed .number("(d+.d+)#") // course .number("(-?d+.d+)#") // altitude diff --git a/test/org/traccar/protocol/C2stekProtocolDecoderTest.java b/test/org/traccar/protocol/C2stekProtocolDecoderTest.java index 0a5690f76..9f841fb8c 100644 --- a/test/org/traccar/protocol/C2stekProtocolDecoderTest.java +++ b/test/org/traccar/protocol/C2stekProtocolDecoderTest.java @@ -10,6 +10,9 @@ public class C2stekProtocolDecoderTest extends ProtocolTest { C2stekProtocolDecoder decoder = new C2stekProtocolDecoder(null); + verifyNull(decoder, text( + "PA$863083038046613$D#181123#162850#1#+37.92684#+23.75933#0.62#200.1#0.0#3768#000#9#00#sz-w1001#B0907839$AP")); + verifyPosition(decoder, text( "PA$353990030327618$D#091117#020928#1#22.537222#114.020948#0.00#0.0#42.1#4183#011#1#101#Wsz-wl001#B0101940#C+3.0,-5.0,+2.0$AP")); -- cgit v1.2.3