diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-11-14 01:56:26 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-11-14 01:56:26 +1300 |
commit | 4066c24ed1ba8749a1a682acb5b027401d0df70f (patch) | |
tree | 1a1a6499fc2b9fff57dc7067f6dd8101b22efad0 /test/org/traccar/protocol | |
parent | b87fa6f361fd0c27383d78a503ed2c28a8bdef1a (diff) | |
download | trackermap-server-4066c24ed1ba8749a1a682acb5b027401d0df70f.tar.gz trackermap-server-4066c24ed1ba8749a1a682acb5b027401d0df70f.tar.bz2 trackermap-server-4066c24ed1ba8749a1a682acb5b027401d0df70f.zip |
Another attempt to fix H02 frame decoder
Diffstat (limited to 'test/org/traccar/protocol')
-rw-r--r-- | test/org/traccar/protocol/H02FrameDecoderTest.java | 21 | ||||
-rw-r--r-- | test/org/traccar/protocol/H02ProtocolDecoderTest.java | 3 |
2 files changed, 21 insertions, 3 deletions
diff --git a/test/org/traccar/protocol/H02FrameDecoderTest.java b/test/org/traccar/protocol/H02FrameDecoderTest.java index 3e12bb446..7d54299a5 100644 --- a/test/org/traccar/protocol/H02FrameDecoderTest.java +++ b/test/org/traccar/protocol/H02FrameDecoderTest.java @@ -7,13 +7,17 @@ import org.traccar.ProtocolTest; public class H02FrameDecoderTest extends ProtocolTest { @Test - public void testDecode() throws Exception { + public void testDecodeShort() throws Exception { H02FrameDecoder decoder = new H02FrameDecoder(0); Assert.assertEquals( - binary("24410600082621532131081504419390060740418306000000fffffbfdff0015060000002c02dc0c000000001f"), - decoder.decode(null, null, binary("24410600082621532131081504419390060740418306000000fffffbfdff0015060000002c02dc0c000000001f"))); + binary("2441060116601245431311165035313006004318210e000000fffffbffff0024"), + decoder.decode(null, null, binary("2441060116601245431311165035313006004318210e000000fffffbffff0024"))); + + Assert.assertEquals( + binary("2441060116601245431311165035313006004318210e000000fffffbffff0024"), + decoder.decode(null, null, binary("2441060116601245431311165035313006004318210e000000fffffbffff00242a48512c343130363031313636302c56312c3132343535322c412c353033352e333132392c4e2c30303433312e383231312c452c3030302e32302c3030302c3133313131362c464646464642464623"))); Assert.assertEquals( binary("2a48512c3335333538383036303031353536382c56312c3139333530352c412c3830392e303031302c532c333435342e383939372c572c302e30302c302e30302c3239313031332c65666666666266662c3030303264342c3030303030622c3030353338352c3030353261612c323523"), @@ -25,4 +29,15 @@ public class H02FrameDecoderTest extends ProtocolTest { } + @Test + public void testDecodeLong() throws Exception { + + H02FrameDecoder decoder = new H02FrameDecoder(0); + + Assert.assertEquals( + binary("24410600082621532131081504419390060740418306000000fffffbfdff0015060000002c02dc0c000000001f"), + decoder.decode(null, null, binary("24410600082621532131081504419390060740418306000000fffffbfdff0015060000002c02dc0c000000001f"))); + + } + } diff --git a/test/org/traccar/protocol/H02ProtocolDecoderTest.java b/test/org/traccar/protocol/H02ProtocolDecoderTest.java index 48fe408d8..9fed9943c 100644 --- a/test/org/traccar/protocol/H02ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/H02ProtocolDecoderTest.java @@ -116,6 +116,9 @@ public class H02ProtocolDecoderTest extends ProtocolTest { "*HQ,8401016597,BASE,152609,0,0,0,0,211014,FFFFFFFF#")); verifyPosition(decoder, binary( + "2441060116601245431311165035313006004318210e000000fffffbffff0024")); + + verifyPosition(decoder, binary( "24410600082621532131081504419390060740418306000000fffffbfdff0015060000002c02dc0c000000001f"), position("2015-08-31 21:53:21.000", true, 4.69898, -74.06971)); |