From 06e9cdeb61ceb6e2f52c2be2a47416ae6741c3ea Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 7 Aug 2019 08:54:40 -0700 Subject: Decode multiple temperature sensors --- src/main/java/org/traccar/protocol/GoSafeProtocolDecoder.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/main/java/org/traccar') 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; -- cgit v1.2.3