@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CaseType","BTManagedDevice","bc01MainServices","BC01Device","onStreamStart","mainServices","stuckDataTimeout","validatePackage","pkg","
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","CaseType","hexToByte","BTManagedDevice","Bc01CommandSequencer","BC01_ANALYTE_ORDER","parseBc01Record","bc01MainServices","BC01_FRAME_MIN_LENGTH","BC01Device","onStreamStart","mainServices","stuckDataTimeout","constructor","device","params","createCommandSequencer","write","serviceUuid","uuid","characteristicUuid","writeUuid","onRefused","reason","onError","Error","validatePackage","pkg","length","opcode","minLength","undefined","handleDependentResult","data","frame","reportUrsRecord","parsingCase","caseType","OTHER","handleSuccessResult","parsed","measuredValues","reduce","acc","analyte","value","values","Object","keys","reading","RESULT","measurementTypeKey","uricAcid","urineValues","recordedAt","timestamp","onResult"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/bc01/bc01.device.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAiC,YAAY;AAGxE,SAASC,QAAQ,QAAQ,6BAA0B;AAQnD,SAASC,SAAS,QAAQ,+BAA4B;AACtD,SAASC,eAAe,QAAQ,yBAAsB;AAEtD,SAASC,oBAAoB,QAAQ,6BAA0B;AAC/D,SAASC,kBAAkB,EAAEC,eAAe,QAAQ,wBAAqB;AACzE,SAASC,gBAAgB,QAAQ,yBAAsB;;AAEvD;AACA,MAAMC,qBAA6C,GAAG;EACpD,IAAI,EAAE,CAAC;EAAE;EACT,IAAI,EAAE,CAAC;EAAE;EACT,IAAI,EAAE,CAAC;EAAE;EACT,IAAI,EAAE,CAAC;EAAE;EACT,IAAI,EAAE,EAAE;EAAE;EACV,IAAI,EAAE,EAAE;EAAE;EACV,IAAI,EAAE,CAAC;EAAE;EACT,IAAI,EAAE,EAAE;EAAE;EACV,IAAI,EAAE,EAAE,CAAE;AACZ,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,SAASN,eAAe,CAAyB;EAC5DO,aAAa,GAAeA,CAAA,KAAM,CAAC,CAAC;EAEpCC,YAAY,GAAeJ,gBAAgB;;EAErD;AACF;AACA;AACA;AACA;AACA;EACYK,gBAAgB,GAAG,MAAM;EAEnCC,WAAWA,CAACC,MAAc,EAAEC,MAAkD,EAAE;IAC9E,KAAK,CAACD,MAAM,EAAEC,MAAM,CAAC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Ae,CAAC4B,KAAK,CAAC;IAErC,IAAI,CAACM,MAAM,EAAE;MACX;IACF;IAEA,MAAMC,cAAc,GAAGpC,kBAAkB,CAACqC,MAAM,CAE9C,CAACC,GAAG,EAAEC,OAAO,KAAK;MAClB,MAAMC,KAAK,GAAGL,MAAM,CAACM,MAAM,CAACF,OAAO,CAAC;MAEpC,IAAIC,KAAK,KAAKd,SAAS,EAAE;QACvBY,GAAG,CAACC,OAAO,CAAC,GAAGC,KAAK;MACtB;MAEA,OAAOF,GAAG;IACZ,CAAC,EAAE,CAAC,CAAC,CAAC;IAEN,IAAII,MAAM,CAACC,IAAI,CAACP,cAAc,CAAC,CAACb,MAAM,KAAK,CAAC,EAAE;MAC5C,IAAI,CAACJ,OAAO,GAAG,sDAAsD,CAAC;MAEtE;IACF;IAEA,MAAMyB,OAAO,GAAG;MACdZ,QAAQ,EAAEpC,QAAQ,CAACiD,MAAM;MACzBC,kBAAkB,EAAEnD,kBAAkB,CAACoD,QAAQ;MAC/CC,WAAW,EAAE,EAAE;MACfC,UAAU,EAAEd,MAAM,CAACe,SAAS;MAC5B,GAAGd;IACL,CAEC;IAED,IAAI,CAACe,QAAQ,GAAGP,OAAO,CAAC;EAC1B;AACF","ignoreList":[]}
|
|
@@ -5,93 +5,57 @@ import { CaseType } from "../../../types/case-type.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* Contec BC401 (a.k.a. BC01) urine analyzer — GATT profile.
|
|
7
7
|
*
|
|
8
|
-
* The BC401 uses Contec's proprietary FF12 service, shared across their
|
|
9
|
-
* medical devices.
|
|
10
|
-
*
|
|
8
|
+
* The BC401 uses Contec's proprietary FF12 service, shared across their
|
|
9
|
+
* consumer medical devices. Every stored URS-7 measurement is pushed as a
|
|
10
|
+
* 16-byte record on 0xFF02 after the host has walked the handshake documented
|
|
11
|
+
* in `bc01-command-sequencer.ts`.
|
|
11
12
|
*
|
|
12
13
|
* Service 0xFF12
|
|
13
|
-
* Notify (result)
|
|
14
|
-
* Write (command)
|
|
14
|
+
* Notify (result) 0xFF02 — CCCD 0x2902 must be written 01 00 to enable
|
|
15
|
+
* Write (command) 0xFF01 — RESET / SET_TIME / GET_COUNT / GET_RECORDS
|
|
15
16
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* [5..15] values one byte per analyte, encoding the discrete
|
|
22
|
-
* level index into diagnosticResults[key]
|
|
23
|
-
* [16] checksum xor over [2..15]
|
|
24
|
-
*
|
|
25
|
-
* Byte positions calibrated against PHMS 3.0.03 Android app; older firmware
|
|
26
|
-
* (< 1.2.x) uses a different command byte and is not supported by this driver
|
|
27
|
-
* (the validator will reject those frames).
|
|
17
|
+
* On the wire a stored URS record opens with 0xE1 (single) or 0xE2 (paginated).
|
|
18
|
+
* The remaining fifteen bytes carry the flags nibble, timestamp, seven bytes of
|
|
19
|
+
* packed 3-bit analyte indices, and a checksum. `bc01-frame-parser.ts` decodes
|
|
20
|
+
* them; this file just declares the GATT surface and hands every E1/E2 frame
|
|
21
|
+
* to the driver's dependent-result path so the parser can run.
|
|
28
22
|
*/
|
|
29
23
|
export const bc01MainServices = [{
|
|
30
24
|
uuid: "0000ff12-0000-1000-8000-00805f9b34fb",
|
|
31
|
-
|
|
25
|
+
/**
|
|
26
|
+
* PHMS 3.0.03 writes `[0x80, 0x00]` to 0xFF01 the moment its GATT
|
|
27
|
+
* subscription is up — decompiled at L1/f.java:694 ("发送复位命令" — "send
|
|
28
|
+
* reset command"). The device answers nothing until this reset lands. The
|
|
29
|
+
* `Bc01CommandSequencer` returns the same reset from `initialCommands()`
|
|
30
|
+
* so the SDK sends it whether or not the polling default is in play.
|
|
31
|
+
*/
|
|
32
|
+
writeUuid: {
|
|
32
33
|
uuid: "0000ff01-0000-1000-8000-00805f9b34fb",
|
|
34
|
+
mainCommandUuid: "8000"
|
|
35
|
+
},
|
|
36
|
+
monitorUuids: [{
|
|
37
|
+
uuid: "0000ff02-0000-1000-8000-00805f9b34fb",
|
|
38
|
+
/**
|
|
39
|
+
* We key on the first byte only. A `DEPENDENT` case fires
|
|
40
|
+
* `handleDependentResult` in the driver, which runs the real decoder
|
|
41
|
+
* (`parseBc01Record`) against the raw frame bytes and calls
|
|
42
|
+
* `onResult` directly. The parsing case itself carries no field
|
|
43
|
+
* definitions — the packed 3-bits-per-pad layout is not expressible
|
|
44
|
+
* with the ordinary declaration parser and would need the vendor's
|
|
45
|
+
* own decoding table pinned in a declaration to be so.
|
|
46
|
+
*/
|
|
33
47
|
parsingModel: {
|
|
34
|
-
caseValuePosition: [0
|
|
48
|
+
caseValuePosition: [0],
|
|
35
49
|
cases: [{
|
|
36
50
|
measurementTypeKey: MeasurementTypeKey.uricAcid,
|
|
37
|
-
caseType: CaseType.
|
|
38
|
-
caseValue: "
|
|
39
|
-
parseDefinitions: [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
name: "bld",
|
|
46
|
-
parseType: "number",
|
|
47
|
-
byteIndexes: [6],
|
|
48
|
-
parseReference: 16
|
|
49
|
-
}, {
|
|
50
|
-
name: "bil",
|
|
51
|
-
parseType: "number",
|
|
52
|
-
byteIndexes: [7],
|
|
53
|
-
parseReference: 16
|
|
54
|
-
}, {
|
|
55
|
-
name: "ket",
|
|
56
|
-
parseType: "number",
|
|
57
|
-
byteIndexes: [8],
|
|
58
|
-
parseReference: 16
|
|
59
|
-
}, {
|
|
60
|
-
name: "glu",
|
|
61
|
-
parseType: "number",
|
|
62
|
-
byteIndexes: [9],
|
|
63
|
-
parseReference: 16
|
|
64
|
-
}, {
|
|
65
|
-
name: "pro",
|
|
66
|
-
parseType: "number",
|
|
67
|
-
byteIndexes: [10],
|
|
68
|
-
parseReference: 16
|
|
69
|
-
}, {
|
|
70
|
-
name: "ph",
|
|
71
|
-
parseType: "number",
|
|
72
|
-
byteIndexes: [11],
|
|
73
|
-
parseReference: 16
|
|
74
|
-
}, {
|
|
75
|
-
name: "nit",
|
|
76
|
-
parseType: "number",
|
|
77
|
-
byteIndexes: [12],
|
|
78
|
-
parseReference: 16
|
|
79
|
-
}, {
|
|
80
|
-
name: "leu",
|
|
81
|
-
parseType: "number",
|
|
82
|
-
byteIndexes: [13],
|
|
83
|
-
parseReference: 16
|
|
84
|
-
}, {
|
|
85
|
-
name: "sg",
|
|
86
|
-
parseType: "number",
|
|
87
|
-
byteIndexes: [14],
|
|
88
|
-
parseReference: 16
|
|
89
|
-
}, {
|
|
90
|
-
name: "vc",
|
|
91
|
-
parseType: "number",
|
|
92
|
-
byteIndexes: [15],
|
|
93
|
-
parseReference: 16
|
|
94
|
-
}]
|
|
51
|
+
caseType: CaseType.DEPENDENT,
|
|
52
|
+
caseValue: "e1",
|
|
53
|
+
parseDefinitions: []
|
|
54
|
+
}, {
|
|
55
|
+
measurementTypeKey: MeasurementTypeKey.uricAcid,
|
|
56
|
+
caseType: CaseType.DEPENDENT,
|
|
57
|
+
caseValue: "e2",
|
|
58
|
+
parseDefinitions: []
|
|
95
59
|
}]
|
|
96
60
|
}
|
|
97
61
|
}]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MeasurementTypeKey","CaseType","bc01MainServices","uuid","monitorUuids","parsingModel","caseValuePosition","cases","measurementTypeKey","uricAcid","caseType","
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","CaseType","bc01MainServices","uuid","writeUuid","mainCommandUuid","monitorUuids","parsingModel","caseValuePosition","cases","measurementTypeKey","uricAcid","caseType","DEPENDENT","caseValue","parseDefinitions"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/bc01/bc01.main-services.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,YAAY;AAE/C,SAASC,QAAQ,QAAQ,6BAA0B;AAGnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAA4B,GAAG,CAC1C;EACEC,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,EAAEV,kBAAkB,CAACW,QAAQ;QAC/CC,QAAQ,EAAEX,QAAQ,CAACY,SAAS;QAC5BC,SAAS,EAAE,IAAI;QACfC,gBAAgB,EAAE;MACpB,CAAC,EACD;QACEL,kBAAkB,EAAEV,kBAAkB,CAACW,QAAQ;QAC/CC,QAAQ,EAAEX,QAAQ,CAACY,SAAS;QAC5BC,SAAS,EAAE,IAAI;QACfC,gBAAgB,EAAE;MACpB,CAAC;IAEL;EACF,CAAC;AAEL,CAAC,CACF","ignoreList":[]}
|
|
@@ -87,6 +87,20 @@ export class BTCommandWriter {
|
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Writes one chunk the way the characteristic accepts writes.
|
|
92
|
+
*
|
|
93
|
+
* A with-response write to a characteristic that only supports write-without-response
|
|
94
|
+
* fails outright, so the command says which it is rather than the transport guessing.
|
|
95
|
+
*/
|
|
96
|
+
writeTo = async (command, value) => {
|
|
97
|
+
if (command.withoutResponse) {
|
|
98
|
+
await this.device.writeCharacteristicWithoutResponseForService(command.serviceUuid, command.characteristicUuid, value);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
await this.device.writeCharacteristicWithResponseForService(command.serviceUuid, command.characteristicUuid, value);
|
|
102
|
+
};
|
|
103
|
+
|
|
90
104
|
/**
|
|
91
105
|
* Splits a frame into writes the link will carry whole.
|
|
92
106
|
*
|
|
@@ -116,7 +130,7 @@ export class BTCommandWriter {
|
|
|
116
130
|
if (!isConnected) {
|
|
117
131
|
return false;
|
|
118
132
|
}
|
|
119
|
-
await this.
|
|
133
|
+
await this.writeTo(command, hexToBase64(chunk.join("")));
|
|
120
134
|
return true;
|
|
121
135
|
} catch (error) {
|
|
122
136
|
sentryLogger("error", "DEVICE: Error sending command", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["slog","sentryLogger","hexToBase64","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","sentryLogger","hexToBase64","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","join","Error","message","deviceName","name"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/bt-command-writer.ts"],"mappings":";;AAEA,SAASA,IAAI,QAAQ,iCAA8B;AACnD,SAASC,YAAY,QAAQ,yCAAsC;AAEnE,SAASC,WAAW,QAAQ,+BAA4B;AAExD,MAAMC,kBAAkB,GAAG,CAAC;;AAE5B;AACA,MAAMC,eAAe,GAAG,EAAE;;AAE1B;AACA,MAAMC,sBAAsB,GAAG,CAAC;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAA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ACnC,MAAM,CAACmC,WAAW,CAAC,CAAC;QAEnD,IAAI,CAACA,WAAW,EAAE;UAChB,OAAO,KAAK;QACd;QAEA,MAAM,IAAI,CAAChB,OAAO,CAACP,OAAO,EAAEtB,WAAW,CAACwB,KAAK,CAACsB,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QAExD,OAAO,IAAI;MACb,CAAC,CAAC,OAAOzB,KAAK,EAAE;QACdtB,YAAY,CAAC,OAAO,EAAE,+BAA+B,EAAE;UACrDsB,KAAK,EAAEA,KAAK,YAAY0B,KAAK,GAAG1B,KAAK,CAAC2B,OAAO,GAAG3B,KAAK;UACrD4B,UAAU,EAAE,IAAI,CAACvC,MAAM,CAACwC;QAC1B,CAAC,CAAC;QAEF,IAAIN,OAAO,KAAK3C,kBAAkB,EAAE;UAClCH,IAAI,CAACuB,KAAK,EAAE,8CAA8C,EAAE;YAC1D4B,UAAU,EAAE,IAAI,CAACvC,MAAM,CAACwC;UAC1B,CAAC,CAAC;QACJ;MACF;IACF;IAEA,OAAO,KAAK;EACd,CAAC;AACH","ignoreList":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { sentryLogger } from "../../../../helpers/utils/sentry-logger.js";
|
|
3
4
|
import { LepuCommandBuilder } from "../lepu/lepu.command-builder.js";
|
|
4
5
|
import { LepuIdentityGate } from "../lepu/lepu.identity-gate.js";
|
|
5
6
|
|
|
@@ -16,7 +17,24 @@ const DEFAULT_START_BYTE = "a5";
|
|
|
16
17
|
* answers on the one it is addressed with, so the list matters for reading and its head for
|
|
17
18
|
* writing.
|
|
18
19
|
*/
|
|
19
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Records what the device said it was.
|
|
22
|
+
*
|
|
23
|
+
* The model number is logged because it is the only place one exists: the vendor's SDK
|
|
24
|
+
* never reads the field back, so a declaration written without it is completed by
|
|
25
|
+
* connecting once and reading this line.
|
|
26
|
+
*/
|
|
27
|
+
const recordLepuIdentity = (deviceData, info) => {
|
|
28
|
+
deviceData.sn = info.serialNumber;
|
|
29
|
+
sentryLogger("info", "BT_MANAGER: Device identified itself", {
|
|
30
|
+
deviceId: deviceData.id,
|
|
31
|
+
deviceName: deviceData.name,
|
|
32
|
+
deviceType: info.deviceType,
|
|
33
|
+
branchCode: info.branchCode,
|
|
34
|
+
protocolMaxLength: info.protocolMaxLength
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
const createLepuSequencer = (lepu, report) => new LepuIdentityGate({
|
|
20
38
|
write: {
|
|
21
39
|
serviceUuid: lepu.write.serviceUuid,
|
|
22
40
|
characteristicUuid: lepu.write.characteristicUuid
|
|
@@ -29,4 +47,5 @@ export const createLepuSequencer = (lepu, report) => new LepuIdentityGate({
|
|
|
29
47
|
onIdentified: report.onIdentified,
|
|
30
48
|
onRefused: report.onRefused
|
|
31
49
|
});
|
|
50
|
+
export { createLepuSequencer, recordLepuIdentity };
|
|
32
51
|
//# sourceMappingURL=custom-lepu-sequencer.js.map
|
package/lib/module/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LepuCommandBuilder","LepuIdentityGate","DEFAULT_START_BYTE","createLepuSequencer","lepu","report","write","serviceUuid","characteristicUuid","builder","startBytes","expectedDeviceTypes","pollCommand","undefined","onIdentified","onRefused"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/custom/custom-lepu-sequencer.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"names":["sentryLogger","LepuCommandBuilder","LepuIdentityGate","DEFAULT_START_BYTE","recordLepuIdentity","deviceData","info","sn","serialNumber","deviceId","id","deviceName","name","deviceType","branchCode","protocolMaxLength","createLepuSequencer","lepu","report","write","serviceUuid","characteristicUuid","builder","startBytes","expectedDeviceTypes","pollCommand","undefined","onIdentified","onRefused"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/custom/custom-lepu-sequencer.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EZ,kBAAkB","ignoreList":[]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { sentryLogger } from "../../../../helpers/utils/sentry-logger.js";
|
|
4
3
|
import { CaseType } from "../../../types/case-type.js";
|
|
5
4
|
import { createFrameValidator } from "../../../utils/create-frame-validator.js";
|
|
5
|
+
import { parseMeasurement } from "../../../utils/parse-measurement.js";
|
|
6
|
+
import { discardedReadingError, rejectCustomReading } from "../../../utils/reject-custom-reading.js";
|
|
6
7
|
import { BTManagedDevice } from "../bt-managed-device.js";
|
|
7
8
|
import { LepuFrameReader } from "../lepu/lepu.frame-reader.js";
|
|
8
|
-
import { createLepuSequencer } from "./custom-lepu-sequencer.js";
|
|
9
|
+
import { createLepuSequencer, recordLepuIdentity } from "./custom-lepu-sequencer.js";
|
|
9
10
|
/**
|
|
10
11
|
* Runs a device registered with defineCustomDevice.
|
|
11
12
|
*
|
|
@@ -49,29 +50,7 @@ export class CustomDevice extends BTManagedDevice {
|
|
|
49
50
|
onRefused: this.onIdentityRefused
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Records what the device said it was.
|
|
55
|
-
*
|
|
56
|
-
* The model number is logged because it is the only place one exists: the vendor's SDK
|
|
57
|
-
* never reads the field back, so a declaration written without it is completed by
|
|
58
|
-
* connecting once and reading this line.
|
|
59
|
-
*/
|
|
60
|
-
onIdentified = info => {
|
|
61
|
-
this.deviceData.sn = info.serialNumber;
|
|
62
|
-
sentryLogger("info", "BT_MANAGER: Device identified itself", {
|
|
63
|
-
deviceId: this.deviceData.id,
|
|
64
|
-
deviceName: this.deviceData.name,
|
|
65
|
-
deviceType: info.deviceType,
|
|
66
|
-
branchCode: info.branchCode,
|
|
67
|
-
protocolMaxLength: info.protocolMaxLength
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Nothing is sent to a device that could not be identified, because the same opcode means
|
|
73
|
-
* different things on different models in this family.
|
|
74
|
-
*/
|
|
53
|
+
onIdentified = info => recordLepuIdentity(this.deviceData, info);
|
|
75
54
|
onIdentityRefused = reason => {
|
|
76
55
|
this.onError?.(new Error(`Custom device "${this.definition.id}" was not addressed: ${reason}.`));
|
|
77
56
|
};
|
|
@@ -90,7 +69,7 @@ export class CustomDevice extends BTManagedDevice {
|
|
|
90
69
|
*/
|
|
91
70
|
handleDependentResult = data => {
|
|
92
71
|
try {
|
|
93
|
-
this.
|
|
72
|
+
this.reportFrame(data);
|
|
94
73
|
} catch (error) {
|
|
95
74
|
this.onError?.(error);
|
|
96
75
|
}
|
|
@@ -111,6 +90,26 @@ export class CustomDevice extends BTManagedDevice {
|
|
|
111
90
|
return;
|
|
112
91
|
}
|
|
113
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Reports what the frame carried, which may be more than one reading.
|
|
95
|
+
*
|
|
96
|
+
* A device handing over its stored history answers one request with every record it
|
|
97
|
+
* holds, back to back. Those were taken at different times and are separate readings, so
|
|
98
|
+
* each record is decoded and reported on its own. A trailing part-record is ignored: half
|
|
99
|
+
* a record is not a reading.
|
|
100
|
+
*/
|
|
101
|
+
reportFrame(data) {
|
|
102
|
+
const repeated = data.parsingCase.repeatedRecords;
|
|
103
|
+
if (!repeated || !data.frame) {
|
|
104
|
+
this.report(data.parsedData, data.parsingCase);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const records = Math.floor((data.frame.length - repeated.from) / repeated.recordBytes);
|
|
108
|
+
for (let record = 0; record < records; record++) {
|
|
109
|
+
this.report(parseMeasurement(data.frame, data.parsingCase, repeated.from + record * repeated.recordBytes), data.parsingCase);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
114
113
|
/**
|
|
115
114
|
* Reports every reading the frame carried.
|
|
116
115
|
*
|
|
@@ -125,11 +124,14 @@ export class CustomDevice extends BTManagedDevice {
|
|
|
125
124
|
report(parsedData, parsingCase) {
|
|
126
125
|
const measurements = parsingCase.measurements ?? [];
|
|
127
126
|
if (measurements.length === 0) {
|
|
128
|
-
this.
|
|
127
|
+
this.discard("a result frame carries no measurement type", parsedData);
|
|
129
128
|
return;
|
|
130
129
|
}
|
|
131
130
|
measurements.forEach(measurement => this.reportMeasurement(parsedData, measurement));
|
|
132
131
|
}
|
|
132
|
+
discard(reason, parsedData) {
|
|
133
|
+
this.onError?.(discardedReadingError(this.definition.id, reason, parsedData));
|
|
134
|
+
}
|
|
133
135
|
reportMeasurement(parsedData, measurement) {
|
|
134
136
|
const reading = {
|
|
135
137
|
caseType: parsedData.caseType,
|
|
@@ -138,28 +140,12 @@ export class CustomDevice extends BTManagedDevice {
|
|
|
138
140
|
measurement.fieldNames.forEach(name => {
|
|
139
141
|
reading[name] = parsedData[name];
|
|
140
142
|
});
|
|
141
|
-
const rejection = measurement.fieldNames.map(name => this.
|
|
143
|
+
const rejection = measurement.fieldNames.map(name => rejectCustomReading(this.definition.fields, measurement.measurementTypeKey, name, reading[name])).find(message => message !== undefined);
|
|
142
144
|
if (rejection) {
|
|
143
|
-
this.
|
|
145
|
+
this.discard(rejection, reading);
|
|
144
146
|
return;
|
|
145
147
|
}
|
|
146
148
|
this.onResult?.(reading);
|
|
147
149
|
}
|
|
148
|
-
reject(measurementTypeKey, name, value) {
|
|
149
|
-
const field = this.definition.fields.get(`${measurementTypeKey}:${name}`);
|
|
150
|
-
if (!field) {
|
|
151
|
-
return `decoded "${name}", which is not declared for ${measurementTypeKey}`;
|
|
152
|
-
}
|
|
153
|
-
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
154
|
-
return `could not decode ${name}; the frame was shorter than the declaration expects`;
|
|
155
|
-
}
|
|
156
|
-
if (value < field.min || value > field.max) {
|
|
157
|
-
return `decoded ${name} = ${value} ${field.unit}, outside the accepted range ${field.min}-${field.max} ${field.unit}`;
|
|
158
|
-
}
|
|
159
|
-
return undefined;
|
|
160
|
-
}
|
|
161
|
-
fail(reason, parsedData) {
|
|
162
|
-
this.onError?.(new Error(`Custom device "${this.definition.id}": ${reason}. The reading was discarded (decoded ${JSON.stringify(parsedData)}).`));
|
|
163
|
-
}
|
|
164
150
|
}
|
|
165
151
|
//# sourceMappingURL=custom.device.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["CaseType","createFrameValidator","parseMeasurement","discardedReadingError","rejectCustomReading","BTManagedDevice","LepuFrameReader","createLepuSequencer","recordLepuIdentity","CustomDevice","validators","Map","constructor","device","params","definition","mainServices","stuckDataTimeout","preferredMtu","undefined","declareLepuProtocol","frames","forEach","frame","uuid","set","lepu","frameReader","startBytes","createCommandSequencer","onIdentified","onRefused","onIdentityRefused","info","deviceData","reason","onError","Error","id","validatePackage","pkg","validate","get","String","toLowerCase","handleDependentResult","data","reportFrame","error","parsingCase","caseType","OTHER","handleSuccessResult","repeated","repeatedRecords","report","parsedData","records","Math","floor","length","from","recordBytes","record","measurements","discard","measurement","reportMeasurement","reading","measurementTypeKey","fieldNames","name","rejection","map","fields","find","message","onResult"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/custom/custom.device.ts"],"mappings":";;AAEA,SAASA,QAAQ,QAAQ,6BAA0B;AAUnD,SAASC,oBAAoB,QAAQ,0CAAuC;AAC5E,SAASC,gBAAgB,QAAQ,qCAAkC;AACnE,SACEC,qBAAqB,EACrBC,mBAAmB,QACd,yCAAsC;AAC7C,SAASC,eAAe,QAAQ,yBAAsB;AAEtD,SAASC,eAAe,QAAQ,8BAA2B;AAE3D,SACEC,mBAAmB,EACnBC,kBAAkB,QACb,4BAAyB;AAKhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,SAASJ,eAAe,CAAiB;EAM/CK,UAAU,GAAG,IAAIC,GAAG,CAAqC,CAAC;EAE3EC,WAAWA,CACTC,MAAc,EACdC,MAA0C,EAC1CC,UAAkC,EAClC;IACA,KAAK,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I,IAAI,CAAEC,OAAO,IAAKA,OAAO,KAAKzD,SAAS,CAAC;IAE3C,IAAIqD,SAAS,EAAE;MACb,IAAI,CAACP,OAAO,CAACO,SAAS,EAAEJ,OAAO,CAAC;MAEhC;IACF;IAEA,IAAI,CAACS,QAAQ,GAAGT,OAAO,CAAC;EAC1B;AAEF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["parseMeasurement","FrameParser","constructor","mainServices","parse","uuid","frame","parsingModel","findParsingModel","caseValue","readCaseValue","parsingCase","cases","find","declared","parsedData","measurementTypeKey","mainService","characteristic","monitorUuids","monitored","toLowerCase","undefined","caseValuePosition","map","index","join"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/frame-parser.ts"],"mappings":";;AAMA,SAASA,gBAAgB,QAAQ,kCAA+B;;AAEhE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,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,GAAGf,gBAAgB,CAACM,KAAK,EAAEK,WAAW,CAAC;IAEvD,IAAI,CAACI,UAAU,EAAE;MACf;IACF;IAEA,OAAO;MACLJ,WAAW;MACXK,kBAAkB,EAAEL,WAAW,CAACK,kBAAkB;MAClDD,UAAU,EAAEA;
|
|
1
|
+
{"version":3,"names":["parseMeasurement","FrameParser","constructor","mainServices","parse","uuid","frame","parsingModel","findParsingModel","caseValue","readCaseValue","parsingCase","cases","find","declared","parsedData","measurementTypeKey","mainService","characteristic","monitorUuids","monitored","toLowerCase","undefined","caseValuePosition","map","index","join"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/frame-parser.ts"],"mappings":";;AAMA,SAASA,gBAAgB,QAAQ,kCAA+B;;AAEhE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,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,GAAGf,gBAAgB,CAACM,KAAK,EAAEK,WAAW,CAAC;IAEvD,IAAI,CAACI,UAAU,EAAE;MACf;IACF;IAEA,OAAO;MACLJ,WAAW;MACXK,kBAAkB,EAAEL,WAAW,CAACK,kBAAkB;MAClDD,UAAU,EAAEA,UAAwC;MACpDT;IACF,CAAC;EACH;EAEQE,gBAAgBA,CAACH,IAAY,EAA4B;IAC/D,KAAK,MAAMY,WAAW,IAAI,IAAI,CAACd,YAAY,EAAE;MAC3C,MAAMe,cAAc,GAAGD,WAAW,CAACE,YAAY,CAACN,IAAI,CACjDO,SAAS,IAAKA,SAAS,CAACf,IAAI,CAACgB,WAAW,CAAC,CAAC,KAAKhB,IAAI,CAACgB,WAAW,CAAC,CACnE,CAAC;MAED,IAAIH,cAAc,EAAE;QAClB,OAAOA,cAAc,CAACX,YAAY;MACpC;IACF;IAEA,OAAOe,SAAS;EAClB;EAEQZ,aAAaA,CAACH,YAA0B,EAAED,KAAe,EAAU;IACzE,OACEC,YAAY,CAACgB,iBAAiB,EAAEC,GAAG,CAAEC,KAAK,IAAKnB,KAAK,CAACmB,KAAK,CAAC,CAAC,CAACC,IAAI,CAAC,EAAE,CAAC,IACrE,EAAE;EAEN;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { FrameReadStatus } from "../../types/frame-read-status.js";
|
|
4
|
+
const lower = byte => (byte ?? "").toLowerCase();
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Reads a reply that ends on a sentinel byte rather than declaring its length.
|
|
8
|
+
*
|
|
9
|
+
* The Veroval duo control answers this way, as serial protocols generally do: a request is
|
|
10
|
+
* answered across as many notifications as it takes and the end is marked, not counted. The
|
|
11
|
+
* reader therefore cannot know how much is coming and holds the buffer until the terminator
|
|
12
|
+
* lands - which is why the cap exists.
|
|
13
|
+
*
|
|
14
|
+
* There is no integrity check to make. A sentinel protocol carries no checksum, so a frame
|
|
15
|
+
* that reaches a parser here has been delimited, not verified, and whatever decodes it is
|
|
16
|
+
* the only thing standing between a corrupted reply and a reported reading. Declare a range
|
|
17
|
+
* for every field.
|
|
18
|
+
*/
|
|
19
|
+
export class SentinelFrameReader {
|
|
20
|
+
constructor(spec) {
|
|
21
|
+
this.spec = spec;
|
|
22
|
+
}
|
|
23
|
+
readFrame(buffer) {
|
|
24
|
+
const first = lower(buffer[0]);
|
|
25
|
+
if (buffer.length > 0 && (this.spec.standaloneBytes ?? []).includes(first)) {
|
|
26
|
+
return {
|
|
27
|
+
status: FrameReadStatus.COMPLETE,
|
|
28
|
+
consumedBytes: 1,
|
|
29
|
+
frame: [first]
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const start = this.frameStart(buffer);
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A declared start byte is one byte, so there is no partial match to preserve: a buffer
|
|
36
|
+
* without it holds no frame start and is junk in its entirety.
|
|
37
|
+
*/
|
|
38
|
+
if (start === undefined) {
|
|
39
|
+
return {
|
|
40
|
+
status: FrameReadStatus.INCOMPLETE,
|
|
41
|
+
consumedBytes: buffer.length
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const end = buffer.findIndex((byte, index) => index >= start && lower(byte) === this.spec.terminator);
|
|
45
|
+
if (end === -1) {
|
|
46
|
+
return this.incompleteOrOverlong(buffer, start);
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
status: FrameReadStatus.COMPLETE,
|
|
50
|
+
consumedBytes: end + 1,
|
|
51
|
+
frame: buffer.slice(start, end)
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Where the payload begins: after the start byte when one is declared, and at zero when
|
|
57
|
+
* none is. A declared start byte that has not arrived means the reply has not begun.
|
|
58
|
+
*/
|
|
59
|
+
frameStart(buffer) {
|
|
60
|
+
if (this.spec.start === undefined) {
|
|
61
|
+
return 0;
|
|
62
|
+
}
|
|
63
|
+
const index = buffer.findIndex(byte => lower(byte) === this.spec.start);
|
|
64
|
+
return index === -1 ? undefined : index + 1;
|
|
65
|
+
}
|
|
66
|
+
incompleteOrOverlong(buffer, start) {
|
|
67
|
+
if (buffer.length - start <= this.spec.maxFrameBytes) {
|
|
68
|
+
return {
|
|
69
|
+
status: FrameReadStatus.INCOMPLETE,
|
|
70
|
+
consumedBytes: 0
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
status: FrameReadStatus.CORRUPT,
|
|
75
|
+
consumedBytes: buffer.length
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=sentinel-frame-reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["FrameReadStatus","lower","byte","toLowerCase","SentinelFrameReader","constructor","spec","readFrame","buffer","first","length","standaloneBytes","includes","status","COMPLETE","consumedBytes","frame","start","frameStart","undefined","INCOMPLETE","end","findIndex","index","terminator","incompleteOrOverlong","slice","maxFrameBytes","CORRUPT"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/sentinel-frame-reader.ts"],"mappings":";;AACA,SAASA,eAAe,QAAQ,kCAA+B;AAgC/D,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;AACA,OAAO,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;IAE9B,IAAIA,MAAM,CAACE,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAACJ,IAAI,CAACK,eAAe,IAAI,EAAE,EAAEC,QAAQ,CAACH,KAAK,CAAC,EAAE;MAC1E,OAAO;QACLI,MAAM,EAAEb,eAAe,CAACc,QAAQ;QAChCC,aAAa,EAAE,CAAC;QAChBC,KAAK,EAAE,CAACP,KAAK;MACf,CAAC;IACH;IAEA,MAAMQ,KAAK,GAAG,IAAI,CAACC,UAAU,CAACV,MAAM,CAAC;;IAErC;AACJ;AACA;AACA;IACI,IAAIS,KAAK,KAAKE,SAAS,EAAE;MACvB,OAAO;QAAEN,MAAM,EAAEb,eAAe,CAACoB,UAAU;QAAEL,aAAa,EAAEP,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