@ovok/native 1.6.32 → 1.6.34
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 +4 -1
- package/lib/commonjs/modules/bt-device/constants/device-instruction-pdfs.js.map +1 -1
- package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-assets.js +3 -1
- package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-assets.js.map +1 -1
- package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-entries.js +1 -1
- package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-entries.js.map +1 -1
- package/lib/commonjs/modules/bt-device/constants/supported-devices.js +25 -0
- package/lib/commonjs/modules/bt-device/constants/supported-devices.js.map +1 -1
- package/lib/commonjs/modules/bt-management/constants/integrated-devices-map.js +2 -1
- package/lib/commonjs/modules/bt-management/constants/integrated-devices-map.js.map +1 -1
- package/lib/commonjs/modules/bt-management/index.js +77 -0
- package/lib/commonjs/modules/bt-management/index.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/background-sync/background-service-uuids.js +4 -0
- package/lib/commonjs/modules/bt-management/services/background-sync/background-service-uuids.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/custom/define-custom-device.js +20 -0
- package/lib/commonjs/modules/bt-management/services/custom/define-custom-device.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/device-creator.js +7 -1
- package/lib/commonjs/modules/bt-management/services/device-creator.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/a606/a606.command-sequencer.js +68 -0
- package/lib/commonjs/modules/bt-management/services/devices/a606/a606.command-sequencer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/a606/a606.device.js +55 -0
- package/lib/commonjs/modules/bt-management/services/devices/a606/a606.device.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/a606/a606.frame-parser.js +36 -0
- package/lib/commonjs/modules/bt-management/services/devices/a606/a606.frame-parser.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/a606/a606.frame-reader.js +68 -0
- package/lib/commonjs/modules/bt-management/services/devices/a606/a606.frame-reader.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/a606/a606.main-services.js +31 -0
- package/lib/commonjs/modules/bt-management/services/devices/a606/a606.main-services.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.js +73 -0
- package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.device.js +55 -0
- package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.device.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.frame-parser.js +53 -0
- package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.frame-parser.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.frame-reader.js +55 -0
- package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.frame-reader.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.main-services.js +30 -0
- package/lib/commonjs/modules/bt-management/services/devices/bpw1/bpw1.main-services.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/bt-data-processor.js +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/bt-data-processor.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js +4 -0
- package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/checkme/checkme.device.js +57 -0
- package/lib/commonjs/modules/bt-management/services/devices/checkme/checkme.device.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/checkme/checkme.protocol.js +263 -0
- package/lib/commonjs/modules/bt-management/services/devices/checkme/checkme.protocol.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/checkme/checkme.sequencer.js +255 -0
- package/lib/commonjs/modules/bt-management/services/devices/checkme/checkme.sequencer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js +87 -6
- package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.transports.js +3 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.transports.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/measurement-state-machine.js +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/measurement-state-machine.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js +4 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.lepod.js +4 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.lepod.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.oximeters.js +10 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.oximeters.js.map +1 -1
- package/lib/commonjs/modules/bt-management/types/clock-sync.js +1 -0
- package/lib/commonjs/modules/bt-management/types/clock-sync.js.map +1 -1
- package/lib/commonjs/modules/bt-management/types/custom-session-policy.js +2 -0
- package/lib/commonjs/modules/bt-management/types/custom-session-policy.js.map +1 -0
- package/lib/commonjs/modules/bt-management/types/integrated-devices.js +3 -0
- package/lib/commonjs/modules/bt-management/types/integrated-devices.js.map +1 -1
- package/lib/module/modules/bt-device/constants/device-instruction-pdfs.js +4 -1
- package/lib/module/modules/bt-device/constants/device-instruction-pdfs.js.map +1 -1
- package/lib/module/modules/bt-device/constants/supported-device-catalog-assets.js +3 -1
- package/lib/module/modules/bt-device/constants/supported-device-catalog-assets.js.map +1 -1
- package/lib/module/modules/bt-device/constants/supported-device-catalog-entries.js +1 -1
- package/lib/module/modules/bt-device/constants/supported-device-catalog-entries.js.map +1 -1
- package/lib/module/modules/bt-device/constants/supported-devices.js +26 -1
- package/lib/module/modules/bt-device/constants/supported-devices.js.map +1 -1
- package/lib/module/modules/bt-management/constants/integrated-devices-map.js +2 -1
- package/lib/module/modules/bt-management/constants/integrated-devices-map.js.map +1 -1
- package/lib/module/modules/bt-management/index.js +7 -0
- package/lib/module/modules/bt-management/index.js.map +1 -1
- package/lib/module/modules/bt-management/services/background-sync/background-service-uuids.js +4 -0
- package/lib/module/modules/bt-management/services/background-sync/background-service-uuids.js.map +1 -1
- package/lib/module/modules/bt-management/services/custom/define-custom-device.js +20 -0
- package/lib/module/modules/bt-management/services/custom/define-custom-device.js.map +1 -1
- package/lib/module/modules/bt-management/services/device-creator.js +7 -1
- package/lib/module/modules/bt-management/services/device-creator.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/a606/a606.command-sequencer.js +61 -0
- package/lib/module/modules/bt-management/services/devices/a606/a606.command-sequencer.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/a606/a606.device.js +45 -0
- package/lib/module/modules/bt-management/services/devices/a606/a606.device.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/a606/a606.frame-parser.js +32 -0
- package/lib/module/modules/bt-management/services/devices/a606/a606.frame-parser.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/a606/a606.frame-reader.js +63 -0
- package/lib/module/modules/bt-management/services/devices/a606/a606.frame-reader.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/a606/a606.main-services.js +28 -0
- package/lib/module/modules/bt-management/services/devices/a606/a606.main-services.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.js +66 -0
- package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.device.js +45 -0
- package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.device.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.frame-parser.js +48 -0
- package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.frame-parser.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.frame-reader.js +50 -0
- package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.frame-reader.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.main-services.js +26 -0
- package/lib/module/modules/bt-management/services/devices/bpw1/bpw1.main-services.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/bt-data-processor.js +1 -0
- package/lib/module/modules/bt-management/services/devices/bt-data-processor.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-managed-device.js +4 -0
- package/lib/module/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/checkme/checkme.device.js +53 -0
- package/lib/module/modules/bt-management/services/devices/checkme/checkme.device.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/checkme/checkme.protocol.js +247 -0
- package/lib/module/modules/bt-management/services/devices/checkme/checkme.protocol.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/checkme/checkme.sequencer.js +245 -0
- package/lib/module/modules/bt-management/services/devices/checkme/checkme.sequencer.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/custom/custom.device.js +87 -6
- package/lib/module/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.transports.js +3 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.transports.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/measurement-state-machine.js +1 -0
- package/lib/module/modules/bt-management/services/devices/measurement-state-machine.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js +4 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.lepod.js +4 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.lepod.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.oximeters.js +10 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.oximeters.js.map +1 -1
- package/lib/module/modules/bt-management/types/clock-sync.js +1 -0
- package/lib/module/modules/bt-management/types/clock-sync.js.map +1 -1
- package/lib/module/modules/bt-management/types/custom-device-definition.js.map +1 -1
- package/lib/module/modules/bt-management/types/custom-session-policy.js +2 -0
- package/lib/module/modules/bt-management/types/custom-session-policy.js.map +1 -0
- package/lib/module/modules/bt-management/types/device-measurement-map.js.map +1 -1
- package/lib/module/modules/bt-management/types/integrated-devices.js +3 -0
- package/lib/module/modules/bt-management/types/integrated-devices.js.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-device/constants/device-instruction-pdfs.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts +3 -1
- package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-entries.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-devices.d.ts +7 -0
- package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-devices.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 +7 -0
- package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/background-sync/background-service-uuids.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/custom/define-custom-device.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/a606/a606.command-sequencer.d.ts +22 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.command-sequencer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.device.d.ts +24 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.device.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.frame-parser.d.ts +10 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.frame-parser.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.frame-reader.d.ts +9 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.frame-reader.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.main-services.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/a606/a606.main-services.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.d.ts +21 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.device.d.ts +22 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.device.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.frame-parser.d.ts +9 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.frame-parser.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.frame-reader.d.ts +8 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.frame-reader.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.main-services.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bpw1/bpw1.main-services.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-data-processor.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-data-processor.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/checkme/checkme.device.d.ts +18 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/checkme/checkme.device.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/checkme/checkme.protocol.d.ts +79 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/checkme/checkme.protocol.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/checkme/checkme.sequencer.d.ts +52 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/checkme/checkme.sequencer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts +10 -0
- 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/lepu/lepu.transports.d.ts +3 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/measurement-state-machine.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/measurement-state-machine.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.lepod.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/clock-sync.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-device-definition.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-device-definition.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-device-spec.d.ts +3 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-device-spec.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-session-policy.d.ts +13 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-session-policy.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts +8 -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 +4 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/integrated-devices.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-device/constants/device-instruction-pdfs.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts +3 -1
- package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-entries.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-device/constants/supported-devices.d.ts +7 -0
- package/lib/typescript/module/src/modules/bt-device/constants/supported-devices.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 +7 -0
- package/lib/typescript/module/src/modules/bt-management/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/background-sync/background-service-uuids.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/custom/define-custom-device.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/a606/a606.command-sequencer.d.ts +22 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.command-sequencer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.device.d.ts +24 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.device.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.frame-parser.d.ts +10 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.frame-parser.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.frame-reader.d.ts +9 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.frame-reader.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.main-services.d.ts +4 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/a606/a606.main-services.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.d.ts +21 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.device.d.ts +22 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.device.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.frame-parser.d.ts +9 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.frame-parser.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.frame-reader.d.ts +8 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.frame-reader.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.main-services.d.ts +4 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bpw1/bpw1.main-services.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-data-processor.d.ts +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-data-processor.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts +2 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/checkme/checkme.device.d.ts +18 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/checkme/checkme.device.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/checkme/checkme.protocol.d.ts +79 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/checkme/checkme.protocol.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/checkme/checkme.sequencer.d.ts +52 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/checkme/checkme.sequencer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts +10 -0
- 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/lepu/lepu.transports.d.ts +3 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/measurement-state-machine.d.ts +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/measurement-state-machine.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.lepod.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/clock-sync.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/custom-device-definition.d.ts +2 -0
- package/lib/typescript/module/src/modules/bt-management/types/custom-device-definition.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/custom-device-spec.d.ts +3 -0
- package/lib/typescript/module/src/modules/bt-management/types/custom-device-spec.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/custom-session-policy.d.ts +13 -0
- package/lib/typescript/module/src/modules/bt-management/types/custom-session-policy.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts +8 -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 +4 -1
- package/lib/typescript/module/src/modules/bt-management/types/integrated-devices.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { getClockParts, isClockSyncEnabled } from "../../../types/clock-sync.js";
|
|
4
|
+
import { hexToByte } from "../../../utils/hex-to-byte.js";
|
|
5
|
+
const SERVICE = "0000ff00-0000-1000-8000-00805f9b34fb";
|
|
6
|
+
const WRITE = "0000ff01-0000-1000-8000-00805f9b34fb";
|
|
7
|
+
const NOTIFY = "0000ff02-0000-1000-8000-00805f9b34fb";
|
|
8
|
+
const TYPE_GET = 0x43;
|
|
9
|
+
const TYPE_UPLOAD = 0x44;
|
|
10
|
+
const CMD_UPDATE_TIME = 0x54;
|
|
11
|
+
const CMD_UPLOAD_DATA = 0x45;
|
|
12
|
+
const byte = value => (value & 0xff).toString(16).padStart(2, "0");
|
|
13
|
+
const frameFor = values => {
|
|
14
|
+
const frame = values.map(byte);
|
|
15
|
+
const checksum = frame.reduce((sum, value) => sum + hexToByte(value) & 0xff, 0);
|
|
16
|
+
return [...frame, byte(checksum)];
|
|
17
|
+
};
|
|
18
|
+
const commandFor = frame => ({
|
|
19
|
+
serviceUuid: SERVICE,
|
|
20
|
+
characteristicUuid: WRITE,
|
|
21
|
+
frame
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
/** The vendor's post-connect command for the ZH-SG family. */
|
|
25
|
+
const buildA606ConnectedCommand = () => frameFor([0x26, TYPE_UPLOAD, 0x03, 0x46, 0x20, 0x01, 0x20]);
|
|
26
|
+
|
|
27
|
+
/** Writes the local clock in the six-byte YY MM DD hh mm ss payload. */
|
|
28
|
+
const buildA606TimeCommand = now => {
|
|
29
|
+
const parts = getClockParts(now);
|
|
30
|
+
return frameFor([0x26, TYPE_GET, CMD_UPDATE_TIME, 0x20, parts.year % 100, parts.month, parts.day, parts.hours, parts.minutes, parts.seconds, 0x20]);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** Requests the next stored record after the current one was accepted. */
|
|
34
|
+
const buildA606UploadCommand = (ack = false) => frameFor([0x26, TYPE_UPLOAD, CMD_UPLOAD_DATA, 0x20, ack ? 0x53 : 0x46, 0x20]);
|
|
35
|
+
class A606CommandSequencer {
|
|
36
|
+
phase = "connected";
|
|
37
|
+
constructor(clockSync) {
|
|
38
|
+
this.clockSync = clockSync;
|
|
39
|
+
}
|
|
40
|
+
initialCommands = () => [commandFor(buildA606ConnectedCommand())];
|
|
41
|
+
isHistoryTransfer = () => true;
|
|
42
|
+
nextCommand = frame => {
|
|
43
|
+
const type = hexToByte(frame[1] ?? "00");
|
|
44
|
+
const command = hexToByte(frame[2] ?? "00");
|
|
45
|
+
if (type === TYPE_GET && command === CMD_UPDATE_TIME) {
|
|
46
|
+
if (this.phase === "connected" && isClockSyncEnabled(this.clockSync) && hexToByte(frame[4] ?? "ff") === 0) {
|
|
47
|
+
this.phase = "clock";
|
|
48
|
+
return [commandFor(buildA606TimeCommand(this.clockSync?.now?.() ?? new Date()))];
|
|
49
|
+
}
|
|
50
|
+
this.phase = "records";
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
if (type === TYPE_UPLOAD && command === CMD_UPLOAD_DATA) {
|
|
54
|
+
this.phase = "records";
|
|
55
|
+
return [commandFor(buildA606UploadCommand(false))];
|
|
56
|
+
}
|
|
57
|
+
return undefined;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export { A606CommandSequencer, buildA606ConnectedCommand, buildA606TimeCommand, buildA606UploadCommand, NOTIFY as A606_NOTIFY, SERVICE as A606_SERVICE, WRITE as A606_WRITE };
|
|
61
|
+
//# sourceMappingURL=a606.command-sequencer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getClockParts","isClockSyncEnabled","hexToByte","SERVICE","WRITE","NOTIFY","TYPE_GET","TYPE_UPLOAD","CMD_UPDATE_TIME","CMD_UPLOAD_DATA","byte","value","toString","padStart","frameFor","values","frame","map","checksum","reduce","sum","commandFor","serviceUuid","characteristicUuid","buildA606ConnectedCommand","buildA606TimeCommand","now","parts","year","month","day","hours","minutes","seconds","buildA606UploadCommand","ack","A606CommandSequencer","phase","constructor","clockSync","initialCommands","isHistoryTransfer","nextCommand","type","command","Date","undefined","A606_NOTIFY","A606_SERVICE","A606_WRITE"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/a606/a606.command-sequencer.ts"],"mappings":";;AAAA,SAEEA,aAAa,EACbC,kBAAkB,QACb,8BAA2B;AAGlC,SAASC,SAAS,QAAQ,+BAA4B;AAEtD,MAAMC,OAAO,GAAG,sCAAsC;AACtD,MAAMC,KAAK,GAAG,sCAAsC;AACpD,MAAMC,MAAM,GAAG,sCAAsC;AAErD,MAAMC,QAAQ,GAAG,IAAI;AACrB,MAAMC,WAAW,GAAG,IAAI;AACxB,MAAMC,eAAe,GAAG,IAAI;AAC5B,MAAMC,eAAe,GAAG,IAAI;AAE5B,MAAMC,IAAI,GAAIC,KAAa,IACzB,CAACA,KAAK,GAAG,IAAI,EAAEC,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AAE9C,MAAMC,QAAQ,GAAIC,MAAyB,IAAe;EACxD,MAAMC,KAAK,GAAGD,MAAM,CAACE,GAAG,CAACP,IAAI,CAAC;EAE9B,MAAMQ,QAAQ,GAAGF,KAAK,CAACG,MAAM,CAC3B,CAACC,GAAG,EAAET,KAAK,KAAMS,GAAG,GAAGlB,SAAS,C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A,KAAe,IAAI;EAEvCC,WAAW,GAChB1B,KAAwB,IACiB;IACzC,MAAM2B,IAAI,GAAGzC,SAAS,CAACc,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IACxC,MAAM4B,OAAO,GAAG1C,SAAS,CAACc,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IAE3C,IAAI2B,IAAI,KAAKrC,QAAQ,IAAIsC,OAAO,KAAKpC,eAAe,EAAE;MACpD,IACE,IAAI,CAAC6B,KAAK,KAAK,WAAW,IAC1BpC,kBAAkB,CAAC,IAAI,CAACsC,SAAS,CAAC,IAClCrC,SAAS,CAACc,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,EACjC;QACA,IAAI,CAACqB,KAAK,GAAG,OAAO;QAEpB,OAAO,CAAChB,UAAU,CAACI,oBAAoB,CAAC,IAAI,CAACc,SAAS,EAAEb,GAAG,GAAG,CAAC,IAAI,IAAImB,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;MAClF;MAEA,IAAI,CAACR,KAAK,GAAG,SAAS;MAEtB,OAAOS,SAAS;IAClB;IAEA,IAAIH,IAAI,KAAKpC,WAAW,IAAIqC,OAAO,KAAKnC,eAAe,EAAE;MACvD,IAAI,CAAC4B,KAAK,GAAG,SAAS;MAEtB,OAAO,CAAChB,UAAU,CAACa,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC;IACpD;IAEA,OAAOY,SAAS;EAClB,CAAC;AACH;AAEA,SACEV,oBAAoB,EACpBZ,yBAAyB,EACzBC,oBAAoB,EACpBS,sBAAsB,EACtB7B,MAAM,IAAI0C,WAAW,EACrB5C,OAAO,IAAI6C,YAAY,EACvB5C,KAAK,IAAI6C,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { MeasurementTypeKey } from "@ovok/core";
|
|
4
|
+
import { CaseType } from "../../../types/case-type.js";
|
|
5
|
+
import { BTManagedDevice } from "../bt-managed-device.js";
|
|
6
|
+
import { A606CommandSequencer } from "./a606.command-sequencer.js";
|
|
7
|
+
import { parseA606Record } from "./a606.frame-parser.js";
|
|
8
|
+
import { A606FrameReader } from "./a606.frame-reader.js";
|
|
9
|
+
import { a606MainServices } from "./a606.main-services.js";
|
|
10
|
+
/** Viatom/Lepu ZH-SG-A606 meter, which uploads stored records after connection. */
|
|
11
|
+
class A606Device extends BTManagedDevice {
|
|
12
|
+
mainServices = a606MainServices;
|
|
13
|
+
stuckDataTimeout = 120_000;
|
|
14
|
+
onStreamStart = undefined;
|
|
15
|
+
frameReader = new A606FrameReader();
|
|
16
|
+
constructor(device, params) {
|
|
17
|
+
super(device, params);
|
|
18
|
+
this.createCommandSequencer = () => new A606CommandSequencer(params.clockSync);
|
|
19
|
+
}
|
|
20
|
+
handleDependentResult = data => {
|
|
21
|
+
if (data.frame) {
|
|
22
|
+
const record = parseA606Record(data.frame);
|
|
23
|
+
if (record) {
|
|
24
|
+
this.onResult?.({
|
|
25
|
+
caseType: CaseType.RESULT,
|
|
26
|
+
measurementTypeKey: MeasurementTypeKey.bloodGlucose,
|
|
27
|
+
bloodGlucose: record.bloodGlucose,
|
|
28
|
+
recordedAt: record.recordedAt
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
...data,
|
|
34
|
+
parsingCase: {
|
|
35
|
+
...data.parsingCase,
|
|
36
|
+
caseType: CaseType.OTHER
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
handleSuccessResult() {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export { A606Device, a606MainServices };
|
|
45
|
+
//# sourceMappingURL=a606.device.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","CaseType","BTManagedDevice","A606CommandSequencer","parseA606Record","A606FrameReader","a606MainServices","A606Device","mainServices","stuckDataTimeout","onStreamStart","undefined","frameReader","constructor","device","params","createCommandSequencer","clockSync","handleDependentResult","data","frame","record","onResult","caseType","RESULT","measurementTypeKey","bloodGlucose","recordedAt","parsingCase","OTHER","handleSuccessResult"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/a606/a606.device.ts"],"mappings":";;AAAA,SAAkCA,kBAAkB,QAAQ,YAAY;AAGxE,SAASC,QAAQ,QAAQ,6BAA0B;AAQnD,SAASC,eAAe,QAAQ,yBAAsB;AAEtD,SAASC,oBAAoB,QAAQ,6BAA0B;AAC/D,SAASC,eAAe,QAAQ,wBAAqB;AACrD,SAASC,eAAe,QAAQ,wBAAqB;AACrD,SAASC,gBAAgB,QAAQ,yBAAsB;AAMvD;AACA,MAAMC,UAAU,SAASL,eAAe,CAA+B;EAC3DM,YAAY,GAAeF,gBAAgB;EAC3CG,gBAAgB,GAAG,OAAO;EAC1BC,aAAa,GAAGC,SAAS;EACzBC,WAAW,GAAG,IAAIP,eAAe,CAAC,CAAC;EAEtCQ,WAAWA,CAChBC,MAAc,EACdC,MAAwD,EACxD;IACA,KAAK,CAACD,MAAM,EAAEC,MAAM,CAAC;IACrB,IAAI,CAACC,sBAAsB,GAAG,MAC5B,IAAIb,oBAAoB,CAACY,MAAM,CAACE,SAAS,CAAC;EAC9C;EAEUC,qBAAqB,GAC7BC,IAAmD,IACD;IAClD,IAAIA,IAAI,CAACC,KAAK,EAAE;MACd,MAAMC,MAAM,GAAGjB,eAAe,CAACe,IAAI,CAACC,KAAK,CAAC;MAE1C,IAAIC,MAAM,EAAE;QACV,IAAI,CAACC,QAAQ,GAAG;UACdC,QAAQ,EAAEtB,QAAQ,CAACuB,MAAM;UACzBC,kBAAkB,EAAEzB,kBAAkB,CAAC0B,YAAY;UACnDA,YAAY,EAAEL,MAAM,CAACK,YAAY;UACjCC,UAAU,EAAEN,MAAM,CAACM;QACrB,CAAwE,CAAC;MAC3E;IACF;IAEA,OAAO;MACL,GAAGR,IAAI;MACPS,WAAW,EAAE;QAAE,GAAGT,IAAI,CAACS,WAAW;QAAEL,QAAQ,EAAEtB,QAAQ,CAAC4B;MAAM;IAC/D,CAAC;EACH,CAAC;EAESC,mBAAmBA,CAAA,EAAmB;IAC9C;EACF;AACF;AAEA,SAASvB,UAAU,EAAED,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { hexToByte } from "../../../utils/hex-to-byte.js";
|
|
4
|
+
const bigEndian = (frame, from) => (hexToByte(frame[from] ?? "00") << 8) + hexToByte(frame[from + 1] ?? "00");
|
|
5
|
+
|
|
6
|
+
/** Decodes the 12-byte glucose payload inside a verified 16-byte ZH-SG record. */
|
|
7
|
+
const parseA606Record = frame => {
|
|
8
|
+
if (frame.length < 16 || hexToByte(frame[0] ?? "00") !== 0x26 || hexToByte(frame[1] ?? "00") !== 0x44 || hexToByte(frame[2] ?? "00") !== 0x45) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
const year = 2000 + hexToByte(frame[8] ?? "00");
|
|
12
|
+
const month = hexToByte(frame[9] ?? "00");
|
|
13
|
+
const day = hexToByte(frame[10] ?? "00");
|
|
14
|
+
const hour = hexToByte(frame[11] ?? "00");
|
|
15
|
+
const minute = hexToByte(frame[12] ?? "00");
|
|
16
|
+
const second = hexToByte(frame[13] ?? "00");
|
|
17
|
+
const recordedAt = new Date(year, month - 1, day, hour, minute, second, 0);
|
|
18
|
+
if (month < 1 || month > 12 || day < 1 || day > 31 || hour > 23 || minute > 59 || second > 59 || recordedAt.getFullYear() !== year || recordedAt.getMonth() !== month - 1 || recordedAt.getDate() !== day || recordedAt.getHours() !== hour || recordedAt.getMinutes() !== minute || recordedAt.getSeconds() !== second) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
const bloodGlucose = bigEndian(frame, 6);
|
|
22
|
+
if (bloodGlucose === 0) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
bloodGlucose,
|
|
27
|
+
recordedAt,
|
|
28
|
+
dataPosition: bigEndian(frame, 4)
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export { parseA606Record };
|
|
32
|
+
//# sourceMappingURL=a606.frame-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["hexToByte","bigEndian","frame","from","parseA606Record","length","undefined","year","month","day","hour","minute","second","recordedAt","Date","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","bloodGlucose","dataPosition"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/a606/a606.frame-parser.ts"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,+BAA4B;AAQtD,MAAMC,SAAS,GAAGA,CAACC,KAAwB,EAAEC,IAAY,KACvD,CAACH,SAAS,CAACE,KAAK,CAACC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAIH,SAAS,CAACE,KAAK,CAACC,IAAI,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC;;AAE5E;AACA,MAAMC,eAAe,GAAIF,KAAwB,IAA6B;EAC5E,IACEA,KAAK,CAACG,MAAM,GAAG,EAAE,IACjBL,SAAS,CAACE,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,IACpCF,SAAS,CAACE,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,IACpCF,SAAS,CAACE,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,EACpC;IACA,OAAOI,SAAS;EAClB;EAEA,MAAMC,IAAI,GAAG,IAAI,GAAGP,SAAS,CAACE,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;EAC/C,MAAMM,KAAK,GAAGR,SAAS,CAACE,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;EACzC,MAAMO,GAAG,GAAGT,SA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
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { FrameReadStatus } from "../../../types/frame-read-status.js";
|
|
4
|
+
import { hexToByte } from "../../../utils/hex-to-byte.js";
|
|
5
|
+
const START = 0x26;
|
|
6
|
+
const TYPE_GET = 0x43;
|
|
7
|
+
const TYPE_UPLOAD = 0x44;
|
|
8
|
+
const TYPE_INDEX = 1;
|
|
9
|
+
const CHECKSUM_BYTES = 1;
|
|
10
|
+
|
|
11
|
+
/** Reads the `& C/D ... checksum` frames used by Viatom's ZH-SG glucose protocol. */
|
|
12
|
+
export class A606FrameReader {
|
|
13
|
+
readFrame(buffer) {
|
|
14
|
+
const start = this.findStart(buffer);
|
|
15
|
+
if (start < 0) {
|
|
16
|
+
return {
|
|
17
|
+
status: FrameReadStatus.INCOMPLETE,
|
|
18
|
+
consumedBytes: Math.max(0, buffer.length - 1)
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const type = hexToByte(buffer[start + TYPE_INDEX] ?? "00");
|
|
22
|
+
const frameLength = type === TYPE_UPLOAD ? 16 : type === TYPE_GET ? 7 : 0;
|
|
23
|
+
if (frameLength === 0) {
|
|
24
|
+
return {
|
|
25
|
+
status: FrameReadStatus.CORRUPT,
|
|
26
|
+
consumedBytes: start + 1
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
if (start + frameLength > buffer.length) {
|
|
30
|
+
return {
|
|
31
|
+
status: FrameReadStatus.INCOMPLETE,
|
|
32
|
+
consumedBytes: start
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const frame = buffer.slice(start, start + frameLength);
|
|
36
|
+
if (!this.hasValidChecksum(frame)) {
|
|
37
|
+
return {
|
|
38
|
+
status: FrameReadStatus.CORRUPT,
|
|
39
|
+
consumedBytes: start + 1
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
status: FrameReadStatus.COMPLETE,
|
|
44
|
+
consumedBytes: start + frameLength,
|
|
45
|
+
frame
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
findStart(buffer) {
|
|
49
|
+
for (let index = 0; index + 2 < buffer.length; index++) {
|
|
50
|
+
const type = hexToByte(buffer[index + TYPE_INDEX] ?? "00");
|
|
51
|
+
if (hexToByte(buffer[index] ?? "00") === START && (type === TYPE_GET || type === TYPE_UPLOAD)) {
|
|
52
|
+
return index;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return -1;
|
|
56
|
+
}
|
|
57
|
+
hasValidChecksum(frame) {
|
|
58
|
+
const checksumIndex = frame.length - CHECKSUM_BYTES;
|
|
59
|
+
const checksum = frame.slice(0, checksumIndex).reduce((sum, byte) => sum + hexToByte(byte) & 0xff, 0);
|
|
60
|
+
return checksum === hexToByte(frame[checksumIndex] ?? "00");
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=a606.frame-reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["FrameReadStatus","hexToByte","START","TYPE_GET","TYPE_UPLOAD","TYPE_INDEX","CHECKSUM_BYTES","A606FrameReader","readFrame","buffer","start","findStart","status","INCOMPLETE","consumedBytes","Math","max","length","type","frameLength","CORRUPT","frame","slice","hasValidChecksum","COMPLETE","index","checksumIndex","checksum","reduce","sum","byte"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/a606/a606.frame-reader.ts"],"mappings":";;AACA,SAASA,eAAe,QAAQ,qCAAkC;AAElE,SAASC,SAAS,QAAQ,+BAA4B;AAEtD,MAAMC,KAAK,GAAG,IAAI;AAClB,MAAMC,QAAQ,GAAG,IAAI;AACrB,MAAMC,WAAW,GAAG,IAAI;AACxB,MAAMC,UAAU,GAAG,CAAC;AACpB,MAAMC,cAAc,GAAG,CAAC;;AAExB;AACA,OAAO,MAAMC,eAAe,CAAwB;EAC3CC,SAASA,CAACC,MAAyB,EAAmB;IAC3D,MAAMC,KAAK,GAA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,MAAM,EAAEQ,KAAK,EAAE,EAAE;MACtD,MAAMP,IAAI,GAAGjB,SAAS,CAACQ,MAAM,CAACgB,KAAK,GAAGpB,UAAU,CAAC,IAAI,IAAI,CAAC;MAE1D,IAAIJ,SAAS,CAACQ,MAAM,CAACgB,KAAK,CAAC,IAAI,IAAI,CAAC,KAAKvB,KAAK,KAAKgB,IAAI,KAAKf,QAAQ,IAAIe,IAAI,KAAKd,WAAW,CAAC,EAAE;QAC7F,OAAOqB,KAAK;MACd;IACF;IAEA,OAAO,CAAC,CAAC;EACX;EAEQF,gBAAgBA,CAACF,KAAwB,EAAW;IAC1D,MAAMK,aAAa,GAAGL,KAAK,CAACJ,MAAM,GAAGX,cAAc;IAEnD,MAAMqB,QAAQ,GAAGN,KAAK,CACnBC,KAAK,CAAC,CAAC,EAAEI,aAAa,CAAC,CACvBE,MAAM,CAAC,CAACC,GAAG,EAAEC,IAAI,KAAMD,GAAG,GAAG5B,SAAS,CAAC6B,IAAI,CAAC,GAAI,IAAI,EAAE,CAAC,CAAC;IAE3D,OAAOH,QAAQ,KAAK1B,SAAS,CAACoB,KAAK,CAACK,aAAa,CAAC,IAAI,IAAI,CAAC;EAC7D;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { MeasurementTypeKey } from "@ovok/core";
|
|
4
|
+
import { CaseType } from "../../../types/case-type.js";
|
|
5
|
+
import { A606_NOTIFY, A606_SERVICE, A606_WRITE } from "./a606.command-sequencer.js";
|
|
6
|
+
|
|
7
|
+
/** ZH-SG's fixed GATT profile and its 16-byte stored glucose record. */
|
|
8
|
+
export const a606MainServices = [{
|
|
9
|
+
uuid: A606_SERVICE,
|
|
10
|
+
writeUuid: {
|
|
11
|
+
uuid: A606_WRITE,
|
|
12
|
+
mainCommandUuid: "26440346200120"
|
|
13
|
+
},
|
|
14
|
+
monitorUuids: [{
|
|
15
|
+
uuid: A606_NOTIFY,
|
|
16
|
+
parsingModel: {
|
|
17
|
+
caseValuePosition: [1, 2],
|
|
18
|
+
cases: [{
|
|
19
|
+
caseValue: "4445",
|
|
20
|
+
caseType: CaseType.DEPENDENT,
|
|
21
|
+
measurementTypeKey: MeasurementTypeKey.bloodGlucose,
|
|
22
|
+
minLengthBytes: 16,
|
|
23
|
+
parseDefinitions: []
|
|
24
|
+
}]
|
|
25
|
+
}
|
|
26
|
+
}]
|
|
27
|
+
}];
|
|
28
|
+
//# sourceMappingURL=a606.main-services.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","CaseType","A606_NOTIFY","A606_SERVICE","A606_WRITE","a606MainServices","uuid","writeUuid","mainCommandUuid","monitorUuids","parsingModel","caseValuePosition","cases","caseValue","caseType","DEPENDENT","measurementTypeKey","bloodGlucose","minLengthBytes","parseDefinitions"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/a606/a606.main-services.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,YAAY;AAE/C,SAASC,QAAQ,QAAQ,6BAA0B;AAGnD,SAASC,WAAW,EAAEC,YAAY,EAAEC,UAAU,QAAQ,6BAA0B;;AAEhF;AACA,OAAO,MAAMC,gBAA4B,GAAG,CAC1C;EACEC,IAAI,EAAEH,YAAY;EAClBI,SAAS,EAAE;IACTD,IAAI,EAAEF,UAAU;IAChBI,eAAe,EAAE;EACnB,CAAC;EACDC,YAAY,EAAE,CACZ;IACEH,IAAI,EAAEJ,WAAW;IACjBQ,YAAY,EAAE;MACZC,iBAAiB,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;MACzBC,KAAK,EAAE,CACL;QACEC,SAAS,EAAE,MAAM;QACjBC,QAAQ,EAAEb,QAAQ,CAACc,SAAS;QAC5BC,kBAAkB,EAAEhB,kBAAkB,CAACiB,YAAY;QACnDC,cAAc,EAAE,EAAE;QAClBC,gBAAgB,EAAE;MACpB,CAAC;IAEL;EACF,CAAC;AAEL,CAAC,CACF","ignoreList":[]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { hexToByte } from "../../../utils/hex-to-byte.js";
|
|
4
|
+
const SERVICE = "81eea003-e735-49ec-8a11-7e32cae1e14e";
|
|
5
|
+
const WRITE = "81eea002-e735-49ec-8a11-7e32cae1e14e";
|
|
6
|
+
const FEATURE_TYPE = 0x00;
|
|
7
|
+
const SYNC_TYPE = 0x01;
|
|
8
|
+
const HISTORY_TYPE = 0x03;
|
|
9
|
+
const FRAME_START = "e0";
|
|
10
|
+
const byte = value => (value & 0xff).toString(16).padStart(2, "0");
|
|
11
|
+
const withChecksum = frame => {
|
|
12
|
+
const checksum = frame.reduce((sum, value, index) => index === 3 ? sum : sum + hexToByte(value) & 0xff, 0);
|
|
13
|
+
return [...frame.slice(0, 3), byte(checksum), ...frame.slice(3)];
|
|
14
|
+
};
|
|
15
|
+
const commandFor = (frame, delayBeforeWriteMs) => ({
|
|
16
|
+
serviceUuid: SERVICE,
|
|
17
|
+
characteristicUuid: WRITE,
|
|
18
|
+
frame,
|
|
19
|
+
...(delayBeforeWriteMs === undefined ? {} : {
|
|
20
|
+
delayBeforeWriteMs
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
/** Builds an LHZL command after applying the checksum inserted by the vendor BLE writer. */
|
|
25
|
+
const buildBpw1Command = (type, protocolVersion, key, payload) => {
|
|
26
|
+
const payloadLength = payload.length;
|
|
27
|
+
const frame = [FRAME_START, byte(payloadLength + 5 >> 8), byte(payloadLength + 5), byte(type), byte(protocolVersion), byte(key), byte(payloadLength >> 8), byte(payloadLength), ...payload.map(byte)];
|
|
28
|
+
return withChecksum(frame);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** Builds the vendor's acknowledgement for one accepted LHZL frame. */
|
|
32
|
+
const buildBpw1Ack = frame => {
|
|
33
|
+
const type = hexToByte(frame[4] ?? "00");
|
|
34
|
+
const protocolVersion = hexToByte(frame[5] ?? "00");
|
|
35
|
+
const key = hexToByte(frame[6] ?? "00");
|
|
36
|
+
return withChecksum(["0e", "00", "06", byte(type), byte(protocolVersion), byte(key), "00", "01", "00"]);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** ViHealth's initial feature probe for the BPW1 LHZL profile. */
|
|
40
|
+
const buildBpw1FeatureCommand = () => buildBpw1Command(FEATURE_TYPE, 0, 0, [1]);
|
|
41
|
+
|
|
42
|
+
/** Requests all stored health-history packets after the feature reply. */
|
|
43
|
+
const buildBpw1HistoryCommand = protocolVersion => buildBpw1Command(SYNC_TYPE, protocolVersion, 0, [1]);
|
|
44
|
+
|
|
45
|
+
/** Answers the feature probe, then starts the vendor's all-history transfer. */
|
|
46
|
+
class Bpw1CommandSequencer {
|
|
47
|
+
protocolVersion = 0;
|
|
48
|
+
historyRequested = false;
|
|
49
|
+
initialCommands = () => [commandFor(buildBpw1FeatureCommand(), 300)];
|
|
50
|
+
nextCommand = frame => {
|
|
51
|
+
if (frame.length < 7) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
const type = hexToByte(frame[4] ?? "00");
|
|
55
|
+
const acknowledgement = commandFor(buildBpw1Ack(frame));
|
|
56
|
+
if (type === FEATURE_TYPE && !this.historyRequested) {
|
|
57
|
+
this.protocolVersion = hexToByte(frame[5] ?? "00");
|
|
58
|
+
this.historyRequested = true;
|
|
59
|
+
return [acknowledgement, commandFor(buildBpw1HistoryCommand(this.protocolVersion))];
|
|
60
|
+
}
|
|
61
|
+
return [acknowledgement];
|
|
62
|
+
};
|
|
63
|
+
isHistoryTransfer = () => true;
|
|
64
|
+
}
|
|
65
|
+
export { Bpw1CommandSequencer, buildBpw1Ack, buildBpw1FeatureCommand, buildBpw1HistoryCommand, SERVICE as BPW1_SERVICE, WRITE as BPW1_WRITE, HISTORY_TYPE as BPW1_HISTORY_TYPE };
|
|
66
|
+
//# sourceMappingURL=bpw1.command-sequencer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["hexToByte","SERVICE","WRITE","FEATURE_TYPE","SYNC_TYPE","HISTORY_TYPE","FRAME_START","byte","value","toString","padStart","withChecksum","frame","checksum","reduce","sum","index","slice","commandFor","delayBeforeWriteMs","serviceUuid","characteristicUuid","undefined","buildBpw1Command","type","protocolVersion","key","payload","payloadLength","length","map","buildBpw1Ack","buildBpw1FeatureCommand","buildBpw1HistoryCommand","Bpw1CommandSequencer","historyRequested","initialCommands","nextCommand","acknowledgement","isHistoryTransfer","BPW1_SERVICE","BPW1_WRITE","BPW1_HISTORY_TYPE"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/bpw1/bpw1.command-sequencer.ts"],"mappings":";;AAEA,SAASA,SAAS,QAAQ,+BAA4B;AAEtD,MAAMC,OAAO,GAAG,sCAAsC;AACtD,MAAMC,KAAK,GAAG,sCAAsC;AACpD,MAAMC,YAAY,GAAG,IAAI;AACzB,MAAMC,SAAS,GAAG,IAAI;AACtB,MAAMC,YAAY,GAAG,IAAI;AACzB,MAAMC,WAAW,GAAG,IAAI;AAExB,MAAMC,IAAI,GAAIC,KAAa,IACzB,CAACA,KAAK,GAAG,IAAI,EAAEC,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AAE9C,MAAMC,YAAY,GAAIC,KAAwB,IAAe;EAC3D,MAAMC,QAAQ,GAAGD,KAAK,CAACE,MAAM,CAC3B,CAACC,GAAG,EAAEP,KAAK,EAAEQ,KAAK,KAChBA,KAAK,KAAK,CAAC,GAAGD,GAAG,GAAIA,GAAG,GAAGf,SAAS,CAACQ,KAAK,CAAC,GAAI,IAAI,EACrD,CACF,CAAC;EAED,OAAO,CAAC,GAAGI,KAAK,CAACK,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAEV,IAAI,CAACM,QAAQ,CAAC,EAAE,GAAGD,KAAK,CAACK,KAAK,CAAC,CAAC,CAAC,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AAuB,EACvBC,uBAAuB,EACvBhC,OAAO,IAAIuC,YAAY,EACvBtC,KAAK,IAAIuC,UAAU,EACnBpC,YAAY,IAAIqC,iBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { MeasurementTypeKey } from "@ovok/core";
|
|
4
|
+
import { CaseType } from "../../../types/case-type.js";
|
|
5
|
+
import { BTManagedDevice } from "../bt-managed-device.js";
|
|
6
|
+
import { Bpw1CommandSequencer } from "./bpw1.command-sequencer.js";
|
|
7
|
+
import { parseBpw1BloodPressureRecords } from "./bpw1.frame-parser.js";
|
|
8
|
+
import { Bpw1FrameReader } from "./bpw1.frame-reader.js";
|
|
9
|
+
import { bpw1MainServices } from "./bpw1.main-services.js";
|
|
10
|
+
/** Viatom BPW1 watch, including stored blood-pressure history. */
|
|
11
|
+
class Bpw1Device extends BTManagedDevice {
|
|
12
|
+
mainServices = bpw1MainServices;
|
|
13
|
+
stuckDataTimeout = 120_000;
|
|
14
|
+
onStreamStart = undefined;
|
|
15
|
+
frameReader = new Bpw1FrameReader();
|
|
16
|
+
constructor(device, params) {
|
|
17
|
+
super(device, params);
|
|
18
|
+
this.createCommandSequencer = () => new Bpw1CommandSequencer();
|
|
19
|
+
}
|
|
20
|
+
handleDependentResult = data => {
|
|
21
|
+
if (data.frame) {
|
|
22
|
+
for (const record of parseBpw1BloodPressureRecords(data.frame)) {
|
|
23
|
+
this.onResult?.({
|
|
24
|
+
caseType: CaseType.RESULT,
|
|
25
|
+
measurementTypeKey: MeasurementTypeKey.bloodPressure,
|
|
26
|
+
systolic: record.systolic,
|
|
27
|
+
diastolic: record.diastolic,
|
|
28
|
+
recordedAt: record.recordedAt
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
...data,
|
|
34
|
+
parsingCase: {
|
|
35
|
+
...data.parsingCase,
|
|
36
|
+
caseType: CaseType.OTHER
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
handleSuccessResult() {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export { Bpw1Device, bpw1MainServices };
|
|
45
|
+
//# sourceMappingURL=bpw1.device.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","CaseType","BTManagedDevice","Bpw1CommandSequencer","parseBpw1BloodPressureRecords","Bpw1FrameReader","bpw1MainServices","Bpw1Device","mainServices","stuckDataTimeout","onStreamStart","undefined","frameReader","constructor","device","params","createCommandSequencer","handleDependentResult","data","frame","record","onResult","caseType","RESULT","measurementTypeKey","bloodPressure","systolic","diastolic","recordedAt","parsingCase","OTHER","handleSuccessResult"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/bpw1/bpw1.device.ts"],"mappings":";;AAAA,SAAmCA,kBAAkB,QAAQ,YAAY;AAGzE,SAASC,QAAQ,QAAQ,6BAA0B;AAQnD,SAASC,eAAe,QAAQ,yBAAsB;AAEtD,SAASC,oBAAoB,QAAQ,6BAA0B;AAC/D,SAASC,6BAA6B,QAAQ,wBAAqB;AACnE,SAASC,eAAe,QAAQ,wBAAqB;AACrD,SAASC,gBAAgB,QAAQ,yBAAsB;AAIvD;AACA,MAAMC,UAAU,SAASL,eAAe,CAAyB;EACrDM,YAAY,GAAeF,gBAAgB;EAC3CG,gBAAgB,GAAG,OAAO;EAC1BC,aAAa,GAAGC,SAAS;EACzBC,WAAW,GAAG,IAAIP,eAAe,CAAC,CAAC;EAEtCQ,WAAWA,CAChBC,MAAc,EACdC,MAAkD,EAClD;IACA,KAAK,CAACD,MAAM,EAAEC,MAAM,CAAC;IACrB,IAAI,CAACC,sBAAsB,GAAG,MAC5B,IAAIb,oBAAoB,CAAC,CAAC;EAC9B;EAEUc,qBAAqB,GAC7BC,IAAmD,IACD;IAClD,IAAIA,IAAI,CAACC,KAAK,EAAE;MACd,KAAK,MAAMC,MAAM,IAAIhB,6BAA6B,CAACc,IAAI,CAACC,KAAK,CAAC,EAAE;QAC9D,IAAI,CAACE,QAAQ,GAAG;UACdC,QAAQ,EAAErB,QAAQ,CAACsB,MAAM;UACzBC,kBAAkB,EAAExB,kBAAkB,CAACyB,aAAa;UACpDC,QAAQ,EAAEN,MAAM,CAACM,QAAQ;UACzBC,SAAS,EAAEP,MAAM,CAACO,SAAS;UAC3BC,UAAU,EAAER,MAAM,CAACQ;QACrB,CAAyE,CAAC;MAC5E;IACF;IAEA,OAAO;MACL,GAAGV,IAAI;MACPW,WAAW,EAAE;QAAE,GAAGX,IAAI,CAACW,WAAW;QAAEP,QAAQ,EAAErB,QAAQ,CAAC6B;MAAM;IAC/D,CAAC;EACH,CAAC;EAESC,mBAAmBA,CAAA,EAAmB;IAC9C;EACF;AACF;AAEA,SAASxB,UAAU,EAAED,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { hexToByte } from "../../../utils/hex-to-byte.js";
|
|
4
|
+
const bigEndian = (frame, from) => hexToByte(frame[from] ?? "00") << 24 | hexToByte(frame[from + 1] ?? "00") << 16 | hexToByte(frame[from + 2] ?? "00") << 8 | hexToByte(frame[from + 3] ?? "00");
|
|
5
|
+
const validDate = (year, month, day) => {
|
|
6
|
+
if (month < 1 || month > 12 || day < 1 || day > 31) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
const date = new Date(year, month - 1, day);
|
|
10
|
+
return date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day ? date : undefined;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/** Decodes BP records from ViHealth's generic LHZL health-history packet. */
|
|
14
|
+
export const parseBpw1BloodPressureRecords = frame => {
|
|
15
|
+
if (frame.length < 21 || hexToByte(frame[0] ?? "00") !== 0xe0 || hexToByte(frame[4] ?? "00") !== 0x03 || hexToByte(frame[6] ?? "00") !== 0x01) {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
const year = 2000 + ((hexToByte(frame[9] ?? "00") & 0x7f) >> 1);
|
|
19
|
+
const month = (hexToByte(frame[9] ?? "00") & 0x01) << 3 | (hexToByte(frame[10] ?? "00") & 0xe0) >> 5;
|
|
20
|
+
const day = hexToByte(frame[10] ?? "00") & 0x1f;
|
|
21
|
+
const date = validDate(year, month, day);
|
|
22
|
+
const count = hexToByte(frame[11] ?? "00") << 8 | hexToByte(frame[12] ?? "00");
|
|
23
|
+
if (!date || count === 0) {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
const records = [];
|
|
27
|
+
for (let index = 0; index < count; index++) {
|
|
28
|
+
const offset = 13 + index * 8;
|
|
29
|
+
if (offset + 7 >= frame.length) {
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
const secondsSinceMidnight = bigEndian(frame, offset);
|
|
33
|
+
const systolic = hexToByte(frame[offset + 6] ?? "00");
|
|
34
|
+
const diastolic = hexToByte(frame[offset + 7] ?? "00");
|
|
35
|
+
if (secondsSinceMidnight < 0 || secondsSinceMidnight >= 24 * 60 * 60 || systolic < 50 || systolic > 300 || diastolic < 30 || diastolic > 200) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const recordedAt = new Date(date);
|
|
39
|
+
recordedAt.setSeconds(secondsSinceMidnight);
|
|
40
|
+
records.push({
|
|
41
|
+
systolic,
|
|
42
|
+
diastolic,
|
|
43
|
+
recordedAt
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return records;
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=bpw1.frame-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["hexToByte","bigEndian","frame","from","validDate","year","month","day","undefined","date","Date","getFullYear","getMonth","getDate","parseBpw1BloodPressureRecords","length","count","records","index","offset","secondsSinceMidnight","systolic","diastolic","recordedAt","setSeconds","push"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/bpw1/bpw1.frame-parser.ts"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,+BAA4B;AAQtD,MAAMC,SAAS,GAAGA,CAACC,KAAwB,EAAEC,IAAY,KACtDH,SAAS,CAACE,KAAK,CAACC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,GACpCH,SAAS,CAACE,KAAK,CAACC,IAAI,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,EAAG,GACzCH,SAAS,CAACE,KAAK,CAACC,IAAI,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAE,GACzCH,SAAS,CAACE,KAAK,CAACC,IAAI,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC;AAEpC,MAAMC,SAAS,GAAGA,CAChBC,IAAY,EACZC,KAAa,EACbC,GAAW,KACU;EACrB,IAAID,KAAK,GAAG,CAAC,IAAIA,KAAK,GAAG,EAAE,IAAIC,GAAG,GAAG,CAAC,IAAIA,GAAG,GAAG,EAAE,EAAE;IAClD,OAAOC,SAAS;EAClB;EAEA,MAAMC,IAAI,GAAG,IAAIC,IAAI,CAACL,IAAI,EAAEC,KAAK,GAAG,CAAC,EAAEC,GAAG,CAAC;EAE3C,OAAOE,IAAI,CAACE,WAAW,CAAC,CAAC,KAAKN,IAAI,IAChCI,IAAI,CAACG,QAAQ,CAAC,CAAC,KAAKN,KAAK,GAAG,CAAC,IAC7BG,IAAI,CAACI,OAAO,CAAC,CAAC,KAAKN,GAAG,GACpBE,IAAI,GACJD,SAAS;AACf,CAAC;;AAED;AACA,OAAO,MAAMM,6BAA6B,GACxCZ,KAAwB,IACM;EAC9B,IACEA,KAAK,CAACa,MAAM,GAAG,EAAE,IACjBf,SAAS,CAACE,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,IACpCF,SAAS,CAACE,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,IA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C,CAAC,IAAI,IAAI,CAAC;IACrD,MAAMG,SAAS,GAAGtB,SAAS,CAACE,KAAK,CAACiB,MAAM,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC;IAEtD,IACEC,oBAAoB,GAAG,CAAC,IACxBA,oBAAoB,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,IACpCC,QAAQ,GAAG,EAAE,IACbA,QAAQ,GAAG,GAAG,IACdC,SAAS,GAAG,EAAE,IACdA,SAAS,GAAG,GAAG,EACf;MACA;IACF;IAEA,MAAMC,UAAU,GAAG,IAAIb,IAAI,CAACD,IAAI,CAAC;IAEjCc,UAAU,CAACC,UAAU,CAACJ,oBAAoB,CAAC;IAC3CH,OAAO,CAACQ,IAAI,CAAC;MAAEJ,QAAQ;MAAEC,SAAS;MAAEC;IAAW,CAAC,CAAC;EACnD;EAEA,OAAON,OAAO;AAChB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { FrameReadStatus } from "../../../types/frame-read-status.js";
|
|
4
|
+
import { hexToByte } from "../../../utils/hex-to-byte.js";
|
|
5
|
+
const START = 0xe0;
|
|
6
|
+
const HEADER_BYTES = 4;
|
|
7
|
+
|
|
8
|
+
/** Reads the length-prefixed, checksummed LHZL history frames used by BPW1. */
|
|
9
|
+
export class Bpw1FrameReader {
|
|
10
|
+
readFrame(buffer) {
|
|
11
|
+
const start = buffer.findIndex((byte, index) => hexToByte(byte) === START && index + 2 < buffer.length);
|
|
12
|
+
if (start < 0) {
|
|
13
|
+
return {
|
|
14
|
+
status: FrameReadStatus.INCOMPLETE,
|
|
15
|
+
consumedBytes: Math.max(0, buffer.length - 1)
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const payloadLength = hexToByte(buffer[start + 1] ?? "00") << 8 | hexToByte(buffer[start + 2] ?? "00");
|
|
19
|
+
const frameLength = payloadLength + HEADER_BYTES;
|
|
20
|
+
if (frameLength < 9) {
|
|
21
|
+
return {
|
|
22
|
+
status: FrameReadStatus.CORRUPT,
|
|
23
|
+
consumedBytes: start + 1
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
if (start + frameLength > buffer.length) {
|
|
27
|
+
return {
|
|
28
|
+
status: FrameReadStatus.INCOMPLETE,
|
|
29
|
+
consumedBytes: start
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const frame = buffer.slice(start, start + frameLength);
|
|
33
|
+
if (!this.hasValidChecksum(frame)) {
|
|
34
|
+
return {
|
|
35
|
+
status: FrameReadStatus.CORRUPT,
|
|
36
|
+
consumedBytes: start + 1
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
status: FrameReadStatus.COMPLETE,
|
|
41
|
+
consumedBytes: start + frameLength,
|
|
42
|
+
frame
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
hasValidChecksum(frame) {
|
|
46
|
+
const checksum = frame.reduce((sum, byte, index) => index === 3 ? sum : sum + hexToByte(byte) & 0xff, 0);
|
|
47
|
+
return checksum === hexToByte(frame[3] ?? "00");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=bpw1.frame-reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["FrameReadStatus","hexToByte","START","HEADER_BYTES","Bpw1FrameReader","readFrame","buffer","start","findIndex","byte","index","length","status","INCOMPLETE","consumedBytes","Math","max","payloadLength","frameLength","CORRUPT","frame","slice","hasValidChecksum","COMPLETE","checksum","reduce","sum"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/bpw1/bpw1.frame-reader.ts"],"mappings":";;AACA,SAASA,eAAe,QAAQ,qCAAkC;AAElE,SAASC,SAAS,QAAQ,+BAA4B;AAEtD,MAAMC,KAAK,GAAG,IAAI;AAClB,MAAMC,YAAY,GAAG,CAAC;;AAEtB;AACA,OAAO,MAAMC,eAAe,CAAwB;EAC3CC,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;MAChCT,aAAa,EAAEP,KAAK,GAAGW,WAAW;MAClCE;IACF,CAAC;EACH;EAEQE,gBAAgBA,CAACF,KAAwB,EAAW;IAC1D,MAAMI,QAAQ,GAAGJ,KAAK,CAACK,MAAM,CAC3B,CAACC,GAAG,EAAEjB,IAAI,EAAEC,KAAK,KACfA,KAAK,KAAK,CAAC,GAAGgB,GAAG,GAAIA,GAAG,GAAGzB,SAAS,CAACQ,IAAI,CAAC,GAAI,IAAI,EACpD,CACF,CAAC;IAED,OAAOe,QAAQ,KAAKvB,SAAS,CAACmB,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;EACjD;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { MeasurementTypeKey } from "@ovok/core";
|
|
4
|
+
import { CaseType } from "../../../types/case-type.js";
|
|
5
|
+
/** Viatom BPW1's LHZL watch-profile GATT surface used by ViHealth. */
|
|
6
|
+
export const bpw1MainServices = [{
|
|
7
|
+
uuid: "81eea003-e735-49ec-8a11-7e32cae1e14e",
|
|
8
|
+
writeUuid: {
|
|
9
|
+
uuid: "81eea002-e735-49ec-8a11-7e32cae1e14e",
|
|
10
|
+
mainCommandUuid: "e00000000000000001"
|
|
11
|
+
},
|
|
12
|
+
monitorUuids: [{
|
|
13
|
+
uuid: "81eea001-e735-49ec-8a11-7e32cae1e14e",
|
|
14
|
+
parsingModel: {
|
|
15
|
+
caseValuePosition: [4, 6],
|
|
16
|
+
cases: [{
|
|
17
|
+
caseValue: "0301",
|
|
18
|
+
caseType: CaseType.DEPENDENT,
|
|
19
|
+
measurementTypeKey: MeasurementTypeKey.bloodPressure,
|
|
20
|
+
minLengthBytes: 21,
|
|
21
|
+
parseDefinitions: []
|
|
22
|
+
}]
|
|
23
|
+
}
|
|
24
|
+
}]
|
|
25
|
+
}];
|
|
26
|
+
//# sourceMappingURL=bpw1.main-services.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","CaseType","bpw1MainServices","uuid","writeUuid","mainCommandUuid","monitorUuids","parsingModel","caseValuePosition","cases","caseValue","caseType","DEPENDENT","measurementTypeKey","bloodPressure","minLengthBytes","parseDefinitions"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/bpw1/bpw1.main-services.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,YAAY;AAE/C,SAASC,QAAQ,QAAQ,6BAA0B;AAGnD;AACA,OAAO,MAAMC,gBAA4B,GAAG,CAC1C;EACEC,IAAI,EAAE,sCAAsC;EAC5CC,SAAS,EAAE;IACTD,IAAI,EAAE,sCAAsC;IAC5CE,eAAe,EAAE;EACnB,CAAC;EACDC,YAAY,EAAE,CACZ;IACEH,IAAI,EAAE,sCAAsC;IAC5CI,YAAY,EAAE;MACZC,iBAAiB,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;MACzBC,KAAK,EAAE,CACL;QACEC,SAAS,EAAE,MAAM;QACjBC,QAAQ,EAAEV,QAAQ,CAACW,SAAS;QAC5BC,kBAAkB,EAAEb,kBAAkB,CAACc,aAAa;QACpDC,cAAc,EAAE,EAAE;QAClBC,gBAAgB,EAAE;MACpB,CAAC;IAEL;EACF,CAAC;AAEL,CAAC,CACF","ignoreList":[]}
|
|
@@ -27,6 +27,7 @@ export class BTDataProcessor {
|
|
|
27
27
|
this.measurementState = new MeasurementStateMachine({
|
|
28
28
|
onStatusChanged: callbacks.onStatusChanged,
|
|
29
29
|
onStreamStart: callbacks.onStreamStart,
|
|
30
|
+
onMeasurementEnd: callbacks.onMeasurementEnd,
|
|
30
31
|
onResult: callbacks.onResult
|
|
31
32
|
});
|
|
32
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["sentryLogger","CaseType","FrameReadStatus","FrameParser","MeasurementStateMachine","BTDataProcessor","buffers","Map","constructor","device","mainServices","stuckDataTimeoutDuration","callbacks","frameReader","frameParser","measurementState","onStatusChanged","onStreamStart","onResult","currentUuid","destroy","clear","reset","clearTimeout","stuckDataTimeout","undefined","commandTimeout","processData","uuid","hexValue","String","toLowerCase","buffer","get","push","set","startStuckTimeout","readFramesFromBuffer","readWholeBuffer","armStuckTimeout","armCommandTimeout","startCommandTimeout","reader","length","result","readFrame","hasProgressed","consumedBytes","splice","status","COMPLETE","handleFrame","frame","answerFrame","CORRUPT","reportCorruptFrame","INCOMPLETE","validatePackage","progress","commandProgress","commands","nextCommand","sendCommands","data","parse","join","dependentData","parsingCase","caseType","DEPENDENT","handleDependentResult","advance","onError","Error","cause","message","setTimeout","cancelConnection","duration","commandTimeoutMs","onCommandTimeout","terminal"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/bt-data-processor.ts"],"mappings":";;AAAA;;AAIA,SAASA,YAAY,QAAQ,yCAAsC;AACnE,SAASC,QAAQ,QAAQ,0BAAuB;AAKhD,SAASC,eAAe,QAAQ,kCAA+B;AAK/D,SAASC,WAAW,QAAQ,mBAAgB;AAC5C,SAASC,uBAAuB,QAAQ,gCAA6B;
|
|
1
|
+
{"version":3,"names":["sentryLogger","CaseType","FrameReadStatus","FrameParser","MeasurementStateMachine","BTDataProcessor","buffers","Map","constructor","device","mainServices","stuckDataTimeoutDuration","callbacks","frameReader","frameParser","measurementState","onStatusChanged","onStreamStart","onMeasurementEnd","onResult","currentUuid","destroy","clear","reset","clearTimeout","stuckDataTimeout","undefined","commandTimeout","processData","uuid","hexValue","String","toLowerCase","buffer","get","push","set","startStuckTimeout","readFramesFromBuffer","readWholeBuffer","armStuckTimeout","armCommandTimeout","startCommandTimeout","reader","length","result","readFrame","hasProgressed","consumedBytes","splice","status","COMPLETE","handleFrame","frame","answerFrame","CORRUPT","reportCorruptFrame","INCOMPLETE","validatePackage","progress","commandProgress","commands","nextCommand","sendCommands","data","parse","join","dependentData","parsingCase","caseType","DEPENDENT","handleDependentResult","advance","onError","Error","cause","message","setTimeout","cancelConnection","duration","commandTimeoutMs","onCommandTimeout","terminal"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/bt-data-processor.ts"],"mappings":";;AAAA;;AAIA,SAASA,YAAY,QAAQ,yCAAsC;AACnE,SAASC,QAAQ,QAAQ,0BAAuB;AAKhD,SAASC,eAAe,QAAQ,kCAA+B;AAK/D,SAASC,WAAW,QAAQ,mBAAgB;AAC5C,SAASC,uBAAuB,QAAQ,gCAA6B;AAuCrE,OAAO,MAAMC,eAAe,CAAwB;EAClD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACUC,OAAO,GAAG,IAAIC,GAAG,CAAmB,CAAC;EAK7CC,WAAWA,CACQC,MAAc,EAC/BC,YAA2C,EAC1BC,wBAAgC,EAChCC,SAAoC,EACpCC,WAAyB,EAC1C;IAAA,KALiBJ,MAAc,GAAdA,MAAc;IAAA,KAEdE,wBAAgC,GAAhCA,wBAAgC;IAAA,KAChCC,SAAoC,GAApCA,SAAoC;IAAA,KACpCC,WAAyB,GAAzBA,WAAyB;IAE1C,IAAI,CAACC,WAAW,GAAG,IAAIX,WAAW,CAACO,YAAY,CAAC;IAChD,IAAI,CAACK,gBAAgB,GAAG,IAAIX,uBAAuB,CAAC;MAClDY,eAAe,EAAEJ,SAAS,CAACI,eAAe;MAC1CC,aAAa,EAAEL,SAAS,CAACK,aAAa;MACtCC,gBAAgB,EAAEN,SAAS,CAACM,gBAAgB;MAC5CC,QAAQ,EAAEP,SAAS,CAACO;IACtB,CAAC,CAAC;EACJ;EAEQC,WAAW,GAAW,EAAE;EAEzBC,OAAO,GAAGA,CAAA,KAAM;IACrB,IAAI,CAACf,OAAO,CAACgB,KAAK,CAAC,CAAC;IACpB,IAAI,CAACF,WAAW,GAAG,EAAE;IACrB,IAAI,CAACL,gBAAgB,CAACQ,KAAK,CAAC,CAAC;IAC7BC,YAAY,CAAC,IAAI,CAACC,gBAAgB,CAAC;IACnC,IAAI,CAACA,gBAAgB,GAAGC,SAAS;IACjCF,YAAY,CAAC,IA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AU,CAAC,MAAM;MACvC,IAAI,CAACjE,SAAS,CAAC6D,OAAO,GACpB,IAAIC,KAAK,CAAC,2CAA2C,EAAE;QACrDC,KAAK,EAAE;UACLC,OAAO,EAAE;QACX;MACF,CAAC,CACH,CAAC;MACD,IAAI,CAACnE,MAAM,CAACqE,gBAAgB,GAAG,CAAC;IAClC,CAAC,EAAE,IAAI,CAACnE,wBAAwB,CAAC;EACnC,CAAC;EAEO+B,mBAAmB,GAAGA,CAAA,KAAM;IAClC,MAAMqC,QAAQ,GAAG,IAAI,CAACnE,SAAS,CAACoE,gBAAgB,GAAG,CAAC;IAEpD,IAAI,CAACD,QAAQ,IAAIA,QAAQ,IAAI,CAAC,EAAE;MAC9B;IACF;IAEAvD,YAAY,CAAC,IAAI,CAACG,cAAc,CAAC;IACjC,IAAI,CAACA,cAAc,GAAGkD,UAAU,CAAC,MAAM;MACrC,IAAI,CAAClD,cAAc,GAAGD,SAAS;MAE/B,MAAMmB,MAAM,GAAG,IAAI,CAACjC,SAAS,CAACqE,gBAAgB,GAAG,CAAC;MAElD,IAAIpC,MAAM,EAAEgB,QAAQ,IAAIhB,MAAM,CAACgB,QAAQ,CAACjB,MAAM,GAAG,CAAC,EAAE;QAClD,IAAI,CAAChC,SAAS,CAACmD,YAAY,GAAGlB,MAAM,CAACgB,QAAQ,CAAC;QAC9C,IAAI,CAACnB,mBAAmB,CAAC,CAAC;QAE1B;MACF;MAEA,IAAIG,MAAM,EAAEqC,QAAQ,EAAE;QACpB,IAAI,CAACtE,SAAS,CAAC6D,OAAO,GACpB,IAAIC,KAAK,CAAC,+CAA+C,CAC3D,CAAC;QACD,KAAK,IAAI,CAACjE,MAAM,CAACqE,gBAAgB,GAAG,CAAC;MACvC;IACF,CAAC,EAAEC,QAAQ,CAAC;EACd,CAAC;AACH","ignoreList":[]}
|
|
@@ -71,6 +71,8 @@ export class BTManagedDevice {
|
|
|
71
71
|
* neither parses nothing, so an unknown buffer is never decoded on trust.
|
|
72
72
|
*/
|
|
73
73
|
|
|
74
|
+
/** Flushes protocol-level session state before a connection is torn down. */
|
|
75
|
+
handleMeasurementEnd() {}
|
|
74
76
|
constructor(device, {
|
|
75
77
|
deviceName,
|
|
76
78
|
onError: onErrorCallback,
|
|
@@ -209,6 +211,7 @@ export class BTManagedDevice {
|
|
|
209
211
|
this.onConnectionEvent = onConnectionEventCallback;
|
|
210
212
|
}
|
|
211
213
|
destroy = () => {
|
|
214
|
+
this.handleMeasurementEnd();
|
|
212
215
|
sentryLogger("info", "BT_MANAGER: Destroying device", {
|
|
213
216
|
deviceData: this.deviceData,
|
|
214
217
|
deviceName: this.deviceData.name
|
|
@@ -298,6 +301,7 @@ export class BTManagedDevice {
|
|
|
298
301
|
this.dataProcessor = new BTDataProcessor(this.device, this.mainServices, this.stuckDataTimeout, {
|
|
299
302
|
onStatusChanged: this.onDeviceStatusChanged?.bind(this),
|
|
300
303
|
onStreamStart: this.onStreamStart?.bind(this),
|
|
304
|
+
onMeasurementEnd: this.handleMeasurementEnd.bind(this),
|
|
301
305
|
validatePackage: this.validatePackage?.bind(this) ?? (() => false),
|
|
302
306
|
onResult: (parsedData, collectedValues) => {
|
|
303
307
|
try {
|