@ovok/native 1.16.1-dev.2131 → 1.16.1-dev.2133
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js +13 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.blood-pressure-status.js +4 -7
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.blood-pressure-status.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.decorators.js +106 -0
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.decorators.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js +38 -31
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.js +41 -0
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js +22 -24
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js.map +1 -1
- package/lib/commonjs/modules/bt-management/utils/device-user.js +22 -0
- package/lib/commonjs/modules/bt-management/utils/device-user.js.map +1 -0
- package/lib/commonjs/modules/bt-management/utils/kpa-to-mmhg.js +9 -0
- package/lib/commonjs/modules/bt-management/utils/kpa-to-mmhg.js.map +1 -0
- package/lib/commonjs/modules/bt-management/utils/rr-interval.js +16 -0
- package/lib/commonjs/modules/bt-management/utils/rr-interval.js.map +1 -0
- package/lib/commonjs/modules/bt-management/utils/temperature-type.js +15 -0
- package/lib/commonjs/modules/bt-management/utils/temperature-type.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/index.js +6 -0
- package/lib/commonjs/modules/next/bluetooth/index.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/result-policy.js +10 -2
- package/lib/commonjs/modules/next/bluetooth/result-policy.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/sig-profiles.js +46 -13
- package/lib/commonjs/modules/next/bluetooth/sig-profiles.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-managed-device.js +13 -1
- package/lib/module/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.blood-pressure-status.js +1 -4
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.blood-pressure-status.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.decorators.js +99 -0
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.decorators.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js +38 -31
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.js +35 -0
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js +18 -20
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js.map +1 -1
- package/lib/module/modules/bt-management/utils/device-user.js +17 -0
- package/lib/module/modules/bt-management/utils/device-user.js.map +1 -0
- package/lib/module/modules/bt-management/utils/kpa-to-mmhg.js +6 -0
- package/lib/module/modules/bt-management/utils/kpa-to-mmhg.js.map +1 -0
- package/lib/module/modules/bt-management/utils/rr-interval.js +12 -0
- package/lib/module/modules/bt-management/utils/rr-interval.js.map +1 -0
- package/lib/module/modules/bt-management/utils/temperature-type.js +11 -0
- package/lib/module/modules/bt-management/utils/temperature-type.js.map +1 -0
- package/lib/module/modules/next/bluetooth/index.js +1 -1
- package/lib/module/modules/next/bluetooth/index.js.map +1 -1
- package/lib/module/modules/next/bluetooth/result-policy.js +8 -1
- package/lib/module/modules/next/bluetooth/result-policy.js.map +1 -1
- package/lib/module/modules/next/bluetooth/sig-profiles.js +44 -11
- package/lib/module/modules/next/bluetooth/sig-profiles.js.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.blood-pressure-status.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.decorators.d.ts +11 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.decorators.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts +5 -2
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.d.ts +10 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/result-policy.d.ts +6 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/result-policy.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/utils/device-user.d.ts +6 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/device-user.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/kpa-to-mmhg.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/kpa-to-mmhg.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/rr-interval.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/rr-interval.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/temperature-type.d.ts +7 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/temperature-type.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/result-policy.d.ts +6 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/result-policy.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/sig-profiles.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts +2 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.blood-pressure-status.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.decorators.d.ts +11 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.decorators.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts +5 -2
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.d.ts +10 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts +2 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/result-policy.d.ts +6 -0
- package/lib/typescript/module/src/modules/bt-management/types/result-policy.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/utils/device-user.d.ts +6 -0
- package/lib/typescript/module/src/modules/bt-management/utils/device-user.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/utils/kpa-to-mmhg.d.ts +4 -0
- package/lib/typescript/module/src/modules/bt-management/utils/kpa-to-mmhg.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/utils/rr-interval.d.ts +4 -0
- package/lib/typescript/module/src/modules/bt-management/utils/rr-interval.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/utils/temperature-type.d.ts +7 -0
- package/lib/typescript/module/src/modules/bt-management/utils/temperature-type.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/result-policy.d.ts +6 -1
- package/lib/typescript/module/src/modules/next/bluetooth/result-policy.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/sig-profiles.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["memorySlotForDeviceUser","rrIntervalMilliseconds","temperatureTypeFromCode","byteAt","DATE_TIME_BYTES","dateTimeAt","withDefinedMetadata","TEMPERATURE_TIMESTAMP","TEMPERATURE_TYPE","TEMPERATURE_FIELDS_INDEX","WEIGHT_TIMESTAMP","WEIGHT_USER","WEIGHT_FIELDS_INDEX","WEIGHT_UNSUCCESSFUL","PULSE_OXIMETER_TIMESTAMP","PULSE_OXIMETER_FIELDS_INDEX","HEART_RATE_UINT16","HEART_RATE_ENERGY_EXPENDED","HEART_RATE_RR_INTERVALS","HEART_RATE_FLAGS_BYTES","UINT8_BYTES","UINT16_BYTES","afterTimestamp","flags","timestampFlag","fieldsIndex","littleEndian16","frame","index","offset","low","high","undefined","decorateThermometerReading","reading","recordOffset","typeCode","recordedAt","temperatureType","decorateWeightReading","userId","memorySlot","decoratePulseOximeterReading","rrIntervalsFromHeartRateFrame","rrIntervals","counts","push","decorateHeartRateReading","length"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/standard-gatt/standard-gatt.decorators.ts"],"mappings":";;AACA,SAASA,uBAAuB,QAAQ,+BAA4B;AACpE,SAASC,sBAAsB,QAAQ,+BAA4B;AACnE,SAASC,uBAAuB,QAAQ,oCAAiC;AAEzE,SACEC,MAAM,EACNC,eAAe,EACfC,UAAU,EACVC,mBAAmB,QACd,0BAAuB;AAE9B,MAAMC,qBAAqB,GAAG,IAAI;AAClC,MAAMC,gBAAgB,GAAG,IAAI;AAC7B,MAAMC,wBAAwB,GAAG,CAAC;AAElC,MAAMC,gBAAgB,GAAG,IAAI;AAC7B,MAAMC,WAAW,GAAG,IAAI;AACxB,MAAMC,mBAAmB,GAAG,CAAC;;AAE7B;AACA,MAAMC,mBAAmB,GAAG,MAAM;AAElC,MAAMC,wBAAwB,GAAG,IAAI;AACrC,MAAMC,2BAA2B,GAAG,CAAC;AAErC,MAAMC,iBAAiB,GAAG,IAAI;AAC9B,MAAMC,0BAA0B,GAAG,IAAI;AACvC,MAAMC,uBAAuB,GAAG,IAAI;AACpC,MAAMC,sBAAsB,GAAG,CAAC;AAChC,MAAMC,WAAW,GAAG,CAAC;AACrB,MAAMC,YAAY,GAAG,CAAC;;AAEtB;AACA,MAAMC,cAAc,GAAGA,CACrBC,KAAa,EACbC,aAAqB,EACrBC,WAAmB,KAEnBF,KAAK,GAAGC,aAAa,GAAGC,WAAW,GAAGrB,eAAe,GAAGqB,WAAW;AAErE,MAAMC,cAAc,GAAGA,CACrBC,KAAwB,EACxBC,KAAa,EACbC,MAAc,KACS;EACvB,MAAMC,GAAG,GAAG3B,MAAM,CAACwB,KAAK,EAAEC,KAAK,EAAEC,MAAM,CAAC;EACxC,MAAME,IAAI,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B,cAAc,CAACC,KAAK,EAAEC,KAAK,EAAEO,YAAY,CAAC;EAEvD,OAAOU,MAAM,KAAKb,SAAS,EAAE;IAC3BY,WAAW,CAACE,IAAI,CAAC7C,sBAAsB,CAAC4C,MAAM,CAAC,CAAC;IAChDjB,KAAK,IAAIP,YAAY;IACrBwB,MAAM,GAAGnB,cAAc,CAACC,KAAK,EAAEC,KAAK,EAAEO,YAAY,CAAC;EACrD;EAEA,OAAOS,WAAW;AACpB,CAAC;;AAED;AACA,MAAMG,wBAAgD,GAAGA,CACvDb,OAAO,EACPP,KAAK,EACLQ,YAAY,GAAG,CAAC,KACb;EACH,MAAMZ,KAAK,GAAGI,KAAK,IAAIxB,MAAM,CAACwB,KAAK,EAAE,CAAC,EAAEQ,YAAY,CAAC;EAErD,IAAI,CAACR,KAAK,IAAIJ,KAAK,KAAKS,SAAS,IAAI,EAAET,KAAK,GAAGL,uBAAuB,CAAC,EAAE;IACvE,OAAOgB,OAAO;EAChB;EAEA,MAAMU,WAAW,GAAGD,6BAA6B,CAAChB,KAAK,EAAEJ,KAAK,EAAEY,YAAY,CAAC;EAE7E,OAAOS,WAAW,CAACI,MAAM,GAAG,CAAC,GAAG;IAAE,GAAGd,OAAO;IAAEU;EAAY,CAAC,GAAGV,OAAO;AACvE,CAAC;AAED,SACEa,wBAAwB,EACxBL,4BAA4B,EAC5BT,0BAA0B,EAC1BM,qBAAqB","ignoreList":[]}
|
package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import { MeasurementTypeKey } from "@ovok/core/next";
|
|
6
6
|
import { byteToHex } from "../../../utils/bytes-to-hex.js";
|
|
7
|
+
import { KPA_TO_MMHG } from "../../../utils/kpa-to-mmhg.js";
|
|
8
|
+
import { decorateHeartRateReading, decoratePulseOximeterReading, decorateThermometerReading, decorateWeightReading } from "./standard-gatt.decorators.js";
|
|
7
9
|
import { standardGlucoseDevice } from "./standard-gatt.glucose.js";
|
|
8
10
|
import { decorateBloodPressureReading, declareProfile, littleEndian } from "./standard-gatt.profile.js";
|
|
9
11
|
|
|
@@ -18,12 +20,20 @@ import { decorateBloodPressureReading, declareProfile, littleEndian } from "./st
|
|
|
18
20
|
* every vendor names its hardware differently. A product declares the profile and supplies
|
|
19
21
|
* the name its own hardware advertises.
|
|
20
22
|
*
|
|
21
|
-
* Values are little-endian, as the specification requires.
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* such a device yields no reading rather than one that is quietly wrong.
|
|
23
|
+
* Values are little-endian, as the specification requires. A device may report in kPa,
|
|
24
|
+
* Fahrenheit or pounds; each field is then declared with the scale and offset that convert
|
|
25
|
+
* it to the catalog's canonical unit.
|
|
25
26
|
*/
|
|
26
27
|
|
|
28
|
+
const BLOOD_PRESSURE_KPA = 0x01;
|
|
29
|
+
const BLOOD_PRESSURE_TIMESTAMP = 0x02;
|
|
30
|
+
const BLOOD_PRESSURE_PULSE = 0x04;
|
|
31
|
+
|
|
32
|
+
/** Bits 0-4 are defined: kPa, timestamp, pulse, user id and measurement status. */
|
|
33
|
+
const BLOOD_PRESSURE_FLAGS = Array.from({
|
|
34
|
+
length: 32
|
|
35
|
+
}, (_, flags) => flags);
|
|
36
|
+
|
|
27
37
|
/**
|
|
28
38
|
* Blood Pressure Service 0x1810, Blood Pressure Measurement 0x2A35.
|
|
29
39
|
*
|
|
@@ -33,8 +43,8 @@ import { decorateBloodPressureReading, declareProfile, littleEndian } from "./st
|
|
|
33
43
|
* declares the length it needs. A device that reports no pulse still decodes, because the
|
|
34
44
|
* flags value it sends selects a case that never looks for one.
|
|
35
45
|
*
|
|
36
|
-
* Bit 3 (user id
|
|
37
|
-
*
|
|
46
|
+
* Bit 3 (user id) and bit 4 (measurement status) follow the pulse, so neither moves it.
|
|
47
|
+
* Bit 0 says the pressures are in kPa, which is converted to whole mmHg.
|
|
38
48
|
*/
|
|
39
49
|
/** Bit 2 set, bit 1 clear: the pulse follows the mean pressure. */
|
|
40
50
|
const pulseAfterMeanPressure = {
|
|
@@ -47,35 +57,25 @@ const pulseAfterTimestamp = {
|
|
|
47
57
|
fields: [littleEndian("heartRate", [14, 15], "bpm", "sfloat")],
|
|
48
58
|
minLengthBytes: 16
|
|
49
59
|
};
|
|
60
|
+
const pressureInKpa = (name, byteIndexes) => ({
|
|
61
|
+
...littleEndian(name, byteIndexes, "mmHg", "sfloat"),
|
|
62
|
+
scale: KPA_TO_MMHG,
|
|
63
|
+
decimals: 0
|
|
64
|
+
});
|
|
65
|
+
const pressuresInKpa = [pressureInKpa("systolic", [1, 2]), pressureInKpa("diastolic", [3, 4])];
|
|
50
66
|
|
|
51
67
|
/** Declares a Bluetooth SIG blood pressure profile device. */
|
|
52
|
-
const standardBloodPressureDevice = params => declareProfile({
|
|
53
|
-
...params,
|
|
54
|
-
decorateReading: (reading, frame, recordOffset) => {
|
|
55
|
-
const decorated = decorateBloodPressureReading(reading, frame, recordOffset);
|
|
56
|
-
if (!decorated) {
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
return params.decorateReading ? params.decorateReading(decorated, frame, recordOffset) : decorated;
|
|
60
|
-
}
|
|
61
|
-
}, {
|
|
68
|
+
const standardBloodPressureDevice = params => declareProfile(params, {
|
|
62
69
|
service: "1810",
|
|
63
70
|
characteristic: "2a35",
|
|
64
71
|
minLengthBytes: 7,
|
|
65
72
|
measurementTypeKey: MeasurementTypeKey.bloodPressure,
|
|
66
|
-
|
|
67
|
-
selectors:
|
|
73
|
+
decorateReading: decorateBloodPressureReading,
|
|
74
|
+
selectors: BLOOD_PRESSURE_FLAGS.map(byteToHex),
|
|
75
|
+
/** mmHg; the kPa shapes override it in `fieldsBySelector`. */
|
|
68
76
|
fields: [littleEndian("systolic", [1, 2], "mmHg", "sfloat"), littleEndian("diastolic", [3, 4], "mmHg", "sfloat")],
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"0c": pulseAfterMeanPressure,
|
|
72
|
-
"14": pulseAfterMeanPressure,
|
|
73
|
-
"1c": pulseAfterMeanPressure,
|
|
74
|
-
"06": pulseAfterTimestamp,
|
|
75
|
-
"0e": pulseAfterTimestamp,
|
|
76
|
-
"16": pulseAfterTimestamp,
|
|
77
|
-
"1e": pulseAfterTimestamp
|
|
78
|
-
}
|
|
77
|
+
fieldsBySelector: Object.fromEntries(BLOOD_PRESSURE_FLAGS.filter(flags => flags & BLOOD_PRESSURE_KPA).map(flags => [byteToHex(flags), pressuresInKpa])),
|
|
78
|
+
optionalFields: Object.fromEntries(BLOOD_PRESSURE_FLAGS.filter(flags => flags & BLOOD_PRESSURE_PULSE).map(flags => [byteToHex(flags), flags & BLOOD_PRESSURE_TIMESTAMP ? pulseAfterTimestamp : pulseAfterMeanPressure]))
|
|
79
79
|
});
|
|
80
80
|
|
|
81
81
|
/** Health Thermometer Service 0x1809, Temperature Measurement 0x2A1C. */
|
|
@@ -84,6 +84,7 @@ const standardThermometerDevice = params => declareProfile(params, {
|
|
|
84
84
|
characteristic: "2a1c",
|
|
85
85
|
minLengthBytes: 5,
|
|
86
86
|
measurementTypeKey: MeasurementTypeKey.temperature,
|
|
87
|
+
decorateReading: decorateThermometerReading,
|
|
87
88
|
/** All combinations of Fahrenheit, timestamp and temperature type flags. */
|
|
88
89
|
selectors: ["00", "02", "04", "06", "01", "03", "05", "07"],
|
|
89
90
|
fields: [littleEndian("bodyTemp", [1, 2, 3, 4], "Cel", "float")],
|
|
@@ -122,12 +123,14 @@ const WEIGHT_KG_PER_COUNT = 0.005;
|
|
|
122
123
|
* Weight Scale Service 0x181D, Weight Measurement 0x2A9D.
|
|
123
124
|
*
|
|
124
125
|
* The reading is a scaled integer rather than a float, so the resolution is applied here.
|
|
126
|
+
* A weight of 0xFFFF means the measurement failed, so it yields no reading.
|
|
125
127
|
*/
|
|
126
128
|
const standardWeightScaleDevice = params => declareProfile(params, {
|
|
127
129
|
service: "181d",
|
|
128
130
|
characteristic: "2a9d",
|
|
129
131
|
minLengthBytes: 3,
|
|
130
132
|
measurementTypeKey: MeasurementTypeKey.bodyWeight,
|
|
133
|
+
decorateReading: decorateWeightReading,
|
|
131
134
|
/** Unit, timestamp, user-id and BMI/height flags may all follow the value. */
|
|
132
135
|
selectors: Array.from({
|
|
133
136
|
length: 16
|
|
@@ -153,14 +156,16 @@ const standardWeightScaleDevice = params => declareProfile(params, {
|
|
|
153
156
|
* Pulse Oximeter Service 0x1822, PLX Spot-Check Measurement 0x2A5E.
|
|
154
157
|
*
|
|
155
158
|
* Saturation and pulse rate are both required by the catalog, which matches the
|
|
156
|
-
* specification: a spot-check measurement always carries both
|
|
159
|
+
* specification: a spot-check measurement always carries both, at bytes 1-4 whatever the
|
|
160
|
+
* flags say, so every flags value selects the same fields. The optional ones follow them.
|
|
157
161
|
*/
|
|
158
162
|
const standardPulseOximeterDevice = params => declareProfile(params, {
|
|
159
163
|
service: "1822",
|
|
160
164
|
characteristic: "2a5e",
|
|
161
165
|
minLengthBytes: 5,
|
|
162
166
|
measurementTypeKey: MeasurementTypeKey.bloodOxygenPulseRate,
|
|
163
|
-
|
|
167
|
+
decorateReading: decoratePulseOximeterReading,
|
|
168
|
+
selectors: ["*"],
|
|
164
169
|
fields: [littleEndian("bloodOxygen", [1, 2], "%", "sfloat"), littleEndian("pulseRate", [3, 4], "bpm", "sfloat")]
|
|
165
170
|
});
|
|
166
171
|
|
|
@@ -176,13 +181,15 @@ const UINT16_HEART_RATE_FLAGS = HEART_RATE_FLAGS.filter(flags => (flags & 0x01)
|
|
|
176
181
|
* Heart Rate Service 0x180D, Heart Rate Measurement 0x2A37.
|
|
177
182
|
*
|
|
178
183
|
* Both heart-rate layouts are declared. A contact-not-detected frame is idle, so it cannot
|
|
179
|
-
* become a false reading while the strap is off the body.
|
|
184
|
+
* become a false reading while the strap is off the body. RR intervals, a list of any
|
|
185
|
+
* length, are read from the frame by the decorator and reported as `rrIntervals`.
|
|
180
186
|
*/
|
|
181
187
|
const standardHeartRateDevice = params => declareProfile(params, {
|
|
182
188
|
service: "180d",
|
|
183
189
|
characteristic: "2a37",
|
|
184
190
|
minLengthBytes: 2,
|
|
185
191
|
measurementTypeKey: MeasurementTypeKey.heartRate,
|
|
192
|
+
decorateReading: decorateHeartRateReading,
|
|
186
193
|
selectors: HEART_RATE_FLAGS.map(byteToHex),
|
|
187
194
|
fields: [{
|
|
188
195
|
name: "heartRate",
|
package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MeasurementTypeKey","byteToHex","standardGlucoseDevice","decorateBloodPressureReading","declareProfile","littleEndian","
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","byteToHex","KPA_TO_MMHG","decorateHeartRateReading","decoratePulseOximeterReading","decorateThermometerReading","decorateWeightReading","standardGlucoseDevice","decorateBloodPressureReading","declareProfile","littleEndian","BLOOD_PRESSURE_KPA","BLOOD_PRESSURE_TIMESTAMP","BLOOD_PRESSURE_PULSE","BLOOD_PRESSURE_FLAGS","Array","from","length","_","flags","pulseAfterMeanPressure","fields","minLengthBytes","pulseAfterTimestamp","pressureInKpa","name","byteIndexes","scale","decimals","pressuresInKpa","standardBloodPressureDevice","params","service","characteristic","measurementTypeKey","bloodPressure","decorateReading","selectors","map","fieldsBySelector","Object","fromEntries","filter","optionalFields","standardThermometerDevice","temperature","offset","WEIGHT_KG_PER_COUNT","standardWeightScaleDevice","bodyWeight","selector","standardPulseOximeterDevice","bloodOxygenPulseRate","HEART_RATE_FLAGS","UINT16_HEART_RATE_FLAGS","standardHeartRateDevice","heartRate","encoding","unit","byteOrder"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.ts"],"mappings":";;AAAA;;AAEA,SAASA,kBAAkB,QAAQ,iBAAiB;AAIpD,SAASC,SAAS,QAAQ,gCAA6B;AACvD,SAASC,WAAW,QAAQ,+BAA4B;AAExD,SACEC,wBAAwB,EACxBC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CAACf,GAAG,CAACrC,SAAS,CAAC;EAC1CoB,MAAM,EAAE,CACN;IAAEI,IAAI,EAAE,WAAW;IAAEC,WAAW,EAAE,CAAC,CAAC,CAAC;IAAE+B,QAAQ,EAAE,MAAM;IAAEC,IAAI,EAAE;EAAM,CAAC,CACvE;EACDnB,gBAAgB,EAAEC,MAAM,CAACC,WAAW,CAClCa,uBAAuB,CAAChB,GAAG,CAAEnB,KAAK,IAAK,CACnClB,SAAS,CAACkB,KAAK,CAAC,EAChB,CACE;IACEM,IAAI,EAAE,WAAW;IACjBC,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACnBiC,SAAS,EAAE,QAAiB;IAC5BF,QAAQ,EAAE,MAAe;IACzBC,IAAI,EAAE;EACR,CAAC,CACF,CACF,CACL,CAAC;EACDf,cAAc,EAAEH,MAAM,CAACC,WAAW,CAChCa,uBAAuB,CAAChB,GAAG,CAAEnB,KAAK,IAAK,CAAClB,SAAS,CAACkB,KAAK,CAAC,EAAE;IACtDE,MAAM,EAAE,EAAE;IACVC,cAAc,EAAE;EAClB,CAAC,CAAC,CACN;AACF,CAAC,CAAC;AAEJ,SACEQ,2BAA2B,EAC3BvB,qBAAqB,EACrBgD,uBAAuB,EACvBJ,2BAA2B,EAC3BP,yBAAyB,EACzBI,yBAAyB","ignoreList":[]}
|
package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/** The Bluetooth SIG Date Time characteristic is seven bytes long. */
|
|
4
|
+
const DATE_TIME_BYTES = 7;
|
|
5
|
+
|
|
6
|
+
/** The byte at `index` of a record that starts at `offset`; undefined when the frame ends first. */
|
|
7
|
+
const byteAt = (frame, index, offset) => {
|
|
8
|
+
const value = Number.parseInt(frame[index + offset] ?? "", 16);
|
|
9
|
+
return Number.isInteger(value) && value >= 0 && value <= 0xff ? value : undefined;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/** Reads a SIG Date Time at `index` as a phone-local date; undefined for missing or impossible fields. */
|
|
13
|
+
const dateTimeAt = (frame, index, offset = 0) => {
|
|
14
|
+
const yearLow = byteAt(frame, index, offset);
|
|
15
|
+
const yearHigh = byteAt(frame, index + 1, offset);
|
|
16
|
+
const month = byteAt(frame, index + 2, offset);
|
|
17
|
+
const day = byteAt(frame, index + 3, offset);
|
|
18
|
+
const hour = byteAt(frame, index + 4, offset);
|
|
19
|
+
const minute = byteAt(frame, index + 5, offset);
|
|
20
|
+
const second = byteAt(frame, index + 6, offset);
|
|
21
|
+
if (yearLow === undefined || yearHigh === undefined || month === undefined || day === undefined || hour === undefined || minute === undefined || second === undefined) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
const year = yearLow | yearHigh << 8;
|
|
25
|
+
const date = new Date(year, month - 1, day, hour, minute, second);
|
|
26
|
+
return date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day && date.getHours() === hour && date.getMinutes() === minute && date.getSeconds() === second ? date : undefined;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/** `reading` plus each of `metadata` that has a value. */
|
|
30
|
+
const withDefinedMetadata = (reading, metadata) => ({
|
|
31
|
+
...reading,
|
|
32
|
+
...Object.fromEntries(Object.entries(metadata).filter(([, value]) => value !== undefined))
|
|
33
|
+
});
|
|
34
|
+
export { byteAt, DATE_TIME_BYTES, dateTimeAt, withDefinedMetadata };
|
|
35
|
+
//# sourceMappingURL=standard-gatt.frame.js.map
|
package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DATE_TIME_BYTES","byteAt","frame","index","offset","value","Number","parseInt","isInteger","undefined","dateTimeAt","yearLow","yearHigh","month","day","hour","minute","second","year","date","Date","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","withDefinedMetadata","reading","metadata","Object","fromEntries","entries","filter"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.ts"],"mappings":";;AAAA;AACA,MAAMA,eAAe,GAAG,CAAC;;AAEzB;AACA,MAAMC,MAAM,GAAGA,CACbC,KAAwB,EACxBC,KAAa,EACbC,MAAc,KACS;EACvB,MAAMC,KAAK,GAAGC,MAAM,CAACC,QAAQ,CAACL,KAAK,CAACC,KAAK,GAAGC,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC;EAE9D,OAAOE,MAAM,CAACE,SAAS,CAACH,KAAK,CAAC,IAAIA,KAAK,IAAI,CAAC,IAAIA,KAAK,IAAI,IAAI,GACzDA,KAAK,GACLI,SAAS;AACf,CAAC;;AAED;AACA,MAAMC,UAAU,GAAGA,CACjBR,KAAwB,EACxBC,KAAa,EACbC,MAAM,GAAG,CAAC,KACW;EACrB,MAAMO,OAAO,GAAGV,MAAM,CAACC,KAAK,EAAEC,KAAK,EAAEC,MAAM,CAAC;EAC5C,MAAMQ,QAAQ,GAAGX,MAAM,CAACC,KAAK,EAAEC,KAAK,GAAG,CAAC,EAAEC,MAAM,CAAC;EACjD,MAAMS,KAAK,GAAGZ,MAAM,CAACC,KAAK,EAAEC,KAAK,GAAG,CAAC,EAAEC,MAAM,CAAC;EAC9C,MAAMU,GAAG,GAAGb,MAAM,CAACC,KAAK,EAAEC,KAAK,GAAG,CAAC,EAAEC,MAAM,CAAC;EAC5C,MAAMW,IAAI,GAAGd,MAAM,CAACC,KAAK,EAAEC,KAAK,GAAG,CAAC,EAAEC,MAAM,CAAC;EAC7C,MAAMY,MAAM,GAAGf,MAAM,CAACC,KAAK,EAAEC,KAAK,GAAG,CAAC,EAAEC,MAAM,CAAC;EAC/C,MAAMa,MAAM,GAAGhB,MAAM,CAACC,KAAK,EAAEC,KAAK,GAAG,CAAC,EAAEC,MAAM,CAAC;EAE/C,IACEO,OAAO,KAAKF,SAAS,IACrBG,QAAQ,KAAKH,SAAS,IACtBI,KAAK,KAAKJ,SAAS,IACnBK,GAAG,KAAKL,SAAS,IACjBM,IAAI,KAAKN,SAAS,IAClBO,MAAM,KAAKP,SAAS,IACpBQ,MAAM,KAAKR,SAAS,EACpB;IACA,OAAOA,SAAS;EAClB;EAEA,MAAMS,IAAI,GAAGP,OAAO,GAAIC,QAAQ,IAAI,CAAE;EACtC,MAAMO,IAAI,GAAG,IAAIC,IAAI,CAACF,IAAI,EAAEL,KAAK,GAAG,CAAC,EAAEC,GAAG,EAAEC,IAAI,EAAEC,MAAM,EAAEC,MAAM,CAAC;EAEjE,OAAOE,IAAI,CAACE,WAAW,CAAC,CAAC,KAAKH,IAAI,IAChCC,IAAI,CAACG,QAAQ,CAAC,CAAC,KAAKT,KAAK,GAAG,CAAC,IAC7BM,IAAI,CAACI,OAAO,CAAC,CAAC,KAAKT,GAAG,IACtBK,IAAI,CAACK,QAAQ,CAAC,CAAC,KAAKT,IAAI,IACxBI,IAAI,CAACM,UAAU,CAAC,CAAC,KAAKT,MAAM,IAC5BG,IAAI,CAACO,UAAU,CAAC,CAAC,KAAKT,MAAM,GAC1BE,IAAI,GACJV,SAAS;AACf,CAAC;;AAED;AACA,MAAMkB,mBAAmB,GAAGA,CAC1BC,OAAU,EACVC,QAA2C,MACpC;EACP,GAAGD,OAAO;EACV,GAAGE,MAAM,CAACC,WAAW,CACnBD,MAAM,CAACE,OAAO,CAACH,QAAQ,CAAC,CAACI,MAAM,CAAC,CAAC,GAAG5B,KAAK,CAAC,KAAKA,KAAK,KAAKI,SAAS,CACpE;AACF,CAAC,CAAC;AAEF,SAASR,MAAM,EAAED,eAAe,EAAEU,UAAU,EAAEiB,mBAAmB","ignoreList":[]}
|
package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { BloodPressureStates } from "../../../types/blood-pressure-states.js";
|
|
4
|
+
import { memorySlotForDeviceUser } from "../../../utils/device-user.js";
|
|
4
5
|
import { sigUuid } from "../../../utils/sig-uuid.js";
|
|
5
6
|
import { defineCustomDevice } from "../../custom/define-custom-device.js";
|
|
6
7
|
import { bloodPressureStatusFromFrame } from "./standard-gatt.blood-pressure-status.js";
|
|
8
|
+
import { byteAt, dateTimeAt } from "./standard-gatt.frame.js";
|
|
7
9
|
|
|
8
10
|
/** Milliseconds a spot-check device may take to produce its reading. */
|
|
9
11
|
const SPOT_CHECK_TIMEOUT_MS = 60_000;
|
|
12
|
+
/** Runs `first`, then `second` on what it returns; either may withhold the reading. */
|
|
13
|
+
const chainDecorators = (first, second) => {
|
|
14
|
+
if (!first || !second) {
|
|
15
|
+
return first ?? second;
|
|
16
|
+
}
|
|
17
|
+
return (reading, frame, recordOffset) => {
|
|
18
|
+
const decorated = first(reading, frame, recordOffset);
|
|
19
|
+
return decorated && second(decorated, frame, recordOffset);
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
10
23
|
/**
|
|
11
24
|
* The flags byte selects the case, because it decides which optional fields are present and
|
|
12
25
|
* therefore where the later ones sit. Fields common to every shape are declared once; a
|
|
@@ -43,7 +56,7 @@ const declareProfile = (params, profile) => defineCustomDevice({
|
|
|
43
56
|
}]
|
|
44
57
|
}]
|
|
45
58
|
}, {
|
|
46
|
-
decorateReading: params.decorateReading
|
|
59
|
+
decorateReading: chainDecorators(profile.decorateReading, params.decorateReading)
|
|
47
60
|
});
|
|
48
61
|
const littleEndian = (name, byteIndexes, unit, encoding) => ({
|
|
49
62
|
name,
|
|
@@ -52,27 +65,11 @@ const littleEndian = (name, byteIndexes, unit, encoding) => ({
|
|
|
52
65
|
encoding,
|
|
53
66
|
unit
|
|
54
67
|
});
|
|
55
|
-
const byteAt = (frame, index, offset) => {
|
|
56
|
-
const value = Number.parseInt(frame[index + offset] ?? "", 16);
|
|
57
|
-
return Number.isInteger(value) && value >= 0 && value <= 0xff ? value : undefined;
|
|
58
|
-
};
|
|
59
68
|
|
|
60
69
|
/** Reads the SIG blood-pressure timestamp as a phone-local date. */
|
|
61
70
|
const recordedAtFromBloodPressureFrame = (frame, offset = 0) => {
|
|
62
71
|
const flags = byteAt(frame, 0, offset);
|
|
63
|
-
|
|
64
|
-
const yearHigh = byteAt(frame, 8, offset);
|
|
65
|
-
const month = byteAt(frame, 9, offset);
|
|
66
|
-
const day = byteAt(frame, 10, offset);
|
|
67
|
-
const hour = byteAt(frame, 11, offset);
|
|
68
|
-
const minute = byteAt(frame, 12, offset);
|
|
69
|
-
const second = byteAt(frame, 13, offset);
|
|
70
|
-
if (flags === undefined || (flags & 0x02) === 0 || yearLow === undefined || yearHigh === undefined || month === undefined || day === undefined || hour === undefined || minute === undefined || second === undefined) {
|
|
71
|
-
return undefined;
|
|
72
|
-
}
|
|
73
|
-
const year = yearLow | yearHigh << 8;
|
|
74
|
-
const recordedAt = new Date(year, month - 1, day, hour, minute, second);
|
|
75
|
-
return recordedAt.getFullYear() === year && recordedAt.getMonth() === month - 1 && recordedAt.getDate() === day && recordedAt.getHours() === hour && recordedAt.getMinutes() === minute && recordedAt.getSeconds() === second ? recordedAt : undefined;
|
|
72
|
+
return flags !== undefined && (flags & 0x02) !== 0 ? dateTimeAt(frame, 7, offset) : undefined;
|
|
76
73
|
};
|
|
77
74
|
const decorateBloodPressureReading = (reading, frame, recordOffset) => {
|
|
78
75
|
if (!frame) {
|
|
@@ -99,8 +96,9 @@ const decorateBloodPressureReading = (reading, frame, recordOffset) => {
|
|
|
99
96
|
} : {};
|
|
100
97
|
if ((flags & 0x08) !== 0) {
|
|
101
98
|
const userId = byteAt(frame, cursor, offset);
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
const memorySlot = userId === undefined ? undefined : memorySlotForDeviceUser(userId);
|
|
100
|
+
if (memorySlot !== undefined) {
|
|
101
|
+
metadata.memorySlot = memorySlot;
|
|
104
102
|
}
|
|
105
103
|
cursor += 1;
|
|
106
104
|
}
|
package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BloodPressureStates","sigUuid","defineCustomDevice","bloodPressureStatusFromFrame","SPOT_CHECK_TIMEOUT_MS","declareProfile","params","profile","id","measurementTypeKey","nameMatch","matchByService","undefined","oneReadingPerConnection","stuckDataTimeoutMs","services","uuid","service","monitor","characteristic","
|
|
1
|
+
{"version":3,"names":["BloodPressureStates","memorySlotForDeviceUser","sigUuid","defineCustomDevice","bloodPressureStatusFromFrame","byteAt","dateTimeAt","SPOT_CHECK_TIMEOUT_MS","chainDecorators","first","second","reading","frame","recordOffset","decorated","declareProfile","params","profile","id","measurementTypeKey","nameMatch","matchByService","undefined","oneReadingPerConnection","stuckDataTimeoutMs","services","uuid","service","monitor","characteristic","minLengthBytes","caseSelectorBytes","cases","selectors","map","selector","optional","optionalFields","fields","fieldsBySelector","kind","decorateReading","littleEndian","name","byteIndexes","unit","encoding","byteOrder","recordedAtFromBloodPressureFrame","offset","flags","decorateBloodPressureReading","recordedAt","cursor","metadata","userId","memorySlot","status","DISTURB_DETECTED","LOOSE_SLEEVE","REGULAR","irregularHeartbeat","Object","keys","length"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.ts"],"mappings":";;AAEA,SAASA,mBAAmB,QAAQ,yCAAsC;AAM1E,SAASC,uBAAuB,QAAQ,+BAA4B;AACpE,SAASC,OAAO,QAAQ,4BAAyB;AACjD,SAASC,kBAAkB,QAAQ,sCAAmC;AAEtE,SAASC,4BAA4B,QAAQ,0CAAuC;AACpF,SAASC,MAAM,EAAEC,UAAU,QAAQ,0BAAuB;;AAE1D;AACA,MAAMC,qBAAqB,GAAG,MAAM;AAqDpC;AACA,MAAMC,eAAe,GAAGA,CACtBC,KAAyC,EACzCC,MAA0C,KACH;EACvC,IAAI,CAACD,KAAK,IAAI,CAACC,MAAM,EAAE;IACrB,OAAOD,KAAK,IAAIC,MAAM;EACxB;EAEA,OA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,GAAG;IAAE,GAAGrD,OAAO;IAAE,GAAG2C;EAAS,CAAC,GAAG3C,OAAO;AACjF,CAAC;AAED,SACEP,4BAA4B,EAC5B+C,4BAA4B,EAC5BpC,cAAc,EACd2B,YAAY,EACZM,gCAAgC","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/** The Bluetooth SIG User Index that means the device does not know whose reading it is. */
|
|
4
|
+
const UNKNOWN_DEVICE_USER = 0xff;
|
|
5
|
+
|
|
6
|
+
/** The memory slot of a SIG device user: users count from 0, slots from 1; the unknown user has none. */
|
|
7
|
+
const memorySlotForDeviceUser = userId => userId === UNKNOWN_DEVICE_USER ? undefined : userId + 1;
|
|
8
|
+
|
|
9
|
+
/** Whether a reading is from one of the device users `slots`; a reading that names no device user is kept. */
|
|
10
|
+
const isFromAcceptedMemorySlot = (reading, slots) => {
|
|
11
|
+
const {
|
|
12
|
+
memorySlot
|
|
13
|
+
} = reading;
|
|
14
|
+
return typeof memorySlot !== "number" || slots.includes(memorySlot);
|
|
15
|
+
};
|
|
16
|
+
export { isFromAcceptedMemorySlot, memorySlotForDeviceUser };
|
|
17
|
+
//# sourceMappingURL=device-user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["UNKNOWN_DEVICE_USER","memorySlotForDeviceUser","userId","undefined","isFromAcceptedMemorySlot","reading","slots","memorySlot","includes"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/utils/device-user.ts"],"mappings":";;AAAA;AACA,MAAMA,mBAAmB,GAAG,IAAI;;AAEhC;AACA,MAAMC,uBAAuB,GAAIC,MAAc,IAC7CA,MAAM,KAAKF,mBAAmB,GAAGG,SAAS,GAAGD,MAAM,GAAG,CAAC;;AAEzD;AACA,MAAME,wBAAwB,GAAGA,CAC/BC,OAAe,EACfC,KAAwB,KACZ;EACZ,MAAM;IAAEC;EAAW,CAAC,GAAGF,OAAmC;EAE1D,OAAO,OAAOE,UAAU,KAAK,QAAQ,IAAID,KAAK,CAACE,QAAQ,CAACD,UAAU,CAAC;AACrE,CAAC;AAED,SAASH,wBAAwB,EAAEH,uBAAuB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["KPA_TO_MMHG"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/utils/kpa-to-mmhg.ts"],"mappings":";;AAAA;AACA,MAAMA,WAAW,GAAG,OAAO;AAE3B,SAASA,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const MILLISECONDS_PER_SECOND = 1000;
|
|
4
|
+
|
|
5
|
+
/** The Bluetooth SIG heart-rate RR-Interval resolution: counts of 1/1024 s. */
|
|
6
|
+
const RR_COUNTS_PER_SECOND = 1024;
|
|
7
|
+
const RR_DECIMALS = 2;
|
|
8
|
+
|
|
9
|
+
/** An RR-Interval count from a Heart Rate Measurement, in milliseconds. */
|
|
10
|
+
const rrIntervalMilliseconds = counts => Number((counts * MILLISECONDS_PER_SECOND / RR_COUNTS_PER_SECOND).toFixed(RR_DECIMALS));
|
|
11
|
+
export { rrIntervalMilliseconds };
|
|
12
|
+
//# sourceMappingURL=rr-interval.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MILLISECONDS_PER_SECOND","RR_COUNTS_PER_SECOND","RR_DECIMALS","rrIntervalMilliseconds","counts","Number","toFixed"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/utils/rr-interval.ts"],"mappings":";;AAAA,MAAMA,uBAAuB,GAAG,IAAI;;AAEpC;AACA,MAAMC,oBAAoB,GAAG,IAAI;AAEjC,MAAMC,WAAW,GAAG,CAAC;;AAErB;AACA,MAAMC,sBAAsB,GAAIC,MAAc,IAC5CC,MAAM,CACJ,CAAED,MAAM,GAAGJ,uBAAuB,GAAIC,oBAAoB,EAAEK,OAAO,CACjEJ,WACF,CACF,CAAC;AAEH,SAASC,sBAAsB","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/** Where on the body a thermometer took its reading: the Bluetooth SIG Temperature Type. */
|
|
4
|
+
|
|
5
|
+
/** Indexed by the Temperature Type code, which starts at 1; code 0 is reserved. */
|
|
6
|
+
const TEMPERATURE_TYPES = ["armpit", "body", "ear", "finger", "gastrointestinal-tract", "mouth", "rectum", "toe", "tympanum"];
|
|
7
|
+
|
|
8
|
+
/** The body site for a Temperature Type code; undefined for a reserved or unknown code. */
|
|
9
|
+
const temperatureTypeFromCode = code => TEMPERATURE_TYPES[code - 1];
|
|
10
|
+
export { temperatureTypeFromCode };
|
|
11
|
+
//# sourceMappingURL=temperature-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TEMPERATURE_TYPES","temperatureTypeFromCode","code"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/utils/temperature-type.ts"],"mappings":";;AAAA;;AAYA;AACA,MAAMA,iBAA6C,GAAG,CACpD,QAAQ,EACR,MAAM,EACN,KAAK,EACL,QAAQ,EACR,wBAAwB,EACxB,OAAO,EACP,QAAQ,EACR,KAAK,EACL,UAAU,CACX;;AAED;AACA,MAAMC,uBAAuB,GAAIC,IAAY,IAC3CF,iBAAiB,CAACE,IAAI,GAAG,CAAC,CAAC;AAE7B,SAASD,uBAAuB","ignoreList":[]}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
export { BluetoothRuntime } from "./runtime.js";
|
|
13
13
|
export { BluetoothError } from "./errors.js";
|
|
14
14
|
export { defineDevice } from "./devices.js";
|
|
15
|
-
export { dailyTotalsOnly, everyReading, firstReadingPerKind, keepReadings, policyByKind } from "./result-policy.js";
|
|
15
|
+
export { acceptedMemorySlots, dailyTotalsOnly, everyReading, firstReadingPerKind, keepReadings, policyByKind } from "./result-policy.js";
|
|
16
16
|
export { SIG_PROTOCOLS } from "./sig-profiles.js";
|
|
17
17
|
export { bleManagerScanner } from "./ble-plx/ble-scanner.js";
|
|
18
18
|
export { builtInDevices } from "./ble-plx/built-in-devices.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BluetoothRuntime","BluetoothError","defineDevice","dailyTotalsOnly","everyReading","firstReadingPerKind","keepReadings","policyByKind","SIG_PROTOCOLS","bleManagerScanner","builtInDevices","IntegratedDevices","osBluetoothPermissions","ovokReadingSink","createBluetoothRuntime","BluetoothProvider","useBluetooth","useBluetoothPermission","useBluetoothState","useMeasurements","useNearbyDevice","useNearbyDevices","usePairedDevices","useScanning","BluetoothDevicePicker"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,cAAW;AAE5C,SAASC,cAAc,QAAQ,aAAU;AAOzC,SAASC,YAAY,QAAQ,cAAW;AAIxC,
|
|
1
|
+
{"version":3,"names":["BluetoothRuntime","BluetoothError","defineDevice","acceptedMemorySlots","dailyTotalsOnly","everyReading","firstReadingPerKind","keepReadings","policyByKind","SIG_PROTOCOLS","bleManagerScanner","builtInDevices","IntegratedDevices","osBluetoothPermissions","ovokReadingSink","createBluetoothRuntime","BluetoothProvider","useBluetooth","useBluetoothPermission","useBluetoothState","useMeasurements","useNearbyDevice","useNearbyDevices","usePairedDevices","useScanning","BluetoothDevicePicker"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,cAAW;AAE5C,SAASC,cAAc,QAAQ,aAAU;AAOzC,SAASC,YAAY,QAAQ,cAAW;AAIxC,SACEC,mBAAmB,EACnBC,eAAe,EACfC,YAAY,EACZC,mBAAmB,EACnBC,YAAY,EACZC,YAAY,QACP,oBAAiB;AAExB,SAASC,aAAa,QAAQ,mBAAgB;AAE9C,SAASC,iBAAiB,QAAQ,0BAAuB;AACzD,SAASC,cAAc,QAAQ,+BAA4B;AAC3D,SAASC,iBAAiB,QAAQ,iDAA8C;AAEhF,SAASC,sBAAsB,QAAQ,kCAA+B;AACtE,SAASC,eAAe,QAAQ,6BAA0B;AAC1D,SAASC,sBAAsB,QAAQ,4CAAyC;AAGhF,SAASC,iBAAiB,EAAEC,YAAY,QAAQ,oBAAiB;AAEjE,SACEC,sBAAsB,EACtBC,iBAAiB,EACjBC,eAAe,EACfC,eAAe,EACfC,gBAAgB,EAChBC,gBAAgB,EAChBC,WAAW,QACN,kBAAe;AACtB,SAASC,qBAAqB,QAAQ,oCAAiC","ignoreList":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { isFromAcceptedMemorySlot } from "../../bt-management/utils/device-user.js";
|
|
3
4
|
import { dailyTotalDay } from "./daily-total-day.js";
|
|
4
5
|
|
|
5
6
|
/** Makes, for each connection, the test of which readings to keep. */
|
|
@@ -38,6 +39,12 @@ const dailyTotalsOnly = () => {
|
|
|
38
39
|
};
|
|
39
40
|
};
|
|
40
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Keeps the readings of the device users in `slots` (a multi-user device reports its user as `memorySlot`, starting at
|
|
44
|
+
* 1), and drops the others. A reading that names no device user is kept.
|
|
45
|
+
*/
|
|
46
|
+
const acceptedMemorySlots = slots => () => reading => isFromAcceptedMemorySlot(reading, slots);
|
|
47
|
+
|
|
41
48
|
/** Applies a policy per measurement type, and `fallback` to the other types. */
|
|
42
49
|
const policyByKind = (policies, fallback = everyReading) => () => {
|
|
43
50
|
const tests = new Map();
|
|
@@ -62,5 +69,5 @@ async function* keepReadings(events, policy) {
|
|
|
62
69
|
}
|
|
63
70
|
}
|
|
64
71
|
}
|
|
65
|
-
export { dailyTotalsOnly, everyReading, firstReadingPerKind, keepReadings, policyByKind };
|
|
72
|
+
export { acceptedMemorySlots, dailyTotalsOnly, everyReading, firstReadingPerKind, keepReadings, policyByKind };
|
|
66
73
|
//# sourceMappingURL=result-policy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["dailyTotalDay","everyReading","firstReadingPerKind","reported","Set","measurementTypeKey","has","add","dailyTotalsOnly","reading","day","Date","now","undefined","key","policyByKind","policies","fallback","tests","Map","fallbackTest","policy","test","get","set","keepReadings","events","keep","event","kind"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/result-policy.ts"],"mappings":";;AAEA,SAASA,aAAa,QAAQ,sBAAmB;;AAGjD;;AAGA;AACA,MAAMC,YAA0B,GAAGA,CAAA,KAAM,MAAM,IAAI;;AAEnD;AACA,MAAMC,mBAAiC,GAAGA,CAAA,KAAM;EAC9C,MAAMC,QAAQ,GAAG,IAAIC,GAAG,CAAqB,CAAC;EAE9C,OAAO,CAAC;IAAEC;EAAmB,CAAC,KAAK;IACjC,IAAIF,QAAQ,CAACG,GAAG,CAACD,kBAAkB,CAAC,EAAE;MACpC,OAAO,KAAK;IACd;IAEAF,QAAQ,CAACI,GAAG,CAACF,kBAAkB,CAAC;IAEhC,OAAO,IAAI;EACb,CAAC;AACH,CAAC;;AAED;AACA,MAAMG,eAA6B,GAAGA,CAAA,KAAM;EAC1C,MAAML,QAAQ,GAAG,IAAIC,GAAG,CAAS,CAAC;EAElC,OAAQK,OAAO,IAAK;IAClB,MAAMC,GAAG,GAAGV,aAAa,CAACS,OAAO,EAAEE,IAAI,CAACC,GAAG,CAAC,CAAC,CAAC;IAE9C,IAAIF,GAAG,KAAKG,SAAS,EAAE;MACrB,OAAO,IAAI;IACb;IAEA,MAAMC,GAAG,GAAG,GAAGL,OAAO,CAACJ,kBAAkB,IAAIK,GAAG,EAAE;IAElD,IAAIA,GAAG,KAAK,QAAQ,IAAIP,QAAQ,CAACG,GAAG,CAACQ,GAAG,CAAC,EAAE;MACzC,OAAO,KAAK;IACd;IAEAX,QAAQ,CAACI,GAAG,CAACO,GAAG,CAAC;IAEjB,OAAO,IAAI;EACb,CAAC;AACH,CAAC;;AAED;AACA,MAAMC,YAAY,GAAGA,CACnBC,QAA2D,EAC3DC,QAAsB,
|
|
1
|
+
{"version":3,"names":["isFromAcceptedMemorySlot","dailyTotalDay","everyReading","firstReadingPerKind","reported","Set","measurementTypeKey","has","add","dailyTotalsOnly","reading","day","Date","now","undefined","key","acceptedMemorySlots","slots","policyByKind","policies","fallback","tests","Map","fallbackTest","policy","test","get","set","keepReadings","events","keep","event","kind"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/result-policy.ts"],"mappings":";;AAEA,SAASA,wBAAwB,QAAQ,0CAAuC;AAEhF,SAASC,aAAa,QAAQ,sBAAmB;;AAGjD;;AAGA;AACA,MAAMC,YAA0B,GAAGA,CAAA,KAAM,MAAM,IAAI;;AAEnD;AACA,MAAMC,mBAAiC,GAAGA,CAAA,KAAM;EAC9C,MAAMC,QAAQ,GAAG,IAAIC,GAAG,CAAqB,CAAC;EAE9C,OAAO,CAAC;IAAEC;EAAmB,CAAC,KAAK;IACjC,IAAIF,QAAQ,CAACG,GAAG,CAACD,kBAAkB,CAAC,EAAE;MACpC,OAAO,KAAK;IACd;IAEAF,QAAQ,CAACI,GAAG,CAACF,kBAAkB,CAAC;IAEhC,OAAO,IAAI;EACb,CAAC;AACH,CAAC;;AAED;AACA,MAAMG,eAA6B,GAAGA,CAAA,KAAM;EAC1C,MAAML,QAAQ,GAAG,IAAIC,GAAG,CAAS,CAAC;EAElC,OAAQK,OAAO,IAAK;IAClB,MAAMC,GAAG,GAAGV,aAAa,CAACS,OAAO,EAAEE,IAAI,CAACC,GAAG,CAAC,CAAC,CAAC;IAE9C,IAAIF,GAAG,KAAKG,SAAS,EAAE;MACrB,OAAO,IAAI;IACb;IAEA,MAAMC,GAAG,GAAG,GAAGL,OAAO,CAACJ,kBAAkB,IAAIK,GAAG,EAAE;IAElD,IAAIA,GAAG,KAAK,QAAQ,IAAIP,QAAQ,CAACG,GAAG,CAACQ,GAA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