aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-04-26 17:06:43 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-04-26 17:07:00 +1200
commit1f3185d8a06f5d8cd3c05c15cbb7abbbfa81af37 (patch)
treef45f77fc14943215dd6112bf10decd7e5cb90ee9 /src/org/traccar/protocol
parent1669e9c453f6bf2add655bbb2cf48b68bbbfb503 (diff)
downloadtrackermap-server-1f3185d8a06f5d8cd3c05c15cbb7abbbfa81af37.tar.gz
trackermap-server-1f3185d8a06f5d8cd3c05c15cbb7abbbfa81af37.tar.bz2
trackermap-server-1f3185d8a06f5d8cd3c05c15cbb7abbbfa81af37.zip
Implement additional Xirgo attributes
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/XirgoProtocolDecoder.java39
1 files changed, 36 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/XirgoProtocolDecoder.java b/src/org/traccar/protocol/XirgoProtocolDecoder.java
index c6d4b6978..77327e001 100644
--- a/src/org/traccar/protocol/XirgoProtocolDecoder.java
+++ b/src/org/traccar/protocol/XirgoProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 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.
@@ -75,6 +75,23 @@ public class XirgoProtocolDecoder extends BaseProtocolDecoder {
.number("(d+.d+),") // battery
.number("(d+),") // gsm
.number("(d+),") // gps
+ .groupBegin()
+ .number("d,") // reset mode
+ .expression("([01])") // input 1
+ .expression("([01])") // input 1
+ .expression("([01])") // input 1
+ .expression("([01]),") // output 1
+ .number("(d+.?d*),") // adc 1
+ .number("(d+.?d*),") // fuel level
+ .number("d+,") // engine load
+ .number("(d+),") // engine hours
+ .number("(d+),") // oil pressure
+ .number("(d+),") // oil level
+ .number("(-?d+),") // oil temperature
+ .number("(d+),") // coolant pressure
+ .number("(d+),") // coolant level
+ .number("(-?d+)") // coolant temperature
+ .groupEnd("?")
.any()
.compile();
@@ -131,7 +148,7 @@ public class XirgoProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_HDOP, parser.next());
if (newFormat) {
- position.set(Position.KEY_ODOMETER, parser.nextDouble(0) * 1609.34);
+ position.set(Position.KEY_ODOMETER, UnitsConverter.metersFromMiles(parser.nextDouble(0)));
position.set(Position.KEY_FUEL_CONSUMPTION, parser.next());
}
@@ -139,11 +156,27 @@ public class XirgoProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_RSSI, parser.next());
if (!newFormat) {
- position.set(Position.KEY_ODOMETER, parser.nextDouble(0) * 1609.34);
+ position.set(Position.KEY_ODOMETER, UnitsConverter.metersFromMiles(parser.nextDouble(0)));
}
position.setValid(parser.nextInt(0) == 1);
+ if (newFormat && parser.hasNext(13)) {
+ position.set(Position.PREFIX_IN + 1, parser.nextInt());
+ position.set(Position.PREFIX_IN + 2, parser.nextInt());
+ position.set(Position.PREFIX_IN + 3, parser.nextInt());
+ position.set(Position.PREFIX_OUT + 1, parser.nextInt());
+ position.set(Position.PREFIX_ADC + 1, parser.nextDouble());
+ position.set(Position.KEY_FUEL_LEVEL, parser.nextDouble());
+ position.set(Position.KEY_HOURS, parser.nextInt());
+ position.set("oilPressure", parser.nextInt());
+ position.set("oilLevel", parser.nextInt());
+ position.set("oilTemp", parser.nextInt());
+ position.set("coolantPressure", parser.nextInt());
+ position.set("coolantLevel", parser.nextInt());
+ position.set("coolantTemp", parser.nextInt());
+ }
+
return position;
}