aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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: