From 10da32b83608a882744212373e3ff4ff2716aadf Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 3 Aug 2019 18:07:01 -0700 Subject: Support temperature sensor --- .../java/org/traccar/protocol/GoSafeProtocolDecoder.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/main') diff --git a/src/main/java/org/traccar/protocol/GoSafeProtocolDecoder.java b/src/main/java/org/traccar/protocol/GoSafeProtocolDecoder.java index ebc7e7c04..c97017d65 100644 --- a/src/main/java/org/traccar/protocol/GoSafeProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/GoSafeProtocolDecoder.java @@ -163,6 +163,18 @@ public class GoSafeProtocolDecoder extends BaseProtocolDecoder { position.set("tagData", values[index++]); break; case "IWD": + while (index < values.length) { + index += 1; // data identifier + 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++])); + + } + } + if (index < values.length && values[index + 1].equals("0")) { position.set(Position.KEY_DRIVER_UNIQUE_ID, values[index + 2]); } -- cgit v1.2.3