diff options
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r-- | src/org/traccar/protocol/MeitrackProtocolEncoder.java | 8 |
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"); |