aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/XirgoProtocolDecoder.java6
-rw-r--r--test/org/traccar/protocol/XirgoProtocolDecoderTest.java8
2 files changed, 13 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/XirgoProtocolDecoder.java b/src/org/traccar/protocol/XirgoProtocolDecoder.java
index 38c21f387..6d215e672 100644
--- a/src/org/traccar/protocol/XirgoProtocolDecoder.java
+++ b/src/org/traccar/protocol/XirgoProtocolDecoder.java
@@ -228,7 +228,11 @@ public class XirgoProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(UnitsConverter.knotsFromKph(Double.parseDouble(values[i])));
break;
case "HD":
- position.setCourse(Integer.parseInt(values[i]) * 0.1);
+ if (values[i].contains(".")) {
+ position.setCourse(Double.parseDouble(values[i]));
+ } else {
+ position.setCourse(Integer.parseInt(values[i]) * 0.1);
+ }
break;
case "SV":
position.set(Position.KEY_SATELLITES, Integer.parseInt(values[i]));
diff --git a/test/org/traccar/protocol/XirgoProtocolDecoderTest.java b/test/org/traccar/protocol/XirgoProtocolDecoderTest.java
index b2e023574..f795742fd 100644
--- a/test/org/traccar/protocol/XirgoProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/XirgoProtocolDecoderTest.java
@@ -10,6 +10,14 @@ public class XirgoProtocolDecoderTest extends ProtocolTest {
XirgoProtocolDecoder decoder = new XirgoProtocolDecoder(null);
+ decoder.setForm("UID,EV,D,T,LT,LN,AL,GSPT,HD,SV,HP,BV,CQ,GS,SI,IG,OT");
+
+ verifyPosition(decoder, text(
+ "$$183900034,4002,03/30/2019,02:15:22,46.848577,-114.022213,978,0.0,172.3,16,1.2,13.291,20,3,2,2,1##"));
+
+ verifyPosition(decoder, text(
+ "$$184800793,4002,03/30/2019,02:10:13,46.848600,-114.022256,9723,0.0,1645,17,1.2,13.283,18,3,89011703278246523594,2,0##"));
+
decoder.setForm("UID,EV,D,T,LT,LN,AL,GSPT,SV,HP,BV,CQ,MI,GS,SI,IG,OT");
verifyPosition(decoder, text(