@ovok/native 0.4.7 → 0.4.8
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-device/constants/device-instruction-pdfs.js +3 -1
- package/lib/commonjs/modules/bt-device/constants/device-instruction-pdfs.js.map +1 -1
- package/lib/commonjs/modules/bt-management/constants/integrated-devices-map.js +1 -1
- package/lib/commonjs/modules/bt-management/constants/integrated-devices-map.js.map +1 -1
- package/lib/commonjs/modules/bt-management/index.js +44 -0
- package/lib/commonjs/modules/bt-management/index.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/custom/compile-case-shape.js +52 -0
- package/lib/commonjs/modules/bt-management/services/custom/compile-case-shape.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/custom/compile-custom-case.js +8 -2
- package/lib/commonjs/modules/bt-management/services/custom/compile-custom-case.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/custom/compile-custom-field.js +3 -0
- package/lib/commonjs/modules/bt-management/services/custom/compile-custom-field.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/device-creator.js +5 -1
- package/lib/commonjs/modules/bt-management/services/device-creator.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js +15 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js +20 -1
- package/lib/commonjs/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js +30 -44
- package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/frame-parser.js +2 -1
- package/lib/commonjs/modules/bt-management/services/devices/frame-parser.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/sentinel-frame-reader.js +84 -0
- package/lib/commonjs/modules/bt-management/services/devices/sentinel-frame-reader.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js +27 -53
- 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.profile.js +55 -0
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.bp-monitors.js +43 -0
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.bp-monitors.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.duo-control-device.js +113 -0
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.duo-control-device.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.js +120 -0
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.ecg-device.js +92 -0
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.ecg-device.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.ecg-samples.js +64 -0
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.ecg-samples.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.ecg-transfer.js +94 -0
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.ecg-transfer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/types/integrated-devices.js +2 -0
- package/lib/commonjs/modules/bt-management/types/integrated-devices.js.map +1 -1
- package/lib/commonjs/modules/bt-management/utils/create-custom-field-parser.js +21 -0
- package/lib/commonjs/modules/bt-management/utils/create-custom-field-parser.js.map +1 -1
- package/lib/commonjs/modules/bt-management/utils/parse-measurement.js +10 -7
- package/lib/commonjs/modules/bt-management/utils/parse-measurement.js.map +1 -1
- package/lib/commonjs/modules/bt-management/utils/reject-custom-reading.js +34 -0
- package/lib/commonjs/modules/bt-management/utils/reject-custom-reading.js.map +1 -0
- package/lib/module/modules/bt-device/constants/device-instruction-pdfs.js +3 -1
- package/lib/module/modules/bt-device/constants/device-instruction-pdfs.js.map +1 -1
- package/lib/module/modules/bt-management/constants/integrated-devices-map.js +1 -1
- package/lib/module/modules/bt-management/constants/integrated-devices-map.js.map +1 -1
- package/lib/module/modules/bt-management/index.js +4 -0
- package/lib/module/modules/bt-management/index.js.map +1 -1
- package/lib/module/modules/bt-management/services/custom/compile-case-shape.js +48 -0
- package/lib/module/modules/bt-management/services/custom/compile-case-shape.js.map +1 -0
- package/lib/module/modules/bt-management/services/custom/compile-custom-case.js +8 -2
- package/lib/module/modules/bt-management/services/custom/compile-custom-case.js.map +1 -1
- package/lib/module/modules/bt-management/services/custom/compile-custom-field.js +3 -0
- package/lib/module/modules/bt-management/services/custom/compile-custom-field.js.map +1 -1
- package/lib/module/modules/bt-management/services/device-creator.js +5 -1
- package/lib/module/modules/bt-management/services/device-creator.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-command-writer.js +15 -1
- package/lib/module/modules/bt-management/services/devices/bt-command-writer.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js +20 -1
- package/lib/module/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/custom/custom.device.js +31 -45
- package/lib/module/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/frame-parser.js +2 -1
- package/lib/module/modules/bt-management/services/devices/frame-parser.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/sentinel-frame-reader.js +79 -0
- package/lib/module/modules/bt-management/services/devices/sentinel-frame-reader.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js +19 -45
- 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.profile.js +50 -0
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.bp-monitors.js +38 -0
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.bp-monitors.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.duo-control-device.js +108 -0
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.duo-control-device.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.js +116 -0
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.ecg-device.js +87 -0
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.ecg-device.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.ecg-samples.js +60 -0
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.ecg-samples.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.ecg-transfer.js +89 -0
- package/lib/module/modules/bt-management/services/devices/veroval/veroval.ecg-transfer.js.map +1 -0
- package/lib/module/modules/bt-management/types/device-measurement-map.js +3 -3
- package/lib/module/modules/bt-management/types/device-measurement-map.js.map +1 -1
- package/lib/module/modules/bt-management/types/integrated-devices.js +2 -0
- package/lib/module/modules/bt-management/types/integrated-devices.js.map +1 -1
- package/lib/module/modules/bt-management/utils/create-custom-field-parser.js +21 -0
- package/lib/module/modules/bt-management/utils/create-custom-field-parser.js.map +1 -1
- package/lib/module/modules/bt-management/utils/parse-measurement.js +10 -7
- package/lib/module/modules/bt-management/utils/parse-measurement.js.map +1 -1
- package/lib/module/modules/bt-management/utils/reject-custom-reading.js +29 -0
- package/lib/module/modules/bt-management/utils/reject-custom-reading.js.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-device/constants/device-instruction-pdfs.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/constants/integrated-devices-map.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-case-shape.d.ts +19 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-case-shape.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-case.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-field.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/device-creator.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-command-writer.d.ts +7 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-command-writer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts +11 -2
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts +10 -13
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/frame-parser.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/sentinel-frame-reader.d.ts +52 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/sentinel-frame-reader.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts +22 -13
- 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.profile.d.ts +45 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.bp-monitors.d.ts +18 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.bp-monitors.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.duo-control-device.d.ts +19 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.duo-control-device.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.d.ts +45 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.ecg-device.d.ts +30 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.ecg-device.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.ecg-samples.d.ts +39 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.ecg-samples.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.ecg-transfer.d.ts +35 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.ecg-transfer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-case-spec.d.ts +30 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-case-spec.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-field-encoding.d.ts +7 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-field-encoding.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/dependent-result-handler-params.d.ts +7 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/dependent-result-handler-params.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-command.d.ts +9 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-command.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/integrated-devices.d.ts +3 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/integrated-devices.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/parsing-case.d.ts +8 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/parsing-case.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/utils/create-custom-field-parser.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/utils/parse-measurement.d.ts +4 -1
- package/lib/typescript/commonjs/src/modules/bt-management/utils/parse-measurement.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/utils/reject-custom-reading.d.ts +15 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/reject-custom-reading.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-device/constants/device-instruction-pdfs.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/constants/integrated-devices-map.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/index.d.ts +4 -0
- package/lib/typescript/module/src/modules/bt-management/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/custom/compile-case-shape.d.ts +19 -0
- package/lib/typescript/module/src/modules/bt-management/services/custom/compile-case-shape.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-case.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-field.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/device-creator.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-command-writer.d.ts +7 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-command-writer.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts +11 -2
- package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts +10 -13
- package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/frame-parser.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/sentinel-frame-reader.d.ts +52 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/sentinel-frame-reader.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts +22 -13
- 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.profile.d.ts +45 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.bp-monitors.d.ts +18 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.bp-monitors.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.duo-control-device.d.ts +19 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.duo-control-device.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.d.ts +45 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.ecg-device.d.ts +30 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.ecg-device.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.ecg-samples.d.ts +39 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.ecg-samples.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.ecg-transfer.d.ts +35 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.ecg-transfer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/types/custom-case-spec.d.ts +30 -0
- package/lib/typescript/module/src/modules/bt-management/types/custom-case-spec.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/custom-field-encoding.d.ts +7 -1
- package/lib/typescript/module/src/modules/bt-management/types/custom-field-encoding.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/dependent-result-handler-params.d.ts +7 -0
- package/lib/typescript/module/src/modules/bt-management/types/dependent-result-handler-params.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/device-command.d.ts +9 -0
- package/lib/typescript/module/src/modules/bt-management/types/device-command.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts +2 -0
- package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/integrated-devices.d.ts +3 -1
- package/lib/typescript/module/src/modules/bt-management/types/integrated-devices.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/parsing-case.d.ts +8 -0
- package/lib/typescript/module/src/modules/bt-management/types/parsing-case.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/utils/create-custom-field-parser.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/utils/parse-measurement.d.ts +4 -1
- package/lib/typescript/module/src/modules/bt-management/utils/parse-measurement.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/utils/reject-custom-reading.d.ts +15 -0
- package/lib/typescript/module/src/modules/bt-management/utils/reject-custom-reading.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -4,9 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.CustomDevice = void 0;
|
|
7
|
-
var _sentryLogger = require("../../../../helpers/utils/sentry-logger.js");
|
|
8
7
|
var _caseType = require("../../../types/case-type.js");
|
|
9
8
|
var _createFrameValidator = require("../../../utils/create-frame-validator.js");
|
|
9
|
+
var _parseMeasurement = require("../../../utils/parse-measurement.js");
|
|
10
|
+
var _rejectCustomReading = require("../../../utils/reject-custom-reading.js");
|
|
10
11
|
var _btManagedDevice = require("../bt-managed-device.js");
|
|
11
12
|
var _lepuFrameReader = require("../lepu/lepu.frame-reader.js");
|
|
12
13
|
var _customLepuSequencer = require("./custom-lepu-sequencer.js");
|
|
@@ -53,29 +54,7 @@ class CustomDevice extends _btManagedDevice.BTManagedDevice {
|
|
|
53
54
|
onRefused: this.onIdentityRefused
|
|
54
55
|
});
|
|
55
56
|
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Records what the device said it was.
|
|
59
|
-
*
|
|
60
|
-
* The model number is logged because it is the only place one exists: the vendor's SDK
|
|
61
|
-
* never reads the field back, so a declaration written without it is completed by
|
|
62
|
-
* connecting once and reading this line.
|
|
63
|
-
*/
|
|
64
|
-
onIdentified = info => {
|
|
65
|
-
this.deviceData.sn = info.serialNumber;
|
|
66
|
-
(0, _sentryLogger.sentryLogger)("info", "BT_MANAGER: Device identified itself", {
|
|
67
|
-
deviceId: this.deviceData.id,
|
|
68
|
-
deviceName: this.deviceData.name,
|
|
69
|
-
deviceType: info.deviceType,
|
|
70
|
-
branchCode: info.branchCode,
|
|
71
|
-
protocolMaxLength: info.protocolMaxLength
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Nothing is sent to a device that could not be identified, because the same opcode means
|
|
77
|
-
* different things on different models in this family.
|
|
78
|
-
*/
|
|
57
|
+
onIdentified = info => (0, _customLepuSequencer.recordLepuIdentity)(this.deviceData, info);
|
|
79
58
|
onIdentityRefused = reason => {
|
|
80
59
|
this.onError?.(new Error(`Custom device "${this.definition.id}" was not addressed: ${reason}.`));
|
|
81
60
|
};
|
|
@@ -94,7 +73,7 @@ class CustomDevice extends _btManagedDevice.BTManagedDevice {
|
|
|
94
73
|
*/
|
|
95
74
|
handleDependentResult = data => {
|
|
96
75
|
try {
|
|
97
|
-
this.
|
|
76
|
+
this.reportFrame(data);
|
|
98
77
|
} catch (error) {
|
|
99
78
|
this.onError?.(error);
|
|
100
79
|
}
|
|
@@ -115,6 +94,26 @@ class CustomDevice extends _btManagedDevice.BTManagedDevice {
|
|
|
115
94
|
return;
|
|
116
95
|
}
|
|
117
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Reports what the frame carried, which may be more than one reading.
|
|
99
|
+
*
|
|
100
|
+
* A device handing over its stored history answers one request with every record it
|
|
101
|
+
* holds, back to back. Those were taken at different times and are separate readings, so
|
|
102
|
+
* each record is decoded and reported on its own. A trailing part-record is ignored: half
|
|
103
|
+
* a record is not a reading.
|
|
104
|
+
*/
|
|
105
|
+
reportFrame(data) {
|
|
106
|
+
const repeated = data.parsingCase.repeatedRecords;
|
|
107
|
+
if (!repeated || !data.frame) {
|
|
108
|
+
this.report(data.parsedData, data.parsingCase);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const records = Math.floor((data.frame.length - repeated.from) / repeated.recordBytes);
|
|
112
|
+
for (let record = 0; record < records; record++) {
|
|
113
|
+
this.report((0, _parseMeasurement.parseMeasurement)(data.frame, data.parsingCase, repeated.from + record * repeated.recordBytes), data.parsingCase);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
118
117
|
/**
|
|
119
118
|
* Reports every reading the frame carried.
|
|
120
119
|
*
|
|
@@ -129,11 +128,14 @@ class CustomDevice extends _btManagedDevice.BTManagedDevice {
|
|
|
129
128
|
report(parsedData, parsingCase) {
|
|
130
129
|
const measurements = parsingCase.measurements ?? [];
|
|
131
130
|
if (measurements.length === 0) {
|
|
132
|
-
this.
|
|
131
|
+
this.discard("a result frame carries no measurement type", parsedData);
|
|
133
132
|
return;
|
|
134
133
|
}
|
|
135
134
|
measurements.forEach(measurement => this.reportMeasurement(parsedData, measurement));
|
|
136
135
|
}
|
|
136
|
+
discard(reason, parsedData) {
|
|
137
|
+
this.onError?.((0, _rejectCustomReading.discardedReadingError)(this.definition.id, reason, parsedData));
|
|
138
|
+
}
|
|
137
139
|
reportMeasurement(parsedData, measurement) {
|
|
138
140
|
const reading = {
|
|
139
141
|
caseType: parsedData.caseType,
|
|
@@ -142,29 +144,13 @@ class CustomDevice extends _btManagedDevice.BTManagedDevice {
|
|
|
142
144
|
measurement.fieldNames.forEach(name => {
|
|
143
145
|
reading[name] = parsedData[name];
|
|
144
146
|
});
|
|
145
|
-
const rejection = measurement.fieldNames.map(name => this.
|
|
147
|
+
const rejection = measurement.fieldNames.map(name => (0, _rejectCustomReading.rejectCustomReading)(this.definition.fields, measurement.measurementTypeKey, name, reading[name])).find(message => message !== undefined);
|
|
146
148
|
if (rejection) {
|
|
147
|
-
this.
|
|
149
|
+
this.discard(rejection, reading);
|
|
148
150
|
return;
|
|
149
151
|
}
|
|
150
152
|
this.onResult?.(reading);
|
|
151
153
|
}
|
|
152
|
-
reject(measurementTypeKey, name, value) {
|
|
153
|
-
const field = this.definition.fields.get(`${measurementTypeKey}:${name}`);
|
|
154
|
-
if (!field) {
|
|
155
|
-
return `decoded "${name}", which is not declared for ${measurementTypeKey}`;
|
|
156
|
-
}
|
|
157
|
-
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
158
|
-
return `could not decode ${name}; the frame was shorter than the declaration expects`;
|
|
159
|
-
}
|
|
160
|
-
if (value < field.min || value > field.max) {
|
|
161
|
-
return `decoded ${name} = ${value} ${field.unit}, outside the accepted range ${field.min}-${field.max} ${field.unit}`;
|
|
162
|
-
}
|
|
163
|
-
return undefined;
|
|
164
|
-
}
|
|
165
|
-
fail(reason, parsedData) {
|
|
166
|
-
this.onError?.(new Error(`Custom device "${this.definition.id}": ${reason}. The reading was discarded (decoded ${JSON.stringify(parsedData)}).`));
|
|
167
|
-
}
|
|
168
154
|
}
|
|
169
155
|
exports.CustomDevice = CustomDevice;
|
|
170
156
|
//# sourceMappingURL=custom.device.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_caseType","require","_createFrameValidator","_parseMeasurement","_rejectCustomReading","_btManagedDevice","_lepuFrameReader","_customLepuSequencer","CustomDevice","BTManagedDevice","validators","Map","constructor","device","params","definition","mainServices","stuckDataTimeout","preferredMtu","undefined","declareLepuProtocol","frames","forEach","frame","uuid","set","createFrameValidator","lepu","frameReader","LepuFrameReader","startBytes","createCommandSequencer","createLepuSequencer","onIdentified","onRefused","onIdentityRefused","info","recordLepuIdentity","deviceData","reason","onError","Error","id","validatePackage","pkg","validate","get","String","toLowerCase","handleDependentResult","data","reportFrame","error","parsingCase","caseType","CaseType","OTHER","handleSuccessResult","repeated","repeatedRecords","report","parsedData","records","Math","floor","length","from","recordBytes","record","parseMeasurement","measurements","discard","measurement","reportMeasurement","discardedReadingError","reading","measurementTypeKey","fieldNames","name","rejection","map","rejectCustomReading","fields","find","message","onResult","exports"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/custom/custom.device.ts"],"mappings":";;;;;;AAEA,IAAAA,SAAA,GAAAC,OAAA;AAUA,IAAAC,qBAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAH,OAAA;AAIA,IAAAI,gBAAA,GAAAJ,OAAA;AAEA,IAAAK,gBAAA,GAAAL,OAAA;AAEA,IAAAM,oBAAA,GAAAN,OAAA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMO,YAAY,SAASC,gCAAe,CAAiB;EAM/CC,UAAU,GAAG,IAAIC,GAAG,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AmB,EACjB,IAAI,CAAClE,UAAU,CAACmE,MAAM,EACtBV,WAAW,CAACI,kBAAkB,EAC9BE,IAAI,EACJH,OAAO,CAACG,IAAI,CACd,CACF,CAAC,CACAK,IAAI,CAAEC,OAAO,IAAKA,OAAO,KAAKjE,SAAS,CAAC;IAE3C,IAAI4D,SAAS,EAAE;MACb,IAAI,CAACR,OAAO,CAACQ,SAAS,EAAEJ,OAAO,CAAC;MAEhC;IACF;IAEA,IAAI,CAACU,QAAQ,GAAGV,OAAO,CAAC;EAC1B;AAEF;AAACW,OAAA,CAAA9E,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_parseMeasurement","require","FrameParser","constructor","mainServices","parse","uuid","frame","parsingModel","findParsingModel","caseValue","readCaseValue","parsingCase","cases","find","declared","parsedData","parseMeasurement","measurementTypeKey","mainService","characteristic","monitorUuids","monitored","toLowerCase","undefined","caseValuePosition","map","index","join","exports"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/frame-parser.ts"],"mappings":";;;;;;AAMA,IAAAA,iBAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,WAAW,CAAwB;EAC9CC,WAAWA,CAAkBC,YAA2C,EAAE;IAAA,KAA7CA,YAA2C,GAA3CA,YAA2C;EAAG;EAEpEC,KAAKA,CACVC,IAAY,EACZC,KAAe,EAC8B;IAC7C,MAAMC,YAAY,GAAG,IAAI,CAACC,gBAAgB,CAACH,IAAI,CAAC;IAEhD,IAAI,CAACE,YAAY,EAAE;MACjB;IACF;IAEA,MAAME,SAAS,GAAG,IAAI,CAACC,aAAa,CAACH,YAAY,EAAED,KAAK,CAAC;IAEzD,MAAMK,WAAW,GAAGJ,YAAY,CAACK,KAAK,EAAEC,IAAI,CACzCC,QAAQ,IAAKA,QAAQ,CAACL,SAAS,KAAKA,SACvC,CAAC;IAED,IAAI,CAACE,WAAW,EAAE;MAChB;IACF;IAEA,MAAMI,UAAU,GAAG,IAAAC,kCAAgB,EAACV,KAAK,EAAEK,WAAW,CAAC;IAEvD,IAAI,CAACI,UAAU,EAAE;MACf;IACF;IAEA,OAAO;MACLJ,WAAW;MACXM,kBAAkB,EAAEN,WAAW,CAACM,kBAAkB;MAClDF,UAAU,EAAEA;
|
|
1
|
+
{"version":3,"names":["_parseMeasurement","require","FrameParser","constructor","mainServices","parse","uuid","frame","parsingModel","findParsingModel","caseValue","readCaseValue","parsingCase","cases","find","declared","parsedData","parseMeasurement","measurementTypeKey","mainService","characteristic","monitorUuids","monitored","toLowerCase","undefined","caseValuePosition","map","index","join","exports"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/frame-parser.ts"],"mappings":";;;;;;AAMA,IAAAA,iBAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,WAAW,CAAwB;EAC9CC,WAAWA,CAAkBC,YAA2C,EAAE;IAAA,KAA7CA,YAA2C,GAA3CA,YAA2C;EAAG;EAEpEC,KAAKA,CACVC,IAAY,EACZC,KAAe,EAC8B;IAC7C,MAAMC,YAAY,GAAG,IAAI,CAACC,gBAAgB,CAACH,IAAI,CAAC;IAEhD,IAAI,CAACE,YAAY,EAAE;MACjB;IACF;IAEA,MAAME,SAAS,GAAG,IAAI,CAACC,aAAa,CAACH,YAAY,EAAED,KAAK,CAAC;IAEzD,MAAMK,WAAW,GAAGJ,YAAY,CAACK,KAAK,EAAEC,IAAI,CACzCC,QAAQ,IAAKA,QAAQ,CAACL,SAAS,KAAKA,SACvC,CAAC;IAED,IAAI,CAACE,WAAW,EAAE;MAChB;IACF;IAEA,MAAMI,UAAU,GAAG,IAAAC,kCAAgB,EAACV,KAAK,EAAEK,WAAW,CAAC;IAEvD,IAAI,CAACI,UAAU,EAAE;MACf;IACF;IAEA,OAAO;MACLJ,WAAW;MACXM,kBAAkB,EAAEN,WAAW,CAACM,kBAAkB;MAClDF,UAAU,EAAEA,UAAwC;MACpDT;IACF,CAAC;EACH;EAEQE,gBAAgBA,CAACH,IAAY,EAA4B;IAC/D,KAAK,MAAMa,WAAW,IAAI,IAAI,CAACf,YAAY,EAAE;MAC3C,MAAMgB,cAAc,GAAGD,WAAW,CAACE,YAAY,CAACP,IAAI,CACjDQ,SAAS,IAAKA,SAAS,CAAChB,IAAI,CAACiB,WAAW,CAAC,CAAC,KAAKjB,IAAI,CAACiB,WAAW,CAAC,CACnE,CAAC;MAED,IAAIH,cAAc,EAAE;QAClB,OAAOA,cAAc,CAACZ,YAAY;MACpC;IACF;IAEA,OAAOgB,SAAS;EAClB;EAEQb,aAAaA,CAACH,YAA0B,EAAED,KAAe,EAAU;IACzE,OACEC,YAAY,CAACiB,iBAAiB,EAAEC,GAAG,CAAEC,KAAK,IAAKpB,KAAK,CAACoB,KAAK,CAAC,CAAC,CAACC,IAAI,CAAC,EAAE,CAAC,IACrE,EAAE;EAEN;AACF;AAACC,OAAA,CAAA3B,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SentinelFrameReader = void 0;
|
|
7
|
+
var _frameReadStatus = require("../../types/frame-read-status.js");
|
|
8
|
+
const lower = byte => (byte ?? "").toLowerCase();
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Reads a reply that ends on a sentinel byte rather than declaring its length.
|
|
12
|
+
*
|
|
13
|
+
* The Veroval duo control answers this way, as serial protocols generally do: a request is
|
|
14
|
+
* answered across as many notifications as it takes and the end is marked, not counted. The
|
|
15
|
+
* reader therefore cannot know how much is coming and holds the buffer until the terminator
|
|
16
|
+
* lands - which is why the cap exists.
|
|
17
|
+
*
|
|
18
|
+
* There is no integrity check to make. A sentinel protocol carries no checksum, so a frame
|
|
19
|
+
* that reaches a parser here has been delimited, not verified, and whatever decodes it is
|
|
20
|
+
* the only thing standing between a corrupted reply and a reported reading. Declare a range
|
|
21
|
+
* for every field.
|
|
22
|
+
*/
|
|
23
|
+
class SentinelFrameReader {
|
|
24
|
+
constructor(spec) {
|
|
25
|
+
this.spec = spec;
|
|
26
|
+
}
|
|
27
|
+
readFrame(buffer) {
|
|
28
|
+
const first = lower(buffer[0]);
|
|
29
|
+
if (buffer.length > 0 && (this.spec.standaloneBytes ?? []).includes(first)) {
|
|
30
|
+
return {
|
|
31
|
+
status: _frameReadStatus.FrameReadStatus.COMPLETE,
|
|
32
|
+
consumedBytes: 1,
|
|
33
|
+
frame: [first]
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
const start = this.frameStart(buffer);
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A declared start byte is one byte, so there is no partial match to preserve: a buffer
|
|
40
|
+
* without it holds no frame start and is junk in its entirety.
|
|
41
|
+
*/
|
|
42
|
+
if (start === undefined) {
|
|
43
|
+
return {
|
|
44
|
+
status: _frameReadStatus.FrameReadStatus.INCOMPLETE,
|
|
45
|
+
consumedBytes: buffer.length
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const end = buffer.findIndex((byte, index) => index >= start && lower(byte) === this.spec.terminator);
|
|
49
|
+
if (end === -1) {
|
|
50
|
+
return this.incompleteOrOverlong(buffer, start);
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
status: _frameReadStatus.FrameReadStatus.COMPLETE,
|
|
54
|
+
consumedBytes: end + 1,
|
|
55
|
+
frame: buffer.slice(start, end)
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Where the payload begins: after the start byte when one is declared, and at zero when
|
|
61
|
+
* none is. A declared start byte that has not arrived means the reply has not begun.
|
|
62
|
+
*/
|
|
63
|
+
frameStart(buffer) {
|
|
64
|
+
if (this.spec.start === undefined) {
|
|
65
|
+
return 0;
|
|
66
|
+
}
|
|
67
|
+
const index = buffer.findIndex(byte => lower(byte) === this.spec.start);
|
|
68
|
+
return index === -1 ? undefined : index + 1;
|
|
69
|
+
}
|
|
70
|
+
incompleteOrOverlong(buffer, start) {
|
|
71
|
+
if (buffer.length - start <= this.spec.maxFrameBytes) {
|
|
72
|
+
return {
|
|
73
|
+
status: _frameReadStatus.FrameReadStatus.INCOMPLETE,
|
|
74
|
+
consumedBytes: 0
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
status: _frameReadStatus.FrameReadStatus.CORRUPT,
|
|
79
|
+
consumedBytes: buffer.length
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.SentinelFrameReader = SentinelFrameReader;
|
|
84
|
+
//# sourceMappingURL=sentinel-frame-reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_frameReadStatus","require","lower","byte","toLowerCase","SentinelFrameReader","constructor","spec","readFrame","buffer","first","length","standaloneBytes","includes","status","FrameReadStatus","COMPLETE","consumedBytes","frame","start","frameStart","undefined","INCOMPLETE","end","findIndex","index","terminator","incompleteOrOverlong","slice","maxFrameBytes","CORRUPT","exports"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/sentinel-frame-reader.ts"],"mappings":";;;;;;AACA,IAAAA,gBAAA,GAAAC,OAAA;AAgCA,MAAMC,KAAK,GAAIC,IAAwB,IAAa,CAACA,IAAI,IAAI,EAAE,EAAEC,WAAW,CAAC,CAAC;;AAE9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,mBAAmB,CAAwB;EAC/CC,WAAWA,CAAkBC,IAAuB,EAAE;IAAA,KAAzBA,IAAuB,GAAvBA,IAAuB;EAAG;EAEvDC,SAASA,CAACC,MAAyB,EAAmB;IAC3D,MAAMC,KAAK,GAAGR,KAAK,CAACO,MAAM,CAAC,CAAC,CAAC,CAAC;I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AAOM,KAAK,KAAK,CAAC,CAAC,GAAGJ,SAAS,GAAGI,KAAK,GAAG,CAAC;EAC7C;EAEQE,oBAAoBA,CAC1BlB,MAAyB,EACzBU,KAAa,EACI;IACjB,IAAIV,MAAM,CAACE,MAAM,GAAGQ,KAAK,IAAI,IAAI,CAACZ,IAAI,CAACsB,aAAa,EAAE;MACpD,OAAO;QAAEf,MAAM,EAAEC,gCAAe,CAACO,UAAU;QAAEL,aAAa,EAAE;MAAE,CAAC;IACjE;IAEA,OAAO;MAAEH,MAAM,EAAEC,gCAAe,CAACe,OAAO;MAAEb,aAAa,EAAER,MAAM,CAACE;IAAO,CAAC;EAC1E;AACF;AAACoB,OAAA,CAAA1B,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.standardWeightScaleDevice = exports.standardThermometerDevice = exports.standardPulseOximeterDevice = exports.standardHeartRateDevice = exports.standardBloodPressureDevice = void 0;
|
|
7
7
|
var _core = require("@ovok/core");
|
|
8
|
-
var
|
|
8
|
+
var _standardGattProfile = require("./standard-gatt.profile.js");
|
|
9
9
|
/**
|
|
10
10
|
* Declarations for the Bluetooth SIG vital-signs profiles.
|
|
11
11
|
*
|
|
@@ -23,73 +23,47 @@ var _defineCustomDevice = require("../../custom/define-custom-device.js");
|
|
|
23
23
|
* such a device yields no reading rather than one that is quietly wrong.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
/** Milliseconds a spot-check device may take to produce its reading. */
|
|
27
|
-
const SPOT_CHECK_TIMEOUT_MS = 60_000;
|
|
28
|
-
const sigUuid = assigned => `0000${assigned}-0000-1000-8000-00805f9b34fb`;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* The flags byte selects the case, because it decides which optional fields are present and
|
|
32
|
-
* therefore where the later ones sit. Every declared case reads the same offsets, so only
|
|
33
|
-
* fields that keep their position across all of them may be declared.
|
|
34
|
-
*/
|
|
35
|
-
const declareProfile = (params, profile) => (0, _defineCustomDevice.defineCustomDevice)({
|
|
36
|
-
id: params.id,
|
|
37
|
-
nameMatch: params.nameMatch,
|
|
38
|
-
stuckDataTimeoutMs: params.stuckDataTimeoutMs ?? SPOT_CHECK_TIMEOUT_MS,
|
|
39
|
-
services: [{
|
|
40
|
-
uuid: sigUuid(profile.service),
|
|
41
|
-
monitor: [{
|
|
42
|
-
uuid: sigUuid(profile.characteristic),
|
|
43
|
-
frame: {
|
|
44
|
-
minLengthBytes: profile.minLengthBytes
|
|
45
|
-
},
|
|
46
|
-
caseSelectorBytes: [0],
|
|
47
|
-
cases: profile.selectors.map(selector => ({
|
|
48
|
-
selector,
|
|
49
|
-
kind: "result",
|
|
50
|
-
measurementTypeKey: profile.measurementTypeKey,
|
|
51
|
-
fields: [...profile.fields]
|
|
52
|
-
}))
|
|
53
|
-
}]
|
|
54
|
-
}]
|
|
55
|
-
});
|
|
56
|
-
const littleEndian = (name, byteIndexes, unit, encoding) => ({
|
|
57
|
-
name,
|
|
58
|
-
byteIndexes,
|
|
59
|
-
byteOrder: "little",
|
|
60
|
-
encoding,
|
|
61
|
-
unit
|
|
62
|
-
});
|
|
63
|
-
|
|
64
26
|
/**
|
|
65
27
|
* Blood Pressure Service 0x1810, Blood Pressure Measurement 0x2A35.
|
|
66
28
|
*
|
|
67
|
-
* The
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
29
|
+
* The pressures sit at bytes 1-4 whatever the flags say. The pulse rate sits behind two of
|
|
30
|
+
* them: bit 1 puts a seven-byte timestamp in front of it and bit 2 says whether it is there
|
|
31
|
+
* at all, so it is read at byte 7 in one shape and byte 14 in the other, and each shape
|
|
32
|
+
* declares the length it needs. A device that reports no pulse still decodes, because the
|
|
33
|
+
* flags value it sends selects a case that never looks for one.
|
|
72
34
|
*/
|
|
73
|
-
const standardBloodPressureDevice = params => declareProfile(params, {
|
|
35
|
+
const standardBloodPressureDevice = params => (0, _standardGattProfile.declareProfile)(params, {
|
|
74
36
|
service: "1810",
|
|
75
37
|
characteristic: "2a35",
|
|
76
38
|
minLengthBytes: 7,
|
|
77
39
|
measurementTypeKey: _core.MeasurementTypeKey.bloodPressure,
|
|
78
40
|
/** mmHg, with and without the timestamp and pulse the pressures sit in front of. */
|
|
79
41
|
selectors: ["00", "02", "04", "06"],
|
|
80
|
-
fields: [littleEndian("systolic", [1, 2], "mmHg", "sfloat"), littleEndian("diastolic", [3, 4], "mmHg", "sfloat")]
|
|
42
|
+
fields: [(0, _standardGattProfile.littleEndian)("systolic", [1, 2], "mmHg", "sfloat"), (0, _standardGattProfile.littleEndian)("diastolic", [3, 4], "mmHg", "sfloat")],
|
|
43
|
+
optionalFields: {
|
|
44
|
+
/** Pulse, no timestamp: it follows the mean pressure. */
|
|
45
|
+
"04": {
|
|
46
|
+
fields: [(0, _standardGattProfile.littleEndian)("heartRate", [7, 8], "bpm", "sfloat")],
|
|
47
|
+
minLengthBytes: 9
|
|
48
|
+
},
|
|
49
|
+
/** Pulse behind a seven-byte timestamp. */
|
|
50
|
+
"06": {
|
|
51
|
+
fields: [(0, _standardGattProfile.littleEndian)("heartRate", [14, 15], "bpm", "sfloat")],
|
|
52
|
+
minLengthBytes: 16
|
|
53
|
+
}
|
|
54
|
+
}
|
|
81
55
|
});
|
|
82
56
|
|
|
83
57
|
/** Health Thermometer Service 0x1809, Temperature Measurement 0x2A1C. */
|
|
84
58
|
exports.standardBloodPressureDevice = standardBloodPressureDevice;
|
|
85
|
-
const standardThermometerDevice = params => declareProfile(params, {
|
|
59
|
+
const standardThermometerDevice = params => (0, _standardGattProfile.declareProfile)(params, {
|
|
86
60
|
service: "1809",
|
|
87
61
|
characteristic: "2a1c",
|
|
88
62
|
minLengthBytes: 5,
|
|
89
63
|
measurementTypeKey: _core.MeasurementTypeKey.temperature,
|
|
90
64
|
/** Celsius, with and without the timestamp that follows the reading. */
|
|
91
65
|
selectors: ["00", "02"],
|
|
92
|
-
fields: [littleEndian("bodyTemp", [1, 2, 3, 4], "Cel", "float")]
|
|
66
|
+
fields: [(0, _standardGattProfile.littleEndian)("bodyTemp", [1, 2, 3, 4], "Cel", "float")]
|
|
93
67
|
});
|
|
94
68
|
|
|
95
69
|
/** The SI weight resolution the specification fixes at five grams per count. */
|
|
@@ -101,7 +75,7 @@ const WEIGHT_KG_PER_COUNT = 0.005;
|
|
|
101
75
|
*
|
|
102
76
|
* The reading is a scaled integer rather than a float, so the resolution is applied here.
|
|
103
77
|
*/
|
|
104
|
-
const standardWeightScaleDevice = params => declareProfile(params, {
|
|
78
|
+
const standardWeightScaleDevice = params => (0, _standardGattProfile.declareProfile)(params, {
|
|
105
79
|
service: "181d",
|
|
106
80
|
characteristic: "2a9d",
|
|
107
81
|
minLengthBytes: 3,
|
|
@@ -109,7 +83,7 @@ const standardWeightScaleDevice = params => declareProfile(params, {
|
|
|
109
83
|
/** Kilograms, with and without the timestamp that follows the reading. */
|
|
110
84
|
selectors: ["00", "02"],
|
|
111
85
|
fields: [{
|
|
112
|
-
...littleEndian("bodyWeight", [1, 2], "kg", "uint"),
|
|
86
|
+
...(0, _standardGattProfile.littleEndian)("bodyWeight", [1, 2], "kg", "uint"),
|
|
113
87
|
scale: WEIGHT_KG_PER_COUNT,
|
|
114
88
|
decimals: 3
|
|
115
89
|
}]
|
|
@@ -122,13 +96,13 @@ const standardWeightScaleDevice = params => declareProfile(params, {
|
|
|
122
96
|
* specification: a spot-check measurement always carries both.
|
|
123
97
|
*/
|
|
124
98
|
exports.standardWeightScaleDevice = standardWeightScaleDevice;
|
|
125
|
-
const standardPulseOximeterDevice = params => declareProfile(params, {
|
|
99
|
+
const standardPulseOximeterDevice = params => (0, _standardGattProfile.declareProfile)(params, {
|
|
126
100
|
service: "1822",
|
|
127
101
|
characteristic: "2a5e",
|
|
128
102
|
minLengthBytes: 5,
|
|
129
103
|
measurementTypeKey: _core.MeasurementTypeKey.bloodOxygenPulseRate,
|
|
130
104
|
selectors: ["00"],
|
|
131
|
-
fields: [littleEndian("bloodOxygen", [1, 2], "%", "sfloat"), littleEndian("pulseRate", [3, 4], "bpm", "sfloat")]
|
|
105
|
+
fields: [(0, _standardGattProfile.littleEndian)("bloodOxygen", [1, 2], "%", "sfloat"), (0, _standardGattProfile.littleEndian)("pulseRate", [3, 4], "bpm", "sfloat")]
|
|
132
106
|
});
|
|
133
107
|
|
|
134
108
|
/**
|
|
@@ -139,7 +113,7 @@ const standardPulseOximeterDevice = params => declareProfile(params, {
|
|
|
139
113
|
* is left out rather than made to displace it.
|
|
140
114
|
*/
|
|
141
115
|
exports.standardPulseOximeterDevice = standardPulseOximeterDevice;
|
|
142
|
-
const standardHeartRateDevice = params => declareProfile(params, {
|
|
116
|
+
const standardHeartRateDevice = params => (0, _standardGattProfile.declareProfile)(params, {
|
|
143
117
|
service: "180d",
|
|
144
118
|
characteristic: "2a37",
|
|
145
119
|
minLengthBytes: 2,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_core","require","
|
|
1
|
+
{"version":3,"names":["_core","require","_standardGattProfile","standardBloodPressureDevice","params","declareProfile","service","characteristic","minLengthBytes","measurementTypeKey","MeasurementTypeKey","bloodPressure","selectors","fields","littleEndian","optionalFields","exports","standardThermometerDevice","temperature","WEIGHT_KG_PER_COUNT","standardWeightScaleDevice","bodyWeight","scale","decimals","standardPulseOximeterDevice","bloodOxygenPulseRate","standardHeartRateDevice","heartRate","name","byteIndexes","encoding","unit"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAIA,IAAAC,oBAAA,GAAAD,OAAA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;A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AC;AAEtD,CAAC,CAAC;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;AANAE,OAAA,CAAAQ,2BAAA,GAAAA,2BAAA;AAOA,MAAME,uBAAuB,GAC3BtB,MAA4B,IAE5B,IAAAC,mCAAc,EAACD,MAAM,EAAE;EACrBE,OAAO,EAAE,MAAM;EACfC,cAAc,EAAE,MAAM;EACtBC,cAAc,EAAE,CAAC;EACjBC,kBAAkB,EAAEC,wBAAkB,CAACiB,SAAS;EAChDf,SAAS,EAAE,CAAC,IAAI,CAAC;EACjBC,MAAM,EAAE,CACN;IAAEe,IAAI,EAAE,WAAW;IAAEC,WAAW,EAAE,CAAC,CAAC,CAAC;IAAEC,QAAQ,EAAE,MAAM;IAAEC,IAAI,EAAE;EAAM,CAAC;AAE1E,CAAC,CAAC;AAACf,OAAA,CAAAU,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.sigUuid = exports.littleEndian = exports.declareProfile = void 0;
|
|
7
|
+
var _defineCustomDevice = require("../../custom/define-custom-device.js");
|
|
8
|
+
/** Milliseconds a spot-check device may take to produce its reading. */
|
|
9
|
+
const SPOT_CHECK_TIMEOUT_MS = 60_000;
|
|
10
|
+
const sigUuid = assigned => `0000${assigned}-0000-1000-8000-00805f9b34fb`;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The flags byte selects the case, because it decides which optional fields are present and
|
|
14
|
+
* therefore where the later ones sit. Fields common to every shape are declared once; a
|
|
15
|
+
* field a flag adds is declared against the selector that carries it, at the offset that
|
|
16
|
+
* flag combination puts it and with the frame length that shape guarantees.
|
|
17
|
+
*/
|
|
18
|
+
exports.sigUuid = sigUuid;
|
|
19
|
+
const declareProfile = (params, profile) => (0, _defineCustomDevice.defineCustomDevice)({
|
|
20
|
+
id: params.id,
|
|
21
|
+
nameMatch: params.nameMatch,
|
|
22
|
+
stuckDataTimeoutMs: params.stuckDataTimeoutMs ?? SPOT_CHECK_TIMEOUT_MS,
|
|
23
|
+
services: [{
|
|
24
|
+
uuid: sigUuid(profile.service),
|
|
25
|
+
monitor: [{
|
|
26
|
+
uuid: sigUuid(profile.characteristic),
|
|
27
|
+
frame: {
|
|
28
|
+
minLengthBytes: profile.minLengthBytes
|
|
29
|
+
},
|
|
30
|
+
caseSelectorBytes: [0],
|
|
31
|
+
cases: profile.selectors.map(selector => {
|
|
32
|
+
const optional = profile.optionalFields?.[selector];
|
|
33
|
+
return {
|
|
34
|
+
selector,
|
|
35
|
+
kind: "result",
|
|
36
|
+
measurementTypeKey: profile.measurementTypeKey,
|
|
37
|
+
fields: [...profile.fields, ...(optional?.fields ?? [])],
|
|
38
|
+
...(optional ? {
|
|
39
|
+
minLengthBytes: optional.minLengthBytes
|
|
40
|
+
} : {})
|
|
41
|
+
};
|
|
42
|
+
})
|
|
43
|
+
}]
|
|
44
|
+
}]
|
|
45
|
+
});
|
|
46
|
+
exports.declareProfile = declareProfile;
|
|
47
|
+
const littleEndian = (name, byteIndexes, unit, encoding) => ({
|
|
48
|
+
name,
|
|
49
|
+
byteIndexes,
|
|
50
|
+
byteOrder: "little",
|
|
51
|
+
encoding,
|
|
52
|
+
unit
|
|
53
|
+
});
|
|
54
|
+
exports.littleEndian = littleEndian;
|
|
55
|
+
//# sourceMappingURL=standard-gatt.profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_defineCustomDevice","require","SPOT_CHECK_TIMEOUT_MS","sigUuid","assigned","exports","declareProfile","params","profile","defineCustomDevice","id","nameMatch","stuckDataTimeoutMs","services","uuid","service","monitor","characteristic","frame","minLengthBytes","caseSelectorBytes","cases","selectors","map","selector","optional","optionalFields","kind","measurementTypeKey","fields","littleEndian","name","byteIndexes","unit","encoding","byteOrder"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.ts"],"mappings":";;;;;;AAIA,IAAAA,mBAAA,GAAAC,OAAA;AAEA;AACA,MAAMC,qBAAqB,GAAG,MAAM;AAyCpC,MAAMC,OAAO,GAAIC,QAAgB,IAC/B,OAAOA,QAAQ,8BAA8B;;AAE/C;AACA;AACA;AACA;AACA;AACA;AALAC,OAAA,CAAAF,OAAA,GAAAA,OAAA;AAMA,MAAMG,cAAc,GAAGA,CACrBC,MAA4B,EAC5BC,OAAoB,KAEpB,IAAAC,sCAAkB,EAAC;EACjBC,EAAE,EAAEH,MAAM,CAACG,EAAE;EACbC,SAAS,EAAEJ,MAAM,CAACI,SAAS;EAC3BC,kBAAkB,EAAEL,MAAM,CAACK,kBAAkB,IAAIV,qBAAqB;EACtEW,QAAQ,EAAE,CACR;IACEC,IAAI,EAAEX,OAAO,CAACK,OAAO,CAACO,OAAO,CAAC;IAC9BC,OAAO,EAAE,CACP;MACEF,IAAI,EAAEX,OAAO,CAACK,OAAO,CAACS,cAAc,CAAC;MACrCC,KAAK,EAAE;QAAEC,cAAc,EAAEX,OAAO,CAACW;MAAe,CAAC;MACjDC,iBAAiB,EAAE,CAAC,CAAC,CAAC;MACtBC,KAAK,EAAEb,OAAO,CAACc,SAAS,CAACC,GAAG,CAAEC,QAAQ,IAAK;QACzC,MAAMC,QAAQ,GAAGjB,OAAO,CAACkB,cAAc,GAAGF,QAAQ,CAAC;QAEnD,OAAO;UACLA,QAAQ;UACRG,IAAI,EAAE,QAAiB;UACvBC,kBAAkB,EAAEpB,OAAO,CAACoB,kBAAkB;UAC9CC,MAAM,EAAE,CAAC,GAAGrB,OAAO,CAACqB,MAAM,EAAE,IAAIJ,QAAQ,EAAEI,MAAM,IAAI,EAAE,CAAC,CAAC;UACxD,IAAIJ,QAAQ,GACR;YAAEN,cAAc,EAAEM,QAAQ,CAACN;UAAe,CAAC,GAC3C,CAAC,CAAC;QACR,CAAC;MACH,CAAC;IACH,CAAC;EAEL,CAAC;AAEL,CAAC,CAAC;AAACd,OAAA,CAAAC,cAAA,GAAAA,cAAA;AAEL,MAAMwB,YAAY,GAAGA,CACnBC,IAAY,EACZC,WAAqB,EACrBC,IAAY,EACZC,QAAqC,MAChB;EACrBH,IAAI;EACJC,WAAW;EACXG,SAAS,EAAE,QAAQ;EACnBD,QAAQ;EACRD;AACF,CAAC,CAAC;AAAC5B,OAAA,CAAAyB,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.verovalCompactMonitor = exports.bpw26Monitor = exports.bpu26Monitor = exports.VEROVAL_BP_MODEL_NAMES = void 0;
|
|
7
|
+
var _standardGattDevices = require("../standard-gatt/standard-gatt.devices.js");
|
|
8
|
+
/**
|
|
9
|
+
* The Veroval compact+ blood-pressure monitors.
|
|
10
|
+
*
|
|
11
|
+
* There is nothing vendor-specific to decode here: these implement the Bluetooth
|
|
12
|
+
* blood-pressure profile as published - service 0x1810, measurement 0x2A35, notifications on
|
|
13
|
+
* the standard descriptor - so the layout comes from the specification and the SDK already
|
|
14
|
+
* reads it. What this adds is the identity, which is the only part the specification does
|
|
15
|
+
* not supply.
|
|
16
|
+
*
|
|
17
|
+
* The vendor's own app compares the advertised name for exact equality, ignoring case, so
|
|
18
|
+
* that is what these matchers do. The duo control and the Fusion are not here: those speak a
|
|
19
|
+
* protocol of their own on a private service, and so does the ECG.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
const BPU_26 = "BPU26";
|
|
23
|
+
const BPW_26 = "BPW26";
|
|
24
|
+
const verovalCompactMonitor = (advertisedName, params) => (0, _standardGattDevices.standardBloodPressureDevice)({
|
|
25
|
+
id: params.id,
|
|
26
|
+
nameMatch: params.nameMatch ?? new RegExp(`^${advertisedName}$`, "i"),
|
|
27
|
+
...(params.stuckDataTimeoutMs === undefined ? {} : {
|
|
28
|
+
stuckDataTimeoutMs: params.stuckDataTimeoutMs
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
/** BPU 26, the Veroval compact+ upper-arm monitor. */
|
|
33
|
+
exports.verovalCompactMonitor = verovalCompactMonitor;
|
|
34
|
+
const bpu26Monitor = params => verovalCompactMonitor(BPU_26, params);
|
|
35
|
+
|
|
36
|
+
/** BPW 26, the Veroval compact+ wrist monitor. */
|
|
37
|
+
exports.bpu26Monitor = bpu26Monitor;
|
|
38
|
+
const bpw26Monitor = params => verovalCompactMonitor(BPW_26, params);
|
|
39
|
+
|
|
40
|
+
/** The names these monitors advertise. */
|
|
41
|
+
exports.bpw26Monitor = bpw26Monitor;
|
|
42
|
+
const VEROVAL_BP_MODEL_NAMES = exports.VEROVAL_BP_MODEL_NAMES = [BPU_26, BPW_26];
|
|
43
|
+
//# sourceMappingURL=veroval.bp-monitors.js.map
|
package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.bp-monitors.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_standardGattDevices","require","BPU_26","BPW_26","verovalCompactMonitor","advertisedName","params","standardBloodPressureDevice","id","nameMatch","RegExp","stuckDataTimeoutMs","undefined","exports","bpu26Monitor","bpw26Monitor","VEROVAL_BP_MODEL_NAMES"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/veroval/veroval.bp-monitors.ts"],"mappings":";;;;;;AACA,IAAAA,oBAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMC,MAAM,GAAG,OAAO;AACtB,MAAMC,MAAM,GAAG,OAAO;AActB,MAAMC,qBAAqB,GAAGA,CAC5BC,cAAsB,EACtBC,MAAuB,KAEvB,IAAAC,gDAA2B,EAAC;EAC1BC,EAAE,EAAEF,MAAM,CAACE,EAAE;EACbC,SAAS,EAAEH,MAAM,CAACG,SAAS,IAAI,IAAIC,MAAM,CAAC,IAAIL,cAAc,GAAG,EAAE,GAAG,CAAC;EACrE,IAAIC,MAAM,CAACK,kBAAkB,KAAKC,SAAS,GACvC,CAAC,CAAC,GACF;IAAED,kBAAkB,EAAEL,MAAM,CAACK;EAAmB,CAAC;AACvD,CAAC,CAAC;;AAEJ;AAAAE,OAAA,CAAAT,qBAAA,GAAAA,qBAAA;AACA,MAAMU,YAAY,GAAIR,MAAuB,IAC3CF,qBAAqB,CAACF,MAAM,EAAEI,MAAM,CAAC;;AAEvC;AAAAO,OAAA,CAAAC,YAAA,GAAAA,YAAA;AACA,MAAMC,YAAY,GAAIT,MAAuB,IAC3CF,qBAAqB,CAACD,MAAM,EAAEG,MAAM,CAAC;;AAEvC;AAAAO,OAAA,CAAAE,YAAA,GAAAA,YAAA;AACA,MAAMC,sBAAyC,GAAAH,OAAA,CAAAG,sBAAA,GAAG,CAACd,MAAM,EAAEC,MAAM,CAAC","ignoreList":[]}
|