From 08e058e868566e44a8e955fa8d18bdae5630ecec Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 6 Aug 2016 10:24:53 +0300 Subject: Fix an issue in Castel decoder --- src/org/traccar/protocol/CastelProtocolDecoder.java | 8 +++++++- test/org/traccar/protocol/CastelProtocolDecoderTest.java | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/org/traccar/protocol/CastelProtocolDecoder.java b/src/org/traccar/protocol/CastelProtocolDecoder.java index 212096018..0beca4070 100644 --- a/src/org/traccar/protocol/CastelProtocolDecoder.java +++ b/src/org/traccar/protocol/CastelProtocolDecoder.java @@ -218,7 +218,13 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder { return positions; } - } else if (type == MSG_SC_GPS_SLEEP || type == MSG_SC_AGPS_REQUEST) { + } else if (type == MSG_SC_GPS_SLEEP) { + + buf.readUnsignedInt(); // device time + + return readPosition(deviceSession, buf); + + } else if (type == MSG_SC_AGPS_REQUEST) { return readPosition(deviceSession, buf); diff --git a/test/org/traccar/protocol/CastelProtocolDecoderTest.java b/test/org/traccar/protocol/CastelProtocolDecoderTest.java index 6df2fd387..feba9386e 100644 --- a/test/org/traccar/protocol/CastelProtocolDecoderTest.java +++ b/test/org/traccar/protocol/CastelProtocolDecoderTest.java @@ -12,6 +12,9 @@ public class CastelProtocolDecoderTest extends ProtocolTest { CastelProtocolDecoder decoder = new CastelProtocolDecoder(new CastelProtocol()); + verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + "40403600043231334e583230313630303033343600000000004009ad31a457050810061a35b29bf80ae6da83180300320bbe32580d0a40403600043231334e583230313630303033343600000000004009ad31a457050810061a35b29bf80ae6da83180300320bbe32580d0a")); + verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN, "4040d400043535333133350000000000000000000000000000100196d499574bd899570000000000000000010000000000000000000000002410000000004944445f3231334730325f532056322e332e345f4e004944445f3231334730325f482056322e332e345f4e0032000110021003100410051006100710081009100a100b100c100d100e1011100111021103110411051106110711011202120312041201130213031301160216011701180218011b011c011d011e011f021f031f041f051f061f071f012102210126012701285b410d0a")); -- cgit v1.2.3