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(+) 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 From 4b43eee0a571ea9d62854cdeb0891166c103bb7d 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:38:58 +0100 Subject: Update WatchProtocolDecoder.java --- src/main/java/org/traccar/protocol/WatchProtocolDecoder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java b/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java index 527a21e7c..557832f05 100644 --- a/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java @@ -90,7 +90,7 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder { } 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 + return Position.ALARM_POWER_CUT; // raised by some 2G devices when unplugged from their charger } else if (BitUtil.check(status, 16)) { return Position.ALARM_SOS; } else if (BitUtil.check(status, 17)) { -- cgit v1.2.3 From b77326b34401d8df3674d4de1e3efd44dde7081b 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:45:44 +0100 Subject: Update WatchProtocolDecoder.java Removed the comment as requested by Anton (but I found it useful since the status "POWER_CUT"I used could be confusing imo) --- src/main/java/org/traccar/protocol/WatchProtocolDecoder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java b/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java index 557832f05..cf58b0fed 100644 --- a/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java @@ -90,7 +90,7 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder { } else if (BitUtil.check(status, 2)) { return Position.ALARM_GEOFENCE_ENTER; } else if (BitUtil.check(status, 14)) { - return Position.ALARM_POWER_CUT; // raised by some 2G devices when unplugged from their charger + return Position.ALARM_POWER_CUT; } else if (BitUtil.check(status, 16)) { return Position.ALARM_SOS; } else if (BitUtil.check(status, 17)) { -- cgit v1.2.3