diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-04-18 17:48:12 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-04-18 17:48:12 -0700 |
commit | 39c5734c2cfdb1ed92eb0801c73793c6603e394c (patch) | |
tree | 9f33885850015f5307d24fe8051e6f05a76e8e4d /src | |
parent | bfe7df0681c09fd3f9ca325da881301955ba040e (diff) | |
download | trackermap-server-39c5734c2cfdb1ed92eb0801c73793c6603e394c.tar.gz trackermap-server-39c5734c2cfdb1ed92eb0801c73793c6603e394c.tar.bz2 trackermap-server-39c5734c2cfdb1ed92eb0801c73793c6603e394c.zip |
Support tag decoding
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/protocol/EelinkProtocolDecoder.java | 16 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/EelinkProtocolDecoderTest.java | 3 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/EelinkProtocolDecoder.java b/src/main/java/org/traccar/protocol/EelinkProtocolDecoder.java index 41d76f37f..c3fe7121e 100644 --- a/src/main/java/org/traccar/protocol/EelinkProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/EelinkProtocolDecoder.java @@ -271,6 +271,22 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder { position.set(Position.PREFIX_TEMP + 2, buf.readShort() / 16.0); } + if (buf.readableBytes() >= 2) { + int count = buf.readUnsignedByte(); + buf.readUnsignedByte(); // id + for (int i = 1; i <= count; i++) { + position.set("tag" + i + "Id", ByteBufUtil.hexDump(buf.readSlice(6))); + buf.readUnsignedByte(); // signal level + buf.readUnsignedByte(); // reserved + buf.readUnsignedByte(); // model + buf.readUnsignedByte(); // version + position.set("tag" + i + "Battery", buf.readUnsignedShort() * 0.001); + position.set("tag" + i + "Temp", buf.readShort() / 256.0); + position.set("tag" + i + "Data", buf.readUnsignedShort()); + } + + } + } return position; diff --git a/src/test/java/org/traccar/protocol/EelinkProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/EelinkProtocolDecoderTest.java index e24da3173..24b419953 100644 --- a/src/test/java/org/traccar/protocol/EelinkProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/EelinkProtocolDecoderTest.java @@ -14,6 +14,9 @@ public class EelinkProtocolDecoderTest extends ProtocolTest { verifyNull(decoder, binary( "454C0027E753035254407167747167670100180002035254407167747100200205020500010432000086BD")); + verifyAttributes(decoder, binary( + "454C03EA2B040865284045749185676712013B001E5E8ED5A60000880ED8000000000000000000030003000000000000000000005C550000000000001102F1A00220F0FEA700B10C0BE91510001828D97ECC95D1C400B1030BFD16C00015B3B0FE237EC7C00001040BD816200019BDC691C032E6C000B1020C2015D00003C67480A034F7A30001040BDC1310001CE52429096FDCBA00B1020C1C15F0001F9AEB3CC9C8D49F0001040B7316200014C0A26B6495EFAB0001040ACC1A400013D6313E4CE3EED700B1030BF516800016BE49BD3E05EDB00001040BF01620001DDB15BDE209E4A800B10C0BE515300014BA13142CB0C7AA0001040BD815D00019D39722BB52DBA30001040BF317500011020C850118EFC50001020A8115F000188B659FD04CD1AD0001040BE816000014AC91F5C96BDBAC0001040BF214B0001495CDFA62B6D2AB00B10C0BDB15C00013676712014B001F5E8ED5AC0000880ED8000000000000000000030003000000000000000000005F8D0000000000001202B3B0FE237EC7C00001040BD816200019BDC691C032E6C000B1020C2015D00003C67480A034F7A30001040BDC1310001CE52429096FDCBA00B1020C1C15F0001FBE49BD3E05EDB00001040BF01620001DDB15BDE209E4A800B10C0BE515300014BA13142CB0C7AA0001040BD815D00019D39722BB52DBA30001040BF317500011020C850118EFC50001020A8115F000188B659FD04CD1AD0001040BE816000014AC91F5C96BDBAC0001040BF214B0001495CDFA62B6D2AB00B10C0BDB15C00013F1A00220F0FEA700B10C0BE9152000189AEB3CC9C8D4A30001040B731620001428D97ECC95D1C200B1030C0016C00015372CFB9E84C3A00029020F5100000000D6313E4CE3EED700B1030BF716800016C0A26B6495EFB10001040ACC1A400013676712014B00205E8ED5B10000880ED8000000000000000000030003000000000000000000005C550000000000001202B3B0FE237EC7C00001040BD816200019BDC691C032E6C000B1020C2015D00003DB15BDE209E4A800B10C0BE515300014BA13142CB0C7AA0001040BD815D00019D39722BB52DBA30001040BF317500011020C850118EFC50001020A8115F000188B659FD04CD1AD0001040BE81600001495CDFA62B6D2AB00B10C0BDB15C000139AEB3CC9C8D4A30001040B731620001428D97ECC95D1C200B1030C0016C00015372CFB9E84C3A00029020F5100000000C0A26B6495EFB10001040ACC1A400013BE49BD3E05EDA90001040BF01620001DAC91F5C96BDBA50001040BF014B00014F1A00220F0FE9F00B10C0BE915200018E52429096FDCC200B1020C1B15F0001FD6313E4CE3EED200B1030BF716800016C67480A034F7A40001040BDC1300001C")); + verifyAttribute(decoder, binary( "6767070006000e0077035d"), Position.KEY_IGNITION, true); |