diff options
author | jon-stumpf <jon.stumpf@gmail.com> | 2017-02-11 21:10:20 -0500 |
---|---|---|
committer | jon-stumpf <jon.stumpf@gmail.com> | 2017-02-11 21:10:20 -0500 |
commit | 9c5e97ce6176850bf4a88e90f6d758055a28f60e (patch) | |
tree | 96ed6061c7097ac0d923f3d36287a094998c0140 /src/org/traccar | |
parent | 37d4bd765541a925bdf67ad134475dd1aaf92ca4 (diff) | |
download | trackermap-server-9c5e97ce6176850bf4a88e90f6d758055a28f60e.tar.gz trackermap-server-9c5e97ce6176850bf4a88e90f6d758055a28f60e.tar.bz2 trackermap-server-9c5e97ce6176850bf4a88e90f6d758055a28f60e.zip |
Fixed MiniFinder protocol to work as per the Eview EV-07S documentation (from the original manufacturer);
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/protocol/MiniFinderProtocolDecoder.java | 28 |
1 files changed, 10 insertions, 18 deletions
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; } - } |