diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-03-25 21:46:33 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-03-25 21:46:33 -0700 |
commit | 854e4c6f1de4620b86842ebd5f21aa26b3f13f2f (patch) | |
tree | 8eba70ff406001a3421ff548374d4b71d62f2132 | |
parent | 01bdaf38fe425a15310a36b059a862bca661159e (diff) | |
download | trackermap-server-854e4c6f1de4620b86842ebd5f21aa26b3f13f2f.tar.gz trackermap-server-854e4c6f1de4620b86842ebd5f21aa26b3f13f2f.tar.bz2 trackermap-server-854e4c6f1de4620b86842ebd5f21aa26b3f13f2f.zip |
Decode alarm values
-rw-r--r-- | src/main/java/org/traccar/protocol/SolarPoweredProtocolDecoder.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/SolarPoweredProtocolDecoder.java b/src/main/java/org/traccar/protocol/SolarPoweredProtocolDecoder.java index 6fe54b0b0..30cbf9217 100644 --- a/src/main/java/org/traccar/protocol/SolarPoweredProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/SolarPoweredProtocolDecoder.java @@ -86,6 +86,22 @@ public class SolarPoweredProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_BATTERY, buf.readUnsignedByte() * 0.02); position.setCourse(buf.readUnsignedByte()); break; + case 0x82: + buf.readUnsignedByte(); // alarm mask + int alarm = buf.readUnsignedByte(); + if (BitUtil.check(alarm, 0)) { + position.set(Position.KEY_ALARM, Position.ALARM_TAMPERING); + } + if (BitUtil.check(alarm, 1)) { + position.set(Position.KEY_ALARM, Position.ALARM_LOW_POWER); + } + if (BitUtil.check(alarm, 2)) { + position.set(Position.KEY_ALARM, Position.ALARM_SOS); + } + if (BitUtil.check(alarm, 3)) { + position.set(Position.KEY_ALARM, Position.ALARM_FALL_DOWN); + } + break; case 0x83: buf.readUnsignedInt(); // uptime buf.readUnsignedInt(); // gps count |