diff options
-rw-r--r-- | src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java | 5 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java index bee21982e..0e829e7f7 100644 --- a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java @@ -461,9 +461,11 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(deviceSession.getDeviceId()); position.set(Position.KEY_TYPE, type); - int mask = Integer.parseInt(values[index++], 16); + int mask; if (type.equals("BLE")) { mask = 0b1100000110110; + } else { + mask = Integer.parseInt(values[index++], 16); } if (BitUtil.check(mask, 1)) { @@ -518,7 +520,6 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { position.setValid(true); int count = Integer.parseInt(values[index++]); - index += 1; for (int i = 1; i <= count; i++) { position.set("tag" + i + "Rssi", Integer.parseInt(values[index++])); diff --git a/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java index 7f0700728..a9720f437 100644 --- a/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java @@ -83,7 +83,10 @@ public class SuntechProtocolDecoderTest extends ProtocolTest { var decoder = new SuntechProtocolDecoder(null); verifyPosition(decoder, buffer( - "BLE;0820012345;001FFF;82;1.0.0;20191203;17:00:51;+32.691615;-117.297160;2;2;-32;-100;33;AABBCCDDEEFF;12;18;52;1;-44;44;112233445566;32;69;101")); + "BLE;1140000053;114;1.0.1;20211001;17:27:09;+28.433465;-82.565891;1;-43;-46;-41;ACB89523EF68;247;0;0")); + + verifyPosition(decoder, buffer( + "BLE;0820012345;82;1.0.0;20191203;17:00:51;+32.691615;-117.297160;2;-32;-100;33;AABBCCDDEEFF;12;18;52;1;-44;44;112233445566;32;69;101")); verifyNull(decoder, buffer( "BSA;0820012345;001FFF;82;1.0.0;1;20191203;17:00:51;+32.691615;-117.297160;1;-55;68:11:6A:FD:1A:A7;6AA5;1DE8")); |