diff options
author | Anton Tananaev <anton@traccar.org> | 2022-10-17 16:54:56 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-10-17 16:54:56 -0700 |
commit | dcecec13f6392980512e0ded566680c3dd657ab4 (patch) | |
tree | 2e571d1cdd7ea0232cdc3d3173f8a0b413612953 | |
parent | 94bb9f2ace4134b4cfc9d0ca2a16f79ce9ec4bce (diff) | |
download | trackermap-server-dcecec13f6392980512e0ded566680c3dd657ab4.tar.gz trackermap-server-dcecec13f6392980512e0ded566680c3dd657ab4.tar.bz2 trackermap-server-dcecec13f6392980512e0ded566680c3dd657ab4.zip |
Fix Suntech alert decoding
-rw-r--r-- | src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java | 2 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java index e67bd7a71..047a1822a 100644 --- a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java @@ -856,7 +856,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { } else { - String[] values = buf.toString(StandardCharsets.US_ASCII).split(";"); + String[] values = buf.toString(StandardCharsets.US_ASCII).split(";", -1); prefix = values[0]; if (prefix.equals("CRR")) { diff --git a/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java index ebd48c5c7..e25ad124c 100644 --- a/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java @@ -84,6 +84,10 @@ public class SuntechProtocolDecoderTest extends ProtocolTest { var decoder = inject(new SuntechProtocolDecoder(null)); verifyAttribute(decoder, buffer( + "ALT;0950030205;3FFFFF;95;1.0.11;0;20221017;21:41:30;02F2F402;334;20;0F1D;45;+25.791061;-100.170745;0.00;0.00;18;1;00000101;00000000;42;2;"), + Position.KEY_ALARM, Position.ALARM_SOS); + + verifyAttribute(decoder, buffer( "RES;4309999001;04;02;TEST"), Position.KEY_RESULT, "04;02;TEST"); |