aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-08-28 02:58:43 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-08-28 02:58:43 +1200
commit1756cad4ad66f1b5e932c51a8c0891e27d705ec6 (patch)
treeae8ba8e92c3f313e2dcc42808740c91bc2adb778
parent2e6c2fd5a6ed500f3d169131295fc8c5923e81b2 (diff)
downloadtraccar-server-1756cad4ad66f1b5e932c51a8c0891e27d705ec6.tar.gz
traccar-server-1756cad4ad66f1b5e932c51a8c0891e27d705ec6.tar.bz2
traccar-server-1756cad4ad66f1b5e932c51a8c0891e27d705ec6.zip
Save Watch movement alert as motion
-rw-r--r--src/org/traccar/protocol/WatchProtocolDecoder.java8
-rw-r--r--test/org/traccar/protocol/WatchProtocolDecoderTest.java3
2 files changed, 8 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/WatchProtocolDecoder.java b/src/org/traccar/protocol/WatchProtocolDecoder.java
index 57f5d7e78..adab65245 100644
--- a/src/org/traccar/protocol/WatchProtocolDecoder.java
+++ b/src/org/traccar/protocol/WatchProtocolDecoder.java
@@ -76,8 +76,6 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder {
return Position.ALARM_GEOFENCE_ENTER;
} else if (BitUtil.check(status, 3)) {
return Position.ALARM_OVERSPEED;
- } else if (BitUtil.check(status, 4)) {
- return Position.ALARM_MOVEMENT;
} else if (BitUtil.check(status, 16)) {
return Position.ALARM_SOS;
} else if (BitUtil.check(status, 17)) {
@@ -209,7 +207,11 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder {
position.set("steps", parser.nextInt(0));
- position.set(Position.KEY_ALARM, decodeAlarm(parser.nextHexInt(0)));
+ int status = parser.nextHexInt(0);
+ position.set(Position.KEY_ALARM, decodeAlarm(status));
+ if (BitUtil.check(status, 4)) {
+ position.set(Position.KEY_MOTION, true);
+ }
decodeTail(position, parser.next());
diff --git a/test/org/traccar/protocol/WatchProtocolDecoderTest.java b/test/org/traccar/protocol/WatchProtocolDecoderTest.java
index ef77857a3..c960ccc25 100644
--- a/test/org/traccar/protocol/WatchProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/WatchProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class WatchProtocolDecoderTest extends ProtocolTest {
WatchProtocolDecoder decoder = new WatchProtocolDecoder(new WatchProtocol());
verifyPosition(decoder, buffer(
+ "[3G*8308373902*0080*AL,230817,095346,A,47.083950,N,15.4821850,E,7.60,273.8,0.0,4,15,44,0,0,00200010,2,255,232,1,7605,42530,118,7605,58036,119,0,65.8]"));
+
+ verifyPosition(decoder, buffer(
"[SG*9051007430*006C*UD,150817,132115,V,28.435142,N,81.354333,W,2.2038,000,99,00,70,100,0,50,00000000,1,1,310,260,1091,30082,139,,00]"));
verifyPosition(decoder, buffer(