@ovok/native 0.4.7 → 0.4.9
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/bt-manager.js +15 -13
- package/lib/commonjs/modules/bt-management/services/bt-manager.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 +12 -2
- package/lib/commonjs/modules/bt-management/services/device-creator.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01-command-sequencer.js +184 -0
- package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01-command-sequencer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01-frame-parser.js +114 -0
- package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01-frame-parser.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01.device.js +113 -51
- package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01.device.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01.main-services.js +41 -77
- package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01.main-services.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/bt-manager.js +15 -13
- package/lib/module/modules/bt-management/services/bt-manager.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 +12 -2
- package/lib/module/modules/bt-management/services/device-creator.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bc01/bc01-command-sequencer.js +180 -0
- package/lib/module/modules/bt-management/services/devices/bc01/bc01-command-sequencer.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/bc01/bc01-frame-parser.js +110 -0
- package/lib/module/modules/bt-management/services/devices/bc01/bc01-frame-parser.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/bc01/bc01.device.js +113 -51
- package/lib/module/modules/bt-management/services/devices/bc01/bc01.device.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bc01/bc01.main-services.js +41 -77
- package/lib/module/modules/bt-management/services/devices/bc01/bc01.main-services.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/bt-manager.d.ts +0 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.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/bc01/bc01-command-sequencer.d.ts +53 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01-command-sequencer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01-frame-parser.d.ts +53 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01-frame-parser.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01.device.d.ts +33 -13
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01.device.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01.main-services.d.ts +11 -17
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01.main-services.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/bt-manager.d.ts +0 -1
- package/lib/typescript/module/src/modules/bt-management/services/bt-manager.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/bc01/bc01-command-sequencer.d.ts +53 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01-command-sequencer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01-frame-parser.d.ts +53 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01-frame-parser.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01.device.d.ts +33 -13
- package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01.device.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01.main-services.d.ts +11 -17
- package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01.main-services.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
|
@@ -9,93 +9,57 @@ var _caseType = require("../../../types/case-type.js");
|
|
|
9
9
|
/**
|
|
10
10
|
* Contec BC401 (a.k.a. BC01) urine analyzer — GATT profile.
|
|
11
11
|
*
|
|
12
|
-
* The BC401 uses Contec's proprietary FF12 service, shared across their
|
|
13
|
-
* medical devices.
|
|
14
|
-
*
|
|
12
|
+
* The BC401 uses Contec's proprietary FF12 service, shared across their
|
|
13
|
+
* consumer medical devices. Every stored URS-7 measurement is pushed as a
|
|
14
|
+
* 16-byte record on 0xFF02 after the host has walked the handshake documented
|
|
15
|
+
* in `bc01-command-sequencer.ts`.
|
|
15
16
|
*
|
|
16
17
|
* Service 0xFF12
|
|
17
|
-
* Notify (result)
|
|
18
|
-
* Write (command)
|
|
18
|
+
* Notify (result) 0xFF02 — CCCD 0x2902 must be written 01 00 to enable
|
|
19
|
+
* Write (command) 0xFF01 — RESET / SET_TIME / GET_COUNT / GET_RECORDS
|
|
19
20
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* [5..15] values one byte per analyte, encoding the discrete
|
|
26
|
-
* level index into diagnosticResults[key]
|
|
27
|
-
* [16] checksum xor over [2..15]
|
|
28
|
-
*
|
|
29
|
-
* Byte positions calibrated against PHMS 3.0.03 Android app; older firmware
|
|
30
|
-
* (< 1.2.x) uses a different command byte and is not supported by this driver
|
|
31
|
-
* (the validator will reject those frames).
|
|
21
|
+
* On the wire a stored URS record opens with 0xE1 (single) or 0xE2 (paginated).
|
|
22
|
+
* The remaining fifteen bytes carry the flags nibble, timestamp, seven bytes of
|
|
23
|
+
* packed 3-bit analyte indices, and a checksum. `bc01-frame-parser.ts` decodes
|
|
24
|
+
* them; this file just declares the GATT surface and hands every E1/E2 frame
|
|
25
|
+
* to the driver's dependent-result path so the parser can run.
|
|
32
26
|
*/
|
|
33
27
|
const bc01MainServices = exports.bc01MainServices = [{
|
|
34
28
|
uuid: "0000ff12-0000-1000-8000-00805f9b34fb",
|
|
35
|
-
|
|
29
|
+
/**
|
|
30
|
+
* PHMS 3.0.03 writes `[0x80, 0x00]` to 0xFF01 the moment its GATT
|
|
31
|
+
* subscription is up — decompiled at L1/f.java:694 ("发送复位命令" — "send
|
|
32
|
+
* reset command"). The device answers nothing until this reset lands. The
|
|
33
|
+
* `Bc01CommandSequencer` returns the same reset from `initialCommands()`
|
|
34
|
+
* so the SDK sends it whether or not the polling default is in play.
|
|
35
|
+
*/
|
|
36
|
+
writeUuid: {
|
|
36
37
|
uuid: "0000ff01-0000-1000-8000-00805f9b34fb",
|
|
38
|
+
mainCommandUuid: "8000"
|
|
39
|
+
},
|
|
40
|
+
monitorUuids: [{
|
|
41
|
+
uuid: "0000ff02-0000-1000-8000-00805f9b34fb",
|
|
42
|
+
/**
|
|
43
|
+
* We key on the first byte only. A `DEPENDENT` case fires
|
|
44
|
+
* `handleDependentResult` in the driver, which runs the real decoder
|
|
45
|
+
* (`parseBc01Record`) against the raw frame bytes and calls
|
|
46
|
+
* `onResult` directly. The parsing case itself carries no field
|
|
47
|
+
* definitions — the packed 3-bits-per-pad layout is not expressible
|
|
48
|
+
* with the ordinary declaration parser and would need the vendor's
|
|
49
|
+
* own decoding table pinned in a declaration to be so.
|
|
50
|
+
*/
|
|
37
51
|
parsingModel: {
|
|
38
|
-
caseValuePosition: [0
|
|
52
|
+
caseValuePosition: [0],
|
|
39
53
|
cases: [{
|
|
40
54
|
measurementTypeKey: _core.MeasurementTypeKey.uricAcid,
|
|
41
|
-
caseType: _caseType.CaseType.
|
|
42
|
-
caseValue: "
|
|
43
|
-
parseDefinitions: [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
name: "bld",
|
|
50
|
-
parseType: "number",
|
|
51
|
-
byteIndexes: [6],
|
|
52
|
-
parseReference: 16
|
|
53
|
-
}, {
|
|
54
|
-
name: "bil",
|
|
55
|
-
parseType: "number",
|
|
56
|
-
byteIndexes: [7],
|
|
57
|
-
parseReference: 16
|
|
58
|
-
}, {
|
|
59
|
-
name: "ket",
|
|
60
|
-
parseType: "number",
|
|
61
|
-
byteIndexes: [8],
|
|
62
|
-
parseReference: 16
|
|
63
|
-
}, {
|
|
64
|
-
name: "glu",
|
|
65
|
-
parseType: "number",
|
|
66
|
-
byteIndexes: [9],
|
|
67
|
-
parseReference: 16
|
|
68
|
-
}, {
|
|
69
|
-
name: "pro",
|
|
70
|
-
parseType: "number",
|
|
71
|
-
byteIndexes: [10],
|
|
72
|
-
parseReference: 16
|
|
73
|
-
}, {
|
|
74
|
-
name: "ph",
|
|
75
|
-
parseType: "number",
|
|
76
|
-
byteIndexes: [11],
|
|
77
|
-
parseReference: 16
|
|
78
|
-
}, {
|
|
79
|
-
name: "nit",
|
|
80
|
-
parseType: "number",
|
|
81
|
-
byteIndexes: [12],
|
|
82
|
-
parseReference: 16
|
|
83
|
-
}, {
|
|
84
|
-
name: "leu",
|
|
85
|
-
parseType: "number",
|
|
86
|
-
byteIndexes: [13],
|
|
87
|
-
parseReference: 16
|
|
88
|
-
}, {
|
|
89
|
-
name: "sg",
|
|
90
|
-
parseType: "number",
|
|
91
|
-
byteIndexes: [14],
|
|
92
|
-
parseReference: 16
|
|
93
|
-
}, {
|
|
94
|
-
name: "vc",
|
|
95
|
-
parseType: "number",
|
|
96
|
-
byteIndexes: [15],
|
|
97
|
-
parseReference: 16
|
|
98
|
-
}]
|
|
55
|
+
caseType: _caseType.CaseType.DEPENDENT,
|
|
56
|
+
caseValue: "e1",
|
|
57
|
+
parseDefinitions: []
|
|
58
|
+
}, {
|
|
59
|
+
measurementTypeKey: _core.MeasurementTypeKey.uricAcid,
|
|
60
|
+
caseType: _caseType.CaseType.DEPENDENT,
|
|
61
|
+
caseValue: "e2",
|
|
62
|
+
parseDefinitions: []
|
|
99
63
|
}]
|
|
100
64
|
}
|
|
101
65
|
}]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_core","require","_caseType","bc01MainServices","exports","uuid","monitorUuids","parsingModel","caseValuePosition","cases","measurementTypeKey","MeasurementTypeKey","uricAcid","caseType","CaseType","
|
|
1
|
+
{"version":3,"names":["_core","require","_caseType","bc01MainServices","exports","uuid","writeUuid","mainCommandUuid","monitorUuids","parsingModel","caseValuePosition","cases","measurementTypeKey","MeasurementTypeKey","uricAcid","caseType","CaseType","DEPENDENT","caseValue","parseDefinitions"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/bc01/bc01.main-services.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,gBAA4B,GAAAC,OAAA,CAAAD,gBAAA,GAAG,CAC1C;EACEE,IAAI,EAAE,sCAAsC;EAE5C;AACJ;AACA;AACA;AACA;AACA;AACA;EACIC,SAAS,EAAE;IACTD,IAAI,EAAE,sCAAsC;IAC5CE,eAAe,EAAE;EACnB,CAAC;EACDC,YAAY,EAAE,CACZ;IACEH,IAAI,EAAE,sCAAsC;IAE5C;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACQI,YAAY,EAAE;MACZC,iBAAiB,EAAE,CAAC,CAAC,CAAC;MACtBC,KAAK,EAAE,CACL;QACEC,kBAAkB,EAAEC,wBAAkB,CAACC,QAAQ;QAC/CC,QAAQ,EAAEC,kBAAQ,CAACC,SAAS;QAC5BC,SAAS,EAAE,IAAI;QACfC,gBAAgB,EAAE;MACpB,CAAC,EACD;QACEP,kBAAkB,EAAEC,wBAAkB,CAACC,QAAQ;QAC/CC,QAAQ,EAAEC,kBAAQ,CAACC,SAAS;QAC5BC,SAAS,EAAE,IAAI;QACfC,gBAAgB,EAAE;MACpB,CAAC;IAEL;EACF,CAAC;AAEL,CAAC,CACF","ignoreList":[]}
|
|
@@ -91,6 +91,20 @@ class BTCommandWriter {
|
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
93
|
|
|
94
|
+
/**
|
|
95
|
+
* Writes one chunk the way the characteristic accepts writes.
|
|
96
|
+
*
|
|
97
|
+
* A with-response write to a characteristic that only supports write-without-response
|
|
98
|
+
* fails outright, so the command says which it is rather than the transport guessing.
|
|
99
|
+
*/
|
|
100
|
+
writeTo = async (command, value) => {
|
|
101
|
+
if (command.withoutResponse) {
|
|
102
|
+
await this.device.writeCharacteristicWithoutResponseForService(command.serviceUuid, command.characteristicUuid, value);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
await this.device.writeCharacteristicWithResponseForService(command.serviceUuid, command.characteristicUuid, value);
|
|
106
|
+
};
|
|
107
|
+
|
|
94
108
|
/**
|
|
95
109
|
* Splits a frame into writes the link will carry whole.
|
|
96
110
|
*
|
|
@@ -120,7 +134,7 @@ class BTCommandWriter {
|
|
|
120
134
|
if (!isConnected) {
|
|
121
135
|
return false;
|
|
122
136
|
}
|
|
123
|
-
await this.
|
|
137
|
+
await this.writeTo(command, (0, _hexToBase.hexToBase64)(chunk.join("")));
|
|
124
138
|
return true;
|
|
125
139
|
} catch (error) {
|
|
126
140
|
(0, _sentryLogger.sentryLogger)("error", "DEVICE: Error sending command", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_sLog","require","_sentryLogger","_hexToBase","MAX_WRITE_ATTEMPTS","DEFAULT_ATT_MTU","ATT_WRITE_HEADER_BYTES","BTCommandWriter","pendingWrites","Promise","resolve","mtu","constructor","device","onError","useNegotiatedMtu","Number","isInteger","reset","send","commands","then","writeInOrder","catch","error","command","writeCommand","chunk","chunksOf","frame","written","writeChunk","size","Math","max","chunks","start","length","push","slice","attempt","isConnected","
|
|
1
|
+
{"version":3,"names":["_sLog","require","_sentryLogger","_hexToBase","MAX_WRITE_ATTEMPTS","DEFAULT_ATT_MTU","ATT_WRITE_HEADER_BYTES","BTCommandWriter","pendingWrites","Promise","resolve","mtu","constructor","device","onError","useNegotiatedMtu","Number","isInteger","reset","send","commands","then","writeInOrder","catch","error","command","writeCommand","chunk","chunksOf","frame","written","writeChunk","writeTo","value","withoutResponse","writeCharacteristicWithoutResponseForService","serviceUuid","characteristicUuid","writeCharacteristicWithResponseForService","size","Math","max","chunks","start","length","push","slice","attempt","isConnected","hexToBase64","join","sentryLogger","Error","message","deviceName","name","slog","exports"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/bt-command-writer.ts"],"mappings":";;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAEA,IAAAE,UAAA,GAAAF,OAAA;AAEA,MAAMG,kBAAkB,GAAG,CAAC;;AAE5B;AACA,MAAMC,eAAe,GAAG,EAAE;;AAE1B;AACA,MAAMC,sBAAsB,GAAG,CAAC;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,eAAe,CAAC;EACnBC,aAAa,GAAkBC,OAAO,CAACC,OAAO,CAAC,CAAC;EAChDC,GAAG,GAAGN,eAAe;EAEtBO,WAAWA,CACCC,MAAc,EACdC,OAA2C,EAC5D;IAAA,KAFiBD,MAAc,GAAdA,MAAc;IAAA,KACdC,OAA2C,GAA3CA,OAA2C;EAC3D;;EAEH;AACF;AACA;AACA;AACA;AACA;AACA;EACSC,gBAAgB,GAAIJ,GAAY,IAAW;IAChD,IAAI,OAAOA,GAAG,KAAK,QAAQ,IAAIK,MAAM,CAACC,SAAS,CAACN,GAAG,CAAC,IAAIA,GAAG,GAAG,IAAI,CAACA,GAAG,EAAE;MACtE,IAAI,CAACA,GAAG,GAAGA,GAAG;IAChB;EACF,CAAC;;EAED;EACOO,KAAK,GAAGA,CAAA,KAAY;IACzB,IAAI,CAACV,aAAa,GAAGC,OAAO,CAACC,OAAO,CAAC,CAAC;EACxC,CAAC;;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACSS,IAAI,GAAIC,QAAkC,IAAoB;IACnE,IAAI,CAACZ,aAAa,GAAG,IAAI,CAACA,aAAa,CACpCa,IAAI,CAAC,MAAM,IAAI,CAACC,YAAY,CAACF,QAAQ,CAAC,CAAC,CACvCG,KAAK,CAAEC,KAAK,IAAK;MAChB,IAAI,CAACV,OAAO,GAAGU,KAAyB,CAAC;IAC3C,CAAC,CAAC;IAEJ,OAAO,IAAI,CAAChB,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AK,CAACiB,KAAK,CAACH,KAAK,EAAEA,KAAK,GAAGJ,IAAI,CAAC,CAAC;IAC/C;IAEA,OAAOG,MAAM;EACf,CAAC;;EAED;AACF;AACA;AACA;AACA;AACA;AACA;EACUX,UAAU,GAAG,MAAAA,CACnBN,OAAsB,EACtBE,KAAwB,KACH;IACrB,KAAK,IAAIoB,OAAO,GAAG,CAAC,EAAEA,OAAO,IAAI3C,kBAAkB,EAAE2C,OAAO,EAAE,EAAE;MAC9D,IAAI;QACF,MAAMC,WAAW,GAAG,MAAM,IAAI,CAACnC,MAAM,CAACmC,WAAW,CAAC,CAAC;QAEnD,IAAI,CAACA,WAAW,EAAE;UAChB,OAAO,KAAK;QACd;QAEA,MAAM,IAAI,CAAChB,OAAO,CAACP,OAAO,EAAE,IAAAwB,sBAAW,EAACtB,KAAK,CAACuB,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QAExD,OAAO,IAAI;MACb,CAAC,CAAC,OAAO1B,KAAK,EAAE;QACd,IAAA2B,0BAAY,EAAC,OAAO,EAAE,+BAA+B,EAAE;UACrD3B,KAAK,EAAEA,KAAK,YAAY4B,KAAK,GAAG5B,KAAK,CAAC6B,OAAO,GAAG7B,KAAK;UACrD8B,UAAU,EAAE,IAAI,CAACzC,MAAM,CAAC0C;QAC1B,CAAC,CAAC;QAEF,IAAIR,OAAO,KAAK3C,kBAAkB,EAAE;UAClC,IAAAoD,UAAI,EAAChC,KAAK,EAAE,8CAA8C,EAAE;YAC1D8B,UAAU,EAAE,IAAI,CAACzC,MAAM,CAAC0C;UAC1B,CAAC,CAAC;QACJ;MACF;IACF;IAEA,OAAO,KAAK;EACd,CAAC;AACH;AAACE,OAAA,CAAAlD,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.createLepuSequencer = void 0;
|
|
6
|
+
exports.recordLepuIdentity = exports.createLepuSequencer = void 0;
|
|
7
|
+
var _sentryLogger = require("../../../../helpers/utils/sentry-logger.js");
|
|
7
8
|
var _lepuCommandBuilder = require("../lepu/lepu.command-builder.js");
|
|
8
9
|
var _lepuIdentityGate = require("../lepu/lepu.identity-gate.js");
|
|
9
10
|
/** Registration guarantees at least one start byte; this keeps the indexed read total. */
|
|
@@ -19,6 +20,24 @@ const DEFAULT_START_BYTE = "a5";
|
|
|
19
20
|
* answers on the one it is addressed with, so the list matters for reading and its head for
|
|
20
21
|
* writing.
|
|
21
22
|
*/
|
|
23
|
+
/**
|
|
24
|
+
* Records what the device said it was.
|
|
25
|
+
*
|
|
26
|
+
* The model number is logged because it is the only place one exists: the vendor's SDK
|
|
27
|
+
* never reads the field back, so a declaration written without it is completed by
|
|
28
|
+
* connecting once and reading this line.
|
|
29
|
+
*/
|
|
30
|
+
const recordLepuIdentity = (deviceData, info) => {
|
|
31
|
+
deviceData.sn = info.serialNumber;
|
|
32
|
+
(0, _sentryLogger.sentryLogger)("info", "BT_MANAGER: Device identified itself", {
|
|
33
|
+
deviceId: deviceData.id,
|
|
34
|
+
deviceName: deviceData.name,
|
|
35
|
+
deviceType: info.deviceType,
|
|
36
|
+
branchCode: info.branchCode,
|
|
37
|
+
protocolMaxLength: info.protocolMaxLength
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
exports.recordLepuIdentity = recordLepuIdentity;
|
|
22
41
|
const createLepuSequencer = (lepu, report) => new _lepuIdentityGate.LepuIdentityGate({
|
|
23
42
|
write: {
|
|
24
43
|
serviceUuid: lepu.write.serviceUuid,
|
package/lib/commonjs/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_sentryLogger","require","_lepuCommandBuilder","_lepuIdentityGate","DEFAULT_START_BYTE","recordLepuIdentity","deviceData","info","sn","serialNumber","sentryLogger","deviceId","id","deviceName","name","deviceType","branchCode","protocolMaxLength","exports","createLepuSequencer","lepu","report","LepuIdentityGate","write","serviceUuid","characteristicUuid","builder","LepuCommandBuilder","startBytes","expectedDeviceTypes","pollCommand","undefined","onIdentified","onRefused"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/custom/custom-lepu-sequencer.ts"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAIA,IAAAC,mBAAA,GAAAD,OAAA;AAEA,IAAAE,iBAAA,GAAAF,OAAA;AAEA;AACA,MAAMG,kBAAkB,GAAG,IAAI;AAO/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,GAAGA,CACzBC,UAAsB,EACtBC,IAAoB,KACX;EACTD,UAAU,CAACE,EAAE,GAAGD,IAAI,CAACE,YAAY;EAEjC,IAAAC,0BAAY,EAAC,MAAM,EAAE,sCAAsC,EAAE;IAC3DC,QAAQ,EAAEL,UAAU,CAACM,EAAE;IACvBC,UAAU,EAAEP,UAAU,CAACQ,IAAI;IAC3BC,UAAU,EAAER,IAAI,CAACQ,UAAU;IAC3BC,UAAU,EAAET,IAAI,CAACS,UAAU;IAC3BC,iBAAiB,EAAEV,IAAI,CAACU;EAC1B,CAAC,CAAC;AACJ,CAAC;AAACC,OAAA,CAAAb,kBAAA,GAAAA,kBAAA;AAEF,MAAMc,mBAAmB,GAAGA,CAC1BC,IAAoB,EACpBC,MAAsB,KAEtB,IAAIC,kCAAgB,CAAC;EACnBC,KAAK,EAAE;IACLC,WAAW,EAAEJ,IAAI,CAACG,KAAK,CAACC,WAAW;IACnCC,kBAAkB,EAAEL,IAAI,CAACG,KAAK,CAACE;EACjC,CAAC;EACDC,OAAO,EAAE,IAAIC,sCAAkB,CAACP,IAAI,CAACQ,UAAU,CAAC,CAAC,CAAC,IAAIxB,kBAAkB,CAAC;EACzEyB,mBAAmB,EAAET,IAAI,CAACS,mBAAmB;EAC7C,IAAIT,IAAI,CAACU,WAAW,KAAKC,SAAS,GAAG,CAAC,CAAC,GAAG;IAAED,WAAW,EAAEV,IAAI,CAACU;EAAY,CAAC,CAAC;EAC5EE,YAAY,EAAEX,MAAM,CAACW,YAAY;EACjCC,SAAS,EAAEZ,MAAM,CAACY;AACpB,CAAC,CAAC;AAACf,OAAA,CAAAC,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -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,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BAAkB,EAAEJ,WAAW,CAACI;IAClC,CAAiB;IAEjBJ,WAAW,CAACK,UAAU,CAACvD,OAAO,CAAEwD,IAAI,IAAK;MACvCH,OAAO,CAACG,IAAI,CAAC,GAAGjB,UAAU,CAACiB,IAAI,CAAC;IAClC,CAAC,CAAC;IAEF,MAAMC,SAAS,GAAGP,WAAW,CAACK,UAAU,CACrCG,GAAG,CAAEF,IAAI,IACR,IAAAG,wCAAmB,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;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