diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-08-19 23:34:24 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-19 23:34:24 +0300 |
commit | 6b6d28695600fee509ee37a7225dd6518879ac9c (patch) | |
tree | 0b40718962f549b6ab963cf93e9de7cf3c105b13 /src/org/traccar/protocol/WialonProtocolDecoder.java | |
parent | 3826a93f1009942e22ec80c1e13be71e8e917b01 (diff) | |
parent | aaa16c01263847221c7cfec95d722b283dcfd35e (diff) | |
download | trackermap-server-6b6d28695600fee509ee37a7225dd6518879ac9c.tar.gz trackermap-server-6b6d28695600fee509ee37a7225dd6518879ac9c.tar.bz2 trackermap-server-6b6d28695600fee509ee37a7225dd6518879ac9c.zip |
Merge pull request #2231 from Abyss777/wialon_commands
Commands to Wialon protocol
Diffstat (limited to 'src/org/traccar/protocol/WialonProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/WialonProtocolDecoder.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/WialonProtocolDecoder.java b/src/org/traccar/protocol/WialonProtocolDecoder.java index 627b93b1c..0043354d5 100644 --- a/src/org/traccar/protocol/WialonProtocolDecoder.java +++ b/src/org/traccar/protocol/WialonProtocolDecoder.java @@ -24,6 +24,7 @@ import org.traccar.helper.PatternBuilder; import org.traccar.model.Position; import java.net.SocketAddress; +import java.util.Date; import java.util.LinkedList; import java.util.List; import java.util.regex.Matcher; @@ -171,6 +172,18 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder { return positions; } + } else if (sentence.startsWith("#M#")) { + DeviceSession deviceSession = getDeviceSession(channel, remoteAddress); + if (deviceSession != null) { + Position position = new Position(); + position.setProtocol(getProtocolName()); + position.setDeviceId(deviceSession.getDeviceId()); + getLastLocation(position, new Date()); + position.setValid(false); + position.set(Position.KEY_RESULT, sentence.substring(sentence.indexOf('#', 1) + 1)); + sendResponse(channel, "#AM#", 1); + return position; + } } return null; |