aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-07-27 23:32:26 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-07-27 23:32:26 -0700
commit02156420e2b7e8ca60982c60c26245c77069dd6e (patch)
treed28a42f04eefe85383fb9aacac7eaa7de75ae0b8
parent9188d67c08f309697fed0f4e452b06ea738a67bf (diff)
downloadtrackermap-server-02156420e2b7e8ca60982c60c26245c77069dd6e.tar.gz
trackermap-server-02156420e2b7e8ca60982c60c26245c77069dd6e.tar.bz2
trackermap-server-02156420e2b7e8ca60982c60c26245c77069dd6e.zip
Decode individual inputs
-rw-r--r--src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java12
-rw-r--r--src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java4
2 files changed, 13 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
index 283dbeb37..194a21bf7 100644
--- a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2019 Anton Tananaev (anton@traccar.org)
+ * Copyright 2012 - 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.
@@ -789,8 +789,14 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
} else if (BitUtil.check(ignition, 5)) {
position.set(Position.KEY_IGNITION, true);
}
- position.set(Position.KEY_INPUT, parser.nextHexInt());
- position.set(Position.KEY_OUTPUT, parser.nextHexInt());
+ int input = parser.nextHexInt();
+ int output = parser.nextHexInt();
+ position.set(Position.KEY_INPUT, input);
+ position.set(Position.PREFIX_IN + 1, BitUtil.check(input, 1));
+ position.set(Position.PREFIX_IN + 2, BitUtil.check(input, 2));
+ position.set(Position.KEY_OUTPUT, output);
+ position.set(Position.PREFIX_OUT + 1, BitUtil.check(output, 0));
+ position.set(Position.PREFIX_OUT + 2, BitUtil.check(output, 1));
}
}
diff --git a/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
index 12e64cd6d..d107387f4 100644
--- a/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
@@ -11,6 +11,10 @@ public class Gl200TextProtocolDecoderTest extends ProtocolTest {
Gl200TextProtocolDecoder decoder = new Gl200TextProtocolDecoder(null);
+ verifyAttribute(decoder, buffer(
+ "+RESP:GTFRI,380903,869606020188383,,,40,1,2,43.4,80,252.4,8.606297,50.700200,20200721090109,0262,0001,1932,1BA4,00,0.0,,,,0,220100,,,,20200721090110,00B9$"),
+ Position.PREFIX_IN + 1, false);
+
verifyPositions(decoder, buffer(
"+RESP:GTFRI,423031,355154083021002,Bolt4G,0,0,0,0,1,1.0,0.2,0,245.3,-85.630193,42.975280,20190729185934,310,410,500b,B0E320F,31,-1,100,20190729185934,0010$"));