From 2e6d54feff3a364aa7e86b7c53beed6d3682b169 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 13 Jan 2018 19:30:31 +1300 Subject: Add Teltonika test case --- src/org/traccar/protocol/TeltonikaProtocolDecoder.java | 3 ++- test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java index 80f0045d5..fcbdfc564 100644 --- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java +++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java @@ -69,6 +69,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { public static final int CODEC_GH3000 = 0x07; public static final int CODEC_FM4X00 = 0x08; public static final int CODEC_12 = 0x0C; + public static final int CODEC_16 = 0x10; private void decodeSerial(Position position, ChannelBuffer buf) { @@ -344,7 +345,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { } // Read 8 byte data - if (codec == CODEC_FM4X00) { + if (codec == CODEC_FM4X00 || codec == CODEC_16) { int cnt = buf.readUnsignedByte(); for (int j = 0; j < cnt; j++) { decodeOtherParameter(position, buf.readUnsignedByte(), buf, 8); diff --git a/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java b/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java index beae48d67..06775cbf1 100644 --- a/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java +++ b/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java @@ -14,6 +14,12 @@ public class TeltonikaProtocolDecoderTest extends ProtocolTest { verifyNull(decoder, binary( "000F313233343536373839303132333435")); + verifyPositions(decoder, false, binary( + "000000000000008c08010000013feb55ff74000f0ea850209a690000940000120000001e09010002000300040016014703f0001504c8000c0900730a00460b00501300464306d7440000b5000bb60007422e9f180000cd0386ce000107c700000000f10000601a46000001344800000bb84900000bb84a00000bb84c00000000024e0000000000000000cf00000000000000000100003fca")); + + /*verifyPositions(decoder, false, binary( + "00000000000001e0100300000160d73749c800d5db2211ec01dbfe021a007d0c0008000007210b0001000100ff01050f010611010d10010e0f010f1101160001170f011811011f0013010100d7010701230108012a01090032010a012a010b0000010c000001100000011100000112000001130000011400000115000001190000011a0000011b0000011c0000011d0000011e0000030102000000000103000002d00104000000000000000160d73745e000d5db2106ec01dbdc021a00940d0008000007210b0001000100ff01050f010611010d10010e0f010f1101160001170f011811011f0013010100d7010701230108012a01090032010a012a010b0000010c000001100000011100000112000001130000011400000115000001190000011a0000011b0000011c0000011d0000011e0000030102000000000103000002d00104000000000000000160d73726a000d5db2448ec01dd4b021c00f20c0007000007210b0001000100ff01050f010611010d10010e0f010f1101160001170f011811011f0013010100d5010701230108012a01090032010a012a010b0000010c000001100000011100000112000001130000011400000115000001190000011a0000011b0000011c0000011d0000011e0000030102000000000103000002d001040000000000030000d199"));*/ + verifyPositions(decoder, false, binary( "0000000000000401080e0000015d12cc211000fadaf627186742f5000d0048080006000a040100f001500515000342318a430fe344000003c700000000f1000068b61000001b05000000015d12c6683800fadaf72118673f82000000000000000007030100f00050040342318a430fe344000001f1000068b6000000015d12bd407800fadaf72118673f82000000000000000007030100f000500403423179430fe144000001f1000068b6000000015d12b414d000fadaf72118673f82000400900c0000fa120a0100f00050051502080007010552090e6f4bfa000542316a430fe14400000600006202b203c700002328f1000068b61000001b05000000015d12b3074800fadaf2821867436a000400890d00170011090100f00150011502081007010553090e6f4d054231fb430fe14400000603ae6202a003c700002328f1000068b61000001b05000000015d12b2ff7800fadaee89186747c60005009a0d001d0011090100f00150011502081b07010553090e6f4d05423125430fe144000006050862029e03c700002328f1000068b61000001b05000000015d12b2e42000fadae8cf18675e0a000300a60d00210011090101f00150011502082407030554090e6f4d0542310a430fe14400000606cf62029703c700002328f1000068b61000001b05000000015d12b2d48000fadae05818676a16000400930c00240011090100f00150011502082207010554090e6f4e05423738430fe144000006066a62029303c700002328f1000068b61000001b05000000015d12b2a1b800fadac33e18678e48000600940d00150011090101f00150051500081907030553090e6f4e054239cc430fe14400000607c662028603c700002328f1000000001000001b05000000015d12b29dd000fadac19d18678fc8000700820d00110011090100f00150051500081607030553090e6f4e054238c8430fe14400000606d962028503c700002328f1000000001000001b05000000015d12b299e800fadabfa9186790e3000700670d00110011090101f00150051500081407030553090e6f4e054231e5430fe144000006060a62028403c700002328f1000000001000001b05000000015d12b2960000fadabd4018679104000600510d00120011090101f00150051500081207030553090e6f4e054231ce430fe144000006057062028303c700002328f1000000001000001b05000000015d12b27aa800fadaa96518678b7c000600470d00120011090101f00150051500081807030551090e6f4e05423a70430fe144000006074462027c03c700002328f1000000001000001b05000000015d12b276c000fadaa73f18678ae60006003b0d000e0011090101f00150051500081607030551090e6f4e05423a5a430fe14400000606b762027b03c700002328f1000000001000001b05000e000007a4")); -- cgit v1.2.3