aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/GoSafeProtocolDecoder.java9
-rw-r--r--src/test/java/org/traccar/protocol/GoSafeProtocolDecoderTest.java6
2 files changed, 7 insertions, 8 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;
diff --git a/src/test/java/org/traccar/protocol/GoSafeProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/GoSafeProtocolDecoderTest.java
index 6a140d746..2ad080219 100644
--- a/src/test/java/org/traccar/protocol/GoSafeProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/GoSafeProtocolDecoderTest.java
@@ -12,8 +12,12 @@ public class GoSafeProtocolDecoderTest extends ProtocolTest {
GoSafeProtocolDecoder decoder = new GoSafeProtocolDecoder(null);
verifyAttribute(decoder, text(
+ "*GS06,356449068350122,013519070819,,SYS:G6S;V3.37;V1.1.8,GPS:A;12;N23.169866;E113.450728;0;255;54;0.79,COT:18779;,ADC:12.66;0.58,DTT:4084;E1;0;0;0;1,IWD:0;1;ad031652643fff28;23.2;1;1;86031652504fff28;24.3;2;1;e603165252a5ff28;24.2;3;1;bb0416557da6ff28;24.0#"),
+ Position.PREFIX_TEMP + 3, 24.0);
+
+ verifyAttribute(decoder, text(
"*GS06,351535058659335,081234310719,,SYS:G6S;V3.37;V1.1.8,GPS:A;10;N23.169758;E113.450640;0;323;47;0.82,COT:18539;,ADC:10.81;4.07,DTT:4000;E0;0;0;0;1,IWD:0;1;9f00000655705d28;22.5#"),
- Position.PREFIX_TEMP + 1, 22.5);
+ Position.PREFIX_TEMP + 0, 22.5);
verifyAttribute(decoder, text(
"*GS06,359568052580548,091946150719,1C,SYS:G3C;V1.40;V1.0.4,GPS:A;5;S25.750200;E28.204858;0;0;1337;1.68,COT:,ADC:13.12;4.06,DTT:4004;C6;0;0;10000000;0$091948150719,,SYS:G3C;V1.40;V1.0.4,GPS:A;5;S25.750200;E28.204858;0;0;1337;1.68,COT:,ADC:12.96;4.06,DTT:4004;C6;0;0;0;1#"),