diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-10-20 00:02:59 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-10-20 00:02:59 +1300 |
commit | f5d309d193d1549d29314310b9c2a7bf0caf42af (patch) | |
tree | dcc927320998178aa59dece3a78eab1a2b20d81b /src/org | |
parent | 4ba8252588c0d280434c83b9d855098be3a15dd9 (diff) | |
download | traccar-server-f5d309d193d1549d29314310b9c2a7bf0caf42af.tar.gz traccar-server-f5d309d193d1549d29314310b9c2a7bf0caf42af.tar.bz2 traccar-server-f5d309d193d1549d29314310b9c2a7bf0caf42af.zip |
Fix download photo command
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/traccar/protocol/MeitrackProtocolDecoder.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java index 4714e24ea..efc9c24db 100644 --- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java +++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java @@ -20,6 +20,7 @@ import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; import org.traccar.Context; import org.traccar.DeviceSession; +import org.traccar.helper.Checksum; import org.traccar.helper.Parser; import org.traccar.helper.PatternBuilder; import org.traccar.helper.UnitsConverter; @@ -313,7 +314,6 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { ChannelBuffer buf = (ChannelBuffer) msg; - // Find type int index = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) ','); index = buf.indexOf(index + 1, buf.writerIndex(), (byte) ','); @@ -323,7 +323,11 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { if (channel != null) { DeviceSession deviceSession = getDeviceSession(channel, remoteAddress); String imei = Context.getIdentityManager().getById(deviceSession.getDeviceId()).getUniqueId(); - channel.write("@@O46," + imei + ",D00,camera_picture.jpg,0*00\r\n"); + String content = "D00,camera_picture.jpg,0"; + int length = 1 + imei.length() + 1 + content.length() + 5; + String response = String.format("@@O%02d,%s,%s*", length, imei, content); + response += Checksum.sum(response) + "\r\n"; + channel.write(response); } return null; case "CCC": |