From 2f98dd6c9f151f48d31ecd09ee06ccbcd4430b97 Mon Sep 17 00:00:00 2001 From: Valerii Vyshniak Date: Thu, 16 Nov 2017 00:07:04 +0100 Subject: T580W: parse altitude and satellites num in GPS data packet --- src/org/traccar/protocol/Tk103ProtocolDecoder.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/org/traccar/protocol') 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; } -- cgit v1.2.3