From 6af986e2bd05d6376c7ad25a4621f6466bff1b46 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 22 Jul 2018 10:28:27 +0800 Subject: Alternative Meitrack arm commands --- src/org/traccar/protocol/MeitrackProtocolEncoder.java | 8 ++++++-- 1 file 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 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"); -- cgit v1.2.3