From 7a4f3f22239cc9b3405387a29819654265e9b345 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 29 Apr 2021 20:41:46 -0700 Subject: Decode serial driver id --- src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java | 2 ++ src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java | 4 ++++ 2 files changed, 6 insertions(+) (limited to 'src') diff --git a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java index 76e3e6ecc..d8710a899 100644 --- a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java @@ -356,6 +356,8 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { totalFuel += fuel2; position.set("fuel2", fuel2); } + } else if (attribute.startsWith("GTSL")) { + position.set(Position.KEY_DRIVER_UNIQUE_ID, attribute.split("\\|")[4]); } else { String[] pair = attribute.split("="); if (pair.length >= 2) { diff --git a/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java index 6e8bd85b3..8cc4148f0 100644 --- a/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java @@ -82,6 +82,10 @@ public class SuntechProtocolDecoderTest extends ProtocolTest { var decoder = new SuntechProtocolDecoder(null); + 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"); + verifyAttribute(decoder, buffer( "STT;0560001616;BFFFFF;56;1.0.15;1;20200219;20:52:25;00008D6C;334;20;0925;24;+20.741764;-103.430364;0.00;0.00;19;1;00000001;00000000;2;1;1765;00008003;0.0;12.14;136598"), Position.KEY_INDEX, 1765); -- cgit v1.2.3