aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2023-07-28 17:17:41 -0700
committerGitHub <noreply@github.com>2023-07-28 17:17:41 -0700
commit28440b7726f186d08073acf7b9b119ec995b1ab7 (patch)
tree6520f65936f6037320c29013b2119235dddcd361 /src
parent2561c3340719089518ef095dd7497c660351eb64 (diff)
parentd4db066c6e0295a4c8646d82a982cd82e42c84c4 (diff)
downloadtrackermap-server-28440b7726f186d08073acf7b9b119ec995b1ab7.tar.gz
trackermap-server-28440b7726f186d08073acf7b9b119ec995b1ab7.tar.bz2
trackermap-server-28440b7726f186d08073acf7b9b119ec995b1ab7.zip
Merge pull request #5148 from KhalilHadded/master
Watch Protocol Decoder update
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/WatchProtocolDecoder.java7
-rw-r--r--src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java7
2 files changed, 12 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java b/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java
index 40d56b130..b586f4e92 100644
--- a/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java
@@ -51,7 +51,7 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder {
.number("(dd)(dd)(dd),") // time (hhmmss)
.expression("([AV]),") // validity
.number(" *(-?d+.d+),") // latitude
- .expression("([NS]),")
+ .expression("([NS])?,")
.number(" *(-?d+.d+),") // longitude
.expression("([EW])?,")
.number("(d+.?d*),") // speed
@@ -285,7 +285,8 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder {
|| type.equalsIgnoreCase("BLOOD")
|| type.equalsIgnoreCase("BPHRT")
|| type.equalsIgnoreCase("TEMP")
- || type.equalsIgnoreCase("btemp2")) {
+ || type.equalsIgnoreCase("btemp2")
+ || type.equalsIgnoreCase("oxygen")) {
if (buf.isReadable()) {
@@ -303,6 +304,8 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder {
if (Integer.parseInt(values[valueIndex++]) > 0) {
position.set(Position.PREFIX_TEMP + 1, Double.parseDouble(values[valueIndex]));
}
+ } else if (type.equalsIgnoreCase("oxygen")) {
+ position.set("bloodOxygen", Integer.parseInt(values[++valueIndex]));
} else {
if (type.equalsIgnoreCase("BPHRT") || type.equalsIgnoreCase("BLOOD")) {
position.set("pressureHigh", values[valueIndex++]);
diff --git a/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java
index 855b9792c..5fd0ede44 100644
--- a/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java
@@ -17,6 +17,13 @@ public class WatchProtocolDecoderTest extends ProtocolTest {
var decoder = inject(new WatchProtocolDecoder(null));
+ verifyAttribute(decoder, buffer(
+ "[3G*9705141740*000B*oxygen,0,98]"),
+ "bloodOxygen", 98);
+
+ verifyPosition(decoder, buffer(
+ "[3G*9705141740*00C2*UD_LTE,260723,185105,V,00.000000,,00.0000000,,0.00,0.0,0.0,0,100,67,0,0,00000000,2,0,605,1,10006,65799,14,10020,4104,4,3,,34:60:f9:ec:19:f8,-82,,98:48:27:55:18:20,-96,,34:e8:94:e4:06:18,-104,0.0]"));
+
verifyPosition(decoder, buffer(
"[SG*9059011020*0067*AL,240123,181628,V,54.427538,N,6.409275,W,0.00,0,0,0,19,90,0,0,00000000,1,1,234,10,55C0,3B882A2,132,,10]"));