@ovok/native 1.6.46 → 1.6.48
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/baby-sleep-clip-catalog-asset.js +10 -0
- package/lib/commonjs/modules/bt-device/constants/baby-sleep-clip-catalog-asset.js.map +1 -0
- package/lib/commonjs/modules/bt-device/constants/device-instruction-pdfs.js +14 -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 +5 -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 +19 -0
- 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 +50 -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 +1 -1
- package/lib/commonjs/modules/bt-management/constants/integrated-devices-map.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/background-sync/background-service-uuids.js +2 -0
- package/lib/commonjs/modules/bt-management/services/background-sync/background-service-uuids.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/device-classes.js +95 -0
- package/lib/commonjs/modules/bt-management/services/device-classes.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/device-creator.js +5 -78
- package/lib/commonjs/modules/bt-management/services/device-creator.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js +6 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/viatom/baby-sleep-clip.device.js +57 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/baby-sleep-clip.device.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/baby-sleep-clip.protocol.js +106 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/baby-sleep-clip.protocol.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/baby-sleep-clip.sequencer.js +80 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/baby-sleep-clip.sequencer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/lpm311.device.js +55 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/lpm311.device.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/lpm311.protocol.js +103 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/lpm311.protocol.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/lpm311.sequencer.js +33 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/lpm311.sequencer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/oxy-s3.device.js +72 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/oxy-s3.device.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/oxy-s3.protocol.js +103 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/oxy-s3.protocol.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/oxy-s3.sequencer.js +110 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/oxy-s3.sequencer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/pf10aw1.device.js +53 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/pf10aw1.device.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/pf10aw1.protocol.js +64 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/pf10aw1.protocol.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/pf10aw1.sequencer.js +96 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/pf10aw1.sequencer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/sp20.device.js +54 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/sp20.device.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/sp20.protocol.js +102 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/sp20.protocol.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/sp20.sequencer.js +115 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/sp20.sequencer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom-lepu-crypto.js +81 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom-lepu-crypto.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom-r20.device.js +57 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom-r20.device.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom-r20.protocol.js +118 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom-r20.protocol.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom-r20.sequencer.js +95 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom-r20.sequencer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.pm10.device.js +48 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.pm10.device.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.pm10.protocol.js +104 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.pm10.protocol.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.pm10.sequencer.js +57 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.pm10.sequencer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.wbp02.device.js +50 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.wbp02.device.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.wbp02.protocol.js +108 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.wbp02.protocol.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.wbp02.sequencer.js +64 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.wbp02.sequencer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/types/clock-sync.js +3 -0
- package/lib/commonjs/modules/bt-management/types/clock-sync.js.map +1 -1
- package/lib/commonjs/modules/bt-management/types/device-measurement-map.js.map +1 -1
- package/lib/commonjs/modules/bt-management/types/integrated-devices.js +13 -0
- package/lib/commonjs/modules/bt-management/types/integrated-devices.js.map +1 -1
- package/lib/module/modules/bt-device/constants/baby-sleep-clip-catalog-asset.js +7 -0
- package/lib/module/modules/bt-device/constants/baby-sleep-clip-catalog-asset.js.map +1 -0
- package/lib/module/modules/bt-device/constants/device-instruction-pdfs.js +14 -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 +5 -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 +20 -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 +50 -0
- package/lib/module/modules/bt-device/constants/supported-devices.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/services/background-sync/background-service-uuids.js +2 -0
- package/lib/module/modules/bt-management/services/background-sync/background-service-uuids.js.map +1 -1
- package/lib/module/modules/bt-management/services/device-classes.js +92 -0
- package/lib/module/modules/bt-management/services/device-classes.js.map +1 -0
- package/lib/module/modules/bt-management/services/device-creator.js +3 -77
- package/lib/module/modules/bt-management/services/device-creator.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-managed-device.js +6 -1
- package/lib/module/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/viatom/baby-sleep-clip.device.js +52 -0
- package/lib/module/modules/bt-management/services/devices/viatom/baby-sleep-clip.device.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/baby-sleep-clip.protocol.js +99 -0
- package/lib/module/modules/bt-management/services/devices/viatom/baby-sleep-clip.protocol.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/baby-sleep-clip.sequencer.js +75 -0
- package/lib/module/modules/bt-management/services/devices/viatom/baby-sleep-clip.sequencer.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/lpm311.device.js +50 -0
- package/lib/module/modules/bt-management/services/devices/viatom/lpm311.device.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/lpm311.protocol.js +98 -0
- package/lib/module/modules/bt-management/services/devices/viatom/lpm311.protocol.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/lpm311.sequencer.js +28 -0
- package/lib/module/modules/bt-management/services/devices/viatom/lpm311.sequencer.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/oxy-s3.device.js +67 -0
- package/lib/module/modules/bt-management/services/devices/viatom/oxy-s3.device.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/oxy-s3.protocol.js +94 -0
- package/lib/module/modules/bt-management/services/devices/viatom/oxy-s3.protocol.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/oxy-s3.sequencer.js +105 -0
- package/lib/module/modules/bt-management/services/devices/viatom/oxy-s3.sequencer.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/pf10aw1.device.js +48 -0
- package/lib/module/modules/bt-management/services/devices/viatom/pf10aw1.device.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/pf10aw1.protocol.js +57 -0
- package/lib/module/modules/bt-management/services/devices/viatom/pf10aw1.protocol.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/pf10aw1.sequencer.js +91 -0
- package/lib/module/modules/bt-management/services/devices/viatom/pf10aw1.sequencer.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/sp20.device.js +49 -0
- package/lib/module/modules/bt-management/services/devices/viatom/sp20.device.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/sp20.protocol.js +94 -0
- package/lib/module/modules/bt-management/services/devices/viatom/sp20.protocol.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/sp20.sequencer.js +110 -0
- package/lib/module/modules/bt-management/services/devices/viatom/sp20.sequencer.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom-lepu-crypto.js +71 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom-lepu-crypto.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom-r20.device.js +52 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom-r20.device.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom-r20.protocol.js +110 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom-r20.protocol.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom-r20.sequencer.js +90 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom-r20.sequencer.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.pm10.device.js +43 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.pm10.device.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.pm10.protocol.js +92 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.pm10.protocol.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.pm10.sequencer.js +52 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.pm10.sequencer.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.wbp02.device.js +45 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.wbp02.device.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.wbp02.protocol.js +94 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.wbp02.protocol.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.wbp02.sequencer.js +59 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.wbp02.sequencer.js.map +1 -0
- package/lib/module/modules/bt-management/types/clock-sync.js +3 -0
- package/lib/module/modules/bt-management/types/clock-sync.js.map +1 -1
- package/lib/module/modules/bt-management/types/device-measurement-map.js.map +1 -1
- package/lib/module/modules/bt-management/types/integrated-devices.js +13 -0
- package/lib/module/modules/bt-management/types/integrated-devices.js.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-device/constants/baby-sleep-clip-catalog-asset.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/bt-device/constants/baby-sleep-clip-catalog-asset.d.ts.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-device/constants/supported-device-catalog-assets.d.ts +5 -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 +1 -1
- 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/services/background-sync/background-service-uuids.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/device-classes.d.ts +89 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/device-classes.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/device-creator.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-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/viatom/baby-sleep-clip.device.d.ts +18 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/baby-sleep-clip.device.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/baby-sleep-clip.protocol.d.ts +27 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/baby-sleep-clip.protocol.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/baby-sleep-clip.sequencer.d.ts +32 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/baby-sleep-clip.sequencer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/lpm311.device.d.ts +9 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/lpm311.device.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/lpm311.protocol.d.ts +14 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/lpm311.protocol.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/lpm311.sequencer.d.ts +10 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/lpm311.sequencer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/oxy-s3.device.d.ts +18 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/oxy-s3.device.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/oxy-s3.protocol.d.ts +42 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/oxy-s3.protocol.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/oxy-s3.sequencer.d.ts +31 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/oxy-s3.sequencer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/pf10aw1.device.d.ts +19 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/pf10aw1.device.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/pf10aw1.protocol.d.ts +30 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/pf10aw1.protocol.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/pf10aw1.sequencer.d.ts +27 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/pf10aw1.sequencer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/sp20.device.d.ts +20 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/sp20.device.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/sp20.protocol.d.ts +28 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/sp20.protocol.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/sp20.sequencer.d.ts +26 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/sp20.sequencer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom-lepu-crypto.d.ts +7 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom-lepu-crypto.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom-r20.device.d.ts +20 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom-r20.device.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom-r20.protocol.d.ts +38 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom-r20.protocol.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom-r20.sequencer.d.ts +35 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom-r20.sequencer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.pm10.device.d.ts +15 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.pm10.device.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.pm10.protocol.d.ts +25 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.pm10.protocol.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.pm10.sequencer.d.ts +21 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.pm10.sequencer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.wbp02.device.d.ts +14 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.wbp02.device.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.wbp02.protocol.d.ts +31 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.wbp02.protocol.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.wbp02.sequencer.d.ts +20 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.wbp02.sequencer.d.ts.map +1 -0
- 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/device-measurement-map.d.ts +14 -1
- 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 +14 -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/baby-sleep-clip-catalog-asset.d.ts +4 -0
- package/lib/typescript/module/src/modules/bt-device/constants/baby-sleep-clip-catalog-asset.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-device/constants/supported-device-catalog-assets.d.ts +5 -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 +1 -1
- 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/services/background-sync/background-service-uuids.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/device-classes.d.ts +89 -0
- package/lib/typescript/module/src/modules/bt-management/services/device-classes.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/device-creator.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-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/viatom/baby-sleep-clip.device.d.ts +18 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/baby-sleep-clip.device.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/baby-sleep-clip.protocol.d.ts +27 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/baby-sleep-clip.protocol.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/baby-sleep-clip.sequencer.d.ts +32 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/baby-sleep-clip.sequencer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/lpm311.device.d.ts +9 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/lpm311.device.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/lpm311.protocol.d.ts +14 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/lpm311.protocol.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/lpm311.sequencer.d.ts +10 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/lpm311.sequencer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/oxy-s3.device.d.ts +18 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/oxy-s3.device.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/oxy-s3.protocol.d.ts +42 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/oxy-s3.protocol.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/oxy-s3.sequencer.d.ts +31 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/oxy-s3.sequencer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/pf10aw1.device.d.ts +19 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/pf10aw1.device.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/pf10aw1.protocol.d.ts +30 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/pf10aw1.protocol.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/pf10aw1.sequencer.d.ts +27 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/pf10aw1.sequencer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/sp20.device.d.ts +20 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/sp20.device.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/sp20.protocol.d.ts +28 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/sp20.protocol.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/sp20.sequencer.d.ts +26 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/sp20.sequencer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom-lepu-crypto.d.ts +7 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom-lepu-crypto.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom-r20.device.d.ts +20 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom-r20.device.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom-r20.protocol.d.ts +38 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom-r20.protocol.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom-r20.sequencer.d.ts +35 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom-r20.sequencer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.pm10.device.d.ts +15 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.pm10.device.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.pm10.protocol.d.ts +25 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.pm10.protocol.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.pm10.sequencer.d.ts +21 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.pm10.sequencer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.wbp02.device.d.ts +14 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.wbp02.device.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.wbp02.protocol.d.ts +31 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.wbp02.protocol.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.wbp02.sequencer.d.ts +20 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.wbp02.sequencer.d.ts.map +1 -0
- 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/device-measurement-map.d.ts +14 -1
- 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 +14 -1
- package/lib/typescript/module/src/modules/bt-management/types/integrated-devices.d.ts.map +1 -1
- package/package.json +6 -4
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { defineCustomDevice } from "../../custom/define-custom-device.js";
|
|
4
|
+
import { CustomDevice } from "../custom/custom.device.js";
|
|
5
|
+
import { decodeLpm311Record, Lpm311FrameReader, LPM311_RECORD_BYTES } from "./lpm311.protocol.js";
|
|
6
|
+
import { Lpm311Sequencer } from "./lpm311.sequencer.js";
|
|
7
|
+
const SERVICE = "0000ffe0-0000-1000-8000-00805f9b34fb";
|
|
8
|
+
const CHARACTERISTIC = "0000ffe1-0000-1000-8000-00805f9b34fb";
|
|
9
|
+
const definition = defineCustomDevice({
|
|
10
|
+
id: "viatom-lpm311",
|
|
11
|
+
nameMatch: /^LPM311(?: |$)/i,
|
|
12
|
+
oneReadingPerConnection: true,
|
|
13
|
+
stuckDataTimeoutMs: 30_000,
|
|
14
|
+
services: [{
|
|
15
|
+
uuid: SERVICE,
|
|
16
|
+
monitor: [{
|
|
17
|
+
uuid: CHARACTERISTIC,
|
|
18
|
+
frame: {
|
|
19
|
+
minLengthBytes: LPM311_RECORD_BYTES
|
|
20
|
+
},
|
|
21
|
+
cases: [{
|
|
22
|
+
selector: "",
|
|
23
|
+
kind: "event",
|
|
24
|
+
minLengthBytes: LPM311_RECORD_BYTES,
|
|
25
|
+
description: "LPM311 lipid panel record"
|
|
26
|
+
}]
|
|
27
|
+
}]
|
|
28
|
+
}]
|
|
29
|
+
}, {
|
|
30
|
+
frameReader: new Lpm311FrameReader(),
|
|
31
|
+
createFrameHandler: () => ({
|
|
32
|
+
frame,
|
|
33
|
+
emit
|
|
34
|
+
}) => {
|
|
35
|
+
const result = decodeLpm311Record(frame);
|
|
36
|
+
if (result) {
|
|
37
|
+
emit(result);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
/** Built-in LPM311 transport because its request/reply messages are device-specific. */
|
|
43
|
+
export class Lpm311Device extends CustomDevice {
|
|
44
|
+
constructor(device, params) {
|
|
45
|
+
super(device, params, definition);
|
|
46
|
+
this.frameReader = new Lpm311FrameReader();
|
|
47
|
+
this.createCommandSequencer = () => new Lpm311Sequencer();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=lpm311.device.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["defineCustomDevice","CustomDevice","decodeLpm311Record","Lpm311FrameReader","LPM311_RECORD_BYTES","Lpm311Sequencer","SERVICE","CHARACTERISTIC","definition","id","nameMatch","oneReadingPerConnection","stuckDataTimeoutMs","services","uuid","monitor","frame","minLengthBytes","cases","selector","kind","description","frameReader","createFrameHandler","emit","result","Lpm311Device","constructor","device","params","createCommandSequencer"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/lpm311.device.ts"],"mappings":";;AAMA,SAASA,kBAAkB,QAAQ,sCAAmC;AACtE,SAASC,YAAY,QAAQ,4BAAyB;AAEtD,SACEC,kBAAkB,EAClBC,iBAAiB,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|
|
3
|
+
import { MeasurementTypeKey } from "@ovok/core";
|
|
4
|
+
import { FrameReadStatus } from "../../../types/frame-read-status.js";
|
|
5
|
+
import { hexToByte } from "../../../utils/hex-to-byte.js";
|
|
6
|
+
const LPM311_RECORD_BYTES = 44;
|
|
7
|
+
const LPM311_MEASUREMENT_TYPE = MeasurementTypeKey.lipidPanel;
|
|
8
|
+
const ascii = bytes => bytes.map(byte => String.fromCharCode(hexToByte(byte))).join("");
|
|
9
|
+
const lipidValue = (bytes, scale) => {
|
|
10
|
+
const encoded = ascii(bytes);
|
|
11
|
+
if (/^f/i.test(encoded)) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
if (!/^[\da-f]{8}$/i.test(encoded)) {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
const value = Number.parseInt(encoded, 16) / scale;
|
|
18
|
+
return Number.isFinite(value) ? value : undefined;
|
|
19
|
+
};
|
|
20
|
+
const recordedAt = bytes => {
|
|
21
|
+
const value = ascii(bytes);
|
|
22
|
+
if (!/^\d{14}$/.test(value)) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
const year = Number(value.slice(0, 4));
|
|
26
|
+
const month = Number(value.slice(4, 6));
|
|
27
|
+
const day = Number(value.slice(6, 8));
|
|
28
|
+
const hour = Number(value.slice(8, 10));
|
|
29
|
+
const minute = Number(value.slice(10, 12));
|
|
30
|
+
const second = Number(value.slice(12, 14));
|
|
31
|
+
const date = new Date(0);
|
|
32
|
+
date.setFullYear(year, month - 1, day);
|
|
33
|
+
date.setHours(hour, minute, second, 0);
|
|
34
|
+
return date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day && date.getHours() === hour && date.getMinutes() === minute && date.getSeconds() === second ? date : undefined;
|
|
35
|
+
};
|
|
36
|
+
const ratioWithinReferenceRange = (unit, total, hdl) => unit === "mmol/L" ? total >= 2.59 && total <= 12.93 && hdl >= 0.39 && hdl <= 2.59 : total >= 100 && total <= 500 && hdl >= 15 && hdl <= 100;
|
|
37
|
+
|
|
38
|
+
/** Decodes one 44-byte ASCII record emitted by the ViHealth LPM311 interface. */
|
|
39
|
+
const decodeLpm311Record = frame => {
|
|
40
|
+
if (frame.length !== LPM311_RECORD_BYTES) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
const unitCode = ascii(frame.slice(40, 41));
|
|
44
|
+
if (unitCode !== "0" && unitCode !== "1") {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
const unit = unitCode === "0" ? "mmol/L" : "mg/dL";
|
|
48
|
+
const scale = unit === "mmol/L" ? 100 : 1;
|
|
49
|
+
const totalCholesterol = lipidValue(frame.slice(15, 23), scale);
|
|
50
|
+
const hdlCholesterol = lipidValue(frame.slice(23, 31), scale);
|
|
51
|
+
const triglycerides = lipidValue(frame.slice(31, 39), scale);
|
|
52
|
+
const complete = totalCholesterol !== undefined && hdlCholesterol !== undefined && triglycerides !== undefined && totalCholesterol > 0 && hdlCholesterol > 0 && triglycerides > 0;
|
|
53
|
+
const recorded = recordedAt(frame.slice(0, 14));
|
|
54
|
+
const result = {
|
|
55
|
+
measurementTypeKey: LPM311_MEASUREMENT_TYPE,
|
|
56
|
+
unit,
|
|
57
|
+
...(totalCholesterol === undefined ? {} : {
|
|
58
|
+
totalCholesterol
|
|
59
|
+
}),
|
|
60
|
+
...(hdlCholesterol === undefined ? {} : {
|
|
61
|
+
hdlCholesterol
|
|
62
|
+
}),
|
|
63
|
+
...(triglycerides === undefined ? {} : {
|
|
64
|
+
triglycerides
|
|
65
|
+
}),
|
|
66
|
+
...(recorded ? {
|
|
67
|
+
recordedAt: recorded
|
|
68
|
+
} : {})
|
|
69
|
+
};
|
|
70
|
+
if (complete) {
|
|
71
|
+
const conversion = unit === "mmol/L" ? 2.2 : 5;
|
|
72
|
+
const ldlCholesterol = totalCholesterol - hdlCholesterol - triglycerides / conversion;
|
|
73
|
+
result.ldlCholesterol = ldlCholesterol;
|
|
74
|
+
if (ratioWithinReferenceRange(unit, totalCholesterol, hdlCholesterol)) {
|
|
75
|
+
result.totalCholesterolHdlRatio = totalCholesterol / hdlCholesterol;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return result;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/** Reads fixed-width records; a notification may contain a fragment or several records. */
|
|
82
|
+
class Lpm311FrameReader {
|
|
83
|
+
readFrame(buffer) {
|
|
84
|
+
if (buffer.length < LPM311_RECORD_BYTES) {
|
|
85
|
+
return {
|
|
86
|
+
status: FrameReadStatus.INCOMPLETE,
|
|
87
|
+
consumedBytes: 0
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
status: FrameReadStatus.COMPLETE,
|
|
92
|
+
consumedBytes: LPM311_RECORD_BYTES,
|
|
93
|
+
frame: buffer.slice(0, LPM311_RECORD_BYTES)
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
export { decodeLpm311Record, Lpm311FrameReader, LPM311_MEASUREMENT_TYPE, LPM311_RECORD_BYTES };
|
|
98
|
+
//# sourceMappingURL=lpm311.protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","FrameReadStatus","hexToByte","LPM311_RECORD_BYTES","LPM311_MEASUREMENT_TYPE","lipidPanel","ascii","bytes","map","byte","String","fromCharCode","join","lipidValue","scale","encoded","test","undefined","value","Number","parseInt","isFinite","recordedAt","year","slice","month","day","hour","minute","second","date","Date","setFullYear","setHours","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","ratioWithinReferenceRange","unit","total","hdl","decodeLpm311Record","frame","length","unitCode","totalCholesterol","hdlCholesterol","triglycerides","complete","recorded","result","measurementTypeKey","conversion","ldlCholesterol","totalCholesterolHdlRatio","Lpm311FrameReader","readFrame","buffer","status","INCOMPLETE","consumedBytes","COMPLETE"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management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m311Record } from "./lpm311.protocol.js";
|
|
4
|
+
const SERVICE = "0000ffe0-0000-1000-8000-00805f9b34fb";
|
|
5
|
+
const CHARACTERISTIC = "0000ffe1-0000-1000-8000-00805f9b34fb";
|
|
6
|
+
const command = (text, delayBeforeWriteMs) => ({
|
|
7
|
+
serviceUuid: SERVICE,
|
|
8
|
+
characteristicUuid: CHARACTERISTIC,
|
|
9
|
+
frame: [...text].map(character => character.charCodeAt(0).toString(16).padStart(2, "0")),
|
|
10
|
+
...(delayBeforeWriteMs === undefined ? {} : {
|
|
11
|
+
delayBeforeWriteMs
|
|
12
|
+
})
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
/** Starts the LPM311 ASCII transfer and acknowledges its result by ending the session. */
|
|
16
|
+
export class Lpm311Sequencer {
|
|
17
|
+
finished = false;
|
|
18
|
+
initialCommands = () => [command("connect", 1_000)];
|
|
19
|
+
nextCommand = frame => {
|
|
20
|
+
if (!decodeLpm311Record(frame)) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
this.finished = true;
|
|
24
|
+
return [command("disconnect")];
|
|
25
|
+
};
|
|
26
|
+
isNormalDisconnect = () => this.finished;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=lpm311.sequencer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["decodeLpm311Record","SERVICE","CHARACTERISTIC","command","text","delayBeforeWriteMs","serviceUuid","characteristicUuid","frame","map","character","charCodeAt","toString","padStart","undefined","Lpm311Sequencer","finished","initialCommands","nextCommand","isNormalDisconnect"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/lpm311.sequencer.ts"],"mappings":";;AAGA,SAASA,kBAAkB,QAAQ,sBAAmB;AAEtD,MAAMC,OAAO,GAAG,sCAAsC;AACtD,MAAMC,cAAc,GAAG,sCAAsC;AAE7D,MAAMC,OAAO,GAAGA,CAACC,IAAY,EAAEC,kBAA2B,MAAqB;EAC7EC,WAAW,EAAEL,OAAO;EACpBM,kBAAkB,EAAEL,cAAc;EAClCM,KAAK,EAAE,CAAC,GAAGJ,IAAI,CAAC,CAACK,GAAG,CAAEC,SAAS,IAC7BA,SAAS,CAACC,UAAU,CAAC,CAAC,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CACtD,CAAC;EACD,IAAIR,kBAAkB,KAAKS,SAAS,GAAG,CAAC,CAAC,GAAG;IAAET;EAAmB,CAAC;AACpE,CAAC,CAAC;;AAEF;AACA,OAAO,MAAMU,eAAe,CAA6B;EAC/CC,QAAQ,GAAG,KAAK;EAEjBC,eAAe,GAAGA,CAAA,KAAgC,CACvDd,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAC1B;EAEMe,WAAW,GAChBV,KAAwB,IACiB;IACzC,IAAI,CAACR,kBAAkB,CAACQ,KAAK,CAAC,EAAE;MAC9B,OAAOM,SAAS;IAClB;IAEA,IAAI,CAACE,QAAQ,GAAG,IAAI;IAEpB,OAAO,CAACb,OAAO,CAAC,YAAY,CAAC,CAAC;EAChC,CAAC;EAEMgB,kBAAkB,GAAGA,CAAA,KAAe,IAAI,CAACH,QAAQ;AAC1D","ignoreList":[]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable import/group-exports */
|
|
4
|
+
|
|
5
|
+
import { MeasurementTypeKey } from "@ovok/core";
|
|
6
|
+
import { BTManagedDevice } from "../bt-managed-device.js";
|
|
7
|
+
import { OXY_S3_V1_NOTIFY, OXY_S3_V1_SERVICE, OXY_S3_V1_WRITE, OXY_S3_V2_NOTIFY, OXY_S3_V2_SERVICE, OXY_S3_V2_WRITE, OxyS3FrameReader, parseOxyS3Advertisement } from "./oxy-s3.protocol.js";
|
|
8
|
+
import { OxyS3Sequencer } from "./oxy-s3.sequencer.js";
|
|
9
|
+
const acceptNothing = {
|
|
10
|
+
caseValuePosition: [],
|
|
11
|
+
cases: []
|
|
12
|
+
};
|
|
13
|
+
export const oxyS3MainServices = [{
|
|
14
|
+
uuid: OXY_S3_V1_SERVICE,
|
|
15
|
+
monitorUuids: [{
|
|
16
|
+
uuid: OXY_S3_V1_NOTIFY,
|
|
17
|
+
parsingModel: acceptNothing
|
|
18
|
+
}],
|
|
19
|
+
writeUuid: {
|
|
20
|
+
uuid: OXY_S3_V1_WRITE,
|
|
21
|
+
mainCommandUuid: "55"
|
|
22
|
+
}
|
|
23
|
+
}, {
|
|
24
|
+
uuid: OXY_S3_V2_SERVICE,
|
|
25
|
+
monitorUuids: [{
|
|
26
|
+
uuid: OXY_S3_V2_NOTIFY,
|
|
27
|
+
parsingModel: acceptNothing
|
|
28
|
+
}],
|
|
29
|
+
writeUuid: {
|
|
30
|
+
uuid: OXY_S3_V2_WRITE,
|
|
31
|
+
mainCommandUuid: "a5"
|
|
32
|
+
}
|
|
33
|
+
}];
|
|
34
|
+
|
|
35
|
+
/** ViHealth BBSM S3 uses both its legacy Oxy and OxyII GATT services. */
|
|
36
|
+
export class OxyS3Device extends BTManagedDevice {
|
|
37
|
+
mainServices = oxyS3MainServices;
|
|
38
|
+
stuckDataTimeout = 60_000;
|
|
39
|
+
onStreamStart = undefined;
|
|
40
|
+
preferredMtu = 247;
|
|
41
|
+
getSupportedMeasurementTypeKeys() {
|
|
42
|
+
return [MeasurementTypeKey.bloodOxygenPulseRate];
|
|
43
|
+
}
|
|
44
|
+
constructor(device, params) {
|
|
45
|
+
super(device, params);
|
|
46
|
+
this.frameReader = new OxyS3FrameReader();
|
|
47
|
+
this.createCommandSequencer = () => {
|
|
48
|
+
const advertisement = parseOxyS3Advertisement(device.manufacturerData);
|
|
49
|
+
const protocol = advertisement.protocol;
|
|
50
|
+
const serviceUuid = protocol === "v2" ? OXY_S3_V2_SERVICE : OXY_S3_V1_SERVICE;
|
|
51
|
+
const characteristicUuid = protocol === "v2" ? OXY_S3_V2_WRITE : OXY_S3_V1_WRITE;
|
|
52
|
+
return new OxyS3Sequencer({
|
|
53
|
+
protocol,
|
|
54
|
+
encrypted: advertisement.encrypted,
|
|
55
|
+
write: {
|
|
56
|
+
serviceUuid,
|
|
57
|
+
characteristicUuid
|
|
58
|
+
},
|
|
59
|
+
onResult: result => this.onResult?.(result)
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
handleSuccessResult() {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=oxy-s3.device.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","BTManagedDevice","OXY_S3_V1_NOTIFY","OXY_S3_V1_SERVICE","OXY_S3_V1_WRITE","OXY_S3_V2_NOTIFY","OXY_S3_V2_SERVICE","OXY_S3_V2_WRITE","OxyS3FrameReader","parseOxyS3Advertisement","OxyS3Sequencer","acceptNothing","caseValuePosition","cases","oxyS3MainServices","uuid","monitorUuids","parsingModel","writeUuid","mainCommandUuid","OxyS3Device","mainServices","stuckDataTimeout","onStreamStart","undefined","preferredMtu","getSupportedMeasurementTypeKeys","bloodOxygenPulseRate","constructor","device","params","frameReader","createCommandSequencer","advertisement","manufacturerData","protocol","serviceUuid","characteristicUuid","encrypted","write","onResult","result","handleSuccessResult"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/oxy-s3.device.ts"],"mappings":";;AAAA;;AAEA,SAASA,kBAAkB,QAAQ,YAAY;AAQ/C,SAASC,eAAe,QAAQ,yBAAsB;AAEtD,SACEC,gBAAgB,EAChBC,iBAAiB,EACjBC,eAAe,EACfC,gBAAgB,EAChBC,iBAAiB,EACjBC,eAAe,EACfC,gBAAgB,EAChBC,uBAAuB,QAClB,sBAAmB;AAC1B,SAASC,cAAc,QAAQ,uBAAoB;AAEnD,MAAMC,aAAa,GAAG;EAAEC,iBAAiB,EAAE,EAAE;EAAEC,KAAK,EAAE;AAAG,CAAC;AAE1D,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,CAACK,SAAS;QAClCC,KAAK,EAAE;UAAEH,WAAW;UAAEC;QAAmB,CAAC;QAC1CG,QAAQ,EAAGC,MAAM,IACf,IAAI,CAACD,QAAQ,GACXC,MAGF;MACJ,CAAC,CAAC;IACJ,CAAC;EACH;EAEUC,mBAAmBA,CAAA,EAAS;IACpC;EACF;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable import/group-exports */
|
|
4
|
+
|
|
5
|
+
import { calculateCrc8 } from "../../../utils/calculate-crc-8.js";
|
|
6
|
+
import { hexToByte } from "../../../utils/hex-to-byte.js";
|
|
7
|
+
import { le16FromHex } from "../../../utils/le-16-from-hex.js";
|
|
8
|
+
import { manufacturerBytes } from "../lepu/lepu.advertisement.js";
|
|
9
|
+
import { LepuFrameReader } from "../lepu/lepu.frame-reader.js";
|
|
10
|
+
export const OXY_S3_V1_SERVICE = "14839ac4-7d7e-415c-9a42-167340cf2339";
|
|
11
|
+
export const OXY_S3_V1_WRITE = "8b00ace7-eb0b-49b0-bbe9-9aee0a26e1a3";
|
|
12
|
+
export const OXY_S3_V1_NOTIFY = "0734594a-a8e7-4b1a-a6b1-cd5243059a57";
|
|
13
|
+
export const OXY_S3_V2_SERVICE = "e8fb0001-a14b-98f9-831b-4e2941d01248";
|
|
14
|
+
export const OXY_S3_V2_WRITE = "e8fb0002-a14b-98f9-831b-4e2941d01248";
|
|
15
|
+
export const OXY_S3_V2_NOTIFY = "e8fb0003-a14b-98f9-831b-4e2941d01248";
|
|
16
|
+
export const OxyS3Command = {
|
|
17
|
+
authenticate: 0xff,
|
|
18
|
+
syncTime: 0xc0,
|
|
19
|
+
enableRealtimeParameters: 0x10,
|
|
20
|
+
realtimeParameters: 0x11,
|
|
21
|
+
legacySyncTime: 0x16,
|
|
22
|
+
legacyRealtimeParameters: 0x17
|
|
23
|
+
};
|
|
24
|
+
const byte = value => (value & 0xff).toString(16).padStart(2, "0");
|
|
25
|
+
|
|
26
|
+
/** The app selects V2 from manufacturer byte 4, otherwise it uses byte 3. */
|
|
27
|
+
export const parseOxyS3Advertisement = manufacturerData => {
|
|
28
|
+
const bytes = manufacturerBytes(manufacturerData ?? undefined);
|
|
29
|
+
const v2 = ((bytes[4] ?? 0) & 0x0f) === 2;
|
|
30
|
+
const protocolByte = v2 ? bytes[4] ?? 0 : bytes[3] ?? 0;
|
|
31
|
+
const encryptionLevel = (protocolByte & 0xf0) >> 4;
|
|
32
|
+
return {
|
|
33
|
+
protocol: v2 ? "v2" : "v1",
|
|
34
|
+
encrypted: encryptionLevel === 1 || encryptionLevel === 2
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** Oxy S3 notifications use the shared Lepu 55 (V1) or A5 (V2) frame. */
|
|
39
|
+
export class OxyS3FrameReader {
|
|
40
|
+
reader = new LepuFrameReader(["55", "a5"]);
|
|
41
|
+
readFrame = buffer => this.reader.readFrame(buffer);
|
|
42
|
+
}
|
|
43
|
+
export const decodeOxyS3Response = (frame, protocol) => {
|
|
44
|
+
const startByte = protocol === "v2" ? 0xa5 : 0x55;
|
|
45
|
+
if (frame.length < 8 || hexToByte(frame[0] ?? "00") !== startByte) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
const commandOrStatus = hexToByte(frame[1] ?? "00");
|
|
49
|
+
if (hexToByte(frame[2] ?? "00") !== (~commandOrStatus & 0xff)) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
const payloadLength = le16FromHex(frame, 5);
|
|
53
|
+
const checksumIndex = frame.length - 1;
|
|
54
|
+
if (frame.length !== payloadLength + 8 || hexToByte(frame[checksumIndex] ?? "00") !== calculateCrc8([...frame], checksumIndex)) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
return protocol === "v2" ? {
|
|
58
|
+
command: commandOrStatus,
|
|
59
|
+
status: hexToByte(frame[3] ?? "00"),
|
|
60
|
+
payload: frame.slice(7, checksumIndex).map(value => hexToByte(value))
|
|
61
|
+
} : {
|
|
62
|
+
// The legacy reply carries success in byte 1 and correlates by request order.
|
|
63
|
+
status: commandOrStatus === 0 ? 1 : 0,
|
|
64
|
+
payload: frame.slice(7, checksumIndex).map(value => hexToByte(value))
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/** Builds an Oxy V1 AA request; unlike the A5 family, its response does not echo opcodes. */
|
|
69
|
+
export const buildOxyS3LegacyFrame = (command, payload = []) => {
|
|
70
|
+
const frame = ["aa", byte(command), byte(~command), "00", "00", byte(payload.length), byte(payload.length >>> 8), ...payload.map(byte), "00"];
|
|
71
|
+
frame[frame.length - 1] = byte(calculateCrc8(frame, frame.length - 1));
|
|
72
|
+
return frame;
|
|
73
|
+
};
|
|
74
|
+
export const parseOxyS3Reading = (payload, protocol) => {
|
|
75
|
+
if (protocol === "v1") {
|
|
76
|
+
if (payload.length < 12) {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
bloodOxygen: payload[0] ?? 0,
|
|
81
|
+
pulseRate: (payload[1] ?? 0) | (payload[2] ?? 0) << 8,
|
|
82
|
+
perfusionIndex: payload[10] ?? 0
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
if (payload.length < 14) {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
bloodOxygen: payload[6] ?? 0,
|
|
90
|
+
perfusionIndex: (payload[7] ?? 0) / 10,
|
|
91
|
+
pulseRate: (payload[8] ?? 0) | (payload[9] ?? 0) << 8
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=oxy-s3.protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["calculateCrc8","hexToByte","le16FromHex","manufacturerBytes","LepuFrameReader","OXY_S3_V1_SERVICE","OXY_S3_V1_WRITE","OXY_S3_V1_NOTIFY","OXY_S3_V2_SERVICE","OXY_S3_V2_WRITE","OXY_S3_V2_NOTIFY","OxyS3Command","authenticate","syncTime","enableRealtimeParameters","realtimeParameters","legacySyncTime","legacyRealtimeParameters","byte","value","toString","padStart","parseOxyS3Advertisement","manufacturerData","bytes","undefined","v2","protocolByte","encryptionLevel","protocol","encrypted","OxyS3FrameReader","reader","readFrame","buffer","decodeOxyS3Response","frame","startByte","length","commandOrStatus","payloadLength","checksumIndex","command","status","payload","slice","map","buildOxyS3LegacyFrame","parseOxyS3Reading","bloodOxygen","pulseRate","perfusionIndex"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/oxy-s3.protocol.ts"],"mappings":";;AAAA;;AAGA,SAASA,aAAa,QAAQ,mCAAgC;AAC9D,SAASC,SAAS,QAAQ,+BAA4B;AACtD,SAASC,WAAW,QAAQ,kCAA+B;AAC3D,SAASC,iBAAiB,QAAQ,+BAA4B;AAC9D,SAASC,eAAe,QAAQ,8BAA2B;AAE3D,OAAO,MAAMC,iBAAiB,GAAG,sCAAsC;AACvE,OAAO,MAAMC,eAAe,GAAG,sCAAsC;AACrE,OAAO,MAAMC,gBAAgB,GAAG,sCAAsC;AACtE,OAAO,MAAMC,iBAAiB,GAAG,sCAAsC;AACvE,OAAO,MAAMC,eAAe,GAAG,sCAAsC;AACrE,OAAO,MAAMC,gBAAgB,GAAG,sCAAsC;AAEtE,OAAO,MAAMC,YAAY,GAAG;EAC1BC,YAAY,EAAE,IAAI;EAClBC,QAAQ,EAAE,IAAI;EACdC,wBAAwB,EAAE,IAAI;EAC9BC,kBAAkB,EAAE,IAAI;EACxBC,cAAc,EAAE,IAAI;EACpBC,wBAAwB,EAAE;AAC5B,CAAU;AAqBV,MAAMC,IAAI,GAAIC,KAAa,IACzB,CAACA,KAAK,GAAG,IAAI,EAAEC,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;;AAE9C;AACA,OAAO,MA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,IAAI,CAAC,EACpB,IAAI,CACL;EAEDkB,KAAK,CAACA,KAAK,CAACE,MAAM,GAAG,CAAC,CAAC,GAAGpB,IAAI,CAAClB,aAAa,CAACoC,KAAK,EAAEA,KAAK,CAACE,MAAM,GAAG,CAAC,CAAC,CAAC;EAEtE,OAAOF,KAAK;AACd,CAAC;AAED,OAAO,MAAMY,iBAAiB,GAAGA,CAC/BJ,OAA0B,EAC1Bf,QAAuB,KACM;EAC7B,IAAIA,QAAQ,KAAK,IAAI,EAAE;IACrB,IAAIe,OAAO,CAACN,MAAM,GAAG,EAAE,EAAE;MACvB,OAAOb,SAAS;IAClB;IAEA,OAAO;MACLwB,WAAW,EAAEL,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;MAC5BM,SAAS,EAAE,CAACN,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAK,CAACA,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAE;MACvDO,cAAc,EAAEP,OAAO,CAAC,EAAE,CAAC,IAAI;IACjC,CAAC;EACH;EAEA,IAAIA,OAAO,CAACN,MAAM,GAAG,EAAE,EAAE;IACvB,OAAOb,SAAS;EAClB;EAEA,OAAO;IACLwB,WAAW,EAAEL,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5BO,cAAc,EAAE,CAACP,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE;IACtCM,SAAS,EAAE,CAACN,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAK,CAACA,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK;EACvD,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { MeasurementTypeKey } from "@ovok/core";
|
|
4
|
+
import { CaseType } from "../../../types/case-type.js";
|
|
5
|
+
import { LepuCommandBuilder } from "../lepu/lepu.command-builder.js";
|
|
6
|
+
import { buildOxyS3LegacyFrame, decodeOxyS3Response, OxyS3Command, parseOxyS3Reading } from "./oxy-s3.protocol.js";
|
|
7
|
+
import { createLepuAccessToken, decryptLepuHandshake, decryptLepuPayload, encryptLepuPayload, parseLepuSessionKey } from "./viatom-lepu-crypto.js";
|
|
8
|
+
const toBytes = value => Array.from(value, character => character.charCodeAt(0));
|
|
9
|
+
const validOxygen = value => value >= 50 && value <= 100;
|
|
10
|
+
const validPulse = value => value > 0 && value <= 300;
|
|
11
|
+
|
|
12
|
+
/** Drives the two Oxy S3 transports documented by ViHealth: legacy Oxy and encrypted A5. */
|
|
13
|
+
export class OxyS3Sequencer {
|
|
14
|
+
commands = new LepuCommandBuilder("a5");
|
|
15
|
+
constructor(params) {
|
|
16
|
+
this.params = params;
|
|
17
|
+
this.phase = params.encrypted ? "authenticate" : "clock";
|
|
18
|
+
}
|
|
19
|
+
initialCommands = () => this.phase === "authenticate" ? [this.command(OxyS3Command.authenticate, createLepuAccessToken(this.now()))] : [this.timeCommand()];
|
|
20
|
+
nextCommand = frame => {
|
|
21
|
+
const response = decodeOxyS3Response(frame, this.params.protocol);
|
|
22
|
+
if (!response) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
if (this.phase === "authenticate") {
|
|
26
|
+
if (response.status !== 1 || this.params.protocol === "v2" && response.command !== OxyS3Command.authenticate) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
const sessionKey = parseLepuSessionKey(decryptLepuHandshake(response.payload));
|
|
30
|
+
if (!sessionKey) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
this.sessionKey = sessionKey;
|
|
34
|
+
this.phase = "clock";
|
|
35
|
+
return [this.timeCommand()];
|
|
36
|
+
}
|
|
37
|
+
if (this.phase === "clock") {
|
|
38
|
+
if (response.status !== 1 || this.params.protocol === "v2" && response.command !== OxyS3Command.syncTime) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
if (this.params.protocol === "v1") {
|
|
42
|
+
this.phase = "ready";
|
|
43
|
+
return [this.readLegacyParameters()];
|
|
44
|
+
}
|
|
45
|
+
this.phase = "stream";
|
|
46
|
+
return [this.command(OxyS3Command.enableRealtimeParameters, [1])];
|
|
47
|
+
}
|
|
48
|
+
if (this.phase === "stream") {
|
|
49
|
+
if (response.command !== OxyS3Command.enableRealtimeParameters || response.status !== 1) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
this.phase = "ready";
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
if (this.params.protocol === "v2" && response.command === OxyS3Command.realtimeParameters && response.status === 1) {
|
|
56
|
+
this.report(this.decrypt(response.payload));
|
|
57
|
+
} else if (this.params.protocol === "v1" && response.status === 1) {
|
|
58
|
+
this.report(this.decrypt(response.payload));
|
|
59
|
+
return [this.readLegacyParameters()];
|
|
60
|
+
}
|
|
61
|
+
return undefined;
|
|
62
|
+
};
|
|
63
|
+
command = (command, payload = []) => {
|
|
64
|
+
const encryptedPayload = this.sessionKey ? encryptLepuPayload(payload, this.sessionKey) : [...payload];
|
|
65
|
+
const frame = this.params.protocol === "v2" ? this.commands.build(command, encryptedPayload) : buildOxyS3LegacyFrame(command, encryptedPayload);
|
|
66
|
+
return {
|
|
67
|
+
...this.params.write,
|
|
68
|
+
frame,
|
|
69
|
+
withoutResponse: true
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
timeCommand = () => {
|
|
73
|
+
const date = this.now();
|
|
74
|
+
if (this.params.protocol === "v1") {
|
|
75
|
+
const time = `${date.getFullYear()}-${this.pad(date.getMonth() + 1)}-${this.pad(date.getDate())},${this.pad(date.getHours())}:${this.pad(date.getMinutes())}:${this.pad(date.getSeconds())}`;
|
|
76
|
+
return this.command(OxyS3Command.legacySyncTime, toBytes(JSON.stringify({
|
|
77
|
+
SetTIME: time
|
|
78
|
+
})));
|
|
79
|
+
}
|
|
80
|
+
const year = date.getFullYear();
|
|
81
|
+
const timezoneOffsetTenthHours = Math.round(-date.getTimezoneOffset() / 6);
|
|
82
|
+
return this.command(OxyS3Command.syncTime, [year & 0xff, year >>> 8, date.getMonth() + 1, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), timezoneOffsetTenthHours & 0xff]);
|
|
83
|
+
};
|
|
84
|
+
readLegacyParameters = () => this.command(OxyS3Command.legacyRealtimeParameters);
|
|
85
|
+
decrypt = payload => this.sessionKey ? decryptLepuPayload(payload, this.sessionKey) ?? [] : [...payload];
|
|
86
|
+
report = payload => {
|
|
87
|
+
const reading = parseOxyS3Reading(payload, this.params.protocol);
|
|
88
|
+
if (!reading || !validOxygen(reading.bloodOxygen) || !validPulse(reading.pulseRate)) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
this.params.onResult({
|
|
92
|
+
caseType: CaseType.RESULT,
|
|
93
|
+
measurementTypeKey: MeasurementTypeKey.bloodOxygenPulseRate,
|
|
94
|
+
bloodOxygen: reading.bloodOxygen,
|
|
95
|
+
pulseRate: reading.pulseRate,
|
|
96
|
+
...(reading.perfusionIndex > 0 ? {
|
|
97
|
+
perfusionIndex: reading.perfusionIndex
|
|
98
|
+
} : {}),
|
|
99
|
+
recordedAt: this.now()
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
now = () => this.params.now?.() ?? new Date();
|
|
103
|
+
pad = value => value.toString().padStart(2, "0");
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=oxy-s3.sequencer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","CaseType","LepuCommandBuilder","buildOxyS3LegacyFrame","decodeOxyS3Response","OxyS3Command","parseOxyS3Reading","createLepuAccessToken","decryptLepuHandshake","decryptLepuPayload","encryptLepuPayload","parseLepuSessionKey","toBytes","value","Array","from","character","charCodeAt","validOxygen","validPulse","OxyS3Sequencer","commands","constructor","params","phase","encrypted","initialCommands","command","authenticate","now","timeCommand","nextCommand","frame","response","protocol","undefined","status","sessionKey","payload","syncTime","readLegacyParameters","enableRealtimeParameters","realtimeParameters","report","decrypt","encryptedPayload","build","write","withoutResponse","date","time","getFullYear","pad","getMonth","getDate","getHours","getMinutes","getSeconds","legacySyncTime","JSON","stringify","SetTIME","year","timezoneOffsetTenthHours","Math","round","getTimezoneOffset","legacyRealtimeParameters","reading","bloodOxygen","pulseRate","onResult","caseType","RESULT","measurementTypeKey","bloodOxygenPulseRate","perfusionIndex","recordedAt","Date","toString","padStart"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/oxy-s3.sequencer.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAkC,YAAY;AAEzE,SAASC,QAAQ,QAAQ,6BAA0B;AAInD,SAASC,kBAAkB,QAAQ,iCAA8B;AAEjE,SACEC,qBAAqB,EACrBC,mBAAmB,EACnBC,YAAY,EAEZC,iBAAiB,QACZ,sBAAmB;AAC1B,SACEC,qBAAqB,EACrBC,oBAAoB,EACpBC,kBAAkB,EAClBC,kBAAkB,EAClBC,mBAAmB,QACd,yBAAsB;AAY7B,MAAMC,OAAO,GAAIC,KAAa,IAC5BC,KAAK,CAACC,IAAI,CAACF,KAAK,EAAGG,SAAS,IAAKA,SAAS,CAACC,UAAU,CAAC,CAAC,CAAC,CAAC;AAE3D,MAAMC,WAAW,GAAIL,KAAa,IAAcA,KAAK,IAAI,EAAE,IAAIA,KAAK,IAAI,GAAG;AAC3E,MAAMM,UAAU,GAAIN,KAAa,IAAcA,KAAK,GAAG,CAAC,IAAIA,KAAK,IAAI,GAAG;;AAExE;AACA,OAAO,MAAMO,cAAc,CAA6B;EACrCC,QAAQ,GAAG,IAAInB,kBAAkB,CAAC,IAAI,CAAC;EAIjDoB,WAAWA,CAAkBC,MAA4B,EAAE;IAAA,KAA9BA,MAA4B,GAA5BA,MAA4B;IAC9D,IAAI,CAACC,KAAK,GAAGD,MAAM,CAACE,SAAS,GAAG,cAAc,GAAG,OAAO;EAC1D;EAEOC,eAAe,GAAGA,CAA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EACJ,CAAC;EAEOA,GAAG,GAAGA,CAAA,KAAY,IAAI,CAACN,MAAM,CAACM,GAAG,GAAG,CAAC,IAAI,IAAIiD,IAAI,CAAC,CAAC;EAEnD1B,GAAG,GAAIvC,KAAa,IAAaA,KAAK,CAACkE,QAAQ,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AAC5E","ignoreList":[]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable import/group-exports */
|
|
4
|
+
|
|
5
|
+
import { MeasurementTypeKey } from "@ovok/core";
|
|
6
|
+
import { BTManagedDevice } from "../bt-managed-device.js";
|
|
7
|
+
import { PF10AW1_NOTIFY, PF10AW1_SERVICE, PF10AW1_WRITE, Pf10Aw1FrameReader } from "./pf10aw1.protocol.js";
|
|
8
|
+
import { Pf10Aw1Sequencer } from "./pf10aw1.sequencer.js";
|
|
9
|
+
const acceptNothing = {
|
|
10
|
+
caseValuePosition: [],
|
|
11
|
+
cases: []
|
|
12
|
+
};
|
|
13
|
+
export const pf10Aw1MainServices = [{
|
|
14
|
+
uuid: PF10AW1_SERVICE,
|
|
15
|
+
monitorUuids: [{
|
|
16
|
+
uuid: PF10AW1_NOTIFY,
|
|
17
|
+
parsingModel: acceptNothing
|
|
18
|
+
}],
|
|
19
|
+
writeUuid: {
|
|
20
|
+
uuid: PF10AW1_WRITE,
|
|
21
|
+
mainCommandUuid: "a5"
|
|
22
|
+
}
|
|
23
|
+
}];
|
|
24
|
+
|
|
25
|
+
/** ViHealth PF10AW-ME, SA10AW-PU, and PF10BW-VE encrypted oximeter driver. */
|
|
26
|
+
export class Pf10Aw1Device extends BTManagedDevice {
|
|
27
|
+
mainServices = pf10Aw1MainServices;
|
|
28
|
+
stuckDataTimeout = 60_000;
|
|
29
|
+
onStreamStart = undefined;
|
|
30
|
+
getSupportedMeasurementTypeKeys() {
|
|
31
|
+
return [MeasurementTypeKey.bloodOxygenPulseRate];
|
|
32
|
+
}
|
|
33
|
+
constructor(device, params) {
|
|
34
|
+
super(device, params);
|
|
35
|
+
this.frameReader = new Pf10Aw1FrameReader();
|
|
36
|
+
this.createCommandSequencer = () => new Pf10Aw1Sequencer({
|
|
37
|
+
write: {
|
|
38
|
+
serviceUuid: PF10AW1_SERVICE,
|
|
39
|
+
characteristicUuid: PF10AW1_WRITE
|
|
40
|
+
},
|
|
41
|
+
onResult: result => this.onResult?.(result)
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
handleSuccessResult() {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=pf10aw1.device.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","BTManagedDevice","PF10AW1_NOTIFY","PF10AW1_SERVICE","PF10AW1_WRITE","Pf10Aw1FrameReader","Pf10Aw1Sequencer","acceptNothing","caseValuePosition","cases","pf10Aw1MainServices","uuid","monitorUuids","parsingModel","writeUuid","mainCommandUuid","Pf10Aw1Device","mainServices","stuckDataTimeout","onStreamStart","undefined","getSupportedMeasurementTypeKeys","bloodOxygenPulseRate","constructor","device","params","frameReader","createCommandSequencer","write","serviceUuid","characteristicUuid","onResult","result","handleSuccessResult"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/pf10aw1.device.ts"],"mappings":";;AAAA;;AAEA,SAASA,kBAAkB,QAAQ,YAAY;AAQ/C,SAASC,eAAe,QAAQ,yBAAsB;AAEtD,SACEC,cAAc,EACdC,eAAe,EACfC,aAAa,EACbC,kBAAkB,QACb,uBAAoB;AAC3B,SAASC,gBAAgB,QAAQ,wBAAqB;AAOtD,MAAMC,aAAa,GAAG;EAAEC,iBAAiB,EAAE,EAAE;EAAEC,KAAK,EAAE;AAAG,CAAC;AAE1D,OAAO,MAAMC,mBAA+B,GAAG,CAC7C;EACEC,IAAI,EAAER,eAAe;EACrBS,YAAY,EAAE,CAAC;IAAED,IAAI,EAAET,cAAc;IAAEW,YAAY,EAAEN;EAAc,CAAC,CAAC;EACrEO,SAAS,EAAE;IAAEH,IAAI,EAAEP,aAAa;IAAEW,eAAe,EAAE;EAAK;AAC1D,CAAC,CACF;;AAED;AACA,OAAO,MAAMC,aAAa,SAASf,eAAe,CAAkB;EACxDgB,YAAY,GAAGP,mBAAmB;EAClCQ,gBAAgB,GAAG,MAAM;EACzBC,aAAa,GAAGC,SAAS;EAEhBC,+BAA+BA,CAAA,EAAyB;IACzE,OAAO,CAACrB,kBAAkB,CAACsB,oBAAoB,CAAC;EAClD;EAEOC,WAAWA,CAChBC,MAAc,EACdC,MAA2C,EAC3C;IACA,KAAK,CAACD,MAAM,EAAEC,MAAM,CAAC;IACrB,IAAI,CAACC,WAAW,GAAG,IAAIrB,kBAAkB,CAAC,CAAC;IAC3C,IAAI,CAACsB,sBAAsB,GAAG,MAC5B,IAAIrB,gBAAgB,CAAC;MACnBsB,KAAK,EAAE;QACLC,WAAW,EAAE1B,eAAe;QAC5B2B,kBAAkB,EAAE1B;MACtB,CAAC;MACD2B,QAAQ,EAAGC,MAAM,IACf,IAAI,CAACD,QAAQ,GACXC,MAGF;IACJ,CAAC,CAAC;EACN;EAEUC,mBAAmBA,CAAA,EAAS;IACpC;EACF;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable import/group-exports */
|
|
4
|
+
|
|
5
|
+
import { calculateCrc8 } from "../../../utils/calculate-crc-8.js";
|
|
6
|
+
import { hexToByte } from "../../../utils/hex-to-byte.js";
|
|
7
|
+
import { le16FromHex } from "../../../utils/le-16-from-hex.js";
|
|
8
|
+
import { LepuFrameReader } from "../lepu/lepu.frame-reader.js";
|
|
9
|
+
export const PF10AW1_SERVICE = "e8fb0001-a14b-98f9-831b-4e2941d01248";
|
|
10
|
+
export const PF10AW1_WRITE = "e8fb0002-a14b-98f9-831b-4e2941d01248";
|
|
11
|
+
export const PF10AW1_NOTIFY = "e8fb0003-a14b-98f9-831b-4e2941d01248";
|
|
12
|
+
export const Pf10Aw1Command = {
|
|
13
|
+
authenticate: 0xff,
|
|
14
|
+
setUtcTime: 0xc0,
|
|
15
|
+
enableParameters: 0x02,
|
|
16
|
+
enableWave: 0x03,
|
|
17
|
+
realtimeParameters: 0x04
|
|
18
|
+
};
|
|
19
|
+
/** PF10AW1 uses the shared Lepu A5 frame and CRC-8/ATM. */
|
|
20
|
+
export class Pf10Aw1FrameReader {
|
|
21
|
+
reader = new LepuFrameReader(["a5"]);
|
|
22
|
+
readFrame = buffer => this.reader.readFrame(buffer);
|
|
23
|
+
}
|
|
24
|
+
export const decodePf10Aw1Response = frame => {
|
|
25
|
+
if (frame.length < 8 || hexToByte(frame[0] ?? "00") !== 0xa5) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
const command = hexToByte(frame[1] ?? "00");
|
|
29
|
+
if (hexToByte(frame[2] ?? "00") !== (~command & 0xff)) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
const payloadLength = le16FromHex(frame, 5);
|
|
33
|
+
if (frame.length !== payloadLength + 8) {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
const checksumIndex = frame.length - 1;
|
|
37
|
+
if (hexToByte(frame[checksumIndex] ?? "00") !== calculateCrc8([...frame], checksumIndex)) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
command,
|
|
42
|
+
status: hexToByte(frame[3] ?? "00"),
|
|
43
|
+
payload: frame.slice(7, checksumIndex).map(value => hexToByte(value))
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export const parsePf10Aw1OximeterReading = payload => {
|
|
47
|
+
if (payload.length < 5) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
bloodOxygen: payload[0] ?? 0,
|
|
52
|
+
pulseRate: payload[1] ?? 0,
|
|
53
|
+
perfusionIndex: (payload[2] ?? 0) / 10,
|
|
54
|
+
probeOff: ((payload[3] ?? 0) & 0x02) !== 0
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=pf10aw1.protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["calculateCrc8","hexToByte","le16FromHex","LepuFrameReader","PF10AW1_SERVICE","PF10AW1_WRITE","PF10AW1_NOTIFY","Pf10Aw1Command","authenticate","setUtcTime","enableParameters","enableWave","realtimeParameters","Pf10Aw1FrameReader","reader","readFrame","buffer","decodePf10Aw1Response","frame","length","undefined","command","payloadLength","checksumIndex","status","payload","slice","map","value","parsePf10Aw1OximeterReading","bloodOxygen","pulseRate","perfusionIndex","probeOff"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/pf10aw1.protocol.ts"],"mappings":";;AAAA;;AAGA,SAASA,aAAa,QAAQ,mCAAgC;AAC9D,SAASC,SAAS,QAAQ,+BAA4B;AACtD,SAASC,WAAW,QAAQ,kCAA+B;AAC3D,SAASC,eAAe,QAAQ,8BAA2B;AAE3D,OAAO,MAAMC,eAAe,GAAG,sCAAsC;AACrE,OAAO,MAAMC,aAAa,GAAG,sCAAsC;AACnE,OAAO,MAAMC,cAAc,GAAG,sCAAsC;AAEpE,OAAO,MAAMC,cAAc,GAAG;EAC5BC,YAAY,EAAE,IAAI;EAClBC,UAAU,EAAE,IAAI;EAChBC,gBAAgB,EAAE,IAAI;EACtBC,UAAU,EAAE,IAAI;EAChBC,kBAAkB,EAAE;AACtB,CAAU;AAeV;AACA,OAAO,MAAMC,kBAAkB,CAAwB;EACpCC,MAAM,GAAG,IAAIX,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC;EAE9CY,SAAS,GAAIC,MAAyB,IAAK,IAAI,CAACF,MAAM,CAACC,SAAS,CAACC,MAAM,CAAC;AACjF;AAEA,OAAO,MAAMC,qBAAq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