aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-05-13 21:29:09 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-05-13 21:29:09 -0700
commit19b087e836caaccb2301e70b0667bb530c1a4077 (patch)
treecdbc6d6b8749ebba2dc6746118e82a5719d4efdd
parentbebd082b08e3f0aa5f5fb5e0b0b9ec697d9815f8 (diff)
downloadtrackermap-server-19b087e836caaccb2301e70b0667bb530c1a4077.tar.gz
trackermap-server-19b087e836caaccb2301e70b0667bb530c1a4077.tar.bz2
trackermap-server-19b087e836caaccb2301e70b0667bb530c1a4077.zip
Decode Suntech assign parameters
-rw-r--r--src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java25
-rw-r--r--src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java3
2 files changed, 28 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java
index 9521a1248..13e171dfa 100644
--- a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java
@@ -521,6 +521,31 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_OUTPUT, Integer.parseInt(values[index++]));
}
+ if (BitUtil.check(mask, 19)) {
+ index += 1; // alert id
+ }
+
+ if (BitUtil.check(mask, 20)) {
+ index += 1; // alert modifier
+ }
+
+ if (BitUtil.check(mask, 21)) {
+ index += 1; // alert data
+ }
+
+ if (BitUtil.check(mask, 22)) {
+ index += 1; // reserved
+ }
+
+ if (BitUtil.check(mask, 23)) {
+ int assignMask = Integer.parseInt(values[index++], 16);
+ for (int i = 0; i <= 30; i++) {
+ if (BitUtil.check(assignMask, i)) {
+ position.set(Position.PREFIX_IO + (i + 1), values[index++]);
+ }
+ }
+ }
+
return position;
}
diff --git a/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java
index 30c28228c..fb4dd5d37 100644
--- a/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java
@@ -67,6 +67,9 @@ public class SuntechProtocolDecoderTest extends ProtocolTest {
SuntechProtocolDecoder decoder = new SuntechProtocolDecoder(null);
+ verifyPosition(decoder, buffer(
+ "ALT;0470001109;BFFFFF;47;1.0.2;0;20200511;22:39:38;0B29790F;310;410;2C13;30;+34.928093;-83.704295;0.94;30.95;10;1;00000001;00000000;15;;;00018003;4.1;14.13;629;11905"));
+
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_INPUT, 1);