Class 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.
-
Method Summary
Modifier and TypeMethodDescriptiondoubleDiastolic pressure in mmHg.doubleMean arterial pressure in mmHg, orDouble.NaNwhen the device did not compute one.doublePulse in beats per minute, orDouble.NaNwhen absent.doubleSystolic pressure in mmHg, converted from kPa when the device reported those.longThe device's own timestamp for this reading in epoch millis, or-1when absent.intThe device's user-profile index, or-1when absent.booleanhasPulse()truewhen this reading carried a pulse.static BloodPressureMeasurementparse(byte[] value) Decodes a0x2A35or0x2A36value.toString()Returns a string representation of the object.
-
Method Details
-
parse
Decodes a
0x2A35or0x2A36value.Returns
nullfor a malformed or truncated payload, and also when the device signalled a failed measurement through a reserved SFLOAT. Never throws. -
getSystolicMmHg
public double getSystolicMmHg()Systolic pressure in mmHg, converted from kPa when the device reported those. -
getDiastolicMmHg
public double getDiastolicMmHg()Diastolic pressure in mmHg. -
getMeanArterialMmHg
public double getMeanArterialMmHg()Mean arterial pressure in mmHg, orDouble.NaNwhen the device did not compute one. -
getPulseBpm
public double getPulseBpm()Pulse in beats per minute, orDouble.NaNwhen absent. -
hasPulse
public boolean hasPulse()truewhen this reading carried a pulse. -
getUserId
public int getUserId()The device's user-profile index, or-1when 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
-1when 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
Description copied from class:ObjectReturns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode())
-