diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-11-10 15:41:08 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2019-11-10 15:41:08 -0800 |
commit | aefc13c7e57d4c6c8c9a22cdd8203f8d1d9f0878 (patch) | |
tree | f65a1b7890b6cc02b509d2e6c4f29f92cc731025 /src/main | |
parent | 9889611b00b6159fddbdddc236448884886fe2ef (diff) | |
download | traccar-server-aefc13c7e57d4c6c8c9a22cdd8203f8d1d9f0878.tar.gz traccar-server-aefc13c7e57d4c6c8c9a22cdd8203f8d1d9f0878.tar.bz2 traccar-server-aefc13c7e57d4c6c8c9a22cdd8203f8d1d9f0878.zip |
Decode binary alerts
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java index 951a5e17b..08d8252a3 100644 --- a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java @@ -508,7 +508,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { private Position decodeBinary( Channel channel, SocketAddress remoteAddress, ByteBuf buf) { - buf.readUnsignedByte(); // header + int type = buf.readUnsignedByte(); buf.readUnsignedShort(); // length DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, ByteBufUtil.hexDump(buf.readSlice(5))); @@ -603,6 +603,13 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_OUTPUT, buf.readUnsignedByte()); } + if (BitUtil.check(mask, 19)) { + int value = buf.readUnsignedByte(); + if (type == 0x82) { + position.set(Position.KEY_ALARM, decodeAlert(value)); + } + } + return position; } |