From aaa16c01263847221c7cfec95d722b283dcfd35e Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Fri, 19 Aug 2016 19:49:11 +0500 Subject: - Added commands to WialonProtocol - Added more additional fields to CommandDialog --- src/org/traccar/protocol/WialonProtocolDecoder.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/org/traccar/protocol/WialonProtocolDecoder.java') 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; -- cgit v1.2.3