@mentra/bluetooth-sdk 3.5.0-dev.1518 → 3.5.0-dev.1519
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/MIGRATION.md +9 -0
- package/README.md +64 -11
- package/android/src/main/java/com/mentra/bluetoothsdk/GeneratedReleaseMetadata.kt +5 -5
- package/android/src/main/java/com/mentra/bluetoothsdk/MentraLocalNetworkModule.kt +10 -0
- package/build/BluetoothSdk.types.d.ts +23 -5
- package/build/BluetoothSdk.types.d.ts.map +1 -1
- package/build/BluetoothSdk.types.js +5 -0
- package/build/BluetoothSdk.types.js.map +1 -1
- package/build/_internal.d.ts +1 -0
- package/build/_internal.d.ts.map +1 -1
- package/build/_internal.js +1 -0
- package/build/_internal.js.map +1 -1
- package/build/_private/BluetoothSdkModule.d.ts.map +1 -1
- package/build/_private/BluetoothSdkModule.js +20 -9
- package/build/_private/BluetoothSdkModule.js.map +1 -1
- package/build/_private/MentraLocalNetworkModule.d.ts +21 -0
- package/build/_private/MentraLocalNetworkModule.d.ts.map +1 -1
- package/build/_private/MentraLocalNetworkModule.js.map +1 -1
- package/build/generated/releaseMetadata.js +5 -5
- package/build/generated/releaseMetadata.js.map +1 -1
- package/build/glasses-wifi/connection.d.ts +6 -0
- package/build/glasses-wifi/connection.d.ts.map +1 -0
- package/build/glasses-wifi/connection.js +44 -0
- package/build/glasses-wifi/connection.js.map +1 -0
- package/build/glasses-wifi/continuous.d.ts +39 -0
- package/build/glasses-wifi/continuous.d.ts.map +1 -0
- package/build/glasses-wifi/continuous.js +151 -0
- package/build/glasses-wifi/continuous.js.map +1 -0
- package/build/glasses-wifi/files.d.ts +11 -0
- package/build/glasses-wifi/files.d.ts.map +1 -0
- package/build/glasses-wifi/files.js +33 -0
- package/build/glasses-wifi/files.js.map +1 -0
- package/build/glasses-wifi/index.d.ts +20 -0
- package/build/glasses-wifi/index.d.ts.map +1 -0
- package/build/glasses-wifi/index.js +15 -0
- package/build/glasses-wifi/index.js.map +1 -0
- package/build/glasses-wifi/link.d.ts +31 -0
- package/build/glasses-wifi/link.d.ts.map +1 -0
- package/build/glasses-wifi/link.js +71 -0
- package/build/glasses-wifi/link.js.map +1 -0
- package/build/glasses-wifi/native.d.ts +63 -0
- package/build/glasses-wifi/native.d.ts.map +1 -0
- package/build/glasses-wifi/native.js +138 -0
- package/build/glasses-wifi/native.js.map +1 -0
- package/build/glasses-wifi/service.d.ts +86 -0
- package/build/glasses-wifi/service.d.ts.map +1 -0
- package/build/glasses-wifi/service.js +497 -0
- package/build/glasses-wifi/service.js.map +1 -0
- package/build/index.d.ts +4 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +24 -6
- package/build/index.js.map +1 -1
- package/build/ota-transport/index.d.ts +2 -43
- package/build/ota-transport/index.d.ts.map +1 -1
- package/build/ota-transport/index.js +3 -49
- package/build/ota-transport/index.js.map +1 -1
- package/build/react/useBluetoothStatus.d.ts.map +1 -1
- package/build/react/useBluetoothStatus.js +5 -24
- package/build/react/useBluetoothStatus.js.map +1 -1
- package/build/react/useMentraBluetooth.d.ts +1 -2
- package/build/react/useMentraBluetooth.d.ts.map +1 -1
- package/build/react/useMentraBluetooth.js +0 -1
- package/build/react/useMentraBluetooth.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/MentraBluetoothSDK.podspec +5 -4
- package/ios/MentraLocalNetworkModule.swift +264 -0
- package/ios/Source/BluetoothSdkDefaults.swift +1 -1
- package/ios/Source/GeneratedReleaseMetadata.swift +5 -5
- package/ios/Source/hotspot/GlassesHotspotNetwork.swift +563 -0
- package/ios/Source/hotspot/HotspotAccessPurpose.swift +5 -0
- package/ios/Source/hotspot/HotspotAddressPolicy.swift +50 -0
- package/ios/Source/hotspot/HotspotInterfacePolicy.swift +155 -0
- package/ios/Source/hotspot/HotspotJoinFailure.swift +27 -0
- package/ios/Source/hotspot/HotspotLeaveCompletion.swift +24 -0
- package/ios/Source/hotspot/HotspotNetworkOwnership.swift +22 -0
- package/ios/Source/hotspot/HotspotReapplyPolicy.swift +26 -0
- package/ios/Source/hotspot/LocalNetworkAccessRequest.swift +160 -0
- package/ios/Source/hotspot/MacHotspotAssociation.swift +415 -0
- package/ios/Source/hotspot/MacHotspotAuthorization.swift +126 -0
- package/ios/Source/hotspot/MacHotspotAuthorizationFacts.swift +51 -0
- package/ios/Source/hotspot/MacHotspotCleanupContinuation.swift +35 -0
- package/ios/Tests/HotspotAddressPolicyTests.swift +30 -0
- package/ios/Tests/HotspotInterfacePolicyTests.swift +304 -0
- package/ios/Tests/HotspotJoinFailureTests.swift +37 -0
- package/ios/Tests/HotspotLeaveCompletionTests.swift +29 -0
- package/ios/Tests/HotspotReapplyPolicyTests.swift +18 -0
- package/ios/Tests/LocalNetworkAccessRequestTests.swift +237 -0
- package/ios/Tests/MacHotspotAssociationTests.swift +521 -0
- package/ios/Tests/MacHotspotAuthorizationFactsTests.swift +62 -0
- package/ios/Tests/MacHotspotAuthorizationTests.swift +348 -0
- package/ios/Tests/MacWifiInvocationTests.swift +76 -0
- package/package.json +7 -2
- package/plugin/build/withIos.d.ts +4 -0
- package/plugin/build/withIos.js +20 -1
- package/src/BluetoothSdk.types.ts +27 -5
- package/src/_internal.ts +1 -0
- package/src/_private/BluetoothSdkModule.ts +20 -10
- package/src/_private/MentraLocalNetworkModule.ts +22 -0
- package/src/generated/releaseMetadata.ts +5 -5
- package/src/glasses-wifi/connection.ts +47 -0
- package/src/glasses-wifi/continuous.ts +177 -0
- package/src/glasses-wifi/files.ts +32 -0
- package/src/glasses-wifi/index.ts +24 -0
- package/src/glasses-wifi/link.ts +94 -0
- package/src/glasses-wifi/native.ts +193 -0
- package/src/glasses-wifi/service.ts +554 -0
- package/src/index.ts +34 -10
- package/src/ota-transport/index.ts +3 -85
- package/src/react/useBluetoothStatus.ts +5 -26
- package/src/react/useMentraBluetooth.ts +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"continuous.js","sourceRoot":"","sources":["../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oCAAoC,CAAC,CAAC,CAAA;gBACtG,IAAI,EAAE,CAAA;YACR,CAAC;YACD,IAAI,OAAO,GAAG,CAAC;gBAAE,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAA;YAC5E,MAAM,IAAI,CAAC,SAAS,EAAE,CAAA;QACxB,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import {createLink} from \"./link\"\nimport {delay} from \"./native\"\n\n/**\n * Continuous capture: photos back to back for as long as the run lasts, the same in the Bluetooth\n * SDK (`BluetoothSdk.captureContinuous`) and the Mentra Miniapp SDK (`camera.captureContinuous`),\n * which the Mentra App runs with this. While a run is on, the SDK holds the glasses fast link for\n * it, so full photos come over Wi-Fi; stopping gives the link back.\n *\n * The run takes one photo at a time: the next starts once the camera took the previous one. It\n * takes photos on its own while it is `capturing`: the fast link is up and fewer than `maxPending`\n * of its photos are still on the glasses (handed out and not released). Otherwise it is `paused`:\n * photos would pile up on the glasses, behind Bluetooth or behind the ones not released yet. Its\n * first state is heard once known. Photos asked for with `capture()` are taken in its turn either way.\n */\n\nexport type ContinuousState = \"capturing\" | \"paused\"\n\n/** How many of a run's photos may stay on the glasses before it waits. */\nexport const DEFAULT_MAX_PENDING = 12\n/** How long a run waits before asking again for a fast link that could not come up. */\nconst LINK_RETRY_MS = 30_000\n\nexport interface ContinuousCapture<C> {\n /** `capturing` while the run takes photos on its own, `paused` while only Bluetooth is left. */\n readonly state: ContinuousState\n /** Each photo the run takes on its own, a capture like `capturePhoto`'s; release it when done. */\n onPhoto(handler: (capture: C) => void): () => void\n onState(handler: (state: ContinuousState) => void): () => void\n /** One more photo, with these options, taken in the run's turn even while it is paused. */\n capture(options?: object): Promise<C>\n /**\n * Stop taking photos. The fast link is given back once every photo the run handed out is\n * released, so photos still on their way keep coming over Wi-Fi; resolves then.\n */\n stop(): Promise<void>\n}\n\n/**\n * A run over `take`, which starts one capture with the given options and calls `released` once\n * that capture is released (the caller's `release()`, or the miniapp closing).\n */\nexport function runContinuousCapture<O extends object, C extends {readonly captured: Promise<void>}>(\n take: (options: O, released: () => void) => C,\n options: O & {maxPending?: number},\n consumer: string,\n): ContinuousCapture<C> {\n const {maxPending = DEFAULT_MAX_PENDING, ...photoOptions} = options\n const link = createLink(consumer)\n const photoHandlers = new Set<(capture: C) => void>()\n const stateHandlers = new Set<(state: ContinuousState) => void>()\n const asked: Array<{options: O; resolve: (capture: C) => void; reject: (error: Error) => void}> = []\n let state: ContinuousState = \"paused\"\n let pending = 0\n let stopped = false\n let wake = () => {}\n const drained: Array<() => void> = []\n\n const notify = <T>(handlers: Set<(value: T) => void>, value: T) => {\n for (const handler of handlers) {\n try {\n handler(value)\n } catch (error) {\n console.warn(`[ContinuousCapture] ${consumer} failed handling an event`, error)\n }\n }\n }\n /** The fast link's last known state; null until the first open settles or the link reports. */\n let linkUp: boolean | null = null\n let announced = false\n /** Capturing while the fast link is up and the glasses have room; the first known state is always heard. */\n const update = () => {\n if (stopped || linkUp === null) return\n const next: ContinuousState = linkUp && pending < maxPending ? \"capturing\" : \"paused\"\n if (next === state && announced) return\n state = next\n announced = true\n notify(stateHandlers, next)\n wake()\n }\n const setLink = (up: boolean) => {\n linkUp = up\n update()\n }\n\n let holding = false\n const hold = async () => {\n if (holding) return\n holding = true\n try {\n await holdUntilUp()\n } finally {\n holding = false\n }\n }\n // Glasses that come back after the link ended get asked again; while it is held, opening waits on it.\n const stopWatching = link.onChange((links) => {\n setLink(links.fast === \"up\")\n if (links.glasses === \"connected\" && links.fast === \"down\") void hold()\n })\n const holdUntilUp = async () => {\n while (!stopped) {\n try {\n await link.openFast()\n setLink(link.state.fast === \"up\")\n return\n } catch (error) {\n console.warn(`[ContinuousCapture] ${consumer}: the fast link did not come up; photos wait`, error)\n setLink(false)\n await delay(LINK_RETRY_MS)\n }\n }\n }\n\n const loop = async () => {\n while (!stopped) {\n const next = asked.shift()\n if (!next && state !== \"capturing\") {\n await new Promise<void>((resolve) => (wake = resolve))\n continue\n }\n let settled = false\n const capture = take(next?.options ?? (photoOptions as O), () => {\n if (settled) return\n settled = true\n pending--\n update()\n wake()\n if (pending === 0) drained.splice(0).forEach((resolve) => resolve())\n })\n pending++\n update()\n if (next) next.resolve(capture)\n else notify(photoHandlers, capture)\n // A capture the glasses refused leaves the camera free at once: wait a little before the next.\n await capture.captured.catch(() => delay(500))\n }\n }\n\n void hold()\n void loop()\n\n return {\n get state() {\n return state\n },\n onPhoto(handler) {\n photoHandlers.add(handler)\n return () => {\n photoHandlers.delete(handler)\n }\n },\n onState(handler) {\n stateHandlers.add(handler)\n return () => {\n stateHandlers.delete(handler)\n }\n },\n capture(extra = {}) {\n if (stopped) return Promise.reject(new Error(\"The continuous capture was stopped\"))\n return new Promise<C>((resolve, reject) => {\n asked.push({options: {...(photoOptions as O), ...extra}, resolve, reject})\n wake()\n })\n },\n async stop() {\n if (!stopped) {\n stopped = true\n stopWatching()\n for (const waiting of asked.splice(0)) waiting.reject(new Error(\"The continuous capture was stopped\"))\n wake()\n }\n if (pending > 0) await new Promise<void>((resolve) => drained.push(resolve))\n await link.closeFast()\n },\n }\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A file the glasses keep for the phone (a deferred photo), fetched over the glasses Wi-Fi link
|
|
3
|
+
* into this app's cache folder when that link is up, held for the fetch's duration so it isn't
|
|
4
|
+
* taken down underneath it. Null when the link is down or the fetch failed: the caller then asks
|
|
5
|
+
* for it over Bluetooth.
|
|
6
|
+
*/
|
|
7
|
+
export declare function fetchGlassesFileOverWifi(fileId: string): Promise<{
|
|
8
|
+
uri: string;
|
|
9
|
+
bytes: number;
|
|
10
|
+
} | null>;
|
|
11
|
+
//# sourceMappingURL=files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/glasses-wifi/files.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,GAAG,IAAI,CAAC,CAmB3G"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { downloadToCache } from "./native";
|
|
2
|
+
import { holdGlassesWifiIfUp } from "./service";
|
|
3
|
+
/** The glasses' file server: the camera server gallery sync uses. */
|
|
4
|
+
const GLASSES_FILE_SERVER_PORT = 8089;
|
|
5
|
+
/**
|
|
6
|
+
* A file the glasses keep for the phone (a deferred photo), fetched over the glasses Wi-Fi link
|
|
7
|
+
* into this app's cache folder when that link is up, held for the fetch's duration so it isn't
|
|
8
|
+
* taken down underneath it. Null when the link is down or the fetch failed: the caller then asks
|
|
9
|
+
* for it over Bluetooth.
|
|
10
|
+
*/
|
|
11
|
+
export async function fetchGlassesFileOverWifi(fileId) {
|
|
12
|
+
const hold = await holdGlassesWifiIfUp(`file ${fileId}`);
|
|
13
|
+
if (!hold)
|
|
14
|
+
return null;
|
|
15
|
+
try {
|
|
16
|
+
const url = `http://${hold.binding.gateway}:${GLASSES_FILE_SERVER_PORT}/api/deferred?id=${encodeURIComponent(fileId)}`;
|
|
17
|
+
const { statusCode, uri, bytes } = await downloadToCache(url, `glasses-file-${fileId.replace(/[^\w.-]/g, "_")}`, {
|
|
18
|
+
connectionMs: 10_000,
|
|
19
|
+
readMs: 30_000,
|
|
20
|
+
});
|
|
21
|
+
if (statusCode === 200)
|
|
22
|
+
return { uri, bytes };
|
|
23
|
+
throw new Error(`the glasses answered ${statusCode}`);
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
console.warn(`[GlassesFiles] ${fileId} over Wi-Fi failed; using Bluetooth:`, err);
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
finally {
|
|
30
|
+
await hold.release();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/glasses-wifi/files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAA;AACxC,OAAO,EAAC,mBAAmB,EAAC,MAAM,WAAW,CAAA;AAE7C,qEAAqE;AACrE,MAAM,wBAAwB,GAAG,IAAI,CAAA;AAErC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,MAAc;IAC3D,MAAM,IAAI,GAAG,MAAM,mBAAmB,CAAC,QAAQ,MAAM,EAAE,CAAC,CAAA;IACxD,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAA;IACtB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,UAAU,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,wBAAwB,oBAAoB,kBAAkB,CAC1G,MAAM,CACP,EAAE,CAAA;QACH,MAAM,EAAC,UAAU,EAAE,GAAG,EAAE,KAAK,EAAC,GAAG,MAAM,eAAe,CAAC,GAAG,EAAE,gBAAgB,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,EAAE,EAAE;YAC7G,YAAY,EAAE,MAAM;YACpB,MAAM,EAAE,MAAM;SACf,CAAC,CAAA;QACF,IAAI,UAAU,KAAK,GAAG;YAAE,OAAO,EAAC,GAAG,EAAE,KAAK,EAAC,CAAA;QAC3C,MAAM,IAAI,KAAK,CAAC,wBAAwB,UAAU,EAAE,CAAC,CAAA;IACvD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,kBAAkB,MAAM,sCAAsC,EAAE,GAAG,CAAC,CAAA;QACjF,OAAO,IAAI,CAAA;IACb,CAAC;YAAS,CAAC;QACT,MAAM,IAAI,CAAC,OAAO,EAAE,CAAA;IACtB,CAAC;AACH,CAAC","sourcesContent":["import {downloadToCache} from \"./native\"\nimport {holdGlassesWifiIfUp} from \"./service\"\n\n/** The glasses' file server: the camera server gallery sync uses. */\nconst GLASSES_FILE_SERVER_PORT = 8089\n\n/**\n * A file the glasses keep for the phone (a deferred photo), fetched over the glasses Wi-Fi link\n * into this app's cache folder when that link is up, held for the fetch's duration so it isn't\n * taken down underneath it. Null when the link is down or the fetch failed: the caller then asks\n * for it over Bluetooth.\n */\nexport async function fetchGlassesFileOverWifi(fileId: string): Promise<{uri: string; bytes: number} | null> {\n const hold = await holdGlassesWifiIfUp(`file ${fileId}`)\n if (!hold) return null\n try {\n const url = `http://${hold.binding.gateway}:${GLASSES_FILE_SERVER_PORT}/api/deferred?id=${encodeURIComponent(\n fileId,\n )}`\n const {statusCode, uri, bytes} = await downloadToCache(url, `glasses-file-${fileId.replace(/[^\\w.-]/g, \"_\")}`, {\n connectionMs: 10_000,\n readMs: 30_000,\n })\n if (statusCode === 200) return {uri, bytes}\n throw new Error(`the glasses answered ${statusCode}`)\n } catch (err) {\n console.warn(`[GlassesFiles] ${fileId} over Wi-Fi failed; using Bluetooth:`, err)\n return null\n } finally {\n await hold.release()\n }\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@mentra/bluetooth-sdk/glasses-wifi`: the glasses Wi-Fi service for the Mentra engine's own
|
|
3
|
+
* consumers (hotspot OTA, gallery sync, Mentra Call, the managed relay, miniapps' photos), which
|
|
4
|
+
* hold the link and talk to the glasses over it. Apps use `BluetoothSdk.link` and
|
|
5
|
+
* `captureContinuous` instead.
|
|
6
|
+
*/
|
|
7
|
+
import { cancel, download, isScoped, onDownloadProgress, request } from "./native";
|
|
8
|
+
export { GlassesWifiError, holdGlassesWifi, type GlassesWifiBinding, type GlassesWifiEvent, type GlassesWifiHold, type GlassesWifiHoldOptions, } from "./service";
|
|
9
|
+
export { createLink, linkState, onLinkChange, type GlassesLink, type LinkState } from "./link";
|
|
10
|
+
export { runContinuousCapture, type ContinuousCapture, type ContinuousState } from "./continuous";
|
|
11
|
+
export type { HotspotStatus } from "../BluetoothSdk.types";
|
|
12
|
+
/** Requests to the glasses over the glasses Wi-Fi link the service holds. */
|
|
13
|
+
export declare const glassesWifiLink: Readonly<{
|
|
14
|
+
isScoped: typeof isScoped;
|
|
15
|
+
request: typeof request;
|
|
16
|
+
download: typeof download;
|
|
17
|
+
cancel: typeof cancel;
|
|
18
|
+
onDownloadProgress: typeof onDownloadProgress;
|
|
19
|
+
}>;
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/glasses-wifi/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,EAAE,OAAO,EAAC,MAAM,UAAU,CAAA;AAEhF,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,sBAAsB,GAC5B,MAAM,WAAW,CAAA;AAClB,OAAO,EAAC,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAC,MAAM,QAAQ,CAAA;AAC5F,OAAO,EAAC,oBAAoB,EAAE,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAAC,MAAM,cAAc,CAAA;AAC/F,YAAY,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAA;AAExD,6EAA6E;AAC7E,eAAO,MAAM,eAAe;;;;;;EAA2E,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@mentra/bluetooth-sdk/glasses-wifi`: the glasses Wi-Fi service for the Mentra engine's own
|
|
3
|
+
* consumers (hotspot OTA, gallery sync, Mentra Call, the managed relay, miniapps' photos), which
|
|
4
|
+
* hold the link and talk to the glasses over it. Apps use `BluetoothSdk.link` and
|
|
5
|
+
* `captureContinuous` instead.
|
|
6
|
+
*/
|
|
7
|
+
// The service's own native requests, behind the link the service holds.
|
|
8
|
+
// eslint-disable-next-line no-restricted-imports
|
|
9
|
+
import { cancel, download, isScoped, onDownloadProgress, request } from "./native";
|
|
10
|
+
export { GlassesWifiError, holdGlassesWifi, } from "./service";
|
|
11
|
+
export { createLink, linkState, onLinkChange } from "./link";
|
|
12
|
+
export { runContinuousCapture } from "./continuous";
|
|
13
|
+
/** Requests to the glasses over the glasses Wi-Fi link the service holds. */
|
|
14
|
+
export const glassesWifiLink = Object.freeze({ isScoped, request, download, cancel, onDownloadProgress });
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/glasses-wifi/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wEAAwE;AACxE,iDAAiD;AACjD,OAAO,EAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,EAAE,OAAO,EAAC,MAAM,UAAU,CAAA;AAEhF,OAAO,EACL,gBAAgB,EAChB,eAAe,GAKhB,MAAM,WAAW,CAAA;AAClB,OAAO,EAAC,UAAU,EAAE,SAAS,EAAE,YAAY,EAAmC,MAAM,QAAQ,CAAA;AAC5F,OAAO,EAAC,oBAAoB,EAA+C,MAAM,cAAc,CAAA;AAG/F,6EAA6E;AAC7E,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,EAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,kBAAkB,EAAC,CAAC,CAAA","sourcesContent":["/**\n * `@mentra/bluetooth-sdk/glasses-wifi`: the glasses Wi-Fi service for the Mentra engine's own\n * consumers (hotspot OTA, gallery sync, Mentra Call, the managed relay, miniapps' photos), which\n * hold the link and talk to the glasses over it. Apps use `BluetoothSdk.link` and\n * `captureContinuous` instead.\n */\n// The service's own native requests, behind the link the service holds.\n// eslint-disable-next-line no-restricted-imports\nimport {cancel, download, isScoped, onDownloadProgress, request} from \"./native\"\n\nexport {\n GlassesWifiError,\n holdGlassesWifi,\n type GlassesWifiBinding,\n type GlassesWifiEvent,\n type GlassesWifiHold,\n type GlassesWifiHoldOptions,\n} from \"./service\"\nexport {createLink, linkState, onLinkChange, type GlassesLink, type LinkState} from \"./link\"\nexport {runContinuousCapture, type ContinuousCapture, type ContinuousState} from \"./continuous\"\nexport type {HotspotStatus} from \"../BluetoothSdk.types\"\n\n/** Requests to the glasses over the glasses Wi-Fi link the service holds. */\nexport const glassesWifiLink = Object.freeze({isScoped, request, download, cancel, onDownloadProgress})\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The phone's links to the glasses, as the Bluetooth SDK's and the Miniapp SDK's `link` show them:
|
|
3
|
+
* the glasses connected over Bluetooth or not, and the fast link (the glasses Wi-Fi) up or down.
|
|
4
|
+
* Photos go over the fast link while it is up, whoever holds it, and over Bluetooth otherwise.
|
|
5
|
+
*/
|
|
6
|
+
export type LinkState = {
|
|
7
|
+
glasses: "connected" | "disconnected";
|
|
8
|
+
fast: "up" | "down";
|
|
9
|
+
};
|
|
10
|
+
export interface GlassesLink {
|
|
11
|
+
/** The links as they are now. */
|
|
12
|
+
readonly state: LinkState;
|
|
13
|
+
/** Hear the links change; the handler gets the new state. */
|
|
14
|
+
onChange(handler: (state: LinkState) => void): () => void;
|
|
15
|
+
/**
|
|
16
|
+
* Hold the fast link, so photos travel over it instead of Bluetooth, until {@link closeFast}.
|
|
17
|
+
* The SDK picks the radio (Wi-Fi Direct on Android with glasses that support it, the glasses'
|
|
18
|
+
* hotspot otherwise), shares the one link with its other users and brings it back after the
|
|
19
|
+
* glasses restart. Resolves once it is up; rejects if it can't come up. Opening a link already
|
|
20
|
+
* held waits for the same one.
|
|
21
|
+
*/
|
|
22
|
+
openFast(): Promise<void>;
|
|
23
|
+
/** Give the fast link back; it goes down once nobody else holds it. Idempotent. */
|
|
24
|
+
closeFast(): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
export declare function linkState(): LinkState;
|
|
27
|
+
/** Hear either link change, with the new state; only real changes are heard. */
|
|
28
|
+
export declare function onLinkChange(handler: (state: LinkState) => void): () => void;
|
|
29
|
+
/** One holder of the fast link: the app's own, or one per miniapp. */
|
|
30
|
+
export declare function createLink(consumer: string): GlassesLink;
|
|
31
|
+
//# sourceMappingURL=link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/glasses-wifi/link.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG;IAAC,OAAO,EAAE,WAAW,GAAG,cAAc,CAAC;IAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAAA;CAAC,CAAA;AAEpF,MAAM,WAAW,WAAW;IAC1B,iCAAiC;IACjC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;IACzB,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,GAAG,MAAM,IAAI,CAAA;IACzD;;;;;;OAMG;IACH,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACzB,mFAAmF;IACnF,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3B;AAED,wBAAgB,SAAS,IAAI,SAAS,CAKrC;AAED,gFAAgF;AAChF,wBAAgB,YAAY,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,GAAG,MAAM,IAAI,CAc5E;AAED,sEAAsE;AACtE,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CAwCxD"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { isConnectedGlassesConnectionStatus } from "../BluetoothSdk.types";
|
|
2
|
+
import { glassesConnection, onGlassesConnection, watchGlassesConnection } from "./connection";
|
|
3
|
+
import { glassesWifiUp, holdGlassesWifi, onGlassesWifiUp } from "./service";
|
|
4
|
+
export function linkState() {
|
|
5
|
+
return {
|
|
6
|
+
glasses: isConnectedGlassesConnectionStatus(glassesConnection()) ? "connected" : "disconnected",
|
|
7
|
+
fast: glassesWifiUp() ? "up" : "down",
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/** Hear either link change, with the new state; only real changes are heard. */
|
|
11
|
+
export function onLinkChange(handler) {
|
|
12
|
+
let last = linkState();
|
|
13
|
+
const check = () => {
|
|
14
|
+
const next = linkState();
|
|
15
|
+
if (next.glasses === last.glasses && next.fast === last.fast)
|
|
16
|
+
return;
|
|
17
|
+
last = next;
|
|
18
|
+
handler(next);
|
|
19
|
+
};
|
|
20
|
+
const stopConnection = onGlassesConnection(check);
|
|
21
|
+
const stopWifi = onGlassesWifiUp(check);
|
|
22
|
+
return () => {
|
|
23
|
+
stopConnection();
|
|
24
|
+
stopWifi();
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/** One holder of the fast link: the app's own, or one per miniapp. */
|
|
28
|
+
export function createLink(consumer) {
|
|
29
|
+
let current = null;
|
|
30
|
+
const closeFast = async () => {
|
|
31
|
+
const entry = current;
|
|
32
|
+
if (!entry)
|
|
33
|
+
return;
|
|
34
|
+
current = null;
|
|
35
|
+
entry.abort.abort();
|
|
36
|
+
await entry.hold.then((hold) => hold.release()).catch(() => undefined);
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
get state() {
|
|
40
|
+
// Watched from the first read on: until the glasses status arrives, they show as disconnected.
|
|
41
|
+
void watchGlassesConnection();
|
|
42
|
+
return linkState();
|
|
43
|
+
},
|
|
44
|
+
onChange: onLinkChange,
|
|
45
|
+
async openFast() {
|
|
46
|
+
let entry = current;
|
|
47
|
+
if (!entry) {
|
|
48
|
+
const abort = new AbortController();
|
|
49
|
+
const opened = { abort, hold: holdGlassesWifi({ consumer, signal: abort.signal }) };
|
|
50
|
+
current = entry = opened;
|
|
51
|
+
// A link the glasses did not bring back is given back, so the next open asks again.
|
|
52
|
+
void opened.hold
|
|
53
|
+
.then((hold) => hold.onChange((event) => {
|
|
54
|
+
if (event.type === "ended" && current === opened)
|
|
55
|
+
void closeFast();
|
|
56
|
+
}))
|
|
57
|
+
.catch(() => undefined);
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
await (await entry.hold).ready();
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
if (current === entry)
|
|
64
|
+
await closeFast();
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
closeFast,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.js","sourceRoot":"","sources":["../../src/glasses-wifi/link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kCAAkC,EAAC,MAAM,uBAAuB,CAAA;AACxE,OAAO,EAAC,iBAAiB,EAAE,mBAAmB,EAAE,sBAAsB,EAAC,MAAM,cAAc,CAAA;AAC3F,OAAO,EAAC,aAAa,EAAE,eAAe,EAAE,eAAe,EAAuB,MAAM,WAAW,CAAA;AA0B/F,MAAM,UAAU,SAAS;IACvB,OAAO;QACL,OAAO,EAAE,kCAAkC,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,cAAc;QAC/F,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM;KACtC,CAAA;AACH,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,YAAY,CAAC,OAAmC;IAC9D,IAAI,IAAI,GAAG,SAAS,EAAE,CAAA;IACtB,MAAM,KAAK,GAAG,GAAG,EAAE;QACjB,MAAM,IAAI,GAAG,SAAS,EAAE,CAAA;QACxB,IAAI,IAAI,CAAC,OAA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,CAAC,MAAM,EAAC,CAAC,EAAC,CAAA;gBAC/E,OAAO,GAAG,KAAK,GAAG,MAAM,CAAA;gBACxB,oFAAoF;gBACpF,KAAK,MAAM,CAAC,IAAI;qBACb,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CACb,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE;oBACtB,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,OAAO,KAAK,MAAM;wBAAE,KAAK,SAAS,EAAE,CAAA;gBACpE,CAAC,CAAC,CACH;qBACA,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;YAC3B,CAAC;YACD,IAAI,CAAC;gBACH,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAA;YAClC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,OAAO,KAAK,KAAK;oBAAE,MAAM,SAAS,EAAE,CAAA;gBACxC,MAAM,KAAK,CAAA;YACb,CAAC;QACH,CAAC;QACD,SAAS;KACV,CAAA;AACH,CAAC","sourcesContent":["import {isConnectedGlassesConnectionStatus} from \"../BluetoothSdk.types\"\nimport {glassesConnection, onGlassesConnection, watchGlassesConnection} from \"./connection\"\nimport {glassesWifiUp, holdGlassesWifi, onGlassesWifiUp, type GlassesWifiHold} from \"./service\"\n\n/**\n * The phone's links to the glasses, as the Bluetooth SDK's and the Miniapp SDK's `link` show them:\n * the glasses connected over Bluetooth or not, and the fast link (the glasses Wi-Fi) up or down.\n * Photos go over the fast link while it is up, whoever holds it, and over Bluetooth otherwise.\n */\nexport type LinkState = {glasses: \"connected\" | \"disconnected\"; fast: \"up\" | \"down\"}\n\nexport interface GlassesLink {\n /** The links as they are now. */\n readonly state: LinkState\n /** Hear the links change; the handler gets the new state. */\n onChange(handler: (state: LinkState) => void): () => void\n /**\n * Hold the fast link, so photos travel over it instead of Bluetooth, until {@link closeFast}.\n * The SDK picks the radio (Wi-Fi Direct on Android with glasses that support it, the glasses'\n * hotspot otherwise), shares the one link with its other users and brings it back after the\n * glasses restart. Resolves once it is up; rejects if it can't come up. Opening a link already\n * held waits for the same one.\n */\n openFast(): Promise<void>\n /** Give the fast link back; it goes down once nobody else holds it. Idempotent. */\n closeFast(): Promise<void>\n}\n\nexport function linkState(): LinkState {\n return {\n glasses: isConnectedGlassesConnectionStatus(glassesConnection()) ? \"connected\" : \"disconnected\",\n fast: glassesWifiUp() ? \"up\" : \"down\",\n }\n}\n\n/** Hear either link change, with the new state; only real changes are heard. */\nexport function onLinkChange(handler: (state: LinkState) => void): () => void {\n let last = linkState()\n const check = () => {\n const next = linkState()\n if (next.glasses === last.glasses && next.fast === last.fast) return\n last = next\n handler(next)\n }\n const stopConnection = onGlassesConnection(check)\n const stopWifi = onGlassesWifiUp(check)\n return () => {\n stopConnection()\n stopWifi()\n }\n}\n\n/** One holder of the fast link: the app's own, or one per miniapp. */\nexport function createLink(consumer: string): GlassesLink {\n let current: {abort: AbortController; hold: Promise<GlassesWifiHold>} | null = null\n const closeFast = async () => {\n const entry = current\n if (!entry) return\n current = null\n entry.abort.abort()\n await entry.hold.then((hold) => hold.release()).catch(() => undefined)\n }\n return {\n get state() {\n // Watched from the first read on: until the glasses status arrives, they show as disconnected.\n void watchGlassesConnection()\n return linkState()\n },\n onChange: onLinkChange,\n async openFast() {\n let entry = current\n if (!entry) {\n const abort = new AbortController()\n const opened = {abort, hold: holdGlassesWifi({consumer, signal: abort.signal})}\n current = entry = opened\n // A link the glasses did not bring back is given back, so the next open asks again.\n void opened.hold\n .then((hold) =>\n hold.onChange((event) => {\n if (event.type === \"ended\" && current === opened) void closeFast()\n }),\n )\n .catch(() => undefined)\n }\n try {\n await (await entry.hold).ready()\n } catch (error) {\n if (current === entry) await closeFast()\n throw error\n }\n },\n closeFast,\n }\n}\n"]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The phone's native joins to the glasses' Wi-Fi, under the glasses Wi-Fi service: one link at a
|
|
3
|
+
* time. Android joins the hotspot or the Wi-Fi Direct group through `ScopedSoftApNetwork` and
|
|
4
|
+
* sends requests over the `Network` it gets; iOS joins the hotspot through `GlassesHotspotNetwork`
|
|
5
|
+
* and its requests take the system's route to it.
|
|
6
|
+
*/
|
|
7
|
+
export type JoinPurpose = "outgoing-client" | "incoming-server";
|
|
8
|
+
/** Android: whether the phone and the connected glasses can use the Wi-Fi Direct link now. */
|
|
9
|
+
export declare function wifiDirectAvailable(): boolean;
|
|
10
|
+
/** Join the glasses' hotspot. Resolves with the phone's address on it, when the platform reports it. */
|
|
11
|
+
export declare function joinHotspot(ssid: string, password: string, options: {
|
|
12
|
+
gateway?: string;
|
|
13
|
+
/** The hotspot's channel in MHz, when the glasses report it: a Mac then scans only that channel. */
|
|
14
|
+
frequency?: number;
|
|
15
|
+
purpose: JoinPurpose;
|
|
16
|
+
/** iOS: the join has waited a few seconds for Local Network access, which may have been denied. */
|
|
17
|
+
onPermissionRequired?: (systemAnswer: string) => void;
|
|
18
|
+
}): Promise<string | undefined>;
|
|
19
|
+
/** Android: join the glasses' Wi-Fi Direct group; the native join asks the glasses for it over Bluetooth. */
|
|
20
|
+
export declare function joinWifiDirect(purpose: JoinPurpose): Promise<{
|
|
21
|
+
ssid: string;
|
|
22
|
+
localAddress?: string;
|
|
23
|
+
gateway?: string;
|
|
24
|
+
}>;
|
|
25
|
+
/** Leave whatever the phone joined, or stop a join in progress. Leaving a group also removes it. */
|
|
26
|
+
export declare function leave(): Promise<void>;
|
|
27
|
+
/** The phone left the glasses' network without being asked to. */
|
|
28
|
+
export declare function onLost(listener: () => void): () => void;
|
|
29
|
+
/** Android: requests to the glasses must go over the joined `Network` (`MentraLocalNetwork.request`). */
|
|
30
|
+
export declare function isScoped(): boolean;
|
|
31
|
+
/** Android: an HTTP request to the glasses over the joined `Network`; the body comes back as base64. */
|
|
32
|
+
export declare function request(requestId: string, url: string, method: string, headers: Record<string, string>, body: string | null, timeoutMs: number): Promise<{
|
|
33
|
+
status: number;
|
|
34
|
+
headers: Record<string, string>;
|
|
35
|
+
bodyBase64: string;
|
|
36
|
+
}>;
|
|
37
|
+
/** A download from the glasses over the link into `destination`, a path; progress comes by `onDownloadProgress`. */
|
|
38
|
+
export declare function download(requestId: string, url: string, destination: string, headers: Record<string, string>, connectionTimeoutMs: number, readTimeoutMs: number): Promise<{
|
|
39
|
+
statusCode: number;
|
|
40
|
+
bytesWritten: number;
|
|
41
|
+
headers: Record<string, string>;
|
|
42
|
+
}>;
|
|
43
|
+
/** Stop a request or download in progress. */
|
|
44
|
+
export declare function cancel(requestId: string): Promise<void>;
|
|
45
|
+
export declare function onDownloadProgress(listener: (event: {
|
|
46
|
+
requestId: string;
|
|
47
|
+
bytesWritten: number;
|
|
48
|
+
contentLength: number;
|
|
49
|
+
statusCode?: number;
|
|
50
|
+
headers?: Record<string, string>;
|
|
51
|
+
}) => void): () => void;
|
|
52
|
+
/** Download a file from the glasses over the link into this app's cache folder, as a `file://` URI. */
|
|
53
|
+
export declare function downloadToCache(url: string, fileName: string, timeouts: {
|
|
54
|
+
connectionMs: number;
|
|
55
|
+
readMs: number;
|
|
56
|
+
}): Promise<{
|
|
57
|
+
statusCode: number;
|
|
58
|
+
uri: string;
|
|
59
|
+
bytes: number;
|
|
60
|
+
}>;
|
|
61
|
+
/** A wait that keeps running while the app is in the background, unlike a JS timer on Android. */
|
|
62
|
+
export declare function delay(ms: number): Promise<void>;
|
|
63
|
+
//# sourceMappingURL=native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../src/glasses-wifi/native.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AAEH,MAAM,MAAM,WAAW,GAAG,iBAAiB,GAAG,iBAAiB,CAAA;AAe/D,8FAA8F;AAC9F,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED,wGAAwG;AACxG,wBAAsB,WAAW,CAC/B,IAA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AAC,MAAM,EAAE,MAAM,CAAC,EAC/B,mBAAmB,EAAE,MAAM,EAC3B,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAC,CAAC,CAEtF;AAED,8CAA8C;AAC9C,wBAAsB,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE7D;AAED,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,CAAC,KAAK,EAAE;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACjC,KAAK,IAAI,GACT,MAAM,IAAI,CAIZ;AAED,uGAAuG;AACvG,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAC,GAC/C,OAAO,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,CAAC,CAI3D;AAED,kGAAkG;AAClG,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI/C"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { Platform } from "react-native";
|
|
2
|
+
// The service is this module's only caller; it reaches the native joins through it.
|
|
3
|
+
// eslint-disable-next-line no-restricted-imports
|
|
4
|
+
import MentraLocalNetwork from "../_private/MentraLocalNetworkModule";
|
|
5
|
+
let generation = 0;
|
|
6
|
+
/** Android: requests go over the joined `Network`, not the default one. */
|
|
7
|
+
let scoped = false;
|
|
8
|
+
/** iOS: the native join's owner id, while joined or joining. */
|
|
9
|
+
let iosOwner = null;
|
|
10
|
+
const native = () => {
|
|
11
|
+
if (!MentraLocalNetwork)
|
|
12
|
+
throw new Error("The glasses Wi-Fi link is not available in this native build");
|
|
13
|
+
return MentraLocalNetwork;
|
|
14
|
+
};
|
|
15
|
+
const requestId = (prefix) => `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2)}`;
|
|
16
|
+
/** Android: whether the phone and the connected glasses can use the Wi-Fi Direct link now. */
|
|
17
|
+
export function wifiDirectAvailable() {
|
|
18
|
+
return Platform.OS === "android" && MentraLocalNetwork?.wifiDirectAvailable?.() === true;
|
|
19
|
+
}
|
|
20
|
+
/** Join the glasses' hotspot. Resolves with the phone's address on it, when the platform reports it. */
|
|
21
|
+
export async function joinHotspot(ssid, password, options) {
|
|
22
|
+
const current = ++generation;
|
|
23
|
+
scoped = false;
|
|
24
|
+
if (Platform.OS === "ios") {
|
|
25
|
+
if (iosOwner)
|
|
26
|
+
throw new Error("Previous hotspot session has not been released");
|
|
27
|
+
const owner = requestId("ios_hotspot");
|
|
28
|
+
iosOwner = owner;
|
|
29
|
+
const permission = native().addListener("hotspotPermissionRequired", (event) => {
|
|
30
|
+
if (event.id === owner)
|
|
31
|
+
options.onPermissionRequired?.(event.systemAnswer ?? "unknown");
|
|
32
|
+
});
|
|
33
|
+
try {
|
|
34
|
+
const address = await native().joinHotspot(owner, ssid, password, options.gateway ?? null, options.purpose, options.frequency ?? null);
|
|
35
|
+
if (current !== generation)
|
|
36
|
+
throw new Error("Local network connection was superseded");
|
|
37
|
+
return address;
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
try {
|
|
41
|
+
await native().leaveHotspot(owner);
|
|
42
|
+
}
|
|
43
|
+
catch (cleanupError) {
|
|
44
|
+
// The owner stays recorded: the next join must not start over a session still being left.
|
|
45
|
+
console.warn("[GlassesWifi] Leaving a failed hotspot join failed", cleanupError);
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
if (iosOwner === owner)
|
|
49
|
+
iosOwner = null;
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
finally {
|
|
53
|
+
permission.remove();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (Platform.OS !== "android")
|
|
57
|
+
throw new Error("The glasses hotspot cannot be joined on this platform");
|
|
58
|
+
const result = await native().connect(ssid, password, options.purpose === "incoming-server");
|
|
59
|
+
scoped = true;
|
|
60
|
+
return result.localAddress;
|
|
61
|
+
}
|
|
62
|
+
/** Android: join the glasses' Wi-Fi Direct group; the native join asks the glasses for it over Bluetooth. */
|
|
63
|
+
export async function joinWifiDirect(purpose) {
|
|
64
|
+
generation += 1;
|
|
65
|
+
scoped = false;
|
|
66
|
+
const result = await native().connectWifiDirect(purpose === "incoming-server");
|
|
67
|
+
scoped = true;
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
/** Leave whatever the phone joined, or stop a join in progress. Leaving a group also removes it. */
|
|
71
|
+
export async function leave() {
|
|
72
|
+
generation += 1;
|
|
73
|
+
if (!MentraLocalNetwork)
|
|
74
|
+
return;
|
|
75
|
+
if (Platform.OS === "ios") {
|
|
76
|
+
const owner = iosOwner;
|
|
77
|
+
if (!owner)
|
|
78
|
+
return;
|
|
79
|
+
await MentraLocalNetwork.leaveHotspot(owner);
|
|
80
|
+
if (iosOwner === owner)
|
|
81
|
+
iosOwner = null;
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
// A failed release keeps the network for the next leave.
|
|
85
|
+
await MentraLocalNetwork.disconnect();
|
|
86
|
+
scoped = false;
|
|
87
|
+
}
|
|
88
|
+
/** The phone left the glasses' network without being asked to. */
|
|
89
|
+
export function onLost(listener) {
|
|
90
|
+
if (!MentraLocalNetwork)
|
|
91
|
+
return () => { };
|
|
92
|
+
const subscription = Platform.OS === "ios"
|
|
93
|
+
? MentraLocalNetwork.addListener("hotspotLost", (event) => {
|
|
94
|
+
if (event.id === iosOwner)
|
|
95
|
+
listener();
|
|
96
|
+
})
|
|
97
|
+
: MentraLocalNetwork.addListener("networkLost", () => {
|
|
98
|
+
scoped = false;
|
|
99
|
+
listener();
|
|
100
|
+
});
|
|
101
|
+
return () => subscription.remove();
|
|
102
|
+
}
|
|
103
|
+
/** Android: requests to the glasses must go over the joined `Network` (`MentraLocalNetwork.request`). */
|
|
104
|
+
export function isScoped() {
|
|
105
|
+
return scoped;
|
|
106
|
+
}
|
|
107
|
+
/** Android: an HTTP request to the glasses over the joined `Network`; the body comes back as base64. */
|
|
108
|
+
export function request(requestId, url, method, headers, body, timeoutMs) {
|
|
109
|
+
return native().request(requestId, url, method, headers, body, timeoutMs);
|
|
110
|
+
}
|
|
111
|
+
/** A download from the glasses over the link into `destination`, a path; progress comes by `onDownloadProgress`. */
|
|
112
|
+
export function download(requestId, url, destination, headers, connectionTimeoutMs, readTimeoutMs) {
|
|
113
|
+
return native().download(requestId, url, destination, headers, connectionTimeoutMs, readTimeoutMs);
|
|
114
|
+
}
|
|
115
|
+
/** Stop a request or download in progress. */
|
|
116
|
+
export async function cancel(requestId) {
|
|
117
|
+
await MentraLocalNetwork?.cancel(requestId);
|
|
118
|
+
}
|
|
119
|
+
export function onDownloadProgress(listener) {
|
|
120
|
+
if (!MentraLocalNetwork)
|
|
121
|
+
return () => { };
|
|
122
|
+
const subscription = MentraLocalNetwork.addListener("downloadProgress", listener);
|
|
123
|
+
return () => subscription.remove();
|
|
124
|
+
}
|
|
125
|
+
/** Download a file from the glasses over the link into this app's cache folder, as a `file://` URI. */
|
|
126
|
+
export async function downloadToCache(url, fileName, timeouts) {
|
|
127
|
+
const path = `${native().cacheDirectory().replace(/\/$/, "")}/${fileName}`;
|
|
128
|
+
const { statusCode, bytesWritten } = await download(requestId("file"), url, path, {}, timeouts.connectionMs, timeouts.readMs);
|
|
129
|
+
return { statusCode, uri: `file://${path}`, bytes: bytesWritten };
|
|
130
|
+
}
|
|
131
|
+
/** A wait that keeps running while the app is in the background, unlike a JS timer on Android. */
|
|
132
|
+
export function delay(ms) {
|
|
133
|
+
const nativeDelay = MentraLocalNetwork?.delay;
|
|
134
|
+
if (typeof nativeDelay === "function")
|
|
135
|
+
return nativeDelay.call(MentraLocalNetwork, Math.max(0, Math.round(ms)));
|
|
136
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native.js","sourceRoot":"","sources":["../../src/glasses-wifi/native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAA;AAErC,oFAAoF;AACpF,iDAAiD;AACjD,OAAO,kBAAkB,MAAM,sCAAsC,CAAA;AAWrE,IAAI,UAAU,GAAG,CAAC,CAAA;AAClB,2EAA2E;AAC3E,IAAI,MAAM,GAAG,KAAK,CAAA;AAClB,gEAAgE;AAChE,IAAI,QAAQ,GAAkB,IAAI,CAAA;AAElC,MAAM,MAAM,GAAG,GAAG,EAAE;IAClB,IAAI,CAAC,kBAAkB;QAAE,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAA;IACxG,OAAO,kBAAkB,CAAA;AAC3B,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,GAAG,MAAM,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;AAEtG,8FAA8F;AAC9F,MAAM,UAAU,mBAAmB;IACjC,OAAO,QAAQ,CAAC,EAAE,KAAK,SAAS,IAAI,kBAAkB,EAAE,mBAAmB,EAAE,EAAE,KAAK,IAAI,CAAA;AAC1F,CAAC;AAED,wGAAwG;AACxG,MA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it reaches the native joins through it.\n// eslint-disable-next-line no-restricted-imports\nimport MentraLocalNetwork from \"../_private/MentraLocalNetworkModule\"\n\n/**\n * The phone's native joins to the glasses' Wi-Fi, under the glasses Wi-Fi service: one link at a\n * time. Android joins the hotspot or the Wi-Fi Direct group through `ScopedSoftApNetwork` and\n * sends requests over the `Network` it gets; iOS joins the hotspot through `GlassesHotspotNetwork`\n * and its requests take the system's route to it.\n */\n\nexport type JoinPurpose = \"outgoing-client\" | \"incoming-server\"\n\nlet generation = 0\n/** Android: requests go over the joined `Network`, not the default one. */\nlet scoped = false\n/** iOS: the native join's owner id, while joined or joining. */\nlet iosOwner: string | null = null\n\nconst native = () => {\n if (!MentraLocalNetwork) throw new Error(\"The glasses Wi-Fi link is not available in this native build\")\n return MentraLocalNetwork\n}\n\nconst requestId = (prefix: string) => `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2)}`\n\n/** Android: whether the phone and the connected glasses can use the Wi-Fi Direct link now. */\nexport function wifiDirectAvailable(): boolean {\n return Platform.OS === \"android\" && MentraLocalNetwork?.wifiDirectAvailable?.() === true\n}\n\n/** Join the glasses' hotspot. Resolves with the phone's address on it, when the platform reports it. */\nexport async function joinHotspot(\n ssid: string,\n password: string,\n options: {\n gateway?: string\n /** The hotspot's channel in MHz, when the glasses report it: a Mac then scans only that channel. */\n frequency?: number\n purpose: JoinPurpose\n /** iOS: the join has waited a few seconds for Local Network access, which may have been denied. */\n onPermissionRequired?: (systemAnswer: string) => void\n },\n): Promise<string | undefined> {\n const current = ++generation\n scoped = false\n if (Platform.OS === \"ios\") {\n if (iosOwner) throw new Error(\"Previous hotspot session has not been released\")\n const owner = requestId(\"ios_hotspot\")\n iosOwner = owner\n const permission = native().addListener(\"hotspotPermissionRequired\", (event) => {\n if (event.id === owner) options.onPermissionRequired?.(event.systemAnswer ?? \"unknown\")\n })\n try {\n const address = await native().joinHotspot(\n owner,\n ssid,\n password,\n options.gateway ?? null,\n options.purpose,\n options.frequency ?? null,\n )\n if (current !== generation) throw new Error(\"Local network connection was superseded\")\n return address\n } catch (error) {\n try {\n await native().leaveHotspot(owner)\n } catch (cleanupError) {\n // The owner stays recorded: the next join must not start over a session still being left.\n console.warn(\"[GlassesWifi] Leaving a failed hotspot join failed\", cleanupError)\n throw error\n }\n if (iosOwner === owner) iosOwner = null\n throw error\n } finally {\n permission.remove()\n }\n }\n if (Platform.OS !== \"android\") throw new Error(\"The glasses hotspot cannot be joined on this platform\")\n const result = await native().connect(ssid, password, options.purpose === \"incoming-server\")\n scoped = true\n return result.localAddress\n}\n\n/** Android: join the glasses' Wi-Fi Direct group; the native join asks the glasses for it over Bluetooth. */\nexport async function joinWifiDirect(\n purpose: JoinPurpose,\n): Promise<{ssid: string; localAddress?: string; gateway?: string}> {\n generation += 1\n scoped = false\n const result = await native().connectWifiDirect(purpose === \"incoming-server\")\n scoped = true\n return result\n}\n\n/** Leave whatever the phone joined, or stop a join in progress. Leaving a group also removes it. */\nexport async function leave(): Promise<void> {\n generation += 1\n if (!MentraLocalNetwork) return\n if (Platform.OS === \"ios\") {\n const owner = iosOwner\n if (!owner) return\n await MentraLocalNetwork.leaveHotspot(owner)\n if (iosOwner === owner) iosOwner = null\n return\n }\n // A failed release keeps the network for the next leave.\n await MentraLocalNetwork.disconnect()\n scoped = false\n}\n\n/** The phone left the glasses' network without being asked to. */\nexport function onLost(listener: () => void): () => void {\n if (!MentraLocalNetwork) return () => {}\n const subscription =\n Platform.OS === \"ios\"\n ? MentraLocalNetwork.addListener(\"hotspotLost\", (event) => {\n if (event.id === iosOwner) listener()\n })\n : MentraLocalNetwork.addListener(\"networkLost\", () => {\n scoped = false\n listener()\n })\n return () => subscription.remove()\n}\n\n/** Android: requests to the glasses must go over the joined `Network` (`MentraLocalNetwork.request`). */\nexport function isScoped(): boolean {\n return scoped\n}\n\n/** Android: an HTTP request to the glasses over the joined `Network`; the body comes back as base64. */\nexport function request(\n requestId: string,\n url: string,\n method: string,\n headers: Record<string, string>,\n body: string | null,\n timeoutMs: number,\n): Promise<{status: number; headers: Record<string, string>; bodyBase64: string}> {\n return native().request(requestId, url, method, headers, body, timeoutMs)\n}\n\n/** A download from the glasses over the link into `destination`, a path; progress comes by `onDownloadProgress`. */\nexport function download(\n requestId: string,\n url: string,\n destination: string,\n headers: Record<string, string>,\n connectionTimeoutMs: number,\n readTimeoutMs: number,\n): Promise<{statusCode: number; bytesWritten: number; headers: Record<string, string>}> {\n return native().download(requestId, url, destination, headers, connectionTimeoutMs, readTimeoutMs)\n}\n\n/** Stop a request or download in progress. */\nexport async function cancel(requestId: string): Promise<void> {\n await MentraLocalNetwork?.cancel(requestId)\n}\n\nexport function onDownloadProgress(\n listener: (event: {\n requestId: string\n bytesWritten: number\n contentLength: number\n statusCode?: number\n headers?: Record<string, string>\n }) => void,\n): () => void {\n if (!MentraLocalNetwork) return () => {}\n const subscription = MentraLocalNetwork.addListener(\"downloadProgress\", listener)\n return () => subscription.remove()\n}\n\n/** Download a file from the glasses over the link into this app's cache folder, as a `file://` URI. */\nexport async function downloadToCache(\n url: string,\n fileName: string,\n timeouts: {connectionMs: number; readMs: number},\n): Promise<{statusCode: number; uri: string; bytes: number}> {\n const path = `${native().cacheDirectory().replace(/\\/$/, \"\")}/${fileName}`\n const {statusCode, bytesWritten} = await download(requestId(\"file\"), url, path, {}, timeouts.connectionMs, timeouts.readMs)\n return {statusCode, uri: `file://${path}`, bytes: bytesWritten}\n}\n\n/** A wait that keeps running while the app is in the background, unlike a JS timer on Android. */\nexport function delay(ms: number): Promise<void> {\n const nativeDelay = MentraLocalNetwork?.delay\n if (typeof nativeDelay === \"function\") return nativeDelay.call(MentraLocalNetwork, Math.max(0, Math.round(ms)))\n return new Promise((resolve) => setTimeout(resolve, ms))\n}\n"]}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import * as native from "./native";
|
|
2
|
+
/**
|
|
3
|
+
* The glasses Wi-Fi service: the one owner of the phone-to-glasses Wi-Fi link.
|
|
4
|
+
*
|
|
5
|
+
* Photo fetches, gallery sync, hotspot OTA, Mentra Call, the managed relay and every fast link
|
|
6
|
+
* hold the link here and use the binding it gives them; none of them sends a hotspot command or
|
|
7
|
+
* joins a network itself. The link is shared: the first holder brings it up (Wi-Fi Direct on
|
|
8
|
+
* Android with glasses that advertise it, else the glasses' hotspot, then the phone's one native
|
|
9
|
+
* join), later holders get the same binding, and the last release takes it down.
|
|
10
|
+
*
|
|
11
|
+
* When the link goes down (the phone leaves the network, the glasses turn the AP off, restart, or
|
|
12
|
+
* leave Bluetooth), holders hear `lost`; the service asks for the link again once the glasses are
|
|
13
|
+
* back and ready, and holders hear `restored` with the new binding. Glasses that do not come back
|
|
14
|
+
* within [RESTORE_DEADLINE_MS] end it: holders hear `ended` and still release.
|
|
15
|
+
*/
|
|
16
|
+
export type GlassesWifiBinding = {
|
|
17
|
+
ssid: string;
|
|
18
|
+
password: string;
|
|
19
|
+
/** The glasses' address on the link. */
|
|
20
|
+
gateway: string;
|
|
21
|
+
/** The phone's address on the link, when the native join reports it. */
|
|
22
|
+
phoneIpv4?: string;
|
|
23
|
+
frequency?: number;
|
|
24
|
+
};
|
|
25
|
+
export type GlassesWifiEvent = {
|
|
26
|
+
type: "lost";
|
|
27
|
+
reason: string;
|
|
28
|
+
} | {
|
|
29
|
+
type: "restored";
|
|
30
|
+
binding: GlassesWifiBinding;
|
|
31
|
+
} | {
|
|
32
|
+
type: "ended";
|
|
33
|
+
reason: string;
|
|
34
|
+
};
|
|
35
|
+
export type GlassesWifiHoldOptions = {
|
|
36
|
+
/** Who holds it, for logs. */
|
|
37
|
+
consumer: string;
|
|
38
|
+
/** "incoming-server" when the glasses connect to the phone (OTA, video); it adds the VPN check. */
|
|
39
|
+
purpose?: native.JoinPurpose;
|
|
40
|
+
/** Aborting it while the link comes up gives the hold back. */
|
|
41
|
+
signal?: AbortSignal;
|
|
42
|
+
/** Runs once the glasses report the network and before the first join, e.g. an explanation. */
|
|
43
|
+
beforeJoin?: (ssid: string) => Promise<void>;
|
|
44
|
+
/** iOS: the join waited a few seconds for Local Network access, which may have been denied. */
|
|
45
|
+
onPermissionRequired?: (systemAnswer: string) => void;
|
|
46
|
+
/** Narration for a consumer that shows its steps. */
|
|
47
|
+
report?: (line: string) => void;
|
|
48
|
+
};
|
|
49
|
+
export interface GlassesWifiHold {
|
|
50
|
+
/** The link as it is now; after `lost`, the last one until `restored`. */
|
|
51
|
+
readonly binding: GlassesWifiBinding;
|
|
52
|
+
onChange(listener: (event: GlassesWifiEvent) => void): () => void;
|
|
53
|
+
/** The binding once the link is up: now, or when it is restored. Rejects when it ends or on abort. */
|
|
54
|
+
ready(signal?: AbortSignal): Promise<GlassesWifiBinding>;
|
|
55
|
+
/** Idempotent. The link goes down once nobody holds it. */
|
|
56
|
+
release(): Promise<void>;
|
|
57
|
+
}
|
|
58
|
+
/** Bringing the link up failed: the glasses did not enable it, or the phone did not join it. */
|
|
59
|
+
export declare class GlassesWifiError extends Error {
|
|
60
|
+
readonly stage: "enable" | "join";
|
|
61
|
+
readonly cause: unknown;
|
|
62
|
+
/** The native join's code, e.g. `SOFTAP_UNAVAILABLE`, when it has one. */
|
|
63
|
+
readonly code?: string;
|
|
64
|
+
constructor(stage: "enable" | "join", cause: unknown);
|
|
65
|
+
}
|
|
66
|
+
/** How often an enable is re-sent while a join waits: the glasses stop an AP unused for 120 s. */
|
|
67
|
+
export declare const JOIN_KEEPALIVE_MS = 30000;
|
|
68
|
+
/** The glasses report the AP enabled before its SSID is in the phone's scan. */
|
|
69
|
+
export declare const BROADCAST_WAIT_MS = 3000;
|
|
70
|
+
/** How long holders wait for glasses that restarted or left before the link ends. */
|
|
71
|
+
export declare const RESTORE_DEADLINE_MS: number;
|
|
72
|
+
/** How long after the last release an enabled report is taken as a late enable to undo (OS-2133). */
|
|
73
|
+
export declare const LATE_ENABLE_WINDOW_MS = 60000;
|
|
74
|
+
/** Hold the glasses Wi-Fi link, bringing it up if nobody holds it yet. */
|
|
75
|
+
export declare function holdGlassesWifi(options: GlassesWifiHoldOptions): Promise<GlassesWifiHold>;
|
|
76
|
+
/**
|
|
77
|
+
* Hold the link only if it is up now (someone else brought it up): for a use that is just as well
|
|
78
|
+
* served over Bluetooth, like a file fetch, and must not bring the link up itself. Null when it
|
|
79
|
+
* is down, coming up or going down.
|
|
80
|
+
*/
|
|
81
|
+
export declare function holdGlassesWifiIfUp(consumer: string): Promise<GlassesWifiHold | null>;
|
|
82
|
+
/** Whether the glasses Wi-Fi link is up now, for whoever holds it. */
|
|
83
|
+
export declare function glassesWifiUp(): boolean;
|
|
84
|
+
/** Hear the glasses Wi-Fi link go up and down, whoever holds it. */
|
|
85
|
+
export declare function onGlassesWifiUp(listener: (up: boolean) => void): () => void;
|
|
86
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/glasses-wifi/service.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAA;AAElC;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAA;IACf,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,gBAAgB,GACxB;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAC,GAC9B;IAAC,IAAI,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,kBAAkB,CAAA;CAAC,GAC/C;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAC,CAAA;AAEnC,MAAM,MAAM,sBAAsB,GAAG;IACnC,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,CAAA;IAChB,mGAAmG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