diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2014-05-25 20:16:47 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2014-05-25 20:16:47 +1200 |
commit | 66dd4c32b36e3b11c2d63fc50411e8ff1c55d512 (patch) | |
tree | ecb54c9418114670e3a09d01b0c06b3924f665e0 | |
parent | cd0527ebafe7199b1a171b95bf09aff79f5243e4 (diff) | |
download | trackermap-server-66dd4c32b36e3b11c2d63fc50411e8ff1c55d512.tar.gz trackermap-server-66dd4c32b36e3b11c2d63fc50411e8ff1c55d512.tar.bz2 trackermap-server-66dd4c32b36e3b11c2d63fc50411e8ff1c55d512.zip |
Fix eeLink decoder
-rw-r--r-- | src/org/traccar/protocol/EelinkProtocolDecoder.java | 3 | ||||
-rw-r--r-- | test/org/traccar/protocol/EelinkProtocolDecoderTest.java | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/EelinkProtocolDecoder.java b/src/org/traccar/protocol/EelinkProtocolDecoder.java index 6c3230050..00c74f7f3 100644 --- a/src/org/traccar/protocol/EelinkProtocolDecoder.java +++ b/src/org/traccar/protocol/EelinkProtocolDecoder.java @@ -111,7 +111,7 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder { // Location position.setTime(new Date(buf.readUnsignedInt() * 1000)); position.setLatitude(buf.readInt() / 1800000.0); - position.setLatitude(buf.readInt() / 1800000.0); + position.setLongitude(buf.readInt() / 1800000.0); position.setSpeed(buf.readUnsignedByte() * 0.539957); position.setCourse((double) buf.readUnsignedShort()); position.setAltitude(0.0); @@ -130,6 +130,7 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder { extendedInfo.set("status", buf.readUnsignedByte()); } + position.setExtendedInfo(extendedInfo.toString()); return position; } diff --git a/test/org/traccar/protocol/EelinkProtocolDecoderTest.java b/test/org/traccar/protocol/EelinkProtocolDecoderTest.java index 121ce3214..f9dd1d6bb 100644 --- a/test/org/traccar/protocol/EelinkProtocolDecoderTest.java +++ b/test/org/traccar/protocol/EelinkProtocolDecoderTest.java @@ -24,6 +24,9 @@ public class EelinkProtocolDecoderTest { assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( new int[] {0x67,0x67,0x07,0x00,0x88,0x00,0x10,0x50,0xE2,0x28,0x14,0x00,0xFF,0xFF,0xFF,0xFF,0x02,0x33,0x44,0x55,0x66,0x03,0x33,0x44,0x55,0x66,0x04,0x33,0x44,0x55,0x66,0x05,0xAA,0x00,0x00,0x00,0x07,0x33,0x44,0x55,0x66,0x0A,0x33,0x44,0x55,0x66,0x0B,0x33,0x44,0x55,0x66,0x0C,0x4E,0x20,0x00,0x00,0x0D,0xAA,0x00,0x00,0x00,0x0E,0x33,0x44,0x55,0x66,0x0F,0x33,0x44,0x55,0x66,0x10,0xAA,0xAA,0x00,0x00,0x11,0x33,0x44,0x55,0x66,0x1C,0x33,0x44,0x55,0x66,0x1F,0x33,0x44,0x55,0x66,0x21,0x33,0x44,0x55,0x66,0x42,0x33,0x44,0x55,0x66,0x46,0x33,0x44,0x55,0x66,0x4D,0x33,0x44,0x55,0x66,0x5C,0x33,0x44,0x55,0x66,0x5E,0x33,0x44,0x55,0x66,0x88,0x00,0x00,0x00,0x00,0x89,0x00,0x00,0x00,0x00,0x8A,0x00,0x00,0x00,0x00,0x8B,0x00,0x00,0x00,0x00})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( + new int[] {0x67,0x67,0x02,0x00,0x1b,0x03,0xc5,0x53,0x80,0x86,0xdf,0x01,0x90,0xc1,0x79,0x0b,0x34,0x82,0xdf,0x0f,0x01,0x57,0x02,0x08,0x00,0x01,0x3b,0xeb,0x00,0x34,0x24,0x01})))); + } } |