@ovok/native 1.17.0-dev.2213 → 1.17.0-dev.2219
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/next/bluetooth/adapters/android-foreground-service.js +58 -5
- package/lib/commonjs/modules/next/bluetooth/adapters/android-foreground-service.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/adapters/ble-plx-central.js +45 -24
- package/lib/commonjs/modules/next/bluetooth/adapters/ble-plx-central.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/adapters/ecg-measurements.js +25 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/ecg-measurements.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/live-supersession.js +62 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/live-supersession.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/ovok-outbox-watch.js +42 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/ovok-outbox-watch.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/ovok-reading-sink.js +97 -96
- package/lib/commonjs/modules/next/bluetooth/adapters/ovok-reading-sink.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/adapters/reading-source-id.js +33 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/reading-source-id.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/reading-values.js +38 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/reading-values.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/series-saving.js +101 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/series-saving.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/sqlite-database.js +24 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/sqlite-database.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/sqlite-outbox-rows.js +65 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/sqlite-outbox-rows.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/sqlite-outbox-schema.js +53 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/sqlite-outbox-schema.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/sqlite-outbox-store.js +82 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/sqlite-outbox-store.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/storage-paired-devices.js +1 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/storage-paired-devices.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/adapters/web-bluetooth-central.js +9 -1
- package/lib/commonjs/modules/next/bluetooth/adapters/web-bluetooth-central.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/core/bluetooth.js +9 -3
- package/lib/commonjs/modules/next/bluetooth/core/bluetooth.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/core/device-deps.js +6 -0
- package/lib/commonjs/modules/next/bluetooth/core/device-deps.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/core/device-link.js +2 -1
- package/lib/commonjs/modules/next/bluetooth/core/device-link.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/core/device-snapshot.js +3 -1
- package/lib/commonjs/modules/next/bluetooth/core/device-snapshot.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/core/device.js +19 -6
- package/lib/commonjs/modules/next/bluetooth/core/device.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/core/live-ledger.js +54 -0
- package/lib/commonjs/modules/next/bluetooth/core/live-ledger.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/core/measuring-watch.js +45 -0
- package/lib/commonjs/modules/next/bluetooth/core/measuring-watch.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/core/outbox-watch.js +17 -0
- package/lib/commonjs/modules/next/bluetooth/core/outbox-watch.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/core/paired-device.js +1 -0
- package/lib/commonjs/modules/next/bluetooth/core/paired-device.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/core/ports.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/core/reading-log.js +89 -7
- package/lib/commonjs/modules/next/bluetooth/core/reading-log.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/core/series-slots.js +94 -0
- package/lib/commonjs/modules/next/bluetooth/core/series-slots.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/core/stream-recorder.js +219 -0
- package/lib/commonjs/modules/next/bluetooth/core/stream-recorder.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/core/waveform-segments.js +110 -0
- package/lib/commonjs/modules/next/bluetooth/core/waveform-segments.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/create-bluetooth.js +19 -11
- package/lib/commonjs/modules/next/bluetooth/create-bluetooth.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/index.js +9 -1
- package/lib/commonjs/modules/next/bluetooth/index.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/shared.js +14 -0
- package/lib/commonjs/modules/next/bluetooth/shared.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/web/create-web-bluetooth.js +2 -0
- package/lib/commonjs/modules/next/bluetooth/web/create-web-bluetooth.js.map +1 -1
- package/lib/module/modules/next/bluetooth/adapters/android-foreground-service.js +59 -6
- package/lib/module/modules/next/bluetooth/adapters/android-foreground-service.js.map +1 -1
- package/lib/module/modules/next/bluetooth/adapters/ble-plx-central.js +45 -24
- package/lib/module/modules/next/bluetooth/adapters/ble-plx-central.js.map +1 -1
- package/lib/module/modules/next/bluetooth/adapters/ecg-measurements.js +22 -0
- package/lib/module/modules/next/bluetooth/adapters/ecg-measurements.js.map +1 -0
- package/lib/module/modules/next/bluetooth/adapters/live-supersession.js +59 -0
- package/lib/module/modules/next/bluetooth/adapters/live-supersession.js.map +1 -0
- package/lib/module/modules/next/bluetooth/adapters/ovok-outbox-watch.js +38 -0
- package/lib/module/modules/next/bluetooth/adapters/ovok-outbox-watch.js.map +1 -0
- package/lib/module/modules/next/bluetooth/adapters/ovok-reading-sink.js +76 -75
- package/lib/module/modules/next/bluetooth/adapters/ovok-reading-sink.js.map +1 -1
- package/lib/module/modules/next/bluetooth/adapters/reading-source-id.js +27 -0
- package/lib/module/modules/next/bluetooth/adapters/reading-source-id.js.map +1 -0
- package/lib/module/modules/next/bluetooth/adapters/reading-values.js +33 -0
- package/lib/module/modules/next/bluetooth/adapters/reading-values.js.map +1 -0
- package/lib/module/modules/next/bluetooth/adapters/series-saving.js +94 -0
- package/lib/module/modules/next/bluetooth/adapters/series-saving.js.map +1 -0
- package/lib/module/modules/next/bluetooth/adapters/sqlite-database.js +20 -0
- package/lib/module/modules/next/bluetooth/adapters/sqlite-database.js.map +1 -0
- package/lib/module/modules/next/bluetooth/adapters/sqlite-outbox-rows.js +59 -0
- package/lib/module/modules/next/bluetooth/adapters/sqlite-outbox-rows.js.map +1 -0
- package/lib/module/modules/next/bluetooth/adapters/sqlite-outbox-schema.js +49 -0
- package/lib/module/modules/next/bluetooth/adapters/sqlite-outbox-schema.js.map +1 -0
- package/lib/module/modules/next/bluetooth/adapters/sqlite-outbox-store.js +79 -0
- package/lib/module/modules/next/bluetooth/adapters/sqlite-outbox-store.js.map +1 -0
- package/lib/module/modules/next/bluetooth/adapters/storage-paired-devices.js +1 -0
- package/lib/module/modules/next/bluetooth/adapters/storage-paired-devices.js.map +1 -1
- package/lib/module/modules/next/bluetooth/adapters/web-bluetooth-central.js +9 -1
- package/lib/module/modules/next/bluetooth/adapters/web-bluetooth-central.js.map +1 -1
- package/lib/module/modules/next/bluetooth/core/bluetooth.js +9 -3
- package/lib/module/modules/next/bluetooth/core/bluetooth.js.map +1 -1
- package/lib/module/modules/next/bluetooth/core/device-deps.js +4 -0
- package/lib/module/modules/next/bluetooth/core/device-deps.js.map +1 -0
- package/lib/module/modules/next/bluetooth/core/device-link.js +2 -1
- package/lib/module/modules/next/bluetooth/core/device-link.js.map +1 -1
- package/lib/module/modules/next/bluetooth/core/device-snapshot.js +3 -1
- package/lib/module/modules/next/bluetooth/core/device-snapshot.js.map +1 -1
- package/lib/module/modules/next/bluetooth/core/device.js +19 -6
- package/lib/module/modules/next/bluetooth/core/device.js.map +1 -1
- package/lib/module/modules/next/bluetooth/core/live-ledger.js +50 -0
- package/lib/module/modules/next/bluetooth/core/live-ledger.js.map +1 -0
- package/lib/module/modules/next/bluetooth/core/measuring-watch.js +41 -0
- package/lib/module/modules/next/bluetooth/core/measuring-watch.js.map +1 -0
- package/lib/module/modules/next/bluetooth/core/outbox-watch.js +14 -0
- package/lib/module/modules/next/bluetooth/core/outbox-watch.js.map +1 -0
- package/lib/module/modules/next/bluetooth/core/paired-device.js +1 -0
- package/lib/module/modules/next/bluetooth/core/paired-device.js.map +1 -1
- package/lib/module/modules/next/bluetooth/core/ports.js.map +1 -1
- package/lib/module/modules/next/bluetooth/core/reading-log.js +89 -7
- package/lib/module/modules/next/bluetooth/core/reading-log.js.map +1 -1
- package/lib/module/modules/next/bluetooth/core/series-slots.js +90 -0
- package/lib/module/modules/next/bluetooth/core/series-slots.js.map +1 -0
- package/lib/module/modules/next/bluetooth/core/stream-recorder.js +215 -0
- package/lib/module/modules/next/bluetooth/core/stream-recorder.js.map +1 -0
- package/lib/module/modules/next/bluetooth/core/waveform-segments.js +106 -0
- package/lib/module/modules/next/bluetooth/core/waveform-segments.js.map +1 -0
- package/lib/module/modules/next/bluetooth/create-bluetooth.js +19 -11
- package/lib/module/modules/next/bluetooth/create-bluetooth.js.map +1 -1
- package/lib/module/modules/next/bluetooth/index.js +1 -0
- package/lib/module/modules/next/bluetooth/index.js.map +1 -1
- package/lib/module/modules/next/bluetooth/shared.js +2 -0
- package/lib/module/modules/next/bluetooth/shared.js.map +1 -1
- package/lib/module/modules/next/bluetooth/web/create-web-bluetooth.js +2 -0
- package/lib/module/modules/next/bluetooth/web/create-web-bluetooth.js.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/android-foreground-service.d.ts +17 -4
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/android-foreground-service.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ble-plx-central.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ecg-measurements.d.ts +6 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ecg-measurements.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/live-supersession.d.ts +9 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/live-supersession.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ovok-outbox-watch.d.ts +8 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ovok-outbox-watch.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts +9 -3
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/reading-source-id.d.ts +9 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/reading-source-id.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/reading-values.d.ts +9 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/reading-values.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/series-saving.d.ts +28 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/series-saving.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/sqlite-database.d.ts +23 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/sqlite-database.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/sqlite-outbox-rows.d.ts +29 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/sqlite-outbox-rows.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/sqlite-outbox-schema.d.ts +6 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/sqlite-outbox-schema.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/sqlite-outbox-store.d.ts +38 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/sqlite-outbox-store.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/storage-paired-devices.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/web-bluetooth-central.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/web-bluetooth-central.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/bluetooth-options.d.ts +3 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/bluetooth-options.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/bluetooth.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/device-deps.d.ts +16 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/device-deps.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/device-snapshot.d.ts +5 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/device-snapshot.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/device.d.ts +6 -13
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/device.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/live-ledger.d.ts +13 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/live-ledger.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/measuring-watch.d.ts +17 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/measuring-watch.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/outbox-watch.d.ts +27 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/outbox-watch.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/paired-device.d.ts +3 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/paired-device.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/ports.d.ts +3 -2
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/ports.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/reading-log.d.ts +25 -6
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/reading-log.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/reading.d.ts +16 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/reading.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/series-slots.d.ts +35 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/series-slots.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/stream-recorder.d.ts +58 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/stream-recorder.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/waveform-segments.d.ts +26 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/waveform-segments.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/create-bluetooth.d.ts +3 -2
- package/lib/typescript/commonjs/src/modules/next/bluetooth/create-bluetooth.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts +4 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/shared.d.ts +5 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/shared.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/create-web-bluetooth.d.ts +3 -2
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/create-web-bluetooth.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/android-foreground-service.d.ts +17 -4
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/android-foreground-service.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/ble-plx-central.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/ecg-measurements.d.ts +6 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/ecg-measurements.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/live-supersession.d.ts +9 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/live-supersession.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/ovok-outbox-watch.d.ts +8 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/ovok-outbox-watch.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts +9 -3
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/reading-source-id.d.ts +9 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/reading-source-id.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/reading-values.d.ts +9 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/reading-values.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/series-saving.d.ts +28 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/series-saving.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/sqlite-database.d.ts +23 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/sqlite-database.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/sqlite-outbox-rows.d.ts +29 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/sqlite-outbox-rows.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/sqlite-outbox-schema.d.ts +6 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/sqlite-outbox-schema.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/sqlite-outbox-store.d.ts +38 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/sqlite-outbox-store.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/storage-paired-devices.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/web-bluetooth-central.d.ts +4 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/web-bluetooth-central.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/bluetooth-options.d.ts +3 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/bluetooth-options.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/bluetooth.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/device-deps.d.ts +16 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/device-deps.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/device-snapshot.d.ts +5 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/device-snapshot.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/device.d.ts +6 -13
- package/lib/typescript/module/src/modules/next/bluetooth/core/device.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/live-ledger.d.ts +13 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/live-ledger.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/measuring-watch.d.ts +17 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/measuring-watch.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/outbox-watch.d.ts +27 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/outbox-watch.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/paired-device.d.ts +3 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/paired-device.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/ports.d.ts +3 -2
- package/lib/typescript/module/src/modules/next/bluetooth/core/ports.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/reading-log.d.ts +25 -6
- package/lib/typescript/module/src/modules/next/bluetooth/core/reading-log.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/reading.d.ts +16 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/reading.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/series-slots.d.ts +35 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/series-slots.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/stream-recorder.d.ts +58 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/stream-recorder.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/waveform-segments.d.ts +26 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/waveform-segments.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/create-bluetooth.d.ts +3 -2
- package/lib/typescript/module/src/modules/next/bluetooth/create-bluetooth.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts +4 -1
- package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/shared.d.ts +5 -1
- package/lib/typescript/module/src/modules/next/bluetooth/shared.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/web/create-web-bluetooth.d.ts +3 -2
- package/lib/typescript/module/src/modules/next/bluetooth/web/create-web-bluetooth.d.ts.map +1 -1
- package/package.json +7 -3
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { NativeModules, Platform } from "react-native";
|
|
4
|
-
import {
|
|
4
|
+
import { noOutboxWatch } from "../core/outbox-watch.js";
|
|
5
|
+
import { noKeepAlive, silentLogger } from "../core/ports.js";
|
|
5
6
|
|
|
6
7
|
/** The notification Android shows while the service runs. */
|
|
7
8
|
|
|
9
|
+
/** What the service watches and reports besides its text. */
|
|
10
|
+
|
|
8
11
|
const nativeService = () => {
|
|
9
12
|
const service = NativeModules.OvokBackgroundSync;
|
|
10
13
|
if (!service) {
|
|
@@ -12,11 +15,61 @@ const nativeService = () => {
|
|
|
12
15
|
}
|
|
13
16
|
return service;
|
|
14
17
|
};
|
|
18
|
+
const describeUnsent = unsent => `${unsent} ${unsent === 1 ? "reading" : "readings"} waiting to upload`;
|
|
19
|
+
|
|
20
|
+
/** The text for the native module: the function is dropped, and the body names the unsent count while there is one. */
|
|
21
|
+
const textFor = ({
|
|
22
|
+
unsentBody = describeUnsent,
|
|
23
|
+
...text
|
|
24
|
+
}, unsent) => unsent > 0 ? {
|
|
25
|
+
...text,
|
|
26
|
+
notificationBody: unsentBody(unsent)
|
|
27
|
+
} : text;
|
|
28
|
+
|
|
29
|
+
/** Android re-posts the same notification when the service is started again, which is how the text changes. */
|
|
30
|
+
class AndroidForegroundService {
|
|
31
|
+
stopWatching = null;
|
|
32
|
+
shownUnsent = 0;
|
|
33
|
+
constructor(text, outbox, logger) {
|
|
34
|
+
this.text = text;
|
|
35
|
+
this.outbox = outbox;
|
|
36
|
+
this.logger = logger;
|
|
37
|
+
}
|
|
38
|
+
start = async () => {
|
|
39
|
+
this.stopWatching?.();
|
|
40
|
+
this.shownUnsent = 0;
|
|
41
|
+
|
|
42
|
+
// Watch before the first await, so a stop that follows at once also ends the watching.
|
|
43
|
+
this.stopWatching = this.outbox.subscribe(({
|
|
44
|
+
waiting
|
|
45
|
+
}) => this.showCount(waiting.size));
|
|
46
|
+
await this.show();
|
|
47
|
+
};
|
|
48
|
+
stop = async () => {
|
|
49
|
+
this.stopWatching?.();
|
|
50
|
+
this.stopWatching = null;
|
|
51
|
+
await nativeService().stopBluetoothForegroundService();
|
|
52
|
+
};
|
|
53
|
+
showCount(unsent) {
|
|
54
|
+
if (unsent !== this.shownUnsent) {
|
|
55
|
+
this.shownUnsent = unsent;
|
|
56
|
+
this.show().catch(() => this.logger.error("bluetooth.keep-alive.notification-failed", {
|
|
57
|
+
unsent
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
show() {
|
|
62
|
+
return nativeService().startBluetoothForegroundService(textFor(this.text, this.shownUnsent));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
15
65
|
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
66
|
+
/**
|
|
67
|
+
* Android's connected-device foreground service, which keeps the process alive for background sync; nothing elsewhere.
|
|
68
|
+
* With an `outbox`, its notification says how many readings wait to upload.
|
|
69
|
+
*/
|
|
70
|
+
const androidForegroundService = (text = {}, {
|
|
71
|
+
outbox = noOutboxWatch,
|
|
72
|
+
logger = silentLogger
|
|
73
|
+
} = {}) => Platform.OS === "android" ? new AndroidForegroundService(text, outbox, logger) : noKeepAlive;
|
|
21
74
|
export { androidForegroundService };
|
|
22
75
|
//# sourceMappingURL=android-foreground-service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","noKeepAlive","nativeService","service","OvokBackgroundSync","Error","
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","noOutboxWatch","noKeepAlive","silentLogger","nativeService","service","OvokBackgroundSync","Error","describeUnsent","unsent","textFor","unsentBody","text","notificationBody","AndroidForegroundService","stopWatching","shownUnsent","constructor","outbox","logger","start","subscribe","waiting","showCount","size","show","stop","stopBluetoothForegroundService","catch","error","startBluetoothForegroundService","androidForegroundService","OS"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/android-foreground-service.ts"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,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AAC;EACnB,CAAC;EAEMC,IAAI,GAAG,MAAAA,CAAA,KAA2B;IACvC,IAAI,CAACX,YAAY,GAAG,CAAC;IACrB,IAAI,CAACA,YAAY,GAAG,IAAI;IACxB,MAAMX,aAAa,CAAC,CAAC,CAACuB,8BAA8B,CAAC,CAAC;EACxD,CAAC;EAEOJ,SAASA,CAACd,MAAc,EAAQ;IACtC,IAAIA,MAAM,KAAK,IAAI,CAACO,WAAW,EAAE;MAC/B,IAAI,CAACA,WAAW,GAAGP,MAAM;MACzB,IAAI,CAACgB,IAAI,CAAC,CAAC,CAACG,KAAK,CAAC,MAAM,IAAI,CAACT,MAAM,CAACU,KAAK,CAAC,0CAA0C,EAAE;QAAEpB;MAAO,CAAC,CAAC,CAAC;IACpG;EACF;EAEQgB,IAAIA,CAAA,EAAkB;IAC5B,OAAOrB,aAAa,CAAC,CAAC,CAAC0B,+BAA+B,CAACpB,OAAO,CAAC,IAAI,CAACE,IAAI,EAAE,IAAI,CAACI,WAAW,CAAC,CAAC;EAC9F;AACF;;AAEA;AACA;AACA;AACA;AACA,MAAMe,wBAAwB,GAAGA,CAC/BnB,IAA2B,GAAG,CAAC,CAAC,EAChC;EAAEM,MAAM,GAAGjB,aAAa;EAAEkB,MAAM,GAAGhB;AAAuC,CAAC,GAAG,CAAC,CAAC,KACjEH,QAAQ,CAACgC,EAAE,KAAK,SAAS,GAAG,IAAIlB,wBAAwB,CAACF,IAAI,EAAEM,MAAM,EAAEC,MAAM,CAAC,GAAGjB,WAAY;AAE9G,SAAS6B,wBAAwB","ignoreList":[]}
|
|
@@ -33,30 +33,51 @@ const advertisementOf = device => ({
|
|
|
33
33
|
serviceData: new Map(Object.entries(device.serviceData ?? {}).map(([uuid, data]) => [fullUuid(uuid), fromBase64(data)])),
|
|
34
34
|
rssi: device.rssi ?? null
|
|
35
35
|
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
36
|
+
|
|
37
|
+
/** Whether a discovered characteristic refuses a write with response but takes one without, as the vendor apps check. */
|
|
38
|
+
const takesOnlyWritesWithoutResponse = async (device, service, characteristic) => {
|
|
39
|
+
const found = (await device.characteristicsForService(service)).find(({
|
|
40
|
+
uuid
|
|
41
|
+
}) => lower(uuid) === characteristic);
|
|
42
|
+
return found !== undefined && !found.isWritableWithResponse && found.isWritableWithoutResponse;
|
|
43
|
+
};
|
|
44
|
+
const gattLinkOf = (manager, device) => {
|
|
45
|
+
const writeTypes = new Map();
|
|
46
|
+
|
|
47
|
+
/** Looks a characteristic's write type up once per link. */
|
|
48
|
+
const writesWithoutResponse = (service, characteristic) => {
|
|
49
|
+
const key = `${service}/${characteristic}`;
|
|
50
|
+
const known = writeTypes.get(key) ?? takesOnlyWritesWithoutResponse(device, service, characteristic);
|
|
51
|
+
writeTypes.set(key, known);
|
|
52
|
+
return known;
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
read: async (service, characteristic) => fromBase64((await device.readCharacteristicForService(lower(service), lower(characteristic))).value ?? ""),
|
|
56
|
+
write: async (service, characteristic, bytes) => {
|
|
57
|
+
const [serviceUuid, characteristicUuid] = [lower(service), lower(characteristic)];
|
|
58
|
+
const value = toBase64(bytes);
|
|
59
|
+
await ((await writesWithoutResponse(serviceUuid, characteristicUuid)) ? device.writeCharacteristicWithoutResponseForService(serviceUuid, characteristicUuid, value) : device.writeCharacteristicWithResponseForService(serviceUuid, characteristicUuid, value));
|
|
60
|
+
},
|
|
61
|
+
writeWithoutResponse: async (service, characteristic, bytes) => {
|
|
62
|
+
await device.writeCharacteristicWithoutResponseForService(lower(service), lower(characteristic), toBase64(bytes));
|
|
63
|
+
},
|
|
64
|
+
subscribe: async (service, characteristic, onValue) => {
|
|
65
|
+
const subscription = device.monitorCharacteristicForService(lower(service), lower(characteristic), (error, value) => {
|
|
66
|
+
if (!error && value?.value) {
|
|
67
|
+
onValue(fromBase64(value.value));
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
return () => subscription.remove();
|
|
71
|
+
},
|
|
72
|
+
onDisconnect: listener => {
|
|
73
|
+
const subscription = manager.onDeviceDisconnected(device.id, () => listener());
|
|
74
|
+
return () => subscription.remove();
|
|
75
|
+
},
|
|
76
|
+
close: async () => {
|
|
77
|
+
await manager.cancelDeviceConnection(device.id).catch(() => undefined);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
};
|
|
60
81
|
|
|
61
82
|
/** The device's Bluetooth LE radio through `react-native-ble-plx`. */
|
|
62
83
|
const blePlxCentral = manager => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BleErrorCode","State","fromBase64","toBase64","u16le","fullUuid","DeviceError","STATES","Unknown","Resetting","Unsupported","Unauthorized","PoweredOff","PoweredOn","ERROR_CODES","BluetoothPoweredOff","BluetoothUnauthorized","BluetoothUnsupported","deviceErrorOf","error","errorCode","message","lower","uuid","toLowerCase","manufacturerDataOf","base64","bytes","Uint8Array","length","Map","subarray","advertisementOf","device","transport","address","id","name","localName","services","serviceUUIDs","map","manufacturerData","serviceData","Object","entries","data","rssi","gattLinkOf","manager","
|
|
1
|
+
{"version":3,"names":["BleErrorCode","State","fromBase64","toBase64","u16le","fullUuid","DeviceError","STATES","Unknown","Resetting","Unsupported","Unauthorized","PoweredOff","PoweredOn","ERROR_CODES","BluetoothPoweredOff","BluetoothUnauthorized","BluetoothUnsupported","deviceErrorOf","error","errorCode","message","lower","uuid","toLowerCase","manufacturerDataOf","base64","bytes","Uint8Array","length","Map","subarray","advertisementOf","device","transport","address","id","name","localName","services","serviceUUIDs","map","manufacturerData","serviceData","Object","entries","data","rssi","takesOnlyWritesWithoutResponse","service","characteristic","found","characteristicsForService","find","undefined","isWritableWithResponse","isWritableWithoutResponse","gattLinkOf","manager","writeTypes","writesWithoutResponse","key","known","get","set","read","readCharacteristicForService","value","write","serviceUuid","characteristicUuid","writeCharacteristicWithoutResponseForService","writeCharacteristicWithResponseForService","writeWithoutResponse","subscribe","onValue","subscription","monitorCharacteristicForService","remove","onDisconnect","listener","onDeviceDisconnected","close","cancelDeviceConnection","catch","blePlxCentral","watchState","onStateChange","state","scan","filter","onAdvertisement","onError","startDeviceScan","allowDuplicates","stopDeviceScan","connect","connectToDevice","Promise","reject","discoverAllServicesAndCharacteristics"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/ble-plx-central.ts"],"mappings":";;AAAA,SAAmBA,YAAY,EAAmCC,KAAK,QAAQ,sBAAsB;AAErG,SAASC,UAAU,EAAEC,QAAQ,QAAQ,oBAAiB;AACtD,SAASC,KAAK,QAAQ,mBAAgB;AACtC,SAAwBC,QAAQ,QAAQ,0BAAuB;AAC/D,SAASC,WAAW,QAAyB,mBAAgB;AAG7D,MAAMC,MAAmC,GAAG;EAC1C,CAACN,KAAK,CAACO,OAAO,GAAG,SAAS;EAC1B,CAACP,KAAK,CAACQ,SAAS,GAAG,SAAS;EAC5B,CAACR,KAAK,CAACS,WAAW,GAAG,aAAa;EAClC,CAACT,KAAK,CAACU,YAAY,GAAG,cAAc;EACpC,CAACV,KAAK,CAACW,UAAU,GAAG,KAAK;EACzB,CAACX,KAAK,CAACY,SAAS,GAAG;AACrB,CAAC;AAED,MAAMC,WAA2D,GAAG;EAClE,CAACd,YAAY,CAACe,mBAAmB,GAAG,aAAa;EACjD,CAACf,YAAY,CAACgB,qBAAqB,GAAG,YAAY;EAClD,CAAChB,YAAY,CAACiB,oBAAoB,GAAG;AACvC,CAAC;AAED,MAAMC,aAAa,GAAIC,KAAe,IACpC,IAAIb,WAAW,CAACQ,WAAW,CAACK,KAAK,CAACC,SAAS,CAAC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C,CAAC;AAEF,SAASoD,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { MeasurementTypeKey } from "@ovok/core/next";
|
|
4
|
+
import { valueOf } from "./reading-values.js";
|
|
5
|
+
|
|
6
|
+
/** Ovok stores ECG points in millivolts; a trace in any other unit is left out rather than mislabelled. */
|
|
7
|
+
const ECG_POINT_UNIT = "mV";
|
|
8
|
+
|
|
9
|
+
/** One ECG recording per channel, each in millivolts at the waveform's sample rate; the heart rate goes with the first. */
|
|
10
|
+
const ecgMeasurements = reading => {
|
|
11
|
+
const waveform = reading.waveform?.unit === ECG_POINT_UNIT ? reading.waveform : undefined;
|
|
12
|
+
const channels = waveform?.samples ?? [new Int16Array(0)];
|
|
13
|
+
return channels.map((samples, index) => ({
|
|
14
|
+
measurementTypeKey: MeasurementTypeKey.ecg,
|
|
15
|
+
heartRate: index === 0 ? valueOf(reading, "heart_rate") : undefined,
|
|
16
|
+
diagramPoints: Array.from(samples, sample => sample * (waveform?.scale ?? 1)),
|
|
17
|
+
duration: waveform ? samples.length / waveform.sampleRateHz : undefined,
|
|
18
|
+
recordedAt: reading.takenAt ?? undefined
|
|
19
|
+
}));
|
|
20
|
+
};
|
|
21
|
+
export { ecgMeasurements };
|
|
22
|
+
//# sourceMappingURL=ecg-measurements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","valueOf","ECG_POINT_UNIT","ecgMeasurements","reading","waveform","unit","undefined","channels","samples","Int16Array","map","index","measurementTypeKey","ecg","heartRate","diagramPoints","Array","from","sample","scale","duration","length","sampleRateHz","recordedAt","takenAt"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/ecg-measurements.ts"],"mappings":";;AAAA,SAAyBA,kBAAkB,QAAQ,iBAAiB;AAIpE,SAASC,OAAO,QAAQ,qBAAkB;;AAE1C;AACA,MAAMC,cAAc,GAAG,IAAI;;AAE3B;AACA,MAAMC,eAAe,GAAIC,OAAgB,IAAuB;EAC9D,MAAMC,QAAQ,GAAGD,OAAO,CAACC,QAAQ,EAAEC,IAAI,KAAKJ,cAAc,GAAGE,OAAO,CAACC,QAAQ,GAAGE,SAAS;EACzF,MAAMC,QAAQ,GAAGH,QAAQ,EAAEI,OAAO,IAAI,CAAC,IAAIC,UAAU,CAAC,CAAC,CAAC,CAAC;EAEzD,OAAOF,QAAQ,CAACG,GAAG,CAAC,CAACF,OAAO,EAAEG,KAAK,MAAM;IACvCC,kBAAkB,EAAEb,kBAAkB,CAACc,GAAG;IAC1CC,SAAS,EAAEH,KAAK,KAAK,CAAC,GAAGX,OAAO,CAACG,OAAO,EAAE,YAAY,CAAC,GAAGG,SAAS;IACnES,aAAa,EAAEC,KAAK,CAACC,IAAI,CAACT,OAAO,EAAGU,MAAM,IAAKA,MAAM,IAAId,QAAQ,EAAEe,KAAK,IAAI,CAAC,CAAC,CAAC;IAC/EC,QAAQ,EAAEhB,QAAQ,GAAGI,OAAO,CAACa,MAAM,GAAGjB,QAAQ,CAACkB,YAAY,GAAGhB,SAAS;IACvEiB,UAAU,EAAEpB,OAAO,CAACqB,OAAO,IAAIlB;EACjC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAASJ,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { MeasurementTypeKey, SEGMENT_IDENTIFIER_SYSTEM } from "@ovok/core/next";
|
|
4
|
+
import { liveSourceId } from "./reading-source-id.js";
|
|
5
|
+
import { seriesFieldOf, seriesObservationsOf, signedInPatientId } from "./series-saving.js";
|
|
6
|
+
|
|
7
|
+
/** What queues the deletions: the outbox, with the measurements API and the session that name what to delete. */
|
|
8
|
+
|
|
9
|
+
const LIVE_SLOT_MS = 1_000;
|
|
10
|
+
|
|
11
|
+
/** The observations a live recording was saved as, rebuilt from its span alone; a single stand-in value gives each its identifiers. */
|
|
12
|
+
const observationsOfSpan = async (client, address, span) => {
|
|
13
|
+
const patientId = await signedInPatientId(client);
|
|
14
|
+
const sourceId = liveSourceId(address, span);
|
|
15
|
+
if (span.channel === null) {
|
|
16
|
+
const field = seriesFieldOf(span.metric);
|
|
17
|
+
return field ? seriesObservationsOf(field, {
|
|
18
|
+
start: span.from,
|
|
19
|
+
intervalMs: LIVE_SLOT_MS,
|
|
20
|
+
values: [0]
|
|
21
|
+
}, {
|
|
22
|
+
patientId,
|
|
23
|
+
sourceId
|
|
24
|
+
}) : [];
|
|
25
|
+
}
|
|
26
|
+
const measurement = {
|
|
27
|
+
measurementTypeKey: MeasurementTypeKey.ecg,
|
|
28
|
+
diagramPoints: [0],
|
|
29
|
+
duration: 1,
|
|
30
|
+
recordedAt: span.from
|
|
31
|
+
};
|
|
32
|
+
return client.measurements.build({
|
|
33
|
+
measurement,
|
|
34
|
+
sourceId,
|
|
35
|
+
patientId
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** The identifiers that name an observation for good; a segment's own depends on its sample count, which a span does not carry. */
|
|
40
|
+
const deleteTargetsOf = observations => observations.flatMap(({
|
|
41
|
+
identifier = []
|
|
42
|
+
}) => identifier.flatMap(({
|
|
43
|
+
system,
|
|
44
|
+
value
|
|
45
|
+
}) => system && value && system !== SEGMENT_IDENTIFIER_SYSTEM ? [{
|
|
46
|
+
system,
|
|
47
|
+
value
|
|
48
|
+
}] : []));
|
|
49
|
+
|
|
50
|
+
/** Queues the deletion of the live recordings a stored record replaces, so the outbox holds them before it holds the record. */
|
|
51
|
+
const replaceLiveRecordings = async (client, reading) => {
|
|
52
|
+
for (const span of reading.supersedes ?? []) {
|
|
53
|
+
for (const target of deleteTargetsOf(await observationsOfSpan(client, reading.source.address, span))) {
|
|
54
|
+
await client.outbox.enqueueDelete(target);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
export { replaceLiveRecordings };
|
|
59
|
+
//# sourceMappingURL=live-supersession.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","SEGMENT_IDENTIFIER_SYSTEM","liveSourceId","seriesFieldOf","seriesObservationsOf","signedInPatientId","LIVE_SLOT_MS","observationsOfSpan","client","address","span","patientId","sourceId","channel","field","metric","start","from","intervalMs","values","measurement","measurementTypeKey","ecg","diagramPoints","duration","recordedAt","measurements","build","deleteTargetsOf","observations","flatMap","identifier","system","value","replaceLiveRecordings","reading","supersedes","target","source","outbox","enqueueDelete"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/live-supersession.ts"],"mappings":";;AAAA,SAAyBA,kBAAkB,EAAQC,yBAAyB,QAAQ,iBAAiB;AAMrG,SAASC,YAAY,QAAQ,wBAAqB;AAClD,SAASC,aAAa,EAAEC,oBAAoB,EAAEC,iBAAiB,QAAQ,oBAAiB;;AAExF;;AAGA,MAAMC,YAAY,GAAG,KAAK;;AAE1B;AACA,MAAMC,kBAAkB,GAAG,MAAAA,CAAOC,MAA0B,EAAEC,OAAe,EAAEC,IAAc,KAA6B;EACxH,MAAMC,SAAS,GAAG,MAAMN,iBAAiB,CAACG,MAAM,CAAC;EACjD,MAAMI,QAAQ,GAAGV,YAAY,CAACO,OAAO,EAAEC,IAAI,CAAC;EAE5C,IAAIA,IAAI,CAACG,OAAO,KAAK,IAAI,EAAE;IACzB,MAAMC,KAAK,GAAGX,aAAa,CAACO,IAAI,CAACK,MAAM,CAAC;IAExC,OAAOD,KAAK,GAAGV,oBAAoB,CAACU,KAAK,EAAE;MAAEE,KAAK,EAAEN,IAAI,CAACO,IAAI;MAAEC,UAAU,EAAEZ,YAAY;MAAEa,MAAM,EAAE,CAAC,CAAC;IAAE,CAAC,EAAE;MAAER,SAAS;MAAEC;IAAS,CAAC,CAAC,GAAG,EAAE;EACvI;EAEA,MAAMQ,WAA2B,GAAG;IAAEC,kBAAkB,EAAErB,kBAAkB,CAACsB,GAAG;IAAEC,aAAa,EAAE,CAAC,CAAC,CAAC;IAAEC,QAAQ,EAAE,CAAC;IAAEC,UAAU,EAAEf,IAAI,CAACO;EAAK,CAAC;EAE1I,OAAOT,MAAM,CAACkB,YAAY,CAACC,KAAK,CAAC;IAAEP,WAAW;IAAER,QAAQ;IAAED;EAAU,CAAC,CAAC;AACxE,CAAC;;AAED;AACA,MAAMiB,eAAe,GAAIC,YAAoC,IAC3DA,YAAY,CAACC,OAAO,CAAC,CAAC;EAAEC,UAAU,GAAG;AAAG,CAAC,KACvCA,UAAU,CAACD,OAAO,CAAC,CAAC;EAAEE,MAAM;EAAEC;AAAM,CAAC,KAAMD,MAAM,IAAIC,KAAK,IAAID,MAAM,KAAK/B,yBAAyB,GAAG,CAAC;EAAE+B,MAAM;EAAEC;AAAM,CAAC,CAAC,GAAG,EAAG,CAChI,CAAC;;AAEH;AACA,MAAMC,qBAAqB,GAAG,MAAAA,CAAO1B,MAA0B,EAAE2B,OAAgB,KAAoB;EACnG,KAAK,MAAMzB,IAAI,IAAIyB,OAAO,CAACC,UAAU,IAAI,EAAE,EAAE;IAC3C,KAAK,MAAMC,MAAM,IAAIT,eAAe,CAAC,MAAMrB,kBAAkB,CAACC,MAAM,EAAE2B,OAAO,CAACG,MAAM,CAAC7B,OAAO,EAAEC,IAAI,CAAC,CAAC,EAAE;MACpG,MAAMF,MAAM,CAAC+B,MAAM,CAACC,aAAa,CAACH,MAAM,CAAC;IAC3C;EACF;AACF,CAAC;AAED,SAASH,qBAAqB","ignoreList":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { silentLogger } from "../core/ports.js";
|
|
4
|
+
const idsOf = items => new Set(items.map(({
|
|
5
|
+
id
|
|
6
|
+
}) => id));
|
|
7
|
+
const itemsIn = (items, state) => idsOf(items.filter(item => item.state === state));
|
|
8
|
+
const viewOf = (items, sent) => ({
|
|
9
|
+
waiting: itemsIn(items, "pending"),
|
|
10
|
+
rejected: itemsIn(items, "rejected"),
|
|
11
|
+
sent: idsOf(sent)
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
/** Watches the signed-in account's Ovok outbox, so the reading log and the notification follow what it sends. */
|
|
15
|
+
const ovokOutboxWatch = (outbox, logger = silentLogger) => ({
|
|
16
|
+
subscribe: listener => {
|
|
17
|
+
let requests = 0;
|
|
18
|
+
let watching = true;
|
|
19
|
+
|
|
20
|
+
// The outbox's snapshot only says something changed; the items say what.
|
|
21
|
+
const stop = outbox.subscribe(() => {
|
|
22
|
+
const request = ++requests;
|
|
23
|
+
void outbox.items().then(items => {
|
|
24
|
+
if (watching && request === requests) {
|
|
25
|
+
listener(viewOf(items, outbox.recentlySent()));
|
|
26
|
+
}
|
|
27
|
+
}, error => logger.error("bluetooth.outbox-watch.failed", {
|
|
28
|
+
error: error.name
|
|
29
|
+
}));
|
|
30
|
+
});
|
|
31
|
+
return () => {
|
|
32
|
+
watching = false;
|
|
33
|
+
stop();
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
export { ovokOutboxWatch };
|
|
38
|
+
//# sourceMappingURL=ovok-outbox-watch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["silentLogger","idsOf","items","Set","map","id","itemsIn","state","filter","item","viewOf","sent","waiting","rejected","ovokOutboxWatch","outbox","logger","subscribe","listener","requests","watching","stop","request","then","recentlySent","error","name"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/ovok-outbox-watch.ts"],"mappings":";;AAGA,SAAiBA,YAAY,QAAQ,kBAAe;AAIpD,MAAMC,KAAK,GAAIC,KAAoC,IAAkB,IAAIC,GAAG,CAACD,KAAK,CAACE,GAAG,CAAC,CAAC;EAAEC;AAAG,CAAC,KAAKA,EAAE,CAAC,CAAC;AAEvG,MAAMC,OAAO,GAAGA,CAACJ,KAA0B,EAAEK,KAAkB,KAC7DN,KAAK,CAACC,KAAK,CAACM,MAAM,CAAEC,IAAI,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-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/** A device's UCUM unit to the unit Ovok stores the value in: mg/dL, kg, °C, mmHg, L, L/s or %. */
|
|
12
|
-
const TO_OVOK_UNIT = {
|
|
13
|
-
"mg/dL": value => value,
|
|
14
|
-
"mmol/L": value => value * MG_PER_DL_PER_MMOL_PER_L,
|
|
15
|
-
kg: value => value,
|
|
16
|
-
"[lb_av]": value => value * KG_PER_POUND,
|
|
17
|
-
"[stone_av]": value => value * KG_PER_STONE,
|
|
18
|
-
Cel: value => value,
|
|
19
|
-
"[degF]": value => (value - FAHRENHEIT_ZERO_IN_CELSIUS_STEPS) * 5 / 9,
|
|
20
|
-
"mm[Hg]": value => value,
|
|
21
|
-
kPa: value => value * MMHG_PER_KPA,
|
|
22
|
-
L: value => value,
|
|
23
|
-
"L/s": value => value,
|
|
24
|
-
"%": value => value
|
|
25
|
-
};
|
|
26
|
-
const valueOf = (reading, metric) => reading.values[metric]?.value;
|
|
27
|
-
|
|
28
|
-
/** The value in Ovok's unit; `undefined` when the reading lacks it or uses a unit Ovok has no conversion for. */
|
|
29
|
-
const ovokValueOf = (reading, metric) => {
|
|
30
|
-
const quantity = reading.values[metric];
|
|
31
|
-
return quantity && TO_OVOK_UNIT[quantity.unit]?.(quantity.value);
|
|
32
|
-
};
|
|
5
|
+
import { ecgMeasurements } from "./ecg-measurements.js";
|
|
6
|
+
import { replaceLiveRecordings } from "./live-supersession.js";
|
|
7
|
+
import { partSourceId, sourceIdOf } from "./reading-source-id.js";
|
|
8
|
+
import { ovokValueOf, valueOf } from "./reading-values.js";
|
|
9
|
+
import { isSeriesReading, saveSeries } from "./series-saving.js";
|
|
33
10
|
const flagSet = (reading, code) => reading.deviceFlags.some(flag => flag.code === code && flag.raw !== 0) ? true : undefined;
|
|
34
11
|
const bloodPressure = reading => ({
|
|
35
12
|
measurementTypeKey: MeasurementTypeKey.bloodPressure,
|
|
@@ -73,32 +50,16 @@ const pulseOximetry = reading => ({
|
|
|
73
50
|
perfusionIndex: valueOf(reading, "perfusion_index"),
|
|
74
51
|
recordedAt: reading.takenAt ?? undefined
|
|
75
52
|
});
|
|
76
|
-
|
|
77
|
-
/** Ovok stores ECG points in millivolts; a trace in any other unit is left out rather than mislabelled. */
|
|
78
|
-
const ECG_POINT_UNIT = "mV";
|
|
79
|
-
const ecg = reading => {
|
|
80
|
-
const waveform = reading.waveform?.unit === ECG_POINT_UNIT ? reading.waveform : undefined;
|
|
81
|
-
const samples = waveform?.samples[0] ?? new Int16Array(0);
|
|
82
|
-
return {
|
|
83
|
-
measurementTypeKey: MeasurementTypeKey.ecg,
|
|
84
|
-
heartRate: valueOf(reading, "heart_rate"),
|
|
85
|
-
diagramPoints: Array.from(samples, sample => sample * (waveform?.scale ?? 1)),
|
|
86
|
-
duration: waveform ? samples.length / waveform.sampleRateHz : undefined,
|
|
87
|
-
recordedAt: reading.takenAt ?? undefined
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
/** A per-second series, such as an ER1 trend, has no single-value measurement; it waits for series saving in core. */
|
|
92
|
-
const heartRate = reading => reading.series ? undefined : {
|
|
53
|
+
const heartRate = reading => ({
|
|
93
54
|
measurementTypeKey: MeasurementTypeKey.heartRate,
|
|
94
55
|
heartRate: valueOf(reading, "heart_rate"),
|
|
95
56
|
recordedAt: reading.takenAt ?? undefined
|
|
96
|
-
};
|
|
97
|
-
const respiratoryRate = reading =>
|
|
57
|
+
});
|
|
58
|
+
const respiratoryRate = reading => ({
|
|
98
59
|
measurementTypeKey: MeasurementTypeKey.respiratoryRate,
|
|
99
60
|
respiratoryRate: valueOf(reading, "respiration_rate"),
|
|
100
61
|
recordedAt: reading.takenAt ?? undefined
|
|
101
|
-
};
|
|
62
|
+
});
|
|
102
63
|
const LIPID_METRICS = ["blood_cholesterol", "hdl_cholesterol", "ldl_cholesterol", "triglycerides"];
|
|
103
64
|
const LIPID_UNITS = ["mg/dL", "mmol/L"];
|
|
104
65
|
const isLipidUnit = unit => LIPID_UNITS.some(lipidUnit => lipidUnit === unit);
|
|
@@ -133,20 +94,24 @@ const spirometry = reading => {
|
|
|
133
94
|
recordedAt: reading.takenAt ?? undefined
|
|
134
95
|
} : undefined;
|
|
135
96
|
};
|
|
97
|
+
const single = measure => reading => {
|
|
98
|
+
const measurement = measure(reading);
|
|
99
|
+
return measurement ? [measurement] : [];
|
|
100
|
+
};
|
|
136
101
|
|
|
137
|
-
/** How each reading type becomes an
|
|
102
|
+
/** How each reading type becomes Ovok measurements, one for most and one per channel for an ECG; a type missing here cannot be saved yet. */
|
|
138
103
|
const MEASUREMENTS = {
|
|
139
|
-
blood_pressure: bloodPressure,
|
|
140
|
-
blood_glucose: bloodGlucose,
|
|
141
|
-
blood_cholesterol: lipidPanel,
|
|
142
|
-
ecg,
|
|
143
|
-
heart_rate: heartRate,
|
|
144
|
-
oxygen_saturation: pulseOximetry,
|
|
145
|
-
respiration_rate: respiratoryRate,
|
|
146
|
-
spirometry,
|
|
147
|
-
temperature: bodyTemperature,
|
|
148
|
-
triglycerides: lipidPanel,
|
|
149
|
-
weight: bodyWeight
|
|
104
|
+
blood_pressure: single(bloodPressure),
|
|
105
|
+
blood_glucose: single(bloodGlucose),
|
|
106
|
+
blood_cholesterol: single(lipidPanel),
|
|
107
|
+
ecg: ecgMeasurements,
|
|
108
|
+
heart_rate: single(heartRate),
|
|
109
|
+
oxygen_saturation: single(pulseOximetry),
|
|
110
|
+
respiration_rate: single(respiratoryRate),
|
|
111
|
+
spirometry: single(spirometry),
|
|
112
|
+
temperature: single(bodyTemperature),
|
|
113
|
+
triglycerides: single(lipidPanel),
|
|
114
|
+
weight: single(bodyWeight)
|
|
150
115
|
};
|
|
151
116
|
const deviceOf = (reading, device) => ({
|
|
152
117
|
id: reading.source.address,
|
|
@@ -163,24 +128,60 @@ const deviceOf = (reading, device) => ({
|
|
|
163
128
|
batteryPercentage: device.battery?.percent
|
|
164
129
|
});
|
|
165
130
|
|
|
166
|
-
/**
|
|
131
|
+
/** What the sink saves with: the measurements API, the outbox that deletes, and the session that names the patient. */
|
|
132
|
+
|
|
133
|
+
const unsupported = what => new DeviceError("unsupported", `Ovok cannot save ${what} yet`);
|
|
134
|
+
|
|
135
|
+
/** Live numbers are saved as series and a live ECG as a recording; any other live trace has no place in Ovok yet. */
|
|
136
|
+
const isUnsavableLive = reading => reading.live !== undefined && reading.series === undefined && reading.type !== "ecg";
|
|
137
|
+
const hasValues = reading => Object.keys(reading.values).length > 0;
|
|
138
|
+
const saveMeasurements = async (client, reading, device) => {
|
|
139
|
+
const measurements = MEASUREMENTS[reading.type]?.(reading) ?? [];
|
|
140
|
+
if (measurements.length === 0) {
|
|
141
|
+
throw unsupported(`a ${reading.type} reading of this shape`);
|
|
142
|
+
}
|
|
143
|
+
const results = [];
|
|
144
|
+
for (const [index, measurement] of measurements.entries()) {
|
|
145
|
+
results.push(await client.measurements.save({
|
|
146
|
+
measurement,
|
|
147
|
+
sourceId: partSourceId(sourceIdOf(reading), index),
|
|
148
|
+
effectiveDateTime: reading.takenAt ?? undefined,
|
|
149
|
+
device
|
|
150
|
+
}));
|
|
151
|
+
}
|
|
152
|
+
return results;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/** Queued when any part of the reading is, with the outbox item of each queued part. */
|
|
156
|
+
const receiptOf = results => {
|
|
157
|
+
const queueIds = results.flatMap(result => result.status === "queued" ? [result.queueId] : []);
|
|
158
|
+
return queueIds.length > 0 ? {
|
|
159
|
+
status: "queued",
|
|
160
|
+
queueIds
|
|
161
|
+
} : {
|
|
162
|
+
status: "saved"
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Saves readings for the signed-in account through the Ovok measurements API, queueing them offline. A reading with a
|
|
168
|
+
* series also saves it; a stored record then removes the live recordings it replaces, once it is saved.
|
|
169
|
+
*/
|
|
167
170
|
const ovokReadingSink = client => ({
|
|
168
171
|
save: async (reading, device) => {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
throw new DeviceError("unsupported", `Ovok cannot save a ${reading.type} reading of this shape yet`);
|
|
172
|
+
if (isUnsavableLive(reading)) {
|
|
173
|
+
throw unsupported(`a live ${reading.live?.metric} recording`);
|
|
172
174
|
}
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
return result.status;
|
|
175
|
+
const target = deviceOf(reading, device);
|
|
176
|
+
const results = [];
|
|
177
|
+
if (isSeriesReading(reading)) {
|
|
178
|
+
results.push(await saveSeries(client, reading, target));
|
|
179
|
+
}
|
|
180
|
+
if (!isSeriesReading(reading) || hasValues(reading)) {
|
|
181
|
+
results.push(...(await saveMeasurements(client, reading, target)));
|
|
182
|
+
}
|
|
183
|
+
await replaceLiveRecordings(client, reading);
|
|
184
|
+
return receiptOf(results);
|
|
184
185
|
}
|
|
185
186
|
});
|
|
186
187
|
export { ovokReadingSink };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MeasurementTypeKey","DeviceError","
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","DeviceError","ecgMeasurements","replaceLiveRecordings","partSourceId","sourceIdOf","ovokValueOf","valueOf","isSeriesReading","saveSeries","flagSet","reading","code","deviceFlags","some","flag","raw","undefined","bloodPressure","measurementTypeKey","systolic","diastolic","meanArterialPressure","heartRate","irregularHeartbeat","recordedAt","takenAt","bloodGlucose","bloodGlucoseValue","bodyWeight","weight","bodyTemperature","temperature","bodyTemp","pulseOximetry","bloodOxygenPulseRate","bloodOxygen","pulseRate","perfusionIndex","respiratoryRate","LIPID_METRICS","LIPID_UNITS","isLipidUnit","unit","lipidUnit","lipidPanel","units","Set","flatMap","metric","values","size","totalCholesterol","hdlCholesterol","ldlCholesterol","triglycerides","spirometry","fvc","fev1","pef","fef2575","Object","value","spirometryPanel","single","measure","measurement","MEASUREMENTS","blood_pressure","blood_glucose","blood_cholesterol","ecg","heart_rate","oxygen_saturation","respiration_rate","deviceOf","device","id","source","address","name","model","localName","manufacturerData","manufacturerName","identity","manufacturer","sn","serial","variant","vendor","batteryPercentage","battery","percent","unsupported","what","isUnsavableLive","live","series","type","hasValues","keys","length","saveMeasurements","client","measurements","results","index","entries","push","save","sourceId","effectiveDateTime","receiptOf","queueIds","result","status","queueId","ovokReadingSink","target"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/ovok-reading-sink.ts"],"mappings":";;AAAA,SAQEA,kBAAkB,QAKb,iBAAiB;AAGxB,SAASC,WAAW,QAAQ,mBAAgB;AAM5C,SAASC,eAAe,QAAQ,uBAAoB;AACpD,SAASC,qBAAqB,QAA4B,wBAAqB;AAC/E,SAASC,YAAY,EAAEC,UAAU,QAAQ,wBAAqB;AAC9D,SAASC,WAAW,EAAEC,OAAO,QAAQ,qBAAkB;AACvD,SAASC,eAAe,EAAqBC,UAAU,QAAQ,oBAAiB;AAEhF,MAAMC,OAAO,GAAGA,CAACC,OAAgB,EAAEC,IAAY,KAC7CD,OAAO,CAACE,WAAW,CAACC,IAAI,CAAEC,IAAI,IAAKA,IAAI,CAACH,IAAI,KAAKA,IAAI,IAAIG,IAAI,CAACC,GAAG,KAAK,CAAC,CAAC,GAAG,IAAI,GAAGC,SAAS;AAE7F,MAAMC,aAAa,GAAIP,OAAgB,KAAgC;EACrEQ,kBAAkB,EAAEnB,kBAAkB,CAACkB,aAAa;EACpDE,QAAQ,EAAEd,WAAW,CAACK,OAAO,EAAE,UAAU,CAAC;EAC1CU,SAAS,EAAEf,WAAW,CAACK,OAAO,EAAE,WAAW,CAAC;EAC5CW,oBAAoB,EAAEhB,WAAW,CAACK,OAAO,EAAE,wBAAwB,CAAC;EACpEY,SAAS,EAAEhB,OAAO,CAACI,OAAO,EAAE,YAAY,CAAC;EACzCa,kBAAkB,EAAEd,OAAO,CAACC,OAAO,EAAE,iBAAiB,CAAC;EACvDc,UAAU,EA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M,EAAE;EAAQ,CAAC;AACnF,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAME,eAAe,GAAId,MAAsB,KAAmB;EAChEM,IAAI,EAAE,MAAAA,CAAOnG,OAAO,EAAEiE,MAAM,KAAK;IAC/B,IAAIoB,eAAe,CAACrF,OAAO,CAAC,EAAE;MAC5B,MAAMmF,WAAW,CAAC,UAAUnF,OAAO,CAACsF,IAAI,EAAEhD,MAAM,YAAY,CAAC;IAC/D;IAEA,MAAMsE,MAAM,GAAG5C,QAAQ,CAAChE,OAAO,EAAEiE,MAAM,CAAC;IACxC,MAAM8B,OAAiC,GAAG,EAAE;IAE5C,IAAIlG,eAAe,CAACG,OAAO,CAAC,EAAE;MAC5B+F,OAAO,CAACG,IAAI,CAAC,MAAMpG,UAAU,CAAC+F,MAAM,EAAE7F,OAAO,EAAE4G,MAAM,CAAC,CAAC;IACzD;IAEA,IAAI,CAAC/G,eAAe,CAACG,OAAO,CAAC,IAAIyF,SAAS,CAACzF,OAAO,CAAC,EAAE;MACnD+F,OAAO,CAACG,IAAI,CAAC,IAAI,MAAMN,gBAAgB,CAACC,MAAM,EAAE7F,OAAO,EAAE4G,MAAM,CAAC,CAAC,CAAC;IACpE;IAEA,MAAMpH,qBAAqB,CAACqG,MAAM,EAAE7F,OAAO,CAAC;IAE5C,OAAOsG,SAAS,CAACP,OAAO,CAAC;EAC3B;AACF,CAAC,CAAC;AAEF,SAASY,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/** The name a live recording is saved under: the device, what it holds, and when it began. */
|
|
4
|
+
const liveSourceId = (address, {
|
|
5
|
+
metric,
|
|
6
|
+
channel,
|
|
7
|
+
from
|
|
8
|
+
}) => ["bluetooth", address, "live", metric, ...(channel === null ? [] : [channel]), from.getTime()].join(":");
|
|
9
|
+
|
|
10
|
+
/** The stable name a reading is saved under, so saving it again writes the same data; `undefined` for a measurement the device does not store. */
|
|
11
|
+
const sourceIdOf = ({
|
|
12
|
+
live,
|
|
13
|
+
source: {
|
|
14
|
+
address,
|
|
15
|
+
recordId
|
|
16
|
+
}
|
|
17
|
+
}) => {
|
|
18
|
+
if (live) {
|
|
19
|
+
return liveSourceId(address, live);
|
|
20
|
+
}
|
|
21
|
+
return recordId === null ? undefined : `bluetooth:${address}:${recordId}`;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/** The name of the `index`th recording of a reading with several, such as the channels of an ECG; the first keeps the reading's own. */
|
|
25
|
+
const partSourceId = (sourceId, index) => sourceId !== undefined && index > 0 ? `${sourceId}:${index}` : sourceId;
|
|
26
|
+
export { liveSourceId, partSourceId, sourceIdOf };
|
|
27
|
+
//# sourceMappingURL=reading-source-id.js.map
|