From b6cc3e27d03de09d61c9ea8dbf3fce108678d031 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 17 Oct 2013 21:42:22 +1300 Subject: Fill Atrack missing fields --- src/org/traccar/protocol/AtrackProtocolDecoder.java | 2 ++ test/org/traccar/protocol/AtrackProtocolDecoderTest.java | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java index 18af7a123..ba03e0642 100644 --- a/src/org/traccar/protocol/AtrackProtocolDecoder.java +++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java @@ -77,8 +77,10 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedInt(); // send time // Coordinates + position.setValid(true); position.setLongitude(buf.readInt() * 0.000001); position.setLatitude(buf.readInt() * 0.000001); + position.setAltitude(0.0); // Course position.setCourse((double) buf.readUnsignedShort()); diff --git a/test/org/traccar/protocol/AtrackProtocolDecoderTest.java b/test/org/traccar/protocol/AtrackProtocolDecoderTest.java index ccead9859..69bf03059 100644 --- a/test/org/traccar/protocol/AtrackProtocolDecoderTest.java +++ b/test/org/traccar/protocol/AtrackProtocolDecoderTest.java @@ -19,6 +19,9 @@ public class AtrackProtocolDecoderTest { int[] buf2 = {0x40,0x50,0x99,0x3f,0x00,0x5c,0x00,0x02,0x00,0x01,0x41,0x04,0xd8,0xf1,0x96,0x82,0x52,0x56,0x66,0xc2,0x52,0x56,0x8c,0x3c,0x52,0x56,0x8c,0x63,0xff,0xc8,0x33,0x84,0x02,0x69,0x88,0x85,0x00,0x00,0x02,0x00,0x00,0x09,0xcf,0x03,0xde,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xd0,0x07,0xd0,0x00,0x52,0x56,0x66,0xc2,0x52,0x56,0x8c,0x5a,0x52,0x56,0x8c,0x63,0xff,0xc8,0x33,0x84,0x02,0x69,0x88,0x85,0x00,0x00,0x02,0x00,0x00,0x09,0xcf,0x03,0xde,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xd0,0x07,0xd0,0x00}; assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf2)))); + + int[] buf3 = {0x40,0x50,0x1e,0x58,0x00,0x33,0x01,0xe0,0x00,0x01,0x41,0x04,0xd8,0xf1,0x96,0x82,0x52,0x5e,0xcd,0x5d,0x52,0x5e,0xe3,0x44,0x52,0x5e,0xe3,0x5e,0xff,0xc8,0x88,0x15,0x02,0x6a,0xb4,0xd7,0x00,0x00,0x02,0x00,0x00,0x10,0x44,0x03,0xde,0x01,0x00,0x0b,0x00,0x00,0x00,0x00,0x07,0xd0,0x07,0xd0,0x00}; + assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf3)))); } -- cgit v1.2.3