public final class BloodPressureMeasurement
- Object
- BloodPressureMeasurement
A decoded Blood Pressure Measurement, characteristic 0x2A35, or the
Intermediate Cuff Pressure, 0x2A36, which shares the same layout.
Wire format
Byte 0 is a flags field:
| Bit | Meaning |
|---|---|
| 0 | units: 0 = mmHg, 1 = kPa |
| 1 | timestamp present |
| 2 | pulse rate present |
| 3 | user id present |
| 4 | measurement status present |
It is followed by three 16-bit IEEE-11073 SFLOAT values – systolic, diastolic and mean arterial pressure – then the optional fields.
Two traps
This characteristic is indicated, not notified. Its client
configuration descriptor takes 0x0002. The Bluetooth layer handles
that automatically, but a hand-rolled GATT client that writes 0x0001
will subscribe successfully and then never receive anything.
A cuff that fails to get a reading sends a reserved SFLOAT. Those
decode to Double.NaN here, and [#parse(byte[])] returns null when
the systolic or diastolic value is one, so a failed measurement can
never reach your UI as 2047 mmHg.
Methods
public static BloodPressureMeasurement parse(byte[] value) | Decodes a 0x2A35 or 0x2A36 value. |
public double getSystolicMmHg() | Systolic pressure in mmHg, converted from kPa when the device reported those. |
public double getDiastolicMmHg() | Diastolic pressure in mmHg. |
public double getMeanArterialMmHg() | Mean arterial pressure in mmHg, or Double.NaN when the device did not compute one. |
public double getPulseBpm() | Pulse in beats per minute, or Double.NaN when absent. |
public boolean hasPulse() | true when this reading carried a pulse. |
public int getUserId() | The device’s user-profile index, or -1 when absent. |
public long getTimestampMillis() | The device’s own timestamp for this reading in epoch millis, or -1 when absent. |
public String toString() | Returns a string representation of the object. |
Inherited methods
Method details
parse
public static BloodPressureMeasurement parse(byte[] value)Decodes a 0x2A35 or 0x2A36 value.
Returns null for a malformed or truncated payload, and also when
the device signalled a failed measurement through a reserved
SFLOAT. Never throws.
getSystolicMmHg
public double getSystolicMmHg()getDiastolicMmHg
public double getDiastolicMmHg()getMeanArterialMmHg
public double getMeanArterialMmHg()Double.NaN when the device did
not compute one.getPulseBpm
public double getPulseBpm()Double.NaN when absent.hasPulse
public boolean hasPulse()true when this reading carried a pulse.getUserId
public int getUserId()-1 when absent. Cuffs shared
by a household use it to attribute a reading.getTimestampMillis
public long getTimestampMillis()The device’s own timestamp for this reading in epoch millis, or
-1 when absent.
Worth preferring over the time of receipt: cuffs store readings and upload them in a burst when they next connect, so several measurements taken hours apart can arrive within a second.
toString
public String toString()