@ovok/native 1.16.1-dev.2133 → 1.16.1-dev.2139
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.js +1 -0
- package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
- package/lib/commonjs/modules/bt-management/hooks/runtime-context.js.map +1 -1
- package/lib/commonjs/modules/bt-management/index.js +12 -0
- package/lib/commonjs/modules/bt-management/index.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/bt-manager.js +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 +17 -1
- 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.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/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/result-identity.js +26 -13
- package/lib/commonjs/modules/bt-management/utils/result-identity.js.map +1 -1
- 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/bluetooth/ble-plx/ble-link.js +41 -4
- package/lib/commonjs/modules/next/bluetooth/ble-plx/ble-link.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/connections.js +4 -0
- package/lib/commonjs/modules/next/bluetooth/connections.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/driver.js +6 -0
- package/lib/commonjs/modules/next/bluetooth/driver.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/react-native/ovok-sink.js +12 -1
- package/lib/commonjs/modules/next/bluetooth/react-native/ovok-sink.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/readings.js +2 -1
- package/lib/commonjs/modules/next/bluetooth/readings.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/stable-hash.js +16 -7
- package/lib/commonjs/modules/next/bluetooth/stable-hash.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/hooks/runtime-context.js.map +1 -1
- package/lib/module/modules/bt-management/index.js +1 -0
- package/lib/module/modules/bt-management/index.js.map +1 -1
- package/lib/module/modules/bt-management/services/bt-manager.js +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 +19 -3
- 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.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/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/result-identity.js +24 -12
- package/lib/module/modules/bt-management/utils/result-identity.js.map +1 -1
- 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/bluetooth/ble-plx/ble-link.js +41 -4
- package/lib/module/modules/next/bluetooth/ble-plx/ble-link.js.map +1 -1
- package/lib/module/modules/next/bluetooth/connections.js +4 -0
- package/lib/module/modules/next/bluetooth/connections.js.map +1 -1
- package/lib/module/modules/next/bluetooth/driver.js +6 -0
- package/lib/module/modules/next/bluetooth/driver.js.map +1 -1
- package/lib/module/modules/next/bluetooth/react-native/ovok-sink.js +12 -1
- package/lib/module/modules/next/bluetooth/react-native/ovok-sink.js.map +1 -1
- package/lib/module/modules/next/bluetooth/readings.js +2 -1
- package/lib/module/modules/next/bluetooth/readings.js.map +1 -1
- package/lib/module/modules/next/bluetooth/stable-hash.js +15 -6
- package/lib/module/modules/next/bluetooth/stable-hash.js.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/hooks/use-sign-in.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/runtime-context.d.ts +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/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 +9 -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.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/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/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/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/bluetooth/ble-plx/ble-link.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/ble-link.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/connections.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/driver.d.ts +6 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/driver.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/link.d.ts +12 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/link.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/react-native/ovok-sink.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/snapshot.d.ts +4 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/snapshot.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/stable-hash.d.ts +5 -2
- package/lib/typescript/commonjs/src/modules/next/bluetooth/stable-hash.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/hooks/use-sign-in.d.ts +1 -1
- package/lib/typescript/module/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/hooks/runtime-context.d.ts +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/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 +9 -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.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/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/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/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/bluetooth/ble-plx/ble-link.d.ts +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/ble-link.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/connections.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/driver.d.ts +6 -1
- package/lib/typescript/module/src/modules/next/bluetooth/driver.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/link.d.ts +12 -1
- package/lib/typescript/module/src/modules/next/bluetooth/link.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/react-native/ovok-sink.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/snapshot.d.ts +4 -1
- package/lib/typescript/module/src/modules/next/bluetooth/snapshot.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/stable-hash.d.ts +5 -2
- package/lib/typescript/module/src/modules/next/bluetooth/stable-hash.d.ts.map +1 -1
- package/package.json +1 -1
package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MeasurementTypeKey","byteToHex","
|
|
1
|
+
{"version":3,"names":["MeasurementTypeKey","byteToHex","defineCustomDevice","glucoseRecordDetails","hasUnusableSensorStatus","BASE_TIME_INDEX","byte","concentrationIndex","FLAG_CONCENTRATION","FLAG_MOL_PER_L","FLAG_TIME_OFFSET","TIME_OFFSET_INDEX","typeAndLocationFromGlucoseFrame","createGlucoseSequencer","GLUCOSE_MEASUREMENT_UUID","GLUCOSE_SERVICE_UUID","RECORD_ACCESS_CONTROL_POINT_UUID","littleEndian","MG_PER_DL_PER_KG_PER_L","MG_PER_DL_PER_MOL_PER_L","MG_PER_DL_DECIMALS","CONTROL_SOLUTION_TYPE","CONTROL_SOLUTION_LOCATION","ALL_FLAGS","Array","from","length","_","flags","glucoseField","index","scale","decimals","recordedAtFromGlucoseFrame","frame","parts","i","undefined","some","part","yearLow","yearHigh","month","day","hour","minute","second","year","recordedAt","Date","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","low","high","offsetMinutes","setMinutes","isControlSolution","typeAndLocation","standardGlucoseDevice","params","id","bloodGlucose","nameMatch","matchByService","oneReadingPerConnection","stuckDataTimeoutMs","services","uuid","monitor","minLengthBytes","caseSelectorBytes","cases","map","selector","kind","measurementTypeKey","fields","description","createCommandSequencer","decorateReading","reading","recordOffset","decorated"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/standard-gatt/standard-gatt.glucose.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,iBAAiB;AAIpD,SAASC,SAAS,QAAQ,gCAA6B;AACvD,SAASC,kBA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rD,0BAA0B,EAAE6B,qBAAqB","ignoreList":[]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { sentryLogger } from "../../helpers/utils/sentry-logger.js";
|
|
4
|
+
import { toBluetoothError } from "../types/bluetooth-error.js";
|
|
5
|
+
const parseCursor = stored => {
|
|
6
|
+
const parsed = Number.parseInt(stored ?? "", 10);
|
|
7
|
+
return Number.isSafeInteger(parsed) && parsed >= 0 ? parsed : undefined;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The number of the newest stored record read from one device, kept in `storage` so the next
|
|
12
|
+
* connection asks the device for newer records only. Without storage it forgets on disconnect.
|
|
13
|
+
*/
|
|
14
|
+
class RecordCursor {
|
|
15
|
+
writing = false;
|
|
16
|
+
changedWhileWriting = false;
|
|
17
|
+
constructor(storage, key) {
|
|
18
|
+
this.storage = storage;
|
|
19
|
+
this.key = key;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** What an earlier connection stored; nothing, an unreadable value or a failing store gives `undefined`. */
|
|
23
|
+
load = async () => {
|
|
24
|
+
try {
|
|
25
|
+
this.newest = parseCursor(await this.storage?.getItem(this.key));
|
|
26
|
+
} catch (error) {
|
|
27
|
+
sentryLogger("error", "RECORD_CURSOR: Could not read the stored cursor", {
|
|
28
|
+
errorCode: toBluetoothError(error).code
|
|
29
|
+
});
|
|
30
|
+
this.newest = undefined;
|
|
31
|
+
}
|
|
32
|
+
return this.newest;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** Remembers a record number that is newer than any seen; writes to the store are coalesced. */
|
|
36
|
+
advance = recordNumber => {
|
|
37
|
+
if (this.newest !== undefined && recordNumber <= this.newest) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
this.newest = recordNumber;
|
|
41
|
+
void this.persist();
|
|
42
|
+
};
|
|
43
|
+
persist = async () => {
|
|
44
|
+
if (this.writing) {
|
|
45
|
+
this.changedWhileWriting = true;
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
this.writing = true;
|
|
49
|
+
do {
|
|
50
|
+
this.changedWhileWriting = false;
|
|
51
|
+
await this.store();
|
|
52
|
+
} while (this.changedWhileWriting);
|
|
53
|
+
this.writing = false;
|
|
54
|
+
};
|
|
55
|
+
store = async () => {
|
|
56
|
+
try {
|
|
57
|
+
await this.storage?.setItem(this.key, String(this.newest));
|
|
58
|
+
} catch (error) {
|
|
59
|
+
sentryLogger("error", "RECORD_CURSOR: Could not store the cursor", {
|
|
60
|
+
errorCode: toBluetoothError(error).code
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export { RecordCursor };
|
|
66
|
+
//# sourceMappingURL=record-cursor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["sentryLogger","toBluetoothError","parseCursor","stored","parsed","Number","parseInt","isSafeInteger","undefined","RecordCursor","writing","changedWhileWriting","constructor","storage","key","load","newest","getItem","error","errorCode","code","advance","recordNumber","persist","store","setItem","String"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/services/record-cursor.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,sCAAmC;AAEhE,SAASC,gBAAgB,QAAQ,6BAA0B;AAE3D,MAAMC,WAAW,GAAIC,MAAiC,IAAyB;EAC7E,MAAMC,MAAM,GAAGC,MAAM,CAACC,QAAQ,CAACH,MAAM,IAAI,EAAE,EAAE,EAAE,CAAC;EAEhD,OAAOE,MAAM,CAACE,aAAa,CAACH,MAAM,CAAC,IAAIA,MAAM,IAAI,CAAC,GAAGA,MAAM,GAAGI,SAAS;AACzE,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMC,YAAY,CAAC;EAETC,OAAO,GAAG,KAAK;EACfC,mBAAmB,GAAG,KAAK;EAE5BC,WAAWA,CACCC,OAA0C,EAC1CC,GAAW,EAC5B;IAAA,KAFiBD,OAA0C,GAA1C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AOE,KAAK,EAAE;MACdlB,YAAY,CAAC,OAAO,EAAE,2CAA2C,EAAE;QACjEmB,SAAS,EAAElB,gBAAgB,CAACiB,KAAK,CAAC,CAACE;MACrC,CAAC,CAAC;IACJ;EACF,CAAC;AACH;AAEA,SAASX,YAAY","ignoreList":[]}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
/* eslint-disable import/group-exports */
|
|
4
4
|
|
|
5
|
+
import { Buffer } from "buffer";
|
|
5
6
|
import { State } from "react-native-ble-plx";
|
|
6
7
|
|
|
7
8
|
/** Options for `createFakeBleDevice`. */
|
|
@@ -13,6 +14,8 @@ import { State } from "react-native-ble-plx";
|
|
|
13
14
|
/** A deterministic BLE manager for hook and scan integration tests. No hardware is used. */
|
|
14
15
|
|
|
15
16
|
const characteristicKey = (serviceUuid, characteristicUuid) => `${serviceUuid}/${characteristicUuid}`;
|
|
17
|
+
const NOTIFICATIONS_ENABLED = Buffer.from([0x01, 0x00]).toString("base64");
|
|
18
|
+
const NOTIFICATIONS_DISABLED = Buffer.from([0x00, 0x00]).toString("base64");
|
|
16
19
|
|
|
17
20
|
/** Creates a GATT-capable fake device for connection and notification tests. */
|
|
18
21
|
export const createFakeBleDevice = ({
|
|
@@ -27,6 +30,7 @@ export const createFakeBleDevice = ({
|
|
|
27
30
|
let connected = false;
|
|
28
31
|
let currentMtu = mtu;
|
|
29
32
|
const values = new Map(Object.entries(characteristics));
|
|
33
|
+
const monitoredKeys = new Set();
|
|
30
34
|
const disconnectedCallbacks = new Set();
|
|
31
35
|
const notificationCallbacks = new Map();
|
|
32
36
|
const fake = {
|
|
@@ -62,8 +66,12 @@ export const createFakeBleDevice = ({
|
|
|
62
66
|
readCharacteristicForService: async (serviceUuid, characteristicUuid) => ({
|
|
63
67
|
value: values.get(characteristicKey(serviceUuid, characteristicUuid)) ?? null
|
|
64
68
|
}),
|
|
69
|
+
readDescriptorForService: async (serviceUuid, characteristicUuid) => ({
|
|
70
|
+
value: monitoredKeys.has(characteristicKey(serviceUuid, characteristicUuid)) ? NOTIFICATIONS_ENABLED : NOTIFICATIONS_DISABLED
|
|
71
|
+
}),
|
|
65
72
|
monitorCharacteristicForService: (serviceUuid, characteristicUuid, callback) => {
|
|
66
73
|
const key = characteristicKey(serviceUuid, characteristicUuid);
|
|
74
|
+
monitoredKeys.add(key);
|
|
67
75
|
const callbacks = notificationCallbacks.get(key) ?? new Set();
|
|
68
76
|
callbacks.add(callback);
|
|
69
77
|
notificationCallbacks.set(key, callbacks);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["State","characteristicKey","serviceUuid","characteristicUuid","createFakeBleDevice","id","name","localName","manufacturerData","serviceUUIDs","mtu","characteristics","connected","currentMtu","values","Map","Object","entries","
|
|
1
|
+
{"version":3,"names":["Buffer","State","characteristicKey","serviceUuid","characteristicUuid","NOTIFICATIONS_ENABLED","from","toString","NOTIFICATIONS_DISABLED","createFakeBleDevice","id","name","localName","manufacturerData","serviceUUIDs","mtu","characteristics","connected","currentMtu","values","Map","Object","entries","monitoredKeys","Set","disconnectedCallbacks","notificationCallbacks","fake","isConnected","connect","cancelConnection","forEach","callback","discoverAllServicesAndCharacteristics","onDisconnected","add","remove","delete","requestMTU","requestedMtu","readCharacteristicForService","value","get","readDescriptorForService","has","monitorCharacteristicForService","key","callbacks","set","writeCharacteristicWithResponseForService","writeCharacteristicWithoutResponseForService","device","emitCharacteristic","characteristic","uuid","disconnect","createFakeBleManager","state","PoweredOn","devices","currentState","scanCallback","stateCallbacks","scannedServiceUUIDs","manager","onStateChange","emitCurrentState","startDeviceScan","_options","stopDeviceScan","undefined","createDevice","emitDevice","emitError","error","setState","nextState","getScannedServiceUUIDs"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/testing/fake-ble-manager.ts"],"mappings":";;AAAA;;AAEA,SAASA,MAAM,QAAQ,QAAQ;AAE/B,SAA6BC,KAAK,QAAsB,sBAAsB;;AAE9E;;AAyBA;;AAiBA;;AAUA;;A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H,QAAQ,CAAC;MAC5B,IAAIkC,gBAAgB,EAAE;QACpBlC,QAAQ,CAAC4B,YAAY,CAAC;MACxB;MAEA,OAAO;QACLxB,MAAM,EAAEA,CAAA,KAAM0B,cAAc,CAACzB,MAAM,CAACL,QAAQ;MAC9C,CAAC;IACH,CAAC;IACDmC,eAAe,EAAEA,CACfrD,YAAsC,EACtCsD,QAAiB,EACjBpC,QAAsD,KACnD;MACH+B,mBAAmB,GAAGjD,YAAY;MAClC+C,YAAY,GAAG7B,QAAQ;MACvB2B,OAAO,CAAC5B,OAAO,CAAEoB,MAAM,IAAKnB,QAAQ,CAAC,IAAI,EAAEmB,MAAM,CAAC,CAAC;IACrD,CAAC;IACDkB,cAAc,EAAEA,CAAA,KAAM;MACpBR,YAAY,GAAGS,SAAS;IAC1B;EACF,CAA0B;EAE1B,OAAO;IACLN,OAAO;IACPO,YAAY,EAAE9D,mBAAmB;IACjC+D,UAAU,EAAGrB,MAAM,IAAKU,YAAY,GAAG,IAAI,EAAEV,MAAM,CAAC;IACpDsB,SAAS,EAAGC,KAAK,IACfb,YAAY,GAAGa,KAAK,EAAW,IAAI,CAAC;IACtCC,QAAQ,EAAGC,SAAS,IAAK;MACvBhB,YAAY,GAAGgB,SAAS;MACxBd,cAAc,CAAC/B,OAAO,CAAEC,QAAQ,IAAKA,QAAQ,CAAC4C,SAAS,CAAC,CAAC;IAC3D,CAAC;IACDC,sBAAsB,EAAEA,CAAA,KAAMd,mBAAmB;IACjDM,cAAc,EAAEA,CAAA,KAAML,OAAO,CAACK,cAAc,CAAC;EAC/C,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -8,6 +8,10 @@ import { CUSTOM_DEVICE_BRAND } from "../constants/custom-device-brand.js";
|
|
|
8
8
|
|
|
9
9
|
/** Creates the per-device `CustomFrameHandler`. */
|
|
10
10
|
|
|
11
|
+
/** What a declaration's command sequencer is told about the device it is about to drive. */
|
|
12
|
+
|
|
13
|
+
/** Creates the command sequencer of one connection, for a declaration whose commands depend on the device or on stored state. */
|
|
14
|
+
|
|
11
15
|
/**
|
|
12
16
|
* A validated, ready-to-run custom device. Only defineCustomDevice produces one.
|
|
13
17
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CUSTOM_DEVICE_BRAND"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/types/custom-device-definition.ts"],"mappings":";;AAEA,SAASA,mBAAmB,QAAQ,qCAAkC;;
|
|
1
|
+
{"version":3,"names":["CUSTOM_DEVICE_BRAND"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/types/custom-device-definition.ts"],"mappings":";;AAEA,SAASA,mBAAmB,QAAQ,qCAAkC;;AAiBtE;;AAeA;;AAGA;;AAGA;;AAUA;;AAGA;AACA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["modules/bt-management/types/glucose-record-details.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -2,20 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
/* eslint-disable import/group-exports */
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { isTimestamped } from "../../next/bluetooth/driver.js";
|
|
6
|
+
import { instantStableHash, stableHash } from "../../next/bluetooth/stable-hash.js";
|
|
7
|
+
/** Reading properties added after result ids were first issued; leaving them out keeps every earlier id. */
|
|
8
|
+
const ADDED_READING_PROPERTIES = new Set(["sequenceNumber", "specimen", "sampleLocation", "sensorStatus", "outOfRange", "meal", "reportedUnit", "temperatureType", "rrIntervals"]);
|
|
9
|
+
const identifyingData = data => Object.fromEntries(Object.entries(data).filter(([key]) => !ADDED_READING_PROPERTIES.has(key)));
|
|
10
|
+
const deviceIdentityOf = deviceData => deviceData.sn || deviceData.manufacturerData || deviceData.model || deviceData.name || deviceData.id;
|
|
11
|
+
|
|
6
12
|
/**
|
|
7
|
-
* Creates an identity that is stable when a device sends its stored history again.
|
|
8
|
-
*
|
|
9
|
-
* delivery metadata is deliberately not part of the key.
|
|
13
|
+
* Creates an identity that is stable when a device sends its stored history again, in any time zone. A reading
|
|
14
|
+
* without a time of its own is a new measurement each time, so it is told apart by when it arrived.
|
|
10
15
|
*/
|
|
11
|
-
export const createStableResultId = (deviceData, data) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
})
|
|
18
|
-
}
|
|
16
|
+
export const createStableResultId = (deviceData, data, receivedAt = new Date()) => `ovok:${stableHash({
|
|
17
|
+
device: deviceIdentityOf(deviceData),
|
|
18
|
+
name: deviceData.name,
|
|
19
|
+
data: identifyingData(data),
|
|
20
|
+
...(isTimestamped(data) ? {} : {
|
|
21
|
+
receivedAt: receivedAt.toISOString()
|
|
22
|
+
})
|
|
23
|
+
})}`;
|
|
24
|
+
|
|
25
|
+
/** The id SDKs before 1.16.1 gave the same reading, to find what they saved. */
|
|
26
|
+
export const createLegacyResultId = (deviceData, data) => `ovok:${instantStableHash({
|
|
27
|
+
device: deviceIdentityOf(deviceData),
|
|
28
|
+
name: deviceData.name,
|
|
29
|
+
data: identifyingData(data)
|
|
30
|
+
})}`;
|
|
19
31
|
|
|
20
32
|
/** Converts the ISO date strings of `recordedAt`, `start` and `end` fields back to `Date`s, recursively. */
|
|
21
33
|
export const reviveResultDates = value => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["stableHash","
|
|
1
|
+
{"version":3,"names":["isTimestamped","instantStableHash","stableHash","ADDED_READING_PROPERTIES","Set","identifyingData","data","Object","fromEntries","entries","filter","key","has","deviceIdentityOf","deviceData","sn","manufacturerData","model","name","id","createStableResultId","receivedAt","Date","device","toISOString","createLegacyResultId","reviveResultDates","value","revive","current","includes","date","Number","isNaN","getTime","Array","isArray","map","item","childKey","childValue"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/utils/result-identity.ts"],"mappings":";;AAAA;;AAIA,SAASA,aAAa,QAAQ,gCAA6B;AAC3D,SAASC,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,IAAI;AAC5B,CAAC,CAAC,EAAE;;AAEN;AACA,OAAO,MAAMoB,iBAAiB,GAAOC,KAAQ,IAAQ;EACnD,MAAMC,MAAM,GAAGA,CAACC,OAAgB,EAAElB,GAAY,KAAc;IAC1D,IACE,OAAOkB,OAAO,KAAK,QAAQ,IAC3B,CAAC,YAAY,EAAE,OAAO,EAAE,KAAK,CAAC,CAACC,QAAQ,CAACnB,GAAG,IAAI,EAAE,CAAC,EAClD;MACA,MAAMoB,IAAI,GAAG,IAAIT,IAAI,CAACO,OAAO,CAAC;MAE9B,OAAOG,MAAM,CAACC,KAAK,CAACF,IAAI,CAACG,OAAO,CAAC,CAAC,CAAC,GAAGL,OAAO,GAAGE,IAAI;IACtD;IAEA,IAAII,KAAK,CAACC,OAAO,CAACP,OAAO,CAAC,EAAE;MAC1B,OAAOA,OAAO,CAACQ,GAAG,CAAEC,IAAI,IAAKV,MAAM,CAACU,IAAI,CAAC,CAAC;IAC5C;IAEA,IAAIT,OAAO,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;MAC1C,OAAOtB,MAAM,CAACC,WAAW,CACvBD,MAAM,CAACE,OAAO,CAACoB,OAAO,CAAC,CAACQ,GAAG,CAAC,CAAC,CAACE,QAAQ,EAAEC,UAAU,CAAC,KAAK,CACtDD,QAAQ,EACRX,MAAM,CAACY,UAAU,EAAED,QAAQ,CAAC,CAC7B,CACH,CAAC;IACH;IAEA,OAAOV,OAAO;EAChB,CAAC;EAED,OAAOD,MAAM,CAACD,KAAK,CAAC;AACtB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["wait","milliseconds","Promise","resolve","setTimeout"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/utils/wait.ts"],"mappings":";;AAAA;AACA,OAAO,MAAMA,IAAI,GAAIC,YAAoB,IACvC,IAAIC,OAAO,CAAEC,OAAO,IAAKC,UAAU,CAACD,OAAO,EAAEF,YAAY,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
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";
|
|
3
6
|
import { sentryLogger } from "../../../helpers/utils/sentry-logger.js";
|
|
4
7
|
import { Channel } from "../channel.js";
|
|
5
8
|
import { fromBleError } from "./ble-errors.js";
|
|
@@ -50,13 +53,33 @@ async function connectWithRetries(device, signal) {
|
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
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
|
+
}
|
|
53
73
|
class BleLink {
|
|
54
74
|
channels = new Set();
|
|
75
|
+
notificationsPending = new Set();
|
|
55
76
|
ended = false;
|
|
56
77
|
closeOnAbort = () => void this.close();
|
|
57
|
-
constructor(device, signal) {
|
|
78
|
+
constructor(device, signal, pairing, deviceInformation) {
|
|
58
79
|
this.device = device;
|
|
59
80
|
this.signal = signal;
|
|
81
|
+
this.pairing = pairing;
|
|
82
|
+
this.deviceInformation = deviceInformation;
|
|
60
83
|
this.disconnected = device.onDisconnected(() => this.endAll());
|
|
61
84
|
signal.addEventListener("abort", this.closeOnAbort, {
|
|
62
85
|
once: true
|
|
@@ -75,13 +98,15 @@ class BleLink {
|
|
|
75
98
|
}
|
|
76
99
|
});
|
|
77
100
|
this.channels.add(channel);
|
|
101
|
+
this.awaitNotifications(service, characteristic);
|
|
78
102
|
if (this.ended) {
|
|
79
103
|
channel.end();
|
|
80
104
|
}
|
|
81
105
|
return channel;
|
|
82
106
|
}
|
|
83
107
|
async write(service, characteristic, bytes) {
|
|
84
|
-
await this.
|
|
108
|
+
await Promise.all(this.notificationsPending);
|
|
109
|
+
await this.pairing.run(() => this.device.writeCharacteristicWithResponseForService(service, characteristic, toBase64(bytes)));
|
|
85
110
|
}
|
|
86
111
|
async close() {
|
|
87
112
|
this.signal.removeEventListener("abort", this.closeOnAbort);
|
|
@@ -89,6 +114,15 @@ class BleLink {
|
|
|
89
114
|
this.disconnected.remove();
|
|
90
115
|
await this.device.cancelConnection().catch(() => undefined);
|
|
91
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
|
+
}
|
|
92
126
|
endOrFail(channel, error) {
|
|
93
127
|
if (ENDS_THE_LINK.has(error.errorCode)) {
|
|
94
128
|
channel.end();
|
|
@@ -102,13 +136,16 @@ class BleLink {
|
|
|
102
136
|
}
|
|
103
137
|
}
|
|
104
138
|
|
|
105
|
-
/** Connects (retrying with backoff) and
|
|
139
|
+
/** Connects (retrying with backoff), discovers services and reads Device Information; aborting `signal` closes the link. */
|
|
106
140
|
async function openBleLink(device, signal) {
|
|
107
141
|
await connectWithRetries(device, signal).catch(error => {
|
|
108
142
|
throw fromBleError(error);
|
|
109
143
|
});
|
|
144
|
+
const pairing = new BTPairingRetry(device, () => sentryLogger("info", "BLUETOOTH: Waiting for the user to pair the device"));
|
|
145
|
+
let information;
|
|
110
146
|
try {
|
|
111
147
|
await device.discoverAllServicesAndCharacteristics();
|
|
148
|
+
information = await readInformation(device, pairing);
|
|
112
149
|
if (signal.aborted) {
|
|
113
150
|
throw abortReason(signal);
|
|
114
151
|
}
|
|
@@ -116,7 +153,7 @@ async function openBleLink(device, signal) {
|
|
|
116
153
|
await device.cancelConnection().catch(() => undefined);
|
|
117
154
|
throw fromBleError(error);
|
|
118
155
|
}
|
|
119
|
-
return new BleLink(device, signal);
|
|
156
|
+
return new BleLink(device, signal, pairing, information);
|
|
120
157
|
}
|
|
121
158
|
export { openBleLink };
|
|
122
159
|
//# sourceMappingURL=ble-link.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["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","BleLink","channels","ended","closeOnAbort","close","constructor","disconnected","onDisconnected","endAll","subscribe","service","characteristic","channel","subscription","remove","delete","monitorCharacteristicForService","value","endOrFail","push","add","end","write","writeCharacteristicWithResponseForService","cancelConnection","catch","undefined","has","fail","forEach","openBleLink","discoverAllServicesAndCharacteristics"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/ble-plx/ble-link.ts"],"mappings":";;AAEA,SAASA,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,G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AAM,CAACQ,OAAO,EAAE;MAClB,MAAMT,WAAW,CAACC,MAAM,CAAC;IAC3B;IAEA,IAAI;MACF,IAAI,EAAE,MAAMgB,MAAM,CAACC,WAAW,CAAC,CAAC,CAAC,EAAE;QACjC,MAAMD,MAAM,CAACE,OAAO,CAAC,CAAC;MACxB;MAEA;IACF,CAAC,CAAC,OAAOC,KAAK,EAAE;MACd,IAAIvB,OAAO,IAAIlB,gBAAgB,EAAE;QAC/BH,YAAY,CAAC,OAAO,EAAE,8BAA8B,EAAE;UACpD6C,SAAS,EAAE3C,YAAY,CAAC0C,KAAK,CAAC,CAACE,IAAI;UACnCC,QAAQ,EAAE1B;QACZ,CAAC,CAAC;QACF,MAAMuB,KAAK;MACb;MAEA,MAAMhB,IAAI,CAACR,UAAU,CAACC,OAAO,CAAC,EAAEI,MAAM,CAAC;IACzC;EACF;AACF;AAEA,
|
|
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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 @@ class Connections {
|
|
|
90
90
|
this.store.updateDevice(id, {
|
|
91
91
|
connection: event.status
|
|
92
92
|
});
|
|
93
|
+
} else if (event.kind === "information") {
|
|
94
|
+
this.store.updateDevice(id, {
|
|
95
|
+
information: event.information
|
|
96
|
+
});
|
|
93
97
|
} else if (event.kind === "reading") {
|
|
94
98
|
const device = this.store.device(id);
|
|
95
99
|
if (device) {
|
|
@@ -1 +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","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,GAApBA,MAAoB;IAAA,KACpBC,OAA6B,GAA7BA,OAA6B;EAC7C;EAEIC,QAAQA,CAACC,EAAU,EAAW;IACnC,OAAO,IAAI,CAACR,QAAQ,CAACS,GAAG,CAACD,EAAE,CAAC;EAC9B;;EAEA;EACA,MAAaE,OAAOA,CAACC,UAAsB,EAAEC,MAAc,EAAiB;IA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MAAM,CAAC,EAAE,IAAI,CAACX,MAAM,CAAC,EAAE;MAC/E,IAAI,CAACyC,KAAK,CAACnC,UAAU,CAACH,EAAE,EAAEqC,KAAK,EAAEzB,SAAS,CAAC;IAC7C;EACF;EAEQ0B,KAAKA,CAACtC,EAAU,EAAEqC,KAAkB,EAAEzB,SAAqB,EAAQ;IACzE,IAAIyB,KAAK,CAACE,IAAI,KAAK,QAAQ,EAAE;MAC3B,IAAIF,KAAK,CAACG,MAAM,KAAK,cAAc,EAAE;QACnC5B,SAAS,CAAC,CAAC;MACb;MACA,IAAI,CAACjB,KAAK,CAACgC,YAAY,CAAC3B,EAAE,EAAE;QAAE4B,UAAU,EAAES,KAAK,CAACG;MAAO,CAAC,CAAC;IAC3D,CAAC,MAAM,IAAIH,KAAK,CAACE,IAAI,KAAK,SAAS,EAAE;MACnC,
|
|
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,Q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YAAY,CAAC3B,EAAE,EAAE;QAAE6B,KAAK,EAAEQ,KAAK,CAACR;MAAM,CAAC,CAAC;IACrD;EACF;AACF;AAEA,SAAStC,WAAW","ignoreList":[]}
|
|
@@ -29,6 +29,12 @@ const gattDriver = (key, protocol) => async function* (peripheral, signal) {
|
|
|
29
29
|
kind: "status",
|
|
30
30
|
status: "connected"
|
|
31
31
|
};
|
|
32
|
+
if (link.deviceInformation) {
|
|
33
|
+
yield {
|
|
34
|
+
kind: "information",
|
|
35
|
+
information: link.deviceInformation
|
|
36
|
+
};
|
|
37
|
+
}
|
|
32
38
|
for await (const reading of protocol(link)) {
|
|
33
39
|
yield {
|
|
34
40
|
kind: "reading",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["stableHash","isTimestamped","reading","temporal","recordedAt","start","end","some","value","Date","readingId","key","peripheral","id","gattDriver","protocol","signal","link","openLink","kind","status","close"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/driver.ts"],"mappings":";;AAIA,SAASA,UAAU,QAAQ,kBAAe;;AAG1C;;
|
|
1
|
+
{"version":3,"names":["stableHash","isTimestamped","reading","temporal","recordedAt","start","end","some","value","Date","readingId","key","peripheral","id","gattDriver","protocol","signal","link","openLink","kind","status","deviceInformation","information","close"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/driver.ts"],"mappings":";;AAIA,SAASA,UAAU,QAAQ,kBAAe;;AAG1C;;AAsCA;;AAGA;;AAGA;AACA,MAAMC,aAAa,GAAIC,OAAoB,IAAc;EACvD,MAAMC,QAAQ,GAAGD,OAAmE;EAEpF,OAAO,CAACC,QAAQ,CAACC,UAAU,EAAED,QAAQ,CAACE,KAAK,EAAEF,QAAQ,CAACG,GAAG,CAAC,CAACC,IAAI,CAAEC,KAAK,IAAKA,KAAK,YAAYC,IAAI,CAAC;AACnG,CAAC;;AAED;AACA,MAAMC,SAAS,GAAGA,CAACC,GAAW,EAAEC,UAAsB,EAAEV,OAAoB,KAC1ED,aAAa,CAACC,OAAO,CAAC,GAAG,QAAQF,UAAU,CAAC;EAAEW,GAAG;EAAEC,UAAU,EAAEA,UAAU,CAACC,EAAE;EAAEX;AAAQ,CAAC,CAAC,EAAE,GAAG,IAAI;;AAEnG;AACA,MAAMY,UAAU,GAAGA,CAACH,GAAW,EAAEI,QAAwB,KACvD,iBAAiBH,UAAU,EAAEI,MAAM,EAAE;EACnC,MAAMC,IAAI,GAAG,MAAML,UAAU,CAACM,QAAQ,CAACF,MAAM,CAAC;EAE9C,IAAI;IACF,MAAM;MAAEG,IAAI,EAAE,QAAQ;MAAEC,MAAM,EAAE;IAAY,CAAC;IAC7C,IAAIH,IAAI,CAACI,iBAAiB,EAAE;MAC1B,MAAM;QAAEF,IAAI,EAAE,aAAa;QAAEG,WAAW,EAAEL,IAAI,CAACI;MAAkB,CAAC;IACpE;IACA,WAAW,MAAMnB,OAAO,IAAIa,QAAQ,CAACE,IAAI,CAAC,EAAE;MAC1C,MAAM;QAAEE,IAAI,EAAE,SAAS;QAAEN,EAAE,EAAEH,SAAS,CAACC,GAAG,EAAEC,UAAU,EAAEV,OAAO,CAAC;QAAEA;MAAQ,CAAC;IAC7E;IACA,MAAM;MAAEiB,IAAI,EAAE,QAAQ;MAAEC,MAAM,EAAE;IAAe,CAAC;EAClD,CAAC,SAAS;IACR,MAAMH,IAAI,CAACM,KAAK,CAAC,CAAC;EACpB;AACF,CAAC;AAEH,SAAST,UAAU,EAAEb,aAAa","ignoreList":[]}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
/** The time the device took the reading, when it reported one. */
|
|
4
|
+
const recordedAtOf = measurement => {
|
|
5
|
+
const {
|
|
6
|
+
recordedAt
|
|
7
|
+
} = measurement;
|
|
8
|
+
return recordedAt instanceof Date && !Number.isNaN(recordedAt.getTime()) ? recordedAt : undefined;
|
|
9
|
+
};
|
|
10
|
+
|
|
3
11
|
/** Saves readings for the signed-in account through the `Ovok` measurements API. */
|
|
4
12
|
const ovokReadingSink = client => ({
|
|
5
13
|
save: async ({
|
|
@@ -10,12 +18,15 @@ const ovokReadingSink = client => ({
|
|
|
10
18
|
const result = await client.measurements.save({
|
|
11
19
|
measurement,
|
|
12
20
|
sourceId: id,
|
|
21
|
+
effectiveDateTime: recordedAtOf(measurement),
|
|
13
22
|
device: {
|
|
14
23
|
id: device.id,
|
|
15
24
|
name: device.key,
|
|
16
25
|
localName: device.name,
|
|
17
26
|
manufacturerData: "",
|
|
18
|
-
|
|
27
|
+
manufacturerName: device.information?.manufacturerName,
|
|
28
|
+
model: device.information?.model,
|
|
29
|
+
sn: device.information?.serialNumber ?? ""
|
|
19
30
|
}
|
|
20
31
|
});
|
|
21
32
|
return result.status === "saved" ? {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ovokReadingSink","client","save","id","device","
|
|
1
|
+
{"version":3,"names":["recordedAtOf","measurement","recordedAt","Date","Number","isNaN","getTime","undefined","ovokReadingSink","client","save","id","device","result","measurements","sourceId","effectiveDateTime","name","key","localName","manufacturerData","manufacturerName","information","model","sn","serialNumber","status","flushQueued","Object","keys","offlineQueue","flush","responses"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/react-native/ovok-sink.ts"],"mappings":";;AAIA;AACA,MAAMA,YAAY,GAAIC,WAAmB,IAAuB;EAC9D,MAAM;IAAEC;EAAW,CAAC,GAAGD,WAAuC;EAE9D,OAAOC,UAAU,YAAYC,IAAI,IAAI,CAACC,MAAM,CAACC,KAAK,CAACH,UAAU,CAACI,OAAO,CAAC,CAAC,CAAC,GAAGJ,UAAU,GAAGK,SAAS;AACnG,CAAC;;AAED;AACA,MAAMC,eAAe,GAAIC,MAAY,KAAmB;EACtDC,IAAI,EAAE,MAAAA,CAAO;IAAEC,EAAE;IAAEC,MAAM;IAAEX;EAAY,CAAC,KAAK;IAC3C,MAAMY,MAAM,GAAG,MAAMJ,MAAM,CAACK,YAAY,CAACJ,IAAI,CAAC;MAC5CT,WAAW;MACXc,QAAQ,EAAEJ,EAAE;MACZK,iBAAiB,EAAEhB,YAAY,CAACC,WAAW,CAAC;MAC5CW,MAAM,EAAE;QACND,EAAE,EAAEC,MAAM,CAACD,EAAE;QACbM,IAAI,EAAEL,MAAM,CAACM,GAAG;QAChBC,SAAS,EAAEP,MAAM,CAACK,IAAI;QACtBG,gBAAgB,EAAE,EAAE;QACpBC,gBAAgB,EAAET,MAAM,CAACU,WAAW,EAAED,gBAAgB;QACtDE,KAAK,EAAEX,MAAM,CAACU,WAAW,EAAEC,KAAK;QAChCC,EAAE,EAAEZ,MAAM,CAACU,WAAW,EAAEG,YAAY,IAAI;MAC1C;IACF,CAAC,CAAC;IAEF,OAAOZ,MAAM,CAACa,MAAM,KAAK,OAAO,GAAG;MAAEA,MAAM,EAAE;IAAQ,CAAC,GAAGb,MAAM;EACjE,CAAC;EACDc,WAAW,EAAE,MAAAA,CAAA,KAAYC,MAAM,CAACC,IAAI,CAAC,CAAC,MAAMpB,MAAM,CAACK,YAAY,CAACgB,YAAY,CAACC,KAAK,CAAC,CAAC,EAAEC,SAAS;AACjG,CAAC,CAAC;AAEF,SAASxB,eAAe","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BluetoothError","KEPT_READINGS","RECOGNISED_READINGS","saveFailed","error","Error","message","String","ReadingLog","recent","Set","sequence","constructor","store","sink","receive","device","id","measurement","remember","receivedAt","Date","reading","getTime","key","name","save","status","set","readings","get","slice","retrySaves","failed","filter","updateReadings","includes","Promise","all","map","flushed","flushQueued","has","queueId","add","size","delete","values","next","value","then","result","current"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/readings.ts"],"mappings":";;AAEA,SAASA,cAAc,QAAQ,aAAU;AAKzC,MAAMC,aAAa,GAAG,GAAG;;AAEzB;AACA,MAAMC,mBAAmB,GAAG,KAAK;AAEjC,MAAMC,UAAU,GAAIC,KAAc,IAChC,IAAIJ,cAAc,CAAC,aAAa,EAAEI,KAAK,YAAYC,KAAK,GAAGD,KAAK,CAACE,OAAO,GAAGC,MAAM,CAACH,KAAK,CAAC,EAAEA,KAAK,CAAC;;AAElG;AACA,MAAMI,UAAU,CAAC;EACEC,MAAM,GAAG,IAAIC,GAAG,CAAS,CAAC;EACnCC,QAAQ,GAAG,CAAC;EAEbC,WAAWA,CAAkBC,KAAoB,EAAmBC,IAAiB,EAAE;IAAA,KAA1DD,KAAoB,GAApBA,KAAoB;IAAA,KAAmBC,IAAiB,GAAjBA,IAAiB;EAAG;;EAE/F;EACOC,OAAOA,CAACC,MAAoB,EAAEC,EAAiB,EAAEC,WAAwB,EAAQ;IACtF,IAAID,EAAE,KAAK,IAAI,IAAI,CAAC,IAAI,CAACE,QAAQ,CAACF,EAAE,CAAC,EAAE;MACrC;IACF;IAEA,MAAMG,UAAU,GAAG,IAAIC,IAAI,CAAC,CAAC;IAE7B,MAAMC,OAAsB,GAAG;MAC7BL,EAAE,EAAEA,EAAE,IAAI,GAAGD,MAAM,CAACC,EAAE,IAAIG,UAAU,CAACG,OAAO,CAAC,CAAC,IAAK,IAAI,CAACZ,QAAQ,IAAI,CAAC,EAAG;MACxEK,MAAM,EAAE;QAAEC,EAAE,EAAED,MAAM,CAACC,EAAE;QAAEO,GAAG,EAAER,MAAM,CAACQ,GAAG;QAAEC,IAAI,EAAET,MAAM,CAACS;
|
|
1
|
+
{"version":3,"names":["BluetoothError","KEPT_READINGS","RECOGNISED_READINGS","saveFailed","error","Error","message","String","ReadingLog","recent","Set","sequence","constructor","store","sink","receive","device","id","measurement","remember","receivedAt","Date","reading","getTime","key","name","information","save","status","set","readings","get","slice","retrySaves","failed","filter","updateReadings","includes","Promise","all","map","flushed","flushQueued","has","queueId","add","size","delete","values","next","value","then","result","current"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/readings.ts"],"mappings":";;AAEA,SAASA,cAAc,QAAQ,aAAU;AAKzC,MAAMC,aAAa,GAAG,GAAG;;AAEzB;AACA,MAAM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AM,CAACqC,IAAI,GAAG5C,mBAAmB,EAAE;MAC1C,IAAI,CAACO,MAAM,CAACsC,MAAM,CAAC,IAAI,CAACtC,MAAM,CAACuC,MAAM,CAAC,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,KAAe,CAAC;IACjE;IAEA,OAAO,IAAI;EACb;EAEA,MAAcvB,IAAIA,CAACL,OAAsB,EAAiB;IACxD,MAAMK,IAAe,GAAG,MAAM,IAAI,CAACb,IAAI,CAACa,IAAI,CAACL,OAAO,CAAC,CAAC6B,IAAI,CACvDC,MAAkB,IAAgBA,MAAM,EACxChD,KAAc,KAAiB;MAAEwB,MAAM,EAAE,QAAQ;MAAExB,KAAK,EAAED,UAAU,CAACC,KAAK;IAAE,CAAC,CAChF,CAAC;IAED,IAAI,CAACS,KAAK,CAACuB,cAAc,CAAEiB,OAAO,IAAMA,OAAO,CAACpC,EAAE,KAAKK,OAAO,CAACL,EAAE,GAAG;MAAE,GAAGoC,OAAO;MAAE1B;IAAK,CAAC,GAAG0B,OAAQ,CAAC;EACtG;AACF;AAEA,SAAS7C,UAAU","ignoreList":[]}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const padded = (value, digits = 2) => String(value).padStart(digits, "0");
|
|
4
|
+
|
|
5
|
+
/** The date as a clock on the wall reads it, which a device's stored record keeps in every time zone. */
|
|
6
|
+
const wallClock = date => `${date.getFullYear()}-${padded(date.getMonth() + 1)}-${padded(date.getDate())}T${padded(date.getHours())}:${padded(date.getMinutes())}:${padded(date.getSeconds())}.${padded(date.getMilliseconds(), 3)}`;
|
|
7
|
+
const instant = date => date.toISOString();
|
|
8
|
+
const canonicalize = (value, formatDate) => {
|
|
4
9
|
if (value instanceof Date) {
|
|
5
|
-
return value
|
|
10
|
+
return formatDate(value);
|
|
6
11
|
}
|
|
7
12
|
if (Array.isArray(value)) {
|
|
8
|
-
return value.map(canonicalize);
|
|
13
|
+
return value.map(item => canonicalize(item, formatDate));
|
|
9
14
|
}
|
|
10
15
|
if (value && typeof value === "object") {
|
|
11
|
-
return Object.fromEntries(Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, nested]) => [key, canonicalize(nested)]));
|
|
16
|
+
return Object.fromEntries(Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, nested]) => [key, canonicalize(nested, formatDate)]));
|
|
12
17
|
}
|
|
13
18
|
return value;
|
|
14
19
|
};
|
|
@@ -23,6 +28,10 @@ const hash = value => {
|
|
|
23
28
|
return `${(first >>> 0).toString(16).padStart(8, "0")}${(second >>> 0).toString(16).padStart(8, "0")}`;
|
|
24
29
|
};
|
|
25
30
|
|
|
26
|
-
/** A short hash of `value` that ignores key order
|
|
27
|
-
|
|
31
|
+
/** A short hash of `value` that ignores key order, is the same on every run and reads dates by their wall clock. */
|
|
32
|
+
const stableHash = value => hash(JSON.stringify(canonicalize(value, wallClock)));
|
|
33
|
+
|
|
34
|
+
/** `stableHash` as SDKs before 1.16.1 computed it, reading dates as instants; for finding what they saved. */
|
|
35
|
+
const instantStableHash = value => hash(JSON.stringify(canonicalize(value, instant)));
|
|
36
|
+
export { instantStableHash, stableHash };
|
|
28
37
|
//# sourceMappingURL=stable-hash.js.map
|