aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-05-17 10:47:14 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-05-17 10:47:14 -0700
commit6623c725111f2439cb80861a006b887a2df291fa (patch)
treedbaa55c1c5bce74d1968368752a58005f9c972c6 /src/main/java/org/traccar/protocol
parent58dc2de1f80e3279c17405edf28c4deac231e7d9 (diff)
downloadtrackermap-server-6623c725111f2439cb80861a006b887a2df291fa.tar.gz
trackermap-server-6623c725111f2439cb80861a006b887a2df291fa.tar.bz2
trackermap-server-6623c725111f2439cb80861a006b887a2df291fa.zip
Decode movement sensor
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r--src/main/java/org/traccar/protocol/SolarPoweredProtocolDecoder.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/protocol/SolarPoweredProtocolDecoder.java b/src/main/java/org/traccar/protocol/SolarPoweredProtocolDecoder.java
index 30cbf9217..a1ce7c649 100644
--- a/src/main/java/org/traccar/protocol/SolarPoweredProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/SolarPoweredProtocolDecoder.java
@@ -87,20 +87,23 @@ public class SolarPoweredProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(buf.readUnsignedByte());
break;
case 0x82:
- buf.readUnsignedByte(); // alarm mask
+ int alarmMask = buf.readUnsignedByte();
int alarm = buf.readUnsignedByte();
- if (BitUtil.check(alarm, 0)) {
+ if (BitUtil.check(alarmMask, 0) && BitUtil.check(alarm, 0)) {
position.set(Position.KEY_ALARM, Position.ALARM_TAMPERING);
}
- if (BitUtil.check(alarm, 1)) {
+ if (BitUtil.check(alarmMask, 1) && BitUtil.check(alarm, 1)) {
position.set(Position.KEY_ALARM, Position.ALARM_LOW_POWER);
}
- if (BitUtil.check(alarm, 2)) {
+ if (BitUtil.check(alarmMask, 2) && BitUtil.check(alarm, 2)) {
position.set(Position.KEY_ALARM, Position.ALARM_SOS);
}
- if (BitUtil.check(alarm, 3)) {
+ if (BitUtil.check(alarmMask, 3) && BitUtil.check(alarm, 3)) {
position.set(Position.KEY_ALARM, Position.ALARM_FALL_DOWN);
}
+ if (BitUtil.check(alarmMask, 4)) {
+ position.set(Position.ALARM_MOVEMENT, BitUtil.check(alarm, 4));
+ }
break;
case 0x83:
buf.readUnsignedInt(); // uptime