diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-09-23 00:13:58 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-23 00:13:58 -0700 |
commit | 5f4ccee4ee552920b8ef1ee0cd385f83ca68fa27 (patch) | |
tree | 69edaaad4b0e4629b9cc8648e7cca919bffa2df9 /src/main/java | |
parent | 2c0fae71df46d661637a53c833c7ddb3ea4acb77 (diff) | |
parent | 8a5e7d351ad1e0708655cc11dc07ac29a8e89e35 (diff) | |
download | trackermap-server-5f4ccee4ee552920b8ef1ee0cd385f83ca68fa27.tar.gz trackermap-server-5f4ccee4ee552920b8ef1ee0cd385f83ca68fa27.tar.bz2 trackermap-server-5f4ccee4ee552920b8ef1ee0cd385f83ca68fa27.zip |
Merge pull request #4397 from ninioe/master
Watch protocol case fix
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/traccar/protocol/WatchProtocolDecoder.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java b/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java index 70b207e9b..3f2156dc2 100644 --- a/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java @@ -267,7 +267,10 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder { sendResponse(channel, id, index, "TKQ"); - } else if (type.equals("PULSE") || type.equals("heart") || type.equals("bphrt")) { + } else if (type.equalsIgnoreCase("PULSE") + || type.equalsIgnoreCase("HEART") + || type.equalsIgnoreCase("BLOOD") + || type.equalsIgnoreCase("BPHRT")) { if (buf.isReadable()) { @@ -279,11 +282,14 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder { String[] values = buf.toString(StandardCharsets.US_ASCII).split(","); int valueIndex = 0; - if (type.equals("bphrt")) { + if (type.equalsIgnoreCase("BPHRT") || type.equalsIgnoreCase("BLOOD")) { position.set("pressureHigh", values[valueIndex++]); position.set("pressureLow", values[valueIndex++]); } - position.set(Position.KEY_HEART_RATE, Integer.parseInt(values[valueIndex])); + + if (valueIndex <= values.length - 1) { + position.set(Position.KEY_HEART_RATE, Integer.parseInt(values[valueIndex])); + } return position; |