From 9c5e97ce6176850bf4a88e90f6d758055a28f60e Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sat, 11 Feb 2017 21:10:20 -0500 Subject: Fixed MiniFinder protocol to work as per the Eview EV-07S documentation (from the original manufacturer); --- .../protocol/MiniFinderProtocolDecoder.java | 28 ++++++++-------------- 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java index 360df726a..738fd57b4 100644 --- a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java +++ b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java @@ -35,23 +35,19 @@ public class MiniFinderProtocolDecoder extends BaseProtocolDecoder { } private static final Pattern PATTERN = new PatternBuilder() - .expression("![A-D],") + .expression("![BD],") .number("(d+)/(d+)/(d+),") // date .number("(d+):(d+):(d+),") // time .number("(-?d+.d+),") // latitude .number("(-?d+.d+),") // longitude - .number("(d+.?d*),") // speed + .number("(d+.?d*),") // speed (km/h) .number("(d+.?d*),") // course - .groupBegin() .number("(x+),") // flags - .number("(-?d+.d+),") // altitude - .number("(d+),") // battery + .number("(-?d+.d+),") // altitude (meters) + .number("(d+),") // battery (percentage) .number("(d+),") // satellites in use .number("(d+),") // satellites in view - .text("0") - .or() - .any() - .groupEnd() + .number("(d+.?d*)") // HDOP, confirmed with Eview manufacturer .compile(); @Override @@ -64,7 +60,7 @@ public class MiniFinderProtocolDecoder extends BaseProtocolDecoder { getDeviceSession(channel, remoteAddress, sentence.substring(3, sentence.length())); - } else if (sentence.matches("![A-D].*")) { + } else if (sentence.matches("![BD].*")) { DeviceSession deviceSession = getDeviceSession(channel, remoteAddress); if (deviceSession == null) { @@ -94,8 +90,6 @@ public class MiniFinderProtocolDecoder extends BaseProtocolDecoder { position.setCourse(0); } - if (parser.hasNext(5)) { - int flags = parser.nextInt(16); position.setValid(BitUtil.check(flags, 0)); @@ -127,16 +121,14 @@ public class MiniFinderProtocolDecoder extends BaseProtocolDecoder { position.setAltitude(parser.nextDouble()); - position.set(Position.KEY_BATTERY, parser.next()); - position.set(Position.KEY_SATELLITES, parser.next()); - - } + position.set(Position.KEY_BATTERY, parser.nextInt()); + position.set(Position.KEY_SATELLITES, parser.nextInt()); + position.set(Position.KEY_SATELLITES_VISIBLE, parser.nextInt()); + position.set(Position.KEY_HDOP, parser.nextDouble()); return position; - } return null; } - } -- cgit v1.2.3