From c2c27617fa4392c3a25a6c4ad62bd24060f1c0c1 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 21 May 2024 06:41:44 -0700 Subject: Handle Snapper protocol ping --- .../traccar/protocol/SnapperFrameDecoderTest.java | 23 ++++++++++++++++++++++ .../protocol/SnapperProtocolDecoderTest.java | 3 +++ 2 files changed, 26 insertions(+) create mode 100644 src/test/java/org/traccar/protocol/SnapperFrameDecoderTest.java (limited to 'src/test') diff --git a/src/test/java/org/traccar/protocol/SnapperFrameDecoderTest.java b/src/test/java/org/traccar/protocol/SnapperFrameDecoderTest.java new file mode 100644 index 000000000..260a18032 --- /dev/null +++ b/src/test/java/org/traccar/protocol/SnapperFrameDecoderTest.java @@ -0,0 +1,23 @@ +package org.traccar.protocol; + +import org.junit.jupiter.api.Test; +import org.traccar.ProtocolTest; + +public class SnapperFrameDecoderTest extends ProtocolTest { + + @Test + public void testDecode() throws Exception { + + var decoder = inject(new SnapperFrameDecoder()); + + verifyFrame( + binary("4b0341a6b0c608000040000005000000000000007d5e14010068656c6c6f"), + decoder.decode(null, null, binary("4b0341a6b0c608000040000005000000000000007d5e14010068656c6c6f"))); + + verifyFrame( + binary("5012"), + decoder.decode(null, null, binary("5012"))); + + } + +} diff --git a/src/test/java/org/traccar/protocol/SnapperProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SnapperProtocolDecoderTest.java index bb79194eb..43df24316 100644 --- a/src/test/java/org/traccar/protocol/SnapperProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/SnapperProtocolDecoderTest.java @@ -22,6 +22,9 @@ public class SnapperProtocolDecoderTest extends ProtocolTest { verifyPosition(decoder, binary( "4b044daff87aff5b8aad0000430100000000bb870c005b37000500210008003e0100ffffffff7f2300190000007f000000018080000002deff080003404000000400000034008c007b2273223a22303034303438222c226332223a2230303030303030303030303030303030222c226132223a2230303030303030303030303030303030222c226f223a2230303030222c2274223a2230303030222c227a223a223030222c2277223a223030222c2272223a222d222c226d223a223030303030303030222c2262223a223030303030303030227d320079007b2266223a224445222c2274223a22303832303335222c2264223a22313730343234222c226c61223a22353334312e34323635222c226c6f223a2230303935342e30373935222c2261223a22362e32222c2273223a22322e3237222c2263223a2233302e3135222c227376223a223038222c2270223a22227d330007007b2262223a5d7d")); + verifyNull(decoder, binary( + "5003")); + } } -- cgit v1.2.3