diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-02-04 22:33:53 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-02-04 22:33:53 -0800 |
commit | 2c0563a4f7d4c89551c23c13f17249b5f1b4665a (patch) | |
tree | 2d273bd6a46281ef1346f1a76f7691d656fde439 /src/main/java/org/traccar/protocol | |
parent | 7e9c68727d65c858264a493003f73195e4f51210 (diff) | |
download | trackermap-server-2c0563a4f7d4c89551c23c13f17249b5f1b4665a.tar.gz trackermap-server-2c0563a4f7d4c89551c23c13f17249b5f1b4665a.tar.bz2 trackermap-server-2c0563a4f7d4c89551c23c13f17249b5f1b4665a.zip |
Implement support for iButton
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r-- | src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java index 915f764e1..7e520ab3a 100644 --- a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java @@ -614,10 +614,21 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_OUTPUT, buf.readUnsignedByte()); } + int alertId = 0; if (BitUtil.check(mask, 19)) { - int value = buf.readUnsignedByte(); + alertId = buf.readUnsignedByte(); if (type == 0x82) { - position.set(Position.KEY_ALARM, decodeAlert(value)); + position.set(Position.KEY_ALARM, decodeAlert(alertId)); + } + } + + if (BitUtil.check(mask, 20)) { + buf.readUnsignedShort(); // alert mod + } + + if (BitUtil.check(mask, 21)) { + if (alertId == 59) { + position.set(Position.KEY_DRIVER_UNIQUE_ID, ByteBufUtil.hexDump(buf.readSlice(8))); } } |