aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-12-08 14:42:17 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2019-12-08 14:42:17 -0800
commit90416b230c97c470b0b942c643fce2bb5afbcb5d (patch)
treeef400e62815a27f6fbc59aae748acfb506c7e1c7 /src/main
parent9a5891a1d2fdca01a04b4f47db375347b504322b (diff)
downloadtrackermap-server-90416b230c97c470b0b942c643fce2bb5afbcb5d.tar.gz
trackermap-server-90416b230c97c470b0b942c643fce2bb5afbcb5d.tar.bz2
trackermap-server-90416b230c97c470b0b942c643fce2bb5afbcb5d.zip
Decode additional attributes
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java34
1 files changed, 30 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java b/src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java
index 2a06d35e5..7ad99b37e 100644
--- a/src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java
@@ -36,10 +36,18 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
}
private static final Pattern PATTERN_HEADER = new PatternBuilder()
- .number("#(d+)#") // imei
- .any()
- .expression("#([^#]+)#") // status
- .number("d+") // number of records
+ .number("#(d+)") // imei
+ .expression("#[^#]*") // user
+ .number("#d+") // password
+ .groupBegin()
+ .number("#([01])") // door
+ .number("#(d+)") // fuel voltage
+ .number("#(d+)") // power
+ .number("#(d+)") // battery
+ .number("#(d+)") // temperature
+ .groupEnd("?")
+ .expression("#([^#]+)") // status
+ .number("#d+") // number of records
.compile();
private static final Pattern PATTERN_POSITION = new PatternBuilder()
@@ -114,6 +122,19 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
return null;
}
+ Boolean door = null;
+ Double adc = null;
+ Double power = null;
+ Double battery = null;
+ Double temperature = null;
+ if (parser.hasNext(5)) {
+ door = parser.nextInt() == 1;
+ adc = parser.nextInt() * 0.1;
+ power = parser.nextInt() * 0.1;
+ battery = parser.nextInt() * 0.1;
+ temperature = parser.nextInt() * 0.1;
+ }
+
String status = parser.next();
String[] messages = sentence.substring(sentence.indexOf('\n') + 1).split("\r\n");
@@ -140,6 +161,11 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
dateBuilder.setDateReverse(parser.nextInt(0), parser.nextInt(0), parser.nextInt(0));
position.setTime(dateBuilder.getDate());
+ position.set(Position.KEY_DOOR, door);
+ position.set(Position.PREFIX_ADC + 1, adc);
+ position.set(Position.KEY_POWER, power);
+ position.set(Position.KEY_BATTERY, battery);
+ position.set(Position.PREFIX_TEMP + 1, temperature);
decodeStatus(position, status);
positions.add(position);