diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2014-01-31 23:01:13 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2014-01-31 23:01:13 +1300 |
commit | 33a5306bb25af9c6b95858c82bed0c4deacbc537 (patch) | |
tree | fc7e7e622a2b8d7df5727013ac3e0dec39d91261 | |
parent | ce8154726e398ca47b3d3ea214ced111c0146769 (diff) | |
download | traccar-server-33a5306bb25af9c6b95858c82bed0c4deacbc537.tar.gz traccar-server-33a5306bb25af9c6b95858c82bed0c4deacbc537.tar.bz2 traccar-server-33a5306bb25af9c6b95858c82bed0c4deacbc537.zip |
Handle negative altitude (fix #535)
6 files changed, 17 insertions, 8 deletions
diff --git a/src/org/traccar/protocol/IntellitracProtocolDecoder.java b/src/org/traccar/protocol/IntellitracProtocolDecoder.java index de834965c..56ddfedfd 100644 --- a/src/org/traccar/protocol/IntellitracProtocolDecoder.java +++ b/src/org/traccar/protocol/IntellitracProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2013 - 2014 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. @@ -41,7 +41,7 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder { "(-?\\d+\\.\\d+)," + // Latitude "(\\d+\\.?\\d*)," + // Speed "(\\d+\\.?\\d*)," + // Course - "(\\d+\\.?\\d*)," + // Altitude + "(-?\\d+\\.?\\d*)," + // Altitude "(\\d+)," + // Satellites "(\\d+)," + // Report Identifier "(\\d+)," + // Input diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java index 71a5a61c1..d1ed182b2 100644 --- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java +++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2012 - 2014 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. @@ -48,8 +48,8 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { "(\\d+)," + // GSM Signal "(\\d+)," + // Speed "(\\d+)," + // Course - "(\\d+\\.?\\d*)," + // HDOP - "(\\d+)," + // Altitude + "(\\d+\\.?\\d*)," + // HDOP + "(-?\\d+)," + // Altitude "(\\d+)," + // Milage ".*"); // TODO: parse other stuff diff --git a/src/org/traccar/protocol/WondexProtocolDecoder.java b/src/org/traccar/protocol/WondexProtocolDecoder.java index 65fb3526d..90f2e62e9 100644 --- a/src/org/traccar/protocol/WondexProtocolDecoder.java +++ b/src/org/traccar/protocol/WondexProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2013 - 2014 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. @@ -33,7 +33,7 @@ public class WondexProtocolDecoder extends BaseProtocolDecoder { super(serverManager); } - static private Pattern pattern = Pattern.compile( + private static final Pattern pattern = Pattern.compile( "[^\\d]*" + // Header "(\\d+)," + // Device Identifier "(\\d{4})(\\d{2})(\\d{2})" + // Date (YYYYMMDD) @@ -42,7 +42,7 @@ public class WondexProtocolDecoder extends BaseProtocolDecoder { "(-?\\d+\\.\\d+)," + // Latitude "(\\d+)," + // Speed "(\\d+)," + // Course - "(\\d+)," + // Altitude + "(-?\\d+)," + // Altitude "(\\d+)," + // Satellites "(\\d+),?" + // Event "(\\d+\\.\\d+)?,?" + // Milage diff --git a/test/org/traccar/protocol/IntellitracProtocolDecoderTest.java b/test/org/traccar/protocol/IntellitracProtocolDecoderTest.java index 7276932d9..9557797b7 100644 --- a/test/org/traccar/protocol/IntellitracProtocolDecoderTest.java +++ b/test/org/traccar/protocol/IntellitracProtocolDecoderTest.java @@ -19,6 +19,9 @@ public class IntellitracProtocolDecoderTest { "1010000002,20030217132813,121.646060,25.061725,20,157,133,7,0,11,15,0.096,0.000")); verify(decoder.decode(null, null, + "1010000002,20030217132813,121.646060,25.061725,20,157,-133,7,0,11,15,0.096,0.000")); + + verify(decoder.decode(null, null, "1001070919,20130405084206,37.903730,48.011377,0,0,235,10,2,2,0,20.211,0.153")); verify(decoder.decode(null, null, diff --git a/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java b/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java index 6d72ca2da..e59c2ad98 100644 --- a/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java +++ b/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java @@ -14,6 +14,9 @@ public class MeitrackProtocolDecoderTest { verify(decoder.decode(null, null, "$$X138,862170010187175,AAA,35,-29.960365,-51.655455,130507201625,A,8,9,0,107,0.9,7,169322,126582,724|6|0547|132B,0000,0009|000A||0278|0000,*BE")); + + verify(decoder.decode(null, null, + "$$X138,862170010187175,AAA,35,-29.960365,-51.655455,130507201625,A,8,9,0,107,0.9,-7,169322,126582,724|6|0547|132B,0000,0009|000A||0278|0000,*BE")); verify(decoder.decode(null, null, "$$]138,012896000475498,AAA,35,-6.138255,106.910545,121205074600,A,5,18,0,0,0,49,3800,24826,510|10|0081|4F4F,0000,0011|0012|0010|0963|0000,,*94")); diff --git a/test/org/traccar/protocol/WondexProtocolDecoderTest.java b/test/org/traccar/protocol/WondexProtocolDecoderTest.java index 463627064..bf51be534 100644 --- a/test/org/traccar/protocol/WondexProtocolDecoderTest.java +++ b/test/org/traccar/protocol/WondexProtocolDecoderTest.java @@ -24,6 +24,9 @@ public class WondexProtocolDecoderTest { verify(decoder.decode(null, null, "1044989601,20130322172647,13.572583,52.401070,22,204,49,0,2")); + verify(decoder.decode(null, null, + "1044989601,20130322172647,13.572583,52.401070,22,204,-49,0,2")); + } } |