aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/MeitrackProtocolEncoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-03-15 22:16:47 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-03-15 22:16:47 +1300
commitd8552cb2975ec8a78ed07e0ec0f1ba1c7d34086a (patch)
treee4857c25617e5fd8eb29fe92742ea60138475f74 /src/org/traccar/protocol/MeitrackProtocolEncoder.java
parent357209a5aafe18688d5bd230d3db1ddf3c79fd59 (diff)
downloadtrackermap-server-d8552cb2975ec8a78ed07e0ec0f1ba1c7d34086a.tar.gz
trackermap-server-d8552cb2975ec8a78ed07e0ec0f1ba1c7d34086a.tar.bz2
trackermap-server-d8552cb2975ec8a78ed07e0ec0f1ba1c7d34086a.zip
Implement send SMS Meitrack command
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;