From 7dd73afe4fe7f07e93e7fbfbb7ed4e1e4e94d10a Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 18 Nov 2018 14:12:48 +1300 Subject: Handle BCE command responses --- src/org/traccar/protocol/BceProtocolDecoder.java | 5 +++++ test/org/traccar/protocol/BceProtocolDecoderTest.java | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/org/traccar/protocol/BceProtocolDecoder.java b/src/org/traccar/protocol/BceProtocolDecoder.java index 22877a29b..ed810bebb 100644 --- a/src/org/traccar/protocol/BceProtocolDecoder.java +++ b/src/org/traccar/protocol/BceProtocolDecoder.java @@ -65,6 +65,11 @@ public class BceProtocolDecoder extends BaseProtocolDecoder { int dataEnd = buf.readUnsignedShortLE() + buf.readerIndex(); int type = buf.readUnsignedByte(); + + if (type != MSG_ASYNC_STACK && type != MSG_TIME_TRIGGERED) { + return null; + } + int confirmKey = buf.readUnsignedByte() & 0x7F; while (buf.readerIndex() < dataEnd) { diff --git a/test/org/traccar/protocol/BceProtocolDecoderTest.java b/test/org/traccar/protocol/BceProtocolDecoderTest.java index 28340baf2..400ba7e12 100644 --- a/test/org/traccar/protocol/BceProtocolDecoderTest.java +++ b/test/org/traccar/protocol/BceProtocolDecoderTest.java @@ -10,6 +10,9 @@ public class BceProtocolDecoderTest extends ProtocolTest { BceProtocolDecoder decoder = new BceProtocolDecoder(null); + verifyNull(decoder, binary( + "3ab90b71bc1503000300c10bff11")); + verifyPositions(decoder, binary( "789622d1cb1303003401a53365b70f4a9babc0ffd700c04400f0b6c741e63933428f1c431c015468de43f18221341b007e0ae20001430a698f003f008d000000000031f85900000000f0831c018400000000000000000000000000000000000209000000000000000000000000000000030065f70f4a9babc0ffd700c0440069bcc741e73733427f1c431a01a9378343f1829c391b00a80be2000170056da7003e007c000000000031c04e00000000f0831c01810000000000000000000000000000000000060100000000000000000000000000000003006537104a9babc0ffd700c0440051c1c74129363342721c421801e4809543f18210341b00710ae2000170056da7003e0072000000000031c04800000000b8841c017e00000000000000000000000000000000000306000000000000000000000000000000030069")); -- cgit v1.2.3