aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-08-07 08:54:40 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2019-08-07 08:54:40 -0700
commit06e9cdeb61ceb6e2f52c2be2a47416ae6741c3ea (patch)
tree41ee43662cdd69aa487ab10c6ca43175d3585a2f /src/main/java/org/traccar/protocol
parent822abea747bb79ff72e3f54cc968c37a73beb73d (diff)
downloadtrackermap-server-06e9cdeb61ceb6e2f52c2be2a47416ae6741c3ea.tar.gz
trackermap-server-06e9cdeb61ceb6e2f52c2be2a47416ae6741c3ea.tar.bz2
trackermap-server-06e9cdeb61ceb6e2f52c2be2a47416ae6741c3ea.zip
Decode multiple temperature sensors
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r--src/main/java/org/traccar/protocol/GoSafeProtocolDecoder.java9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/main/java/org/traccar/protocol/GoSafeProtocolDecoder.java b/src/main/java/org/traccar/protocol/GoSafeProtocolDecoder.java
index c97017d65..76278070e 100644
--- a/src/main/java/org/traccar/protocol/GoSafeProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/GoSafeProtocolDecoder.java
@@ -164,20 +164,15 @@ public class GoSafeProtocolDecoder extends BaseProtocolDecoder {
break;
case "IWD":
while (index < values.length) {
- index += 1; // data identifier
+ int sensorIndex = Integer.parseInt(values[index++]);
int dataType = Integer.parseInt(values[index++]);
if (dataType == 0) {
position.set(Position.KEY_DRIVER_UNIQUE_ID, values[index++]);
} else if (dataType == 1) {
index += 1; // temperature sensor serial number
- position.set(Position.PREFIX_TEMP + 1, Double.parseDouble(values[index++]));
-
+ position.set(Position.PREFIX_TEMP + sensorIndex, Double.parseDouble(values[index++]));
}
}
-
- if (index < values.length && values[index + 1].equals("0")) {
- position.set(Position.KEY_DRIVER_UNIQUE_ID, values[index + 2]);
- }
break;
default:
break;