diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-12-19 11:52:56 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-12-19 11:52:56 +1300 |
commit | de9a600541738bd14608e740b495693f79bc97a1 (patch) | |
tree | 1569ea5dd69cbaeea795e9ed844160a02edb0ebb | |
parent | 56131bb61d845cfd4684ee315d2b713305a4446c (diff) | |
download | trackermap-server-de9a600541738bd14608e740b495693f79bc97a1.tar.gz trackermap-server-de9a600541738bd14608e740b495693f79bc97a1.tar.bz2 trackermap-server-de9a600541738bd14608e740b495693f79bc97a1.zip |
Correctly docode speed for Castel protocol
-rw-r--r-- | src/org/traccar/protocol/CastelProtocolDecoder.java | 2 | ||||
-rw-r--r-- | test/org/traccar/protocol/CastelProtocolDecoderTest.java | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/CastelProtocolDecoder.java b/src/org/traccar/protocol/CastelProtocolDecoder.java index bf0d8ea46..e36d086f8 100644 --- a/src/org/traccar/protocol/CastelProtocolDecoder.java +++ b/src/org/traccar/protocol/CastelProtocolDecoder.java @@ -65,7 +65,7 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder { double lat = buf.readUnsignedInt() / 3600000.0; double lon = buf.readUnsignedInt() / 3600000.0; - position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort())); + position.setSpeed(UnitsConverter.knotsFromCps(buf.readUnsignedShort())); position.setCourse(buf.readUnsignedShort() % 360); int flags = buf.readUnsignedByte(); diff --git a/test/org/traccar/protocol/CastelProtocolDecoderTest.java b/test/org/traccar/protocol/CastelProtocolDecoderTest.java index fbacfb94e..b8795e09a 100644 --- a/test/org/traccar/protocol/CastelProtocolDecoderTest.java +++ b/test/org/traccar/protocol/CastelProtocolDecoderTest.java @@ -12,8 +12,11 @@ public class CastelProtocolDecoderTest extends ProtocolTest { CastelProtocolDecoder decoder = new CastelProtocolDecoder(new CastelProtocol()); - //verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, - // "4040590004313030303030303030303800000000000000000040010072f53f56c25240560000000078b00900000000009c3100000000030100011900030001090b0f080106c04fe40b4037310c0060e001ff018d01e05e0d0a")); + verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + "4040590004313030303030303030303800000000000000000040010072f53f56c25240560000000078b00900000000009c3100000000030100011900030001090b0f080106c04fe40b4037310c0060e001ff018d01e05e0d0a")); + + verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + "40405900043231334e5832303135303030303336000000000040010073dd735600df7356b9220000270b000000000000000000000400000000240e03000201120c0f0a19050c1e5808ca35530dd902540d9c010000e5300d0a")); verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, "404055000431303031313132353239393837000000000000001002C1F0695230086A529C911100000000000F890000A60500000000036301014CFF000001190A0D0539191480D60488C5721800000000BF8A640D0A")); |