@mentra/engine 3.1.0-dev.4 → 3.1.0-dev.40
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/README.md +19 -5
- package/build/bluetooth-sdk/ota-transport.d.ts +2 -0
- package/build/bluetooth-sdk/ota-transport.d.ts.map +1 -0
- package/build/bluetooth-sdk/ota-transport.js +2 -0
- package/build/bluetooth-sdk/ota-transport.js.map +1 -0
- package/build/engine.d.ts +5 -2
- package/build/engine.d.ts.map +1 -1
- package/build/facades/ota.d.ts +9 -6
- package/build/facades/ota.d.ts.map +1 -1
- package/build/facades/ota.js +6 -4
- package/build/facades/ota.js.map +1 -1
- package/build/facades/pairing.d.ts +4 -0
- package/build/facades/pairing.d.ts.map +1 -1
- package/build/facades/pairing.js +81 -7
- package/build/facades/pairing.js.map +1 -1
- package/build/generated/releaseMetadata.js +5 -5
- package/build/generated/releaseMetadata.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js.map +1 -1
- package/build/react/MentraLiveOtaFlow.d.ts +3 -2
- package/build/react/MentraLiveOtaFlow.d.ts.map +1 -1
- package/build/react/MentraLiveOtaFlow.js +113 -352
- package/build/react/MentraLiveOtaFlow.js.map +1 -1
- package/build/react/index.d.ts +1 -0
- package/build/react/index.d.ts.map +1 -1
- package/build/react/index.js +1 -0
- package/build/react/index.js.map +1 -1
- package/build/react/useMentraLiveOta.d.ts +80 -0
- package/build/react/useMentraLiveOta.d.ts.map +1 -0
- package/build/react/useMentraLiveOta.js +550 -0
- package/build/react/useMentraLiveOta.js.map +1 -0
- package/build/services/BlobStore.d.ts +2 -0
- package/build/services/BlobStore.d.ts.map +1 -1
- package/build/services/BlobStore.js +63 -10
- package/build/services/BlobStore.js.map +1 -1
- package/build/services/GlassesStatusProjection.d.ts +15 -2
- package/build/services/GlassesStatusProjection.d.ts.map +1 -1
- package/build/services/GlassesStatusProjection.js +3 -3
- package/build/services/GlassesStatusProjection.js.map +1 -1
- package/build/services/HotspotOtaTransport.d.ts.map +1 -1
- package/build/services/HotspotOtaTransport.js +8 -7
- package/build/services/HotspotOtaTransport.js.map +1 -1
- package/build/services/OtaAutoChain.d.ts +9 -2
- package/build/services/OtaAutoChain.d.ts.map +1 -1
- package/build/services/OtaAutoChain.js +10 -2
- package/build/services/OtaAutoChain.js.map +1 -1
- package/build/services/OtaInstallCoordinator.d.ts +24 -3
- package/build/services/OtaInstallCoordinator.d.ts.map +1 -1
- package/build/services/OtaInstallCoordinator.js +14 -12
- package/build/services/OtaInstallCoordinator.js.map +1 -1
- package/build/services/OtaService.d.ts.map +1 -1
- package/build/services/OtaService.js +1 -1
- package/build/services/OtaService.js.map +1 -1
- package/build/services/OtaUpdateCheckService.d.ts +4 -1
- package/build/services/OtaUpdateCheckService.d.ts.map +1 -1
- package/build/services/OtaUpdateCheckService.js +21 -5
- package/build/services/OtaUpdateCheckService.js.map +1 -1
- package/build/services/asg/localNetworkTransport.d.ts.map +1 -1
- package/build/services/asg/localNetworkTransport.js +13 -12
- package/build/services/asg/localNetworkTransport.js.map +1 -1
- package/build/services/glassesClockSync.js +1 -1
- package/build/services/glassesClockSync.js.map +1 -1
- package/build/services/otaReleaseVersion.d.ts +10 -0
- package/build/services/otaReleaseVersion.d.ts.map +1 -0
- package/build/services/otaReleaseVersion.js +14 -0
- package/build/services/otaReleaseVersion.js.map +1 -0
- package/build/stores/appVisibility.d.ts +3 -0
- package/build/stores/appVisibility.d.ts.map +1 -0
- package/build/stores/appVisibility.js +3 -0
- package/build/stores/appVisibility.js.map +1 -0
- package/build/stores/apps.d.ts.map +1 -1
- package/build/stores/apps.js +7 -1
- package/build/stores/apps.js.map +1 -1
- package/build/stores/core.d.ts +3 -3
- package/build/stores/core.d.ts.map +1 -1
- package/build/stores/core.js.map +1 -1
- package/build/stores/glasses.d.ts +10 -4
- package/build/stores/glasses.d.ts.map +1 -1
- package/build/stores/glasses.js.map +1 -1
- package/package.json +12 -6
- package/src/bluetooth-sdk/ota-transport.ts +1 -0
- package/src/facades/ota.ts +16 -5
- package/src/facades/pairing.ts +88 -12
- package/src/generated/releaseMetadata.ts +5 -5
- package/src/index.ts +1 -0
- package/src/react/MentraLiveOtaFlow.tsx +178 -465
- package/src/react/index.ts +14 -0
- package/src/react/useMentraLiveOta.ts +707 -0
- package/src/services/BlobStore.ts +57 -10
- package/src/services/GlassesStatusProjection.ts +7 -6
- package/src/services/HotspotOtaTransport.ts +8 -7
- package/src/services/OtaAutoChain.ts +26 -2
- package/src/services/OtaInstallCoordinator.ts +16 -13
- package/src/services/OtaService.ts +1 -2
- package/src/services/OtaUpdateCheckService.ts +26 -8
- package/src/services/asg/localNetworkTransport.ts +20 -19
- package/src/services/glassesClockSync.ts +1 -1
- package/src/services/otaReleaseVersion.ts +22 -0
- package/src/stores/appVisibility.ts +3 -0
- package/src/stores/apps.ts +7 -1
- package/src/stores/core.ts +4 -4
- package/src/stores/glasses.ts +13 -6
package/src/facades/pairing.ts
CHANGED
|
@@ -13,6 +13,7 @@ import BluetoothSdk from "@mentra/bluetooth-sdk/internal"
|
|
|
13
13
|
import type {ConnectOptions, Device, DeviceModel, PairFailureEvent, GlassesNotReadyEvent} from "@mentra/bluetooth-sdk"
|
|
14
14
|
import {useCoreStore} from "../stores/core"
|
|
15
15
|
import {useGlassesStore} from "../stores/glasses"
|
|
16
|
+
import {SETTINGS, useSettingsStore} from "../stores/settings"
|
|
16
17
|
import {hasDefaultDevice} from "../services/DeviceStoreHydration"
|
|
17
18
|
import {
|
|
18
19
|
markPendingSelection,
|
|
@@ -20,18 +21,14 @@ import {
|
|
|
20
21
|
subscribePairingIdentity,
|
|
21
22
|
type IdentitySnapshot,
|
|
22
23
|
} from "../services/PairingIdentity"
|
|
23
|
-
import {
|
|
24
|
-
isGlassesConnected,
|
|
25
|
-
isGlassesLinkLayerBusy,
|
|
26
|
-
isGlassesReady,
|
|
27
|
-
waitForGlassesReady,
|
|
28
|
-
} from "../services/GlassesReadiness"
|
|
24
|
+
import {isGlassesConnected, isGlassesLinkLayerBusy, isGlassesReady} from "../services/GlassesReadiness"
|
|
29
25
|
import {
|
|
30
26
|
logAutomaticReportSubmissionStatus,
|
|
31
27
|
toAutomaticReportSubmissionStatus,
|
|
32
28
|
type AutomaticReportSubmissionStatus,
|
|
33
29
|
} from "../services/AutomaticReportResult"
|
|
34
30
|
import {pushAllBluetoothSettings} from "../services/GlassesSettingsSync"
|
|
31
|
+
import {ControllerTypes} from "../types"
|
|
35
32
|
import {submitAutomaticReport} from "./reports"
|
|
36
33
|
|
|
37
34
|
export type {IdentitySnapshot} from "../services/PairingIdentity"
|
|
@@ -60,6 +57,82 @@ function projectReadiness() {
|
|
|
60
57
|
}
|
|
61
58
|
}
|
|
62
59
|
|
|
60
|
+
function projectTargetReady(options: Pick<PairingReadyWaitOptions, "deviceModel" | "deviceName">): boolean {
|
|
61
|
+
const {deviceModel, deviceName} = options
|
|
62
|
+
const glasses = useGlassesStore.getState()
|
|
63
|
+
|
|
64
|
+
if (deviceModel === ControllerTypes.R1) {
|
|
65
|
+
if (!glasses.controllerConnected || !glasses.controllerFullyBooted) return false
|
|
66
|
+
const settings = useSettingsStore.getState()
|
|
67
|
+
const pairedModel = settings.getSetting(SETTINGS.default_controller.key)
|
|
68
|
+
const pairedName = settings.getSetting(SETTINGS.controller_device_name.key)
|
|
69
|
+
return (!deviceModel || pairedModel === deviceModel) && (!deviceName || pairedName === deviceName)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (!isGlassesReady(glasses.connection)) return false
|
|
73
|
+
const identity = projectPairingIdentity()
|
|
74
|
+
if (!deviceModel && !deviceName) return true
|
|
75
|
+
return (
|
|
76
|
+
identity.kind === "paired" &&
|
|
77
|
+
(!deviceModel || identity.model === deviceModel) &&
|
|
78
|
+
(!deviceName || identity.name === deviceName)
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function subscribeTargetReady(
|
|
83
|
+
options: Pick<PairingReadyWaitOptions, "deviceModel" | "deviceName">,
|
|
84
|
+
cb: (ready: boolean) => void,
|
|
85
|
+
): () => void {
|
|
86
|
+
let last = projectTargetReady(options)
|
|
87
|
+
const notify = () => {
|
|
88
|
+
const ready = projectTargetReady(options)
|
|
89
|
+
if (ready === last) return
|
|
90
|
+
last = ready
|
|
91
|
+
cb(ready)
|
|
92
|
+
}
|
|
93
|
+
const unsubscribeGlasses = useGlassesStore.subscribe(notify)
|
|
94
|
+
const unsubscribeSettings = useSettingsStore.subscribe(notify)
|
|
95
|
+
return () => {
|
|
96
|
+
unsubscribeGlasses()
|
|
97
|
+
unsubscribeSettings()
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async function waitForTargetReady(options: PairingReadyWaitOptions, timeoutMs: number): Promise<boolean> {
|
|
102
|
+
return new Promise((resolve) => {
|
|
103
|
+
if (options.signal?.aborted) {
|
|
104
|
+
resolve(false)
|
|
105
|
+
return
|
|
106
|
+
}
|
|
107
|
+
if (projectTargetReady(options)) {
|
|
108
|
+
resolve(true)
|
|
109
|
+
return
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
let settled = false
|
|
113
|
+
let timeout: ReturnType<typeof setTimeout> | null = null
|
|
114
|
+
let unsubscribe: (() => void) | null = null
|
|
115
|
+
let onAbort: (() => void) | null = null
|
|
116
|
+
const finish = (ready: boolean) => {
|
|
117
|
+
if (settled) return
|
|
118
|
+
settled = true
|
|
119
|
+
if (timeout) clearTimeout(timeout)
|
|
120
|
+
if (unsubscribe) unsubscribe()
|
|
121
|
+
if (onAbort && options.signal) options.signal.removeEventListener("abort", onAbort)
|
|
122
|
+
resolve(ready)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
unsubscribe = subscribeTargetReady(options, (ready) => {
|
|
126
|
+
if (ready) finish(true)
|
|
127
|
+
})
|
|
128
|
+
if (options.signal) {
|
|
129
|
+
onAbort = () => finish(false)
|
|
130
|
+
options.signal.addEventListener("abort", onAbort)
|
|
131
|
+
}
|
|
132
|
+
timeout = setTimeout(() => finish(projectTargetReady(options)), timeoutMs)
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
|
|
63
136
|
export type PairingReadinessSnapshot = ReturnType<typeof projectReadiness>
|
|
64
137
|
|
|
65
138
|
export async function submitPairingBootTimeoutReport(params: {
|
|
@@ -108,12 +181,7 @@ async function waitForReadyDuringPairing(options: PairingReadyWaitOptions = {}):
|
|
|
108
181
|
})
|
|
109
182
|
|
|
110
183
|
try {
|
|
111
|
-
const ready = await
|
|
112
|
-
getConnection: () => useGlassesStore.getState().connection,
|
|
113
|
-
subscribe: (listener) => useGlassesStore.subscribe((state) => state.connection, listener),
|
|
114
|
-
timeoutMs,
|
|
115
|
-
signal: options.signal,
|
|
116
|
-
})
|
|
184
|
+
const ready = await waitForTargetReady(options, timeoutMs)
|
|
117
185
|
|
|
118
186
|
if (!ready && !options.signal?.aborted) {
|
|
119
187
|
void submitPairingBootTimeoutReport({
|
|
@@ -193,6 +261,14 @@ export const pairing = {
|
|
|
193
261
|
cb(snap)
|
|
194
262
|
})
|
|
195
263
|
},
|
|
264
|
+
/** Whether the exact wearable or controller selected on the scan screen is ready. */
|
|
265
|
+
targetReady: (options: Pick<PairingReadyWaitOptions, "deviceModel" | "deviceName">): boolean =>
|
|
266
|
+
projectTargetReady(options),
|
|
267
|
+
/** Subscribe to readiness for the exact selected target, excluding stale devices. */
|
|
268
|
+
onTargetReady: (
|
|
269
|
+
options: Pick<PairingReadyWaitOptions, "deviceModel" | "deviceName">,
|
|
270
|
+
cb: (ready: boolean) => void,
|
|
271
|
+
): (() => void) => subscribeTargetReady(options, cb),
|
|
196
272
|
|
|
197
273
|
// --- pairing-identity lifecycle (the PairingIdentity read-model + the JS-owned
|
|
198
274
|
// identity writes; promotion to `paired` only ever happens natively) ---
|
|
@@ -12,9 +12,9 @@ export interface EngineReleaseMetadata {
|
|
|
12
12
|
export const ENGINE_RELEASE_METADATA: Readonly<EngineReleaseMetadata> = Object.freeze({
|
|
13
13
|
"schemaVersion": 1,
|
|
14
14
|
"familyBaseVersion": "3.1.0",
|
|
15
|
-
"releaseIdentity": "3.1.0-dev.
|
|
16
|
-
"releaseSetId": "mentra-3.1.0-dev.
|
|
17
|
-
"sourceCommit": "
|
|
18
|
-
"otaManifestUrl": "https://github.com/Mentra-Community/MentraOS/releases/download/mentra-v3.1.0
|
|
19
|
-
"otaManifestSha256": "
|
|
15
|
+
"releaseIdentity": "3.1.0-dev.40",
|
|
16
|
+
"releaseSetId": "mentra-3.1.0-dev.40",
|
|
17
|
+
"sourceCommit": "b23b9074e8c086564bf685494462e9c90c4da4eb",
|
|
18
|
+
"otaManifestUrl": "https://github.com/Mentra-Community/MentraOS/releases/download/mentra-builds-v3.1.0/mentra-live-ota-3.1.0-dev.40.json",
|
|
19
|
+
"otaManifestSha256": "0fdf4cd8e5aca0a8a2098a056aab0608f65ac76314debe4243fefc7804d04033"
|
|
20
20
|
})
|