diff options
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/Server.java | 2 | ||||
-rw-r--r-- | src/org/traccar/protocol/t55/T55ProtocolDecoder.java | 2 | ||||
-rw-r--r-- | src/org/traccar/protocol/xexun2/Xexun2ProtocolDecoder.java | 9 |
3 files changed, 8 insertions, 5 deletions
diff --git a/src/org/traccar/Server.java b/src/org/traccar/Server.java index c7d52337e..83e18a537 100644 --- a/src/org/traccar/Server.java +++ b/src/org/traccar/Server.java @@ -524,7 +524,7 @@ public class Server implements DataManager { if (serverCreator.isLoggerEnabled()) { pipeline.addLast("logger", new LoggingHandler("logger")); } - byte delimiter[] = { (byte) '\r', (byte) '\n' }; + byte delimiter[] = { (byte) '\n' }; // tracker bug \n\r pipeline.addLast("frameDecoder", new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); diff --git a/src/org/traccar/protocol/t55/T55ProtocolDecoder.java b/src/org/traccar/protocol/t55/T55ProtocolDecoder.java index 08c5e6447..8247b9fd4 100644 --- a/src/org/traccar/protocol/t55/T55ProtocolDecoder.java +++ b/src/org/traccar/protocol/t55/T55ProtocolDecoder.java @@ -119,7 +119,6 @@ public class T55ProtocolDecoder extends OneToOneDecoder { time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++))); time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); index += 1; // Skip milliseconds - position.setTime(time.getTime()); // Validity position.setValid(parser.group(index++).compareTo("A") == 0 ? true : false); @@ -156,6 +155,7 @@ public class T55ProtocolDecoder extends OneToOneDecoder { time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); + position.setTime(time.getTime()); // Altitude position.setAltitude(0.0); diff --git a/src/org/traccar/protocol/xexun2/Xexun2ProtocolDecoder.java b/src/org/traccar/protocol/xexun2/Xexun2ProtocolDecoder.java index 8f1b53328..8f9fb7535 100644 --- a/src/org/traccar/protocol/xexun2/Xexun2ProtocolDecoder.java +++ b/src/org/traccar/protocol/xexun2/Xexun2ProtocolDecoder.java @@ -59,6 +59,7 @@ public class Xexun2ProtocolDecoder extends OneToOneDecoder { * Regular expressions pattern */ static private Pattern pattern = Pattern.compile( + "[\r\n]*" + "\\d+," + "\\+\\d+," + "GPRMC," + @@ -72,11 +73,12 @@ public class Xexun2ProtocolDecoder extends OneToOneDecoder { "(\\d+.\\d+)?," + // Course "(\\d{2})(\\d{2})(\\d{2})," + // Date (DDMMYY) ".*imei:" + - "([\\d]+)," + // IMEI + "(\\d+)," + // IMEI "\\d+," + "\\d+.\\d+," + "F:(\\d+.\\d+)V," + // Power - ".*"); + ".*" + + "[\r\n]*"); /** * Decode message @@ -89,7 +91,8 @@ public class Xexun2ProtocolDecoder extends OneToOneDecoder { String sentence = (String) msg; Matcher parser = pattern.matcher(sentence); if (!parser.matches()) { - throw new ParseException(null, 0); + //throw new ParseException(null, 0); + return null; } // Create new position |