aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValerii Vyshniak <valeravi@vi-soft.com.ua>2017-11-16 00:07:04 +0100
committerValerii Vyshniak <valeravi@vi-soft.com.ua>2017-11-18 18:51:50 +0100
commit2f98dd6c9f151f48d31ecd09ee06ccbcd4430b97 (patch)
treee90e27da953e8f347264bbe295471eed468a519a
parentfb9cbb2b74dc0060bd0dc5d0b3bfeb958ed6f3b5 (diff)
downloadtrackermap-server-2f98dd6c9f151f48d31ecd09ee06ccbcd4430b97.tar.gz
trackermap-server-2f98dd6c9f151f48d31ecd09ee06ccbcd4430b97.tar.bz2
trackermap-server-2f98dd6c9f151f48d31ecd09ee06ccbcd4430b97.zip
T580W: parse altitude and satellites num in GPS data packet
-rw-r--r--src/org/traccar/protocol/Tk103ProtocolDecoder.java13
-rw-r--r--test/org/traccar/protocol/Tk103ProtocolDecoderTest.java10
2 files changed, 23 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
index be3def453..1a5ada81b 100644
--- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
@@ -63,6 +63,10 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
.number("(?:L(x+))?") // odometer
.any()
.number("([+-]ddd.d)?") // temperature
+ .groupBegin()
+ .number("([+-]?d+.d{1,2}),").optional() // altitude
+ .number("(d+)$").optional() // number of visible satellites
+ .groupEnd("?")
.text(")").optional()
.compile();
@@ -299,6 +303,15 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.PREFIX_TEMP + 1, parser.nextDouble(0));
}
+ if (parser.hasNext()) {
+ position.setAltitude(parser.nextDouble(0));
+ }
+
+ if (parser.hasNext()) {
+ // Store amount of visible satellites as RSSI
+ position.set(Position.KEY_RSSI, parser.nextInt(0));
+ }
+
return position;
}
diff --git a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
index a69ff8856..3c17d2d11 100644
--- a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
@@ -159,6 +159,16 @@ public class Tk103ProtocolDecoderTest extends ProtocolTest {
verifyPosition(decoder, text(
"(094050000111BP05000094050000111150808A3804.2418N04616.7468E000.0201447133.3501000011L0028019DT000)"));
+ //T580W
+ verifyPosition(decoder, text(
+ "(864555555555555,DW3B,131117,A,5544.02870N,01315.08194E,1.597,223707,291.65,-0.10,4)"));
+
+ verifyPosition(decoder, text(
+ "(864555555555555,DW3B,131117,A,5544.02870N,01315.08194E,1.597,223707,291.65,0.10,8)"));
+
+ verifyPosition(decoder, text(
+ "(013632651491,ZC07,040613,A,2234.0297N,11405.9101E,000.0,040137,178.48)"));
+
}
}