diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-03-31 21:24:15 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-03-31 21:24:15 -0700 |
commit | 0fc02b910558cbcf10fa82f92938475f52d39a52 (patch) | |
tree | c88f7995df72dd756c123bd5061c0170f0839e20 | |
parent | 2b9897a9595855385233429d42ed6971b456258a (diff) | |
download | traccar-server-0fc02b910558cbcf10fa82f92938475f52d39a52.tar.gz traccar-server-0fc02b910558cbcf10fa82f92938475f52d39a52.tar.bz2 traccar-server-0fc02b910558cbcf10fa82f92938475f52d39a52.zip |
Implement inputs and outputs
-rw-r--r-- | src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java | 8 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java | 4 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java index 978d768be..9521a1248 100644 --- a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java @@ -513,6 +513,14 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { position.setValid(values[index++].equals("1")); } + if (BitUtil.check(mask, 17)) { + position.set(Position.KEY_INPUT, Integer.parseInt(values[index++])); + } + + if (BitUtil.check(mask, 18)) { + position.set(Position.KEY_OUTPUT, Integer.parseInt(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 692a13131..30c28228c 100644 --- a/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java @@ -67,6 +67,10 @@ public class SuntechProtocolDecoderTest extends ProtocolTest { SuntechProtocolDecoder decoder = new SuntechProtocolDecoder(null); + 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); + verifyAttribute(decoder, binary( "82004d05800000553fffff360100100114020410293902ccccf102dc007b00053c00476fa18469e87f000000000b0100003b00081d00000113f3f8010000049e00000000000000001d00000113f3f801"), Position.KEY_DRIVER_UNIQUE_ID, "1d00000113f3f801"); |