diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-01-09 17:22:52 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-01-09 17:22:52 -0800 |
commit | 92f02e0accbffad409761bfe962c94cf4fca2288 (patch) | |
tree | c79fde85947d513f087c7e857e2545660d927be1 /src | |
parent | 42a0fef17757082442e3dea4d1fc0f57750c0f90 (diff) | |
download | trackermap-server-92f02e0accbffad409761bfe962c94cf4fca2288.tar.gz trackermap-server-92f02e0accbffad409761bfe962c94cf4fca2288.tar.bz2 trackermap-server-92f02e0accbffad409761bfe962c94cf4fca2288.zip |
Support Suntech 410 devices
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java | 6 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java index f9fcfe79d..8d58803c9 100644 --- a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 - 2019 Anton Tananaev (anton@traccar.org) + * Copyright 2013 - 2020 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -242,6 +242,10 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_INDEX, Integer.parseInt(values[index++])); position.set(Position.KEY_STATUS, Integer.parseInt(values[index++])); + if (values[index].length() == 3) { + index += 1; // collaborative network + } + DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHH:mm:ss"); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); position.setTime(dateFormat.parse(values[index++] + values[index++])); diff --git a/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java index da1ef8ab4..ad9be942f 100644 --- a/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java @@ -63,6 +63,9 @@ public class SuntechProtocolDecoderTest extends ProtocolTest { SuntechProtocolDecoder decoder = new SuntechProtocolDecoder(null); verifyPosition(decoder, buffer( + "ST410STT;007638094;426;01;24153;724;4;-65;365;0;24161;724;4;365;0;0;24162;724;4;365;0;0;24363;724;4;365;0;0;24151;724;4;365;0;0;24991;724;4;365;0;0;24373;724;4;365;0;0;3.98;1;0176;2;016;20200106;19:18:04;-15.571860;-056.062637;000.852;238.28;6;1;201")); + + verifyPosition(decoder, buffer( "ST390STT;007579860;18;302;20191101;11:28:51;145b49;-23.267030;-047.298142;000.000;000.00;9;1;5;11.93;000000;2;0003;000002;4.03;0;20010000;22470;724;05;-58;5211;1")); verifyAttribute(decoder, binary( |