From f35567956593f78f3f9630add815710b9df47634 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 6 May 2017 09:44:27 +1200 Subject: Fix PT502 coordinates decoding --- src/org/traccar/protocol/Pt502ProtocolDecoder.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/protocol/Pt502ProtocolDecoder.java b/src/org/traccar/protocol/Pt502ProtocolDecoder.java index eb86f01ff..b1851f8ca 100644 --- a/src/org/traccar/protocol/Pt502ProtocolDecoder.java +++ b/src/org/traccar/protocol/Pt502ProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 - 2016 Anton Tananaev (anton@traccar.org) + * Copyright 2012 - 2017 Anton Tananaev (anton@traccar.org) * Copyright 2012 Luis Parada (luis.parada@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -43,9 +43,9 @@ public class Pt502ProtocolDecoder extends BaseProtocolDecoder { .number("(d+),") // id .number("(dd)(dd)(dd).(ddd),") // time (hhmmss.sss) .expression("([AV]),") // validity - .number("(dd)(dd.dddd),") // latitude + .number("(d+)(dd.dddd),") // latitude .expression("([NS]),") - .number("(ddd)(dd.dddd),") // longitude + .number("(d+)(dd.dddd),") // longitude .expression("([EW]),") .number("(d+.d+)?,") // speed .number("(d+.d+)?,") // course @@ -83,9 +83,7 @@ public class Pt502ProtocolDecoder extends BaseProtocolDecoder { protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { - String sentence = (String) msg; - - Parser parser = new Parser(PATTERN, sentence); + Parser parser = new Parser(PATTERN, (String) msg); if (!parser.matches()) { return null; } -- cgit v1.2.3