aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2014-05-26 22:58:53 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2014-05-26 22:58:53 +1200
commit68ec6c08336f29545f1d02b26b2a014a0cefb9d9 (patch)
tree5a10560eee6f96d60aea6638a31bb4e6504e8021 /src
parent27e3540172417564f0b5f116bd7ac579da5b80b3 (diff)
downloadtrackermap-server-68ec6c08336f29545f1d02b26b2a014a0cefb9d9.tar.gz
trackermap-server-68ec6c08336f29545f1d02b26b2a014a0cefb9d9.tar.bz2
trackermap-server-68ec6c08336f29545f1d02b26b2a014a0cefb9d9.zip
Fix T322 response message (fix #419)
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/protocol/MeitrackProtocolDecoder.java7
1 files changed, 4 insertions, 3 deletions
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<Position> decodeBinaryMessage(Channel channel, ChannelBuffer buf) {
List<Position> positions = new LinkedList<Position>();
- 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);