diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-10-26 07:19:42 +0400 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-10-26 07:19:42 +0400 |
commit | 464348b91591a684bc16cf3c207f38ca3f923daa (patch) | |
tree | 986db66d55174ee1243befa0b9a6fdf5fedf04f2 | |
parent | 8fd45f48667a40a9111d8833f5335cfee4ea1fd5 (diff) | |
download | trackermap-server-464348b91591a684bc16cf3c207f38ca3f923daa.tar.gz trackermap-server-464348b91591a684bc16cf3c207f38ca3f923daa.tar.bz2 trackermap-server-464348b91591a684bc16cf3c207f38ca3f923daa.zip |
Support MiniFinder command result
-rw-r--r-- | src/org/traccar/protocol/MiniFinderProtocolDecoder.java | 12 | ||||
-rw-r--r-- | test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java | 3 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java index 9ea8de0bf..2b7a960c4 100644 --- a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java +++ b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java @@ -143,7 +143,7 @@ public class MiniFinderProtocolDecoder extends BaseProtocolDecoder { } DeviceSession deviceSession = getDeviceSession(channel, remoteAddress); - if (deviceSession == null || !sentence.matches("![A-D],.*")) { + if (deviceSession == null || !sentence.matches("![3A-D],.*")) { return null; } @@ -153,7 +153,15 @@ public class MiniFinderProtocolDecoder extends BaseProtocolDecoder { String type = sentence.substring(1, 2); position.set(Position.KEY_TYPE, type); - if (type.equals("B") || type.equals("D")) { + if (type.equals("3")) { + + getLastLocation(position, null); + + position.set(Position.KEY_RESULT, sentence.substring(3)); + + return position; + + } else if (type.equals("B") || type.equals("D")) { Parser parser = new Parser(PATTERN_BD, sentence); if (!parser.matches()) { diff --git a/test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java b/test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java index e1f957c8a..afa930e5b 100644 --- a/test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java +++ b/test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java @@ -13,6 +13,9 @@ public class MiniFinderProtocolDecoderTest extends ProtocolTest { verifyNull(decoder, text( "!1,867273023933661,V07S.5701.1621,100")); + verifyAttributes(decoder, text( + "!3,ok")); + verifyNull(decoder, text( "!1,123456789012345")); |