aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-11-10 15:41:08 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2019-11-10 15:41:08 -0800
commitaefc13c7e57d4c6c8c9a22cdd8203f8d1d9f0878 (patch)
treef65a1b7890b6cc02b509d2e6c4f29f92cc731025 /src/main/java
parent9889611b00b6159fddbdddc236448884886fe2ef (diff)
downloadtrackermap-server-aefc13c7e57d4c6c8c9a22cdd8203f8d1d9f0878.tar.gz
trackermap-server-aefc13c7e57d4c6c8c9a22cdd8203f8d1d9f0878.tar.bz2
trackermap-server-aefc13c7e57d4c6c8c9a22cdd8203f8d1d9f0878.zip
Decode binary alerts
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java9
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;
}