aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-08-27 11:04:03 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-08-27 11:04:03 +1200
commit06eb72ad101b5a0de9a975fd6f3585238d887cef (patch)
treee82c678e3d791468a9f55912828cfa2025b0c623
parenta39439829c85dd1b0323b6c15b647eb0d1d92f5f (diff)
downloadtrackermap-server-06eb72ad101b5a0de9a975fd6f3585238d887cef.tar.gz
trackermap-server-06eb72ad101b5a0de9a975fd6f3585238d887cef.tar.bz2
trackermap-server-06eb72ad101b5a0de9a975fd6f3585238d887cef.zip
Fix an issue in GpsMaker protocol decoder
-rw-r--r--src/org/traccar/protocol/GpsMarkerProtocolDecoder.java6
-rw-r--r--test/org/traccar/protocol/GpsMarkerProtocolDecoderTest.java2
2 files changed, 5 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/GpsMarkerProtocolDecoder.java b/src/org/traccar/protocol/GpsMarkerProtocolDecoder.java
index 4f6faa6ba..89537fa3d 100644
--- a/src/org/traccar/protocol/GpsMarkerProtocolDecoder.java
+++ b/src/org/traccar/protocol/GpsMarkerProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com)
+ * Copyright 2015 - 2016 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.
@@ -45,7 +45,7 @@ public class GpsMarkerProtocolDecoder extends BaseProtocolDecoder {
.number("(ddd)(dd)(dddd)") // longitude
.number("(ddd)") // speed
.number("(ddd)") // course
- .number("(d)") // satellites
+ .number("(x)") // satellites
.number("(dd)") // battery
.number("(d)") // input
.number("(d)") // output
@@ -82,7 +82,7 @@ public class GpsMarkerProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(parser.nextDouble());
position.setCourse(parser.nextDouble());
- position.set(Position.KEY_SATELLITES, parser.next());
+ position.set(Position.KEY_SATELLITES, parser.nextInt(16));
position.set(Position.KEY_BATTERY, parser.next());
position.set(Position.KEY_INPUT, parser.next());
position.set(Position.KEY_OUTPUT, parser.next());
diff --git a/test/org/traccar/protocol/GpsMarkerProtocolDecoderTest.java b/test/org/traccar/protocol/GpsMarkerProtocolDecoderTest.java
index a8888c48c..8e25598fc 100644
--- a/test/org/traccar/protocol/GpsMarkerProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/GpsMarkerProtocolDecoderTest.java
@@ -11,6 +11,8 @@ public class GpsMarkerProtocolDecoderTest extends ProtocolTest {
GpsMarkerProtocolDecoder decoder = new GpsMarkerProtocolDecoder(new GpsMarkerProtocol());
+ verifyPosition(decoder, text(
+ "$GM23D863071014445404T260816142611N55441051E037325071033063C0530304#"));
verifyNothing(decoder, text(
"$GM300350123456789012T100511123300G25000001772F185200000000000000005230298#"));