@ovok/native 1.17.0-dev.2215 → 1.17.0-dev.2222
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/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/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-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 +59 -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/families/viatom/bp2-real-time.js +6 -0
- package/lib/commonjs/modules/next/bluetooth/families/viatom/bp2-real-time.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/families/viatom/recorder-real-time.js +12 -4
- package/lib/commonjs/modules/next/bluetooth/families/viatom/recorder-real-time.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/sqlite/index.js +13 -0
- package/lib/commonjs/modules/next/bluetooth/sqlite/index.js.map +1 -0
- 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/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/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-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 +55 -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/families/viatom/bp2-real-time.js +6 -0
- package/lib/module/modules/next/bluetooth/families/viatom/bp2-real-time.js.map +1 -1
- package/lib/module/modules/next/bluetooth/families/viatom/recorder-real-time.js +12 -4
- package/lib/module/modules/next/bluetooth/families/viatom/recorder-real-time.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/sqlite/index.js +10 -0
- package/lib/module/modules/next/bluetooth/sqlite/index.js.map +1 -0
- 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/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/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 +22 -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 +18 -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/families/viatom/bp2-real-time.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/viatom/recorder-real-time.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/viatom/recorder-real-time.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts +1 -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/sqlite/index.d.ts +10 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/sqlite/index.d.ts.map +1 -0
- 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/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/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 +22 -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 +18 -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/families/viatom/bp2-real-time.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/families/viatom/recorder-real-time.d.ts +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/families/viatom/recorder-real-time.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts +1 -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/sqlite/index.d.ts +10 -0
- package/lib/typescript/module/src/modules/next/bluetooth/sqlite/index.d.ts.map +1 -0
- 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
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { DeviceError } from "./errors.js";
|
|
4
|
+
import { LiveLedger } from "./live-ledger.js";
|
|
5
|
+
import { RECORDED_METRICS, SlotSeries } from "./series-slots.js";
|
|
6
|
+
import { ChannelSegment } from "./waveform-segments.js";
|
|
7
|
+
const MS_PER_SECOND = 1_000;
|
|
8
|
+
const SAVE_OPEN_EVERY_MS = 60_000;
|
|
9
|
+
|
|
10
|
+
/** The device being recorded. */
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Records what one device streams live and saves it through the sink: numbers as series of one-second slots, waveforms
|
|
14
|
+
* as segments of five minutes at the waveform's own sample rate. It does the same for every device.
|
|
15
|
+
*/
|
|
16
|
+
class StreamRecorder {
|
|
17
|
+
open = new Map();
|
|
18
|
+
segments = new Map();
|
|
19
|
+
ledger = new LiveLedger();
|
|
20
|
+
replacing = new Map();
|
|
21
|
+
unsupported = new Set();
|
|
22
|
+
saving = Promise.resolve();
|
|
23
|
+
streaming = false;
|
|
24
|
+
constructor(device, sink, deps) {
|
|
25
|
+
this.device = device;
|
|
26
|
+
this.sink = sink;
|
|
27
|
+
this.deps = deps;
|
|
28
|
+
this.origin = {
|
|
29
|
+
modelId: deps.model.id,
|
|
30
|
+
protocolId: deps.protocol.id,
|
|
31
|
+
address: device.address,
|
|
32
|
+
recordId: null
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Records from the device's events: live numbers and samples, and the end of the stream. */
|
|
37
|
+
follow(events) {
|
|
38
|
+
events.add(event => this.observe(event));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Takes one device event: numbers and samples while recording is on, and the end of the stream. */
|
|
42
|
+
observe(event) {
|
|
43
|
+
if (event.kind === "state") {
|
|
44
|
+
this.followStream(event.snapshot.live);
|
|
45
|
+
} else if (event.kind === "live" && this.device.snapshot().record) {
|
|
46
|
+
this.recordNumbers(event.values);
|
|
47
|
+
} else if (event.kind === "waveform" && this.device.snapshot().record) {
|
|
48
|
+
this.recordWaveform(event.waveform);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Marks the live recordings a stored record replaces, which the sink removes once it has saved the record. */
|
|
53
|
+
supersede(recordId, record) {
|
|
54
|
+
const spans = this.ledger.inside(record);
|
|
55
|
+
if (spans.length === 0) {
|
|
56
|
+
return record;
|
|
57
|
+
}
|
|
58
|
+
this.replacing.set(recordId, spans);
|
|
59
|
+
return {
|
|
60
|
+
...record,
|
|
61
|
+
supersedes: spans
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** The record was saved, so the recordings it replaced are gone for good. */
|
|
66
|
+
acknowledged(recordId) {
|
|
67
|
+
this.ledger.remove(this.replacing.get(recordId) ?? []);
|
|
68
|
+
this.replacing.delete(recordId);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Saves everything still open, and resolves once every save has finished. */
|
|
72
|
+
close() {
|
|
73
|
+
this.stopTimer();
|
|
74
|
+
[...this.open.keys()].forEach(metric => this.finish(metric));
|
|
75
|
+
this.segments.forEach(segment => segment.flush().forEach(reading => this.saveSettled(reading)));
|
|
76
|
+
this.segments.clear();
|
|
77
|
+
return this.saving;
|
|
78
|
+
}
|
|
79
|
+
followStream(streaming) {
|
|
80
|
+
if (this.streaming && !streaming) {
|
|
81
|
+
void this.close();
|
|
82
|
+
}
|
|
83
|
+
this.streaming = streaming;
|
|
84
|
+
}
|
|
85
|
+
recordNumbers({
|
|
86
|
+
values,
|
|
87
|
+
at
|
|
88
|
+
}) {
|
|
89
|
+
Object.entries(values).forEach(([metric, quantity]) => {
|
|
90
|
+
const type = RECORDED_METRICS[metric];
|
|
91
|
+
if (quantity && type && Number.isFinite(quantity.value) && !this.unsupported.has(metric)) {
|
|
92
|
+
const takenAt = at.getTime();
|
|
93
|
+
this.seriesFor({
|
|
94
|
+
metric,
|
|
95
|
+
type,
|
|
96
|
+
unit: quantity.unit
|
|
97
|
+
}, takenAt).put(quantity.value, takenAt);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
seriesFor(kind, at) {
|
|
102
|
+
const current = this.open.get(kind.metric);
|
|
103
|
+
if (current?.takes(kind.unit, at)) {
|
|
104
|
+
return current;
|
|
105
|
+
}
|
|
106
|
+
if (current) {
|
|
107
|
+
this.finish(kind.metric);
|
|
108
|
+
}
|
|
109
|
+
const series = new SlotSeries(kind, at);
|
|
110
|
+
this.open.set(kind.metric, series);
|
|
111
|
+
this.timer ??= setInterval(() => this.saveOpenSeries(), SAVE_OPEN_EVERY_MS);
|
|
112
|
+
return series;
|
|
113
|
+
}
|
|
114
|
+
recordWaveform(waveform) {
|
|
115
|
+
if (this.unsupported.has(waveform.metric) || !(waveform.sampleRateHz > 0)) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const arrivedAt = this.deps.now().getTime();
|
|
119
|
+
waveform.channels.forEach((channel, index) => {
|
|
120
|
+
const samples = waveform.samples[index];
|
|
121
|
+
const firstAt = waveform.firstSampleAt?.getTime() ?? arrivedAt - (samples?.length ?? 0) / waveform.sampleRateHz * MS_PER_SECOND;
|
|
122
|
+
if (samples?.length) {
|
|
123
|
+
this.segmentFor(waveform, channel).add(samples, firstAt).forEach(reading => this.saveSettled(reading));
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
segmentFor(waveform, channel) {
|
|
128
|
+
const {
|
|
129
|
+
metric,
|
|
130
|
+
sampleRateHz,
|
|
131
|
+
unit,
|
|
132
|
+
scale
|
|
133
|
+
} = waveform;
|
|
134
|
+
const key = [metric, channel, sampleRateHz, unit, scale].join("|");
|
|
135
|
+
const segment = this.segments.get(key) ?? new ChannelSegment({
|
|
136
|
+
metric,
|
|
137
|
+
channel,
|
|
138
|
+
sampleRateHz,
|
|
139
|
+
unit,
|
|
140
|
+
scale
|
|
141
|
+
}, this.origin);
|
|
142
|
+
this.segments.set(key, segment);
|
|
143
|
+
return segment;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** The 60-second save: an open series that grew goes out again under its own name, so the outbox keeps one copy. */
|
|
147
|
+
saveOpenSeries() {
|
|
148
|
+
const now = this.deps.now().getTime();
|
|
149
|
+
[...this.open.entries()].forEach(([metric, series]) => {
|
|
150
|
+
if (series.isQuiet(now)) {
|
|
151
|
+
this.finish(metric);
|
|
152
|
+
} else if (series.unsaved) {
|
|
153
|
+
this.enqueue(series.reading(this.origin), () => undefined);
|
|
154
|
+
series.markSaved();
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
if (this.open.size === 0) {
|
|
158
|
+
this.stopTimer();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
finish(metric) {
|
|
162
|
+
const series = this.open.get(metric);
|
|
163
|
+
this.open.delete(metric);
|
|
164
|
+
if (series) {
|
|
165
|
+
this.saveSettled(series.reading(this.origin));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
saveSettled(reading) {
|
|
169
|
+
this.enqueue(reading, ({
|
|
170
|
+
live
|
|
171
|
+
}) => {
|
|
172
|
+
if (live) {
|
|
173
|
+
this.ledger.add(live);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** Saves one at a time, in the order they were made. */
|
|
179
|
+
enqueue(reading, onSaved) {
|
|
180
|
+
this.saving = this.saving.then(async () => {
|
|
181
|
+
if (reading.live && this.unsupported.has(reading.live.metric)) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
try {
|
|
185
|
+
await this.sink.save(reading, this.device.snapshot());
|
|
186
|
+
onSaved(reading);
|
|
187
|
+
} catch (error) {
|
|
188
|
+
this.failed(reading, error);
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
failed(reading, error) {
|
|
193
|
+
const metric = reading.live?.metric ?? null;
|
|
194
|
+
const protocol = this.origin.protocolId;
|
|
195
|
+
if (error instanceof DeviceError && error.code === "unsupported" && reading.live) {
|
|
196
|
+
this.unsupported.add(reading.live.metric);
|
|
197
|
+
this.deps.logger.warn("bluetooth.stream.unsupported", {
|
|
198
|
+
protocol,
|
|
199
|
+
metric
|
|
200
|
+
});
|
|
201
|
+
} else {
|
|
202
|
+
this.deps.logger.error("bluetooth.stream.save-failed", {
|
|
203
|
+
protocol,
|
|
204
|
+
metric,
|
|
205
|
+
code: error instanceof DeviceError ? error.code : null
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
stopTimer() {
|
|
210
|
+
clearInterval(this.timer);
|
|
211
|
+
this.timer = undefined;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
export { StreamRecorder };
|
|
215
|
+
//# sourceMappingURL=stream-recorder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DeviceError","LiveLedger","RECORDED_METRICS","SlotSeries","ChannelSegment","MS_PER_SECOND","SAVE_OPEN_EVERY_MS","StreamRecorder","open","Map","segments","ledger","replacing","unsupported","Set","saving","Promise","resolve","streaming","constructor","device","sink","deps","origin","modelId","model","id","protocolId","protocol","address","recordId","follow","events","add","event","observe","kind","followStream","snapshot","live","record","recordNumbers","values","recordWaveform","waveform","supersede","spans","inside","length","set","supersedes","acknowledged","remove","get","delete","close","stopTimer","keys","forEach","metric","finish","segment","flush","reading","saveSettled","clear","at","Object","entries","quantity","type","Number","isFinite","value","has","takenAt","getTime","seriesFor","unit","put","current","takes","series","timer","setInterval","saveOpenSeries","sampleRateHz","arrivedAt","now","channels","channel","index","samples","firstAt","firstSampleAt","segmentFor","scale","key","join","isQuiet","unsaved","enqueue","undefined","markSaved","size","onSaved","then","save","error","failed","code","logger","warn","clearInterval"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/core/stream-recorder.ts"],"mappings":";;AAEA,SAASA,WAAW,QAAQ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AAC9C,OAAgB,EAAE6C,KAAc,EAAQ;IACrD,MAAMjD,MAAM,GAAGI,OAAO,CAACxB,IAAI,EAAEoB,MAAM,IAAI,IAAI;IAC3C,MAAM/B,QAAQ,GAAG,IAAI,CAACL,MAAM,CAACI,UAAU;IAEvC,IAAIiF,KAAK,YAAY5G,WAAW,IAAI4G,KAAK,CAACE,IAAI,KAAK,aAAa,IAAI/C,OAAO,CAACxB,IAAI,EAAE;MAChF,IAAI,CAAC1B,WAAW,CAACoB,GAAG,CAAC8B,OAAO,CAACxB,IAAI,CAACoB,MAAM,CAAC;MACzC,IAAI,CAACrC,IAAI,CAACyF,MAAM,CAACC,IAAI,CAAC,8BAA8B,EAAE;QAAEpF,QAAQ;QAAE+B;MAAO,CAAC,CAAC;IAC7E,CAAC,MAAM;MACL,IAAI,CAACrC,IAAI,CAACyF,MAAM,CAACH,KAAK,CAAC,8BAA8B,EAAE;QAAEhF,QAAQ;QAAE+B,MAAM;QAAEmD,IAAI,EAAEF,KAAK,YAAY5G,WAAW,GAAG4G,KAAK,CAACE,IAAI,GAAG;MAAK,CAAC,CAAC;IACtI;EACF;EAEQtD,SAASA,CAAA,EAAS;IACxByD,aAAa,CAAC,IAAI,CAAC9B,KAAK,CAAC;IACzB,IAAI,CAACA,KAAK,GAAGmB,SAAS;EACxB;AACF;AAEA,SAAS/F,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const MS_PER_SECOND = 1_000;
|
|
4
|
+
const SEGMENT_MS = 5 * 60_000;
|
|
5
|
+
|
|
6
|
+
/** Samples that arrive this much later than the ones before them leave a hole, so they start a new segment. */
|
|
7
|
+
const MAX_GAP_MS = 5_000;
|
|
8
|
+
const MEASUREMENT_OF_WAVEFORM = {
|
|
9
|
+
ecg_waveform: "ecg",
|
|
10
|
+
pleth_waveform: "oxygen_saturation"
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/** What stays the same while one channel of a waveform streams. */
|
|
14
|
+
|
|
15
|
+
/** One channel's samples, collected until they fill five minutes, a gap opens, or the stream ends. */
|
|
16
|
+
class ChannelSegment {
|
|
17
|
+
chunks = [];
|
|
18
|
+
count = 0;
|
|
19
|
+
from = 0;
|
|
20
|
+
constructor(shape, origin) {
|
|
21
|
+
this.shape = shape;
|
|
22
|
+
this.origin = origin;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Adds samples whose first was taken at `at`; returns the segments they completed. */
|
|
26
|
+
add(samples, at) {
|
|
27
|
+
const completed = this.count > 0 && at - this.endsAt() > MAX_GAP_MS ? this.flush() : [];
|
|
28
|
+
let rest = samples;
|
|
29
|
+
let restAt = at;
|
|
30
|
+
while (rest.length > 0) {
|
|
31
|
+
const part = rest.subarray(0, this.capacity() - this.count);
|
|
32
|
+
this.append(part, restAt);
|
|
33
|
+
rest = rest.subarray(part.length);
|
|
34
|
+
restAt += this.durationOf(part.length);
|
|
35
|
+
completed.push(...(this.count >= this.capacity() ? this.flush() : []));
|
|
36
|
+
}
|
|
37
|
+
return completed;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Hands over what is collected as one reading, none when it is empty. */
|
|
41
|
+
flush() {
|
|
42
|
+
if (this.count === 0) {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
const samples = new Int16Array(this.count);
|
|
46
|
+
let filled = 0;
|
|
47
|
+
this.chunks.forEach(chunk => {
|
|
48
|
+
samples.set(chunk, filled);
|
|
49
|
+
filled += chunk.length;
|
|
50
|
+
});
|
|
51
|
+
const reading = this.readingOf(samples);
|
|
52
|
+
this.chunks = [];
|
|
53
|
+
this.count = 0;
|
|
54
|
+
return [reading];
|
|
55
|
+
}
|
|
56
|
+
append(part, at) {
|
|
57
|
+
if (this.count === 0) {
|
|
58
|
+
this.from = at;
|
|
59
|
+
}
|
|
60
|
+
this.chunks.push(part.slice());
|
|
61
|
+
this.count += part.length;
|
|
62
|
+
}
|
|
63
|
+
readingOf(samples) {
|
|
64
|
+
const from = new Date(this.from);
|
|
65
|
+
const {
|
|
66
|
+
metric,
|
|
67
|
+
channel,
|
|
68
|
+
sampleRateHz,
|
|
69
|
+
unit,
|
|
70
|
+
scale
|
|
71
|
+
} = this.shape;
|
|
72
|
+
return {
|
|
73
|
+
type: MEASUREMENT_OF_WAVEFORM[metric],
|
|
74
|
+
takenAt: from,
|
|
75
|
+
values: {},
|
|
76
|
+
deviceFlags: [],
|
|
77
|
+
waveform: {
|
|
78
|
+
metric,
|
|
79
|
+
sampleRateHz,
|
|
80
|
+
unit,
|
|
81
|
+
scale,
|
|
82
|
+
channels: [channel],
|
|
83
|
+
samples: [samples],
|
|
84
|
+
firstSampleAt: from
|
|
85
|
+
},
|
|
86
|
+
live: {
|
|
87
|
+
metric,
|
|
88
|
+
channel,
|
|
89
|
+
from,
|
|
90
|
+
to: new Date(this.endsAt())
|
|
91
|
+
},
|
|
92
|
+
source: this.origin
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
capacity() {
|
|
96
|
+
return Math.round(this.shape.sampleRateHz * SEGMENT_MS / MS_PER_SECOND);
|
|
97
|
+
}
|
|
98
|
+
endsAt() {
|
|
99
|
+
return this.from + this.durationOf(this.count);
|
|
100
|
+
}
|
|
101
|
+
durationOf(samples) {
|
|
102
|
+
return samples / this.shape.sampleRateHz * MS_PER_SECOND;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
export { ChannelSegment };
|
|
106
|
+
//# sourceMappingURL=waveform-segments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MS_PER_SECOND","SEGMENT_MS","MAX_GAP_MS","MEASUREMENT_OF_WAVEFORM","ecg_waveform","pleth_waveform","ChannelSegment","chunks","count","from","constructor","shape","origin","add","samples","at","completed","endsAt","flush","rest","restAt","length","part","subarray","capacity","append","durationOf","push","Int16Array","filled","forEach","chunk","set","reading","readingOf","slice","Date","metric","channel","sampleRateHz","unit","scale","type","takenAt","values","deviceFlags","waveform","channels","firstSampleAt","live","to","source","Math","round"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/core/waveform-segments.ts"],"mappings":";;AAGA,MAAMA,aAAa,GAAG,KAAK;AAC3B,MAAMC,UAAU,GAAG,CAAC,GAAG,MAAM;;AAE7B;AACA,MAAMC,UAAU,GAAG,KAAK;AAExB,MAAMC,uBAAoE,GAAG;EAC3EC,YAAY,EAAE,KAAK;EACnBC,cAAc,EAAE;AAClB,CAAC;;AAED;;AAGA;AACA,MAAMC,cAAc,CAAC;EACXC,MAAM,GAAiB,EAAE;EACzBC,KAAK,GAAG,CAAC;EACTC,IAAI,GAAG,CAAC;EAETC,WAAWA,CAAkBC,KAAmB,EAAmBC,MAAqB,EAAE;IAAA,KAA7DD,KAAmB,GAAnBA,KAAmB;IAAA,KAAmBC,MAAqB,GAArBA,MAAqB;EAAG;;EAElG;EACOC,GAAGA,CAACC,OAAmB,EAAEC,EAAU,EAAa;IACrD,MAAMC,SAAS,GAAG,IAAI,CAACR,KAAK,GAAG,CAAC,IAAIO,EAAE,GAAG,IAAI,CAACE,MAAM,CAAC,CAAC,GAAGf,UAAU,GAAG,IAAI,CAACgB,KAAK,CAAC,CAAC,GAAG,EAAE;IACvF,IAAIC,IAAI,GAAGL,OAAO;IAClB,IAAIM,MAAM,GAAGL,EAAE;IAEf,OAAOI,IAAI,CAACE,MAAM,GAAG,CAAC,EAAE;MACtB,MAAMC,IAAI,GAAGH,IAAI,CAACI,QAAQ,CAAC,CAAC,EAAE,IAAI,CAACC,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAChB,KAAK,CAAC;MAE3D,IAAI,CAACiB,MAAM,CAACH,IAAI,EAAEF,MAAM,CAAC;MACzBD,IAAI,GAAGA,IAAI,CAACI,QAAQ,CAACD,IAAI,CAACD,MAAM,CAAC;MACjCD,MAAM,IAAI,IAAI,CAACM,UAAU,CAACJ,IAAI,CAACD,MAAM,CAAC;MACtCL,SAAS,CAACW,IA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ACL+B,IAAI,EAAEvC,uBAAuB,CAACkC,MAAM,CAAC;MACrCM,OAAO,EAAElC,IAAI;MACbmC,MAAM,EAAE,CAAC,CAAC;MACVC,WAAW,EAAE,EAAE;MACfC,QAAQ,EAAE;QAAET,MAAM;QAAEE,YAAY;QAAEC,IAAI;QAAEC,KAAK;QAAEM,QAAQ,EAAE,CAACT,OAAO,CAAC;QAAExB,OAAO,EAAE,CAACA,OAAO,CAAC;QAAEkC,aAAa,EAAEvC;MAAK,CAAC;MAC7GwC,IAAI,EAAE;QAAEZ,MAAM;QAAEC,OAAO;QAAE7B,IAAI;QAAEyC,EAAE,EAAE,IAAId,IAAI,CAAC,IAAI,CAACnB,MAAM,CAAC,CAAC;MAAE,CAAC;MAC5DkC,MAAM,EAAE,IAAI,CAACvC;IACf,CAAC;EACH;EAEQY,QAAQA,CAAA,EAAW;IACzB,OAAO4B,IAAI,CAACC,KAAK,CAAE,IAAI,CAAC1C,KAAK,CAAC4B,YAAY,GAAGtC,UAAU,GAAID,aAAa,CAAC;EAC3E;EAEQiB,MAAMA,CAAA,EAAW;IACvB,OAAO,IAAI,CAACR,IAAI,GAAG,IAAI,CAACiB,UAAU,CAAC,IAAI,CAAClB,KAAK,CAAC;EAChD;EAEQkB,UAAUA,CAACZ,OAAe,EAAU;IAC1C,OAAQA,OAAO,GAAG,IAAI,CAACH,KAAK,CAAC4B,YAAY,GAAIvC,aAAa;EAC5D;AACF;AAEA,SAASM,cAAc","ignoreList":[]}
|
|
@@ -4,6 +4,7 @@ import { BleManager } from "react-native-ble-plx";
|
|
|
4
4
|
import { androidForegroundService } from "./adapters/android-foreground-service.js";
|
|
5
5
|
import { blePlxCentral } from "./adapters/ble-plx-central.js";
|
|
6
6
|
import { osBluetoothPermissions } from "./adapters/os-permissions.js";
|
|
7
|
+
import { ovokOutboxWatch } from "./adapters/ovok-outbox-watch.js";
|
|
7
8
|
import { ovokReadingSink } from "./adapters/ovok-reading-sink.js";
|
|
8
9
|
import { reactNativeLifecycle } from "./adapters/react-native-lifecycle.js";
|
|
9
10
|
import { storagePairedDevices } from "./adapters/storage-paired-devices.js";
|
|
@@ -17,16 +18,23 @@ const createBluetooth = ({
|
|
|
17
18
|
ovok,
|
|
18
19
|
storage,
|
|
19
20
|
...overrides
|
|
20
|
-
}) =>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
21
|
+
}) => {
|
|
22
|
+
const outbox = ovokOutboxWatch(ovok.outbox, overrides.logger);
|
|
23
|
+
return new Bluetooth({
|
|
24
|
+
central: blePlxCentral(new BleManager()),
|
|
25
|
+
store: storagePairedDevices(storage),
|
|
26
|
+
sink: ovokReadingSink(ovok),
|
|
27
|
+
permissions: osBluetoothPermissions(),
|
|
28
|
+
models: BUILT_IN_MODELS,
|
|
29
|
+
protocols: BUILT_IN_PROTOCOLS,
|
|
30
|
+
lifecycle: reactNativeLifecycle(),
|
|
31
|
+
keepAlive: androidForegroundService({}, {
|
|
32
|
+
outbox,
|
|
33
|
+
logger: overrides.logger
|
|
34
|
+
}),
|
|
35
|
+
outbox,
|
|
36
|
+
...overrides
|
|
37
|
+
});
|
|
38
|
+
};
|
|
31
39
|
export { createBluetooth };
|
|
32
40
|
//# sourceMappingURL=create-bluetooth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BleManager","androidForegroundService","blePlxCentral","osBluetoothPermissions","ovokReadingSink","reactNativeLifecycle","storagePairedDevices","Bluetooth","BUILT_IN_MODELS","BUILT_IN_PROTOCOLS","createBluetooth","ovok","storage","overrides","central","store","sink","permissions","models","protocols","lifecycle","keepAlive"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/create-bluetooth.ts"],"mappings":";;AACA,SAASA,UAAU,QAAQ,sBAAsB;AAEjD,SAASC,wBAAwB,QAAQ,0CAAuC;AAChF,SAASC,aAAa,QAAQ,+BAA4B;AAC1D,SAASC,sBAAsB,QAAQ,8BAA2B;AAClE,SAASC,eAAe,QAAQ,iCAA8B;AAC9D,SAASC,oBAAoB,QAAQ,sCAAmC;AACxE,SAASC,oBAAoB,QAAQ,sCAAmC;AACxE,SAASC,SAAS,QAA0B,qBAAkB;AAC9D,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,wBAAqB;;AAEzE;;AAUA;AACA,MAAMC,eAAe,GAAGA,CAAC;EAAEC,IAAI;EAAEC,OAAO;EAAE,GAAGC;AAAkC,CAAC,
|
|
1
|
+
{"version":3,"names":["BleManager","androidForegroundService","blePlxCentral","osBluetoothPermissions","ovokOutboxWatch","ovokReadingSink","reactNativeLifecycle","storagePairedDevices","Bluetooth","BUILT_IN_MODELS","BUILT_IN_PROTOCOLS","createBluetooth","ovok","storage","overrides","outbox","logger","central","store","sink","permissions","models","protocols","lifecycle","keepAlive"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/create-bluetooth.ts"],"mappings":";;AACA,SAASA,UAAU,QAAQ,sBAAsB;AAEjD,SAASC,wBAAwB,QAAQ,0CAAuC;AAChF,SAASC,aAAa,QAAQ,+BAA4B;AAC1D,SAASC,sBAAsB,QAAQ,8BAA2B;AAClE,SAASC,eAAe,QAAQ,iCAA8B;AAC9D,SAAyBC,eAAe,QAAQ,iCAA8B;AAC9E,SAASC,oBAAoB,QAAQ,sCAAmC;AACxE,SAASC,oBAAoB,QAAQ,sCAAmC;AACxE,SAASC,SAAS,QAA0B,qBAAkB;AAC9D,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,wBAAqB;;AAEzE;;AAUA;AACA,MAAMC,eAAe,GAAGA,CAAC;EAAEC,IAAI;EAAEC,OAAO;EAAE,GAAGC;AAAkC,CAAC,KAAgB;EAC9F,MAAMC,MAAM,GAAGX,eAAe,CAACQ,IAAI,CAACG,MAAM,EAAED,SAAS,CAACE,MAAM,CAAC;EAE7D,OAAO,IAAIR,SAAS,CAAC;IACnBS,OAAO,EAAEf,aAAa,CAAC,IAAIF,UAAU,CAAC,CAAC,CAAC;IACxCkB,KAAK,EAAEX,oBAAoB,CAACM,OAAO,CAAC;IACpCM,IAAI,EAAEd,eAAe,CAACO,IAAI,CAAC;IAC3BQ,WAAW,EAAEjB,sBAAsB,CAAC,CAAC;IACrCkB,MAAM,EAAEZ,eAAe;IACvBa,SAAS,EAAEZ,kBAAkB;IAC7Ba,SAAS,EAAEjB,oBAAoB,CAAC,CAAC;IACjCkB,SAAS,EAAEvB,wBAAwB,CAAC,CAAC,CAAC,EAAE;MAAEc,MAAM;MAAEC,MAAM,EAAEF,SAAS,CAACE;IAAO,CAAC,CAAC;IAC7ED,MAAM;IACN,GAAGD;EACL,CAAC,CAAC;AACJ,CAAC;AAED,SAASH,eAAe","ignoreList":[]}
|
|
@@ -13,10 +13,15 @@ const BATTERY_STATE_AT = 1;
|
|
|
13
13
|
const BATTERY_PERCENT_AT = 2;
|
|
14
14
|
const WAVE_DATA_AT = 10;
|
|
15
15
|
const WAVE_DATA_BYTES = 20;
|
|
16
|
+
const BP_MEASURING = 4;
|
|
16
17
|
const BP_RESULT = 5;
|
|
17
18
|
const ECG_MEASURING = 6;
|
|
18
19
|
const ECG_RESULT = 7;
|
|
20
|
+
const BP_AVERAGE_MEASURING = 15;
|
|
19
21
|
const BP_AVERAGE_RESULT = 17;
|
|
22
|
+
|
|
23
|
+
/** The run statuses in which the monitor is measuring; on a result, ready or history screen it is not. */
|
|
24
|
+
const MEASURING_STATES = new Set([BP_MEASURING, ECG_MEASURING, BP_AVERAGE_MEASURING]);
|
|
20
25
|
const BP_SYSTOLIC_AT = 3;
|
|
21
26
|
const BP_DIASTOLIC_AT = 5;
|
|
22
27
|
const BP_MEAN_AT = 7;
|
|
@@ -92,6 +97,7 @@ const liveFrame = (reply, now) => {
|
|
|
92
97
|
const runStatus = reply[RUN_STATUS_AT] ?? 0;
|
|
93
98
|
const shown = WAVE_DECODERS[runStatus]?.(reply.subarray(WAVE_DATA_AT, WAVE_DATA_AT + WAVE_DATA_BYTES));
|
|
94
99
|
return {
|
|
100
|
+
measuring: MEASURING_STATES.has(runStatus),
|
|
95
101
|
values: {
|
|
96
102
|
at: now,
|
|
97
103
|
values: shown?.values ?? {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["u16le","u32le","batteryReport","count","milliseconds","mmHg","perMinute","completeReply","RT_DATA","REPLY_BYTES","RUN_STATUS_AT","BATTERY_STATE_AT","BATTERY_PERCENT_AT","WAVE_DATA_AT","WAVE_DATA_BYTES","BP_RESULT","ECG_MEASURING","ECG_RESULT","BP_AVERAGE_RESULT","BP_SYSTOLIC_AT","BP_DIASTOLIC_AT","BP_MEAN_AT","BP_PULSE_AT","BP_RESULT_CODE_AT","BP_RESULT_VALID","ECG_FLAGS_AT","ECG_MEASURING_HEART_RATE_AT","MIN_RECORDING_HEART_RATE","MAX_RECORDING_HEART_RATE","ECG_DIAGNOSIS_AT","ECG_RESULT_HEART_RATE_AT","ECG_QRS_AT","ECG_PVC_AT","ECG_QTC_AT","bloodPressureResult","wave","code","values","systolic","diastolic","mean_arterial_pressure","pulse_rate","deviceFlags","raw","ecgMeasuring","heartRate","shown","heart_rate","ecgResult","ecg_qrs_duration","pvc_count","ecg_qtc_interval","WAVE_DECODERS","liveFrame","reply","now","length","runStatus","subarray","at","batteryOf","BP2_REAL_TIME","command","request","frame","battery"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/viatom/bp2-real-time.ts"],"mappings":";;AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,sBAAmB;AAGhD,SAASC,aAAa,QAAQ,kBAAe;AAC7C,SAASC,KAAK,EAAEC,YAAY,EAAEC,IAAI,EAAEC,SAAS,QAAQ,iBAAc;AACnE,SAASC,aAAa,QAAkB,gBAAa;AAErD,MAAMC,OAAO,GAAG,IAAI;;AAEpB;AACA,MAAMC,WAAW,GAAG,EAAE;AACtB,MAAMC,aAAa,GAAG,CAAC;AACvB,MAAMC,gBAAgB,GAAG,CAAC;AAC1B,MAAMC,kBAAkB,GAAG,CAAC;AAC5B,MAAMC,YAAY,GAAG,EAAE;AACvB,MAAMC,eAAe,GAAG,EAAE;AAE1B,MAAMC,SAAS,GAAG,CAAC;AACnB,MAAMC,aAAa,GAAG,CAAC;AACvB,MAAMC,UAAU,GAAG,CAAC;AACpB,MAAMC,iBAAiB,GAAG,EAAE;
|
|
1
|
+
{"version":3,"names":["u16le","u32le","batteryReport","count","milliseconds","mmHg","perMinute","completeReply","RT_DATA","REPLY_BYTES","RUN_STATUS_AT","BATTERY_STATE_AT","BATTERY_PERCENT_AT","WAVE_DATA_AT","WAVE_DATA_BYTES","BP_MEASURING","BP_RESULT","ECG_MEASURING","ECG_RESULT","BP_AVERAGE_MEASURING","BP_AVERAGE_RESULT","MEASURING_STATES","Set","BP_SYSTOLIC_AT","BP_DIASTOLIC_AT","BP_MEAN_AT","BP_PULSE_AT","BP_RESULT_CODE_AT","BP_RESULT_VALID","ECG_FLAGS_AT","ECG_MEASURING_HEART_RATE_AT","MIN_RECORDING_HEART_RATE","MAX_RECORDING_HEART_RATE","ECG_DIAGNOSIS_AT","ECG_RESULT_HEART_RATE_AT","ECG_QRS_AT","ECG_PVC_AT","ECG_QTC_AT","bloodPressureResult","wave","code","values","systolic","diastolic","mean_arterial_pressure","pulse_rate","deviceFlags","raw","ecgMeasuring","heartRate","shown","heart_rate","ecgResult","ecg_qrs_duration","pvc_count","ecg_qtc_interval","WAVE_DECODERS","liveFrame","reply","now","length","runStatus","subarray","measuring","has","at","batteryOf","BP2_REAL_TIME","command","request","frame","battery"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/viatom/bp2-real-time.ts"],"mappings":";;AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,sBAAmB;AAGhD,SAASC,aAAa,QAAQ,kBAAe;AAC7C,SAASC,KAAK,EAAEC,YAAY,EAAEC,IAAI,EAAEC,SAAS,QAAQ,iBAAc;AACnE,SAASC,a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B,CAAC,IAAI,CAAC,CAAC;AACpF,CAAC;;AAED;AACA,MAAMwD,aAAuB,GAAG;EAAEC,OAAO,EAAE5D,OAAO;EAAE6D,OAAO,EAAE,EAAE;EAAEC,KAAK,EAAEb,SAAS;EAAEc,OAAO,EAAEL;AAAU,CAAC;AAEvG,SAASC,aAAa","ignoreList":[]}
|
|
@@ -20,6 +20,11 @@ const BATTERY_STATE_MASK = 0x03;
|
|
|
20
20
|
|
|
21
21
|
/** The low nibble of the run status is the state now; the high nibble is the state before. */
|
|
22
22
|
const CURRENT_STATE_MASK = 0x0f;
|
|
23
|
+
const CHECKING_LEADS = 1;
|
|
24
|
+
const RECORDING = 2;
|
|
25
|
+
|
|
26
|
+
/** The states in which the patch is on a body and streams its lead; standby, lead off and the rest stream nothing real. */
|
|
27
|
+
const ON_BODY_STATES = new Set([CHECKING_LEADS, RECORDING]);
|
|
23
28
|
|
|
24
29
|
/** A heart rate of these means the device has none. */
|
|
25
30
|
const NO_HEART_RATES = new Set([0xff, 0xffff]);
|
|
@@ -42,16 +47,19 @@ const liveFrame = lead => (reply, now) => {
|
|
|
42
47
|
if (reply.length < PARAMETER_BYTES) {
|
|
43
48
|
return null;
|
|
44
49
|
}
|
|
50
|
+
const runStatus = (reply[RUN_STATUS_AT] ?? 0) & CURRENT_STATE_MASK;
|
|
51
|
+
const onBody = ON_BODY_STATES.has(runStatus);
|
|
45
52
|
const samples = Int16Array.from({
|
|
46
|
-
length: sampleCount(reply)
|
|
53
|
+
length: onBody ? sampleCount(reply) : 0
|
|
47
54
|
}, (_, index) => sampleOf(reply, index));
|
|
48
55
|
return {
|
|
56
|
+
measuring: onBody,
|
|
49
57
|
values: {
|
|
50
58
|
at: now,
|
|
51
|
-
values: heartRateValues(reply),
|
|
59
|
+
values: onBody ? heartRateValues(reply) : {},
|
|
52
60
|
deviceFlags: [{
|
|
53
61
|
code: "run_status",
|
|
54
|
-
raw:
|
|
62
|
+
raw: runStatus
|
|
55
63
|
}]
|
|
56
64
|
},
|
|
57
65
|
...(samples.length > 0 ? {
|
|
@@ -75,7 +83,7 @@ const recorderRealTime = (request, lead) => ({
|
|
|
75
83
|
battery: batteryOf
|
|
76
84
|
});
|
|
77
85
|
|
|
78
|
-
/** The real-time poll of an ER1 patch:
|
|
86
|
+
/** The real-time poll of an ER1 patch: its run status, and while it is worn its heart rate and newest samples. */
|
|
79
87
|
const ER1_REAL_TIME = recorderRealTime(ER1_POLL_REQUEST, "II");
|
|
80
88
|
|
|
81
89
|
/** The real-time poll of an ER2 recorder: the same reply, asked for with no payload. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["u16le","batteryReport","ecgWaveform","i16le","MILLIVOLTS_PER_COUNT","NO_SIGNAL_SAMPLE","perMinute","completeReply","RT_DATA","PARAMETER_BYTES","SAMPLES_AT","SAMPLE_BYTES","HEART_RATE_AT","SYS_FLAG_AT","BATTERY_AT","RUN_STATUS_AT","BATTERY_STATE_SHIFT","BATTERY_STATE_MASK","CURRENT_STATE_MASK","
|
|
1
|
+
{"version":3,"names":["u16le","batteryReport","ecgWaveform","i16le","MILLIVOLTS_PER_COUNT","NO_SIGNAL_SAMPLE","perMinute","completeReply","RT_DATA","PARAMETER_BYTES","SAMPLES_AT","SAMPLE_BYTES","HEART_RATE_AT","SYS_FLAG_AT","BATTERY_AT","RUN_STATUS_AT","BATTERY_STATE_SHIFT","BATTERY_STATE_MASK","CURRENT_STATE_MASK","CHECKING_LEADS","RECORDING","ON_BODY_STATES","Set","NO_HEART_RATES","ER1_POLL_REQUEST","NO_POLL_REQUEST","heartRateValues","reply","heartRate","has","heart_rate","sampleCount","Math","max","floor","length","sampleOf","index","raw","liveFrame","lead","now","runStatus","onBody","samples","Int16Array","from","_","measuring","values","at","deviceFlags","code","waveform","scale","startedAt","batteryOf","recorderRealTime","request","command","frame","battery","ER1_REAL_TIME","ER2_REAL_TIME"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/viatom/recorder-real-time.ts"],"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D,oBAAoB;QAAEmD,SAAS,EAAE;MAAK,CAAC;IAAE,CAAC,GAC1F,CAAC,CAAC;EACR,CAAC;AACH,CAAC;AAEH,MAAMC,SAAS,GAAI7B,KAAiB,IAAK;EACvCpB,aAAa,CAACoB,KAAK,EAAElB,eAAe,CAAC;EAErC,OAAOR,aAAa,CAAC0B,KAAK,CAACb,UAAU,CAAC,IAAI,CAAC,EAAG,CAACa,KAAK,CAACd,WAAW,CAAC,IAAI,CAAC,KAAKG,mBAAmB,GAAIC,kBAAkB,CAAC;AACvH,CAAC;AAED,MAAMwC,gBAAgB,GAAGA,CAACC,OAA0B,EAAElB,IAAY,MAAgB;EAChFmB,OAAO,EAAEnD,OAAO;EAChBkD,OAAO;EACPE,KAAK,EAAErB,SAAS,CAACC,IAAI,CAAC;EACtBqB,OAAO,EAAEL;AACX,CAAC,CAAC;;AAEF;AACA,MAAMM,aAAa,GAAGL,gBAAgB,CAACjC,gBAAgB,EAAE,IAAI,CAAC;;AAE9D;AACA,MAAMuC,aAAa,GAAGN,gBAAgB,CAAChC,eAAe,EAAE,GAAG,CAAC;AAE5D,SAASqC,aAAa,EAAEC,aAAa","ignoreList":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
export { ovokOutboxWatch } from "./adapters/ovok-outbox-watch.js";
|
|
3
4
|
export { ovokReadingSink } from "./adapters/ovok-reading-sink.js";
|
|
4
5
|
export { storagePairedDevices } from "./adapters/storage-paired-devices.js";
|
|
5
6
|
export { Bluetooth } from "./core/bluetooth.js";
|
|
@@ -12,4 +13,5 @@ export { BluetoothProvider, useBluetooth } from "./react/context.js";
|
|
|
12
13
|
export { useBluetoothAdapter, useCatalog, usePairedDevices, useReadings } from "./react/hooks.js";
|
|
13
14
|
export { useDevice, useLiveValues, useWaveform } from "./react/use-device.js";
|
|
14
15
|
export { useDiscovery } from "./react/use-discovery.js";
|
|
16
|
+
export { useOutbox } from "@ovok/core/next/react";
|
|
15
17
|
//# sourceMappingURL=shared.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ovokReadingSink","storagePairedDevices","Bluetooth","Catalog","Device","Discovery","DeviceError","BUILT_IN_MODELS","BUILT_IN_PROTOCOLS","BluetoothProvider","useBluetooth","useBluetoothAdapter","useCatalog","usePairedDevices","useReadings","useDevice","useLiveValues","useWaveform","useDiscovery"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/shared.ts"],"mappings":";;AAAA,SAASA,eAAe,QAAQ,iCAA8B;AAC9D,SAASC,oBAAoB,QAAQ,sCAAmC;AACxE,SAASC,SAAS,QAAQ,qBAAkB;AAE5C,SAASC,OAAO,QAAQ,mBAAgB;AAExC,SAASC,MAAM,QAAQ,kBAAe;AAEtC,SAASC,SAAS,QAAQ,qBAAkB;AAE5C,SAASC,WAAW,QAAQ,kBAAe;
|
|
1
|
+
{"version":3,"names":["ovokOutboxWatch","ovokReadingSink","storagePairedDevices","Bluetooth","Catalog","Device","Discovery","DeviceError","BUILT_IN_MODELS","BUILT_IN_PROTOCOLS","BluetoothProvider","useBluetooth","useBluetoothAdapter","useCatalog","usePairedDevices","useReadings","useDevice","useLiveValues","useWaveform","useDiscovery","useOutbox"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/shared.ts"],"mappings":";;AAAA,SAASA,eAAe,QAAQ,iCAA8B;AAC9D,SAASC,eAAe,QAAQ,iCAA8B;AAC9D,SAASC,oBAAoB,QAAQ,sCAAmC;AACxE,SAASC,SAAS,QAAQ,qBAAkB;AAE5C,SAASC,OAAO,QAAQ,mBAAgB;AAExC,SAASC,MAAM,QAAQ,kBAAe;AAEtC,SAASC,SAAS,QAAQ,qBAAkB;AAE5C,SAASC,WAAW,QAAQ,kBAAe;AA0B3C,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,wBAAqB;AACzE,SAASC,iBAAiB,EAAEC,YAAY,QAAQ,oBAAiB;AAEjE,SAASC,mBAAmB,EAAEC,UAAU,EAAEC,gBAAgB,EAAEC,WAAW,QAAQ,kBAAe;AAC9F,SAASC,SAAS,EAAEC,aAAa,EAAEC,WAAW,QAAQ,uBAAoB;AAE1E,SAASC,YAAY,QAAQ,0BAAuB;AACpD,SAASC,SAAS,QAAQ,uBAAuB","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The outbox store on `expo-sqlite` for phones. Import from `@ovok/native/next/bluetooth/sqlite`.
|
|
5
|
+
* It has its own subpath so apps without `expo-sqlite`, and browser bundles, never load it.
|
|
6
|
+
*
|
|
7
|
+
* @module next/bluetooth/sqlite
|
|
8
|
+
*/
|
|
9
|
+
export { SqliteOutboxStore } from "../adapters/sqlite-outbox-store.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SqliteOutboxStore"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/sqlite/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,iBAAiB,QAAQ,oCAAiC","ignoreList":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { ovokOutboxWatch } from "../adapters/ovok-outbox-watch.js";
|
|
3
4
|
import { ovokReadingSink } from "../adapters/ovok-reading-sink.js";
|
|
4
5
|
import { storagePairedDevices } from "../adapters/storage-paired-devices.js";
|
|
5
6
|
import { webBluetoothCentral } from "../adapters/web-bluetooth-central.js";
|
|
@@ -25,6 +26,7 @@ const createWebBluetooth = ({
|
|
|
25
26
|
central: webBluetoothCentral(browserBluetooth()),
|
|
26
27
|
store: storagePairedDevices(storage),
|
|
27
28
|
sink: ovokReadingSink(ovok),
|
|
29
|
+
outbox: ovokOutboxWatch(ovok.outbox, overrides.logger),
|
|
28
30
|
permissions: chooserPermissions,
|
|
29
31
|
models: BUILT_IN_MODELS,
|
|
30
32
|
protocols: BUILT_IN_PROTOCOLS,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ovokReadingSink","storagePairedDevices","webBluetoothCentral","Bluetooth","BUILT_IN_MODELS","BUILT_IN_PROTOCOLS","chooserPermissions","check","request","openSettings","undefined","browserBluetooth","globalThis","navigator","bluetooth","createWebBluetooth","ovok","storage","overrides","central","store","sink","permissions","models","protocols","autoSync"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/web/create-web-bluetooth.ts"],"mappings":";;AAEA,SAASA,eAAe,QAAQ,kCAA+B;AAC/D,SAASC,oBAAoB,QAAQ,uCAAoC;AACzE,SAAuBC,mBAAmB,QAAQ,sCAAmC;AACrF,SAASC,SAAS,QAA0B,sBAAmB;AAE/D,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,yBAAsB;;AAE1E;;AAUA;AACA,MAAMC,kBAAwC,GAAG;EAC/CC,KAAK,EAAE,MAAAA,CAAA,KAAY,SAAS;EAC5BC,OAAO,EAAE,MAAAA,CAAA,KAAY,SAAS;EAC9BC,YAAY,EAAE,MAAAA,CAAA,KAAYC;AAC5B,CAAC;AAED,MAAMC,gBAAgB,GAAGA,CAAA,KACtBC,UAAU,CAAkDC,SAAS,EAAEC,SAAS;;AAEnF;AACA,MAAMC,kBAAkB,GAAGA,CAAC;EAAEC,IAAI;EAAEC,OAAO;EAAE,GAAGC;AAAqC,CAAC,KACpF,IAAIf,SAAS,CAAC;EACZgB,OAAO,EAAEjB,mBAAmB,CAACS,gBAAgB,CAAC,CAAC,CAAC;EAChDS,KAAK,EAAEnB,oBAAoB,CAACgB,OAAO,CAAC;EACpCI,IAAI,EAAErB,eAAe,CAACgB,IAAI,CAAC;EAC3BM,WAAW,
|
|
1
|
+
{"version":3,"names":["ovokOutboxWatch","ovokReadingSink","storagePairedDevices","webBluetoothCentral","Bluetooth","BUILT_IN_MODELS","BUILT_IN_PROTOCOLS","chooserPermissions","check","request","openSettings","undefined","browserBluetooth","globalThis","navigator","bluetooth","createWebBluetooth","ovok","storage","overrides","central","store","sink","outbox","logger","permissions","models","protocols","autoSync"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/web/create-web-bluetooth.ts"],"mappings":";;AAEA,SAASA,eAAe,QAAQ,kCAA+B;AAC/D,SAAyBC,eAAe,QAAQ,kCAA+B;AAC/E,SAASC,oBAAoB,QAAQ,uCAAoC;AACzE,SAAuBC,mBAAmB,QAAQ,sCAAmC;AACrF,SAASC,SAAS,QAA0B,sBAAmB;AAE/D,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,yBAAsB;;AAE1E;;AAUA;AACA,MAAMC,kBAAwC,GAAG;EAC/CC,KAAK,EAAE,MAAAA,CAAA,KAAY,SAAS;EAC5BC,OAAO,EAAE,MAAAA,CAAA,KAAY,SAAS;EAC9BC,YAAY,EAAE,MAAAA,CAAA,KAAYC;AAC5B,CAAC;AAED,MAAMC,gBAAgB,GAAGA,CAAA,KACtBC,UAAU,CAAkDC,SAAS,EAAEC,SAAS;;AAEnF;AACA,MAAMC,kBAAkB,GAAGA,CAAC;EAAEC,IAAI;EAAEC,OAAO;EAAE,GAAGC;AAAqC,CAAC,KACpF,IAAIf,SAAS,CAAC;EACZgB,OAAO,EAAEjB,mBAAmB,CAACS,gBAAgB,CAAC,CAAC,CAAC;EAChDS,KAAK,EAAEnB,oBAAoB,CAACgB,OAAO,CAAC;EACpCI,IAAI,EAAErB,eAAe,CAACgB,IAAI,CAAC;EAC3BM,MAAM,EAAEvB,eAAe,CAACiB,IAAI,CAACM,MAAM,EAAEJ,SAAS,CAACK,MAAM,CAAC;EACtDC,WAAW,EAAElB,kBAAkB;EAC/BmB,MAAM,EAAErB,eAAe;EACvBsB,SAAS,EAAErB,kBAAkB;EAC7BsB,QAAQ,EAAE,KAAK;EACf,GAAGT;AACL,CAAC,CAAC;AAEJ,SAASH,kBAAkB","ignoreList":[]}
|
package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/android-foreground-service.d.ts
CHANGED
|
@@ -1,13 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OutboxWatch } from "../core/outbox-watch";
|
|
2
|
+
import { KeepAlive, Logger } from "../core/ports";
|
|
2
3
|
/** The notification Android shows while the service runs. */
|
|
3
4
|
type ForegroundServiceText = {
|
|
4
5
|
/** The notification's title. */
|
|
5
6
|
notificationTitle?: string;
|
|
6
7
|
/** The notification's body. */
|
|
7
8
|
notificationBody?: string;
|
|
9
|
+
/** The body while readings wait to upload, given how many; "3 readings waiting to upload" by default. */
|
|
10
|
+
unsentBody?: (unsent: number) => string;
|
|
8
11
|
};
|
|
9
|
-
/**
|
|
10
|
-
|
|
12
|
+
/** What the service watches and reports besides its text. */
|
|
13
|
+
type ForegroundServiceOptions = {
|
|
14
|
+
/** The offline queue whose waiting readings the notification counts; with none, it never shows a count. */
|
|
15
|
+
outbox?: OutboxWatch;
|
|
16
|
+
/** Where structured events go; silent by default. */
|
|
17
|
+
logger?: Logger;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Android's connected-device foreground service, which keeps the process alive for background sync; nothing elsewhere.
|
|
21
|
+
* With an `outbox`, its notification says how many readings wait to upload.
|
|
22
|
+
*/
|
|
23
|
+
declare const androidForegroundService: (text?: ForegroundServiceText, { outbox, logger }?: ForegroundServiceOptions) => KeepAlive;
|
|
11
24
|
export { androidForegroundService };
|
|
12
|
-
export type { ForegroundServiceText };
|
|
25
|
+
export type { ForegroundServiceOptions, ForegroundServiceText };
|
|
13
26
|
//# sourceMappingURL=android-foreground-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"android-foreground-service.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/android-foreground-service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"android-foreground-service.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/android-foreground-service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,EAA6B,MAAM,eAAe,CAAC;AAE7E,6DAA6D;AAC7D,KAAK,qBAAqB,GAAG;IAE3B,gCAAgC;IAChC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,+BAA+B;IAC/B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,yGAAyG;IACzG,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CACzC,CAAC;AAEF,6DAA6D;AAC7D,KAAK,wBAAwB,GAAG;IAE9B,2GAA2G;IAC3G,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AA+DF;;;GAGG;AACH,QAAA,MAAM,wBAAwB,GAC5B,OAAM,qBAA0B,EAChC,qBAAmD,wBAA6B,KAC/E,SAA2G,CAAC;AAE/G,OAAO,EAAE,wBAAwB,EAAE,CAAC;AACpC,YAAY,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { EcgMeasurement } from "@ovok/core/next";
|
|
2
|
+
import { Reading } from "../core/reading";
|
|
3
|
+
/** One ECG recording per channel, each in millivolts at the waveform's sample rate; the heart rate goes with the first. */
|
|
4
|
+
declare const ecgMeasurements: (reading: Reading) => EcgMeasurement[];
|
|
5
|
+
export { ecgMeasurements };
|
|
6
|
+
//# sourceMappingURL=ecg-measurements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ecg-measurements.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/adapters/ecg-measurements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAsB,MAAM,iBAAiB,CAAC;AAErE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAO1C,2HAA2H;AAC3H,QAAA,MAAM,eAAe,GAAI,SAAS,OAAO,KAAG,cAAc,EAWzD,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC"}
|