From fde6001ce081dad7976a96246b8eca50ed62fa22 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 9 Jul 2015 13:51:51 +1200 Subject: Extend EV603 protocol support --- src/org/traccar/protocol/Ev603ProtocolDecoder.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/protocol/Ev603ProtocolDecoder.java b/src/org/traccar/protocol/Ev603ProtocolDecoder.java index 36a08f394..8686088cb 100644 --- a/src/org/traccar/protocol/Ev603ProtocolDecoder.java +++ b/src/org/traccar/protocol/Ev603ProtocolDecoder.java @@ -34,13 +34,13 @@ public class Ev603ProtocolDecoder extends BaseProtocolDecoder{ } private static final Pattern pattern = Pattern.compile( - "!A," + // Type + "!.," + // Type "(\\d{2})\\/(\\d{2})\\/(\\d{2})," + // Date dd/mm/YY "(\\d{2}):(\\d{2}):(\\d{2})," + // Time hh:mm:ss - "(-?\\d+\\.\\d+)," + // Latitude (DDMM.MMMM) - "(-?\\d+\\.\\d+)," + // Longitude (DDDMM.MMMM) - "(\\d+\\.\\d+)," + // Speed - "(\\d+\\.?\\d+)," + // Course + "(-?\\d+\\.\\d+)," + // Latitude + "(-?\\d+\\.\\d+)," + // Longitude + "(\\d+\\.?\\d*)," + // Speed + "(\\d+\\.?\\d*)," + // Course ".*"); @Override @@ -52,10 +52,11 @@ public class Ev603ProtocolDecoder extends BaseProtocolDecoder{ // Detect device ID if (sentence.startsWith("!1,")) { + identify(sentence.substring(3), channel); - } - else if (sentence.startsWith("!A,")) { + } else { + // Parse message Matcher parser = pattern.matcher(sentence); if (!hasDeviceId() || !parser.matches()) { -- cgit v1.2.3