aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/MeitrackProtocolEncoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/MeitrackProtocolEncoder.java')
-rw-r--r--src/org/traccar/protocol/MeitrackProtocolEncoder.java7
1 files changed, 7 insertions, 0 deletions
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;