@ovok/native 1.6.55 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/modules/bt-device/constants/device-instruction-pdfs.js +2 -1
- package/lib/commonjs/modules/bt-device/constants/device-instruction-pdfs.js.map +1 -1
- package/lib/commonjs/modules/bt-device/constants/device-list-items.js +7 -0
- package/lib/commonjs/modules/bt-device/constants/device-list-items.js.map +1 -1
- package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-assets.js +3 -1
- package/lib/commonjs/modules/bt-device/constants/supported-device-catalog-assets.js.map +1 -1
- package/lib/commonjs/modules/bt-device/constants/supported-devices.js +11 -2
- package/lib/commonjs/modules/bt-device/constants/supported-devices.js.map +1 -1
- package/lib/commonjs/modules/bt-management/core/resolve-device-key.js +6 -1
- package/lib/commonjs/modules/bt-management/core/resolve-device-key.js.map +1 -1
- package/lib/commonjs/modules/bt-management/index.js +48 -0
- package/lib/commonjs/modules/bt-management/index.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/bt-manager.js +9 -17
- package/lib/commonjs/modules/bt-management/services/bt-manager.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/device-classes.js +3 -1
- package/lib/commonjs/modules/bt-management/services/device-classes.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/device-creator.js +9 -7
- package/lib/commonjs/modules/bt-management/services/device-creator.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.device.js +1 -7
- 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.history-sequencer.js +1 -5
- 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 +2 -8
- package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-connection-handler.js +17 -31
- package/lib/commonjs/modules/bt-management/services/devices/bt-connection-handler.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-device-information.js +2 -3
- package/lib/commonjs/modules/bt-management/services/devices/bt-device-information.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js +8 -24
- 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 +0 -3
- package/lib/commonjs/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/trasense/s9-advertisement.js +31 -0
- package/lib/commonjs/modules/bt-management/services/devices/trasense/s9-advertisement.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/trasense/s9-frame-reader.js +27 -0
- package/lib/commonjs/modules/bt-management/services/devices/trasense/s9-frame-reader.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/trasense/s9.command-sequencer.js +340 -0
- package/lib/commonjs/modules/bt-management/services/devices/trasense/s9.command-sequencer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/trasense/s9.device.js +74 -0
- package/lib/commonjs/modules/bt-management/services/devices/trasense/s9.device.js.map +1 -0
- package/lib/commonjs/modules/bt-management/types/clock-sync.js +1 -0
- package/lib/commonjs/modules/bt-management/types/clock-sync.js.map +1 -1
- package/lib/commonjs/modules/bt-management/types/integrated-devices.js +1 -0
- package/lib/commonjs/modules/bt-management/types/integrated-devices.js.map +1 -1
- package/lib/commonjs/modules/data-sync/index.js +15 -0
- package/lib/commonjs/modules/data-sync/index.js.map +1 -1
- package/lib/commonjs/modules/data-sync/services/base-health-sync-service.js +25 -19
- package/lib/commonjs/modules/data-sync/services/base-health-sync-service.js.map +1 -1
- package/lib/commonjs/modules/data-sync/services/managers/data-processor.js +73 -17
- package/lib/commonjs/modules/data-sync/services/managers/data-processor.js.map +1 -1
- package/lib/commonjs/modules/data-sync/services/managers/storage-manager.js +14 -0
- package/lib/commonjs/modules/data-sync/services/managers/storage-manager.js.map +1 -1
- package/lib/commonjs/modules/data-sync/utils/convert-generic-health-data.js +45 -7
- package/lib/commonjs/modules/data-sync/utils/convert-generic-health-data.js.map +1 -1
- package/lib/commonjs/modules/data-sync/utils/get-health-record-sync-id.js +15 -2
- package/lib/commonjs/modules/data-sync/utils/get-health-record-sync-id.js.map +1 -1
- package/lib/commonjs/modules/data-sync/utils/get-records-from-health-connect.js +103 -8
- 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 +66 -23
- package/lib/commonjs/modules/data-sync/utils/get-samples-from-health.js.map +1 -1
- package/lib/commonjs/modules/data-sync/utils/get-total-records-count.js +4 -1
- package/lib/commonjs/modules/data-sync/utils/get-total-records-count.js.map +1 -1
- package/lib/commonjs/modules/data-sync/utils/get-total-samples-count.js +3 -3
- 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 +364 -0
- package/lib/commonjs/modules/data-sync/utils/health-data-catalog.js.map +1 -0
- package/lib/commonjs/modules/data-sync/utils/health-units.js +13 -11
- package/lib/commonjs/modules/data-sync/utils/health-units.js.map +1 -1
- package/lib/commonjs/modules/data-sync/utils/healthkit-data-types.js +34 -0
- package/lib/commonjs/modules/data-sync/utils/healthkit-data-types.js.map +1 -0
- package/lib/module/modules/bt-device/constants/device-instruction-pdfs.js +2 -1
- package/lib/module/modules/bt-device/constants/device-instruction-pdfs.js.map +1 -1
- package/lib/module/modules/bt-device/constants/device-list-items.js +7 -0
- package/lib/module/modules/bt-device/constants/device-list-items.js.map +1 -1
- package/lib/module/modules/bt-device/constants/supported-device-catalog-assets.js +3 -1
- package/lib/module/modules/bt-device/constants/supported-device-catalog-assets.js.map +1 -1
- package/lib/module/modules/bt-device/constants/supported-devices.js +12 -3
- package/lib/module/modules/bt-device/constants/supported-devices.js.map +1 -1
- package/lib/module/modules/bt-management/core/resolve-device-key.js +6 -1
- package/lib/module/modules/bt-management/core/resolve-device-key.js.map +1 -1
- package/lib/module/modules/bt-management/index.js +4 -0
- package/lib/module/modules/bt-management/index.js.map +1 -1
- package/lib/module/modules/bt-management/services/bt-manager.js +9 -17
- package/lib/module/modules/bt-management/services/bt-manager.js.map +1 -1
- package/lib/module/modules/bt-management/services/device-classes.js +3 -1
- package/lib/module/modules/bt-management/services/device-classes.js.map +1 -1
- package/lib/module/modules/bt-management/services/device-creator.js +9 -7
- package/lib/module/modules/bt-management/services/device-creator.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bp2/bp2.device.js +1 -7
- 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.history-sequencer.js +1 -5
- 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 +2 -8
- package/lib/module/modules/bt-management/services/devices/bt-command-writer.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-connection-handler.js +17 -31
- package/lib/module/modules/bt-management/services/devices/bt-connection-handler.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-device-information.js +2 -3
- package/lib/module/modules/bt-management/services/devices/bt-device-information.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-managed-device.js +8 -24
- 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 +0 -3
- package/lib/module/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/trasense/s9-advertisement.js +26 -0
- package/lib/module/modules/bt-management/services/devices/trasense/s9-advertisement.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/trasense/s9-frame-reader.js +22 -0
- package/lib/module/modules/bt-management/services/devices/trasense/s9-frame-reader.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/trasense/s9.command-sequencer.js +336 -0
- package/lib/module/modules/bt-management/services/devices/trasense/s9.command-sequencer.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/trasense/s9.device.js +69 -0
- package/lib/module/modules/bt-management/services/devices/trasense/s9.device.js.map +1 -0
- package/lib/module/modules/bt-management/types/clock-sync.js +1 -0
- package/lib/module/modules/bt-management/types/clock-sync.js.map +1 -1
- package/lib/module/modules/bt-management/types/device-measurement-map.js.map +1 -1
- package/lib/module/modules/bt-management/types/integrated-devices.js +1 -0
- package/lib/module/modules/bt-management/types/integrated-devices.js.map +1 -1
- package/lib/module/modules/data-sync/index.js +1 -0
- package/lib/module/modules/data-sync/index.js.map +1 -1
- package/lib/module/modules/data-sync/services/base-health-sync-service.js +25 -19
- package/lib/module/modules/data-sync/services/base-health-sync-service.js.map +1 -1
- package/lib/module/modules/data-sync/services/managers/data-processor.js +74 -18
- package/lib/module/modules/data-sync/services/managers/data-processor.js.map +1 -1
- package/lib/module/modules/data-sync/services/managers/storage-manager.js +14 -0
- package/lib/module/modules/data-sync/services/managers/storage-manager.js.map +1 -1
- package/lib/module/modules/data-sync/utils/convert-generic-health-data.js +45 -7
- package/lib/module/modules/data-sync/utils/convert-generic-health-data.js.map +1 -1
- package/lib/module/modules/data-sync/utils/get-health-record-sync-id.js +15 -2
- package/lib/module/modules/data-sync/utils/get-health-record-sync-id.js.map +1 -1
- package/lib/module/modules/data-sync/utils/get-records-from-health-connect.js +103 -8
- 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 +66 -22
- package/lib/module/modules/data-sync/utils/get-samples-from-health.js.map +1 -1
- package/lib/module/modules/data-sync/utils/get-total-records-count.js +4 -1
- package/lib/module/modules/data-sync/utils/get-total-records-count.js.map +1 -1
- package/lib/module/modules/data-sync/utils/get-total-samples-count.js +2 -2
- 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 +360 -0
- package/lib/module/modules/data-sync/utils/health-data-catalog.js.map +1 -0
- package/lib/module/modules/data-sync/utils/health-units.js +13 -11
- package/lib/module/modules/data-sync/utils/health-units.js.map +1 -1
- package/lib/module/modules/data-sync/utils/healthkit-data-types.js +26 -0
- package/lib/module/modules/data-sync/utils/healthkit-data-types.js.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/device-list-items.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts +3 -1
- package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-devices.d.ts +7 -0
- package/lib/typescript/commonjs/src/modules/bt-device/constants/supported-devices.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/core/resolve-device-key.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/core/resolve-device-key.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts +4 -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.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/device-classes.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/device-classes.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/device-creator.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/device-creator.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts.map +1 -1
- 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.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-connection-handler.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-device-information.d.ts.map +1 -1
- 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.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/trasense/s9-advertisement.d.ts +8 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/trasense/s9-advertisement.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/trasense/s9-frame-reader.d.ts +7 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/trasense/s9-frame-reader.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/trasense/s9.command-sequencer.d.ts +63 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/trasense/s9.command-sequencer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/trasense/s9.device.d.ts +18 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/trasense/s9.device.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-connection-event.d.ts +5 -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-data.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-data.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts +3 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/integrated-devices.d.ts +2 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/integrated-devices.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/data-sync/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/services/base-health-sync-service.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/services/managers/data-processor.d.ts +2 -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/services/managers/storage-manager.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/data-sync/services/managers/storage-manager.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/services/managers/sync-progress-manager.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/types/convert-data-props.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/data-sync/types/convert-data-props.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/types/data-from-provider-result.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/data-sync/types/data-from-provider-result.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/types/health-sync-props.d.ts +6 -1
- package/lib/typescript/commonjs/src/modules/data-sync/types/health-sync-props.d.ts.map +1 -1
- 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/get-health-record-sync-id.d.ts +9 -1
- package/lib/typescript/commonjs/src/modules/data-sync/utils/get-health-record-sync-id.d.ts.map +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 +49 -4
- 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-records-count.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 +30 -0
- package/lib/typescript/commonjs/src/modules/data-sync/utils/health-data-catalog.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/data-sync/utils/health-units.d.ts +1 -1
- 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-data-types.d.ts +11 -0
- package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-data-types.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/device-list-items.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts +3 -1
- package/lib/typescript/module/src/modules/bt-device/constants/supported-device-catalog-assets.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-device/constants/supported-devices.d.ts +7 -0
- package/lib/typescript/module/src/modules/bt-device/constants/supported-devices.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/core/resolve-device-key.d.ts +1 -1
- package/lib/typescript/module/src/modules/bt-management/core/resolve-device-key.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/index.d.ts +4 -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.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/device-classes.d.ts +2 -0
- package/lib/typescript/module/src/modules/bt-management/services/device-classes.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/device-creator.d.ts +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/device-creator.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts.map +1 -1
- 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.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-connection-handler.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-device-information.d.ts.map +1 -1
- 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.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/trasense/s9-advertisement.d.ts +8 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/trasense/s9-advertisement.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/trasense/s9-frame-reader.d.ts +7 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/trasense/s9-frame-reader.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/trasense/s9.command-sequencer.d.ts +63 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/trasense/s9.command-sequencer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/trasense/s9.device.d.ts +18 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/trasense/s9.device.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-connection-event.d.ts +5 -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-data.d.ts +2 -0
- package/lib/typescript/module/src/modules/bt-management/types/device-data.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts +3 -0
- package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/integrated-devices.d.ts +2 -1
- package/lib/typescript/module/src/modules/bt-management/types/integrated-devices.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/index.d.ts +1 -0
- package/lib/typescript/module/src/modules/data-sync/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/services/base-health-sync-service.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/services/managers/data-processor.d.ts +2 -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/services/managers/storage-manager.d.ts +2 -0
- package/lib/typescript/module/src/modules/data-sync/services/managers/storage-manager.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/services/managers/sync-progress-manager.d.ts +1 -1
- package/lib/typescript/module/src/modules/data-sync/types/convert-data-props.d.ts +2 -0
- package/lib/typescript/module/src/modules/data-sync/types/convert-data-props.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/types/data-from-provider-result.d.ts +4 -0
- package/lib/typescript/module/src/modules/data-sync/types/data-from-provider-result.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/types/health-sync-props.d.ts +6 -1
- package/lib/typescript/module/src/modules/data-sync/types/health-sync-props.d.ts.map +1 -1
- 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/get-health-record-sync-id.d.ts +9 -1
- package/lib/typescript/module/src/modules/data-sync/utils/get-health-record-sync-id.d.ts.map +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 +49 -4
- 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-records-count.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 +30 -0
- package/lib/typescript/module/src/modules/data-sync/utils/health-data-catalog.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/data-sync/utils/health-units.d.ts +1 -1
- 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-data-types.d.ts +11 -0
- package/lib/typescript/module/src/modules/data-sync/utils/healthkit-data-types.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { base64ToHex } from "../../../utils/base-64-to-hex.js";
|
|
4
|
+
import { hexToByte } from "../../../utils/hex-to-byte.js";
|
|
5
|
+
const NAME = "S9";
|
|
6
|
+
const COMPANY_ID = [0x0a, 0x0a];
|
|
7
|
+
const PAYLOAD_LENGTH = 18;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The SH09 reuses company ID 0x0A0A and advertises only as "S9". Require both
|
|
11
|
+
* fields and the exact manufacturer payload length; the name alone is ambiguous.
|
|
12
|
+
* react-native-ble-plx exposes the manufacturer-specific bytes as base64, including
|
|
13
|
+
* the two company-ID bytes at the start of the AD structure.
|
|
14
|
+
*/
|
|
15
|
+
export const isTrasenseS9Advertisement = (advertisedName, manufacturerData) => {
|
|
16
|
+
if (advertisedName !== NAME || !manufacturerData) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
const bytes = base64ToHex(manufacturerData).map(hexToByte);
|
|
21
|
+
return bytes.length === PAYLOAD_LENGTH + COMPANY_ID.length && bytes[0] === COMPANY_ID[0] && bytes[1] === COMPANY_ID[1];
|
|
22
|
+
} catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=s9-advertisement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["base64ToHex","hexToByte","NAME","COMPANY_ID","PAYLOAD_LENGTH","isTrasenseS9Advertisement","advertisedName","manufacturerData","bytes","map","length"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/trasense/s9-advertisement.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,kCAA+B;AAC3D,SAASC,SAAS,QAAQ,+BAA4B;AAEtD,MAAMC,IAAI,GAAG,IAAI;AACjB,MAAMC,UAAU,GAAG,CAAC,IAAI,EAAE,IAAI,CAAU;AACxC,MAAMC,cAAc,GAAG,EAAE;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,yBAAyB,GAAGA,CACvCC,cAAsB,EACtBC,gBAAyB,KACb;EACZ,IAAID,cAAc,KAAKJ,IAAI,IAAI,CAACK,gBAAgB,EAAE;IAChD,OAAO,KAAK;EACd;EAEA,IAAI;IACF,MAAMC,KAAK,GAAGR,WAAW,CAACO,gBAAgB,CAAC,CAACE,GAAG,CAACR,SAAS,CAAC;IAE1D,OACEO,KAAK,CAACE,MAAM,KAAKN,cAAc,GAAGD,UAAU,CAACO,MAAM,IACnDF,KAAK,CAAC,CAAC,CAAC,KAAKL,UAAU,CAAC,CAAC,CAAC,IAC1BK,KAAK,CAAC,CAAC,CAAC,KAAKL,UAAU,CAAC,CAAC,CAAC;EAE9B,CAAC,CAAC,MAAM;IACN,OAAO,KAAK;EACd;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { FrameReadStatus } from "../../../types/frame-read-status.js";
|
|
4
|
+
const FRAME_LENGTH = 20;
|
|
5
|
+
|
|
6
|
+
/** SH09 notifications are fixed-width, zero-padded 20-byte replies. */
|
|
7
|
+
export class S9FrameReader {
|
|
8
|
+
readFrame(buffer) {
|
|
9
|
+
if (buffer.length < FRAME_LENGTH) {
|
|
10
|
+
return {
|
|
11
|
+
status: FrameReadStatus.INCOMPLETE,
|
|
12
|
+
consumedBytes: 0
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
status: FrameReadStatus.COMPLETE,
|
|
17
|
+
consumedBytes: FRAME_LENGTH,
|
|
18
|
+
frame: buffer.slice(0, FRAME_LENGTH)
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=s9-frame-reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["FrameReadStatus","FRAME_LENGTH","S9FrameReader","readFrame","buffer","length","status","INCOMPLETE","consumedBytes","COMPLETE","frame","slice"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/trasense/s9-frame-reader.ts"],"mappings":";;AACA,SAASA,eAAe,QAAQ,qCAAkC;AAGlE,MAAMC,YAAY,GAAG,EAAE;;AAEvB;AACA,OAAO,MAAMC,aAAa,CAAwB;EACzCC,SAASA,CAACC,MAAyB,EAAmB;IAC3D,IAAIA,MAAM,CAACC,MAAM,GAAGJ,YAAY,EAAE;MAChC,OAAO;QAAEK,MAAM,EAAEN,eAAe,CAACO,UAAU;QAAEC,aAAa,EAAE;MAAE,CAAC;IACjE;IAEA,OAAO;MACLF,MAAM,EAAEN,eAAe,CAACS,QAAQ;MAChCD,aAAa,EAAEP,YAAY;MAC3BS,KAAK,EAAEN,MAAM,CAACO,KAAK,CAAC,CAAC,EAAEV,YAAY;IACrC,CAAC;EACH;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable max-lines */
|
|
4
|
+
|
|
5
|
+
import { MeasurementTypeKey } from "@ovok/core";
|
|
6
|
+
import { CaseType } from "../../../types/case-type.js";
|
|
7
|
+
import { getClockParts } from "../../../types/clock-sync.js";
|
|
8
|
+
import { hexToByte } from "../../../utils/hex-to-byte.js";
|
|
9
|
+
const TRASENSE_S9_SERVICE = "0000fff0-0000-1000-8000-00805f9b34fb";
|
|
10
|
+
const TRASENSE_S9_WRITE = "0000fff1-0000-1000-8000-00805f9b34fb";
|
|
11
|
+
const TRASENSE_S9_NOTIFY = "0000fff2-0000-1000-8000-00805f9b34fb";
|
|
12
|
+
const RESPONSE = {
|
|
13
|
+
identity: 0xf0,
|
|
14
|
+
address: 0x88,
|
|
15
|
+
clock: 0x81,
|
|
16
|
+
historyIndex: 0x90,
|
|
17
|
+
steps: 0x93,
|
|
18
|
+
heartRate: 0xd6,
|
|
19
|
+
battery: 0xb0
|
|
20
|
+
};
|
|
21
|
+
const HISTORY_HOURS = [0x00, 0x06, 0x0c, 0x12];
|
|
22
|
+
const HISTORY_SLOTS = 7;
|
|
23
|
+
const RESPONSE_TIMEOUT_MS = 3_000;
|
|
24
|
+
const MAX_RESPONSE_RETRIES = 1;
|
|
25
|
+
const MAX_HEART_RATE_POLLS = 12;
|
|
26
|
+
const HEART_RATE_POLL_INTERVAL_MS = 1_000;
|
|
27
|
+
const byte = value => (value & 0xff).toString(16).padStart(2, "0");
|
|
28
|
+
const values = frame => frame.map(hexToByte);
|
|
29
|
+
const command = (write, request, delayBeforeWriteMs) => ({
|
|
30
|
+
...write,
|
|
31
|
+
frame: [...request, ...new Array(20 - request.length).fill(0)].map(byte),
|
|
32
|
+
...(delayBeforeWriteMs === undefined ? {} : {
|
|
33
|
+
delayBeforeWriteMs
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
const decodeFirmware = frame => values(frame).slice(1).filter(value => value !== 0).map(value => String.fromCharCode(value)).join("").trim();
|
|
37
|
+
const buildDateFromFirmware = firmware => {
|
|
38
|
+
const match = /^(\d{4})(\d{2})(\d{2})\.SH09(?:\.|$)/.exec(firmware);
|
|
39
|
+
if (!match) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
const date = {
|
|
43
|
+
year: Number(match[1]),
|
|
44
|
+
month: Number(match[2]),
|
|
45
|
+
day: Number(match[3])
|
|
46
|
+
};
|
|
47
|
+
return isValidDate(date) ? date : undefined;
|
|
48
|
+
};
|
|
49
|
+
const isValidDate = ({
|
|
50
|
+
year,
|
|
51
|
+
month,
|
|
52
|
+
day
|
|
53
|
+
}) => {
|
|
54
|
+
const date = new Date(0);
|
|
55
|
+
date.setFullYear(year, month - 1, day);
|
|
56
|
+
return Number.isInteger(year) && Number.isInteger(month) && Number.isInteger(day) && month >= 1 && month <= 12 && day >= 1 && date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day;
|
|
57
|
+
};
|
|
58
|
+
const dateFromReply = frame => {
|
|
59
|
+
if (frame.length < 5) {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
const date = {
|
|
63
|
+
year: (frame[1] ?? 0) * 100 + (frame[2] ?? 0),
|
|
64
|
+
month: frame[3] ?? 0,
|
|
65
|
+
day: frame[4] ?? 0
|
|
66
|
+
};
|
|
67
|
+
return isValidDate(date) ? date : undefined;
|
|
68
|
+
};
|
|
69
|
+
const isBefore = (left, right) => left.year < right.year || left.year === right.year && left.month < right.month || left.year === right.year && left.month === right.month && left.day < right.day;
|
|
70
|
+
const dateAtHour = (date, hour, timezone) => {
|
|
71
|
+
const result = new Date(0);
|
|
72
|
+
if (timezone === "utc") {
|
|
73
|
+
result.setUTCFullYear(date.year, date.month - 1, date.day);
|
|
74
|
+
result.setUTCHours(hour, 0, 0, 0);
|
|
75
|
+
} else {
|
|
76
|
+
result.setFullYear(date.year, date.month - 1, date.day);
|
|
77
|
+
result.setHours(hour, 0, 0, 0);
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
};
|
|
81
|
+
const isResponseFor = (phase, frame) => {
|
|
82
|
+
const response = hexToByte(frame[0] ?? "00");
|
|
83
|
+
if (phase === "heart-rate") {
|
|
84
|
+
return response === RESPONSE.heartRate && hexToByte(frame[1] ?? "00") === 0x02;
|
|
85
|
+
}
|
|
86
|
+
switch (phase) {
|
|
87
|
+
case "identity":
|
|
88
|
+
return response === RESPONSE.identity;
|
|
89
|
+
case "address":
|
|
90
|
+
return response === RESPONSE.address;
|
|
91
|
+
case "clock":
|
|
92
|
+
return response === RESPONSE.clock;
|
|
93
|
+
case "history-index":
|
|
94
|
+
return response === RESPONSE.historyIndex;
|
|
95
|
+
case "steps":
|
|
96
|
+
return response === RESPONSE.steps;
|
|
97
|
+
case "battery":
|
|
98
|
+
return response === RESPONSE.battery;
|
|
99
|
+
case "done":
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/** Runs only the SH09 commands verified on firmware image 1. */
|
|
105
|
+
class S9CommandSequencer {
|
|
106
|
+
phase = "identity";
|
|
107
|
+
retries = 0;
|
|
108
|
+
firmware = "";
|
|
109
|
+
historyCount = 0;
|
|
110
|
+
historySlot = 0;
|
|
111
|
+
historyHourIndex = 0;
|
|
112
|
+
heartRatePolls = 0;
|
|
113
|
+
constructor(params) {
|
|
114
|
+
this.params = params;
|
|
115
|
+
}
|
|
116
|
+
initialCommands = () => [this.queue([0x70])];
|
|
117
|
+
isHistoryTransfer = () => true;
|
|
118
|
+
commandTimeoutMs = () => RESPONSE_TIMEOUT_MS;
|
|
119
|
+
commandProgress = frame => isResponseFor(this.phase, frame) ? "complete" : "ignored";
|
|
120
|
+
onCommandTimeout = () => {
|
|
121
|
+
if (this.pendingCommand && this.retries < MAX_RESPONSE_RETRIES) {
|
|
122
|
+
this.retries += 1;
|
|
123
|
+
return {
|
|
124
|
+
commands: [this.pendingCommand]
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
return {
|
|
128
|
+
terminal: true
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
nextCommand = frame => {
|
|
132
|
+
if (!isResponseFor(this.phase, frame)) {
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
this.pendingCommand = undefined;
|
|
136
|
+
this.retries = 0;
|
|
137
|
+
const response = values(frame);
|
|
138
|
+
switch (this.phase) {
|
|
139
|
+
case "identity":
|
|
140
|
+
return this.handleIdentity(frame);
|
|
141
|
+
case "address":
|
|
142
|
+
return this.handleAddress(response);
|
|
143
|
+
case "clock":
|
|
144
|
+
this.reportClockWrite();
|
|
145
|
+
return this.queueHistoryIndex();
|
|
146
|
+
case "history-index":
|
|
147
|
+
return this.handleHistoryIndex(response);
|
|
148
|
+
case "steps":
|
|
149
|
+
if (!this.handleSteps(response)) {
|
|
150
|
+
return undefined;
|
|
151
|
+
}
|
|
152
|
+
return this.queueNextStepsOrHeartRate();
|
|
153
|
+
case "heart-rate":
|
|
154
|
+
return this.handleHeartRate(response);
|
|
155
|
+
case "battery":
|
|
156
|
+
this.handleBattery(response);
|
|
157
|
+
this.finish();
|
|
158
|
+
return undefined;
|
|
159
|
+
case "done":
|
|
160
|
+
return undefined;
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
handleIdentity = frame => {
|
|
164
|
+
const firmware = decodeFirmware(frame);
|
|
165
|
+
if (!/(?:^|\.)SH09(?:\.|$)/.test(firmware)) {
|
|
166
|
+
this.params.onError(new Error("Trasense S9 identity check failed."));
|
|
167
|
+
this.finish();
|
|
168
|
+
return undefined;
|
|
169
|
+
}
|
|
170
|
+
this.firmware = firmware;
|
|
171
|
+
this.firmwareBuildDate = buildDateFromFirmware(firmware);
|
|
172
|
+
this.phase = "address";
|
|
173
|
+
return [this.queue([0x08])];
|
|
174
|
+
};
|
|
175
|
+
handleAddress = response => {
|
|
176
|
+
if (response.length < 7) {
|
|
177
|
+
this.params.onError(new Error("Trasense S9 address reply was incomplete."));
|
|
178
|
+
this.finish();
|
|
179
|
+
return undefined;
|
|
180
|
+
}
|
|
181
|
+
const addressBytes = response.slice(1, 7).reverse();
|
|
182
|
+
if (addressBytes.every(value => value === 0 || value === 0xff)) {
|
|
183
|
+
this.params.onError(new Error("Trasense S9 address reply was invalid."));
|
|
184
|
+
this.finish();
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
187
|
+
const hardwareAddress = addressBytes.map(byte).join(":").toUpperCase();
|
|
188
|
+
this.params.onIdentity(this.firmware, hardwareAddress);
|
|
189
|
+
this.params.onConnectionEvent({
|
|
190
|
+
kind: "device-identified"
|
|
191
|
+
});
|
|
192
|
+
return [this.queueClockOrHistoryIndex()];
|
|
193
|
+
};
|
|
194
|
+
queueClockOrHistoryIndex = () => {
|
|
195
|
+
const options = this.params.clockSync;
|
|
196
|
+
if (options?.enabled === false) {
|
|
197
|
+
return this.queueHistoryIndex()[0];
|
|
198
|
+
}
|
|
199
|
+
this.phase = "clock";
|
|
200
|
+
const now = options?.now?.() ?? new Date();
|
|
201
|
+
|
|
202
|
+
// SH09 has no time-zone setting; its clock and history are local wall time.
|
|
203
|
+
const parts = getClockParts(now, "local");
|
|
204
|
+
return this.queue([0x01, Math.floor(parts.year / 100), parts.year % 100, parts.month, parts.day, parts.hours, parts.minutes, parts.seconds, 0x00, 0x18], undefined, now);
|
|
205
|
+
};
|
|
206
|
+
reportClockWrite = () => {
|
|
207
|
+
const clockAt = this.clockAt ?? new Date();
|
|
208
|
+
this.params.onConnectionEvent({
|
|
209
|
+
kind: "clock-synchronized",
|
|
210
|
+
clockAt,
|
|
211
|
+
phoneUtcOffsetMinutes: -clockAt.getTimezoneOffset()
|
|
212
|
+
});
|
|
213
|
+
};
|
|
214
|
+
queueHistoryIndex = () => {
|
|
215
|
+
this.phase = "history-index";
|
|
216
|
+
return [this.queue([0x10])];
|
|
217
|
+
};
|
|
218
|
+
handleHistoryIndex = response => {
|
|
219
|
+
if (response.length < 7) {
|
|
220
|
+
this.params.onError(new Error("Trasense S9 history index was incomplete."));
|
|
221
|
+
this.finish();
|
|
222
|
+
return undefined;
|
|
223
|
+
}
|
|
224
|
+
const todaySlot = response[1] ?? 0;
|
|
225
|
+
const count = response[2] ?? 0;
|
|
226
|
+
if (count > HISTORY_SLOTS || todaySlot >= Math.max(count, 1)) {
|
|
227
|
+
this.params.onError(new Error("Trasense S9 history index was invalid."));
|
|
228
|
+
this.finish();
|
|
229
|
+
return undefined;
|
|
230
|
+
}
|
|
231
|
+
this.historyCount = count;
|
|
232
|
+
this.historySlot = 0;
|
|
233
|
+
this.historyHourIndex = 0;
|
|
234
|
+
if (count === 0 || !this.firmwareBuildDate) {
|
|
235
|
+
return this.queueHeartRate();
|
|
236
|
+
}
|
|
237
|
+
return this.queueSteps();
|
|
238
|
+
};
|
|
239
|
+
queueSteps = () => {
|
|
240
|
+
this.phase = "steps";
|
|
241
|
+
return [this.queue([0x13, this.historySlot, HISTORY_HOURS[this.historyHourIndex] ?? 0])];
|
|
242
|
+
};
|
|
243
|
+
handleSteps = response => {
|
|
244
|
+
const date = dateFromReply(response);
|
|
245
|
+
const hour = response[5] ?? -1;
|
|
246
|
+
const expectedHour = HISTORY_HOURS[this.historyHourIndex];
|
|
247
|
+
if (response.length < 18 || !date || hour !== expectedHour) {
|
|
248
|
+
this.params.onError(new Error("Trasense S9 steps reply was invalid."));
|
|
249
|
+
this.finish();
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
if (this.firmwareBuildDate && !isBefore(date, this.firmwareBuildDate)) {
|
|
253
|
+
for (let index = 0; index < 6; index += 1) {
|
|
254
|
+
const high = response[6 + index * 2] ?? 0;
|
|
255
|
+
const low = response[7 + index * 2] ?? 0;
|
|
256
|
+
const stepCount = high * 256 + low;
|
|
257
|
+
if (stepCount === 0xffff) {
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
const start = dateAtHour(date, hour + index, "local");
|
|
261
|
+
this.params.onResult({
|
|
262
|
+
caseType: CaseType.RESULT,
|
|
263
|
+
measurementTypeKey: MeasurementTypeKey.stepCount,
|
|
264
|
+
stepCount,
|
|
265
|
+
start,
|
|
266
|
+
end: new Date(start.getTime() + 60 * 60 * 1000)
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return true;
|
|
271
|
+
};
|
|
272
|
+
queueNextStepsOrHeartRate = () => {
|
|
273
|
+
this.historyHourIndex += 1;
|
|
274
|
+
if (this.historyHourIndex >= HISTORY_HOURS.length) {
|
|
275
|
+
this.historyHourIndex = 0;
|
|
276
|
+
this.historySlot += 1;
|
|
277
|
+
}
|
|
278
|
+
if (this.historySlot < this.historyCount) {
|
|
279
|
+
return this.queueSteps();
|
|
280
|
+
}
|
|
281
|
+
return this.queueHeartRate();
|
|
282
|
+
};
|
|
283
|
+
queueHeartRate = () => {
|
|
284
|
+
this.phase = "heart-rate";
|
|
285
|
+
this.heartRatePolls = 0;
|
|
286
|
+
return [this.queue([0x56, 0x02])];
|
|
287
|
+
};
|
|
288
|
+
handleHeartRate = response => {
|
|
289
|
+
const heartRate = response[2] ?? 0;
|
|
290
|
+
if (heartRate >= 40 && heartRate <= 200) {
|
|
291
|
+
const recordedAt = this.params.clockSync?.now?.() ?? new Date();
|
|
292
|
+
this.params.onResult({
|
|
293
|
+
caseType: CaseType.RESULT,
|
|
294
|
+
measurementTypeKey: MeasurementTypeKey.heartRate,
|
|
295
|
+
heartRate,
|
|
296
|
+
start: recordedAt,
|
|
297
|
+
end: recordedAt
|
|
298
|
+
});
|
|
299
|
+
return this.queueBattery();
|
|
300
|
+
}
|
|
301
|
+
this.heartRatePolls += 1;
|
|
302
|
+
if (this.heartRatePolls < MAX_HEART_RATE_POLLS) {
|
|
303
|
+
return [this.queue([0x56, 0x02], HEART_RATE_POLL_INTERVAL_MS)];
|
|
304
|
+
}
|
|
305
|
+
return this.queueBattery();
|
|
306
|
+
};
|
|
307
|
+
queueBattery = () => {
|
|
308
|
+
this.phase = "battery";
|
|
309
|
+
return [this.queue([0x30])];
|
|
310
|
+
};
|
|
311
|
+
handleBattery = response => {
|
|
312
|
+
const level = response[1] ?? -1;
|
|
313
|
+
if (level < 0 || level > 5) {
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
this.params.onConnectionEvent({
|
|
317
|
+
kind: "battery",
|
|
318
|
+
batteryLevel: level === 0 ? 5 : level * 20
|
|
319
|
+
});
|
|
320
|
+
};
|
|
321
|
+
queue = (request, delayBeforeWriteMs, clockAt) => {
|
|
322
|
+
this.pendingCommand = command(this.params.write, request, delayBeforeWriteMs);
|
|
323
|
+
this.retries = 0;
|
|
324
|
+
if (clockAt) {
|
|
325
|
+
this.clockAt = clockAt;
|
|
326
|
+
}
|
|
327
|
+
return this.pendingCommand;
|
|
328
|
+
};
|
|
329
|
+
finish = () => {
|
|
330
|
+
this.phase = "done";
|
|
331
|
+
this.pendingCommand = undefined;
|
|
332
|
+
this.params.onComplete();
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
export { S9CommandSequencer, TRASENSE_S9_NOTIFY, TRASENSE_S9_SERVICE, TRASENSE_S9_WRITE };
|
|
336
|
+
//# sourceMappingURL=s9.command-sequencer.js.map
|
package/lib/module/modules/bt-management/services/devices/trasense/s9.command-sequencer.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","CaseType","getClockParts","hexToByte","TRASENSE_S9_SERVICE","TRASENSE_S9_WRITE","TRASENSE_S9_NOTIFY","RESPONSE","identity","address","clock","historyIndex","steps","heartRate","battery","HISTORY_HOURS","HISTORY_SLOTS","RESPONSE_TIMEOUT_MS","MAX_RESPONSE_RETRIES","MAX_HEART_RATE_POLLS","HEART_RATE_POLL_INTERVAL_MS","byte","value","toString","padStart","values","frame","map","command","write","request","delayBeforeWriteMs","Array","length","fill","undefined","decodeFirmware","slice","filter","String","fromCharCode","join","trim","buildDateFromFirmware","firmware","match","exec","date","year","Number","month","day","isValidDate","Date","setFullYear","isInteger","getFullYear","getMonth","getDate","dateFromReply","isBefore","left","right","dateAtHour","hour","timezone","result","setUTCFullYear","setUTCHours","setHours","isResponseFor","phase","response","S9CommandSequencer","retries","historyCount","historySlot","historyHourIndex","heartRatePolls","constructor","params","initialCommands","queue","isHistoryTransfer","commandTimeoutMs","commandProgress","onCommandTimeout","pendingCommand","commands","terminal","nextCommand","handleIdentity","handleAddress","reportClockWrite","queueHistoryIndex","handleHistoryIndex","handleSteps","queueNextStepsOrHeartRate","handleHeartRate","handleBattery","finish","test","onError","Error","firmwareBuildDate","addressBytes","reverse","every","hardwareAddress","toUpperCase","onIdentity","onConnectionEvent","kind","queueClockOrHistoryIndex","options","clockSync","enabled","now","parts","Math","floor","hours","minutes","seconds","clockAt","phoneUtcOffsetMinutes","getTimezoneOffset","todaySlot","count","max","queueHeartRate","queueSteps","expectedHour","index","high","low","stepCount","start","onResult","caseType","RESULT","measurementTypeKey","end","getTime","recordedAt","queueBattery","level","batteryLevel","onComplete"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/trasense/s9.command-sequencer.ts"],"mappings":";;AAAA;;AAEA,SAASA,kBAAkB,QAAQ,YAAY;AAE/C,SAASC,QAAQ,QAAQ,6BAA0B;AACnD,SAA2BC,aAAa,QAAQ,8BAA2B;AAM3E,SAASC,SAAS,QAAQ,+BAA4B;AAEtD,MAAMC,mBAAmB,GAAG,sCAAsC;AAClE,MAAMC,iBAAiB,GAAG,sCAAsC;AAChE,MAAMC,kBAAkB,GAAG,sCAAsC;AAEjE,MAAMC,QAAQ,GAAG;EACfC,QAAQ,EAAE,IAAI;EACdC,OAAO,EAAE,IAAI;EACbC,KAAK,EAAE,IAAI;EACXC,YAAY,EAAE,IAAI;EAClBC,KAAK,EAAE,IAAI;EACXC,SAAS,EAAE,IAAI;EACfC,OAAO,EAAE;AACX,CAAU;AAEV,MAAMC,aAAa,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU;AACvD,MAAMC,aAAa,GAAG,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AO,CAAC,IAAI,CAACoD,MAAM,CAACnD,KAAK,EAAEC,OAAO,EAAEC,kBAAkB,CAAC;IAC7E,IAAI,CAAC2C,OAAO,GAAG,CAAC;IAEhB,IAAIkD,OAAO,EAAE;MACX,IAAI,CAACA,OAAO,GAAGA,OAAO;IACxB;IAEA,OAAO,IAAI,CAACrC,cAAc;EAC5B,CAAC;EAEOa,MAAM,GAAGA,CAAA,KAAY;IAC3B,IAAI,CAAC7B,KAAK,GAAG,MAAM;IACnB,IAAI,CAACgB,cAAc,GAAGpD,SAAS;IAC/B,IAAI,CAAC6C,MAAM,CAACoE,UAAU,CAAC,CAAC;EAC1B,CAAC;AACH;AAEA,SACE3E,kBAAkB,EAClBnE,kBAAkB,EAClBF,mBAAmB,EACnBC,iBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { MeasurementTypeKey } from "@ovok/core";
|
|
4
|
+
import { CaseType } from "../../../types/case-type.js";
|
|
5
|
+
import { BTManagedDevice } from "../bt-managed-device.js";
|
|
6
|
+
import { S9FrameReader } from "./s9-frame-reader.js";
|
|
7
|
+
import { S9CommandSequencer, TRASENSE_S9_NOTIFY, TRASENSE_S9_SERVICE, TRASENSE_S9_WRITE } from "./s9.command-sequencer.js";
|
|
8
|
+
const acceptProtocolFrames = {
|
|
9
|
+
caseValuePosition: [],
|
|
10
|
+
cases: [{
|
|
11
|
+
caseValue: "",
|
|
12
|
+
caseType: CaseType.OTHER,
|
|
13
|
+
parseDefinitions: [],
|
|
14
|
+
description: "SH09 protocol frame handled by its command sequencer"
|
|
15
|
+
}]
|
|
16
|
+
};
|
|
17
|
+
const s9Services = [{
|
|
18
|
+
uuid: TRASENSE_S9_SERVICE,
|
|
19
|
+
writeUuid: {
|
|
20
|
+
uuid: TRASENSE_S9_SERVICE,
|
|
21
|
+
mainCommandUuid: TRASENSE_S9_WRITE
|
|
22
|
+
},
|
|
23
|
+
monitorUuids: [{
|
|
24
|
+
uuid: TRASENSE_S9_NOTIFY,
|
|
25
|
+
parsingModel: acceptProtocolFrames
|
|
26
|
+
}]
|
|
27
|
+
}];
|
|
28
|
+
const S9_SUPPORTED_MEASUREMENTS = [MeasurementTypeKey.stepCount, MeasurementTypeKey.heartRate];
|
|
29
|
+
|
|
30
|
+
/** Trasense SH09. Its address and advertisement data are sensitive and never logged. */
|
|
31
|
+
export class TrasenseS9Device extends BTManagedDevice {
|
|
32
|
+
mainServices = s9Services;
|
|
33
|
+
stuckDataTimeout = 120_000;
|
|
34
|
+
onStreamStart = undefined;
|
|
35
|
+
frameReader = new S9FrameReader();
|
|
36
|
+
constructor(device, params) {
|
|
37
|
+
super(device, params);
|
|
38
|
+
|
|
39
|
+
// Manufacturer data contains device health information; do not expose it in callbacks.
|
|
40
|
+
this.deviceData.manufacturerData = "";
|
|
41
|
+
this.createCommandSequencer = () => new S9CommandSequencer({
|
|
42
|
+
clockSync: params.clockSync,
|
|
43
|
+
write: {
|
|
44
|
+
serviceUuid: TRASENSE_S9_SERVICE,
|
|
45
|
+
characteristicUuid: TRASENSE_S9_WRITE
|
|
46
|
+
},
|
|
47
|
+
onResult: result => this.onResult?.(result),
|
|
48
|
+
onConnectionEvent: event => this.onConnectionEvent?.({
|
|
49
|
+
deviceData: this.deviceData,
|
|
50
|
+
...event
|
|
51
|
+
}),
|
|
52
|
+
onIdentity: (_firmware, hardwareAddress) => {
|
|
53
|
+
this.deviceData.model = "SH09";
|
|
54
|
+
this.deviceData.hardwareAddress = hardwareAddress;
|
|
55
|
+
},
|
|
56
|
+
onError: error => this.onError?.(error),
|
|
57
|
+
onComplete: () => {
|
|
58
|
+
setTimeout(() => void this.disconnect(), 0);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
getSupportedMeasurementTypeKeys() {
|
|
63
|
+
return [...S9_SUPPORTED_MEASUREMENTS];
|
|
64
|
+
}
|
|
65
|
+
handleSuccessResult() {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=s9.device.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","CaseType","BTManagedDevice","S9FrameReader","S9CommandSequencer","TRASENSE_S9_NOTIFY","TRASENSE_S9_SERVICE","TRASENSE_S9_WRITE","acceptProtocolFrames","caseValuePosition","cases","caseValue","caseType","OTHER","parseDefinitions","description","s9Services","uuid","writeUuid","mainCommandUuid","monitorUuids","parsingModel","S9_SUPPORTED_MEASUREMENTS","stepCount","heartRate","TrasenseS9Device","mainServices","stuckDataTimeout","onStreamStart","undefined","frameReader","constructor","device","params","deviceData","manufacturerData","createCommandSequencer","clockSync","write","serviceUuid","characteristicUuid","onResult","result","onConnectionEvent","event","onIdentity","_firmware","hardwareAddress","model","onError","error","onComplete","setTimeout","disconnect","getSupportedMeasurementTypeKeys","handleSuccessResult"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/trasense/s9.device.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,YAAY;AAG/C,SAASC,QAAQ,QAAQ,6BAA0B;AAKnD,SAASC,eAAe,QAAQ,yBAAsB;AAEtD,SAASC,aAAa,QAAQ,sBAAmB;AACjD,SACEC,kBAAkB,EAClBC,kBAAkB,EAClBC,mBAAmB,EACnBC,iBAAiB,QACZ,2BAAwB;AAE/B,MAAMC,oBAAoB,GAAG;EAC3BC,iBAAiB,EAAE,EAAE;EACrBC,KAAK,EAAE,CACL;IACEC,SAAS,EAAE,EAAE;IACbC,QAAQ,EAAEX,QAAQ,CAACY,KAAK;IACxBC,gBAAgB,EAAE,EAAE;IACpBC,WAAW,EAAE;EACf,CAAC;AAEL,CAAC;AAED,MAAMC,UAAsB,GAAG,CAC7B;EACEC,IAAI,EAAEX,mBAAmB;EACzBY,SAAS,EAAE;IACTD,IAAI,EAAEX,mBAAmB;IACzBa,eAAe,EAAEZ;EACnB,CAAC;EACDa,Y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AAC,CAAC,EAAE,CAAC,CAAC;MAC7C;IACF,CAAC,CAAC;EACN;EAEmBC,+BAA+BA,CAAA,EAAyB;IACzE,OAAO,CAAC,GAAGhC,yBAAyB,CAAC;EACvC;EAEUiC,mBAAmBA,CAAA,EAAmB;IAC9C;EACF;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["IntegratedDevices","isClockSyncEnabled","options","enabled","getClockParts","date","timezone","year","getUTCFullYear","month","getUTCMonth","day","getUTCDate","hours","getUTCHours","minutes","getUTCMinutes","seconds","getUTCSeconds","milliseconds","getUTCMilliseconds","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","getMilliseconds","clockSyncCapabilityForDevice","deviceName","BC01","MYSENSE","VEROVAL_ECG","AOJ20A","BP2","VIATOM_R20","VIATOM_R200","VIATOM_BBSM_BS1","VEROVAL_ACTIVITY","GENIAL_T31","ZH_SG_A606"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/types/clock-sync.ts"],"mappings":";;AAAA;;AAEA,SAASA,iBAAiB,QAAQ,yBAAsB;AAkBxD,OAAO,MAAMC,kBAAkB,GAAIC,OAA0B,IAC3DA,OAAO,EAAEC,OAAO,KAAK,KAAK;AAE5B,OAAO,MAAMC,aAAa,GAAGA,CAC3BC,IAAU,EACVC,QAA2B,GAAG,OAAO,KAErCA,QAAQ,KAAK,KAAK,GACd;EACEC,IAAI,EAAEF,IAAI,CAACG,cAAc,CAAC,CAAC;EAC3BC,KAAK,EAAEJ,IAAI,CAACK,WAAW,CAAC,CAAC,GAAG,CAAC;EAC7BC,GAAG,EAAEN,IAAI,CAACO,UAAU,CAAC,CAAC;EACtBC,KAAK,EAAER,IAAI,CAACS,WAAW,CAAC,CAAC;EACzBC,OAAO,EAAEV,IAAI,CAACW,aAAa,CAAC,CAAC;EAC7BC,OAAO,EAAEZ,IAAI,CAACa,aAAa,CAAC,CAAC;EAC7BC,YAAY,EAAEd,IAAI,CAACe,kBAAkB,CAAC;AACxC,CAAC,GACD;EACEb,IAAI,EAAEF,IAAI,CAACgB,WAAW,CAAC,CAAC;EACxBZ,KAAK,EAAEJ,IAAI,CAACiB,QAAQ,CAAC,CAAC,GAAG,CAAC;EAC1BX,GAAG,EAAEN,IAAI,CAACkB,OAAO,CAAC,CAAC;EACnBV,KAAK,EAAER,IAAI,CAACmB,QAAQ,CAAC,CAAC;EACtBT,OAAO,EAAEV,IAAI,CAACoB,UAAU,CAAC,CAAC;EAC1BR,OAAO,EAAEZ,IAAI,CAACqB,UAAU,CAAC,CAAC;EAC1BP,YAAY,EAAEd,IAAI,CAACsB,eAAe,CAAC;AACrC,CAAC;;AAEP;AACA,OAAO,MAAMC,4BAA4B,GACvCC,UAAkB,IACM;EACxB,QAAQA,UAAU;IAChB,KAAK7B,iBAAiB,CAAC8B,IAAI;IAC3B,KAAK9B,iBAAiB,CAAC+B,OAAO;IAC9B,KAAK/B,iBAAiB,CAACgC,WAAW;IAClC,KAAKhC,iBAAiB,CAACiC,MAAM;IAC7B,KAAKjC,iBAAiB,CAACkC,GAAG;IAC1B,KAAKlC,iBAAiB,CAACmC,UAAU;IACjC,KAAKnC,iBAAiB,CAACoC,WAAW;IAClC,KAAKpC,iBAAiB,CAACqC,eAAe;MACpC,OAAO,WAAW;IACpB,KAAKrC,iBAAiB,CAACsC,gBAAgB;MACrC,OAAO,aAAa;IACtB,KAAKtC,iBAAiB,CAACuC,UAAU;IACjC,KAAKvC,iBAAiB,CAACwC,UAAU;
|
|
1
|
+
{"version":3,"names":["IntegratedDevices","isClockSyncEnabled","options","enabled","getClockParts","date","timezone","year","getUTCFullYear","month","getUTCMonth","day","getUTCDate","hours","getUTCHours","minutes","getUTCMinutes","seconds","getUTCSeconds","milliseconds","getUTCMilliseconds","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","getMilliseconds","clockSyncCapabilityForDevice","deviceName","BC01","MYSENSE","VEROVAL_ECG","AOJ20A","BP2","VIATOM_R20","VIATOM_R200","VIATOM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AI;IAC3B,KAAK9B,iBAAiB,CAAC+B,OAAO;IAC9B,KAAK/B,iBAAiB,CAACgC,WAAW;IAClC,KAAKhC,iBAAiB,CAACiC,MAAM;IAC7B,KAAKjC,iBAAiB,CAACkC,GAAG;IAC1B,KAAKlC,iBAAiB,CAACmC,UAAU;IACjC,KAAKnC,iBAAiB,CAACoC,WAAW;IAClC,KAAKpC,iBAAiB,CAACqC,eAAe;MACpC,OAAO,WAAW;IACpB,KAAKrC,iBAAiB,CAACsC,gBAAgB;MACrC,OAAO,aAAa;IACtB,KAAKtC,iBAAiB,CAACuC,UAAU;IACjC,KAAKvC,iBAAiB,CAACwC,UAAU;IACjC,KAAKxC,iBAAiB,CAACyC,WAAW;MAChC,OAAO,WAAW;IACpB;MACE,OAAO,SAAS;EACpB;AACF,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["IntegratedDevices"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/types/device-measurement-map.ts"],"mappings":";;AAiBA,SAASA,iBAAiB,QAAQ,yBAAsB;;
|
|
1
|
+
{"version":3,"names":["IntegratedDevices"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/types/device-measurement-map.ts"],"mappings":";;AAiBA,SAASA,iBAAiB,QAAQ,yBAAsB;;AAkHxD;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -57,6 +57,7 @@ export let IntegratedDevices = /*#__PURE__*/function (IntegratedDevices) {
|
|
|
57
57
|
IntegratedDevices["PF10AW_ME"] = "PF10AW-ME";
|
|
58
58
|
IntegratedDevices["SA10AW_PU"] = "SA10AW-PU";
|
|
59
59
|
IntegratedDevices["PF10BW_VE"] = "PF10BW-VE";
|
|
60
|
+
IntegratedDevices["TRASENSE_S9"] = "Trasense S9";
|
|
60
61
|
return IntegratedDevices;
|
|
61
62
|
}({});
|
|
62
63
|
//# sourceMappingURL=integrated-devices.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["IntegratedDevices"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/types/integrated-devices.ts"],"mappings":";;AAAA,WAAYA,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["IntegratedDevices"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/types/integrated-devices.ts"],"mappings":";;AAAA,WAAYA,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA","ignoreList":[]}
|
|
@@ -9,5 +9,6 @@ export * from "./types/health-authorization-status.js";
|
|
|
9
9
|
export * from "./types/health-sync-keys.js";
|
|
10
10
|
export * from "./types/health-sync-batch-error.js";
|
|
11
11
|
export * from "./hooks/use-health-import.js";
|
|
12
|
+
export { HEALTH_DATA_CATALOG, getHealthDataCoding } from "./utils/health-data-catalog.js";
|
|
12
13
|
export { HealthAuthorizationContext, useHealthAuthorization } from "./contexts/health-authorization-context.js";
|
|
13
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HealthAuthorizationContext","useHealthAuthorization"],"sourceRoot":"../../../../src","sources":["modules/data-sync/index.ts"],"mappings":";;AAAA,cAAc,2BAAwB;AACtC,cAAc,oCAAiC;AAC/C,cAAc,uDAAoD;AAClE,cAAc,0BAAuB;AACrC,cAAc,sCAAmC;AACjD,cAAc,wCAAqC;AACnD,cAAc,6BAA0B;AACxC,cAAc,oCAAiC;AAC/C,cAAc,8BAA2B;AACzC,
|
|
1
|
+
{"version":3,"names":["HEALTH_DATA_CATALOG","getHealthDataCoding","HealthAuthorizationContext","useHealthAuthorization"],"sourceRoot":"../../../../src","sources":["modules/data-sync/index.ts"],"mappings":";;AAAA,cAAc,2BAAwB;AACtC,cAAc,oCAAiC;AAC/C,cAAc,uDAAoD;AAClE,cAAc,0BAAuB;AACrC,cAAc,sCAAmC;AACjD,cAAc,wCAAqC;AACnD,cAAc,6BAA0B;AACxC,cAAc,oCAAiC;AAC/C,cAAc,8BAA2B;AACzC,SAASA,mBAAmB,EAAEC,mBAAmB,QAAQ,gCAA6B;AACtF,SACEC,0BAA0B,EAC1BC,sBAAsB,QACjB,4CAAyC","ignoreList":[]}
|
|
@@ -71,7 +71,7 @@ export class BaseHealthSyncService {
|
|
|
71
71
|
if (!data) {
|
|
72
72
|
continue;
|
|
73
73
|
}
|
|
74
|
-
const latestValidStartDate = this.dataProcessor.getLatestValidStartDate(this.stateManager.latestObservationDates, data, getHealthDataMode(measurementTypeKey, data.mode));
|
|
74
|
+
const latestValidStartDate = this.dataProcessor.getLatestValidStartDate(this.stateManager.latestObservationDates, data, measurementTypeKey, getHealthDataMode(measurementTypeKey, data.mode));
|
|
75
75
|
const totalCount = await this.dataProcessor.getTotalRecordsCountForType(measurementTypeKey, data, latestValidStartDate);
|
|
76
76
|
this.progressManager.setTotalObservations(measurementTypeKey, totalCount);
|
|
77
77
|
}
|
|
@@ -92,12 +92,13 @@ export class BaseHealthSyncService {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
async syncDataByType(measurementTypeKey, data) {
|
|
95
|
-
const latestValidStartDate = this.dataProcessor.getLatestValidStartDate(this.stateManager.latestObservationDates, data, getHealthDataMode(measurementTypeKey, data.mode));
|
|
95
|
+
const latestValidStartDate = this.dataProcessor.getLatestValidStartDate(this.stateManager.latestObservationDates, data, measurementTypeKey, getHealthDataMode(measurementTypeKey, data.mode));
|
|
96
96
|
let hasMore = true;
|
|
97
97
|
while (hasMore && !this.stateManager.shouldStopSync) {
|
|
98
98
|
const {
|
|
99
99
|
observationBodies,
|
|
100
100
|
observationSyncIds,
|
|
101
|
+
deletedObservationSyncIds,
|
|
101
102
|
hasMore: currentHasMore,
|
|
102
103
|
anchors
|
|
103
104
|
} = await this.dataProcessor.getObservationBodiesForType(measurementTypeKey, data, latestValidStartDate);
|
|
@@ -106,25 +107,30 @@ export class BaseHealthSyncService {
|
|
|
106
107
|
break;
|
|
107
108
|
}
|
|
108
109
|
const entries = this.dataProcessor.generateObservationEntries(observationBodies, observationSyncIds, getHealthDataMode(measurementTypeKey, data.mode));
|
|
109
|
-
if (entries.length !== 0 && !this.stateManager.shouldStopSync) {
|
|
110
|
+
if ((entries.length !== 0 || deletedObservationSyncIds.length !== 0) && !this.stateManager.shouldStopSync) {
|
|
110
111
|
try {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
if (entries.length !== 0) {
|
|
113
|
+
const startedAt = Date.now();
|
|
114
|
+
const result = await withSyncRetries(() => this.storageManager.saveObservations(entries), () => this.stateManager.shouldStopSync);
|
|
115
|
+
if (this.stateManager.shouldStopSync) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const responseEntries = result.entry ?? [];
|
|
119
|
+
const savedCount = responseEntries.length ? responseEntries.filter(entry => entry.response?.status.startsWith("2")).length : entries.length;
|
|
120
|
+
const createdCount = responseEntries.filter(entry => entry.response?.status.startsWith("201")).length;
|
|
121
|
+
recordOvokMetric("ovok.health.samples.imported", createdCount, {
|
|
122
|
+
provider: this.getProviderName(),
|
|
123
|
+
measurementTypeKey
|
|
124
|
+
});
|
|
125
|
+
recordOvokDuration("ovok.measurement.save.duration", Date.now() - startedAt, {
|
|
126
|
+
provider: this.getProviderName()
|
|
127
|
+
});
|
|
128
|
+
this.stateManager.addResult(result);
|
|
129
|
+
this.progressManager.incrementSyncedObservations(measurementTypeKey, savedCount, createdCount);
|
|
130
|
+
}
|
|
131
|
+
if (deletedObservationSyncIds.length !== 0) {
|
|
132
|
+
await this.storageManager.deleteObservations(deletedObservationSyncIds, this.patientId);
|
|
115
133
|
}
|
|
116
|
-
const responseEntries = result.entry ?? [];
|
|
117
|
-
const savedCount = responseEntries.length ? responseEntries.filter(entry => entry.response?.status.startsWith("2")).length : entries.length;
|
|
118
|
-
const createdCount = responseEntries.filter(entry => entry.response?.status.startsWith("201")).length;
|
|
119
|
-
recordOvokMetric("ovok.health.samples.imported", createdCount, {
|
|
120
|
-
provider: this.getProviderName(),
|
|
121
|
-
measurementTypeKey
|
|
122
|
-
});
|
|
123
|
-
recordOvokDuration("ovok.measurement.save.duration", Date.now() - startedAt, {
|
|
124
|
-
provider: this.getProviderName()
|
|
125
|
-
});
|
|
126
|
-
this.stateManager.addResult(result);
|
|
127
|
-
this.progressManager.incrementSyncedObservations(measurementTypeKey, savedCount, createdCount);
|
|
128
134
|
this.storageManager.saveAnchors(anchors);
|
|
129
135
|
} catch (error) {
|
|
130
136
|
if (isSyncRetryCancelled(error) || this.stateManager.shouldStopSync) {
|