diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-08-03 18:07:01 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2019-08-03 18:07:07 -0700 |
commit | 10da32b83608a882744212373e3ff4ff2716aadf (patch) | |
tree | e00ea42eb6117873c3688e005125c44e5037f7fe /src/main/java/org/traccar/protocol | |
parent | 1417443c6023f71a16d7b17549e2601c8cd05c2d (diff) | |
download | traccar-server-10da32b83608a882744212373e3ff4ff2716aadf.tar.gz traccar-server-10da32b83608a882744212373e3ff4ff2716aadf.tar.bz2 traccar-server-10da32b83608a882744212373e3ff4ff2716aadf.zip |
Support temperature sensor
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r-- | src/main/java/org/traccar/protocol/GoSafeProtocolDecoder.java | 12 |
1 files changed, 12 insertions, 0 deletions
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]); } |