@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,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Pf10Aw1Sequencer = void 0;
|
|
7
|
+
var _core = require("@ovok/core");
|
|
8
|
+
var _caseType = require("../../../types/case-type.js");
|
|
9
|
+
var _lepuCommandBuilder = require("../lepu/lepu.command-builder.js");
|
|
10
|
+
var _pf10aw1Protocol = require("./pf10aw1.protocol.js");
|
|
11
|
+
var _viatomLepuCrypto = require("./viatom-lepu-crypto.js");
|
|
12
|
+
const isValidOxygen = value => value >= 50 && value <= 100;
|
|
13
|
+
const isValidPulse = value => value > 0 && value <= 300;
|
|
14
|
+
|
|
15
|
+
/** Drives the vendor-encrypted A5 exchange used by the PF10AW1 oximeter models. */
|
|
16
|
+
class Pf10Aw1Sequencer {
|
|
17
|
+
commands = new _lepuCommandBuilder.LepuCommandBuilder("a5");
|
|
18
|
+
phase = "authenticate";
|
|
19
|
+
constructor(params) {
|
|
20
|
+
this.params = params;
|
|
21
|
+
}
|
|
22
|
+
initialCommands = () => [this.write(this.commands.build(_pf10aw1Protocol.Pf10Aw1Command.authenticate, (0, _viatomLepuCrypto.createLepuAccessToken)(this.params.now?.() ?? new Date())))];
|
|
23
|
+
nextCommand = frame => {
|
|
24
|
+
const response = (0, _pf10aw1Protocol.decodePf10Aw1Response)(frame);
|
|
25
|
+
if (!response) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
if (this.phase === "authenticate") {
|
|
29
|
+
return this.acceptHandshake(response.command, response.status, response.payload);
|
|
30
|
+
}
|
|
31
|
+
if (this.phase === "clock" && response.command === _pf10aw1Protocol.Pf10Aw1Command.setUtcTime) {
|
|
32
|
+
if (response.status !== 1) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
this.phase = "parameters";
|
|
36
|
+
return [this.buildEncryptedCommand(_pf10aw1Protocol.Pf10Aw1Command.enableParameters, [1])];
|
|
37
|
+
}
|
|
38
|
+
if (this.phase === "parameters" && response.command === _pf10aw1Protocol.Pf10Aw1Command.enableParameters && response.status === 1) {
|
|
39
|
+
this.phase = "wave";
|
|
40
|
+
return [this.buildEncryptedCommand(_pf10aw1Protocol.Pf10Aw1Command.enableWave, [1])];
|
|
41
|
+
}
|
|
42
|
+
if (this.phase === "wave" && response.command === _pf10aw1Protocol.Pf10Aw1Command.enableWave && response.status === 1) {
|
|
43
|
+
this.phase = "ready";
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
if (this.phase === "ready" && response.command === _pf10aw1Protocol.Pf10Aw1Command.realtimeParameters && response.status === 1) {
|
|
47
|
+
this.report(this.decrypt(response.payload));
|
|
48
|
+
}
|
|
49
|
+
return undefined;
|
|
50
|
+
};
|
|
51
|
+
acceptHandshake = (command, status, payload) => {
|
|
52
|
+
if (command !== _pf10aw1Protocol.Pf10Aw1Command.authenticate || status !== 1) {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
const key = (0, _viatomLepuCrypto.parseLepuSessionKey)((0, _viatomLepuCrypto.decryptLepuHandshake)(payload));
|
|
56
|
+
if (!key) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
this.sessionKey = key;
|
|
60
|
+
this.phase = "clock";
|
|
61
|
+
return [this.buildEncryptedCommand(_pf10aw1Protocol.Pf10Aw1Command.setUtcTime, this.timePayload())];
|
|
62
|
+
};
|
|
63
|
+
buildEncryptedCommand = (command, payload) => {
|
|
64
|
+
const encrypted = (0, _viatomLepuCrypto.encryptLepuPayload)(payload, this.sessionKey ?? []);
|
|
65
|
+
return this.write(this.commands.build(command, encrypted));
|
|
66
|
+
};
|
|
67
|
+
decrypt = payload => (this.sessionKey && (0, _viatomLepuCrypto.decryptLepuPayload)(payload, this.sessionKey)) ?? [];
|
|
68
|
+
timePayload = () => {
|
|
69
|
+
const date = this.params.now?.() ?? new Date();
|
|
70
|
+
const timezoneOffsetTenthHours = Math.round(-date.getTimezoneOffset() / 6);
|
|
71
|
+
return [date.getFullYear() & 0xff, date.getFullYear() >>> 8 & 0xff, date.getMonth() + 1, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), timezoneOffsetTenthHours & 0xff];
|
|
72
|
+
};
|
|
73
|
+
report = payload => {
|
|
74
|
+
const reading = (0, _pf10aw1Protocol.parsePf10Aw1OximeterReading)(payload);
|
|
75
|
+
if (!reading || reading.probeOff || !isValidOxygen(reading.bloodOxygen) || !isValidPulse(reading.pulseRate)) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
this.params.onResult({
|
|
79
|
+
caseType: _caseType.CaseType.RESULT,
|
|
80
|
+
measurementTypeKey: _core.MeasurementTypeKey.bloodOxygenPulseRate,
|
|
81
|
+
bloodOxygen: reading.bloodOxygen,
|
|
82
|
+
pulseRate: reading.pulseRate,
|
|
83
|
+
...(reading.perfusionIndex > 0 ? {
|
|
84
|
+
perfusionIndex: reading.perfusionIndex
|
|
85
|
+
} : {}),
|
|
86
|
+
recordedAt: this.params.now?.() ?? new Date()
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
write = frame => ({
|
|
90
|
+
...this.params.write,
|
|
91
|
+
frame,
|
|
92
|
+
withoutResponse: true
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
exports.Pf10Aw1Sequencer = Pf10Aw1Sequencer;
|
|
96
|
+
//# sourceMappingURL=pf10aw1.sequencer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_core","require","_caseType","_lepuCommandBuilder","_pf10aw1Protocol","_viatomLepuCrypto","isValidOxygen","value","isValidPulse","Pf10Aw1Sequencer","commands","LepuCommandBuilder","phase","constructor","params","initialCommands","write","build","Pf10Aw1Command","authenticate","createLepuAccessToken","now","Date","nextCommand","frame","response","decodePf10Aw1Response","undefined","acceptHandshake","command","status","payload","setUtcTime","buildEncryptedCommand","enableParameters","enableWave","realtimeParameters","report","decrypt","key","parseLepuSessionKey","decryptLepuHandshake","sessionKey","timePayload","encrypted","encryptLepuPayload","decryptLepuPayload","date","timezoneOffsetTenthHours","Math","round","getTimezoneOffset","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","reading","parsePf10Aw1OximeterReading","probeOff","bloodOxygen","pulseRate","onResult","caseType","CaseType","RESULT","measurementTypeKey","MeasurementTypeKey","bloodOxygenPulseRate","perfusionIndex","recordedAt","withoutResponse","exports"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/pf10aw1.sequencer.ts"],"mappings":";;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAIA,IAAAE,mBAAA,GAAAF,OAAA;AAEA,IAAAG,gBAAA,GAAAH,OAAA;AAKA,IAAAI,iBAAA,GAAAJ,OAAA;AAgBA,MAAMK,aAAa,GAAIC,KAAa,IAAcA,KAAK,IAAI,EAAE,IAAIA,KAAK,IAAI,GAAG;AAC7E,MAAMC,YAAY,GAAID,KAAa,IAAcA,KAAK,GAAG,CAAC,IAAIA,KAAK,IAAI,GAAG;;AAE1E;AACO,MAAME,gBAAgB,CAA6B;EACvCC,QAAQ,GAAG,IAAIC,sCAAkB,CAAC,IAAI,CAAC;EAChDC,KAAK,GAAU,cAAc;EAG9BC,WAAWA,CAAkBC,MAA8B,EAAE;IAAA,KAAhCA,MAA8B,GAA9BA,MAA8B;EAAG;EAE9DC,eAAe,GAAGA,CAAA,KAAgC,CACvD,IAAI,CAACC,KAAK,CACR,IAAI,CAACN,QAAQ,CAACO,KAAK,CACjBC,+BAAc,CAACC,YAAY,EAC3B,IAAAC,uCAAqB,EAAC,IAAI,CAACN,MAAM,CAACO,GAAG,GAAG,CAAC,IAAI,IAAIC,IAAI,CAAC,CAAC,CACzD,CACF,CAAC,CACF;EAEMC,WAAW,GAChBC,KAAwB,IACiB;IACzC,MAAMC,QAAQ,GAAG,IAAAC,sCAAqB,EAACF,KAAK,CAAC;IAE7C,IAAI,CAACC,QAAQ,EAAE;MACb,OAAOE,SAAS;IAClB;IAEA,IAAI,IAAI,CAACf,KAAK,KAAK,cAAc,EAAE;MACjC,OAAO,IAAI,CAACgB,eAAe,CAACH,QAAQ,CAACI,OAAO,EAAEJ,QAAQ,CAACK,MA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
+
});
|
|
6
|
+
exports.sp20MainServices = exports.Sp20Device = void 0;
|
|
7
|
+
var _core = require("@ovok/core");
|
|
8
|
+
var _btManagedDevice = require("../bt-managed-device.js");
|
|
9
|
+
var _sp20Protocol = require("./sp20.protocol.js");
|
|
10
|
+
var _sp20Sequencer = require("./sp20.sequencer.js");
|
|
11
|
+
/* eslint-disable import/group-exports */
|
|
12
|
+
|
|
13
|
+
const acceptNothing = {
|
|
14
|
+
caseValuePosition: [],
|
|
15
|
+
cases: []
|
|
16
|
+
};
|
|
17
|
+
const sp20MainServices = exports.sp20MainServices = [{
|
|
18
|
+
uuid: _sp20Protocol.SP20_SERVICE,
|
|
19
|
+
monitorUuids: [{
|
|
20
|
+
uuid: _sp20Protocol.SP20_NOTIFY,
|
|
21
|
+
parsingModel: acceptNothing
|
|
22
|
+
}],
|
|
23
|
+
writeUuid: {
|
|
24
|
+
uuid: _sp20Protocol.SP20_WRITE,
|
|
25
|
+
mainCommandUuid: "aa55"
|
|
26
|
+
}
|
|
27
|
+
}];
|
|
28
|
+
|
|
29
|
+
/** ViHealth SP-20, SP-20-BLE, and SP-20-WPS encrypted realtime oximeter. */
|
|
30
|
+
class Sp20Device extends _btManagedDevice.BTManagedDevice {
|
|
31
|
+
mainServices = sp20MainServices;
|
|
32
|
+
stuckDataTimeout = 60_000;
|
|
33
|
+
onStreamStart = undefined;
|
|
34
|
+
preferredMtu = 247;
|
|
35
|
+
getSupportedMeasurementTypeKeys() {
|
|
36
|
+
return [_core.MeasurementTypeKey.bloodOxygenPulseRate];
|
|
37
|
+
}
|
|
38
|
+
constructor(device, params) {
|
|
39
|
+
super(device, params);
|
|
40
|
+
this.frameReader = new _sp20Protocol.Sp20FrameReader();
|
|
41
|
+
this.createCommandSequencer = () => new _sp20Sequencer.Sp20Sequencer({
|
|
42
|
+
write: {
|
|
43
|
+
serviceUuid: _sp20Protocol.SP20_SERVICE,
|
|
44
|
+
characteristicUuid: _sp20Protocol.SP20_WRITE
|
|
45
|
+
},
|
|
46
|
+
onResult: result => this.onResult?.(result)
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
handleSuccessResult() {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.Sp20Device = Sp20Device;
|
|
54
|
+
//# sourceMappingURL=sp20.device.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_core","require","_btManagedDevice","_sp20Protocol","_sp20Sequencer","acceptNothing","caseValuePosition","cases","sp20MainServices","exports","uuid","SP20_SERVICE","monitorUuids","SP20_NOTIFY","parsingModel","writeUuid","SP20_WRITE","mainCommandUuid","Sp20Device","BTManagedDevice","mainServices","stuckDataTimeout","onStreamStart","undefined","preferredMtu","getSupportedMeasurementTypeKeys","MeasurementTypeKey","bloodOxygenPulseRate","constructor","device","params","frameReader","Sp20FrameReader","createCommandSequencer","Sp20Sequencer","write","serviceUuid","characteristicUuid","onResult","result","handleSuccessResult"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/sp20.device.ts"],"mappings":";;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAQA,IAAAC,gBAAA,GAAAD,OAAA;AAEA,IAAAE,aAAA,GAAAF,OAAA;AAMA,IAAAG,cAAA,GAAAH,OAAA;AAlBA;;AAyBA,MAAMI,aAAa,GAAG;EAAEC,iBAAiB,EAAE,EAAE;EAAEC,KAAK,EAAE;AAAG,CAAC;AAEnD,MAAMC,gBAA4B,GAAAC,OAAA,CAAAD,gBAAA,GAAG,CAC1C;EACEE,IAAI,EAAEC,0BAAY;EAClBC,YAAY,EAAE,CAAC;IAAEF,IAAI,EAAEG,yBAAW;IAAEC,YAAY,EAAET;EAAc,CAAC,CAAC;EAClEU,SAAS,EAAE;IAAEL,IAAI,EAAEM,wBAAU;IAAEC,eAAe,EAAE;EAAO;AACzD,CAAC,CACF;;AAED;AACO,MAAMC,UAAU,SAASC,gCAAe,CAAe;EAClDC,YAAY,GAAGZ,gBAAgB;EAC/Ba,gBAAgB,GAAG,MAAM;EACzBC,aAAa,GAAGC,SAAS;EAChBC,YAAY,GAAG,GAAG;EAClBC,+BAA+BA,CAAA,EAAyB;IACzE,OAAO,CAACC,wBAAkB,CAACC,oBAAoB,CAAC;EAClD;EAEOC,WAAWA,CAChBC,MAAc,EACdC,MAAwC,EACxC;IACA,KAAK,CAACD,MAAM,EAAEC,MAAM,CAAC;IACrB,IAAI,CAACC,WAAW,GAAG,IAAIC,6BAAe,CAAC,CAAC;IACxC,IAAI,CAACC,sBAAsB,GAAG,MAC5B,IAAIC,4BAAa,CAAC;MAChBC,KAAK,EAAE;QAAEC,WAAW,EAAEzB,0BAAY;QAAE0B,kBAAkB,EAAErB;MAAW,CAAC;MACpEsB,QAAQ,EAAGC,MAAM,IACf,IAAI,CAACD,QAAQ,GACXC,MAGF;IACJ,CAAC,CAAC;EACN;EAEUC,mBAAmBA,CAAA,EAAS;IACpC;EACF;AACF;AAAC/B,OAAA,CAAAS,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.parseSp20OximeterReading = exports.decodeSp20Frame = exports.buildSp20Frame = exports.Sp20FrameReader = exports.SP20_WRITE = exports.SP20_SERVICE = exports.SP20_NOTIFY = void 0;
|
|
7
|
+
var _frameReadStatus = require("../../../types/frame-read-status.js");
|
|
8
|
+
var _calculateCrc8Pc = require("../../../utils/calculate-crc-8-pc.js");
|
|
9
|
+
var _hexToByte = require("../../../utils/hex-to-byte.js");
|
|
10
|
+
/* eslint-disable import/group-exports */
|
|
11
|
+
|
|
12
|
+
const SP20_SERVICE = exports.SP20_SERVICE = "0000fff0-0000-1000-8000-00805f9b34fb";
|
|
13
|
+
const SP20_NOTIFY = exports.SP20_NOTIFY = "0000fff1-0000-1000-8000-00805f9b34fb";
|
|
14
|
+
const SP20_WRITE = exports.SP20_WRITE = "0000fff2-0000-1000-8000-00805f9b34fb";
|
|
15
|
+
const byte = value => (value & 0xff).toString(16).padStart(2, "0");
|
|
16
|
+
const buildSp20Frame = (token, type, payload = []) => {
|
|
17
|
+
const frame = ["aa", "55", byte(token), byte(payload.length + 2), byte(type), ...payload.map(byte), "00"];
|
|
18
|
+
frame[frame.length - 1] = byte((0, _calculateCrc8Pc.calculateCrc8Pc)(frame));
|
|
19
|
+
return frame;
|
|
20
|
+
};
|
|
21
|
+
exports.buildSp20Frame = buildSp20Frame;
|
|
22
|
+
const decodeSp20Frame = frame => {
|
|
23
|
+
if ((0, _hexToByte.hexToByte)(frame[0] ?? "00") !== 0xaa || (0, _hexToByte.hexToByte)(frame[1] ?? "00") !== 0x55 || frame.length < 6 || frame.length !== (0, _hexToByte.hexToByte)(frame[3] ?? "00") + 4 || (0, _calculateCrc8Pc.calculateCrc8Pc)(frame) !== (0, _hexToByte.hexToByte)(frame.at(-1) ?? "00")) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
token: (0, _hexToByte.hexToByte)(frame[2] ?? "00"),
|
|
28
|
+
type: (0, _hexToByte.hexToByte)(frame[4] ?? "00"),
|
|
29
|
+
content: frame.slice(5, -1).map(value => (0, _hexToByte.hexToByte)(value)),
|
|
30
|
+
cipherText: frame.slice(4, -1).map(value => (0, _hexToByte.hexToByte)(value))
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
exports.decodeSp20Frame = decodeSp20Frame;
|
|
34
|
+
const parseSp20OximeterReading = content => {
|
|
35
|
+
if (content.length < 6) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
const flags = content[4] ?? 0;
|
|
39
|
+
return {
|
|
40
|
+
bloodOxygen: content[0] ?? 0,
|
|
41
|
+
pulseRate: (content[1] ?? 0) | (content[2] ?? 0) << 8,
|
|
42
|
+
perfusionIndex: content[3] ?? 0,
|
|
43
|
+
probeOff: (flags & 0x02) !== 0,
|
|
44
|
+
pulseSearching: (flags & 0x04) !== 0,
|
|
45
|
+
checkProbe: (flags & 0x08) !== 0
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/** AA55 frames carry their length at byte 3; notifications may split or batch them. */
|
|
50
|
+
exports.parseSp20OximeterReading = parseSp20OximeterReading;
|
|
51
|
+
class Sp20FrameReader {
|
|
52
|
+
readFrame(buffer) {
|
|
53
|
+
const start = this.findHeader(buffer);
|
|
54
|
+
if (start < 0) {
|
|
55
|
+
return {
|
|
56
|
+
status: _frameReadStatus.FrameReadStatus.INCOMPLETE,
|
|
57
|
+
consumedBytes: Math.max(0, buffer.length - 1)
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
if (start + 4 > buffer.length) {
|
|
61
|
+
return {
|
|
62
|
+
status: _frameReadStatus.FrameReadStatus.INCOMPLETE,
|
|
63
|
+
consumedBytes: start
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
const length = (0, _hexToByte.hexToByte)(buffer[start + 3] ?? "00") + 4;
|
|
67
|
+
if (length < 6) {
|
|
68
|
+
return {
|
|
69
|
+
status: _frameReadStatus.FrameReadStatus.CORRUPT,
|
|
70
|
+
consumedBytes: start + 2
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
if (start + length > buffer.length) {
|
|
74
|
+
return {
|
|
75
|
+
status: _frameReadStatus.FrameReadStatus.INCOMPLETE,
|
|
76
|
+
consumedBytes: start
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
const frame = buffer.slice(start, start + length);
|
|
80
|
+
if ((0, _calculateCrc8Pc.calculateCrc8Pc)(frame) !== (0, _hexToByte.hexToByte)(frame.at(-1) ?? "00")) {
|
|
81
|
+
return {
|
|
82
|
+
status: _frameReadStatus.FrameReadStatus.CORRUPT,
|
|
83
|
+
consumedBytes: start + 2
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
status: _frameReadStatus.FrameReadStatus.COMPLETE,
|
|
88
|
+
consumedBytes: start + length,
|
|
89
|
+
frame
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
findHeader = buffer => {
|
|
93
|
+
for (let index = 0; index < buffer.length - 1; index += 1) {
|
|
94
|
+
if ((0, _hexToByte.hexToByte)(buffer[index] ?? "00") === 0xaa && (0, _hexToByte.hexToByte)(buffer[index + 1] ?? "00") === 0x55) {
|
|
95
|
+
return index;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return -1;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
exports.Sp20FrameReader = Sp20FrameReader;
|
|
102
|
+
//# sourceMappingURL=sp20.protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_frameReadStatus","require","_calculateCrc8Pc","_hexToByte","SP20_SERVICE","exports","SP20_NOTIFY","SP20_WRITE","byte","value","toString","padStart","buildSp20Frame","token","type","payload","frame","length","map","calculateCrc8Pc","decodeSp20Frame","hexToByte","at","undefined","content","slice","cipherText","parseSp20OximeterReading","flags","bloodOxygen","pulseRate","perfusionIndex","probeOff","pulseSearching","checkProbe","Sp20FrameReader","readFrame","buffer","start","findHeader","status","FrameReadStatus","INCOMPLETE","consumedBytes","Math","max","CORRUPT","COMPLETE","index"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/sp20.protocol.ts"],"mappings":";;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AAEA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AANA;;AAQO,MAAMG,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,sCAAsC;AAC3D,MAAME,WAAW,GAAAD,OAAA,CAAAC,WAAA,GAAG,sCAAsC;AAC1D,MAAMC,UAAU,GAAAF,OAAA,CAAAE,UAAA,GAAG,sCAAsC;AAEhE,MAAMC,IAAI,GAAI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KAAK,IAAIW,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGX,MAAM,CAACpB,MAAM,GAAG,CAAC,EAAE+B,KAAK,IAAI,CAAC,EAAE;MACzD,IACE,IAAA3B,oBAAS,EAACgB,MAAM,CAACW,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,IACzC,IAAA3B,oBAAS,EAACgB,MAAM,CAACW,KAAK,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,EAC7C;QACA,OAAOA,KAAK;MACd;IACF;IAEA,OAAO,CAAC,CAAC;EACX,CAAC;AACH;AAAC3C,OAAA,CAAA8B,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Sp20Sequencer = void 0;
|
|
7
|
+
var _core = require("@ovok/core");
|
|
8
|
+
var _caseType = require("../../../types/case-type.js");
|
|
9
|
+
var _calculateCrc8Pc = require("../../../utils/calculate-crc-8-pc.js");
|
|
10
|
+
var _sp20Protocol = require("./sp20.protocol.js");
|
|
11
|
+
var _viatomLepuCrypto = require("./viatom-lepu-crypto.js");
|
|
12
|
+
const command = (write, frame) => ({
|
|
13
|
+
...write,
|
|
14
|
+
frame,
|
|
15
|
+
withoutResponse: true
|
|
16
|
+
});
|
|
17
|
+
const validOxygen = value => value >= 50 && value <= 100;
|
|
18
|
+
const validPulse = value => value > 0 && value <= 300;
|
|
19
|
+
|
|
20
|
+
/** Handles the encrypted AA55 exchange used by the ViHealth SP-20 variants. */
|
|
21
|
+
class Sp20Sequencer {
|
|
22
|
+
phase = "authenticate";
|
|
23
|
+
constructor(params) {
|
|
24
|
+
this.params = params;
|
|
25
|
+
}
|
|
26
|
+
initialCommands = () => {
|
|
27
|
+
const token = (0, _viatomLepuCrypto.createLepuAccessToken)(this.params.now?.() ?? new Date());
|
|
28
|
+
return [this.write((0, _sp20Protocol.buildSp20Frame)(0xff, 0x81, token))];
|
|
29
|
+
};
|
|
30
|
+
nextCommand = frame => {
|
|
31
|
+
const raw = (0, _sp20Protocol.decodeSp20Frame)(frame);
|
|
32
|
+
if (!raw) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
const response = this.decodePayload(raw);
|
|
36
|
+
if (!response) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
if (this.phase === "authenticate") {
|
|
40
|
+
return this.acceptHandshake(raw, response);
|
|
41
|
+
}
|
|
42
|
+
if (this.phase === "clock" && response.token === 0x0f && response.type === 7) {
|
|
43
|
+
this.phase = "parameters";
|
|
44
|
+
return [this.encryptedCommand(0x84, [1])];
|
|
45
|
+
}
|
|
46
|
+
if (this.phase === "parameters" && response.token === 0x0f && response.type === 4) {
|
|
47
|
+
this.phase = "wave";
|
|
48
|
+
return [this.encryptedCommand(0x85, [1])];
|
|
49
|
+
}
|
|
50
|
+
if (this.phase === "wave" && response.token === 0x0f && response.type === 5) {
|
|
51
|
+
this.phase = "ready";
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
if (this.phase === "ready" && response.token === 0xf0 && response.type === 1) {
|
|
55
|
+
this.report(response.content);
|
|
56
|
+
}
|
|
57
|
+
return undefined;
|
|
58
|
+
};
|
|
59
|
+
decodePayload = response => {
|
|
60
|
+
if (response.token === 0xff && !this.sessionKey) {
|
|
61
|
+
return response;
|
|
62
|
+
}
|
|
63
|
+
if (!this.sessionKey) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
const decrypted = (0, _viatomLepuCrypto.decryptLepuPayload)(response.cipherText, this.sessionKey);
|
|
67
|
+
return decrypted?.length ? {
|
|
68
|
+
token: response.token,
|
|
69
|
+
type: decrypted[0] ?? 0,
|
|
70
|
+
content: decrypted.slice(1),
|
|
71
|
+
cipherText: response.cipherText
|
|
72
|
+
} : undefined;
|
|
73
|
+
};
|
|
74
|
+
acceptHandshake = (raw, response) => {
|
|
75
|
+
if (raw.token !== 0xff || raw.type !== 1) {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
const key = (0, _viatomLepuCrypto.parseLepuSessionKey)((0, _viatomLepuCrypto.decryptLepuHandshake)(response.content));
|
|
79
|
+
if (!key) {
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
this.sessionKey = key;
|
|
83
|
+
this.phase = "clock";
|
|
84
|
+
return [this.encryptedCommand(0x87, this.timePayload())];
|
|
85
|
+
};
|
|
86
|
+
encryptedCommand = (type, payload) => {
|
|
87
|
+
const encrypted = (0, _viatomLepuCrypto.encryptLepuPayload)([type, ...payload], this.sessionKey ?? []);
|
|
88
|
+
const frame = ["aa", "55", "0f", (encrypted.length + 1 & 0xff).toString(16).padStart(2, "0"), ...encrypted.map(value => value.toString(16).padStart(2, "0")), "00"];
|
|
89
|
+
frame[frame.length - 1] = (0, _calculateCrc8Pc.calculateCrc8Pc)(frame).toString(16).padStart(2, "0");
|
|
90
|
+
return this.write(frame);
|
|
91
|
+
};
|
|
92
|
+
timePayload = () => {
|
|
93
|
+
const date = this.params.now?.() ?? new Date();
|
|
94
|
+
return [date.getFullYear() >>> 8 & 0xff, date.getFullYear() & 0xff, date.getMonth() + 1, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()];
|
|
95
|
+
};
|
|
96
|
+
report = content => {
|
|
97
|
+
const reading = (0, _sp20Protocol.parseSp20OximeterReading)(content);
|
|
98
|
+
if (!reading || reading.probeOff || reading.pulseSearching || reading.checkProbe || !validOxygen(reading.bloodOxygen) || !validPulse(reading.pulseRate)) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
this.params.onResult({
|
|
102
|
+
caseType: _caseType.CaseType.RESULT,
|
|
103
|
+
measurementTypeKey: _core.MeasurementTypeKey.bloodOxygenPulseRate,
|
|
104
|
+
bloodOxygen: reading.bloodOxygen,
|
|
105
|
+
pulseRate: reading.pulseRate,
|
|
106
|
+
...(reading.perfusionIndex > 0 ? {
|
|
107
|
+
perfusionIndex: reading.perfusionIndex
|
|
108
|
+
} : {}),
|
|
109
|
+
recordedAt: this.params.now?.() ?? new Date()
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
write = frame => command(this.params.write, frame);
|
|
113
|
+
}
|
|
114
|
+
exports.Sp20Sequencer = Sp20Sequencer;
|
|
115
|
+
//# sourceMappingURL=sp20.sequencer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_core","require","_caseType","_calculateCrc8Pc","_sp20Protocol","_viatomLepuCrypto","command","write","frame","withoutResponse","validOxygen","value","validPulse","Sp20Sequencer","phase","constructor","params","initialCommands","token","createLepuAccessToken","now","Date","buildSp20Frame","nextCommand","raw","decodeSp20Frame","undefined","response","decodePayload","acceptHandshake","type","encryptedCommand","report","content","sessionKey","decrypted","decryptLepuPayload","cipherText","length","slice","key","parseLepuSessionKey","decryptLepuHandshake","timePayload","payload","encrypted","encryptLepuPayload","toString","padStart","map","calculateCrc8Pc","date","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","reading","parseSp20OximeterReading","probeOff","pulseSearching","checkProbe","bloodOxygen","pulseRate","onResult","caseType","CaseType","RESULT","measurementTypeKey","MeasurementTypeKey","bloodOxygenPulseRate","perfusionIndex","recordedAt","exports"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/sp20.sequencer.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAIA,IAAAE,gBAAA,GAAAF,OAAA;AAEA,IAAAG,aAAA,GAAAH,OAAA;AAMA,IAAAI,iBAAA,GAAAJ,OAAA;AAgBA,MAAMK,OAAO,GAAGA,CACdC,KAAmC,EACnCC,KAAwB,MACL;EAAE,GAAGD,KAAK;EAAEC,KAAK;EAAEC,eAAe,EAAE;AAAK,CAAC,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AAM,CAACI,GAAG,GAAG,CAAC,IAAI,IAAIC,IAAI,CAAC;IAC9C,CAAC,CAAC;EACJ,CAAC;EAEOd,KAAK,GAAIC,KAAwB,IACvCF,OAAO,CAAC,IAAI,CAACU,MAAM,CAACT,KAAK,EAAEC,KAAK,CAAC;AAErC;AAACkE,OAAA,CAAA7D,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.parseLepuSessionKey = exports.encryptLepuPayload = exports.decryptLepuPayload = exports.decryptLepuHandshake = exports.createLepuAccessToken = void 0;
|
|
7
|
+
var _cryptoJs = _interopRequireDefault(require("crypto-js"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
/* eslint-disable import/group-exports */
|
|
10
|
+
|
|
11
|
+
const LEPU_CIPHER_KEY = "c2a7cf50dafed885a8f8f7eac44335f3";
|
|
12
|
+
const DEFAULT_ENCRYPTION_ID = "0000";
|
|
13
|
+
const AES_BLOCK_BYTES = 16;
|
|
14
|
+
const toHex = bytes => bytes.map(value => (value & 0xff).toString(16).padStart(2, "0")).join("");
|
|
15
|
+
const fromHex = hex => hex.match(/.{2}/g)?.map(value => Number.parseInt(value, 16)) ?? [];
|
|
16
|
+
const lepuXor = bytes => {
|
|
17
|
+
const key = fromHex(LEPU_CIPHER_KEY);
|
|
18
|
+
return bytes.map((value, index) => value ^ (key[index % key.length] ?? 0));
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** Builds the vendor's four-character client token without logging identity or key bytes. */
|
|
22
|
+
const createLepuAccessToken = (now = new Date(), encryptionId = DEFAULT_ENCRYPTION_ID) => {
|
|
23
|
+
const idBytes = Array.from(encryptionId, character => character.charCodeAt(0));
|
|
24
|
+
if (idBytes.length !== 4 || idBytes.some(value => value > 0x7f)) {
|
|
25
|
+
throw new Error("Lepu encryption ID must be four ASCII characters.");
|
|
26
|
+
}
|
|
27
|
+
const key = fromHex(LEPU_CIPHER_KEY);
|
|
28
|
+
const token = Array(16).fill(0);
|
|
29
|
+
for (let index = 0; index < 8; index += 1) {
|
|
30
|
+
token[index] = key[index * 2] ?? 0;
|
|
31
|
+
}
|
|
32
|
+
token.splice(8, 4, ...idBytes);
|
|
33
|
+
const epochSeconds = Math.floor(now.getTime() / 1000);
|
|
34
|
+
for (let index = 0; index < 4; index += 1) {
|
|
35
|
+
token[index + 12] = epochSeconds >> index & 0xff;
|
|
36
|
+
}
|
|
37
|
+
return lepuXor(token);
|
|
38
|
+
};
|
|
39
|
+
exports.createLepuAccessToken = createLepuAccessToken;
|
|
40
|
+
const decryptLepuHandshake = encrypted => lepuXor(encrypted);
|
|
41
|
+
exports.decryptLepuHandshake = decryptLepuHandshake;
|
|
42
|
+
const parseLepuSessionKey = handshake => {
|
|
43
|
+
if (handshake.length < 4 || handshake[0] !== 1) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
const length = handshake[1] ?? 0;
|
|
47
|
+
const key = handshake.slice(4, 4 + length);
|
|
48
|
+
return key.length === length && [16, 24, 32].includes(length) ? key : undefined;
|
|
49
|
+
};
|
|
50
|
+
exports.parseLepuSessionKey = parseLepuSessionKey;
|
|
51
|
+
const encryptLepuPayload = (payload, sessionKey) => {
|
|
52
|
+
if (![16, 24, 32].includes(sessionKey.length)) {
|
|
53
|
+
throw new Error("Invalid Lepu AES session key length.");
|
|
54
|
+
}
|
|
55
|
+
const encrypted = _cryptoJs.default.AES.encrypt(_cryptoJs.default.enc.Hex.parse(toHex(payload)), _cryptoJs.default.enc.Hex.parse(toHex(sessionKey)), {
|
|
56
|
+
mode: _cryptoJs.default.mode.ECB,
|
|
57
|
+
padding: _cryptoJs.default.pad.Pkcs7
|
|
58
|
+
});
|
|
59
|
+
return fromHex(_cryptoJs.default.enc.Hex.stringify(encrypted.ciphertext));
|
|
60
|
+
};
|
|
61
|
+
exports.encryptLepuPayload = encryptLepuPayload;
|
|
62
|
+
const decryptLepuPayload = (encrypted, sessionKey) => {
|
|
63
|
+
if (![16, 24, 32].includes(sessionKey.length) || encrypted.length === 0 || encrypted.length % AES_BLOCK_BYTES !== 0) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
const ciphertext = _cryptoJs.default.lib.CipherParams.create({
|
|
67
|
+
ciphertext: _cryptoJs.default.enc.Hex.parse(toHex(encrypted))
|
|
68
|
+
});
|
|
69
|
+
const decrypted = _cryptoJs.default.AES.decrypt(ciphertext, _cryptoJs.default.enc.Hex.parse(toHex(sessionKey)), {
|
|
70
|
+
mode: _cryptoJs.default.mode.ECB,
|
|
71
|
+
padding: _cryptoJs.default.pad.NoPadding
|
|
72
|
+
});
|
|
73
|
+
const unpadded = fromHex(_cryptoJs.default.enc.Hex.stringify(decrypted));
|
|
74
|
+
const paddingLength = unpadded.at(-1) ?? 0;
|
|
75
|
+
if (paddingLength === 0 || paddingLength > AES_BLOCK_BYTES || unpadded.length < paddingLength || unpadded.slice(-paddingLength).some(value => value !== paddingLength)) {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
return unpadded.slice(0, -paddingLength);
|
|
79
|
+
};
|
|
80
|
+
exports.decryptLepuPayload = decryptLepuPayload;
|
|
81
|
+
//# sourceMappingURL=viatom-lepu-crypto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_cryptoJs","_interopRequireDefault","require","e","__esModule","default","LEPU_CIPHER_KEY","DEFAULT_ENCRYPTION_ID","AES_BLOCK_BYTES","toHex","bytes","map","value","toString","padStart","join","fromHex","hex","match","Number","parseInt","lepuXor","key","index","length","createLepuAccessToken","now","Date","encryptionId","idBytes","Array","from","character","charCodeAt","some","Error","token","fill","splice","epochSeconds","Math","floor","getTime","exports","decryptLepuHandshake","encrypted","parseLepuSessionKey","handshake","undefined","slice","includes","encryptLepuPayload","payload","sessionKey","CryptoJS","AES","encrypt","enc","Hex","parse","mode","ECB","padding","pad","Pkcs7","stringify","ciphertext","decryptLepuPayload","lib","CipherParams","create","decrypted","decrypt","NoPadding","unpadded","paddingLength","at"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/viatom/viatom-lepu-crypto.ts"],"mappings":";;;;;;AAEA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAiC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAFjC;;AAIA,MAAMG,eAAe,GAAG,kCAAkC;AAC1D,MAAMC,qBAAqB,GAAG,MAAM;AACpC,MAAMC,eAAe,GAAG,EAAE;AAE1B,MAAMC,KAAK,GAAIC,KAAwB,IACrCA,KAAK,CAACC,GAAG,CAAEC,KAAK,IAAK,CAACA,KAAK,GAAG,IAAI,EAAEC,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAACC,IAAI,CAAC,EAAE,CAAC;AAE7E,MAAMC,OAAO,GAAIC,GAAW,IAC1BA,GAAG,CAACC,KAAK,CAAC,OAAO,CAAC,EAAEP,GAAG,CAAEC,KAAK,IAAKO,MAAM,CAACC,QAAQ,CAACR,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE;AAEtE,MAAMS,OAAO,GAAIX,KAAwB,IAAe;EACtD,MAAMY,GAAG,GAAGN,OAAO,CAACV,eAAe,CAAC;EAEpC,OAAOI,KAAK,CAACC,GAAG,CAAC,CAACC,KAAK,EAAEW,KAAK,KAAKX,KAAK,IAAIU,GAAG,CAACC,KAAK,GAAGD,GAAG,CAACE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AAC5E,CAAC;;AAED;AACO,MAAMC,qBAAqB,GAAGA,CACnCC,GAAS,GAAG,IAAIC,IAAI,CAAC,CAA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AC,EACvE;IACA,OAAO3B,SAAS;EAClB;EAEA,OAAO0B,QAAQ,CAACzB,KAAK,CAAC,CAAC,EAAE,CAAC0B,aAAa,CAAC;AAC1C,CAAC;AAAChC,OAAA,CAAAwB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.viatomR20MainServices = exports.ViatomR20Device = void 0;
|
|
7
|
+
var _btManagedDevice = require("../bt-managed-device.js");
|
|
8
|
+
var _viatomR20Protocol = require("./viatom-r20.protocol.js");
|
|
9
|
+
var _viatomR20Sequencer = require("./viatom-r20.sequencer.js");
|
|
10
|
+
/* eslint-disable import/group-exports */
|
|
11
|
+
|
|
12
|
+
const acceptNothing = {
|
|
13
|
+
caseValuePosition: [],
|
|
14
|
+
cases: []
|
|
15
|
+
};
|
|
16
|
+
const viatomR20MainServices = exports.viatomR20MainServices = [{
|
|
17
|
+
uuid: _viatomR20Protocol.VIATOM_R20_SERVICE,
|
|
18
|
+
monitorUuids: [{
|
|
19
|
+
uuid: _viatomR20Protocol.VIATOM_R20_NOTIFY,
|
|
20
|
+
parsingModel: acceptNothing
|
|
21
|
+
}],
|
|
22
|
+
writeUuid: {
|
|
23
|
+
uuid: _viatomR20Protocol.VIATOM_R20_WRITE,
|
|
24
|
+
mainCommandUuid: "a5"
|
|
25
|
+
}
|
|
26
|
+
}];
|
|
27
|
+
/** ViHealth LeRes-A/R20 and LeRes-C/R200 ventilators use the same A5 BLE service. */
|
|
28
|
+
class ViatomR20Device extends _btManagedDevice.BTManagedDevice {
|
|
29
|
+
mainServices = viatomR20MainServices;
|
|
30
|
+
stuckDataTimeout = 60_000;
|
|
31
|
+
onStreamStart = undefined;
|
|
32
|
+
preferredMtu = 247;
|
|
33
|
+
getSupportedMeasurementTypeKeys() {
|
|
34
|
+
return [_viatomR20Protocol.VIATOM_R20_MEASUREMENT_TYPE];
|
|
35
|
+
}
|
|
36
|
+
constructor(device, params) {
|
|
37
|
+
super(device, {
|
|
38
|
+
...params,
|
|
39
|
+
oneReadingPerConnection: params.oneReadingPerConnection ?? true
|
|
40
|
+
});
|
|
41
|
+
this.frameReader = new _viatomR20Protocol.ViatomR20FrameReader();
|
|
42
|
+
this.createCommandSequencer = () => new _viatomR20Sequencer.ViatomR20Sequencer({
|
|
43
|
+
encrypted: (0, _viatomR20Protocol.parseViatomR20Advertisement)(device.manufacturerData).encrypted,
|
|
44
|
+
write: {
|
|
45
|
+
serviceUuid: _viatomR20Protocol.VIATOM_R20_SERVICE,
|
|
46
|
+
characteristicUuid: _viatomR20Protocol.VIATOM_R20_WRITE
|
|
47
|
+
},
|
|
48
|
+
clockSync: params.clockSync,
|
|
49
|
+
onResult: result => this.onResult?.(result)
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
handleSuccessResult() {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.ViatomR20Device = ViatomR20Device;
|
|
57
|
+
//# sourceMappingURL=viatom-r20.device.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_btManagedDevice","require","_viatomR20Protocol","_viatomR20Sequencer","acceptNothing","caseValuePosition","cases","viatomR20MainServices","exports","uuid","VIATOM_R20_SERVICE","monitorUuids","VIATOM_R20_NOTIFY","parsingModel","writeUuid","VIATOM_R20_WRITE","mainCommandUuid","ViatomR20Device","BTManagedDevice","mainServices","stuckDataTimeout","onStreamStart","undefined","preferredMtu","getSupportedMeasurementTypeKeys","VIATOM_R20_MEASUREMENT_TYPE","constructor","device","params","oneReadingPerConnection","frameReader","ViatomR20FrameReader","createCommandSequencer","ViatomR20Sequencer","encrypted","parseViatomR20Advertisement","manufacturerData","write","serviceUuid","characteristicUuid","clockSync","onResult","result","handleSuccessResult"],"sourceRoot":"../../../../../../../src","sources":["modules/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