diff options
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r-- | src/org/traccar/protocol/MeitrackProtocol.java | 3 | ||||
-rw-r--r-- | src/org/traccar/protocol/MeitrackProtocolEncoder.java | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/MeitrackProtocol.java b/src/org/traccar/protocol/MeitrackProtocol.java index e5b5ddf2b..a004d5cb6 100644 --- a/src/org/traccar/protocol/MeitrackProtocol.java +++ b/src/org/traccar/protocol/MeitrackProtocol.java @@ -36,7 +36,8 @@ public class MeitrackProtocol extends BaseProtocol { Command.TYPE_ENGINE_RESUME, Command.TYPE_ALARM_ARM, Command.TYPE_ALARM_DISARM, - Command.TYPE_REQUEST_PHOTO); + Command.TYPE_REQUEST_PHOTO, + Command.TYPE_SEND_SMS); } @Override diff --git a/src/org/traccar/protocol/MeitrackProtocolEncoder.java b/src/org/traccar/protocol/MeitrackProtocolEncoder.java index 381935c58..04cb39637 100644 --- a/src/org/traccar/protocol/MeitrackProtocolEncoder.java +++ b/src/org/traccar/protocol/MeitrackProtocolEncoder.java @@ -20,6 +20,8 @@ import org.traccar.helper.Checksum; import org.traccar.helper.Log; import org.traccar.model.Command; +import java.util.Map; + public class MeitrackProtocolEncoder extends StringProtocolEncoder { private Object formatCommand(Command command, char dataId, String content) { @@ -33,6 +35,8 @@ public class MeitrackProtocolEncoder extends StringProtocolEncoder { @Override protected Object encodeCommand(Command command) { + Map<String, Object> attributes = command.getAttributes(); + switch (command.getType()) { case Command.TYPE_POSITION_SINGLE: return formatCommand(command, 'Q', "A10"); @@ -46,6 +50,9 @@ public class MeitrackProtocolEncoder extends StringProtocolEncoder { return formatCommand(command, 'M', "C01,0,22022"); case Command.TYPE_REQUEST_PHOTO: return formatCommand(command, 'D', "D03,1,camera_picture.jpg"); + case Command.TYPE_SEND_SMS: + return formatCommand(command, 'f', "C02,0," + + attributes.get(Command.KEY_PHONE_NUMBER) + "," + attributes.get(Command.KEY_MESSAGE)); default: Log.warning(new UnsupportedOperationException(command.getType())); break; |