From 88cce4463160d31923d3be2ad893a436a8aef8cf Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 9 Jan 2015 10:00:50 +1300 Subject: Suntech decoder new format --- src/org/traccar/protocol/SuntechProtocolDecoder.java | 5 +++-- test/org/traccar/protocol/SuntechProtocolDecoderTest.java | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/org/traccar/protocol/SuntechProtocolDecoder.java b/src/org/traccar/protocol/SuntechProtocolDecoder.java index 868425e8d..cdfca7905 100644 --- a/src/org/traccar/protocol/SuntechProtocolDecoder.java +++ b/src/org/traccar/protocol/SuntechProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2013 - 2015 Anton Tananaev (anton.tananaev@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,8 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { static private Pattern pattern = Pattern.compile( "S.\\d{3}(?:\\w{3})?;" + // Header "(?:[^;]+;)?" + - "(\\d{6});" + // Device ID + "(\\d{6,});" + // Device ID + "(?:\\d+;)?" + "(\\d+);" + // Version "(\\d{4})(\\d{2})(\\d{2});" + // Date (YYYYMMDD) "(\\d{2}):(\\d{2}):(\\d{2});" + // Time (HH:MM:SS) diff --git a/test/org/traccar/protocol/SuntechProtocolDecoderTest.java b/test/org/traccar/protocol/SuntechProtocolDecoderTest.java index f021ccdf3..f3a18f70a 100644 --- a/test/org/traccar/protocol/SuntechProtocolDecoderTest.java +++ b/test/org/traccar/protocol/SuntechProtocolDecoderTest.java @@ -41,6 +41,9 @@ public class SuntechProtocolDecoderTest { verify(decoder.decode(null, null, "ST910;Location;344506;017;20130727;14:10:00;-25.398714;-049.296818;000.187;000.00;1;4.32;1;1;0001")); + verify(decoder.decode(null, null, + "ST300STT;205027329;03;374;20150108;17:54:42;177b38;-23.566052;-046.477588;000.000;000.00;0;0;0;12.11;000000;1;0312")); + } } -- cgit v1.2.3