diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-07-23 01:26:41 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-07-23 01:31:08 +1200 |
commit | 83d2fdc694ca75eaef53adef76dad938e1bd6262 (patch) | |
tree | 4cfdb03a5b9ec5993c280bec1abe9ec4e37781fe /src/org/traccar/protocol/Gt02ProtocolDecoder.java | |
parent | 8e5441831a6b70fa2af12385c530fd40e56898ae (diff) | |
download | trackermap-server-83d2fdc694ca75eaef53adef76dad938e1bd6262.tar.gz trackermap-server-83d2fdc694ca75eaef53adef76dad938e1bd6262.tar.bz2 trackermap-server-83d2fdc694ca75eaef53adef76dad938e1bd6262.zip |
Support GT02 command responses
Diffstat (limited to 'src/org/traccar/protocol/Gt02ProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/Gt02ProtocolDecoder.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/Gt02ProtocolDecoder.java b/src/org/traccar/protocol/Gt02ProtocolDecoder.java index d93b93b83..dea1416ac 100644 --- a/src/org/traccar/protocol/Gt02ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gt02ProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 - 2015 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2012 - 2016 Anton Tananaev (anton.tananaev@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ import org.traccar.helper.UnitsConverter; import org.traccar.model.Position; import java.net.SocketAddress; +import java.nio.charset.StandardCharsets; public class Gt02ProtocolDecoder extends BaseProtocolDecoder { @@ -33,8 +34,9 @@ public class Gt02ProtocolDecoder extends BaseProtocolDecoder { super(protocol); } - public static final int MSG_HEARTBEAT = 0x1A; public static final int MSG_DATA = 0x10; + public static final int MSG_HEARTBEAT = 0x1A; + public static final int MSG_RESPONSE = 0x1C; @Override protected Object decode( @@ -102,6 +104,13 @@ public class Gt02ProtocolDecoder extends BaseProtocolDecoder { position.setLatitude(latitude); position.setLongitude(longitude); + } else if (type == MSG_RESPONSE) { + + getLastLocation(position, null); + + position.set(Position.KEY_RESULT, + buf.readBytes(buf.readUnsignedByte()).toString(StandardCharsets.US_ASCII)); + } else { return null; |