@ovok/native 1.6.47 → 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 +12 -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 +38 -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/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 -82
- 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/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 +11 -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 +12 -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 +38 -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/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 -81
- 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/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 +11 -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/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/types/clock-sync.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts +12 -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 +12 -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/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/types/clock-sync.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts +12 -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 +12 -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,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable import/group-exports */
|
|
4
|
+
|
|
5
|
+
import { MeasurementTypeKey } from "@ovok/core";
|
|
6
|
+
import { calculateCrc8 } from "../../../utils/calculate-crc-8.js";
|
|
7
|
+
import { hexToByte } from "../../../utils/hex-to-byte.js";
|
|
8
|
+
import { le16FromHex } from "../../../utils/le-16-from-hex.js";
|
|
9
|
+
import { LepuFrameReader } from "../lepu/lepu.frame-reader.js";
|
|
10
|
+
export const BABY_SLEEP_CLIP_SERVICE = "e8fb0001-a14b-98f9-831b-4e2941d01248";
|
|
11
|
+
export const BABY_SLEEP_CLIP_WRITE = "e8fb0002-a14b-98f9-831b-4e2941d01248";
|
|
12
|
+
export const BABY_SLEEP_CLIP_NOTIFY = "e8fb0003-a14b-98f9-831b-4e2941d01248";
|
|
13
|
+
export const BABY_SLEEP_CLIP_MEASUREMENT_TYPE = MeasurementTypeKey.babySleep;
|
|
14
|
+
export const BabySleepClipCommand = {
|
|
15
|
+
authenticate: 0xff,
|
|
16
|
+
syncTime: 0xec,
|
|
17
|
+
readData: 0x02
|
|
18
|
+
};
|
|
19
|
+
const COMPONENT_SYSTEM = "https://sdk.ovok.com/fhir/CodeSystem/baby-sleep-components";
|
|
20
|
+
const componentCode = (code, display) => ({
|
|
21
|
+
coding: [{
|
|
22
|
+
system: COMPONENT_SYSTEM,
|
|
23
|
+
code,
|
|
24
|
+
display
|
|
25
|
+
}],
|
|
26
|
+
text: display
|
|
27
|
+
});
|
|
28
|
+
const integerComponent = (code, display, value) => ({
|
|
29
|
+
code: componentCode(code, display),
|
|
30
|
+
valueInteger: value
|
|
31
|
+
});
|
|
32
|
+
const booleanComponent = (code, display, value) => ({
|
|
33
|
+
code: componentCode(code, display),
|
|
34
|
+
valueBoolean: value
|
|
35
|
+
});
|
|
36
|
+
const quantityComponent = (code, display, value, unit, ucum) => ({
|
|
37
|
+
code: componentCode(code, display),
|
|
38
|
+
valueQuantity: {
|
|
39
|
+
value,
|
|
40
|
+
unit,
|
|
41
|
+
system: "http://unitsofmeasure.org",
|
|
42
|
+
code: ucum
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
const u32 = (bytes, offset) => (bytes[offset] ?? 0) + (bytes[offset + 1] ?? 0) * 0x100 + (bytes[offset + 2] ?? 0) * 0x10000 + (bytes[offset + 3] ?? 0) * 0x1000000;
|
|
46
|
+
const u16 = (bytes, offset) => (bytes[offset] ?? 0) | (bytes[offset + 1] ?? 0) << 8;
|
|
47
|
+
const i16 = (bytes, offset) => {
|
|
48
|
+
const value = u16(bytes, offset);
|
|
49
|
+
return value > 0x7fff ? value - 0x10000 : value;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/** Validates one complete A5 response used by the BabySleep Clip interface. */
|
|
53
|
+
export const decodeBabySleepClipResponse = frame => {
|
|
54
|
+
if (frame.length < 8 || hexToByte(frame[0] ?? "00") !== 0xa5) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
const command = hexToByte(frame[1] ?? "00");
|
|
58
|
+
const checksumIndex = frame.length - 1;
|
|
59
|
+
const payloadLength = le16FromHex(frame, 5);
|
|
60
|
+
if (hexToByte(frame[2] ?? "00") !== (~command & 0xff) || frame.length !== payloadLength + 8 || hexToByte(frame[checksumIndex] ?? "00") !== calculateCrc8([...frame], checksumIndex)) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
command,
|
|
65
|
+
status: hexToByte(frame[3] ?? "00"),
|
|
66
|
+
payload: frame.slice(7, checksumIndex).map(hexToByte)
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/** Maps the vendor's RT_DATA response without assigning meanings to its coded states. */
|
|
71
|
+
export const decodeBabySleepClipData = (bytes, recordedAt = new Date()) => {
|
|
72
|
+
if (bytes.length < 21) {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
const components = [integerComponent("duration", "Recording duration (raw)", u32(bytes, 0)), integerComponent("device-status", "Device status", bytes[4] ?? 0), integerComponent("posture", "Posture code", bytes[5] ?? 0), booleanComponent("lead-off", "Sensor lead-off", bytes[6] === 1), integerComponent("breath-alarm", "Respiratory alarm code", bytes[8] ?? 0), integerComponent("temperature-alarm", "Temperature alarm code", (bytes[11] ?? 0) & 0x03), booleanComponent("quilt-kick-alarm", "Quilt movement alarm", ((bytes[11] ?? 0) & 0x04) !== 0), integerComponent("battery-state", "Battery state code", bytes[12] ?? 0), quantityComponent("battery-charge", "Battery charge", bytes[13] ?? 0, "%", "%"), quantityComponent("battery-voltage", "Battery voltage", u16(bytes, 14) / 1000, "V", "V"), integerComponent("startup", "Device startup value (raw)", u32(bytes, 16)), booleanComponent("posture-alarm", "Posture alarm", bytes[20] === 1)];
|
|
76
|
+
const respiratoryRate = bytes[7] ?? 0;
|
|
77
|
+
if (respiratoryRate > 0 && respiratoryRate <= 100) {
|
|
78
|
+
components.push(quantityComponent("respiratory-rate", "Respiratory rate", respiratoryRate, "breaths/min", "{breaths}/min"));
|
|
79
|
+
}
|
|
80
|
+
const temperature = i16(bytes, 9) / 10;
|
|
81
|
+
if (temperature >= -20 && temperature <= 60) {
|
|
82
|
+
components.push(quantityComponent("temperature", "Feeling temperature", temperature, "°C", "Cel"));
|
|
83
|
+
}
|
|
84
|
+
if (bytes.length >= 56) {
|
|
85
|
+
components.push(integerComponent("cough-display", "Cough display flag", bytes[28] ?? 0), integerComponent("sleep-state", "Sleep state code", bytes[29] ?? 0), integerComponent("falling-asleep-time", "Falling asleep time (raw)", u32(bytes, 30)), integerComponent("awake-time", "Awake time (raw)", u32(bytes, 34)), integerComponent("wake-time", "Wake time (raw)", u32(bytes, 38)), integerComponent("deep-sleep-time", "Deep sleep time (raw)", u32(bytes, 42)), integerComponent("light-sleep-time", "Light sleep time (raw)", u32(bytes, 46)), integerComponent("sleep-time", "Sleep time (raw)", u32(bytes, 50)), integerComponent("awake-count", "Awake count", bytes[54] ?? 0), integerComponent("playpnea", "Playpnea code", bytes[55] ?? 0));
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
measurementTypeKey: BABY_SLEEP_CLIP_MEASUREMENT_TYPE,
|
|
89
|
+
recordedAt,
|
|
90
|
+
components
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/** Reads complete encrypted Lepu A5 notifications and joins split frames. */
|
|
95
|
+
export class BabySleepClipFrameReader {
|
|
96
|
+
reader = new LepuFrameReader(["a5"]);
|
|
97
|
+
readFrame = buffer => this.reader.readFrame(buffer);
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=baby-sleep-clip.protocol.js.map
|
package/lib/module/modules/bt-management/services/devices/viatom/baby-sleep-clip.protocol.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","calculateCrc8","hexToByte","le16FromHex","LepuFrameReader","BABY_SLEEP_CLIP_SERVICE","BABY_SLEEP_CLIP_WRITE","BABY_SLEEP_CLIP_NOTIFY","BABY_SLEEP_CLIP_MEASUREMENT_TYPE","babySleep","BabySleepClipCommand","authenticate","syncTime","readData","COMPONENT_SYSTEM","componentCode","code","display","coding","system","text","integerComponent","value","valueInteger","booleanComponent","valueBoolean","quantityComponent","unit","ucum","valueQuantity","u32","bytes","offset","u16","i16","decodeBabySleepClipResponse","frame","length","undefined","command","checksumIndex","payloadLength","status","payload","slice","map","decodeBabySleepClipData","recordedAt","Date","components","respiratoryRate","push","temperature","measurementTypeKey","BabySleepClipFrameReader","reader","readFrame","buffer"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/baby-sleep-clip.protocol.ts"],"mappings":";;AAAA;;AAGA,SAA+BA,kBAAkB,QAAQ,YAAY;AAIrE,SAASC,aAAa,QAAQ,mCAAgC;AAC9D,SAASC,SAAS,QAAQ,+BAA4B;AACtD,SAASC,WAAW,QAAQ,kCAA+B;AAC3D,SAASC,eAAe,QAAQ,8BAA2B;AAE3D,OAAO,MAAMC,uBAAuB,GAAG,sCAAsC;AAC7E,OAAO,MAAMC,qBAAqB,GAAG,sCAAsC;AAC3E,OAAO,MAAMC,sBAAsB,GAAG,sCAAsC;AAC5E,OAAO,MAAMC,gCAAgC,GAAGR,kBAAkB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ACC,KAAK,EAAE,EAAE,CAAC,CAAC,EAClEV,gBAAgB,CAAC,WAAW,EAAE,iBAAiB,EAAES,GAAG,CAACC,KAAK,EAAE,EAAE,CAAC,CAAC,EAChEV,gBAAgB,CACd,iBAAiB,EACjB,uBAAuB,EACvBS,GAAG,CAACC,KAAK,EAAE,EAAE,CACf,CAAC,EACDV,gBAAgB,CACd,kBAAkB,EAClB,wBAAwB,EACxBS,GAAG,CAACC,KAAK,EAAE,EAAE,CACf,CAAC,EACDV,gBAAgB,CAAC,YAAY,EAAE,kBAAkB,EAAES,GAAG,CAACC,KAAK,EAAE,EAAE,CAAC,CAAC,EAClEV,gBAAgB,CAAC,aAAa,EAAE,aAAa,EAAEU,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,EAC9DV,gBAAgB,CAAC,UAAU,EAAE,eAAe,EAAEU,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAC9D,CAAC;EACH;EAEA,OAAO;IACLsB,kBAAkB,EAAE7C,gCAAgC;IACpDuC,UAAU;IACVE;EACF,CAAC;AACH,CAAC;;AAED;AACA,OAAO,MAAMK,wBAAwB,CAAwB;EAC1CC,MAAM,GAAG,IAAInD,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC;EAE9CoD,SAAS,GAAIC,MAAyB,IAC3C,IAAI,CAACF,MAAM,CAACC,SAAS,CAACC,MAAM,CAAC;AACjC","ignoreList":[]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { CaseType } from "../../../types/case-type.js";
|
|
4
|
+
import { getClockParts, isClockSyncEnabled } from "../../../types/clock-sync.js";
|
|
5
|
+
import { LepuCommandBuilder } from "../lepu/lepu.command-builder.js";
|
|
6
|
+
import { BabySleepClipCommand, decodeBabySleepClipData, decodeBabySleepClipResponse } from "./baby-sleep-clip.protocol.js";
|
|
7
|
+
import { createLepuAccessToken, decryptLepuHandshake, decryptLepuPayload, encryptLepuPayload, parseLepuSessionKey } from "./viatom-lepu-crypto.js";
|
|
8
|
+
/** Authenticates, synchronizes the BS1 clock when enabled, and reads one RT_DATA record. */
|
|
9
|
+
export class BabySleepClipSequencer {
|
|
10
|
+
commands = new LepuCommandBuilder("a5");
|
|
11
|
+
phase = "authenticate";
|
|
12
|
+
resultReported = false;
|
|
13
|
+
constructor(params) {
|
|
14
|
+
this.params = params;
|
|
15
|
+
}
|
|
16
|
+
initialCommands = () => [this.command(BabySleepClipCommand.authenticate, createLepuAccessToken(this.now()), false)];
|
|
17
|
+
isNormalDisconnect = () => this.resultReported;
|
|
18
|
+
commandTimeoutMs = () => this.phase === "done" ? undefined : 5_000;
|
|
19
|
+
onCommandTimeout = () => {
|
|
20
|
+
this.phase = "done";
|
|
21
|
+
return {
|
|
22
|
+
terminal: true
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
nextCommand = frame => {
|
|
26
|
+
const response = decodeBabySleepClipResponse(frame);
|
|
27
|
+
if (!response || response.status !== 1) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
if (this.phase === "authenticate") {
|
|
31
|
+
if (response.command !== BabySleepClipCommand.authenticate) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
const sessionKey = parseLepuSessionKey(decryptLepuHandshake(response.payload));
|
|
35
|
+
if (!sessionKey) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
this.sessionKey = sessionKey;
|
|
39
|
+
this.phase = isClockSyncEnabled(this.params.clockSync) ? "clock" : "read";
|
|
40
|
+
return [this.phase === "clock" ? this.timeCommand() : this.readCommand()];
|
|
41
|
+
}
|
|
42
|
+
if (this.phase === "clock" && response.command === BabySleepClipCommand.syncTime) {
|
|
43
|
+
this.phase = "read";
|
|
44
|
+
return [this.readCommand()];
|
|
45
|
+
}
|
|
46
|
+
if (this.phase === "read" && response.command === BabySleepClipCommand.readData) {
|
|
47
|
+
const payload = this.sessionKey ? decryptLepuPayload(response.payload, this.sessionKey) ?? [] : [];
|
|
48
|
+
const measurement = decodeBabySleepClipData(payload, this.now());
|
|
49
|
+
if (measurement) {
|
|
50
|
+
this.phase = "done";
|
|
51
|
+
this.resultReported = true;
|
|
52
|
+
this.params.onResult({
|
|
53
|
+
...measurement,
|
|
54
|
+
caseType: CaseType.RESULT
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return undefined;
|
|
59
|
+
};
|
|
60
|
+
command = (command, payload = [], encrypt = true) => {
|
|
61
|
+
const framePayload = encrypt && this.sessionKey && payload.length > 0 ? encryptLepuPayload(payload, this.sessionKey) : [...payload];
|
|
62
|
+
return {
|
|
63
|
+
...this.params.write,
|
|
64
|
+
frame: this.commands.build(command, framePayload),
|
|
65
|
+
withoutResponse: true
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
timeCommand = () => {
|
|
69
|
+
const parts = getClockParts(this.now(), this.params.clockSync?.timezone ?? "local");
|
|
70
|
+
return this.command(BabySleepClipCommand.syncTime, [parts.year & 0xff, parts.year >>> 8, parts.month, parts.day, parts.hours, parts.minutes, parts.seconds]);
|
|
71
|
+
};
|
|
72
|
+
readCommand = () => this.command(BabySleepClipCommand.readData);
|
|
73
|
+
now = () => this.params.clockSync?.now?.() ?? new Date();
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=baby-sleep-clip.sequencer.js.map
|
package/lib/module/modules/bt-management/services/devices/viatom/baby-sleep-clip.sequencer.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CaseType","getClockParts","isClockSyncEnabled","LepuCommandBuilder","BabySleepClipCommand","decodeBabySleepClipData","decodeBabySleepClipResponse","createLepuAccessToken","decryptLepuHandshake","decryptLepuPayload","encryptLepuPayload","parseLepuSessionKey","BabySleepClipSequencer","commands","phase","resultReported","constructor","params","initialCommands","command","authenticate","now","isNormalDisconnect","commandTimeoutMs","undefined","onCommandTimeout","terminal","nextCommand","frame","response","status","sessionKey","payload","clockSync","timeCommand","readCommand","syncTime","readData","measurement","onResult","caseType","RESULT","encrypt","framePayload","length","write","build","withoutResponse","parts","timezone","year","month","day","hours","minutes","seconds","Date"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/baby-sleep-clip.sequencer.ts"],"mappings":";;AAEA,SAASA,QAAQ,QAAQ,6BAA0B;AACnD,SAEEC,aAAa,EACbC,kBAAkB,QACb,8BAA2B;AAIlC,SAASC,kBAAkB,QAAQ,iCAA8B;AAEjE,SACEC,oBAAoB,EACpBC,uBAAuB,EACvBC,2BAA2B,QACtB,+BAA4B;AACnC,SACEC,qBAAqB,EACrBC,oBAAoB,EACpBC,kBAAkB,EAClBC,kBAAkB,EAClBC,mBAAmB,QACd,yBAAsB;AAU7B;AACA,OAAO,MAAMC,sBAAsB,CAA6B;EAC7CC,QAAQ,GAAG,IAAIV,kBAAkB,CAAC,IAAI,CAAC;EAChDW,KAAK,GAAU,cAAc;EAE7BC,cAAc,GAAG,KAAK;EAEvBC,WAAWA,CAAkBC,MAAoC,EAAE;IAAA,KAAtCA,MAAoC,GAApCA,MAAoC;EAAG;EAEpEC,eAAe,GAAGA,CAAA,KAAgC,CACvD,IAAI,CAACC,OAAO,CACVf,oBAAoB,CAACgB,YAAY,EACjCb,qBAAqB,CAAC,IAAI,CAACc,GAAG,CAAC,CAAC,CAAC,EACjC,KACF,CAAC,CACF;EAEMC,kBAAkB,GAAGA,CAAA,KAAe,IAAI,CAACP,cAAc;EAEvDQ,gBAAgB,GAAGA,CAAA,KACxB,IAAI,CAACT,KAAK,KAAK,MAAM,GAAGU,SAAS,GAAG,KAAK;EAEpCC,gBAAgB,GAAGA,CAAA,KAAM;IAC9B,IAAI,CAACX,KAAK,GAAG,MAAM;IAEnB,OAAO;MAAEY,QAAQ,EAAE;IAAK,CAAC;EAC3B,CAAC;EAEMC,WAAW,GAChBC,KAAwB,IACiB;IACzC,MAAMC,QAAQ,GAAGvB,2BAA2B,CAACsB,KAAK,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AoB,CAACiC,QAAQ,CAAC;EAErChB,GAAG,GAAGA,CAAA,KAAY,IAAI,CAACJ,MAAM,CAACgB,SAAS,EAAEZ,GAAG,GAAG,CAAC,IAAI,IAAImC,IAAI,CAAC,CAAC;AACxE","ignoreList":[]}
|
|
@@ -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,EACjBC,mBAAmB,QACd,sBAAmB;AAC1B,SAASC,eAAe,QAAQ,uBAAoB;AAEpD,MAAMC,OAAO,GAAG,sCAAsC;AACtD,MAAMC,cAAc,GAAG,sCAAsC;AAE7D,MAAMC,UAAU,GAAGR,kBAAkB,CACnC;EACES,EAAE,EAAE,eAAe;EACnBC,SAAS,EAAE,iBAAiB;EAC5BC,uBAAuB,EAAE,IAAI;EAC7BC,kBAAkB,EAAE,MAAM;EAC1BC,QAAQ,EAAE,CACR;IACEC,IAAI,EAAER,OAAO;IACbS,OAAO,EAAE,CACP;MACED,IAAI,EAAEP,cAAc;MACpBS,KAAK,EAAE;QAAEC,cAAc,EAAEb;MAAoB,CAAC;MAC9Cc,KAAK,EAAE,CACL;QACEC,QAAQ,EAAE,EAAE;QACZC,IAAI,EAAE,OAAO;QACbH,cAAc,EAAEb,mBAAmB;QACnCiB,WAAW,EAAE;MACf,CAAC;IAEL,CAAC;EAEL,CAAC;AAEL,CAAC,EACD;EACEC,WAAW,EAAE,IAAInB,iBAAiB,CAAC,CAAC;EACpCoB,kBAAkB,EAChBA,CAAA,KACA,CAAC;IAAEP,KAAK;IAAEQ;EAAK,CAAC,KAAK;IACnB,MAAMC,MAAM,GAAGvB,kBAAkB,CAACc,KAAK,CAAC;IAExC,IAAIS,MAAM,EAAE;MACVD,IAAI,CAACC,MAAqB,CAAC;IAC7B;EACF;AACJ,CACF,CAAC;;AAED;AACA,OAAO,MAAMC,YAAY,SAASzB,YAAY,CAAC;EACtC0B,WAAWA,CAChBC,MAAc,EACdC,MAAoD,EACpD;IACA,KAAK,CACHD,MAAM,EACNC,MAAM,EACNrB,UACF,CAAC;IAED,IAAI,CAACc,WAAW,GAAG,IAAInB,iBAAiB,CAAC,CAAC;IAC1C,IAAI,CAAC2B,sBAAsB,GAAG,MAAM,IAAIzB,eAAe,CAAC,CAAC;EAC3D;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
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/services/devices/viatom/lpm311.protocol.ts"],"mappings":";;AAAA,SAAgCA,kBAAkB,QAAQ,YAAY;AAGtE,SAASC,eAAe,QAAQ,qCAAkC;AAElE,SAASC,SAAS,QAAQ,+BAA4B;AAEtD,MAAMC,mBAAmB,GAAG,EAAE;AAC9B,MAAMC,uBAAuB,GAAGJ,kBAAkB,CAACK,UAAU;AAI7D,MAAMC,KAAK,GAAIC,KAAwB,IACrCA,KAAK,CAACC,GAAG,CAAEC,IAAI,IAAKC,MAAM,CAACC,YAAY,CAACT,SAAS,CAACO,IAAI,CAAC,CAAC,CAAC,CAACG,IAAI,CAAC,EAAE,CAAC;AAEpE,MAAMC,UAAU,GAAGA,CACj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AGC,cAAc,GAAGC,aAAa,GAAGK,UAAU;IAEhEF,MAAM,CAACG,cAAc,GAAGA,cAAc;IAEtC,IAAIhB,yBAAyB,CAACC,IAAI,EAAEO,gBAAgB,EAAEC,cAAc,CAAC,EAAE;MACrEI,MAAM,CAACI,wBAAwB,GAAGT,gBAAgB,GAAGC,cAAc;IACrE;EACF;EAEA,OAAOI,MAAM;AACf,CAAC;;AAED;AACA,MAAMK,iBAAiB,CAAwB;EACtCC,SAASA,CAACC,MAAyB,EAAmB;IAC3D,IAAIA,MAAM,CAACd,MAAM,GAAG3C,mBAAmB,EAAE;MACvC,OAAO;QAAE0D,MAAM,EAAE5D,eAAe,CAAC6D,UAAU;QAAEC,aAAa,EAAE;MAAE,CAAC;IACjE;IAEA,OAAO;MACLF,MAAM,EAAE5D,eAAe,CAAC+D,QAAQ;MAChCD,aAAa,EAAE5D,mBAAmB;MAClC0C,KAAK,EAAEe,MAAM,CAACpC,KAAK,CAAC,CAAC,EAAErB,mBAAmB;IAC5C,CAAC;EACH;AACF;AAEA,SACEyC,kBAAkB,EAClBc,iBAAiB,EACjBtD,uBAAuB,EACvBD,mBAAmB","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { decodeLpm311Record } 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,OAAO,MAAMC,iBAA6B,GAAG,CAC3C;EACEC,IAAI,EAAEZ,iBAAiB;EACvBa,YAAY,EAAE,CAAC;IAAED,IAAI,EAAEb,gBAAgB;IAAEe,YAAY,EAAEN;EAAc,CAAC,CAAC;EACvEO,SAAS,EAAE;IAAEH,IAAI,EAAEX,eAAe;IAAEe,eAAe,EAAE;EAAK;AAC5D,CAAC,EACD;EACEJ,IAAI,EAAET,iBAAiB;EACvBU,YAAY,EAAE,CAAC;IAAED,IAAI,EAAEV,gBAAgB;IAAEY,YAAY,EAAEN;EAAc,CAAC,CAAC;EACvEO,SAAS,EAAE;IAAEH,IAAI,EAAER,eAAe;IAAEY,eAAe,EAAE;EAAK;AAC5D,CAAC,CACF;;AAED;AACA,OAAO,MAAMC,WAAW,SAASnB,eAAe,CAA4B;EAChEoB,YAAY,GAAGP,iBAAiB;EAChCQ,gBAAgB,GAAG,MAAM;EACzBC,aAAa,GAAGC,SAAS;EAChBC,YAAY,GAAG,GAAG;EAElBC,+BAA+BA,CAAA,EAAyB;IACzE,OAAO,CAAC1B,kBAAkB,CAAC2B,oBAAoB,CAAC;EAClD;EAEOC,WAAWA,CAChBC,MAAc,EACdC,MAAqD,EACrD;IACA,KAAK,CAACD,MAAM,EAAEC,MAAM,CAAC;IACrB,IAAI,CAACC,WAAW,GAAG,IAAIvB,gBAAgB,CAAC,CAAC;IACzC,IAAI,CAACwB,sBAAsB,GAAG,MAAM;MAClC,MAAMC,aAAa,GAAGxB,uBAAuB,CAACoB,MAAM,CAACK,gBAAgB,CAAC;MACtE,MAAMC,QAAQ,GAAGF,aAAa,CAACE,QAAQ;MAEvC,MAAMC,WAAW,GACfD,QAAQ,KAAK,IAAI,GAAG7B,iBAAiB,GAAGH,iBAAiB;MAE3D,MAAMkC,kBAAkB,GACtBF,QAAQ,KAAK,IAAI,GAAG5B,eAAe,GAAGH,eAAe;MAEvD,OAAO,IAAIM,cAAc,CAAC;QACxByB,QAAQ;QACRG,SAAS,EAAEL,aAAa,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"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