diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-11-05 22:33:27 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2019-11-05 22:33:27 -0800 |
commit | 771768c215d31e6b9e4a50079cabdbd96fc62d5f (patch) | |
tree | 9eac12404b469d09ccae33f89a06f578889bff5e /src | |
parent | 959c2762c7a8bd65f98b41c45e5e990fe5ff714d (diff) | |
download | traccar-server-771768c215d31e6b9e4a50079cabdbd96fc62d5f.tar.gz traccar-server-771768c215d31e6b9e4a50079cabdbd96fc62d5f.tar.bz2 traccar-server-771768c215d31e6b9e4a50079cabdbd96fc62d5f.zip |
Update Plugin protocol
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/protocol/PluginProtocolDecoder.java | 8 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/PluginProtocolDecoderTest.java | 3 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/PluginProtocolDecoder.java b/src/main/java/org/traccar/protocol/PluginProtocolDecoder.java index 106889ee0..b5d71854b 100644 --- a/src/main/java/org/traccar/protocol/PluginProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/PluginProtocolDecoder.java @@ -40,12 +40,12 @@ public class PluginProtocolDecoder extends BaseProtocolDecoder { .number("(dd)(dd)(dd),") // time (hhmmss) .number("(-?d+.d+),") // longitude .number("(-?d+.d+),") // latitude - .number("(d+),") // speed + .number("(d+.?d*),") // speed .number("(d+),") // course .number("(-?d+),") // altitude .number("(-?d+),") // satellites .number("d+,") // type - .number("(d+),") // odometer + .number("(d+.?d*),") // odometer .number("(d+),") // status .expression("[^,]*,") .expression("[^,]*,") @@ -78,12 +78,12 @@ public class PluginProtocolDecoder extends BaseProtocolDecoder { position.setTime(parser.nextDateTime()); position.setLongitude(parser.nextDouble()); position.setLatitude(parser.nextDouble()); - position.setSpeed(UnitsConverter.knotsFromKph(parser.nextInt())); + position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble())); position.setCourse(parser.nextInt()); position.setAltitude(parser.nextInt()); position.set(Position.KEY_SATELLITES, parser.nextInt()); - position.set(Position.KEY_ODOMETER, parser.nextInt()); + position.set(Position.KEY_ODOMETER, (long) (parser.nextDouble() * 1000)); position.set(Position.KEY_STATUS, parser.nextInt()); position.set(Position.KEY_EVENT, parser.nextInt()); diff --git a/src/test/java/org/traccar/protocol/PluginProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/PluginProtocolDecoderTest.java index 582ed9a5a..d5c5a3b78 100644 --- a/src/test/java/org/traccar/protocol/PluginProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/PluginProtocolDecoderTest.java @@ -11,6 +11,9 @@ public class PluginProtocolDecoderTest extends ProtocolTest { PluginProtocolDecoder decoder = new PluginProtocolDecoder(null); verifyPosition(decoder, text( + "$$STATUS,60550,20191014084650,28.254258,-25.860355,0.0,236,0,-1,2,7472.967,13697,0.00,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0")); + + verifyPosition(decoder, text( "$$STATUS,fleet40,20190704122622,26.259431,-29.027889,0,9,0,-1,2,19719,805315969,0,0,0")); verifyPosition(decoder, text( |