From 1268417e9052e36b899bd3f024aa99c01644c3f4 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 3 Nov 2015 10:09:05 +1300 Subject: Big improvements to Atrack decoder --- .../protocol/AtrackProtocolDecoderTest.java | 29 +++++++++++++--------- 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'test/org') diff --git a/test/org/traccar/protocol/AtrackProtocolDecoderTest.java b/test/org/traccar/protocol/AtrackProtocolDecoderTest.java index 882501e9e..72c54f1e6 100644 --- a/test/org/traccar/protocol/AtrackProtocolDecoderTest.java +++ b/test/org/traccar/protocol/AtrackProtocolDecoderTest.java @@ -1,9 +1,7 @@ package org.traccar.protocol; -import org.jboss.netty.buffer.ChannelBuffers; import org.junit.Test; import org.traccar.ProtocolDecoderTest; -import org.traccar.helper.ChannelBufferTools; public class AtrackProtocolDecoderTest extends ProtocolDecoderTest { @@ -12,12 +10,26 @@ public class AtrackProtocolDecoderTest extends ProtocolDecoderTest { AtrackProtocolDecoder decoder = new AtrackProtocolDecoder(new AtrackProtocol()); + decoder.setLongDate(true); + + verifyPositions(decoder, binary( + "0203b494003c00eb00014104d8dd3a3e07de011b0b1f0307de011b0b1f0307de011b0b1f0300307f28030574d30000020000000600160100020000000007d007d000")); + + decoder.setLongDate(false); + + decoder.setCustom(true); + + verifyPositions(decoder, binary( + "405025e30096eb730001452efaf6a7d6562fe4f8562fe4f7562fe52c02a006d902273f810064650000e0f5000a0100000000000007d007d000254349255341254d5625425625475125415400090083002a1a000001a8562fe4f8562fe4f7562fe52c02a006d902273f810064020000e0f5000a0100000000000007d007d000254349255341254d5625425625475125415400090083002a1a000001a8")); + + decoder.setCustom(false); + verifyNothing(decoder, binary( "fe0200014104d8f196820001")); - // invalid GPS data - //verifyPositions(decoder, binary( - // "40503835003300070001441c3d8ed1c400000000000000c9000000c900000000000000000000020000000003de0100000000000007d007d000")); + verifyPositions(decoder, binary( + "40503835003300070001441c3d8ed1c400000000000000c9000000c900000000000000000000020000000003de0100000000000007d007d000"), + position("1970-01-01 00:00:00.000", true, 0.00000, 0.00000)); verifyPositions(decoder, binary( "4050993f005c000200014104d8f19682525666c252568c3c52568c63ffc8338402698885000002000009cf03de0100000000000007d007d000525666c252568c5a52568c63ffc8338402698885000002000009cf03de0100000000000007d007d000")); @@ -28,13 +40,6 @@ public class AtrackProtocolDecoderTest extends ProtocolDecoderTest { verifyPositions(decoder, binary( "40501e58003301e000014104d8f19682525ecd5d525ee344525ee35effc88815026ab4d70000020000104403de01000b0000000007d007d000000000000000")); - // 7-byte date - //verifyPosition(decoder, binary( - // "0203b494003c00eb00014104d8dd3a3e07de011b0b1f0307de011b0b1f0307de011b0b1f0300307f28030574d30000020000000600160100020000000007d007d000")); - - //verifyPosition(decoder, binary( - // "4050d2c500da055200014104d8f19682530755515307555053075581ffbba66a0231295c001902000000da000a0100830000000007d007d000000000001200080e090085530755605307555f53075582ffbbb04102313b4b001802000000e0000c0100850000000007d007d000000000001200080d0000865307556f5307556e53075582ffbbbbea02314b49002402000000e5000a01007b0000000007d007d000000000001200080d0200855307557e5307557d53075582ffbbc98702315982002502000000ea000901007a0000000007d007d000000000001300180d08007b")); - } } -- cgit v1.2.3