Class GlucoseMeasurement
A decoded Glucose Measurement, characteristic 0x2A18.
Wire format
A flags byte, a uint16 sequence number, a 7-byte base time, then the
optional fields the flags select:
| Bit | Meaning |
|---|---|
| 0 | time offset present (sint16 minutes) |
| 1 | concentration, type and location present |
| 2 | concentration units: 0 = kg/L, 1 = mol/L |
| 3 | sensor status annunciation present |
| 4 | context information will follow on 0x2A34 |
The units bit selects a different quantity, not a different scale
A meter reporting kg/L transmits a mass concentration; one reporting
mol/L transmits a molar concentration. Converting between them divides
by the molar mass of glucose, 18.0182 -- it is not a generic unit
conversion, and applying it to any other analyte would be wrong. This
parser normalizes to mmol/L, the SI clinical unit, and exposes
getMilligramsPerDeciliter() for the convention used in the United
States.
Sequence numbers and stored records
Meters store readings and upload them in a burst, so the sequence
number rather than the arrival order is what identifies a measurement.
Retrieving stored records means driving the Record Access Control Point
-- see GlucoseRecordFilter and
SensorSession.requestStoredRecords(GlucoseRecordFilter).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intAlternate site test, such as the forearm.static final intControl solution rather than blood -- a calibration check, andstatic final intEarlobe.static final intFingertip.static final intThe sample came from somewhere this profile does not name. -
Method Summary
Modifier and TypeMethodDescriptiondoubleThe concentration in mg/dL, the unit used clinically in the United States, orDouble.NaNwhen absent.doubleThe concentration in mmol/L, orDouble.NaNwhen this record carried none.intWhere the sample was taken, as aSAMPLE_LOCATION_constant.intThe fluid type code the meter reported -- capillary whole blood, venous plasma, interstitial fluid and so on.intThe meter's sequence number for this reading.longWhen the reading was taken, epoch millis, or-1when the meter's clock was unset.booleantruewhen this record carried a concentration.booleantruewhen the meter will follow this record with a context notification on0x2A34carrying meal, exercise and medication annotations.booleantruewhen this reading came from control solution rather than blood and must not be stored as a glucose measurement.static GlucoseMeasurementparse(byte[] value) Decodes a0x2A18value.toString()Returns a string representation of the object.
-
Field Details
-
SAMPLE_LOCATION_UNKNOWN
public static final int SAMPLE_LOCATION_UNKNOWNThe sample came from somewhere this profile does not name.- See Also:
-
SAMPLE_LOCATION_FINGER
public static final int SAMPLE_LOCATION_FINGERFingertip.- See Also:
-
SAMPLE_LOCATION_ALTERNATE_SITE
public static final int SAMPLE_LOCATION_ALTERNATE_SITEAlternate site test, such as the forearm.- See Also:
-
SAMPLE_LOCATION_EARLOBE
public static final int SAMPLE_LOCATION_EARLOBEEarlobe.- See Also:
-
SAMPLE_LOCATION_CONTROL_SOLUTION
public static final int SAMPLE_LOCATION_CONTROL_SOLUTIONControl solution rather than blood -- a calibration check, and not a reading to store as the user's glucose.- See Also:
-
-
Method Details
-
parse
Decodes a0x2A18value. Returnsnullfor a malformed or truncated payload; never throws. -
getSequenceNumber
public int getSequenceNumber()The meter's sequence number for this reading. Stable across re-transmission, and the right key for de-duplicating a burst of stored records. -
getTimestampMillis
public long getTimestampMillis()When the reading was taken, epoch millis, or-1when the meter's clock was unset. Prefer this over the time of receipt -- stored records arrive long after the fact. -
getMillimolesPerLiter
public double getMillimolesPerLiter()The concentration in mmol/L, orDouble.NaNwhen this record carried none. -
getMilligramsPerDeciliter
public double getMilligramsPerDeciliter()The concentration in mg/dL, the unit used clinically in the United States, orDouble.NaNwhen absent. -
hasConcentration
public boolean hasConcentration()truewhen this record carried a concentration. A record without one is a placeholder the meter kept for a failed test. -
getSampleLocation
public int getSampleLocation()Where the sample was taken, as a
SAMPLE_LOCATION_constant.Check for
SAMPLE_LOCATION_CONTROL_SOLUTIONbefore storing a reading as the user's glucose: that value means the meter was being calibrated against a test fluid, and recording it as a blood measurement puts a fictitious reading into their medical history. -
getSampleType
public int getSampleType()The fluid type code the meter reported -- capillary whole blood, venous plasma, interstitial fluid and so on. -
isContextFollowing
public boolean isContextFollowing()truewhen the meter will follow this record with a context notification on0x2A34carrying meal, exercise and medication annotations. -
isControlSolution
public boolean isControlSolution()truewhen this reading came from control solution rather than blood and must not be stored as a glucose measurement. -
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())
-