From 68ec6c08336f29545f1d02b26b2a014a0cefb9d9 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 26 May 2014 22:58:53 +1200 Subject: Fix T322 response message (fix #419) --- src/org/traccar/protocol/MeitrackProtocolDecoder.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/org') diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java index 3d3d31002..9e30b885a 100644 --- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java +++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java @@ -29,7 +29,6 @@ import org.jboss.netty.channel.ChannelHandlerContext; import org.traccar.BaseProtocolDecoder; import org.traccar.ServerManager; import org.traccar.helper.ChannelBufferTools; -import org.traccar.helper.Crc; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; @@ -156,7 +155,8 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { private List decodeBinaryMessage(Channel channel, ChannelBuffer buf) { List positions = new LinkedList(); - Integer index = ChannelBufferTools.find(buf, 0, buf.readableBytes(), ","); + String flag = buf.toString(2, 1, Charset.defaultCharset()); + int index = ChannelBufferTools.find(buf, 0, buf.readableBytes(), ","); // Identification long deviceId; @@ -228,7 +228,8 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { // Delete recorded data if (channel != null) { - StringBuilder command = new StringBuilder("@@W28,"); + StringBuilder command = new StringBuilder("@@"); + command.append(flag).append(27 + positions.size() / 10).append(","); command.append(imei).append(",CCC,").append(positions.size()).append("*"); int checksum = 0; for (int i = 0; i < command.length(); i += 1) checksum += command.charAt(i); -- cgit v1.2.3