aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-05-26 02:24:37 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2019-05-26 02:24:37 -0700
commit48b03a977aff2de4532930e4d84f25606d4e7074 (patch)
treed361c16fd04e1d0284de27f37b3988e05c069199 /src/main/java/org/traccar/protocol
parenteedf41bb641a8429d3bfe624d9dcbbd543eec494 (diff)
downloadtrackermap-server-48b03a977aff2de4532930e4d84f25606d4e7074.tar.gz
trackermap-server-48b03a977aff2de4532930e4d84f25606d4e7074.tar.bz2
trackermap-server-48b03a977aff2de4532930e4d84f25606d4e7074.zip
Decode attribute values
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r--src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java
index bd485ca70..1ad984c60 100644
--- a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java
@@ -326,12 +326,28 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
case "UEX":
int remaining = Integer.parseInt(values[index++]);
while (remaining > 0) {
- String value = values[index++];
- String[] pair = value.split("=");
+ String attribute = values[index++];
+ String[] pair = attribute.split("=");
if (pair.length >= 2) {
- position.set(pair[0].toLowerCase(), pair[1].trim());
+ String value = pair[1].trim();
+ if (value.contains(".")) {
+ value = value.substring(0, value.indexOf('.'));
+ }
+ switch (pair[0].charAt(0)) {
+ case 't':
+ position.set(Position.PREFIX_TEMP + pair[0].charAt(2), Integer.parseInt(value, 16));
+ break;
+ case 'N':
+ position.set("fuel" + pair[0].charAt(2), Integer.parseInt(value, 16));
+ break;
+ case 'Q':
+ position.set("drivingQuality", Integer.parseInt(value, 16));
+ break;
+ default:
+ break;
+ }
}
- remaining -= value.length() + 1;
+ remaining -= attribute.length() + 1;
}
break;
default: