From 854e4c6f1de4620b86842ebd5f21aa26b3f13f2f Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 25 Mar 2020 21:46:33 -0700 Subject: Decode alarm values --- .../traccar/protocol/SolarPoweredProtocolDecoder.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/main') 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 -- cgit v1.2.3