@ovok/native 1.16.1-rc.6 → 1.16.1-rc.7
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-management/components/bt-provider-child-wrapper.js +19 -7
- package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
- package/lib/commonjs/modules/bt-management/hooks/runtime-context.js.map +1 -1
- package/lib/commonjs/modules/bt-management/index.js +12 -0
- package/lib/commonjs/modules/bt-management/index.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/bt-manager.js +27 -1
- package/lib/commonjs/modules/bt-management/services/bt-manager.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/custom/compile-custom-lepu.js +39 -0
- package/lib/commonjs/modules/bt-management/services/custom/compile-custom-lepu.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.device.js +36 -10
- package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.device.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.frame-reader.js +2 -2
- package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.frame-reader.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.history-sequencer.js +69 -25
- package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.history-sequencer.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js +30 -2
- package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-data-processor.js +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-data-processor.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js +48 -3
- package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js +6 -2
- package/lib/commonjs/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js +113 -24
- package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.advertisement.js +19 -2
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.advertisement.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.connect-retry.js +32 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.connect-retry.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.delivered-files.js +73 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.delivered-files.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.js +130 -30
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.js +103 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.file-transfer.js +20 -14
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.file-transfer.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.frame-reader.js +4 -2
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.frame-reader.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.identity-gate.js +94 -10
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.identity-gate.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.js +75 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.js +113 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.pulse-wave.js +67 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.pulse-wave.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.recorder.js +55 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.recorder.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.recording-watch.js +57 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.recording-watch.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.session.js +49 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.session.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.stored-files.js +46 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.stored-files.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.transports.js +10 -4
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.transports.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.waveform.js +27 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.waveform.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js +0 -1
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-files.js +3 -5
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-files.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js +17 -8
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.js +47 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.oximeters.js +58 -32
- package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.oximeters.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/series-recorder.js +27 -5
- package/lib/commonjs/modules/bt-management/services/series-recorder.js.map +1 -1
- package/lib/commonjs/modules/bt-management/types/device-waveform.js +6 -0
- package/lib/commonjs/modules/bt-management/types/device-waveform.js.map +1 -0
- package/lib/commonjs/modules/bt-management/utils/i-16-from-hex.js.map +1 -1
- package/lib/commonjs/modules/bt-management/utils/le-32-from-hex.js.map +1 -1
- package/lib/commonjs/modules/data-sync/components/apple/apple-health-authorization-provider.js +15 -8
- package/lib/commonjs/modules/data-sync/components/apple/apple-health-authorization-provider.js.map +1 -1
- package/lib/commonjs/modules/data-sync/components/apple/apple-health-authorization-utils.js +1 -1
- package/lib/commonjs/modules/data-sync/components/apple/apple-health-authorization-utils.js.map +1 -1
- package/lib/commonjs/modules/data-sync/constants.js +4 -1
- package/lib/commonjs/modules/data-sync/constants.js.map +1 -1
- package/lib/commonjs/modules/data-sync/hooks/use-listen-changes.js +6 -9
- package/lib/commonjs/modules/data-sync/hooks/use-listen-changes.js.map +1 -1
- package/lib/commonjs/modules/data-sync/services/managers/data-processor.js +1 -0
- package/lib/commonjs/modules/data-sync/services/managers/data-processor.js.map +1 -1
- package/lib/commonjs/modules/data-sync/types/health-sync-keys.js +13 -0
- package/lib/commonjs/modules/data-sync/types/health-sync-keys.js.map +1 -1
- package/lib/commonjs/modules/data-sync/utils/convert-ecg-samples-to-observation.js +47 -0
- package/lib/commonjs/modules/data-sync/utils/convert-ecg-samples-to-observation.js.map +1 -0
- package/lib/commonjs/modules/data-sync/utils/convert-generic-health-data.js +6 -3
- package/lib/commonjs/modules/data-sync/utils/convert-generic-health-data.js.map +1 -1
- package/lib/commonjs/modules/data-sync/utils/convert-samples-to-observation.js +7 -15
- package/lib/commonjs/modules/data-sync/utils/convert-samples-to-observation.js.map +1 -1
- package/lib/commonjs/modules/data-sync/utils/default-health-coding.js +25 -4
- package/lib/commonjs/modules/data-sync/utils/default-health-coding.js.map +1 -1
- package/lib/commonjs/modules/data-sync/utils/get-records-from-health-connect.js +20 -4
- package/lib/commonjs/modules/data-sync/utils/get-records-from-health-connect.js.map +1 -1
- package/lib/commonjs/modules/data-sync/utils/get-samples-from-health.js +43 -86
- package/lib/commonjs/modules/data-sync/utils/get-samples-from-health.js.map +1 -1
- package/lib/commonjs/modules/data-sync/utils/get-total-samples-count.js +6 -5
- package/lib/commonjs/modules/data-sync/utils/get-total-samples-count.js.map +1 -1
- package/lib/commonjs/modules/data-sync/utils/health-data-catalog.js +15 -15
- package/lib/commonjs/modules/data-sync/utils/health-data-catalog.js.map +1 -1
- package/lib/commonjs/modules/data-sync/utils/health-units.js +6 -1
- package/lib/commonjs/modules/data-sync/utils/health-units.js.map +1 -1
- package/lib/commonjs/modules/data-sync/utils/healthkit-daily-statistics.js +64 -0
- package/lib/commonjs/modules/data-sync/utils/healthkit-daily-statistics.js.map +1 -0
- package/lib/commonjs/modules/data-sync/utils/healthkit-data-types.js.map +1 -1
- package/lib/commonjs/modules/data-sync/utils/healthkit-query-options.js +20 -0
- package/lib/commonjs/modules/data-sync/utils/healthkit-query-options.js.map +1 -0
- package/lib/commonjs/modules/data-sync/utils/healthkit-sample-source.js +21 -0
- package/lib/commonjs/modules/data-sync/utils/healthkit-sample-source.js.map +1 -0
- package/lib/commonjs/modules/data-sync/utils/healthkit-samples.js +59 -0
- package/lib/commonjs/modules/data-sync/utils/healthkit-samples.js.map +1 -0
- package/lib/commonjs/modules/data-sync/utils/healthkit-series.js +20 -11
- package/lib/commonjs/modules/data-sync/utils/healthkit-series.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/ble-plx/built-in-devices.js +12 -2
- package/lib/commonjs/modules/next/bluetooth/ble-plx/built-in-devices.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/ble-plx/legacy-driver.js +39 -5
- package/lib/commonjs/modules/next/bluetooth/ble-plx/legacy-driver.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/connections.js +45 -2
- package/lib/commonjs/modules/next/bluetooth/connections.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/driver.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/errors.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/index.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/readings.js +10 -2
- package/lib/commonjs/modules/next/bluetooth/readings.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/runtime.js +37 -1
- package/lib/commonjs/modules/next/bluetooth/runtime.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/web/index.js.map +1 -1
- package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js +19 -7
- package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
- package/lib/module/modules/bt-management/hooks/runtime-context.js.map +1 -1
- package/lib/module/modules/bt-management/index.js +1 -0
- package/lib/module/modules/bt-management/index.js.map +1 -1
- package/lib/module/modules/bt-management/services/bt-manager.js +27 -1
- package/lib/module/modules/bt-management/services/bt-manager.js.map +1 -1
- package/lib/module/modules/bt-management/services/custom/compile-custom-lepu.js +39 -0
- package/lib/module/modules/bt-management/services/custom/compile-custom-lepu.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bp2/bp2.device.js +36 -10
- package/lib/module/modules/bt-management/services/devices/bp2/bp2.device.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bp2/bp2.frame-reader.js +2 -3
- package/lib/module/modules/bt-management/services/devices/bp2/bp2.frame-reader.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bp2/bp2.history-sequencer.js +68 -25
- package/lib/module/modules/bt-management/services/devices/bp2/bp2.history-sequencer.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-command-writer.js +30 -2
- package/lib/module/modules/bt-management/services/devices/bt-command-writer.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-data-processor.js +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-data-processor.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-managed-device.js +48 -3
- package/lib/module/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js +6 -2
- package/lib/module/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/custom/custom.device.js +113 -24
- package/lib/module/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.advertisement.js +17 -1
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.advertisement.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.connect-retry.js +28 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.connect-retry.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.delivered-files.js +69 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.delivered-files.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.js +129 -30
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.js +99 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.file-transfer.js +20 -14
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.file-transfer.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.frame-reader.js +4 -2
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.frame-reader.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.identity-gate.js +94 -10
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.identity-gate.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.js +72 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.js +109 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.pulse-wave.js +64 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.pulse-wave.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.recorder.js +51 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.recorder.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.recording-watch.js +53 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.recording-watch.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.session.js +45 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.session.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.stored-files.js +42 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.stored-files.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.transports.js +10 -4
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.transports.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.waveform.js +22 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.waveform.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js +0 -1
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-files.js +3 -6
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-files.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js +17 -8
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.js +44 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.oximeters.js +58 -32
- package/lib/module/modules/bt-management/services/devices/viatom/viatom.oximeters.js.map +1 -1
- package/lib/module/modules/bt-management/services/series-recorder.js +27 -5
- package/lib/module/modules/bt-management/services/series-recorder.js.map +1 -1
- package/lib/module/modules/bt-management/types/device-waveform.js +4 -0
- package/lib/module/modules/bt-management/types/device-waveform.js.map +1 -0
- package/lib/module/modules/bt-management/utils/i-16-from-hex.js.map +1 -1
- package/lib/module/modules/bt-management/utils/le-32-from-hex.js.map +1 -1
- package/lib/module/modules/data-sync/components/apple/apple-health-authorization-provider.js +16 -9
- package/lib/module/modules/data-sync/components/apple/apple-health-authorization-provider.js.map +1 -1
- package/lib/module/modules/data-sync/components/apple/apple-health-authorization-utils.js +2 -2
- package/lib/module/modules/data-sync/components/apple/apple-health-authorization-utils.js.map +1 -1
- package/lib/module/modules/data-sync/constants.js +4 -1
- package/lib/module/modules/data-sync/constants.js.map +1 -1
- package/lib/module/modules/data-sync/hooks/use-listen-changes.js +7 -10
- package/lib/module/modules/data-sync/hooks/use-listen-changes.js.map +1 -1
- package/lib/module/modules/data-sync/services/managers/data-processor.js +1 -0
- package/lib/module/modules/data-sync/services/managers/data-processor.js.map +1 -1
- package/lib/module/modules/data-sync/types/health-sync-keys.js +13 -0
- package/lib/module/modules/data-sync/types/health-sync-keys.js.map +1 -1
- package/lib/module/modules/data-sync/utils/convert-ecg-samples-to-observation.js +43 -0
- package/lib/module/modules/data-sync/utils/convert-ecg-samples-to-observation.js.map +1 -0
- package/lib/module/modules/data-sync/utils/convert-generic-health-data.js +6 -3
- package/lib/module/modules/data-sync/utils/convert-generic-health-data.js.map +1 -1
- package/lib/module/modules/data-sync/utils/convert-samples-to-observation.js +7 -15
- package/lib/module/modules/data-sync/utils/convert-samples-to-observation.js.map +1 -1
- package/lib/module/modules/data-sync/utils/default-health-coding.js +25 -4
- package/lib/module/modules/data-sync/utils/default-health-coding.js.map +1 -1
- package/lib/module/modules/data-sync/utils/get-records-from-health-connect.js +20 -4
- package/lib/module/modules/data-sync/utils/get-records-from-health-connect.js.map +1 -1
- package/lib/module/modules/data-sync/utils/get-samples-from-health.js +44 -87
- package/lib/module/modules/data-sync/utils/get-samples-from-health.js.map +1 -1
- package/lib/module/modules/data-sync/utils/get-total-samples-count.js +5 -4
- package/lib/module/modules/data-sync/utils/get-total-samples-count.js.map +1 -1
- package/lib/module/modules/data-sync/utils/health-data-catalog.js +15 -15
- package/lib/module/modules/data-sync/utils/health-data-catalog.js.map +1 -1
- package/lib/module/modules/data-sync/utils/health-units.js +6 -1
- package/lib/module/modules/data-sync/utils/health-units.js.map +1 -1
- package/lib/module/modules/data-sync/utils/healthkit-daily-statistics.js +59 -0
- package/lib/module/modules/data-sync/utils/healthkit-daily-statistics.js.map +1 -0
- package/lib/module/modules/data-sync/utils/healthkit-data-types.js.map +1 -1
- package/lib/module/modules/data-sync/utils/healthkit-query-options.js +16 -0
- package/lib/module/modules/data-sync/utils/healthkit-query-options.js.map +1 -0
- package/lib/module/modules/data-sync/utils/healthkit-sample-source.js +17 -0
- package/lib/module/modules/data-sync/utils/healthkit-sample-source.js.map +1 -0
- package/lib/module/modules/data-sync/utils/healthkit-samples.js +52 -0
- package/lib/module/modules/data-sync/utils/healthkit-samples.js.map +1 -0
- package/lib/module/modules/data-sync/utils/healthkit-series.js +19 -10
- package/lib/module/modules/data-sync/utils/healthkit-series.js.map +1 -1
- package/lib/module/modules/next/bluetooth/ble-plx/built-in-devices.js +12 -2
- package/lib/module/modules/next/bluetooth/ble-plx/built-in-devices.js.map +1 -1
- package/lib/module/modules/next/bluetooth/ble-plx/legacy-driver.js +39 -5
- package/lib/module/modules/next/bluetooth/ble-plx/legacy-driver.js.map +1 -1
- package/lib/module/modules/next/bluetooth/connections.js +45 -2
- package/lib/module/modules/next/bluetooth/connections.js.map +1 -1
- package/lib/module/modules/next/bluetooth/driver.js.map +1 -1
- package/lib/module/modules/next/bluetooth/errors.js.map +1 -1
- package/lib/module/modules/next/bluetooth/index.js.map +1 -1
- package/lib/module/modules/next/bluetooth/readings.js +10 -2
- package/lib/module/modules/next/bluetooth/readings.js.map +1 -1
- package/lib/module/modules/next/bluetooth/runtime.js +37 -1
- package/lib/module/modules/next/bluetooth/runtime.js.map +1 -1
- package/lib/module/modules/next/bluetooth/web/index.js.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/runtime-context.d.ts +4 -1
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/runtime-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts +21 -5
- package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-lepu.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts +2 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.history-sequencer.d.ts +24 -4
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.history-sequencer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-command-writer.d.ts +6 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-command-writer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts +23 -3
- 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/custom/custom-lepu-sequencer.d.ts +6 -3
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts +20 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.advertisement.d.ts +8 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.advertisement.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.connect-retry.d.ts +12 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.connect-retry.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.delivered-files.d.ts +24 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.delivered-files.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.d.ts +40 -5
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.d.ts +20 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts +6 -3
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts +3 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts +26 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.d.ts +42 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.d.ts +28 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave.d.ts +16 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.recorder.d.ts +32 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.recorder.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.recording-watch.d.ts +28 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.recording-watch.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.session.d.ts +17 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.session.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.stored-files.d.ts +33 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.stored-files.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.waveform.d.ts +9 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.waveform.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.bp-monitors.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-files.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-files.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.d.ts +8 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/series-recorder.d.ts +6 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/series-recorder.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/create-device-params.d.ts +7 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/create-device-params.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-lepu-spec.d.ts +42 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-lepu-spec.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-connection-event.d.ts +17 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-connection-event.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-waveform.d.ts +15 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-waveform.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/i-16-from-hex.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/utils/i-16-from-hex.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/utils/le-32-from-hex.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/utils/le-32-from-hex.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/components/apple/apple-health-authorization-provider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/components/apple/apple-health-authorization-utils.d.ts +2 -2
- package/lib/typescript/commonjs/src/modules/data-sync/components/apple/apple-health-authorization-utils.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/constants.d.ts +3 -1
- package/lib/typescript/commonjs/src/modules/data-sync/constants.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/hooks/use-listen-changes.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/services/managers/data-processor.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/types/apple-health-authorization-provider-props.d.ts +2 -2
- package/lib/typescript/commonjs/src/modules/data-sync/types/apple-health-authorization-provider-props.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/types/apple-health-sync-props.d.ts +4 -7
- package/lib/typescript/commonjs/src/modules/data-sync/types/apple-health-sync-props.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/types/get-data-from-provider-props.d.ts +3 -1
- package/lib/typescript/commonjs/src/modules/data-sync/types/get-data-from-provider-props.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/types/health-authorization-status.d.ts +2 -2
- package/lib/typescript/commonjs/src/modules/data-sync/types/health-authorization-status.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/types/health-sync-keys.d.ts +11 -1
- package/lib/typescript/commonjs/src/modules/data-sync/types/health-sync-keys.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/utils/convert-ecg-samples-to-observation.d.ts +6 -0
- package/lib/typescript/commonjs/src/modules/data-sync/utils/convert-ecg-samples-to-observation.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/data-sync/utils/convert-generic-health-data.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/utils/convert-generic-health-data.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/utils/convert-samples-to-observation.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/utils/default-health-coding.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/utils/get-records-from-health-connect.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/utils/get-records-from-health-connect.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/utils/get-samples-from-health.d.ts +12 -46
- package/lib/typescript/commonjs/src/modules/data-sync/utils/get-samples-from-health.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/utils/get-total-samples-count.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/utils/health-data-catalog.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/utils/health-units.d.ts +2 -2
- package/lib/typescript/commonjs/src/modules/data-sync/utils/health-units.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-daily-statistics.d.ts +10 -0
- package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-daily-statistics.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-data-types.d.ts +5 -5
- package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-data-types.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-query-options.d.ts +7 -0
- package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-query-options.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-sample-source.d.ts +8 -0
- package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-sample-source.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-samples.d.ts +30 -0
- package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-samples.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-series.d.ts +2 -2
- package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-series.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/utils/to-core-health-observations.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/data-sync/utils/to-core-health-observations.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts +12 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts +2 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/connections.d.ts +13 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/connections.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/driver.d.ts +20 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/driver.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/errors.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/errors.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts +2 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/readings.d.ts +3 -2
- package/lib/typescript/commonjs/src/modules/next/bluetooth/readings.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/runtime.d.ts +19 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/runtime.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/snapshot.d.ts +33 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/snapshot.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/hooks/runtime-context.d.ts +4 -1
- package/lib/typescript/module/src/modules/bt-management/hooks/runtime-context.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/index.d.ts +1 -0
- package/lib/typescript/module/src/modules/bt-management/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts +21 -5
- package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-lepu.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts +4 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts +2 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.history-sequencer.d.ts +24 -4
- package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.history-sequencer.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-command-writer.d.ts +6 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-command-writer.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts +23 -3
- 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/custom/custom-lepu-sequencer.d.ts +6 -3
- package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts +20 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.advertisement.d.ts +8 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.advertisement.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.connect-retry.d.ts +12 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.connect-retry.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.delivered-files.d.ts +24 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.delivered-files.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.d.ts +40 -5
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.d.ts +20 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts +6 -3
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts +3 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts +26 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.d.ts +42 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.d.ts +28 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave.d.ts +16 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.recorder.d.ts +32 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.recorder.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.recording-watch.d.ts +28 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.recording-watch.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.session.d.ts +17 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.session.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.stored-files.d.ts +33 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.stored-files.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts +4 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.waveform.d.ts +9 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.waveform.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.bp-monitors.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-files.d.ts +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-files.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.d.ts +8 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/series-recorder.d.ts +6 -1
- package/lib/typescript/module/src/modules/bt-management/services/series-recorder.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/create-device-params.d.ts +7 -1
- package/lib/typescript/module/src/modules/bt-management/types/create-device-params.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/custom-lepu-spec.d.ts +42 -1
- package/lib/typescript/module/src/modules/bt-management/types/custom-lepu-spec.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/device-connection-event.d.ts +17 -1
- package/lib/typescript/module/src/modules/bt-management/types/device-connection-event.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/device-waveform.d.ts +15 -0
- package/lib/typescript/module/src/modules/bt-management/types/device-waveform.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/utils/i-16-from-hex.d.ts +1 -1
- package/lib/typescript/module/src/modules/bt-management/utils/i-16-from-hex.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/utils/le-32-from-hex.d.ts +1 -1
- package/lib/typescript/module/src/modules/bt-management/utils/le-32-from-hex.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/components/apple/apple-health-authorization-provider.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/components/apple/apple-health-authorization-utils.d.ts +2 -2
- package/lib/typescript/module/src/modules/data-sync/components/apple/apple-health-authorization-utils.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/constants.d.ts +3 -1
- package/lib/typescript/module/src/modules/data-sync/constants.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/hooks/use-listen-changes.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/services/managers/data-processor.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/types/apple-health-authorization-provider-props.d.ts +2 -2
- package/lib/typescript/module/src/modules/data-sync/types/apple-health-authorization-provider-props.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/types/apple-health-sync-props.d.ts +4 -7
- package/lib/typescript/module/src/modules/data-sync/types/apple-health-sync-props.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/types/get-data-from-provider-props.d.ts +3 -1
- package/lib/typescript/module/src/modules/data-sync/types/get-data-from-provider-props.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/types/health-authorization-status.d.ts +2 -2
- package/lib/typescript/module/src/modules/data-sync/types/health-authorization-status.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/types/health-sync-keys.d.ts +11 -1
- package/lib/typescript/module/src/modules/data-sync/types/health-sync-keys.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/utils/convert-ecg-samples-to-observation.d.ts +6 -0
- package/lib/typescript/module/src/modules/data-sync/utils/convert-ecg-samples-to-observation.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/data-sync/utils/convert-generic-health-data.d.ts +1 -1
- package/lib/typescript/module/src/modules/data-sync/utils/convert-generic-health-data.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/utils/convert-samples-to-observation.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/utils/default-health-coding.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/utils/get-records-from-health-connect.d.ts +1 -1
- package/lib/typescript/module/src/modules/data-sync/utils/get-records-from-health-connect.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/utils/get-samples-from-health.d.ts +12 -46
- package/lib/typescript/module/src/modules/data-sync/utils/get-samples-from-health.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/utils/get-total-samples-count.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/utils/health-data-catalog.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/utils/health-units.d.ts +2 -2
- package/lib/typescript/module/src/modules/data-sync/utils/health-units.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/utils/healthkit-daily-statistics.d.ts +10 -0
- package/lib/typescript/module/src/modules/data-sync/utils/healthkit-daily-statistics.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/data-sync/utils/healthkit-data-types.d.ts +5 -5
- package/lib/typescript/module/src/modules/data-sync/utils/healthkit-data-types.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/utils/healthkit-query-options.d.ts +7 -0
- package/lib/typescript/module/src/modules/data-sync/utils/healthkit-query-options.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/data-sync/utils/healthkit-sample-source.d.ts +8 -0
- package/lib/typescript/module/src/modules/data-sync/utils/healthkit-sample-source.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/data-sync/utils/healthkit-samples.d.ts +30 -0
- package/lib/typescript/module/src/modules/data-sync/utils/healthkit-samples.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/data-sync/utils/healthkit-series.d.ts +2 -2
- package/lib/typescript/module/src/modules/data-sync/utils/healthkit-series.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/utils/to-core-health-observations.d.ts +1 -0
- package/lib/typescript/module/src/modules/data-sync/utils/to-core-health-observations.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts +12 -1
- package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts +2 -1
- package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/connections.d.ts +13 -1
- package/lib/typescript/module/src/modules/next/bluetooth/connections.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/driver.d.ts +20 -0
- package/lib/typescript/module/src/modules/next/bluetooth/driver.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/errors.d.ts +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/errors.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts +2 -1
- package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/readings.d.ts +3 -2
- package/lib/typescript/module/src/modules/next/bluetooth/readings.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/runtime.d.ts +19 -1
- package/lib/typescript/module/src/modules/next/bluetooth/runtime.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/snapshot.d.ts +33 -1
- package/lib/typescript/module/src/modules/next/bluetooth/snapshot.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/web/index.d.ts +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/web/index.d.ts.map +1 -1
- package/package.json +8 -3
|
@@ -1,16 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
/* eslint-disable max-lines */
|
|
3
4
|
import { getClockParts, isClockSyncEnabled } from "../../../types/clock-sync.js";
|
|
4
5
|
import { LepuCommand } from "./lepu.commands.js";
|
|
5
|
-
import {
|
|
6
|
+
import { LEPU_CONNECT_REPLY_TIMEOUT_MS, LepuConnectRetry } from "./lepu.connect-retry.js";
|
|
6
7
|
import { lepuCommandOf } from "./lepu.frame.js";
|
|
7
8
|
import { LepuIdentityGate } from "./lepu.identity-gate.js";
|
|
8
9
|
import { describeLepuResponseType, isLepuSuccess } from "./lepu.response-type.js";
|
|
9
|
-
|
|
10
|
+
import { LepuStoredFiles } from "./lepu.stored-files.js";
|
|
11
|
+
/** How long past its delay a poll may go unanswered before it is sent again. */
|
|
12
|
+
const POLL_ANSWER_GRACE_MS = 1_000;
|
|
13
|
+
|
|
14
|
+
/** Lets a device finish writing a record before its file list is read. */
|
|
15
|
+
const FILE_LIST_DELAY_MS = 3_000;
|
|
16
|
+
const hexOf = opcode => `0x${(opcode ?? 0).toString(16).padStart(2, "0")}`;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Identifies a recorder, sets its local clock, then polls it live. Its stored files are only
|
|
20
|
+
* listed on connect: they are read when the app asks (`takeHistorySync`), and a record the
|
|
21
|
+
* device stores while connected is read as it is saved. A device that does not poll reads its
|
|
22
|
+
* files on connect, as nothing else would ever ask for them.
|
|
23
|
+
*/
|
|
10
24
|
class LepuEcgTransferSequencer {
|
|
11
25
|
phase = "identity";
|
|
26
|
+
clockRetry = new LepuConnectRetry();
|
|
12
27
|
constructor(params) {
|
|
13
28
|
this.params = params;
|
|
29
|
+
this.storedFiles = new LepuStoredFiles({
|
|
30
|
+
write: params.write,
|
|
31
|
+
builder: params.builder,
|
|
32
|
+
onFile: params.onFile,
|
|
33
|
+
onError: params.onError,
|
|
34
|
+
skipFiles: params.skipFiles,
|
|
35
|
+
deliveredFiles: params.deliveredFiles,
|
|
36
|
+
acceptFile: params.acceptFile,
|
|
37
|
+
onProgress: params.onProgress
|
|
38
|
+
});
|
|
14
39
|
this.identity = new LepuIdentityGate({
|
|
15
40
|
write: params.write,
|
|
16
41
|
builder: params.builder,
|
|
@@ -19,11 +44,51 @@ class LepuEcgTransferSequencer {
|
|
|
19
44
|
rejectEncryptionAtBytes: params.rejectEncryptionAtBytes,
|
|
20
45
|
onIdentified: params.onIdentified,
|
|
21
46
|
onRefused: params.onRefused,
|
|
22
|
-
onAdmitted: this.
|
|
47
|
+
onAdmitted: this.startClockOrFiles
|
|
23
48
|
});
|
|
24
49
|
}
|
|
25
50
|
initialCommands = () => this.identity.initialCommands();
|
|
26
51
|
isHistoryTransfer = () => true;
|
|
52
|
+
commandTimeoutMs = () => {
|
|
53
|
+
if (this.phase === "identity") {
|
|
54
|
+
return this.identity.commandTimeoutMs();
|
|
55
|
+
}
|
|
56
|
+
if (this.phase === "polling" && this.params.pollIntervalMs !== undefined) {
|
|
57
|
+
return this.params.pollIntervalMs + POLL_ANSWER_GRACE_MS;
|
|
58
|
+
}
|
|
59
|
+
if (this.phase === "requested") {
|
|
60
|
+
return LEPU_CONNECT_REPLY_TIMEOUT_MS;
|
|
61
|
+
}
|
|
62
|
+
return this.phase === "clock" ? LEPU_CONNECT_REPLY_TIMEOUT_MS : undefined;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/** An unanswered clock is sent once more, then skipped; nothing after it needs it. */
|
|
66
|
+
onCommandTimeout = () => {
|
|
67
|
+
if (this.phase === "identity") {
|
|
68
|
+
return this.identity.onCommandTimeout();
|
|
69
|
+
}
|
|
70
|
+
if (this.phase === "requested") {
|
|
71
|
+
this.params.onError(`the device did not answer command ${hexOf(this.requestedCommand)}`);
|
|
72
|
+
}
|
|
73
|
+
if (this.phase === "polling" || this.phase === "requested") {
|
|
74
|
+
return {
|
|
75
|
+
commands: this.resumePolling()
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
if (this.phase !== "clock") {
|
|
79
|
+
return {};
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
commands: this.clockRetry.mayRetry() ? [this.setTimeCommand()] : this.startFiles()
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
commandProgress = frame => {
|
|
86
|
+
if (this.phase === "identity") {
|
|
87
|
+
return this.identity.commandProgress(frame);
|
|
88
|
+
}
|
|
89
|
+
const awaited = this.phase === "clock" ? LepuCommand.SET_TIME : this.phase === "polling" ? this.params.pollCommand : this.phase === "requested" ? this.requestedCommand : undefined;
|
|
90
|
+
return awaited !== undefined && lepuCommandOf(frame) !== awaited ? "ignored" : "complete";
|
|
91
|
+
};
|
|
27
92
|
nextCommand = frame => {
|
|
28
93
|
if (this.phase === "identity") {
|
|
29
94
|
return this.identity.nextCommand(frame);
|
|
@@ -35,20 +100,60 @@ class LepuEcgTransferSequencer {
|
|
|
35
100
|
if (this.params.pollCommand === undefined || lepuCommandOf(frame) !== this.params.pollCommand) {
|
|
36
101
|
return undefined;
|
|
37
102
|
}
|
|
38
|
-
return this.
|
|
103
|
+
return this.afterPollAnswer(frame);
|
|
104
|
+
}
|
|
105
|
+
if (this.phase === "requested") {
|
|
106
|
+
return this.finishRequested(frame);
|
|
39
107
|
}
|
|
40
108
|
return this.transfer?.nextCommand(frame);
|
|
41
109
|
};
|
|
42
|
-
|
|
110
|
+
afterPollAnswer = frame => {
|
|
111
|
+
const stored = this.params.shouldStartTransfer?.(frame) ?? true;
|
|
112
|
+
const delayBeforeWriteMs = stored ? FILE_LIST_DELAY_MS : undefined;
|
|
113
|
+
if (this.params.takeHistorySync?.()) {
|
|
114
|
+
return this.startTransfer(this.storedFiles.readAll, delayBeforeWriteMs);
|
|
115
|
+
}
|
|
116
|
+
return stored ? this.startTransfer(this.storedFiles.readNew, delayBeforeWriteMs) : this.requestedOrPoll();
|
|
117
|
+
};
|
|
118
|
+
requestedOrPoll = () => {
|
|
119
|
+
const requested = this.params.takeRequestedCommand?.();
|
|
120
|
+
if (requested === undefined) {
|
|
121
|
+
return [this.pollCommand()];
|
|
122
|
+
}
|
|
123
|
+
this.phase = "requested";
|
|
124
|
+
this.requestedCommand = requested;
|
|
125
|
+
return [{
|
|
126
|
+
...this.params.write,
|
|
127
|
+
frame: this.params.builder.build(requested)
|
|
128
|
+
}];
|
|
129
|
+
};
|
|
130
|
+
finishRequested = frame => {
|
|
131
|
+
if (lepuCommandOf(frame) !== this.requestedCommand) {
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
if (!isLepuSuccess(frame)) {
|
|
135
|
+
this.params.onError(`the device refused command ${hexOf(this.requestedCommand)}: ${describeLepuResponseType(frame)}`);
|
|
136
|
+
}
|
|
137
|
+
return this.resumePolling();
|
|
138
|
+
};
|
|
139
|
+
resumePolling = () => {
|
|
140
|
+
this.phase = "polling";
|
|
141
|
+
this.requestedCommand = undefined;
|
|
142
|
+
return [this.pollCommand()];
|
|
143
|
+
};
|
|
144
|
+
startClockOrFiles = () => {
|
|
43
145
|
if (isClockSyncEnabled(this.params.clockSync)) {
|
|
44
146
|
this.phase = "clock";
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
frame: this.params.builder.build(LepuCommand.SET_TIME, clockPayload(this.params.clockSync))
|
|
48
|
-
}];
|
|
147
|
+
this.clockRetry.started();
|
|
148
|
+
return [this.setTimeCommand()];
|
|
49
149
|
}
|
|
50
|
-
return this.
|
|
150
|
+
return this.startFiles();
|
|
51
151
|
};
|
|
152
|
+
startFiles = () => this.params.pollCommand === undefined || this.params.takeHistorySync?.() ? this.startTransfer(this.storedFiles.readAll) : this.startTransfer(this.storedFiles.listExisting);
|
|
153
|
+
setTimeCommand = () => ({
|
|
154
|
+
...this.params.write,
|
|
155
|
+
frame: this.params.builder.build(LepuCommand.SET_TIME, clockPayload(this.params.clockSync))
|
|
156
|
+
});
|
|
52
157
|
finishClock = frame => {
|
|
53
158
|
if (lepuCommandOf(frame) !== LepuCommand.SET_TIME) {
|
|
54
159
|
return undefined;
|
|
@@ -56,20 +161,11 @@ class LepuEcgTransferSequencer {
|
|
|
56
161
|
if (!isLepuSuccess(frame)) {
|
|
57
162
|
this.params.onError(`the device refused SET_TIME: ${describeLepuResponseType(frame)}`);
|
|
58
163
|
}
|
|
59
|
-
return this.
|
|
164
|
+
return this.startFiles();
|
|
60
165
|
};
|
|
61
|
-
startTransfer = delayBeforeWriteMs => {
|
|
166
|
+
startTransfer = (files, delayBeforeWriteMs) => {
|
|
62
167
|
this.phase = "files";
|
|
63
|
-
this.transfer =
|
|
64
|
-
write: this.params.write,
|
|
65
|
-
builder: this.params.builder,
|
|
66
|
-
onFile: this.params.onFile,
|
|
67
|
-
onError: this.params.onError,
|
|
68
|
-
skipFiles: this.params.skipFiles,
|
|
69
|
-
acceptFile: this.params.acceptFile,
|
|
70
|
-
afterTransfer: this.finishTransfer,
|
|
71
|
-
onProgress: this.params.onProgress
|
|
72
|
-
});
|
|
168
|
+
this.transfer = files(this.finishTransfer);
|
|
73
169
|
return this.transfer.initialCommands(delayBeforeWriteMs);
|
|
74
170
|
};
|
|
75
171
|
finishTransfer = () => {
|
|
@@ -78,15 +174,18 @@ class LepuEcgTransferSequencer {
|
|
|
78
174
|
this.phase = "polling";
|
|
79
175
|
return [this.pollCommand()];
|
|
80
176
|
}
|
|
81
|
-
return
|
|
177
|
+
return [];
|
|
178
|
+
};
|
|
179
|
+
pollCommand = () => {
|
|
180
|
+
const delayBeforeWriteMs = this.params.pollsOnAnswer?.() ? undefined : this.params.pollIntervalMs;
|
|
181
|
+
return {
|
|
182
|
+
...this.params.write,
|
|
183
|
+
frame: this.params.builder.build(this.params.pollCommand),
|
|
184
|
+
...(delayBeforeWriteMs === undefined ? {} : {
|
|
185
|
+
delayBeforeWriteMs
|
|
186
|
+
})
|
|
187
|
+
};
|
|
82
188
|
};
|
|
83
|
-
pollCommand = () => ({
|
|
84
|
-
...this.params.write,
|
|
85
|
-
frame: this.params.builder.build(this.params.pollCommand),
|
|
86
|
-
...(this.params.pollIntervalMs === undefined ? {} : {
|
|
87
|
-
delayBeforeWriteMs: this.params.pollIntervalMs
|
|
88
|
-
})
|
|
89
|
-
});
|
|
90
189
|
}
|
|
91
190
|
const clockPayload = clockSync => {
|
|
92
191
|
const parts = getClockParts(clockSync?.now?.() ?? new Date(), clockSync?.timezone);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getClockParts","isClockSyncEnabled","LepuCommand","
|
|
1
|
+
{"version":3,"names":["getClockParts","isClockSyncEnabled","LepuCommand","LEPU_CONNECT_REPLY_TIMEOUT_MS","LepuConnectRetry","lepuCommandOf","LepuIdentityGate","describeLepuResponseType","isLepuSuccess","LepuStoredFiles","POLL_ANSWER_GRACE_MS","FILE_LIST_DELAY_MS","hexOf","opcode","toString","padStart","LepuEcgTransferSequencer","phase","clockRetry","constructor","params","storedFiles","write","builder","onFile","onError","skipFiles","deliveredFiles","acceptFile","onProgress","identity","expectedDeviceTypes","manufacturerData","rejectEncryptionAtBytes","onIdentified","onRefused","onAdmitted","startClockOrFiles","initialCommands","isHistoryTransfer","commandTimeoutMs","pollIntervalMs","undefined","onCommandTimeout","requestedCommand","commands","resumePolling","mayRetry","setTimeCommand","startFiles","commandProgress","frame","awaited","SET_TIME","pollCommand","nextCommand","finishClock","afterPollAnswer","finishRequested","transfer","stored","shouldStartTransfer","delayBeforeWriteMs","takeHistorySync","startTransfer","readAll","readNew","requestedOrPoll","requested","takeRequestedCommand","build","clockSync","started","listExisting","clockPayload","files","finishTransfer","pollsOnAnswer","parts","now","Date","timezone","year","month","day","hours","minutes","seconds"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.ecg-transfer.ts"],"mappings":";;AAAA;AACA,SAEEA,aAAa,EACbC,kBAAkB,QACb,8BAA2B;AAQlC,SAASC,WAAW,QAAQ,oBAAiB;AAC7C,SAASC,6BAA6B,EAAEC,gBAAgB,QAAQ,yBAAsB;AAItF,SAASC,aAAa,QAAQ,iBAAc;AAC5C,SAASC,gBAAgB,QAAQ,yBAAsB;AACvD,SAASC,wBAAwB,EAAEC,aAAa,QAAQ,yBAAsB;AAC9E,SAASC,eAAe,QAAQ,wBAAqB;AAgDrD;AACA,MAAMC,oBAAoB,GAAG,KAAK;;AAElC;AACA,MAAMC,kBAAkB,GAAG,KAAK;AAEhC,MAAMC,KAAK,GAAIC,MAA0B,IACvC,KAAK,CAACA,MAAM,IAAI,CAAC,EAAEC,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,wBAAwB,CAA6B;EACjDC,KAAK,GAAyB,UAAU;EAC/BC,UAAU,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,IAAI,IAAI,CAAC,GAAI,IAAI,EACxBJ,KAAK,CAACK,KAAK,EACXL,KAAK,CAACM,GAAG,EACTN,KAAK,CAACO,KAAK,EACXP,KAAK,CAACQ,OAAO,EACbR,KAAK,CAACS,OAAO,CACd;AACH,CAAC;AAED,SAASvE,wBAAwB,EAAE0D,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { hexToByte } from "../../../utils/hex-to-byte.js";
|
|
4
|
+
import { createLepuAccessToken, decryptLepuHandshake, parseLepuSessionKey } from "../viatom/viatom-lepu-crypto.js";
|
|
5
|
+
import { advertisesLepuEncryption } from "./lepu.advertisement.js";
|
|
6
|
+
import { LepuCommandBuilder } from "./lepu.command-builder.js";
|
|
7
|
+
import { LEPU_CONNECT_REPLY_TIMEOUT_MS, LepuConnectRetry } from "./lepu.connect-retry.js";
|
|
8
|
+
import { lepuCommandOf, lepuPayloadOf } from "./lepu.frame.js";
|
|
9
|
+
import { isLepuSuccess } from "./lepu.response-type.js";
|
|
10
|
+
const LEPU_ENCRYPT_COMMAND = 0xff;
|
|
11
|
+
/**
|
|
12
|
+
* Runs the vendor's encryption handshake before a standard Lepu exchange, when the
|
|
13
|
+
* advertisement asks for one.
|
|
14
|
+
*
|
|
15
|
+
* The access token goes out in plain text; the reply carries the session key, and from then
|
|
16
|
+
* on every request is encrypted here and every reply is decrypted by the frame reader that
|
|
17
|
+
* shares the session. Without the flag the exchange runs exactly as it did before.
|
|
18
|
+
*/
|
|
19
|
+
class LepuEncryptionHandshake {
|
|
20
|
+
state = "awaiting-key";
|
|
21
|
+
retry = new LepuConnectRetry();
|
|
22
|
+
constructor(inner, params) {
|
|
23
|
+
this.inner = inner;
|
|
24
|
+
this.params = params;
|
|
25
|
+
}
|
|
26
|
+
initialCommands = () => {
|
|
27
|
+
this.retry.started();
|
|
28
|
+
return [this.tokenCommand()];
|
|
29
|
+
};
|
|
30
|
+
nextCommand = (frame, characteristicUuid) => {
|
|
31
|
+
if (this.state === "done") {
|
|
32
|
+
return this.encrypted(this.inner.nextCommand(frame, characteristicUuid));
|
|
33
|
+
}
|
|
34
|
+
if (this.state === "refused" || lepuCommandOf(frame) !== LEPU_ENCRYPT_COMMAND) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
return this.acceptKey(frame);
|
|
38
|
+
};
|
|
39
|
+
commandTimeoutMs = () => this.state === "awaiting-key" ? LEPU_CONNECT_REPLY_TIMEOUT_MS : this.state === "done" ? this.inner.commandTimeoutMs?.() : undefined;
|
|
40
|
+
|
|
41
|
+
/** A device just woken can drop the token, so it is sent once more before giving up. */
|
|
42
|
+
onCommandTimeout = () => {
|
|
43
|
+
if (this.state === "done") {
|
|
44
|
+
const result = this.inner.onCommandTimeout?.() ?? {};
|
|
45
|
+
return {
|
|
46
|
+
...result,
|
|
47
|
+
commands: this.encrypted(result.commands)
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
if (this.state === "refused") {
|
|
51
|
+
return {};
|
|
52
|
+
}
|
|
53
|
+
return this.retry.mayRetry() ? {
|
|
54
|
+
commands: [this.tokenCommand()]
|
|
55
|
+
} : {
|
|
56
|
+
terminal: true
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
commandProgress = frame => {
|
|
60
|
+
if (this.state === "done") {
|
|
61
|
+
return this.inner.commandProgress?.(frame) ?? "complete";
|
|
62
|
+
}
|
|
63
|
+
return lepuCommandOf(frame) === LEPU_ENCRYPT_COMMAND ? "complete" : "ignored";
|
|
64
|
+
};
|
|
65
|
+
onServicesDiscovered = serviceUuids => this.inner.onServicesDiscovered?.(serviceUuids);
|
|
66
|
+
isNormalDisconnect = () => this.inner.isNormalDisconnect?.() ?? false;
|
|
67
|
+
isHistoryTransfer = () => this.inner.isHistoryTransfer?.() ?? false;
|
|
68
|
+
acceptKey = frame => {
|
|
69
|
+
const reply = lepuPayloadOf(frame).map(hexToByte);
|
|
70
|
+
const key = isLepuSuccess(frame) ? parseLepuSessionKey(decryptLepuHandshake(reply)) : undefined;
|
|
71
|
+
if (!key) {
|
|
72
|
+
this.state = "refused";
|
|
73
|
+
this.params.onRefused("the device refused the encryption handshake");
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
this.params.session.begin(key);
|
|
77
|
+
this.state = "done";
|
|
78
|
+
return this.encrypted(this.inner.initialCommands());
|
|
79
|
+
};
|
|
80
|
+
tokenCommand = () => ({
|
|
81
|
+
...this.params.write,
|
|
82
|
+
frame: new LepuCommandBuilder(this.params.startByte).build(LEPU_ENCRYPT_COMMAND, createLepuAccessToken())
|
|
83
|
+
});
|
|
84
|
+
encrypted = commands => commands?.map(command => ({
|
|
85
|
+
...command,
|
|
86
|
+
frame: this.params.session.encryptFrame(command.frame)
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* The sequencer for one connection: wrapped in the handshake when the advertisement asks
|
|
92
|
+
* for encryption, unchanged otherwise. Either way the session starts without a key.
|
|
93
|
+
*/
|
|
94
|
+
const withLepuEncryption = (inner, params) => {
|
|
95
|
+
params.session.end();
|
|
96
|
+
return advertisesLepuEncryption(params.manufacturerData) ? new LepuEncryptionHandshake(inner, params) : inner;
|
|
97
|
+
};
|
|
98
|
+
export { withLepuEncryption };
|
|
99
|
+
//# sourceMappingURL=lepu.encryption-handshake.js.map
|
package/lib/module/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["hexToByte","createLepuAccessToken","decryptLepuHandshake","parseLepuSessionKey","advertisesLepuEncryption","LepuCommandBuilder","LEPU_CONNECT_REPLY_TIMEOUT_MS","LepuConnectRetry","lepuCommandOf","lepuPayloadOf","isLepuSuccess","LEPU_ENCRYPT_COMMAND","LepuEncryptionHandshake","state","retry","constructor","inner","params","initialCommands","started","tokenCommand","nextCommand","frame","characteristicUuid","encrypted","undefined","acceptKey","commandTimeoutMs","onCommandTimeout","result","commands","mayRetry","terminal","commandProgress","onServicesDiscovered","serviceUuids","isNormalDisconnect","isHistoryTransfer","reply","map","key","onRefused","session","begin","write","startByte","build","command","encryptFrame","withLepuEncryption","end","manufacturerData"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.encryption-handshake.ts"],"mappings":";;AAKA,SAASA,SAAS,QAAQ,+BAA4B;AACtD,SACEC,qBAAqB,EACrBC,oBAAoB,EACpBC,mBAAmB,QACd,iCAA8B;AAErC,SAASC,wBAAwB,QAAQ,yBAAsB;AAC/D,SAASC,kBAAkB,QAAQ,2BAAwB;AAC3D,SAASC,6BAA6B,EAAEC,gBAAgB,QAAQ,yBAAsB;AACtF,SAASC,aAAa,EAAEC,aAAa,QAAQ,iBAAc;AAC3D,SAASC,aAAa,QAAQ,yBAAsB;AAGpD,MAAMC,oBAAoB,GAAG,IAAI;AAgBjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,uBAAuB,CAA6B;EAChDC,KAAK,GAAmB,cAAc;EAC7BC,KAAK,GAAG,IAAIP,gBAAgB,CAAC,CAAC;EAExCQ,WAAWA,CACCC,KAA2B,EAC3BC,MAA4B,EAC7C;IAAA,KAFiBD,KAA2B,GAA3BA,KAA2B;IAAA,KAC3BC,MAA4B,GAA5BA,MAA4B;EAC5C;EAEIC,eAAe,GAAGA,CAAA,KAAgC;IACvD,IAAI,CAACJ,KAAK,CAACK,OAAO,CAAC,CAAC;IAEpB,OAAO,CAAC,IAAI,CAACC,YAAY,CAAC,CAAC,CAAC;EAC9B,CAAC;EAEMC,WAAW,GAAGA,CACnBC,KAAwB,EACxBC,kBAA2B,KACc;IACzC,IAAI,IAAI,CAACV,KAAK,KAAK,MAAM,EAAE;MACzB,OAAO,IAAI,CAACW,SAAS,CAAC,IAAI,CAACR,KAAK,CAACK,WAAW,CAACC,KAAK,EAAEC,kBAAkB,CAAC,CAAC;IAC1E;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,CAACzB,KAAK;EACvD,CAAC,CAAC,CAAC;AACP;;AAEA;AACA;AACA;AACA;AACA,MAAM2B,kBAAkB,GAAGA,CACzBjC,KAA2B,EAC3BC,MAA4B,KACP;EACrBA,MAAM,CAACyB,OAAO,CAACQ,GAAG,CAAC,CAAC;EAEpB,OAAO9C,wBAAwB,CAACa,MAAM,CAACkC,gBAAgB,CAAC,GACpD,IAAIvC,uBAAuB,CAACI,KAAK,EAAEC,MAAM,CAAC,GAC1CD,KAAK;AACX,CAAC;AAED,SAASiC,kBAAkB","ignoreList":[]}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
/* eslint-disable max-lines */
|
|
4
4
|
|
|
5
|
+
import { hexToByte } from "../../../utils/hex-to-byte.js";
|
|
5
6
|
import { le32FromHex } from "../../../utils/le-32-from-hex.js";
|
|
6
7
|
import { le32ToBytes } from "../../../utils/le-32-to-bytes.js";
|
|
7
8
|
import { LepuCommand } from "./lepu.commands.js";
|
|
@@ -11,11 +12,10 @@ import { describeLepuResponseType, isLepuSuccess } from "./lepu.response-type.js
|
|
|
11
12
|
const FILE_SIZE_OFFSET = 0;
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
|
-
* A
|
|
15
|
-
*
|
|
16
|
-
* is a length to refuse rather than try to hold on a low-memory tablet.
|
|
15
|
+
* A size beyond this is a corrupt length field rather than a recording. A holter ECG takes about
|
|
16
|
+
* a byte per sample at 125 Hz, so this holds about 140 hours.
|
|
17
17
|
*/
|
|
18
|
-
const MAX_FILE_BYTES =
|
|
18
|
+
const MAX_FILE_BYTES = 64 * 1_024 * 1_024;
|
|
19
19
|
const TRANSFER_COMMANDS = [LepuCommand.GET_FILE_LIST, LepuCommand.READ_FILE_START, LepuCommand.READ_FILE_DATA, LepuCommand.READ_FILE_END];
|
|
20
20
|
|
|
21
21
|
/** A file read from a Lepu device. */
|
|
@@ -44,7 +44,8 @@ class LepuFileTransfer {
|
|
|
44
44
|
fileIndex = 0;
|
|
45
45
|
name = "";
|
|
46
46
|
totalBytes = 0;
|
|
47
|
-
|
|
47
|
+
bytes = new Uint8Array(0);
|
|
48
|
+
received = 0;
|
|
48
49
|
isSessionOpen = false;
|
|
49
50
|
isDone = false;
|
|
50
51
|
constructor(params) {
|
|
@@ -66,6 +67,7 @@ class LepuFileTransfer {
|
|
|
66
67
|
if (command === LepuCommand.GET_FILE_LIST) {
|
|
67
68
|
this.files = lepuNamesFrom(lepuPayloadOf(frame));
|
|
68
69
|
this.fileIndex = 0;
|
|
70
|
+
this.params.onFileList?.(this.files);
|
|
69
71
|
return this.openNextFile();
|
|
70
72
|
}
|
|
71
73
|
if (command === LepuCommand.READ_FILE_START) {
|
|
@@ -88,7 +90,8 @@ class LepuFileTransfer {
|
|
|
88
90
|
}
|
|
89
91
|
this.name = name;
|
|
90
92
|
this.totalBytes = 0;
|
|
91
|
-
this.
|
|
93
|
+
this.bytes = new Uint8Array(0);
|
|
94
|
+
this.received = 0;
|
|
92
95
|
return [this.commandFor(LepuCommand.READ_FILE_START, [...lepuNameBytes(name), ...le32ToBytes(0)])];
|
|
93
96
|
};
|
|
94
97
|
|
|
@@ -103,6 +106,7 @@ class LepuFileTransfer {
|
|
|
103
106
|
if (this.totalBytes === 0) {
|
|
104
107
|
return this.closeFile();
|
|
105
108
|
}
|
|
109
|
+
this.bytes = new Uint8Array(this.totalBytes);
|
|
106
110
|
return [this.commandFor(LepuCommand.READ_FILE_DATA, le32ToBytes(0))];
|
|
107
111
|
};
|
|
108
112
|
|
|
@@ -113,28 +117,30 @@ class LepuFileTransfer {
|
|
|
113
117
|
*/
|
|
114
118
|
appendChunk = payload => {
|
|
115
119
|
if (payload.length === 0) {
|
|
116
|
-
return this.fail(`"${this.name}" stopped sending at ${this.
|
|
120
|
+
return this.fail(`"${this.name}" stopped sending at ${this.received} of ${this.totalBytes} bytes`);
|
|
117
121
|
}
|
|
118
|
-
this.
|
|
122
|
+
const fits = payload.slice(0, this.totalBytes - this.received);
|
|
123
|
+
this.bytes.set(fits.map(hexToByte), this.received);
|
|
124
|
+
this.received += fits.length;
|
|
119
125
|
this.params.onProgress?.({
|
|
120
126
|
name: this.name,
|
|
121
|
-
receivedBytes: this.
|
|
127
|
+
receivedBytes: this.received,
|
|
122
128
|
totalBytes: this.totalBytes
|
|
123
129
|
});
|
|
124
|
-
if (this.
|
|
130
|
+
if (this.received >= this.totalBytes) {
|
|
125
131
|
return this.closeFile();
|
|
126
132
|
}
|
|
127
|
-
return [this.commandFor(LepuCommand.READ_FILE_DATA, le32ToBytes(this.
|
|
133
|
+
return [this.commandFor(LepuCommand.READ_FILE_DATA, le32ToBytes(this.received))];
|
|
128
134
|
};
|
|
129
135
|
closedFile = () => {
|
|
130
136
|
this.isSessionOpen = false;
|
|
131
|
-
if (this.totalBytes > 0 && this.
|
|
132
|
-
return this.fail(`"${this.name}" ended at ${this.
|
|
137
|
+
if (this.totalBytes > 0 && this.received !== this.totalBytes) {
|
|
138
|
+
return this.fail(`"${this.name}" ended at ${this.received} of ${this.totalBytes} bytes`);
|
|
133
139
|
}
|
|
134
140
|
if (this.totalBytes > 0) {
|
|
135
141
|
this.params.onFile({
|
|
136
142
|
name: this.name,
|
|
137
|
-
|
|
143
|
+
bytes: this.bytes
|
|
138
144
|
});
|
|
139
145
|
}
|
|
140
146
|
this.fileIndex++;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["le32FromHex","le32ToBytes","LepuCommand","lepuNameBytes","lepuNamesFrom","lepuCommandOf","lepuPayloadOf","describeLepuResponseType","isLepuSuccess","FILE_SIZE_OFFSET","MAX_FILE_BYTES","TRANSFER_COMMANDS","GET_FILE_LIST","READ_FILE_START","READ_FILE_DATA","READ_FILE_END","LepuFileTransfer","files","fileIndex","name","totalBytes","
|
|
1
|
+
{"version":3,"names":["hexToByte","le32FromHex","le32ToBytes","LepuCommand","lepuNameBytes","lepuNamesFrom","lepuCommandOf","lepuPayloadOf","describeLepuResponseType","isLepuSuccess","FILE_SIZE_OFFSET","MAX_FILE_BYTES","TRANSFER_COMMANDS","GET_FILE_LIST","READ_FILE_START","READ_FILE_DATA","READ_FILE_END","LepuFileTransfer","files","fileIndex","name","totalBytes","bytes","Uint8Array","received","isSessionOpen","isDone","constructor","params","isHistoryTransfer","initialCommands","delayBeforeWriteMs","commandFor","nextCommand","frame","command","afterTransfer","includes","undefined","fail","onFileList","openNextFile","openedFile","appendChunk","closedFile","skipFiles","has","acceptFile","payload","limit","maxFileBytes","closeFile","length","fits","slice","set","map","onProgress","receivedBytes","onFile","reason","onError","write","builder","build"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.file-transfer.ts"],"mappings":";;AAAA;;AAIA,SAASA,SAAS,QAAQ,+BAA4B;AACtD,SAASC,WAAW,QAAQ,kCAA+B;AAC3D,SAASC,WAAW,QAAQ,kCAA+B;AAG3D,SAASC,WAAW,QAAQ,oBAAiB;AAC7C,SAASC,aAAa,EAAEC,aAAa,QAAQ,sBAAmB;AAChE,SAASC,aAAa,EAAEC,aAAa,QAAQ,iBAAc;AAC3D,SAASC,wBAAwB,EAAEC,aAAa,QAAQ,yBAAsB;AAE9E,MAAMC,gBAAgB,GAAG,CAAC;;AAE1B;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAAG,EAAE,GAAG,KAAK,GAAG,KAAK;AAEzC,MAAMC,iBAAoC,GAAG,CAC3CT,WAAW,CAACU,aAAa,EACzBV,WAAW,CAACW,eAAe,EAC3BX,WAAW,CAACY,cAAc,EAC1BZ,WAAW,CAACa,aAAa,CAC1B;;AAED;;AAUA;;AAsCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,CAA6B;EACzCC,KAAK,GAAa,EAAE;EACpBC,SAAS,GAAG,CAAC;EACbC,IAAI,GAAG,EAAE;EACTC,UAAU,GAAG,CAAC;EACdC,KAAK,GAAG,IAAIC,UAAU,CAAC,CAAC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AEOnB,UAAU,GAAGA,CACnBG,OAAe,EACfa,OAA0B,GAAG,EAAE,EAC/BjB,kBAA2B,MACR;IACnB,GAAG,IAAI,CAACH,MAAM,CAACkC,KAAK;IACpB5B,KAAK,EAAE,IAAI,CAACN,MAAM,CAACmC,OAAO,CAACC,KAAK,CAAC7B,OAAO,EAAEa,OAAO,CAAC;IAClD,IAAIjB,kBAAkB,KAAKO,SAAS,GAAG,CAAC,CAAC,GAAG;MAAEP;IAAmB,CAAC;EACpE,CAAC,CAAC;AACJ;AAEA,SAASd,gBAAgB","ignoreList":[]}
|
|
@@ -27,8 +27,9 @@ const START_PATTERN_BYTES = 3;
|
|
|
27
27
|
* protocol, which is why it is worth having once rather than once per device.
|
|
28
28
|
*/
|
|
29
29
|
export class LepuFrameReader {
|
|
30
|
-
constructor(startBytes) {
|
|
30
|
+
constructor(startBytes, session) {
|
|
31
31
|
this.startBytes = startBytes;
|
|
32
|
+
this.session = session;
|
|
32
33
|
}
|
|
33
34
|
readFrame(buffer) {
|
|
34
35
|
const start = this.findFrameStart(buffer);
|
|
@@ -44,7 +45,8 @@ export class LepuFrameReader {
|
|
|
44
45
|
if (!this.hasValidChecksum(frame)) {
|
|
45
46
|
return corrupt(start + START_PATTERN_BYTES);
|
|
46
47
|
}
|
|
47
|
-
|
|
48
|
+
const plainFrame = this.session ? this.session.decryptFrame(frame) : frame;
|
|
49
|
+
return plainFrame ? complete(plainFrame, start + frameLength) : corrupt(start + frameLength);
|
|
48
50
|
}
|
|
49
51
|
isFrameStart(buffer, index) {
|
|
50
52
|
if (!this.startBytes.includes((buffer[index] || "").toLowerCase())) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["calculateCrc8","complete","corrupt","incomplete","hexToByte","le16FromHex","COMMAND_INDEX","COMMAND_COMPLEMENT_INDEX","PAYLOAD_LENGTH_INDEX","HEADER_BYTES","CHECKSUM_BYTES","BYTE_MASK","START_PATTERN_BYTES","LepuFrameReader","constructor","startBytes","readFrame","buffer","start","findFrameStart","droppableLeadingBytes","payloadLength","frameLength","length","frame","slice","hasValidChecksum","isFrameStart","index","includes","toLowerCase","command","complement","lastCandidate","Math","max","checksummedBytes","declared"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.frame-reader.ts"],"mappings":";;AAEA,SAASA,aAAa,QAAQ,mCAAgC;AAC9D,SAASC,QAAQ,EAAEC,OAAO,EAAEC,UAAU,QAAQ,sCAAmC;AACjF,SAASC,SAAS,QAAQ,+BAA4B;AACtD,SAASC,WAAW,QAAQ,kCAA+B;
|
|
1
|
+
{"version":3,"names":["calculateCrc8","complete","corrupt","incomplete","hexToByte","le16FromHex","COMMAND_INDEX","COMMAND_COMPLEMENT_INDEX","PAYLOAD_LENGTH_INDEX","HEADER_BYTES","CHECKSUM_BYTES","BYTE_MASK","START_PATTERN_BYTES","LepuFrameReader","constructor","startBytes","session","readFrame","buffer","start","findFrameStart","droppableLeadingBytes","payloadLength","frameLength","length","frame","slice","hasValidChecksum","plainFrame","decryptFrame","isFrameStart","index","includes","toLowerCase","command","complement","lastCandidate","Math","max","checksummedBytes","declared"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.frame-reader.ts"],"mappings":";;AAEA,SAASA,aAAa,QAAQ,mCAAgC;AAC9D,SAASC,QAAQ,EAAEC,OAAO,EAAEC,UAAU,QAAQ,sCAAmC;AACjF,SAASC,SAAS,QAAQ,+BAA4B;AACtD,SAASC,WAAW,QAAQ,kCAA+B;AAI3D,MAAMC,aAAa,GAAG,CAAC;AACvB,MAAMC,wBAAwB,GAAG,CAAC;AAClC,MAAMC,oBAAoB,GAAG,CAAC;AAC9B,MAAMC,YAAY,GAAG,CAAC;AACtB,MAAMC,cAAc,GAAG,CAAC;AACxB,MAAMC,SAAS,GAAG,IAAI;;AAEtB;AACA,MAAMC,mBAAmB,GAAG,CAAC;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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