diff options
-rw-r--r-- | src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java | 11 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java | 3 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java index 8a440e765..963c8646e 100644 --- a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java @@ -216,7 +216,10 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_TYPE, type); position.set(Position.KEY_VERSION_FW, values[index++]); - index += 1; // model + int model = Integer.parseInt(values[index++]); + if (model == 41) { + index += 1; // variant + } Network network = new Network(); @@ -249,6 +252,12 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { index += 1; // collaborative network } + if (model == 41) { + index += 1; // collaborative network + index += 1; // temperature + position.set(Position.KEY_MOTION, Integer.parseInt(values[index++]) == 2); + } + if (values[index].isEmpty()) { getLastLocation(position, null); diff --git a/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java index 67fa43dec..144045b2a 100644 --- a/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java @@ -12,6 +12,9 @@ public class SuntechProtocolDecoderTest extends ProtocolTest { var decoder = inject(new SuntechProtocolDecoder(null)); + verifyPosition(decoder, buffer( + "ST419STT;807587388;306;41;04;30062;724;2;-65;5221;255;30061;724;2;5221;0;0;30212;724;2;5221;0;0;30071;724;2;5221;0;0;30222;724;2;5221;0;0;30213;724;2;5221;0;0;30063;724;2;5221;0;0;3.92;1;0185;1;00010000;26.1;1;20240729;19:22:43;-22.754650;-043.437569;000.185;297.35;6;1")); + verifyAttribute(decoder, buffer( "UEX;1610020241;03FFFFFF;161;3.0.9;0;20240506;15:52:55;00006697;724;11;4EDA;33;-5.129240;-42.797868;0.00;0.00;11;1;00000001;00000000;24;GTSL|6|1|0|22574684|1|\r\n;A7;;164;0;11.82"), Position.KEY_DRIVER_UNIQUE_ID, "22574684"); |