aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2024-01-29 06:47:46 -0800
committerGitHub <noreply@github.com>2024-01-29 06:47:46 -0800
commit0968c7a10f1eb78b87fdc96ae7f5a7c3b7524e12 (patch)
tree21d44d77c31e3d07b576c76782e8d17587c42e42
parent52dcedfe60e5b9468db16e7d72048595bcdeb98f (diff)
parent04a99c14fc2840f78e988d66c150807abae8bf79 (diff)
downloadtrackermap-server-0968c7a10f1eb78b87fdc96ae7f5a7c3b7524e12.tar.gz
trackermap-server-0968c7a10f1eb78b87fdc96ae7f5a7c3b7524e12.tar.bz2
trackermap-server-0968c7a10f1eb78b87fdc96ae7f5a7c3b7524e12.zip
Merge pull request #5259 from vithanagevms/master
analog input voltage decode
-rw-r--r--src/main/java/org/traccar/protocol/UproProtocolDecoder.java4
-rw-r--r--src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java8
2 files changed, 12 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/UproProtocolDecoder.java b/src/main/java/org/traccar/protocol/UproProtocolDecoder.java
index ed714e464..915f5adfe 100644
--- a/src/main/java/org/traccar/protocol/UproProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/UproProtocolDecoder.java
@@ -310,6 +310,10 @@ public class UproProtocolDecoder extends BaseProtocolDecoder {
position.set("serial", data.toString(StandardCharsets.US_ASCII).substring(3));
}
break;
+ case 'd':
+ position.set(Position.PREFIX_ADC + 1,
+ (Integer.parseInt(data.toString(StandardCharsets.US_ASCII)) / 100.0));
+ break;
default:
break;
}
diff --git a/src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java
index c99166374..f070c6201 100644
--- a/src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java
@@ -83,6 +83,14 @@ public class UproProtocolDecoderTest extends ProtocolTest {
verifyPosition(decoder, buffer(
"*AI2000905300036,AD1&A1703054913231101844949860000251115&B0500000000&C0;4?72:9&F0000"));
+ verifyAttribute(decoder, buffer(
+ "*HQ200862312328000001,AD1&A1520441548253003503696640017270124&B0000000000&C00000117&F0000&R2118&N01&V0125&X(J01E0)&K00300&Z000&d01286"),
+ Position.PREFIX_ADC + 1, 12.86);
+
+ verifyAttribute(decoder, buffer(
+ "*HQ200862312328000001,BA&A1520461548253003503696640017270124&B0000000000&C00000117&F0000&R2218&N01&V0125&X(J01E0)&K00300&Z000&d01287"),
+ Position.PREFIX_ADC + 1, 12.87);
+
}
}