aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/MiniFinderProtocolDecoder.java27
1 files changed, 9 insertions, 18 deletions
diff --git a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
index bb0057964..9b4372c5b 100644
--- a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
+++ b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 - 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2014 - 2017 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,12 +48,6 @@ public class MiniFinderProtocolDecoder extends BaseProtocolDecoder {
.number("(d+),") // battery (percentage)
.compile();
- private static final Pattern PATTERN_GPS_PRECISION = new PatternBuilder()
- .number("(d+),") // satellites in use
- .number("(d+),") // satellites in view
- .number("(d+.?d*)") // hdop
- .compile();
-
private static final Pattern PATTERN_A = new PatternBuilder()
.text("!A,")
.expression(PATTERN_FIX.pattern())
@@ -67,12 +61,13 @@ public class MiniFinderProtocolDecoder extends BaseProtocolDecoder {
.any() // unknown 3 fields
.compile();
- // The !B (buffered data) records are the same as !D (live data) records.
private static final Pattern PATTERN_BD = new PatternBuilder()
- .expression("![BD],")
+ .expression("![BD],") // B - buffered, D - live
.expression(PATTERN_FIX.pattern())
.expression(PATTERN_STATE.pattern())
- .expression(PATTERN_GPS_PRECISION.pattern())
+ .number("(d+),") // satellites in use
+ .number("(d+),") // satellites in view
+ .number("(d+.?d*)") // hdop
.compile();
private void decodeFix(Position position, Parser parser) {
@@ -128,13 +123,6 @@ public class MiniFinderProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_BATTERY, parser.nextInt(0));
}
- private void decodeGPSPrecision(Position position, Parser parser) {
-
- position.set(Position.KEY_SATELLITES, parser.nextInt(0));
- position.set(Position.KEY_SATELLITES_VISIBLE, parser.nextInt(0));
- position.set(Position.KEY_HDOP, parser.nextDouble(0));
- }
-
@Override
protected Object decode(
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
@@ -167,7 +155,10 @@ public class MiniFinderProtocolDecoder extends BaseProtocolDecoder {
decodeFix(position, parser);
decodeState(position, parser);
- decodeGPSPrecision(position, parser);
+
+ position.set(Position.KEY_SATELLITES, parser.nextInt(0));
+ position.set(Position.KEY_SATELLITES_VISIBLE, parser.nextInt(0));
+ position.set(Position.KEY_HDOP, parser.nextDouble(0));
return position;