aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-23 16:29:25 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-23 16:29:25 -0700
commitbf504bdda752dfbde1a81ece03805d14a4bd117c (patch)
treefa97c6c3f6437981d0b99d72ec3d7d8b62a308a4 /src
parentd24edbc439a96b38442be1fbbfaccf65f0dd1923 (diff)
downloadtrackermap-server-bf504bdda752dfbde1a81ece03805d14a4bd117c.tar.gz
trackermap-server-bf504bdda752dfbde1a81ece03805d14a4bd117c.tar.bz2
trackermap-server-bf504bdda752dfbde1a81ece03805d14a4bd117c.zip
Decode ST300UEX serial data
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java4
-rw-r--r--src/test/java/org/traccar/protocol/SuntechFrameDecoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java7
3 files changed, 14 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java
index 44ba1da38..67a82a688 100644
--- a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java
@@ -375,7 +375,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
}
} else if (attribute.startsWith("GTSL")) {
position.set(Position.KEY_DRIVER_UNIQUE_ID, attribute.split("\\|")[4]);
- } else {
+ } else if (attribute.contains("=")) {
String[] pair = attribute.split("=");
if (pair.length >= 2) {
String value = pair[1].trim();
@@ -398,6 +398,8 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
break;
}
}
+ } else {
+ position.set("serial", attribute);
}
remaining -= attribute.length() + 1;
}
diff --git a/src/test/java/org/traccar/protocol/SuntechFrameDecoderTest.java b/src/test/java/org/traccar/protocol/SuntechFrameDecoderTest.java
index 96fed314c..6d0351a8e 100644
--- a/src/test/java/org/traccar/protocol/SuntechFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SuntechFrameDecoderTest.java
@@ -11,6 +11,10 @@ public class SuntechFrameDecoderTest extends ProtocolTest {
var decoder = inject(new SuntechFrameDecoder());
verifyFrame(
+ binary("53543330305545583b3531313639393339383b34353b3331353b32303232303632333b31383a32343a35383b3661313332393b2d32392e3735343934373b2d3035372e3038353838353b3030302e3030303b3030302e30303b31303b313b37323b302e30303b3030303030303b31323b0201100110011090011001100110011001100110fe3b39303b3030303030303b332e393b313b30303030303030303030303030303b30"),
+ decoder.decode(null, null, binary("53543330305545583b3531313639393339383b34353b3331353b32303232303632333b31383a32343a35383b3661313332393b2d32392e3735343934373b2d3035372e3038353838353b3030302e3030303b3030302e30303b31303b313b37323b302e30303b3030303030303b31323b0201100110011090011001100110011001100110fe3b39303b3030303030303b332e393b313b30303030303030303030303030303b300d")));
+
+ verifyFrame(
binary("81004e05200013383fffff3401000301130a0512080400000000000000000000000047f9d5846a06810072225214010100020300a8002604c1000004b000000470000025a100000000000025c4000000a6"),
decoder.decode(null, null, binary("81004e05200013383fffff3401000301130a0512080400000000000000000000000047f9d5846a06810072225214010100020300a8002604c1000004b000000470000025a100000000000025c4000000a6")));
diff --git a/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java
index 7fed55454..71f71ce99 100644
--- a/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java
@@ -92,6 +92,13 @@ public class SuntechProtocolDecoderTest extends ProtocolTest {
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"));
+ verifyAttributes(decoder, binary(
+ "53543330305545583b3531313639393339383b34353b3331353b32303232303632333b31383a32343a35383b3661313332393b2d32392e3735343934373b2d3035372e3038353838353b3030302e3030303b3030302e30303b31303b313b37323b302e30303b3030303030303b31323b0201100110011090011001100110011001100110fe3b39303b3030303030303b332e393b313b30303030303030303030303030303b30"));
+
+ verifyAttribute(decoder, buffer(
+ "ST300UEX;100850000;01;010;20081017;07:41:56;2F100;+37.478519;+126.886819;000.012;000.00;9;1;0;15.30;001100;25;Welcome to Suntech World!;12;0;4.5;1"),
+ "serial", "Welcome to Suntech World!");
+
verifyAttribute(decoder, buffer(
"ST300UEX;511331307;45;311;20210420;12:41:01;12361;-01.280825;-047.931773;000.000;000.00;16;1;0;12.54;000000;23;GTSL|6|1|0|9255143|2|;6F;000276;0.0;1;00000000000000;0"),
Position.KEY_DRIVER_UNIQUE_ID, "9255143");