Class BloodPressureSample

java.lang.Object
com.codename1.health.HealthSample
com.codename1.health.BloodPressureSample

public final class BloodPressureSample extends HealthSample

A blood-pressure reading: systolic and diastolic together, plus an optional pulse.

One sample, not a correlation

HealthKit models blood pressure as an HKCorrelation wrapping two separate quantity samples; Health Connect has a single BloodPressureRecord and no correlation concept at all. This API follows Health Connect, because a portable Correlation type would be a fiction that only one platform actually has -- Android would have to synthesize it and every caller would have to destructure it.

Local and simulator only in this release

Neither phone carries this shape. The iOS type map has no blood_pressure entry, so the correlation assembly the port will need is not written, and Health Connect's record is not mapped either: a read or write of HealthDataType.BLOOD_PRESSURE on a device is refused with HealthError.TYPE_NOT_SUPPORTED rather than dropped without a word. It works fully against the local and simulator stores. Until that changes, take the reading off the cuff's SensorSession and keep it yourself.

  • Field Details

    • POSITION_UNKNOWN

      public static final int POSITION_UNKNOWN
      The body position was not recorded.
      See Also:
    • POSITION_STANDING

      public static final int POSITION_STANDING
      Measured while standing.
      See Also:
    • POSITION_SITTING

      public static final int POSITION_SITTING
      Measured while sitting.
      See Also:
    • POSITION_LYING_DOWN

      public static final int POSITION_LYING_DOWN
      Measured while lying down.
      See Also:
    • POSITION_RECLINING

      public static final int POSITION_RECLINING
      Measured while reclining.
      See Also:
    • LOCATION_UNKNOWN

      public static final int LOCATION_UNKNOWN
      The measurement site was not recorded.
      See Also:
    • LOCATION_LEFT_UPPER_ARM

      public static final int LOCATION_LEFT_UPPER_ARM
      Left upper arm.
      See Also:
    • LOCATION_RIGHT_UPPER_ARM

      public static final int LOCATION_RIGHT_UPPER_ARM
      Right upper arm.
      See Also:
    • LOCATION_LEFT_WRIST

      public static final int LOCATION_LEFT_WRIST
      Left wrist.
      See Also:
    • LOCATION_RIGHT_WRIST

      public static final int LOCATION_RIGHT_WRIST
      Right wrist.
      See Also:
  • Method Details

    • create

      public static BloodPressureSample create(double systolicMmHg, double diastolicMmHg, long instantMillis)
      A reading in millimetres of mercury, the unit both platforms and every cuff use.
    • create

      public static BloodPressureSample create(HealthQuantity systolic, HealthQuantity diastolic, long instantMillis)
      A reading given as explicit pressure quantities.
    • getSystolic

      public HealthQuantity getSystolic()
      The systolic pressure.
    • getDiastolic

      public HealthQuantity getDiastolic()
      The diastolic pressure.
    • getPulse

      public HealthQuantity getPulse()
      The pulse recorded with this reading, or null. Most cuffs report one; neither store requires it.
    • setPulse

      public void setPulse(HealthQuantity pulse)
      Attaches the pulse recorded alongside the reading.
    • getBodyPosition

      public int getBodyPosition()
      One of the POSITION_ constants.
    • setBodyPosition

      public void setBodyPosition(int bodyPosition)
      Records the body position, using a POSITION_ constant.
    • getMeasurementLocation

      public int getMeasurementLocation()
      One of the LOCATION_ constants.
    • setMeasurementLocation

      public void setMeasurementLocation(int measurementLocation)
      Records the measurement site, using a LOCATION_ constant.
    • toString

      public String toString()
      Description copied from class: Object
      Returns 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())
      Overrides:
      toString in class HealthSample