From b7e24f5f74e658c2431f3a46b4c2cb1e912edfbe Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 17 Feb 2015 09:25:58 +1300 Subject: Add Xexun Glonass support (fix #1082) --- src/org/traccar/protocol/Xexun2ProtocolDecoder.java | 2 +- src/org/traccar/protocol/XexunFrameDecoder.java | 5 ++++- src/org/traccar/protocol/XexunProtocolDecoder.java | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/Xexun2ProtocolDecoder.java b/src/org/traccar/protocol/Xexun2ProtocolDecoder.java index 3a9e1129e..ea2197b31 100644 --- a/src/org/traccar/protocol/Xexun2ProtocolDecoder.java +++ b/src/org/traccar/protocol/Xexun2ProtocolDecoder.java @@ -40,7 +40,7 @@ public class Xexun2ProtocolDecoder extends BaseProtocolDecoder { "[\r\n]*" + "(\\d+)," + // Serial "([^,]+)?," + // Number - "GPRMC," + + "G[PN]RMC," + "(\\d{2})(\\d{2})(\\d{2})\\.(\\d+)," + // Time (HHMMSS.SSS) "([AV])," + // Validity "(\\d{2})(\\d{2}\\.\\d+)," + // Latitude (DDMM.MMMM) diff --git a/src/org/traccar/protocol/XexunFrameDecoder.java b/src/org/traccar/protocol/XexunFrameDecoder.java index 2dd9dad7d..1b3446ff9 100644 --- a/src/org/traccar/protocol/XexunFrameDecoder.java +++ b/src/org/traccar/protocol/XexunFrameDecoder.java @@ -38,7 +38,10 @@ public class XexunFrameDecoder extends FrameDecoder { // Find start Integer beginIndex = ChannelBufferTools.find(buf, 0, length, "GPRMC"); if (beginIndex == null) { - return null; + beginIndex = ChannelBufferTools.find(buf, 0, length, "GNRMC"); + if (beginIndex == null) { + return null; + } } // Find identifier diff --git a/src/org/traccar/protocol/XexunProtocolDecoder.java b/src/org/traccar/protocol/XexunProtocolDecoder.java index 01ce44964..dd9ed0528 100644 --- a/src/org/traccar/protocol/XexunProtocolDecoder.java +++ b/src/org/traccar/protocol/XexunProtocolDecoder.java @@ -38,7 +38,7 @@ public class XexunProtocolDecoder extends BaseProtocolDecoder { } private static final Pattern pattern = Pattern.compile( - "GPRMC," + + "G[PN]RMC," + "(\\d{2})(\\d{2})(\\d{2}).(\\d+)," + // Time (HHMMSS.SSS) "([AV])," + // Validity "(\\d+)(\\d{2}\\.\\d+)," + // Latitude (DDMM.MMMM) -- cgit v1.2.3