diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-02-16 10:16:00 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-02-16 10:16:00 +1300 |
commit | 5ac7a4595d6b9f56cf2f43c2a623ee5ffeee2228 (patch) | |
tree | 13a8a50685da3b35a1fda5f631315e4ab3b23f51 | |
parent | 9f929e8ab59ac4512c695f22fb1f7dc66349c84a (diff) | |
download | trackermap-server-5ac7a4595d6b9f56cf2f43c2a623ee5ffeee2228.tar.gz trackermap-server-5ac7a4595d6b9f56cf2f43c2a623ee5ffeee2228.tar.bz2 trackermap-server-5ac7a4595d6b9f56cf2f43c2a623ee5ffeee2228.zip |
Improve GoSafe decoder (fix #1079)
-rw-r--r-- | src/org/traccar/protocol/GoSafeProtocolDecoder.java | 11 | ||||
-rw-r--r-- | test/org/traccar/protocol/GoSafeProtocolDecoderTest.java | 3 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/GoSafeProtocolDecoder.java b/src/org/traccar/protocol/GoSafeProtocolDecoder.java index 7d43fd4e7..65f058bb6 100644 --- a/src/org/traccar/protocol/GoSafeProtocolDecoder.java +++ b/src/org/traccar/protocol/GoSafeProtocolDecoder.java @@ -47,6 +47,10 @@ public class GoSafeProtocolDecoder extends BaseProtocolDecoder { "\\d+;" + "([NS])(\\d+\\.\\d+);" + // Latitude "([EW])(\\d+\\.\\d+);" + // Longitude + "(\\d+);" + // Speed + "(\\d+);" + // Course + "(\\d+);" + // Altitude + "(\\d+\\.\\d+)" + // HDOP ".*"); @Override @@ -104,9 +108,10 @@ public class GoSafeProtocolDecoder extends BaseProtocolDecoder { position.setLongitude(longitude); // Other - position.setSpeed(0.0); - position.setCourse(0.0); - position.setAltitude(0.0); + position.setSpeed(Double.valueOf(parser.group(index++))); + position.setCourse(Double.valueOf(parser.group(index++))); + position.setAltitude(Double.valueOf(parser.group(index++))); + extendedInfo.set("hdop", parser.group(index++)); // Extended info position.setExtendedInfo(extendedInfo.toString()); diff --git a/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java b/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java index 604fe55ab..08f4a4fb6 100644 --- a/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java +++ b/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java @@ -12,6 +12,9 @@ public class GoSafeProtocolDecoderTest { GoSafeProtocolDecoder decoder = new GoSafeProtocolDecoder(new TestDataManager(), null, null); + assertNull(decoder.decode(null, null, null, + "*GS16,351535058709775")); + verify(decoder.decode(null, null, null, "*GS16,351535058709775,100356130215,,SYS:G79W;V1.06;V1.0.2,GPS:A;6;N24.802700;E46.616828;0;0;684;1.35,COT:60,ADC:4.31;0.10,DTT:20000;;0;0;0;1")); |