From e54122e22725bae7a962d58e06a497526aed46cb Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 12 Jan 2017 02:07:56 +1300 Subject: Better handle H02 X mode (fix #2780) --- test/org/traccar/protocol/H02FrameDecoderTest.java | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test/org') diff --git a/test/org/traccar/protocol/H02FrameDecoderTest.java b/test/org/traccar/protocol/H02FrameDecoderTest.java index 7d54299a5..1505e25ac 100644 --- a/test/org/traccar/protocol/H02FrameDecoderTest.java +++ b/test/org/traccar/protocol/H02FrameDecoderTest.java @@ -40,4 +40,27 @@ public class H02FrameDecoderTest extends ProtocolTest { } + @Test + public void testDecodeAlternative() throws Exception { + + H02FrameDecoder decoder = new H02FrameDecoder(0); + + Assert.assertEquals( + binary("2a48512c343230363131393133302c4e42522c3130323430332c3233382c312c302c372c313131312c323236342c36332c313131312c323236352c35382c313131312c323236362c35302c313131312c333133352c33372c313131312c3630352c33332c313131312c343932302c33302c313131312c3630372c32382c3131303131372c46464646444646462c3623"), + decoder.decode(null, null, binary("2a48512c343230363131393133302c4e42522c3130323430332c3233382c312c302c372c313131312c323236342c36332c313131312c323236352c35382c313131312c323236362c35302c313131312c333133352c33372c313131312c3630352c33332c313131312c343932302c33302c313131312c3630372c32382c3131303131372c46464646444646462c3623"))); + + Assert.assertEquals( + binary("2442061191301024031101175540227006012321670c000095fffffbffff001f00000001f800ee010000000032"), + decoder.decode(null, null, binary("2442061191301024031101175540227006012321670c000095fffffbffff001f00000001f800ee010000000032"))); + + Assert.assertEquals( + binary("5800009814991024031101175540227006012321670c000095fffffbffff0033"), + decoder.decode(null, null, binary("5800009814991024031101175540227006012321670c000095fffffbffff0033"))); + + Assert.assertEquals( + binary("2a48512c343230363131393133302c4e42522c3130323431362c3233382c312c302c372c313131312c323236342c35332c313131312c323236352c36302c313131312c323236362c34342c313131312c333133352c34332c313131312c3630352c33392c313131312c343932302c32392c313131312c3630372c32342c3131303131372c46464646464246462c3623"), + decoder.decode(null, null, binary("2a48512c343230363131393133302c4e42522c3130323431362c3233382c312c302c372c313131312c323236342c35332c313131312c323236352c36302c313131312c323236362c34342c313131312c333133352c34332c313131312c3630352c33392c313131312c343932302c32392c313131312c3630372c32342c3131303131372c46464646464246462c3623"))); + + } + } -- cgit v1.2.3