@ovok/native 1.16.1-rc.3 → 1.16.1-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/modules/bt-management/components/android-bluetooth-foreground-service.js +3 -1
- package/lib/commonjs/modules/bt-management/components/android-bluetooth-foreground-service.js.map +1 -1
- package/lib/commonjs/modules/bt-management/components/bluetooth-device-picker.js +9 -141
- package/lib/commonjs/modules/bt-management/components/bluetooth-device-picker.js.map +1 -1
- package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.js +1 -0
- package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
- package/lib/commonjs/modules/bt-management/components/device-picker-sheet.js +160 -0
- package/lib/commonjs/modules/bt-management/components/device-picker-sheet.js.map +1 -0
- package/lib/commonjs/modules/bt-management/hooks/runtime-context.js.map +1 -1
- package/lib/commonjs/modules/bt-management/hooks/use-bluetooth-permission.js +2 -1
- package/lib/commonjs/modules/bt-management/hooks/use-bluetooth-permission.js.map +1 -1
- package/lib/commonjs/modules/bt-management/hooks/use-measurements.js +1 -1
- package/lib/commonjs/modules/bt-management/hooks/use-measurements.js.map +1 -1
- package/lib/commonjs/modules/bt-management/index.js +12 -0
- package/lib/commonjs/modules/bt-management/index.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/bt-manager.js +50 -0
- package/lib/commonjs/modules/bt-management/services/bt-manager.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/custom/define-custom-device.js +3 -0
- package/lib/commonjs/modules/bt-management/services/custom/define-custom-device.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js +4 -2
- package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-connection-handler.js +97 -28
- package/lib/commonjs/modules/bt-management/services/devices/bt-connection-handler.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-current-time.js +59 -0
- package/lib/commonjs/modules/bt-management/services/devices/bt-current-time.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/bt-device-information.js +18 -37
- package/lib/commonjs/modules/bt-management/services/devices/bt-device-information.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js +31 -3
- package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-notification-readiness.js +68 -0
- package/lib/commonjs/modules/bt-management/services/devices/bt-notification-readiness.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/bt-pairing-retry.js +70 -0
- package/lib/commonjs/modules/bt-management/services/devices/bt-pairing-retry.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js +14 -0
- package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.blood-pressure-status.js +4 -7
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.blood-pressure-status.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.decorators.js +106 -0
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.decorators.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js +38 -31
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.js +41 -0
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-details.js +77 -0
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-details.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-frame.js +49 -0
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-frame.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-racp.js +89 -0
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-racp.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose.js +35 -42
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js +22 -24
- package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/record-cursor.js +70 -0
- package/lib/commonjs/modules/bt-management/services/record-cursor.js.map +1 -0
- package/lib/commonjs/modules/bt-management/testing/fake-ble-manager.js +8 -0
- package/lib/commonjs/modules/bt-management/testing/fake-ble-manager.js.map +1 -1
- package/lib/commonjs/modules/bt-management/types/glucose-record-details.js +2 -0
- package/lib/commonjs/modules/bt-management/types/glucose-record-details.js.map +1 -0
- package/lib/commonjs/modules/bt-management/utils/bluetooth-permission-list.js +19 -0
- package/lib/commonjs/modules/bt-management/utils/bluetooth-permission-list.js.map +1 -0
- package/lib/commonjs/modules/bt-management/utils/device-user.js +22 -0
- package/lib/commonjs/modules/bt-management/utils/device-user.js.map +1 -0
- package/lib/commonjs/modules/bt-management/utils/kpa-to-mmhg.js +9 -0
- package/lib/commonjs/modules/bt-management/utils/kpa-to-mmhg.js.map +1 -0
- package/lib/commonjs/modules/bt-management/utils/result-identity.js +26 -35
- package/lib/commonjs/modules/bt-management/utils/result-identity.js.map +1 -1
- package/lib/commonjs/modules/bt-management/utils/rr-interval.js +16 -0
- package/lib/commonjs/modules/bt-management/utils/rr-interval.js.map +1 -0
- package/lib/commonjs/modules/bt-management/utils/temperature-type.js +15 -0
- package/lib/commonjs/modules/bt-management/utils/temperature-type.js.map +1 -0
- package/lib/commonjs/modules/bt-management/utils/wait.js +10 -0
- package/lib/commonjs/modules/bt-management/utils/wait.js.map +1 -0
- package/lib/commonjs/modules/next/background-sync/index.js +28 -0
- package/lib/commonjs/modules/next/background-sync/index.js.map +1 -0
- package/lib/commonjs/modules/next/background-sync/offline-measurement-background-sync.js +63 -0
- package/lib/commonjs/modules/next/background-sync/offline-measurement-background-sync.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/auto-connect.js +32 -0
- package/lib/commonjs/modules/next/bluetooth/auto-connect.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/ble-plx/ble-errors.js +33 -0
- package/lib/commonjs/modules/next/bluetooth/ble-plx/ble-errors.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/ble-plx/ble-link.js +162 -0
- package/lib/commonjs/modules/next/bluetooth/ble-plx/ble-link.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/ble-plx/ble-scanner.js +75 -0
- package/lib/commonjs/modules/next/bluetooth/ble-plx/ble-scanner.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/ble-plx/built-in-devices.js +34 -0
- package/lib/commonjs/modules/next/bluetooth/ble-plx/built-in-devices.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/ble-plx/legacy-driver.js +67 -0
- package/lib/commonjs/modules/next/bluetooth/ble-plx/legacy-driver.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/connections.js +114 -0
- package/lib/commonjs/modules/next/bluetooth/connections.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/daily-total-day.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/devices.js +41 -0
- package/lib/commonjs/modules/next/bluetooth/devices.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/driver.js +30 -20
- package/lib/commonjs/modules/next/bluetooth/driver.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/errors.js +26 -0
- package/lib/commonjs/modules/next/bluetooth/errors.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/index.js +122 -11
- package/lib/commonjs/modules/next/bluetooth/index.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/link.js +0 -103
- package/lib/commonjs/modules/next/bluetooth/link.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/paired.js +50 -0
- package/lib/commonjs/modules/next/bluetooth/paired.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/permissions.js +2 -0
- package/lib/commonjs/modules/next/bluetooth/permissions.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/react/bluetooth-device-picker.js +44 -0
- package/lib/commonjs/modules/next/bluetooth/react/bluetooth-device-picker.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/react/context.js +54 -0
- package/lib/commonjs/modules/next/bluetooth/react/context.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/react/hooks.js +86 -0
- package/lib/commonjs/modules/next/bluetooth/react/hooks.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/react-native/create-bluetooth-runtime.js +28 -0
- package/lib/commonjs/modules/next/bluetooth/react-native/create-bluetooth-runtime.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/react-native/os-permissions.js +32 -0
- package/lib/commonjs/modules/next/bluetooth/react-native/os-permissions.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/react-native/ovok-sink.js +43 -0
- package/lib/commonjs/modules/next/bluetooth/react-native/ovok-sink.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/readings.js +93 -0
- package/lib/commonjs/modules/next/bluetooth/readings.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/result-policy.js +15 -2
- package/lib/commonjs/modules/next/bluetooth/result-policy.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/runtime.js +223 -0
- package/lib/commonjs/modules/next/bluetooth/runtime.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/scan-loop.js +82 -0
- package/lib/commonjs/modules/next/bluetooth/scan-loop.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/sig-profiles.js +46 -13
- package/lib/commonjs/modules/next/bluetooth/sig-profiles.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/sink.js +6 -0
- package/lib/commonjs/modules/next/bluetooth/sink.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/snapshot.js +6 -0
- package/lib/commonjs/modules/next/bluetooth/snapshot.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/stable-hash.js +42 -0
- package/lib/commonjs/modules/next/bluetooth/stable-hash.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/store.js +61 -0
- package/lib/commonjs/modules/next/bluetooth/store.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/transport.js +6 -0
- package/lib/commonjs/modules/next/bluetooth/transport.js.map +1 -0
- package/lib/commonjs/modules/next/data-sync/index.js +17 -0
- package/lib/commonjs/modules/next/data-sync/index.js.map +1 -0
- package/lib/module/modules/bt-management/components/android-bluetooth-foreground-service.js +3 -1
- package/lib/module/modules/bt-management/components/android-bluetooth-foreground-service.js.map +1 -1
- package/lib/module/modules/bt-management/components/bluetooth-device-picker.js +9 -141
- package/lib/module/modules/bt-management/components/bluetooth-device-picker.js.map +1 -1
- package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js +1 -0
- package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
- package/lib/module/modules/bt-management/components/device-picker-sheet.js +154 -0
- package/lib/module/modules/bt-management/components/device-picker-sheet.js.map +1 -0
- package/lib/module/modules/bt-management/hooks/runtime-context.js.map +1 -1
- package/lib/module/modules/bt-management/hooks/use-bluetooth-permission.js +4 -3
- package/lib/module/modules/bt-management/hooks/use-bluetooth-permission.js.map +1 -1
- package/lib/module/modules/bt-management/hooks/use-measurements.js +1 -1
- package/lib/module/modules/bt-management/hooks/use-measurements.js.map +1 -1
- package/lib/module/modules/bt-management/index.js +1 -0
- package/lib/module/modules/bt-management/index.js.map +1 -1
- package/lib/module/modules/bt-management/services/bt-manager.js +50 -0
- package/lib/module/modules/bt-management/services/bt-manager.js.map +1 -1
- package/lib/module/modules/bt-management/services/custom/define-custom-device.js +3 -0
- package/lib/module/modules/bt-management/services/custom/define-custom-device.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-command-writer.js +4 -2
- package/lib/module/modules/bt-management/services/devices/bt-command-writer.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-connection-handler.js +97 -28
- package/lib/module/modules/bt-management/services/devices/bt-connection-handler.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-current-time.js +55 -0
- package/lib/module/modules/bt-management/services/devices/bt-current-time.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/bt-device-information.js +18 -37
- package/lib/module/modules/bt-management/services/devices/bt-device-information.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-managed-device.js +33 -5
- package/lib/module/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-notification-readiness.js +65 -0
- package/lib/module/modules/bt-management/services/devices/bt-notification-readiness.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/bt-pairing-retry.js +65 -0
- package/lib/module/modules/bt-management/services/devices/bt-pairing-retry.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/custom/custom.device.js +14 -0
- package/lib/module/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.blood-pressure-status.js +1 -4
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.blood-pressure-status.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.decorators.js +99 -0
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.decorators.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js +38 -31
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.js +35 -0
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-details.js +72 -0
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-details.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-frame.js +40 -0
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-frame.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-racp.js +85 -0
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-racp.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose.js +25 -32
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js +18 -20
- package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js.map +1 -1
- package/lib/module/modules/bt-management/services/record-cursor.js +66 -0
- package/lib/module/modules/bt-management/services/record-cursor.js.map +1 -0
- package/lib/module/modules/bt-management/testing/fake-ble-manager.js +8 -0
- package/lib/module/modules/bt-management/testing/fake-ble-manager.js.map +1 -1
- package/lib/module/modules/bt-management/types/custom-device-definition.js +4 -0
- package/lib/module/modules/bt-management/types/custom-device-definition.js.map +1 -1
- package/lib/module/modules/bt-management/types/glucose-record-details.js +2 -0
- package/lib/module/modules/bt-management/types/glucose-record-details.js.map +1 -0
- package/lib/module/modules/bt-management/utils/bluetooth-permission-list.js +14 -0
- package/lib/module/modules/bt-management/utils/bluetooth-permission-list.js.map +1 -0
- package/lib/module/modules/bt-management/utils/device-user.js +17 -0
- package/lib/module/modules/bt-management/utils/device-user.js.map +1 -0
- package/lib/module/modules/bt-management/utils/kpa-to-mmhg.js +6 -0
- package/lib/module/modules/bt-management/utils/kpa-to-mmhg.js.map +1 -0
- package/lib/module/modules/bt-management/utils/result-identity.js +23 -33
- package/lib/module/modules/bt-management/utils/result-identity.js.map +1 -1
- package/lib/module/modules/bt-management/utils/rr-interval.js +12 -0
- package/lib/module/modules/bt-management/utils/rr-interval.js.map +1 -0
- package/lib/module/modules/bt-management/utils/temperature-type.js +11 -0
- package/lib/module/modules/bt-management/utils/temperature-type.js.map +1 -0
- package/lib/module/modules/bt-management/utils/wait.js +5 -0
- package/lib/module/modules/bt-management/utils/wait.js.map +1 -0
- package/lib/module/modules/next/background-sync/index.js +12 -0
- package/lib/module/modules/next/background-sync/index.js.map +1 -0
- package/lib/module/modules/next/background-sync/offline-measurement-background-sync.js +55 -0
- package/lib/module/modules/next/background-sync/offline-measurement-background-sync.js.map +1 -0
- package/lib/module/modules/next/bluetooth/auto-connect.js +28 -0
- package/lib/module/modules/next/bluetooth/auto-connect.js.map +1 -0
- package/lib/module/modules/next/bluetooth/ble-plx/ble-errors.js +28 -0
- package/lib/module/modules/next/bluetooth/ble-plx/ble-errors.js.map +1 -0
- package/lib/module/modules/next/bluetooth/ble-plx/ble-link.js +159 -0
- package/lib/module/modules/next/bluetooth/ble-plx/ble-link.js.map +1 -0
- package/lib/module/modules/next/bluetooth/ble-plx/ble-scanner.js +69 -0
- package/lib/module/modules/next/bluetooth/ble-plx/ble-scanner.js.map +1 -0
- package/lib/module/modules/next/bluetooth/ble-plx/built-in-devices.js +31 -0
- package/lib/module/modules/next/bluetooth/ble-plx/built-in-devices.js.map +1 -0
- package/lib/module/modules/next/bluetooth/ble-plx/legacy-driver.js +63 -0
- package/lib/module/modules/next/bluetooth/ble-plx/legacy-driver.js.map +1 -0
- package/lib/module/modules/next/bluetooth/connections.js +110 -0
- package/lib/module/modules/next/bluetooth/connections.js.map +1 -0
- package/lib/module/modules/next/bluetooth/daily-total-day.js.map +1 -0
- package/lib/module/modules/next/bluetooth/devices.js +37 -0
- package/lib/module/modules/next/bluetooth/devices.js.map +1 -0
- package/lib/module/modules/next/bluetooth/driver.js +29 -20
- package/lib/module/modules/next/bluetooth/driver.js.map +1 -1
- package/lib/module/modules/next/bluetooth/errors.js +21 -0
- package/lib/module/modules/next/bluetooth/errors.js.map +1 -0
- package/lib/module/modules/next/bluetooth/index.js +22 -4
- package/lib/module/modules/next/bluetooth/index.js.map +1 -1
- package/lib/module/modules/next/bluetooth/link.js +0 -101
- package/lib/module/modules/next/bluetooth/link.js.map +1 -1
- package/lib/module/modules/next/bluetooth/paired.js +46 -0
- package/lib/module/modules/next/bluetooth/paired.js.map +1 -0
- package/lib/module/modules/next/bluetooth/permissions.js +2 -0
- package/lib/module/modules/next/bluetooth/permissions.js.map +1 -0
- package/lib/module/modules/next/bluetooth/react/bluetooth-device-picker.js +39 -0
- package/lib/module/modules/next/bluetooth/react/bluetooth-device-picker.js.map +1 -0
- package/lib/module/modules/next/bluetooth/react/context.js +48 -0
- package/lib/module/modules/next/bluetooth/react/context.js.map +1 -0
- package/lib/module/modules/next/bluetooth/react/hooks.js +76 -0
- package/lib/module/modules/next/bluetooth/react/hooks.js.map +1 -0
- package/lib/module/modules/next/bluetooth/react-native/create-bluetooth-runtime.js +25 -0
- package/lib/module/modules/next/bluetooth/react-native/create-bluetooth-runtime.js.map +1 -0
- package/lib/module/modules/next/bluetooth/react-native/os-permissions.js +28 -0
- package/lib/module/modules/next/bluetooth/react-native/os-permissions.js.map +1 -0
- package/lib/module/modules/next/bluetooth/react-native/ovok-sink.js +39 -0
- package/lib/module/modules/next/bluetooth/react-native/ovok-sink.js.map +1 -0
- package/lib/module/modules/next/bluetooth/readings.js +89 -0
- package/lib/module/modules/next/bluetooth/readings.js.map +1 -0
- package/lib/module/modules/next/bluetooth/result-policy.js +14 -2
- package/lib/module/modules/next/bluetooth/result-policy.js.map +1 -1
- package/lib/module/modules/next/bluetooth/runtime.js +220 -0
- package/lib/module/modules/next/bluetooth/runtime.js.map +1 -0
- package/lib/module/modules/next/bluetooth/scan-loop.js +78 -0
- package/lib/module/modules/next/bluetooth/scan-loop.js.map +1 -0
- package/lib/module/modules/next/bluetooth/sig-profiles.js +44 -11
- package/lib/module/modules/next/bluetooth/sig-profiles.js.map +1 -1
- package/lib/module/modules/next/bluetooth/sink.js +4 -0
- package/lib/module/modules/next/bluetooth/sink.js.map +1 -0
- package/lib/module/modules/next/bluetooth/snapshot.js +4 -0
- package/lib/module/modules/next/bluetooth/snapshot.js.map +1 -0
- package/lib/module/modules/next/bluetooth/stable-hash.js +37 -0
- package/lib/module/modules/next/bluetooth/stable-hash.js.map +1 -0
- package/lib/module/modules/next/bluetooth/store.js +57 -0
- package/lib/module/modules/next/bluetooth/store.js.map +1 -0
- package/lib/module/modules/next/bluetooth/transport.js +4 -0
- package/lib/module/modules/next/bluetooth/transport.js.map +1 -0
- package/lib/module/modules/next/data-sync/index.js +11 -0
- package/lib/module/modules/next/data-sync/index.js.map +1 -0
- package/lib/typescript/commonjs/src/modules/auth/hooks/use-sign-in.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/components/android-bluetooth-foreground-service.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/components/bluetooth-device-picker.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/components/bluetooth-device-picker.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/components/device-picker-sheet.d.ts +25 -0
- package/lib/typescript/commonjs/src/modules/bt-management/components/device-picker-sheet.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/runtime-context.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/runtime-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-bluetooth-permission.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-measurements.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts +20 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/custom/define-custom-device.d.ts +2 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/custom/define-custom-device.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-command-writer.d.ts +3 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-command-writer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-connection-handler.d.ts +14 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-connection-handler.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-current-time.d.ts +11 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-current-time.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-device-information.d.ts +2 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-device-information.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts +11 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-notification-readiness.d.ts +15 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-notification-readiness.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-pairing-retry.d.ts +21 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-pairing-retry.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.blood-pressure-status.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.decorators.d.ts +11 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.decorators.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts +5 -2
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.d.ts +10 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-details.d.ts +7 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-details.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-frame.d.ts +16 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-frame.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-racp.d.ts +8 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-racp.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/record-cursor.d.ts +21 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/record-cursor.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/testing/fake-ble-manager.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/command-sequencer.d.ts +6 -2
- package/lib/typescript/commonjs/src/modules/bt-management/types/command-sequencer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/create-device-params.d.ts +3 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/create-device-params.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-device-definition.d.ts +14 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/custom-device-definition.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/glucose-record-details.d.ts +33 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/glucose-record-details.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/result-callback.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/result-callback.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/result-policy.d.ts +6 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/result-policy.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/utils/bluetooth-permission-list.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/bluetooth-permission-list.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/device-user.d.ts +6 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/device-user.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/kpa-to-mmhg.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/kpa-to-mmhg.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/result-identity.d.ts +5 -4
- package/lib/typescript/commonjs/src/modules/bt-management/utils/result-identity.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/utils/rr-interval.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/rr-interval.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/temperature-type.d.ts +7 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/temperature-type.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/wait.d.ts +3 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/wait.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/data-sync/services/managers/sync-progress-manager.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/next/background-sync/index.d.ts +10 -0
- package/lib/typescript/commonjs/src/modules/next/background-sync/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/background-sync/offline-measurement-background-sync.d.ts +22 -0
- package/lib/typescript/commonjs/src/modules/next/background-sync/offline-measurement-background-sync.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/auto-connect.d.ts +10 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/auto-connect.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/ble-errors.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/ble-errors.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/ble-link.d.ts +6 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/ble-link.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/ble-scanner.d.ts +10 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/ble-scanner.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts +6 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts +8 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/connections.d.ts +25 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/connections.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/daily-total-day.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/devices.d.ts +30 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/devices.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/driver.d.ts +27 -20
- package/lib/typescript/commonjs/src/modules/next/bluetooth/driver.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/errors.d.ts +17 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/errors.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts +34 -5
- package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/link.d.ts +14 -5
- package/lib/typescript/commonjs/src/modules/next/bluetooth/link.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/paired.d.ts +18 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/paired.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/permissions.d.ts +13 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/permissions.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/react/bluetooth-device-picker.d.ts +35 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/react/bluetooth-device-picker.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/react/context.d.ts +30 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/react/context.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/react/hooks.d.ts +47 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/react/hooks.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/react-native/create-bluetooth-runtime.d.ts +21 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/react-native/create-bluetooth-runtime.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/react-native/os-permissions.d.ts +5 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/react-native/os-permissions.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/react-native/ovok-sink.d.ts +6 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/react-native/ovok-sink.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/readings.d.ts +21 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/readings.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/result-policy.d.ts +9 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/result-policy.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/runtime.d.ts +87 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/runtime.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/scan-loop.d.ts +23 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/scan-loop.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/sig-profiles.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/sink.d.ts +20 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/sink.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/snapshot.d.ts +72 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/snapshot.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/stable-hash.d.ts +6 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/stable-hash.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/store.d.ts +16 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/store.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/transport.d.ts +31 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/transport.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/data-sync/index.d.ts +9 -0
- package/lib/typescript/commonjs/src/modules/next/data-sync/index.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/auth/hooks/use-sign-in.d.ts +1 -1
- package/lib/typescript/module/src/modules/bt-management/components/android-bluetooth-foreground-service.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/components/bluetooth-device-picker.d.ts +1 -1
- package/lib/typescript/module/src/modules/bt-management/components/bluetooth-device-picker.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/components/device-picker-sheet.d.ts +25 -0
- package/lib/typescript/module/src/modules/bt-management/components/device-picker-sheet.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/hooks/runtime-context.d.ts +1 -1
- package/lib/typescript/module/src/modules/bt-management/hooks/runtime-context.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/hooks/use-bluetooth-permission.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/hooks/use-measurements.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/index.d.ts +1 -0
- package/lib/typescript/module/src/modules/bt-management/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts +20 -0
- package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/custom/define-custom-device.d.ts +2 -1
- package/lib/typescript/module/src/modules/bt-management/services/custom/define-custom-device.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-command-writer.d.ts +3 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-command-writer.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-connection-handler.d.ts +14 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-connection-handler.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-current-time.d.ts +11 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-current-time.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-device-information.d.ts +2 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-device-information.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts +11 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-notification-readiness.d.ts +15 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-notification-readiness.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-pairing-retry.d.ts +21 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-pairing-retry.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts +2 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.blood-pressure-status.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.decorators.d.ts +11 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.decorators.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts +5 -2
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.d.ts +10 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.frame.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-details.d.ts +7 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-details.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-frame.d.ts +16 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-frame.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-racp.d.ts +8 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose-racp.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts +2 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/record-cursor.d.ts +21 -0
- package/lib/typescript/module/src/modules/bt-management/services/record-cursor.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/testing/fake-ble-manager.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/command-sequencer.d.ts +6 -2
- package/lib/typescript/module/src/modules/bt-management/types/command-sequencer.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/create-device-params.d.ts +3 -0
- package/lib/typescript/module/src/modules/bt-management/types/create-device-params.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/custom-device-definition.d.ts +14 -1
- package/lib/typescript/module/src/modules/bt-management/types/custom-device-definition.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/glucose-record-details.d.ts +33 -0
- package/lib/typescript/module/src/modules/bt-management/types/glucose-record-details.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/types/result-callback.d.ts +2 -0
- package/lib/typescript/module/src/modules/bt-management/types/result-callback.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/result-policy.d.ts +6 -0
- package/lib/typescript/module/src/modules/bt-management/types/result-policy.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/utils/bluetooth-permission-list.d.ts +4 -0
- package/lib/typescript/module/src/modules/bt-management/utils/bluetooth-permission-list.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/utils/device-user.d.ts +6 -0
- package/lib/typescript/module/src/modules/bt-management/utils/device-user.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/utils/kpa-to-mmhg.d.ts +4 -0
- package/lib/typescript/module/src/modules/bt-management/utils/kpa-to-mmhg.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/utils/result-identity.d.ts +5 -4
- package/lib/typescript/module/src/modules/bt-management/utils/result-identity.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/utils/rr-interval.d.ts +4 -0
- package/lib/typescript/module/src/modules/bt-management/utils/rr-interval.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/utils/temperature-type.d.ts +7 -0
- package/lib/typescript/module/src/modules/bt-management/utils/temperature-type.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/utils/wait.d.ts +3 -0
- package/lib/typescript/module/src/modules/bt-management/utils/wait.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/data-sync/services/managers/sync-progress-manager.d.ts +1 -1
- package/lib/typescript/module/src/modules/next/background-sync/index.d.ts +10 -0
- package/lib/typescript/module/src/modules/next/background-sync/index.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/background-sync/offline-measurement-background-sync.d.ts +22 -0
- package/lib/typescript/module/src/modules/next/background-sync/offline-measurement-background-sync.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/auto-connect.d.ts +10 -0
- package/lib/typescript/module/src/modules/next/bluetooth/auto-connect.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/ble-errors.d.ts +4 -0
- package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/ble-errors.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/ble-link.d.ts +6 -0
- package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/ble-link.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/ble-scanner.d.ts +10 -0
- package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/ble-scanner.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts +6 -0
- package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts +8 -0
- package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/connections.d.ts +25 -0
- package/lib/typescript/module/src/modules/next/bluetooth/connections.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/daily-total-day.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/devices.d.ts +30 -0
- package/lib/typescript/module/src/modules/next/bluetooth/devices.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/driver.d.ts +27 -20
- package/lib/typescript/module/src/modules/next/bluetooth/driver.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/errors.d.ts +17 -0
- package/lib/typescript/module/src/modules/next/bluetooth/errors.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts +34 -5
- package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/link.d.ts +14 -5
- package/lib/typescript/module/src/modules/next/bluetooth/link.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/paired.d.ts +18 -0
- package/lib/typescript/module/src/modules/next/bluetooth/paired.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/permissions.d.ts +13 -0
- package/lib/typescript/module/src/modules/next/bluetooth/permissions.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/react/bluetooth-device-picker.d.ts +35 -0
- package/lib/typescript/module/src/modules/next/bluetooth/react/bluetooth-device-picker.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/react/context.d.ts +30 -0
- package/lib/typescript/module/src/modules/next/bluetooth/react/context.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/react/hooks.d.ts +47 -0
- package/lib/typescript/module/src/modules/next/bluetooth/react/hooks.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/react-native/create-bluetooth-runtime.d.ts +21 -0
- package/lib/typescript/module/src/modules/next/bluetooth/react-native/create-bluetooth-runtime.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/react-native/os-permissions.d.ts +5 -0
- package/lib/typescript/module/src/modules/next/bluetooth/react-native/os-permissions.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/react-native/ovok-sink.d.ts +6 -0
- package/lib/typescript/module/src/modules/next/bluetooth/react-native/ovok-sink.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/readings.d.ts +21 -0
- package/lib/typescript/module/src/modules/next/bluetooth/readings.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/result-policy.d.ts +9 -1
- package/lib/typescript/module/src/modules/next/bluetooth/result-policy.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/runtime.d.ts +87 -0
- package/lib/typescript/module/src/modules/next/bluetooth/runtime.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/scan-loop.d.ts +23 -0
- package/lib/typescript/module/src/modules/next/bluetooth/scan-loop.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/sig-profiles.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/sink.d.ts +20 -0
- package/lib/typescript/module/src/modules/next/bluetooth/sink.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/snapshot.d.ts +72 -0
- package/lib/typescript/module/src/modules/next/bluetooth/snapshot.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/stable-hash.d.ts +6 -0
- package/lib/typescript/module/src/modules/next/bluetooth/stable-hash.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/store.d.ts +16 -0
- package/lib/typescript/module/src/modules/next/bluetooth/store.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/transport.d.ts +31 -0
- package/lib/typescript/module/src/modules/next/bluetooth/transport.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/data-sync/index.d.ts +9 -0
- package/lib/typescript/module/src/modules/next/data-sync/index.d.ts.map +1 -0
- package/package.json +12 -2
- package/lib/commonjs/modules/bt-management/utils/daily-total-day.js.map +0 -1
- package/lib/commonjs/modules/next/bluetooth/drivers.js +0 -20
- package/lib/commonjs/modules/next/bluetooth/drivers.js.map +0 -1
- package/lib/commonjs/modules/next/bluetooth/legacy-driver.js +0 -55
- package/lib/commonjs/modules/next/bluetooth/legacy-driver.js.map +0 -1
- package/lib/module/modules/bt-management/utils/daily-total-day.js.map +0 -1
- package/lib/module/modules/next/bluetooth/drivers.js +0 -17
- package/lib/module/modules/next/bluetooth/drivers.js.map +0 -1
- package/lib/module/modules/next/bluetooth/legacy-driver.js +0 -51
- package/lib/module/modules/next/bluetooth/legacy-driver.js.map +0 -1
- package/lib/typescript/commonjs/src/modules/bt-management/utils/daily-total-day.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/drivers.d.ts +0 -7
- package/lib/typescript/commonjs/src/modules/next/bluetooth/drivers.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/legacy-driver.d.ts +0 -8
- package/lib/typescript/commonjs/src/modules/next/bluetooth/legacy-driver.d.ts.map +0 -1
- package/lib/typescript/module/src/modules/bt-management/utils/daily-total-day.d.ts.map +0 -1
- package/lib/typescript/module/src/modules/next/bluetooth/drivers.d.ts +0 -7
- package/lib/typescript/module/src/modules/next/bluetooth/drivers.d.ts.map +0 -1
- package/lib/typescript/module/src/modules/next/bluetooth/legacy-driver.d.ts +0 -8
- package/lib/typescript/module/src/modules/next/bluetooth/legacy-driver.d.ts.map +0 -1
- /package/lib/commonjs/modules/{bt-management/utils → next/bluetooth}/daily-total-day.js +0 -0
- /package/lib/module/modules/{bt-management/utils → next/bluetooth}/daily-total-day.js +0 -0
- /package/lib/typescript/commonjs/src/modules/{bt-management/utils → next/bluetooth}/daily-total-day.d.ts +0 -0
- /package/lib/typescript/module/src/modules/{bt-management/utils → next/bluetooth}/daily-total-day.d.ts +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const FIRST_RETRY_DELAY_MS = 2_000;
|
|
4
|
+
const MAX_RETRY_DELAY_MS = 60_000;
|
|
5
|
+
|
|
6
|
+
/** When a paired device that keeps failing may be connected automatically again. */
|
|
7
|
+
class AutoConnectBackoff {
|
|
8
|
+
failures = new Map();
|
|
9
|
+
allows(id, now = Date.now()) {
|
|
10
|
+
return (this.failures.get(id)?.notBefore ?? 0) <= now;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** Records a failure; returns how long until the next automatic attempt. */
|
|
14
|
+
failed(id, now = Date.now()) {
|
|
15
|
+
const count = (this.failures.get(id)?.count ?? 0) + 1;
|
|
16
|
+
const delay = Math.min(FIRST_RETRY_DELAY_MS * 2 ** (count - 1), MAX_RETRY_DELAY_MS);
|
|
17
|
+
this.failures.set(id, {
|
|
18
|
+
count,
|
|
19
|
+
notBefore: now + delay
|
|
20
|
+
});
|
|
21
|
+
return delay;
|
|
22
|
+
}
|
|
23
|
+
succeeded(id) {
|
|
24
|
+
this.failures.delete(id);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export { AutoConnectBackoff };
|
|
28
|
+
//# sourceMappingURL=auto-connect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["FIRST_RETRY_DELAY_MS","MAX_RETRY_DELAY_MS","AutoConnectBackoff","failures","Map","allows","id","now","Date","get","notBefore","failed","count","delay","Math","min","set","succeeded","delete"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/auto-connect.ts"],"mappings":";;AAAA,MAAMA,oBAAoB,GAAG,KAAK;AAClC,MAAMC,kBAAkB,GAAG,MAAM;;AAEjC;AACA,MAAMC,kBAAkB,CAAC;EACNC,QAAQ,GAAG,IAAIC,GAAG,CAA+C,CAAC;EAE5EC,MAAMA,CAACC,EAAU,EAAEC,GAAG,GAAGC,IAAI,CAACD,GAAG,CAAC,CAAC,EAAW;IACnD,OAAO,CAAC,IAAI,CAACJ,QAAQ,CAACM,GAAG,CAACH,EAAE,CAAC,EAAEI,SAAS,IAAI,CAAC,KAAKH,GAAG;EACvD;;EAEA;EACOI,MAAMA,CAACL,EAAU,EAAEC,GAAG,GAAGC,IAAI,CAACD,GAAG,CAAC,CAAC,EAAU;IAClD,MAAMK,KAAK,GAAG,CAAC,IAAI,CAACT,QAAQ,CAACM,GAAG,CAACH,EAAE,CAAC,EAAEM,KAAK,IAAI,CAAC,IAAI,CAAC;IACrD,MAAMC,KAAK,GAAGC,IAAI,CAACC,GAAG,CAACf,oBAAoB,GAAG,CAAC,KAAKY,KAAK,GAAG,CAAC,CAAC,EAAEX,kBAAkB,CAAC;IAEnF,IAAI,CAACE,QAAQ,CAACa,GAAG,CAACV,EAAE,EAAE;MAAEM,KAAK;MAAEF,SAAS,EAAEH,GAAG,GAAGM;IAAM,CAAC,CAAC;IAExD,OAAOA,KAAK;EACd;EAEOI,SAASA,CAACX,EAAU,EAAQ;IACjC,IAAI,CAACH,QAAQ,CAACe,MAAM,CAACZ,EAAE,CAAC;EAC1B;AACF;AAEA,SAASJ,kBAAkB","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { BluetoothErrorCode as LegacyCode, toBluetoothError } from "../../../bt-management/types/bluetooth-error.js";
|
|
4
|
+
import { BluetoothError } from "../errors.js";
|
|
5
|
+
const CODES = {
|
|
6
|
+
[LegacyCode.UNKNOWN]: "unknown",
|
|
7
|
+
[LegacyCode.PERMISSION_DENIED]: "permission-denied",
|
|
8
|
+
[LegacyCode.UNSUPPORTED]: "unsupported",
|
|
9
|
+
[LegacyCode.POWERED_OFF]: "powered-off",
|
|
10
|
+
[LegacyCode.SCAN_FAILED]: "scan-failed",
|
|
11
|
+
[LegacyCode.CONNECTION_FAILED]: "connection-failed",
|
|
12
|
+
[LegacyCode.PAIRING_REQUIRED]: "pairing-required",
|
|
13
|
+
[LegacyCode.DISCOVERY_FAILED]: "discovery-failed",
|
|
14
|
+
[LegacyCode.DEVICE_ERROR]: "device-error",
|
|
15
|
+
[LegacyCode.FRAME_INVALID]: "frame-invalid",
|
|
16
|
+
[LegacyCode.MEASUREMENT_FAILED]: "measurement-failed",
|
|
17
|
+
[LegacyCode.BACKGROUND_SYNC]: "unknown"
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** Classifies a `react-native-ble-plx` or legacy device error as a `BluetoothError`. */
|
|
21
|
+
export const fromBleError = error => {
|
|
22
|
+
if (error instanceof BluetoothError) {
|
|
23
|
+
return error;
|
|
24
|
+
}
|
|
25
|
+
const legacy = toBluetoothError(error);
|
|
26
|
+
return new BluetoothError(CODES[legacy.code], legacy.message, error);
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=ble-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["BluetoothErrorCode","LegacyCode","toBluetoothError","BluetoothError","CODES","UNKNOWN","PERMISSION_DENIED","UNSUPPORTED","POWERED_OFF","SCAN_FAILED","CONNECTION_FAILED","PAIRING_REQUIRED","DISCOVERY_FAILED","DEVICE_ERROR","FRAME_INVALID","MEASUREMENT_FAILED","BACKGROUND_SYNC","fromBleError","error","legacy","code","message"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/ble-plx/ble-errors.ts"],"mappings":";;AAAA,SAASA,kBAAkB,IAAIC,UAAU,EAAEC,gBAAgB,QAAQ,iDAA8C;AACjH,SAASC,cAAc,QAA4B,cAAW;AAE9D,MAAMC,KAA6C,GAAG;EACpD,CAACH,UAAU,CAACI,OAAO,GAAG,SAAS;EAC/B,CAACJ,UAAU,CAACK,iBAAiB,GAAG,mBAAmB;EACnD,CAACL,UAAU,CAACM,WAAW,GAAG,aAAa;EACvC,CAACN,UAAU,CAACO,WAAW,GAAG,aAAa;EACvC,CAACP,UAAU,CAACQ,WAAW,GAAG,aAAa;EACvC,CAACR,UAAU,CAACS,iBAAiB,GAAG,mBAAmB;EACnD,CAACT,UAAU,CAACU,gBAAgB,GAAG,kBAAkB;EACjD,CAACV,UAAU,CAACW,gBAAgB,GAAG,kBAAkB;EACjD,CAACX,UAAU,CAACY,YAAY,GAAG,cAAc;EACzC,CAACZ,UAAU,CAACa,aAAa,GAAG,eAAe;EAC3C,CAACb,UAAU,CAACc,kBAAkB,GAAG,oBAAoB;EACrD,CAACd,UAAU,CAACe,eAAe,GAAG;AAChC,CAAC;;AAED;AACA,OAAO,MAAMC,YAAY,GAAIC,KAAc,IAAqB;EAC9D,IAAIA,KAAK,YAAYf,cAAc,EAAE;IACnC,OAAOe,KAAK;EACd;EAEA,MAAMC,MAAM,GAAGjB,gBAAgB,CAACgB,KAAK,CAAC;EAEtC,OAAO,IAAIf,cAAc,CAACC,KAAK,CAACe,MAAM,CAACC,IAAI,CAAC,EAAED,MAAM,CAACE,OAAO,EAAEH,KAAK,CAAC;AACtE,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { readDeviceInformation } from "../../../bt-management/services/devices/bt-device-information.js";
|
|
4
|
+
import { awaitNotificationsEnabled } from "../../../bt-management/services/devices/bt-notification-readiness.js";
|
|
5
|
+
import { BTPairingRetry } from "../../../bt-management/services/devices/bt-pairing-retry.js";
|
|
6
|
+
import { sentryLogger } from "../../../helpers/utils/sentry-logger.js";
|
|
7
|
+
import { Channel } from "../channel.js";
|
|
8
|
+
import { fromBleError } from "./ble-errors.js";
|
|
9
|
+
const CONNECT_ATTEMPTS = 5;
|
|
10
|
+
const FIRST_RETRY_DELAY_MS = 1000;
|
|
11
|
+
const MAX_RETRY_DELAY_MS = 5000;
|
|
12
|
+
|
|
13
|
+
/** BleErrorCode.OperationCancelled and DeviceDisconnected; the enum is not available at runtime. */
|
|
14
|
+
const ENDS_THE_LINK = new Set([2, 201]);
|
|
15
|
+
const toBytes = base64 => Uint8Array.from(atob(base64), char => char.charCodeAt(0));
|
|
16
|
+
const toBase64 = bytes => btoa(String.fromCharCode(...bytes));
|
|
17
|
+
const retryDelay = attempt => Math.min(FIRST_RETRY_DELAY_MS * 2 ** (attempt - 1), MAX_RETRY_DELAY_MS);
|
|
18
|
+
const abortReason = signal => signal.reason ?? new Error("The Bluetooth connection was cancelled");
|
|
19
|
+
|
|
20
|
+
/** Waits `ms`, or rejects as soon as `signal` aborts so a cancelled retry does not linger. */
|
|
21
|
+
const wait = (ms, signal) => new Promise((resolve, reject) => {
|
|
22
|
+
const aborted = () => {
|
|
23
|
+
clearTimeout(timer);
|
|
24
|
+
reject(abortReason(signal));
|
|
25
|
+
};
|
|
26
|
+
const timer = setTimeout(() => {
|
|
27
|
+
signal.removeEventListener("abort", aborted);
|
|
28
|
+
resolve();
|
|
29
|
+
}, ms);
|
|
30
|
+
signal.addEventListener("abort", aborted, {
|
|
31
|
+
once: true
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
async function connectWithRetries(device, signal) {
|
|
35
|
+
for (let attempt = 1;; attempt += 1) {
|
|
36
|
+
if (signal.aborted) {
|
|
37
|
+
throw abortReason(signal);
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
if (!(await device.isConnected())) {
|
|
41
|
+
await device.connect();
|
|
42
|
+
}
|
|
43
|
+
return;
|
|
44
|
+
} catch (error) {
|
|
45
|
+
if (attempt >= CONNECT_ATTEMPTS) {
|
|
46
|
+
sentryLogger("error", "BLUETOOTH: Connection failed", {
|
|
47
|
+
errorCode: fromBleError(error).code,
|
|
48
|
+
attempts: attempt
|
|
49
|
+
});
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
await wait(retryDelay(attempt), signal);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Reads the standard Device Information strings; `undefined` when the device has none. */
|
|
58
|
+
async function readInformation(device, pairing) {
|
|
59
|
+
let information;
|
|
60
|
+
await readDeviceInformation(device, ({
|
|
61
|
+
manufacturerName,
|
|
62
|
+
model,
|
|
63
|
+
serialNumber
|
|
64
|
+
}) => {
|
|
65
|
+
information = {
|
|
66
|
+
manufacturerName,
|
|
67
|
+
model,
|
|
68
|
+
serialNumber
|
|
69
|
+
};
|
|
70
|
+
}, pairing.run);
|
|
71
|
+
return information;
|
|
72
|
+
}
|
|
73
|
+
class BleLink {
|
|
74
|
+
channels = new Set();
|
|
75
|
+
notificationsPending = new Set();
|
|
76
|
+
ended = false;
|
|
77
|
+
closeOnAbort = () => void this.close();
|
|
78
|
+
constructor(device, signal, pairing, deviceInformation) {
|
|
79
|
+
this.device = device;
|
|
80
|
+
this.signal = signal;
|
|
81
|
+
this.pairing = pairing;
|
|
82
|
+
this.deviceInformation = deviceInformation;
|
|
83
|
+
this.disconnected = device.onDisconnected(() => this.endAll());
|
|
84
|
+
signal.addEventListener("abort", this.closeOnAbort, {
|
|
85
|
+
once: true
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
subscribe(service, characteristic) {
|
|
89
|
+
const channel = new Channel(() => {
|
|
90
|
+
subscription.remove();
|
|
91
|
+
this.channels.delete(channel);
|
|
92
|
+
});
|
|
93
|
+
const subscription = this.device.monitorCharacteristicForService(service, characteristic, (error, value) => {
|
|
94
|
+
if (error) {
|
|
95
|
+
this.endOrFail(channel, error);
|
|
96
|
+
} else if (value?.value) {
|
|
97
|
+
channel.push(toBytes(value.value));
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
this.channels.add(channel);
|
|
101
|
+
this.awaitNotifications(service, characteristic);
|
|
102
|
+
if (this.ended) {
|
|
103
|
+
channel.end();
|
|
104
|
+
}
|
|
105
|
+
return channel;
|
|
106
|
+
}
|
|
107
|
+
async write(service, characteristic, bytes) {
|
|
108
|
+
await Promise.all(this.notificationsPending);
|
|
109
|
+
await this.pairing.run(() => this.device.writeCharacteristicWithResponseForService(service, characteristic, toBase64(bytes)));
|
|
110
|
+
}
|
|
111
|
+
async close() {
|
|
112
|
+
this.signal.removeEventListener("abort", this.closeOnAbort);
|
|
113
|
+
this.endAll();
|
|
114
|
+
this.disconnected.remove();
|
|
115
|
+
await this.device.cancelConnection().catch(() => undefined);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** A write waits for these, because a device may refuse a command until its notifications are on. */
|
|
119
|
+
awaitNotifications(serviceUuid, characteristicUuid) {
|
|
120
|
+
const enabled = awaitNotificationsEnabled(this.device, [{
|
|
121
|
+
serviceUuid,
|
|
122
|
+
characteristicUuid
|
|
123
|
+
}]).finally(() => this.notificationsPending.delete(enabled));
|
|
124
|
+
this.notificationsPending.add(enabled);
|
|
125
|
+
}
|
|
126
|
+
endOrFail(channel, error) {
|
|
127
|
+
if (ENDS_THE_LINK.has(error.errorCode)) {
|
|
128
|
+
channel.end();
|
|
129
|
+
} else {
|
|
130
|
+
channel.fail(fromBleError(error));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
endAll() {
|
|
134
|
+
this.ended = true;
|
|
135
|
+
[...this.channels].forEach(channel => channel.end());
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** Connects (retrying with backoff), discovers services and reads Device Information; aborting `signal` closes the link. */
|
|
140
|
+
async function openBleLink(device, signal) {
|
|
141
|
+
await connectWithRetries(device, signal).catch(error => {
|
|
142
|
+
throw fromBleError(error);
|
|
143
|
+
});
|
|
144
|
+
const pairing = new BTPairingRetry(device, () => sentryLogger("info", "BLUETOOTH: Waiting for the user to pair the device"));
|
|
145
|
+
let information;
|
|
146
|
+
try {
|
|
147
|
+
await device.discoverAllServicesAndCharacteristics();
|
|
148
|
+
information = await readInformation(device, pairing);
|
|
149
|
+
if (signal.aborted) {
|
|
150
|
+
throw abortReason(signal);
|
|
151
|
+
}
|
|
152
|
+
} catch (error) {
|
|
153
|
+
await device.cancelConnection().catch(() => undefined);
|
|
154
|
+
throw fromBleError(error);
|
|
155
|
+
}
|
|
156
|
+
return new BleLink(device, signal, pairing, information);
|
|
157
|
+
}
|
|
158
|
+
export { openBleLink };
|
|
159
|
+
//# sourceMappingURL=ble-link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["readDeviceInformation","awaitNotificationsEnabled","BTPairingRetry","sentryLogger","Channel","fromBleError","CONNECT_ATTEMPTS","FIRST_RETRY_DELAY_MS","MAX_RETRY_DELAY_MS","ENDS_THE_LINK","Set","toBytes","base64","Uint8Array","from","atob","char","charCodeAt","toBase64","bytes","btoa","String","fromCharCode","retryDelay","attempt","Math","min","abortReason","signal","reason","Error","wait","ms","Promise","resolve","reject","aborted","clearTimeout","timer","setTimeout","removeEventListener","addEventListener","once","connectWithRetries","device","isConnected","connect","error","errorCode","code","attempts","readInformation","pairing","information","manufacturerName","model","serialNumber","run","BleLink","channels","notificationsPending","ended","closeOnAbort","close","constructor","deviceInformation","disconnected","onDisconnected","endAll","subscribe","service","characteristic","channel","subscription","remove","delete","monitorCharacteristicForService","value","endOrFail","push","add","awaitNotifications","end","write","all","writeCharacteristicWithResponseForService","cancelConnection","catch","undefined","serviceUuid","characteristicUuid","enabled","finally","has","fail","forEach","openBleLink","discoverAllServicesAndCharacteristics"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/ble-plx/ble-link.ts"],"mappings":";;AAEA,SAASA,qBAAqB,QAAQ,kEAA+D;AACrG,SAASC,yBAAyB,QAAQ,sEAAmE;AAC7G,SAASC,cAAc,QAAQ,6DAA0D;AACzF,SAASC,YAAY,QAAQ,yCAAsC;AACnE,SAASC,OAAO,QAAQ,eAAY;AAGpC,SAASC,YAAY,QAAQ,iBAAc;AAE3C,MAAMC,gBAAgB,GAAG,CAAC;AAC1B,MAAMC,oBAAoB,GAAG,IAAI;AACjC,MAAMC,kBAAkB,GAAG,IAAI;;AAE/B;AACA,MAAMC,aAAkC,GAAG,IAAIC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAE5D,MAAMC,OAAO,GAAIC,MAAc,IAAiBC,UAAU,CAACC,IAAI,CAACC,IAAI,CAACH,MAAM,CAAC,EAAGI,IAAI,IAAKA,IAAI,CAACC,UAAU,CAAC,CAAC,CAAC,CAAC;AAE3G,MAAMC,QAAQ,GAAIC,KAAiB,IAAaC,IAAI,CAACC,MAAM,CAACC,YAAY,CAAC,GAAGH,KAAK,CAAC,CAAC;AAEnF,MAAMI,UAAU,GAAIC,OAAe,IACjCC,IAAI,CAACC,GAAG,CAACnB,oBAAoB,GAAG,CAAC,KAAKiB,OAAO,GAAG,CAAC,CAAC,EAAEhB,kBAAkB,CAAC;AAEzE,MAAMmB,WAAW,GAAIC,MAAmB,IACtCA,MAAM,CAACC,MAAM,IAAI,IAAIC,KAAK,CAAC,wCAAwC,CAAC;;AAEtE;AACA,MAAMC,IAAI,GAAGA,CAACC,EAAU,EAAEJ,MAAmB,KAC3C,IAAIK,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;EAC/B,MAAMC,OAAO,GAAGA,CAAA,KAAM;IACpBC,YAAY,CAACC,KAAK,CAAC;IACnBH,MAAM,CAACR,WAAW,CA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B,MAAM,EAAEwB,OAAO,EAAEC,WAAW,CAAC;AAC1D;AAEA,SAAS2C,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { ScanMode, State } from "react-native-ble-plx";
|
|
4
|
+
import { fromBleError } from "./ble-errors.js";
|
|
5
|
+
import { openBleLink } from "./ble-link.js";
|
|
6
|
+
const ADAPTER_STATES = {
|
|
7
|
+
[State.PoweredOn]: "on",
|
|
8
|
+
[State.PoweredOff]: "off",
|
|
9
|
+
[State.Unauthorized]: "unauthorized",
|
|
10
|
+
[State.Unsupported]: "unsupported"
|
|
11
|
+
};
|
|
12
|
+
const bleDevices = new WeakMap();
|
|
13
|
+
|
|
14
|
+
/** The `react-native-ble-plx` device behind a peripheral this adapter reported. */
|
|
15
|
+
const bleDeviceOf = peripheral => {
|
|
16
|
+
const device = bleDevices.get(peripheral);
|
|
17
|
+
if (!device) {
|
|
18
|
+
throw new Error("The peripheral was not found by bleManagerScanner");
|
|
19
|
+
}
|
|
20
|
+
return device;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/** A `react-native-ble-plx` device as a peripheral. */
|
|
24
|
+
const blePeripheral = device => {
|
|
25
|
+
const peripheral = {
|
|
26
|
+
id: device.id,
|
|
27
|
+
advertisement: {
|
|
28
|
+
name: device.name?.trim() || device.localName?.trim() || "",
|
|
29
|
+
serviceUUIDs: device.serviceUUIDs ?? [],
|
|
30
|
+
manufacturerData: device.manufacturerData ?? null
|
|
31
|
+
},
|
|
32
|
+
openLink: signal => openBleLink(device, signal)
|
|
33
|
+
};
|
|
34
|
+
bleDevices.set(peripheral, device);
|
|
35
|
+
return peripheral;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** A scanner over a `react-native-ble-plx` `BleManager`. */
|
|
39
|
+
const bleManagerScanner = bleManager => ({
|
|
40
|
+
watchState: listener => {
|
|
41
|
+
const subscription = bleManager.onStateChange(state => listener(ADAPTER_STATES[state] ?? "unknown"), true);
|
|
42
|
+
return () => subscription.remove();
|
|
43
|
+
},
|
|
44
|
+
scan: (onFound, onError) => {
|
|
45
|
+
let active = true;
|
|
46
|
+
try {
|
|
47
|
+
bleManager.startDeviceScan(null, {
|
|
48
|
+
scanMode: ScanMode.Balanced
|
|
49
|
+
}, (error, device) => {
|
|
50
|
+
if (!active) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (error) {
|
|
54
|
+
onError(fromBleError(error));
|
|
55
|
+
} else if (device) {
|
|
56
|
+
onFound(blePeripheral(device));
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
} catch (error) {
|
|
60
|
+
onError(fromBleError(error));
|
|
61
|
+
}
|
|
62
|
+
return () => {
|
|
63
|
+
active = false;
|
|
64
|
+
bleManager.stopDeviceScan();
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
export { bleDeviceOf, bleManagerScanner, blePeripheral };
|
|
69
|
+
//# sourceMappingURL=ble-scanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ScanMode","State","fromBleError","openBleLink","ADAPTER_STATES","PoweredOn","PoweredOff","Unauthorized","Unsupported","bleDevices","WeakMap","bleDeviceOf","peripheral","device","get","Error","blePeripheral","id","advertisement","name","trim","localName","serviceUUIDs","manufacturerData","openLink","signal","set","bleManagerScanner","bleManager","watchState","listener","subscription","onStateChange","state","remove","scan","onFound","onError","active","startDeviceScan","scanMode","Balanced","error","stopDeviceScan"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/ble-plx/ble-scanner.ts"],"mappings":";;AAAA,SAA6BA,QAAQ,EAAEC,KAAK,QAAQ,sBAAsB;AAI1E,SAASC,YAAY,QAAQ,iBAAc;AAC3C,SAASC,WAAW,QAAQ,eAAY;AAExC,MAAMC,cAAoD,GAAG;EAC3D,CAACH,KAAK,CAACI,SAAS,GAAG,IAAI;EACvB,CAACJ,KAAK,C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ACC,OAAO,EAAEC,OAAO,KAAK;IAC1B,IAAIC,MAAM,GAAG,IAAI;IAEjB,IAAI;MACFV,UAAU,CAACW,eAAe,CAAC,IAAI,EAAE;QAAEC,QAAQ,EAAExC,QAAQ,CAACyC;MAAS,CAAC,EAAE,CAACC,KAAK,EAAE7B,MAAM,KAAK;QACnF,IAAI,CAACyB,MAAM,EAAE;UACX;QACF;QACA,IAAII,KAAK,EAAE;UACTL,OAAO,CAACnC,YAAY,CAACwC,KAAK,CAAC,CAAC;QAC9B,CAAC,MAAM,IAAI7B,MAAM,EAAE;UACjBuB,OAAO,CAACpB,aAAa,CAACH,MAAM,CAAC,CAAC;QAChC;MACF,CAAC,CAAC;IACJ,CAAC,CAAC,OAAO6B,KAAK,EAAE;MACdL,OAAO,CAACnC,YAAY,CAACwC,KAAK,CAAC,CAAC;IAC9B;IAEA,OAAO,MAAM;MACXJ,MAAM,GAAG,KAAK;MACdV,UAAU,CAACe,cAAc,CAAC,CAAC;IAC7B,CAAC;EACH;AACF,CAAC,CAAC;AAEF,SAAShC,WAAW,EAAEgB,iBAAiB,EAAEX,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { resolveDeviceKey } from "../../../bt-management/core/resolve-device-key.js";
|
|
4
|
+
import { DeviceCreator } from "../../../bt-management/services/device-creator.js";
|
|
5
|
+
import { gattDriver } from "../driver.js";
|
|
6
|
+
import { SIG_PROTOCOLS } from "../sig-profiles.js";
|
|
7
|
+
import { legacyDriver } from "./legacy-driver.js";
|
|
8
|
+
|
|
9
|
+
/** Support for the SDK's integrated devices and `defineCustomDevice` declarations, over `react-native-ble-plx`. */
|
|
10
|
+
const builtInDevices = accepted => {
|
|
11
|
+
const creator = new DeviceCreator(accepted);
|
|
12
|
+
return {
|
|
13
|
+
match: ({
|
|
14
|
+
name,
|
|
15
|
+
serviceUUIDs,
|
|
16
|
+
manufacturerData
|
|
17
|
+
}) => {
|
|
18
|
+
const key = resolveDeviceKey(accepted, name, serviceUUIDs, manufacturerData ?? undefined);
|
|
19
|
+
if (key === undefined) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
const protocol = SIG_PROTOCOLS.get(key);
|
|
23
|
+
return {
|
|
24
|
+
key,
|
|
25
|
+
driver: protocol ? gattDriver(key, protocol) : legacyDriver(creator, key)
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export { builtInDevices };
|
|
31
|
+
//# sourceMappingURL=built-in-devices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["resolveDeviceKey","DeviceCreator","gattDriver","SIG_PROTOCOLS","legacyDriver","builtInDevices","accepted","creator","match","name","serviceUUIDs","manufacturerData","key","undefined","protocol","get","driver"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/ble-plx/built-in-devices.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,mDAAgD;AACjF,SAASC,aAAa,QAAQ,mDAAgD;AAG9E,SAASC,UAAU,QAAQ,cAAW;AACtC,SAASC,aAAa,QAAQ,oBAAiB;AAE/C,SAASC,YAAY,QAAQ,oBAAiB;;AAE9C;AACA,MAAMC,cAAc,GAAIC,QAAmC,IAAoB;EAC7E,MAAMC,OAAO,GAAG,IAAIN,aAAa,CAACK,QAAQ,CAAC;EAE3C,OAAO;IACLE,KAAK,EAAEA,CAAC;MAAEC,IAAI;MAAEC,YAAY;MAAEC;IAAiB,CAAC,KAAK;MACnD,MAAMC,GAAG,GAAGZ,gBAAgB,CAACM,QAAQ,EAAEG,IAAI,EAAEC,YAAY,EAAEC,gBAAgB,IAAIE,SAAS,CAAC;MAEzF,IAAID,GAAG,KAAKC,SAAS,EAAE;QACrB,OAAOA,SAAS;MAClB;MAEA,MAAMC,QAAQ,GAAGX,aAAa,CAACY,GAAG,CAACH,GAAG,CAAC;MAEvC,OAAO;QAAEA,GAAG;QAAEI,MAAM,EAAEF,QAAQ,GAAGZ,UAAU,CAACU,GAAG,EAAEE,QAAQ,CAAC,GAAGV,YAAY,CAACG,OAAO,EAAEK,GAAG;MAAE,CAAC;IAC3F;EACF,CAAC;AACH,CAAC;AAED,SAASP,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { DeviceStatus } from "../../../bt-management/types/device-status.js";
|
|
4
|
+
import { Channel } from "../channel.js";
|
|
5
|
+
import { isTimestamped } from "../driver.js";
|
|
6
|
+
import { fromBleError } from "./ble-errors.js";
|
|
7
|
+
import { bleDeviceOf } from "./ble-scanner.js";
|
|
8
|
+
const STATUSES = {
|
|
9
|
+
[DeviceStatus.CONNECTED]: "connected",
|
|
10
|
+
[DeviceStatus.MEASURING]: "measuring",
|
|
11
|
+
[DeviceStatus.DISCONNECTED]: "disconnected"
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** Runs a device class from `@ovok/native/bt-management` until its protocol moves to a `DeviceProtocol`. */
|
|
15
|
+
const legacyDriver = (creator, deviceName) => (peripheral, signal) => {
|
|
16
|
+
const stop = () => events.end();
|
|
17
|
+
const events = new Channel(() => {
|
|
18
|
+
signal.removeEventListener("abort", stop);
|
|
19
|
+
void managed.disconnect();
|
|
20
|
+
});
|
|
21
|
+
const managed = creator.createDevice({
|
|
22
|
+
device: bleDeviceOf(peripheral),
|
|
23
|
+
deviceName,
|
|
24
|
+
onResult: ({
|
|
25
|
+
id,
|
|
26
|
+
data
|
|
27
|
+
}) => {
|
|
28
|
+
const reading = data;
|
|
29
|
+
events.push({
|
|
30
|
+
kind: "reading",
|
|
31
|
+
id: isTimestamped(reading) ? id : null,
|
|
32
|
+
reading
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
onDeviceStatusChanged: ({
|
|
36
|
+
status
|
|
37
|
+
}) => {
|
|
38
|
+
const mapped = STATUSES[status];
|
|
39
|
+
if (mapped) {
|
|
40
|
+
events.push({
|
|
41
|
+
kind: "status",
|
|
42
|
+
status: mapped
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
if (status === DeviceStatus.DISCONNECTED) {
|
|
46
|
+
events.end();
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
onError: ({
|
|
50
|
+
error
|
|
51
|
+
}) => events.push({
|
|
52
|
+
kind: "error",
|
|
53
|
+
error: fromBleError(error)
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
signal.addEventListener("abort", stop, {
|
|
57
|
+
once: true
|
|
58
|
+
});
|
|
59
|
+
managed.connect().catch(error => events.fail(fromBleError(error)));
|
|
60
|
+
return events;
|
|
61
|
+
};
|
|
62
|
+
export { legacyDriver };
|
|
63
|
+
//# sourceMappingURL=legacy-driver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DeviceStatus","Channel","isTimestamped","fromBleError","bleDeviceOf","STATUSES","CONNECTED","MEASURING","DISCONNECTED","legacyDriver","creator","deviceName","peripheral","signal","stop","events","end","removeEventListener","managed","disconnect","createDevice","device","onResult","id","data","reading","push","kind","onDeviceStatusChanged","status","mapped","onError","error","addEventListener","once","connect","catch","fail"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/ble-plx/legacy-driver.ts"],"mappings":";;AAKA,SAASA,YAAY,QAAQ,+CAA4C;AACzE,SAASC,OAAO,QAAQ,eAAY;AACpC,SAA8BC,aAAa,QAAQ,cAAW;AAE9D,SAASC,YAAY,QAAQ,iBAAc;AAC3C,SAASC,WAAW,QAAQ,kBAAe;AAE3C,MAAMC,QAAmF,GAAG;EAC1F,CAACL,YAAY,CAACM,SAAS,GAAG,WAAW;EACrC,CAACN,YAAY,CAACO,SAAS,GAAG,WAAW;EACrC,CAACP,YAAY,CAACQ,YAAY,GAAG;AAC/B,CAAC;;AAED;AACA,MAAMC,YAAY,GAAGA,CAACC,OAAiD,EAAEC,UAAqB,KAC5F,CAACC,UAAU,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EAAE;EAAK,CAAC,CAAC;EACtDhB,OAAO,CAACiB,OAAO,CAAC,CAAC,CAACC,KAAK,CAAEJ,KAAc,IAAKjB,MAAM,CAACsB,IAAI,CAAClC,YAAY,CAAC6B,KAAK,CAAC,CAAC,CAAC;EAE7E,OAAOjB,MAAM;AACf,CAAC;AAEH,SAASN,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { asBluetoothError, BluetoothError } from "./errors.js";
|
|
4
|
+
import { keepReadings } from "./result-policy.js";
|
|
5
|
+
const endedBeforeConnecting = () => new BluetoothError("connection-failed", "The device disconnected before it connected");
|
|
6
|
+
|
|
7
|
+
/** One driver run per connected device, its events folded into the snapshot. */
|
|
8
|
+
class Connections {
|
|
9
|
+
sessions = new Map();
|
|
10
|
+
constructor(store, readings, policy, onEnded) {
|
|
11
|
+
this.store = store;
|
|
12
|
+
this.readings = readings;
|
|
13
|
+
this.policy = policy;
|
|
14
|
+
this.onEnded = onEnded;
|
|
15
|
+
}
|
|
16
|
+
isActive(id) {
|
|
17
|
+
return this.sessions.has(id);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Resolves once connected; joins a connection still opening or open, and waits out one being closed. */
|
|
21
|
+
async connect(peripheral, driver) {
|
|
22
|
+
const current = this.sessions.get(peripheral.id);
|
|
23
|
+
if (current?.controller.signal.aborted) {
|
|
24
|
+
await current.ended;
|
|
25
|
+
return this.connect(peripheral, driver);
|
|
26
|
+
}
|
|
27
|
+
return (current ?? this.start(peripheral, driver)).connected;
|
|
28
|
+
}
|
|
29
|
+
async disconnect(id) {
|
|
30
|
+
const session = this.sessions.get(id);
|
|
31
|
+
session?.controller.abort();
|
|
32
|
+
await session?.ended;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Disconnects every device; resolves once every connection has ended. */
|
|
36
|
+
async disconnectAll() {
|
|
37
|
+
await Promise.all([...this.sessions.keys()].map(id => this.disconnect(id)));
|
|
38
|
+
}
|
|
39
|
+
start(peripheral, driver) {
|
|
40
|
+
const {
|
|
41
|
+
id
|
|
42
|
+
} = peripheral;
|
|
43
|
+
const controller = new AbortController();
|
|
44
|
+
let markConnected = () => undefined;
|
|
45
|
+
let failConnecting = () => undefined;
|
|
46
|
+
const connected = new Promise((resolve, reject) => {
|
|
47
|
+
markConnected = resolve;
|
|
48
|
+
failConnecting = reject;
|
|
49
|
+
});
|
|
50
|
+
this.store.updateDevice(id, {
|
|
51
|
+
connection: "connecting",
|
|
52
|
+
error: null
|
|
53
|
+
});
|
|
54
|
+
const ended = this.run(peripheral, driver, controller.signal, () => markConnected()).then(() => {
|
|
55
|
+
this.store.updateDevice(id, {
|
|
56
|
+
connection: "disconnected"
|
|
57
|
+
});
|
|
58
|
+
failConnecting(endedBeforeConnecting());
|
|
59
|
+
}).catch(error => {
|
|
60
|
+
const failure = asBluetoothError(error, "connection-failed");
|
|
61
|
+
this.store.updateDevice(id, controller.signal.aborted ? {
|
|
62
|
+
connection: "disconnected"
|
|
63
|
+
} : {
|
|
64
|
+
connection: "failed",
|
|
65
|
+
error: failure
|
|
66
|
+
});
|
|
67
|
+
failConnecting(failure);
|
|
68
|
+
}).finally(() => {
|
|
69
|
+
this.sessions.delete(id);
|
|
70
|
+
this.onEnded(id);
|
|
71
|
+
});
|
|
72
|
+
const session = {
|
|
73
|
+
controller,
|
|
74
|
+
connected,
|
|
75
|
+
ended
|
|
76
|
+
};
|
|
77
|
+
this.sessions.set(id, session);
|
|
78
|
+
return session;
|
|
79
|
+
}
|
|
80
|
+
async run(peripheral, driver, signal, connected) {
|
|
81
|
+
for await (const event of keepReadings(driver(peripheral, signal), this.policy)) {
|
|
82
|
+
this.apply(peripheral.id, event, connected);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
apply(id, event, connected) {
|
|
86
|
+
if (event.kind === "status") {
|
|
87
|
+
if (event.status !== "disconnected") {
|
|
88
|
+
connected();
|
|
89
|
+
}
|
|
90
|
+
this.store.updateDevice(id, {
|
|
91
|
+
connection: event.status
|
|
92
|
+
});
|
|
93
|
+
} else if (event.kind === "information") {
|
|
94
|
+
this.store.updateDevice(id, {
|
|
95
|
+
information: event.information
|
|
96
|
+
});
|
|
97
|
+
} else if (event.kind === "reading") {
|
|
98
|
+
const device = this.store.device(id);
|
|
99
|
+
if (device) {
|
|
100
|
+
this.readings.receive(device, event.id, event.reading);
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
this.store.updateDevice(id, {
|
|
104
|
+
error: event.error
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
export { Connections };
|
|
110
|
+
//# sourceMappingURL=connections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["asBluetoothError","BluetoothError","keepReadings","endedBeforeConnecting","Connections","sessions","Map","constructor","store","readings","policy","onEnded","isActive","id","has","connect","peripheral","driver","current","get","controller","signal","aborted","ended","start","connected","disconnect","session","abort","disconnectAll","Promise","all","keys","map","AbortController","markConnected","undefined","failConnecting","resolve","reject","updateDevice","connection","error","run","then","catch","failure","finally","delete","set","event","apply","kind","status","information","device","receive","reading"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/connections.ts"],"mappings":";;AACA,SAASA,gBAAgB,EAAEC,cAAc,QAAQ,aAAU;AAE3D,SAASC,YAAY,QAAsB,oBAAiB;AAM5D,MAAMC,qBAAqB,GAAGA,CAAA,KAC5B,IAAIF,cAAc,CAAC,mBAAmB,EAAE,6CAA6C,CAAC;;AAExF;AACA,MAAMG,WAAW,CAAC;EACCC,QAAQ,GAAG,IAAIC,GAAG,CAAkB,CAAC;EAE/CC,WAAWA,CACCC,KAAoB,EACpBC,QAAoB,EACpBC,MAAoB,EACpBC,OAA6B,EAC9C;IAAA,KAJiBH,KAAoB,GAApBA,KAAoB;IAAA,KACpBC,QAAoB,GAApBA,QAAoB;IAAA,KACpBC,MAAoB,G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AAEQ,KAAK,CAACR;MAAM,CAAC,CAAC;IACrD;EACF;AACF;AAEA,SAAStC,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["dailyTotalDay","data","now","temporal","end","Date","getTime","day","start","recordedAt","toISOString","slice","undefined"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/daily-total-day.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,aAAa,GAAGA,CAC3BC,IAAY,EACZC,GAAW,KACY;EACvB,MAAMC,QAAQ,GAAGF,IAAuD;EAExE,IAAIE,QAAQ,CAACC,GAAG,YAAYC,IAAI,IAAIF,QAAQ,CAACC,GAAG,CAACE,OAAO,CAAC,CAAC,GAAGJ,GAAG,EAAE;IAChE,OAAO,QAAQ;EACjB;EAEA,MAAMK,GAAG,GAAGJ,QAAQ,CAACC,GAAG,IAAID,QAAQ,CAACK,KAAK,IAAIL,QAAQ,CAACM,UAAU;EAEjE,OAAOF,GAAG,YAAYF,IAAI,GAAGE,GAAG,CAACG,WAAW,CAAC,CAAC,CAACC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAGC,SAAS;AACzE,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { gattDriver } from "./driver.js";
|
|
4
|
+
|
|
5
|
+
/** A peripheral a support recognised: the device key its readings carry and the driver that runs it. */
|
|
6
|
+
|
|
7
|
+
/** Recognises peripherals by their advertisement. */
|
|
8
|
+
|
|
9
|
+
/** A device a third party adds: how to recognise it and the protocol that reads it. */
|
|
10
|
+
|
|
11
|
+
/** Support for one device a third party defines with its own protocol. */
|
|
12
|
+
const defineDevice = ({
|
|
13
|
+
key,
|
|
14
|
+
matches,
|
|
15
|
+
protocol
|
|
16
|
+
}) => {
|
|
17
|
+
const driver = gattDriver(key, protocol);
|
|
18
|
+
return {
|
|
19
|
+
match: advertisement => matches(advertisement) ? {
|
|
20
|
+
key,
|
|
21
|
+
driver
|
|
22
|
+
} : undefined
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** The first support's match for an advertisement. */
|
|
27
|
+
const matchDevice = (devices, advertisement) => {
|
|
28
|
+
for (const support of devices) {
|
|
29
|
+
const match = support.match(advertisement);
|
|
30
|
+
if (match) {
|
|
31
|
+
return match;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return undefined;
|
|
35
|
+
};
|
|
36
|
+
export { defineDevice, matchDevice };
|
|
37
|
+
//# sourceMappingURL=devices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["gattDriver","defineDevice","key","matches","protocol","driver","match","advertisement","undefined","matchDevice","devices","support"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/devices.ts"],"mappings":";;AAAA,SAAiCA,UAAU,QAAQ,aAAU;;AAG7D;;AAUA;;AAOA;;AAaA;AACA,MAAMC,YAAY,GAAGA,CAAC;EAAEC,GAAG;EAAEC,OAAO;EAAEC;AAA2B,CAAC,KAAoB;EACpF,MAAMC,MAAM,GAAGL,UAAU,CAACE,GAAG,EAAEE,QAAQ,CAAC;EAExC,OAAO;IAAEE,KAAK,EAAGC,aAAa,IAAMJ,OAAO,CAACI,aAAa,CAAC,GAAG;MAAEL,GAAG;MAAEG;IAAO,CAAC,GAAGG;EAAW,CAAC;AAC7F,CAAC;;AAED;AACA,MAAMC,WAAW,GAAGA,CAACC,OAAiC,EAAEH,aAA4B,KAA8B;EAChH,KAAK,MAAMI,OAAO,IAAID,OAAO,EAAE;IAC7B,MAAMJ,KAAK,GAAGK,OAAO,CAACL,KAAK,CAACC,aAAa,CAAC;IAE1C,IAAID,KAAK,EAAE;MACT,OAAOA,KAAK;IACd;EACF;EAEA,OAAOE,SAAS;AAClB,CAAC;AAED,SAASP,YAAY,EAAEQ,WAAW","ignoreList":[]}
|