From 955d19a1d4937f1650cbcc94731701b4637721f4 Mon Sep 17 00:00:00 2001 From: l-e-o-n-c-e <38976766+l-e-o-n-c-e@users.noreply.github.com> Date: Wed, 26 Jan 2022 21:29:23 +0100 Subject: Add an alarm code on Watch protocol Some 2G devices send a 00004000 code when the device is removed from its charger. This is very useful as many cheap devices have a strange magnet connector which is very easy to unplug by accident. If not working, the feature might have to be activated by sending AON,1# to the device. Does NOT work on 4G devices which send a "sos" alert in that situation (00010000). --- src/main/java/org/traccar/protocol/WatchProtocolDecoder.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/main/java/org') diff --git a/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java b/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java index 4990cfd65..527a21e7c 100644 --- a/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java @@ -89,6 +89,8 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder { return Position.ALARM_GEOFENCE_EXIT; } else if (BitUtil.check(status, 2)) { return Position.ALARM_GEOFENCE_ENTER; + } else if (BitUtil.check(status, 14)) { + return Position.ALARM_POWER_CUT; // some 2G devices raise this alarm when the device is unplugged from its charger } else if (BitUtil.check(status, 16)) { return Position.ALARM_SOS; } else if (BitUtil.check(status, 17)) { -- cgit v1.2.3