diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-03-02 10:47:36 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-03-02 10:47:36 +1300 |
commit | f5d687b7adb86e259f7b1f3b04a48d625cf1ca5e (patch) | |
tree | eef1f44b391c1237eae0f5beb175b7c5188b7b98 /src/org/traccar/protocol/MeitrackProtocolDecoder.java | |
parent | ea5d08507fc82073bf198b2c3fffd90870d291d3 (diff) | |
download | trackermap-server-f5d687b7adb86e259f7b1f3b04a48d625cf1ca5e.tar.gz trackermap-server-f5d687b7adb86e259f7b1f3b04a48d625cf1ca5e.tar.bz2 trackermap-server-f5d687b7adb86e259f7b1f3b04a48d625cf1ca5e.zip |
Implement Meitrack photo request
Diffstat (limited to 'src/org/traccar/protocol/MeitrackProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/MeitrackProtocolDecoder.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java index e0ca01412..a920c6e76 100644 --- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java +++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java @@ -24,6 +24,7 @@ import java.util.regex.Pattern; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; +import org.traccar.Context; import org.traccar.helper.DateBuilder; import org.traccar.helper.Parser; import org.traccar.helper.PatternBuilder; @@ -237,10 +238,17 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { index = buf.indexOf(index + 1, buf.writerIndex(), (byte) ','); String type = buf.toString(index + 1, 3, Charset.defaultCharset()); - if (type.equals("CCC")) { - return decodeBinaryMessage(channel, remoteAddress, buf); - } else { - return decodeRegularMessage(channel, remoteAddress, buf); + switch (type) { + case "D03": + if (channel != null) { + String imei = Context.getIdentityManager().getDeviceById(getDeviceId()).getUniqueId(); + channel.write("@@O46," + imei + ",D00,camera_picture.jpg,0*00\r\n"); + } + return null; + case "CCC": + return decodeBinaryMessage(channel, remoteAddress, buf); + default: + return decodeRegularMessage(channel, remoteAddress, buf); } } |