aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-07-30 20:59:28 -1000
committerAnton Tananaev <anton.tananaev@gmail.com>2021-07-30 20:59:28 -1000
commit57ff7a02db797ad377df8a7b65e96e8768aed438 (patch)
tree5dc36c653cb9d62288b545533bab924d9ac37cbe
parentad6720a20bc9abb728630b96fc811e7293e7a307 (diff)
downloadtrackermap-server-57ff7a02db797ad377df8a7b65e96e8768aed438.tar.gz
trackermap-server-57ff7a02db797ad377df8a7b65e96e8768aed438.tar.bz2
trackermap-server-57ff7a02db797ad377df8a7b65e96e8768aed438.zip
Fix Mobicom G102 result
-rw-r--r--src/main/java/org/traccar/protocol/KhdProtocolDecoder.java2
-rw-r--r--src/test/java/org/traccar/ProtocolTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/KhdProtocolDecoderTest.java3
3 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/KhdProtocolDecoder.java b/src/main/java/org/traccar/protocol/KhdProtocolDecoder.java
index 371b0f71c..a14f9b8a4 100644
--- a/src/main/java/org/traccar/protocol/KhdProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/KhdProtocolDecoder.java
@@ -178,7 +178,7 @@ public class KhdProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte();
buf.readUnsignedByte();
- position.set(Position.KEY_RESULT, buf.readUnsignedByte());
+ position.set(Position.KEY_RESULT, String.valueOf(buf.readUnsignedByte()));
if (type == MSG_PERIPHERAL) {
diff --git a/src/test/java/org/traccar/ProtocolTest.java b/src/test/java/org/traccar/ProtocolTest.java
index 56551f247..c40a15dcc 100644
--- a/src/test/java/org/traccar/ProtocolTest.java
+++ b/src/test/java/org/traccar/ProtocolTest.java
@@ -300,6 +300,10 @@ public class ProtocolTest extends BaseTest {
assertTrue(attributes.get(Position.KEY_HOURS) instanceof Number);
}
+ if (attributes.containsKey(Position.KEY_RESULT)) {
+ assertTrue(attributes.get(Position.KEY_RESULT) instanceof String);
+ }
+
if (position.getNetwork() != null && position.getNetwork().getCellTowers() != null) {
for (CellTower cellTower : position.getNetwork().getCellTowers()) {
checkInteger(cellTower.getMobileCountryCode(), 0, 999);
diff --git a/src/test/java/org/traccar/protocol/KhdProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/KhdProtocolDecoderTest.java
index 76f4d83d2..5c2b0732b 100644
--- a/src/test/java/org/traccar/protocol/KhdProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/KhdProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class KhdProtocolDecoderTest extends ProtocolTest {
var decoder = new KhdProtocolDecoder(null);
verifyPosition(decoder, binary(
+ "2929800028258b8c10210731035840031534240542120200000337fb000000ffff5a00000a0000000005005d0d"));
+
+ verifyPosition(decoder, binary(
"292980002825863156210105095059035109370460010100000211ffff000002fc0000001e780b12000034e70d"));
verifyPosition(decoder, binary(