From c81160165ae6881c9195cf3c00469cb9466e6364 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 1 Aug 2013 23:25:00 +1200 Subject: Fix teltonika decoder (fix #207) --- src/org/traccar/protocol/TeltonikaProtocolDecoder.java | 2 +- test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java index 723f6f93e..99e923692 100644 --- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java +++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java @@ -83,7 +83,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { if (codec == CODEC_GH3000) { long time = buf.readUnsignedInt() & 0x3fffffff; - time += 1199145600; // 2008-01-01 00:00:00 + time += 1167609600; // 2007-01-01 00:00:00 position.setTime(new Date(time * 1000)); globalMask = buf.readUnsignedByte(); diff --git a/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java b/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java index 789844f50..8dc0af6b1 100644 --- a/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java +++ b/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java @@ -27,6 +27,9 @@ public class TeltonikaProtocolDecoderTest { byte[] buf5 = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xc7,0x07,0x04,0x41,(byte)0xbf,(byte)0x9d,(byte)0xb0,0x0f,(byte)0xff,0x42,0x5a,(byte)0xdb,(byte)0xd7,0x41,(byte)0xca,0x6e,0x1e,0x00,(byte)0x9e,0x12,0x05,0x07,0x00,0x01,0x03,0x0b,0x16,0x00,0x00,0x60,0x1a,0x02,0x01,0x5e,0x02,0x00,0x03,0x14,0x00,0x66,0x15,0x00,0x0a,0x16,0x00,0x67,0x01,0x05,0x00,0x00,0x0c,(byte)0xe4,0x41,(byte)0xbf,(byte)0x9d,(byte)0x92,0x0f,(byte)0xff,0x42,0x5a,(byte)0xdb,(byte)0xb1,0x41,(byte)0xca,0x6f,(byte)0xc9,0x00,(byte)0xa2,(byte)0xb2,0x18,0x07,0x00,0x01,0x03,0x0b,0x16,0x00,0x00,0x60,0x1a,0x02,0x01,0x5e,0x02,0x00,0x03,0x14,0x00,0x66,0x15,0x00,0x0a,0x16,0x00,0x67,0x01,0x05,0x00,0x00,0x0c,(byte)0xc6,0x41,(byte)0xbf,(byte)0x9d,0x74,0x0f,(byte)0xff,0x42,0x5a,(byte)0xdb,(byte)0xee,0x41,(byte)0xca,0x73,(byte)0x92,0x00,(byte)0xb6,(byte)0xc9,0x1e,0x07,0x00,0x01,0x03,0x0b,0x1f,0x00,0x00,0x60,0x1a,0x02,0x01,0x5f,0x02,0x00,0x03,0x14,0x00,0x66,0x15,0x00,0x0a,0x16,0x00,0x66,0x01,0x05,0x00,0x00,0x0c,(byte)0xa8,0x41,(byte)0xbf,(byte)0x9c,(byte)0xfc,0x0f,(byte)0xff,0x42,0x5a,(byte)0xdb,(byte)0xa0,0x41,(byte)0xca,0x70,(byte)0xc1,0x00,(byte)0xb9,0x38,0x13,0x07,0x00,0x01,0x03,0x0b,0x1f,0x00,0x00,0x60,0x1a,0x02,0x01,0x5f,0x02,0x00,0x03,0x14,0x00,0x23,0x15,0x00,0x0a,0x16,0x00,0x25,0x01,0x05,0x00,0x00,0x0c,0x30,0x04,0x00,0x00,0x00}; assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf5))); + + byte[] buf6 = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x07,0x02,0x4c,0x61,0x41,0x0b,0x01,0x3f,0x42,0x31,(byte)0xc2,(byte)0xc1,0x41,(byte)0xd0,(byte)0xbe,(byte)0xb9,0x00,0x3d,0x00,0x00,0x05,0x00,0x64,(byte)0x83,(byte)0xff,0x4c,0x61,0x40,(byte)0xeb,0x01,0x3f,0x42,0x31,(byte)0xc2,(byte)0xc1,0x41,(byte)0xd0,(byte)0xbe,(byte)0xb9,0x00,0x3d,0x00,0x00,0x05,0x00,0x64,(byte)0x83,(byte)0xff,0x02,0x00,0x00,0x41,(byte)0xdf}; + assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf6))); } -- cgit v1.2.3