aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
authorl-e-o-n-c-e <38976766+l-e-o-n-c-e@users.noreply.github.com>2022-01-26 21:29:23 +0100
committerGitHub <noreply@github.com>2022-01-26 21:29:23 +0100
commit955d19a1d4937f1650cbcc94731701b4637721f4 (patch)
treef66af45a6ce881ba7a8d3a8fc3278d288d038b06 /src/main/java/org
parentafee330248c3e39029102ab984382ae9723895ae (diff)
downloadtrackermap-server-955d19a1d4937f1650cbcc94731701b4637721f4.tar.gz
trackermap-server-955d19a1d4937f1650cbcc94731701b4637721f4.tar.bz2
trackermap-server-955d19a1d4937f1650cbcc94731701b4637721f4.zip
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).
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/traccar/protocol/WatchProtocolDecoder.java2
1 files changed, 2 insertions, 0 deletions
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)) {