aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-07-22 10:28:27 +0800
committerAnton Tananaev <anton.tananaev@gmail.com>2018-07-22 10:28:27 +0800
commit6af986e2bd05d6376c7ad25a4621f6466bff1b46 (patch)
tree6d1c54e9d81891b7c14dbe795d97191ff5bfd8e7 /src/org/traccar
parentbb56fa434bc9b6215269baffaf7c64f80ced079b (diff)
downloadtraccar-server-6af986e2bd05d6376c7ad25a4621f6466bff1b46.tar.gz
traccar-server-6af986e2bd05d6376c7ad25a4621f6466bff1b46.tar.bz2
traccar-server-6af986e2bd05d6376c7ad25a4621f6466bff1b46.zip
Alternative Meitrack arm commands
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/MeitrackProtocolEncoder.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/MeitrackProtocolEncoder.java b/src/org/traccar/protocol/MeitrackProtocolEncoder.java
index f73d74de9..af059508b 100644
--- a/src/org/traccar/protocol/MeitrackProtocolEncoder.java
+++ b/src/org/traccar/protocol/MeitrackProtocolEncoder.java
@@ -15,6 +15,7 @@
*/
package org.traccar.protocol;
+import org.traccar.Context;
import org.traccar.StringProtocolEncoder;
import org.traccar.helper.Checksum;
import org.traccar.helper.Log;
@@ -37,6 +38,9 @@ public class MeitrackProtocolEncoder extends StringProtocolEncoder {
Map<String, Object> attributes = command.getAttributes();
+ boolean alternative = Context.getIdentityManager().lookupAttributeBoolean(
+ command.getDeviceId(), "meitrack.alternative", false, true);
+
switch (command.getType()) {
case Command.TYPE_POSITION_SINGLE:
return formatCommand(command, 'Q', "A10");
@@ -45,9 +49,9 @@ public class MeitrackProtocolEncoder extends StringProtocolEncoder {
case Command.TYPE_ENGINE_RESUME:
return formatCommand(command, 'M', "C01,0,02222");
case Command.TYPE_ALARM_ARM:
- return formatCommand(command, 'M', "C01,0,22122");
+ return formatCommand(command, 'M', alternative ? "B21,1" : "C01,0,22122");
case Command.TYPE_ALARM_DISARM:
- return formatCommand(command, 'M', "C01,0,22022");
+ return formatCommand(command, 'M', alternative ? "B21,0" : "C01,0,22022");
case Command.TYPE_REQUEST_PHOTO:
int index = command.getInteger(Command.KEY_INDEX);
return formatCommand(command, 'D', "D03," + (index > 0 ? index : 1) + ",camera_picture.jpg");