From 7c7002e3b001b9e4f8f9a00f9a14dff87b5c9862 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 14 Mar 2018 07:58:15 +1300 Subject: Support Watch blood pressure --- src/org/traccar/protocol/WatchProtocolDecoder.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/org/traccar/protocol') diff --git a/src/org/traccar/protocol/WatchProtocolDecoder.java b/src/org/traccar/protocol/WatchProtocolDecoder.java index 12ec3bd3f..325f2efd9 100644 --- a/src/org/traccar/protocol/WatchProtocolDecoder.java +++ b/src/org/traccar/protocol/WatchProtocolDecoder.java @@ -238,7 +238,7 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder { sendResponse(channel, manufacturer, id, index, "TKQ"); - } else if (type.equals("PULSE") || type.equals("heart")) { + } else if (type.equals("PULSE") || type.equals("heart") || type.equals("bphrt")) { if (buf.readable()) { @@ -247,10 +247,14 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder { getLastLocation(position, new Date()); - position.setValid(false); - String pulse = buf.toString(StandardCharsets.US_ASCII); - position.set("pulse", pulse); - position.set(Position.KEY_RESULT, pulse); + String[] values = buf.toString(StandardCharsets.US_ASCII).split(","); + int valueIndex = 0; + + if (type.equals("bphrt")) { + position.set("pressureLow", values[valueIndex++]); + position.set("pressureHigh", values[valueIndex++]); + } + position.set("pulse", values[valueIndex]); return position; -- cgit v1.2.3