aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)"));
+
}
}