aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-03-08 11:17:50 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-03-08 11:17:50 +1300
commit1d3a0b49ead6f0836583cf5e97948c6a86bb8663 (patch)
treefbb983064bfdc9b80afee30acecac8969e2b6f28
parentb8d2578c5448bc760a91c80793ff4141a974324f (diff)
downloadtrackermap-server-1d3a0b49ead6f0836583cf5e97948c6a86bb8663.tar.gz
trackermap-server-1d3a0b49ead6f0836583cf5e97948c6a86bb8663.tar.bz2
trackermap-server-1d3a0b49ead6f0836583cf5e97948c6a86bb8663.zip
Fix Meitrack regex pattern
-rw-r--r--src/org/traccar/protocol/MeitrackProtocolDecoder.java4
-rw-r--r--test/org/traccar/protocol/MeitrackProtocolDecoderTest.java5
2 files changed, 6 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
index 62bd21a4b..2d8fa9511 100644
--- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
@@ -56,7 +56,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
"([AV])," + // Validity
"(\\d+)," + // Satellites
"(\\d+)," + // GSM Signal
- "(\\d+)," + // Speed
+ "(\\d+\\.?\\d*)," + // Speed
"(\\d+)," + // Course
"(\\d+\\.?\\d*)," + // HDOP
"(-?\\d+)," + // Altitude
@@ -68,7 +68,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
"(\\p{XDigit}+)?\\|" + // ADC2
"(\\p{XDigit}+)?\\|" + // ADC3
"(\\p{XDigit}+)\\|" + // Battery
- "(\\p{XDigit}+)," + // Power*/
+ "(\\p{XDigit}+)," + // Power
".*(\r\n)?");
private Position decodeRegularMessage(Channel channel, ChannelBuffer buf) {
diff --git a/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java b/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java
index 6be7373ae..7d0dc6bc0 100644
--- a/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java
@@ -14,7 +14,10 @@ public class MeitrackProtocolDecoderTest {
public void testDecode() throws Exception {
MeitrackProtocolDecoder decoder = new MeitrackProtocolDecoder(new TestDataManager(), null, null);
-
+
+ verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
+ "$$E141,863071013799553,AAA,35,-1.264521,36.801128,150307132846,A,11,20,0.2,0,5,1767,84045888,36496633,639|02|100E|844,1234,0018|||025D|00CB,*17", Charset.defaultCharset())));
+
verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
"$$m140,013777008931857,AAA,1,54.739580,25.273263,141120144603,V,0,25,0,6,50.0,159,19825,13940,246|1|0065|118A,0100,0000|0000|0000|092A|0001,,*1C", Charset.defaultCharset())));