@mentra/bluetooth-sdk 3.5.0-dev.1518 → 3.5.0-dev.1520
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,497 @@
|
|
|
1
|
+
// The service is the one sender of hotspot commands; apps never see them.
|
|
2
|
+
// eslint-disable-next-line no-restricted-imports
|
|
3
|
+
import PrivateBluetoothSdkModule from "../_private/BluetoothSdkModule";
|
|
4
|
+
import { isConnectedGlassesConnectionStatus, isEnabledHotspotStatus, isReadyGlassesConnectionStatus, } from "../BluetoothSdk.types";
|
|
5
|
+
import { glassesConnection, onGlassesConnection, watchGlassesConnection } from "./connection";
|
|
6
|
+
import * as native from "./native";
|
|
7
|
+
/** Bringing the link up failed: the glasses did not enable it, or the phone did not join it. */
|
|
8
|
+
export class GlassesWifiError extends Error {
|
|
9
|
+
stage;
|
|
10
|
+
cause;
|
|
11
|
+
/** The native join's code, e.g. `SOFTAP_UNAVAILABLE`, when it has one. */
|
|
12
|
+
code;
|
|
13
|
+
constructor(stage, cause) {
|
|
14
|
+
super(cause instanceof Error ? cause.message : String(cause));
|
|
15
|
+
this.stage = stage;
|
|
16
|
+
this.cause = cause;
|
|
17
|
+
this.name = "GlassesWifiError";
|
|
18
|
+
const code = cause?.code;
|
|
19
|
+
if (typeof code === "string")
|
|
20
|
+
this.code = code;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/** How often an enable is re-sent while a join waits: the glasses stop an AP unused for 120 s. */
|
|
24
|
+
export const JOIN_KEEPALIVE_MS = 30_000;
|
|
25
|
+
/** The glasses report the AP enabled before its SSID is in the phone's scan. */
|
|
26
|
+
export const BROADCAST_WAIT_MS = 3_000;
|
|
27
|
+
/** How long holders wait for glasses that restarted or left before the link ends. */
|
|
28
|
+
export const RESTORE_DEADLINE_MS = 3 * 60_000;
|
|
29
|
+
/** How long after the last release an enabled report is taken as a late enable to undo (OS-2133). */
|
|
30
|
+
export const LATE_ENABLE_WINDOW_MS = 60_000;
|
|
31
|
+
const SESSION_REFRESH_CODES = new Set(["wifi_session_restarted", "wifi_session_changed"]);
|
|
32
|
+
const holders = new Set();
|
|
33
|
+
let binding = null;
|
|
34
|
+
let bringingUp = null;
|
|
35
|
+
let takingDown = null;
|
|
36
|
+
/** The radio of the link up or coming up. */
|
|
37
|
+
let linkType = null;
|
|
38
|
+
let lostAt = null;
|
|
39
|
+
/** Why the link ended, while it stays down; ready() rejects with it. */
|
|
40
|
+
let endedReason = null;
|
|
41
|
+
let releasedAt = Number.NEGATIVE_INFINITY;
|
|
42
|
+
let commands = Promise.resolve();
|
|
43
|
+
let watching = null;
|
|
44
|
+
let cancelRestore = null;
|
|
45
|
+
let cancelDeadline = null;
|
|
46
|
+
const upListeners = new Set();
|
|
47
|
+
let reclaiming = null;
|
|
48
|
+
/** The link's binding; whoever listens hears it go up and down. */
|
|
49
|
+
function setBinding(next) {
|
|
50
|
+
const changed = (binding === null) !== (next === null);
|
|
51
|
+
binding = next;
|
|
52
|
+
if (!changed)
|
|
53
|
+
return;
|
|
54
|
+
for (const listener of upListeners) {
|
|
55
|
+
try {
|
|
56
|
+
listener(next !== null);
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
console.warn("[GlassesWifi] A link listener failed", error);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const message = (error) => (error instanceof Error ? error.message : String(error));
|
|
64
|
+
/** Run `callback` after `ms`, also in the background; the returned function cancels it. */
|
|
65
|
+
function after(ms, callback) {
|
|
66
|
+
let cancelled = false;
|
|
67
|
+
void native.delay(ms).then(() => {
|
|
68
|
+
if (!cancelled)
|
|
69
|
+
callback();
|
|
70
|
+
});
|
|
71
|
+
return () => {
|
|
72
|
+
cancelled = true;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* One hotspot command at a time, re-sent once when a restarting ASG dropped it. ASG answers a
|
|
77
|
+
* same-state command with its current status, so a re-send never cycles the AP.
|
|
78
|
+
*/
|
|
79
|
+
function setHotspot(enabled) {
|
|
80
|
+
const send = async () => {
|
|
81
|
+
try {
|
|
82
|
+
return await PrivateBluetoothSdkModule.setHotspotState(enabled);
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
const code = error?.code;
|
|
86
|
+
if (!code || !SESSION_REFRESH_CODES.has(code))
|
|
87
|
+
throw error;
|
|
88
|
+
await native.delay(500);
|
|
89
|
+
return await PrivateBluetoothSdkModule.setHotspotState(enabled);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const run = commands.then(send, send);
|
|
93
|
+
commands = run.catch(() => undefined);
|
|
94
|
+
return run;
|
|
95
|
+
}
|
|
96
|
+
/** Hold the glasses Wi-Fi link, bringing it up if nobody holds it yet. */
|
|
97
|
+
export async function holdGlassesWifi(options) {
|
|
98
|
+
const holder = { options, listeners: new Set() };
|
|
99
|
+
if (takingDown)
|
|
100
|
+
await takingDown;
|
|
101
|
+
holders.add(holder);
|
|
102
|
+
watchLateHotspots();
|
|
103
|
+
await watch();
|
|
104
|
+
// A cancelled hold settles at once, whatever the link is doing; giving it back stops the
|
|
105
|
+
// bring-up when nobody else wants the link (the join waits on the person answering a prompt).
|
|
106
|
+
let abort = () => { };
|
|
107
|
+
const aborted = new Promise((_, reject) => {
|
|
108
|
+
abort = () => reject(new Error("Glasses Wi-Fi hold cancelled"));
|
|
109
|
+
});
|
|
110
|
+
aborted.catch(() => undefined);
|
|
111
|
+
options.signal?.addEventListener("abort", abort, { once: true });
|
|
112
|
+
let current;
|
|
113
|
+
try {
|
|
114
|
+
if (options.signal?.aborted)
|
|
115
|
+
throw new Error("Glasses Wi-Fi hold cancelled");
|
|
116
|
+
current = binding ?? (await Promise.race([bringingUp ?? bringUp(holder), aborted]));
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
// Not awaited: the teardown waits for the bring-up to settle, and the next hold waits for it.
|
|
120
|
+
void release(holder).catch((cause) => console.warn("[GlassesWifi] Giving back a failed hold failed", cause));
|
|
121
|
+
throw error;
|
|
122
|
+
}
|
|
123
|
+
finally {
|
|
124
|
+
options.signal?.removeEventListener("abort", abort);
|
|
125
|
+
}
|
|
126
|
+
console.log(`[GlassesWifi] ${options.consumer} holds the link (${holders.size} holder(s))`);
|
|
127
|
+
let released = null;
|
|
128
|
+
return {
|
|
129
|
+
get binding() {
|
|
130
|
+
return binding ?? current;
|
|
131
|
+
},
|
|
132
|
+
onChange(listener) {
|
|
133
|
+
holder.listeners.add(listener);
|
|
134
|
+
return () => holder.listeners.delete(listener);
|
|
135
|
+
},
|
|
136
|
+
ready(signal) {
|
|
137
|
+
if (binding)
|
|
138
|
+
return Promise.resolve(binding);
|
|
139
|
+
if (endedReason)
|
|
140
|
+
return Promise.reject(new Error(endedReason));
|
|
141
|
+
return new Promise((resolve, reject) => {
|
|
142
|
+
const done = () => {
|
|
143
|
+
holder.listeners.delete(listener);
|
|
144
|
+
signal?.removeEventListener("abort", onAbort);
|
|
145
|
+
};
|
|
146
|
+
const listener = (event) => {
|
|
147
|
+
if (event.type === "lost")
|
|
148
|
+
return;
|
|
149
|
+
done();
|
|
150
|
+
if (event.type === "restored")
|
|
151
|
+
resolve(event.binding);
|
|
152
|
+
else
|
|
153
|
+
reject(new Error(event.reason));
|
|
154
|
+
};
|
|
155
|
+
const onAbort = () => {
|
|
156
|
+
done();
|
|
157
|
+
reject(new Error("Glasses Wi-Fi wait cancelled"));
|
|
158
|
+
};
|
|
159
|
+
holder.listeners.add(listener);
|
|
160
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
161
|
+
});
|
|
162
|
+
},
|
|
163
|
+
release() {
|
|
164
|
+
released ??= release(holder);
|
|
165
|
+
return released;
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* The radio, chosen once per bring-up from the platform and the glasses' capability: Wi-Fi Direct
|
|
171
|
+
* on Android with glasses that advertise `wifi_direct_version`, the hotspot otherwise.
|
|
172
|
+
*/
|
|
173
|
+
function chooseLink() {
|
|
174
|
+
return native.wifiDirectAvailable() ? "wifi_direct" : "hotspot";
|
|
175
|
+
}
|
|
176
|
+
const purpose = () => [...holders].some((holder) => holder.options.purpose === "incoming-server") ? "incoming-server" : "outgoing-client";
|
|
177
|
+
function bringUp(first) {
|
|
178
|
+
const attempt = (async () => {
|
|
179
|
+
const report = (line) => first?.options.report?.(line);
|
|
180
|
+
linkType = chooseLink();
|
|
181
|
+
console.log(`[GlassesWifi] Bringing up the ${linkType} link`);
|
|
182
|
+
const joined = linkType === "wifi_direct" ? await joinWifiDirect(report) : await joinHotspot(first, report);
|
|
183
|
+
const wasLost = lostAt !== null;
|
|
184
|
+
setBinding(joined);
|
|
185
|
+
lostAt = null;
|
|
186
|
+
endedReason = null;
|
|
187
|
+
if (wasLost)
|
|
188
|
+
notify({ type: "restored", binding: joined });
|
|
189
|
+
return joined;
|
|
190
|
+
})();
|
|
191
|
+
bringingUp = attempt;
|
|
192
|
+
const settled = () => {
|
|
193
|
+
if (bringingUp === attempt)
|
|
194
|
+
bringingUp = null;
|
|
195
|
+
};
|
|
196
|
+
attempt.then(settled, settled);
|
|
197
|
+
return attempt;
|
|
198
|
+
}
|
|
199
|
+
async function joinHotspot(first, report) {
|
|
200
|
+
const status = await enableHotspot(report).catch((error) => {
|
|
201
|
+
throw new GlassesWifiError("enable", error);
|
|
202
|
+
});
|
|
203
|
+
assertWanted();
|
|
204
|
+
await beforeJoin(first, status.ssid);
|
|
205
|
+
assertWanted();
|
|
206
|
+
return await joinWithRetry(status, first, report).catch((error) => {
|
|
207
|
+
throw error instanceof GlassesWifiError ? error : new GlassesWifiError("join", error);
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
/** The native join asks the glasses for their group over Bluetooth and joins it, with no prompt. */
|
|
211
|
+
async function joinWifiDirect(report) {
|
|
212
|
+
assertWanted();
|
|
213
|
+
const joined = await native.joinWifiDirect(purpose()).catch((error) => {
|
|
214
|
+
throw new GlassesWifiError("join", error);
|
|
215
|
+
});
|
|
216
|
+
if (!joined.gateway)
|
|
217
|
+
throw new GlassesWifiError("join", new Error("The glasses reported no group address"));
|
|
218
|
+
report(`Joined the glasses' Wi-Fi Direct group ${joined.ssid}`);
|
|
219
|
+
// A group has no password the consumers need: the phone joined it with the one the glasses sent.
|
|
220
|
+
return { ssid: joined.ssid, password: "", gateway: joined.gateway, phoneIpv4: joined.localAddress };
|
|
221
|
+
}
|
|
222
|
+
async function enableHotspot(report) {
|
|
223
|
+
let status = await setHotspot(true).catch(async (error) => {
|
|
224
|
+
// An unanswered enable may still land: ask again rather than turn it off.
|
|
225
|
+
if (!/timed out waiting for glasses response|glasses did not answer/i.test(message(error)))
|
|
226
|
+
throw error;
|
|
227
|
+
report("Glasses did not answer; asking again");
|
|
228
|
+
return setHotspot(true);
|
|
229
|
+
});
|
|
230
|
+
if (!isEnabledHotspotStatus(status)) {
|
|
231
|
+
// A start racing the previous stop reports disabled: turn it off and start again once.
|
|
232
|
+
report("Glasses hotspot did not start; turning it off and trying again");
|
|
233
|
+
await setHotspot(false).catch(() => undefined);
|
|
234
|
+
await native.delay(1_000);
|
|
235
|
+
status = await setHotspot(true);
|
|
236
|
+
}
|
|
237
|
+
if (!isEnabledHotspotStatus(status) || !status.password) {
|
|
238
|
+
throw new Error(`The glasses hotspot did not start (state=${status.state})`);
|
|
239
|
+
}
|
|
240
|
+
report(`Glasses report hotspot ${status.ssid} enabled`);
|
|
241
|
+
await native.delay(BROADCAST_WAIT_MS);
|
|
242
|
+
return status;
|
|
243
|
+
}
|
|
244
|
+
async function joinWithRetry(status, first, report) {
|
|
245
|
+
try {
|
|
246
|
+
return await join(status, first);
|
|
247
|
+
}
|
|
248
|
+
catch (error) {
|
|
249
|
+
// Leaving the phone's previous Wi-Fi can make Android's first join fail as Unavailable.
|
|
250
|
+
// Cycle the AP and join again from an idle radio.
|
|
251
|
+
if (!/SOFTAP_UNAVAILABLE/.test(`${error?.code} ${message(error)}`))
|
|
252
|
+
throw error;
|
|
253
|
+
if (holders.size === 0)
|
|
254
|
+
throw error;
|
|
255
|
+
report("Phone couldn't join; cycling the glasses hotspot and trying again");
|
|
256
|
+
await setHotspot(false);
|
|
257
|
+
const again = await enableHotspot(report);
|
|
258
|
+
return await join(again, first);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* The first holder's step before the join, such as gallery's one-time explanation. It belongs to
|
|
263
|
+
* that holder: once it cancels, the bring-up stops waiting for it and goes on for anyone else.
|
|
264
|
+
*/
|
|
265
|
+
async function beforeJoin(first, ssid) {
|
|
266
|
+
const step = first?.options.beforeJoin;
|
|
267
|
+
const signal = first?.options.signal;
|
|
268
|
+
if (!step || signal?.aborted)
|
|
269
|
+
return;
|
|
270
|
+
let onAbort = () => { };
|
|
271
|
+
const cancelled = new Promise((resolve) => {
|
|
272
|
+
onAbort = resolve;
|
|
273
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
274
|
+
});
|
|
275
|
+
try {
|
|
276
|
+
await Promise.race([
|
|
277
|
+
step(ssid).catch((error) => {
|
|
278
|
+
if (!signal?.aborted)
|
|
279
|
+
throw error;
|
|
280
|
+
}),
|
|
281
|
+
cancelled,
|
|
282
|
+
]);
|
|
283
|
+
}
|
|
284
|
+
finally {
|
|
285
|
+
signal?.removeEventListener("abort", onAbort);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
/** A bring-up nobody holds any more stops before it starts a join, which has no time limit. */
|
|
289
|
+
function assertWanted() {
|
|
290
|
+
if (holders.size === 0)
|
|
291
|
+
throw new Error("Glasses Wi-Fi hold cancelled");
|
|
292
|
+
}
|
|
293
|
+
async function join(status, first) {
|
|
294
|
+
assertWanted();
|
|
295
|
+
const joining = native.joinHotspot(status.ssid, status.password, {
|
|
296
|
+
gateway: status.localIp,
|
|
297
|
+
frequency: status.frequency,
|
|
298
|
+
purpose: purpose(),
|
|
299
|
+
onPermissionRequired: (answer) => first?.options.onPermissionRequired?.(answer),
|
|
300
|
+
});
|
|
301
|
+
// The join has no time limit, so a person can take their time with the phone's prompt. Keep
|
|
302
|
+
// the AP up meanwhile: a repeated enable restarts the glasses' idle clock.
|
|
303
|
+
let keepAlive = () => { };
|
|
304
|
+
const scheduleKeepAlive = () => {
|
|
305
|
+
keepAlive = after(JOIN_KEEPALIVE_MS, () => {
|
|
306
|
+
setHotspot(true).then((current) => {
|
|
307
|
+
if (current.state !== "enabled")
|
|
308
|
+
void native.leave().catch(() => undefined);
|
|
309
|
+
}, (error) => console.warn("[GlassesWifi] Keeping the hotspot up during the join failed", error));
|
|
310
|
+
scheduleKeepAlive();
|
|
311
|
+
});
|
|
312
|
+
};
|
|
313
|
+
scheduleKeepAlive();
|
|
314
|
+
try {
|
|
315
|
+
const phoneIpv4 = await joining;
|
|
316
|
+
return {
|
|
317
|
+
ssid: status.ssid,
|
|
318
|
+
password: status.password,
|
|
319
|
+
gateway: status.localIp,
|
|
320
|
+
phoneIpv4,
|
|
321
|
+
frequency: status.frequency,
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
finally {
|
|
325
|
+
keepAlive();
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
async function release(holder) {
|
|
329
|
+
if (!holders.delete(holder))
|
|
330
|
+
return;
|
|
331
|
+
console.log(`[GlassesWifi] ${holder.options.consumer} released the link (${holders.size} left)`);
|
|
332
|
+
if (holders.size > 0)
|
|
333
|
+
return;
|
|
334
|
+
takingDown = takeDown().finally(() => {
|
|
335
|
+
takingDown = null;
|
|
336
|
+
});
|
|
337
|
+
await takingDown;
|
|
338
|
+
}
|
|
339
|
+
async function takeDown() {
|
|
340
|
+
unwatch();
|
|
341
|
+
if (bringingUp) {
|
|
342
|
+
void native.leave().catch(() => undefined);
|
|
343
|
+
await bringingUp.catch(() => undefined);
|
|
344
|
+
}
|
|
345
|
+
setBinding(null);
|
|
346
|
+
lostAt = null;
|
|
347
|
+
endedReason = null;
|
|
348
|
+
await native.leave().catch((error) => console.warn("[GlassesWifi] Leaving the glasses network failed", error));
|
|
349
|
+
releasedAt = Date.now();
|
|
350
|
+
// Leaving the Wi-Fi Direct group above also told the glasses to remove it.
|
|
351
|
+
const down = linkType;
|
|
352
|
+
linkType = null;
|
|
353
|
+
if (down === "wifi_direct")
|
|
354
|
+
return;
|
|
355
|
+
// Glasses away now get their AP turned off on return, by the late-hotspot watch, or by their idle stop.
|
|
356
|
+
if (!isConnectedGlassesConnectionStatus(glassesConnection()))
|
|
357
|
+
return;
|
|
358
|
+
for (let attempt = 1; attempt <= 2; attempt++) {
|
|
359
|
+
const status = await setHotspot(false).catch(() => null);
|
|
360
|
+
if (status?.state === "disabled")
|
|
361
|
+
return;
|
|
362
|
+
// A just-replaced ASG can drop the first command while its command path settles.
|
|
363
|
+
await native.delay(500);
|
|
364
|
+
}
|
|
365
|
+
console.warn("[GlassesWifi] The glasses did not confirm their hotspot is off");
|
|
366
|
+
}
|
|
367
|
+
function notify(event) {
|
|
368
|
+
for (const holder of holders) {
|
|
369
|
+
for (const listener of holder.listeners) {
|
|
370
|
+
try {
|
|
371
|
+
listener(event);
|
|
372
|
+
}
|
|
373
|
+
catch (error) {
|
|
374
|
+
console.warn(`[GlassesWifi] ${holder.options.consumer} failed handling ${event.type}`, error);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
function lose(reason) {
|
|
380
|
+
if (!binding || holders.size === 0)
|
|
381
|
+
return;
|
|
382
|
+
console.warn(`[GlassesWifi] The link went down: ${reason}`);
|
|
383
|
+
setBinding(null);
|
|
384
|
+
lostAt = Date.now();
|
|
385
|
+
void native.leave().catch(() => undefined);
|
|
386
|
+
notify({ type: "lost", reason });
|
|
387
|
+
scheduleRestore();
|
|
388
|
+
// Glasses that never come back still end the link at the deadline.
|
|
389
|
+
cancelDeadline?.();
|
|
390
|
+
cancelDeadline = after(RESTORE_DEADLINE_MS + 1, () => {
|
|
391
|
+
cancelDeadline = null;
|
|
392
|
+
void restore();
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
/** Ask for the link again once the glasses are ready, until it is back or the deadline passes. */
|
|
396
|
+
function scheduleRestore(delayMs = 0) {
|
|
397
|
+
cancelRestore?.();
|
|
398
|
+
cancelRestore = after(delayMs, () => {
|
|
399
|
+
cancelRestore = null;
|
|
400
|
+
void restore();
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
async function restore() {
|
|
404
|
+
if (binding || bringingUp || holders.size === 0 || lostAt === null)
|
|
405
|
+
return;
|
|
406
|
+
if (Date.now() - lostAt > RESTORE_DEADLINE_MS) {
|
|
407
|
+
lostAt = null;
|
|
408
|
+
endedReason = "the glasses did not bring the link back";
|
|
409
|
+
notify({ type: "ended", reason: endedReason });
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
if (!isReadyGlassesConnectionStatus(glassesConnection()))
|
|
413
|
+
return; // the connection watch calls again
|
|
414
|
+
try {
|
|
415
|
+
await bringUp(null);
|
|
416
|
+
}
|
|
417
|
+
catch (error) {
|
|
418
|
+
console.warn("[GlassesWifi] Bringing the link back failed; trying again", error);
|
|
419
|
+
scheduleRestore(5_000);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
async function watch() {
|
|
423
|
+
if (watching)
|
|
424
|
+
return;
|
|
425
|
+
const unsubscribeStatus = onGlassesConnection(onConnection);
|
|
426
|
+
const networkLost = native.onLost(() => lose("the phone left the glasses network"));
|
|
427
|
+
const hotspot = PrivateBluetoothSdkModule.addListener("hotspot_status_change", (event) => {
|
|
428
|
+
if (linkType === "hotspot" && event.state !== "enabled" && !bringingUp)
|
|
429
|
+
lose("the glasses turned their hotspot off");
|
|
430
|
+
});
|
|
431
|
+
watching = () => {
|
|
432
|
+
unsubscribeStatus();
|
|
433
|
+
networkLost();
|
|
434
|
+
hotspot.remove();
|
|
435
|
+
};
|
|
436
|
+
await watchGlassesConnection();
|
|
437
|
+
}
|
|
438
|
+
function onConnection(next) {
|
|
439
|
+
if (!isConnectedGlassesConnectionStatus(next)) {
|
|
440
|
+
// A join still waiting cannot finish without the glasses: end it, as a loss does.
|
|
441
|
+
if (bringingUp)
|
|
442
|
+
void native.leave().catch(() => undefined);
|
|
443
|
+
lose("the glasses left Bluetooth");
|
|
444
|
+
}
|
|
445
|
+
else if (lostAt !== null && isReadyGlassesConnectionStatus(next))
|
|
446
|
+
scheduleRestore();
|
|
447
|
+
}
|
|
448
|
+
function unwatch() {
|
|
449
|
+
watching?.();
|
|
450
|
+
watching = null;
|
|
451
|
+
cancelRestore?.();
|
|
452
|
+
cancelRestore = null;
|
|
453
|
+
cancelDeadline?.();
|
|
454
|
+
cancelDeadline = null;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Hold the link only if it is up now (someone else brought it up): for a use that is just as well
|
|
458
|
+
* served over Bluetooth, like a file fetch, and must not bring the link up itself. Null when it
|
|
459
|
+
* is down, coming up or going down.
|
|
460
|
+
*/
|
|
461
|
+
export async function holdGlassesWifiIfUp(consumer) {
|
|
462
|
+
if (holders.size === 0 || !binding || lostAt !== null || bringingUp || takingDown)
|
|
463
|
+
return null;
|
|
464
|
+
return holdGlassesWifi({ consumer });
|
|
465
|
+
}
|
|
466
|
+
/** Whether anyone holds the link now. */
|
|
467
|
+
function held() {
|
|
468
|
+
return holders.size > 0 || takingDown !== null;
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Turn off a hotspot that came up with no holder soon after the last release: a hotspot command
|
|
472
|
+
* can wait in the BLE queue past its caller and reach the glasses after the release (OS-2133).
|
|
473
|
+
* An AP the glasses start on their own, long after any phone use, is left alone. Watched from the
|
|
474
|
+
* first hold on, since only a release opens the window.
|
|
475
|
+
*/
|
|
476
|
+
function watchLateHotspots() {
|
|
477
|
+
if (reclaiming)
|
|
478
|
+
return;
|
|
479
|
+
reclaiming = PrivateBluetoothSdkModule.addListener("hotspot_status_change", (event) => {
|
|
480
|
+
if (event.state !== "enabled" || held() || Date.now() - releasedAt >= LATE_ENABLE_WINDOW_MS)
|
|
481
|
+
return;
|
|
482
|
+
console.warn("[GlassesWifi] An enabled hotspot has no holder after a release; turning it off");
|
|
483
|
+
void setHotspot(false).catch((error) => console.warn("[GlassesWifi] Could not turn off the late hotspot", error));
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
/** Whether the glasses Wi-Fi link is up now, for whoever holds it. */
|
|
487
|
+
export function glassesWifiUp() {
|
|
488
|
+
return binding !== null;
|
|
489
|
+
}
|
|
490
|
+
/** Hear the glasses Wi-Fi link go up and down, whoever holds it. */
|
|
491
|
+
export function onGlassesWifiUp(listener) {
|
|
492
|
+
upListeners.add(listener);
|
|
493
|
+
return () => {
|
|
494
|
+
upListeners.delete(listener);
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/glasses-wifi/service.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,iDAAiD;AACjD,OAAO,yBAAyB,MAAM,gCAAgC,CAAA;AACtE,OAAO,EACL,kCAAkC,EAClC,sBAAsB,EACtB,8BAA8B,GAG/B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAC,iBAAiB,EAAE,mBAAmB,EAAE,sBAAsB,EAAC,MAAM,cAAc,CAAA;AAC3F,OAAO,KAAK,MAAM,MAAM,UAAU,CAAA;AAyDlC,gGAAgG;AAChG,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAGpB;IAAmC;IAFxD,0EAA0E;IACjE,IAAI,CAAS;IACtB,YAAqB,KAAwB,EAAW,KAAc;QACpE,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;QAD1C,UAAK,GAAL,KAAK,CAAmB;QAAW,UAAK,GAAL,KAAK,CAAS;QAEpE,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAA;QAC9B,MAAM,IAAI,GAAI,KAAiC,EAAE,IAAI,CAAA;QACrD,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,IAAI,CAAC,IAAI,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;AACzC,SAAS,IAAI;IACX,OAAO,OAAO,CAAC,IAAI,GAAG,CAAC,IAAI,UAAU,KAAK,IAAI,CAAA;AAChD,CAAC;AAED;;;;;GAKG;AACH,SAAS,iBAAiB;IACxB,IAAI,UAAU;QAAE,OAAM;IACtB,UAAU,GAAG,yBAAyB,CAAC,WAAW,CAAC,uBAAuB,EAAE,CAAC,KAAK,EAAE,EAAE;QACpF,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,UAAU,IAAI,qBAAqB;YAAE,OAAM;QACnG,OAAO,CAAC,IAAI,CAAC,gFAAgF,CAAC,CAAA;QAC9F,KAAK,UAAU,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,mDAAmD,EAAE,KAAK,CAAC,CAAC,CAAA;IACnH,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,aAAa;IAC3B,OAAO,OAAO,KAAK,IAAI,CAAA;AACzB,CAAC;AAED,oEAAoE;AACpE,MAAM,UAAU,eAAe,CAAC,QAA+B;IAC7D,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IACzB,OAAO,GAAG,EAAE;QACV,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IAC9B,CAAC,CAAA;AACH,CAAC","sourcesContent":["// The service is the one sender of hotspot commands; apps never see them.\n// eslint-disable-next-line no-restricted-imports\nimport PrivateBluetoothSdkModule from \"../_private/BluetoothSdkModule\"\nimport {\n isConnectedGlassesConnectionStatus,\n isEnabledHotspotStatus,\n isReadyGlassesConnectionStatus,\n type GlassesConnectionStatus,\n type HotspotStatus,\n} from \"../BluetoothSdk.types\"\nimport {glassesConnection, onGlassesConnection, watchGlassesConnection} from \"./connection\"\nimport * as native from \"./native\"\n\n/**\n * The glasses Wi-Fi service: the one owner of the phone-to-glasses Wi-Fi link.\n *\n * Photo fetches, gallery sync, hotspot OTA, Mentra Call, the managed relay and every fast link\n * hold the link here and use the binding it gives them; none of them sends a hotspot command or\n * joins a network itself. The link is shared: the first holder brings it up (Wi-Fi Direct on\n * Android with glasses that advertise it, else the glasses' hotspot, then the phone's one native\n * join), later holders get the same binding, and the last release takes it down.\n *\n * When the link goes down (the phone leaves the network, the glasses turn the AP off, restart, or\n * leave Bluetooth), holders hear `lost`; the service asks for the link again once the glasses are\n * back and ready, and holders hear `restored` with the new binding. Glasses that do not come back\n * within [RESTORE_DEADLINE_MS] end it: holders hear `ended` and still release.\n */\n\nexport type GlassesWifiBinding = {\n ssid: string\n password: string\n /** The glasses' address on the link. */\n gateway: string\n /** The phone's address on the link, when the native join reports it. */\n phoneIpv4?: string\n frequency?: number\n}\n\nexport type GlassesWifiEvent =\n | {type: \"lost\"; reason: string}\n | {type: \"restored\"; binding: GlassesWifiBinding}\n | {type: \"ended\"; reason: string}\n\nexport type GlassesWifiHoldOptions = {\n /** Who holds it, for logs. */\n consumer: string\n /** \"incoming-server\" when the glasses connect to the phone (OTA, video); it adds the VPN check. */\n purpose?: native.JoinPurpose\n /** Aborting it while the link comes up gives the hold back. */\n signal?: AbortSignal\n /** Runs once the glasses report the network and before the first join, e.g. an explanation. */\n beforeJoin?: (ssid: string) => Promise<void>\n /** iOS: the join waited a few seconds for Local Network access, which may have been denied. */\n onPermissionRequired?: (systemAnswer: string) => void\n /** Narration for a consumer that shows its steps. */\n report?: (line: string) => void\n}\n\nexport interface GlassesWifiHold {\n /** The link as it is now; after `lost`, the last one until `restored`. */\n readonly binding: GlassesWifiBinding\n onChange(listener: (event: GlassesWifiEvent) => void): () => void\n /** The binding once the link is up: now, or when it is restored. Rejects when it ends or on abort. */\n ready(signal?: AbortSignal): Promise<GlassesWifiBinding>\n /** Idempotent. The link goes down once nobody holds it. */\n release(): Promise<void>\n}\n\n/** Bringing the link up failed: the glasses did not enable it, or the phone did not join it. */\nexport class GlassesWifiError extends Error {\n /** The native join's code, e.g. `SOFTAP_UNAVAILABLE`, when it has one. */\n readonly code?: string\n constructor(readonly stage: \"enable\" | \"join\", readonly cause: unknown) {\n super(cause instanceof Error ? cause.message : String(cause))\n this.name = \"GlassesWifiError\"\n const code = (cause as {code?: unknown} | null)?.code\n if (typeof code === \"string\") this.code = code\n }\n}\n\n/** How often an enable is re-sent while a join waits: the glasses stop an AP unused for 120 s. */\nexport const JOIN_KEEPALIVE_MS = 30_000\n/** The glasses report the AP enabled before its SSID is in the phone's scan. */\nexport const BROADCAST_WAIT_MS = 3_000\n/** How long holders wait for glasses that restarted or left before the link ends. */\nexport const RESTORE_DEADLINE_MS = 3 * 60_000\n/** How long after the last release an enabled report is taken as a late enable to undo (OS-2133). */\nexport const LATE_ENABLE_WINDOW_MS = 60_000\n\nconst SESSION_REFRESH_CODES = new Set([\"wifi_session_restarted\", \"wifi_session_changed\"])\n\ntype Holder = {options: GlassesWifiHoldOptions; listeners: Set<(event: GlassesWifiEvent) => void>}\ntype Link = \"hotspot\" | \"wifi_direct\"\n\nconst holders = new Set<Holder>()\nlet binding: GlassesWifiBinding | null = null\nlet bringingUp: Promise<GlassesWifiBinding> | null = null\nlet takingDown: Promise<void> | null = null\n/** The radio of the link up or coming up. */\nlet linkType: Link | null = null\nlet lostAt: number | null = null\n/** Why the link ended, while it stays down; ready() rejects with it. */\nlet endedReason: string | null = null\nlet releasedAt = Number.NEGATIVE_INFINITY\nlet commands: Promise<unknown> = Promise.resolve()\nlet watching: (() => void) | null = null\nlet cancelRestore: (() => void) | null = null\nlet cancelDeadline: (() => void) | null = null\nconst upListeners = new Set<(up: boolean) => void>()\nlet reclaiming: {remove(): void} | null = null\n\n/** The link's binding; whoever listens hears it go up and down. */\nfunction setBinding(next: GlassesWifiBinding | null): void {\n const changed = (binding === null) !== (next === null)\n binding = next\n if (!changed) return\n for (const listener of upListeners) {\n try {\n listener(next !== null)\n } catch (error) {\n console.warn(\"[GlassesWifi] A link listener failed\", error)\n }\n }\n}\n\nconst message = (error: unknown) => (error instanceof Error ? error.message : String(error))\n\n/** Run `callback` after `ms`, also in the background; the returned function cancels it. */\nfunction after(ms: number, callback: () => void): () => void {\n let cancelled = false\n void native.delay(ms).then(() => {\n if (!cancelled) callback()\n })\n return () => {\n cancelled = true\n }\n}\n\n/**\n * One hotspot command at a time, re-sent once when a restarting ASG dropped it. ASG answers a\n * same-state command with its current status, so a re-send never cycles the AP.\n */\nfunction setHotspot(enabled: boolean): Promise<HotspotStatus> {\n const send = async () => {\n try {\n return await PrivateBluetoothSdkModule.setHotspotState(enabled)\n } catch (error) {\n const code = (error as {code?: string} | null)?.code\n if (!code || !SESSION_REFRESH_CODES.has(code)) throw error\n await native.delay(500)\n return await PrivateBluetoothSdkModule.setHotspotState(enabled)\n }\n }\n const run = commands.then(send, send)\n commands = run.catch(() => undefined)\n return run\n}\n\n/** Hold the glasses Wi-Fi link, bringing it up if nobody holds it yet. */\nexport async function holdGlassesWifi(options: GlassesWifiHoldOptions): Promise<GlassesWifiHold> {\n const holder: Holder = {options, listeners: new Set()}\n if (takingDown) await takingDown\n holders.add(holder)\n watchLateHotspots()\n await watch()\n // A cancelled hold settles at once, whatever the link is doing; giving it back stops the\n // bring-up when nobody else wants the link (the join waits on the person answering a prompt).\n let abort = () => {}\n const aborted = new Promise<never>((_, reject) => {\n abort = () => reject(new Error(\"Glasses Wi-Fi hold cancelled\"))\n })\n aborted.catch(() => undefined)\n options.signal?.addEventListener(\"abort\", abort, {once: true})\n let current: GlassesWifiBinding\n try {\n if (options.signal?.aborted) throw new Error(\"Glasses Wi-Fi hold cancelled\")\n current = binding ?? (await Promise.race([bringingUp ?? bringUp(holder), aborted]))\n } catch (error) {\n // Not awaited: the teardown waits for the bring-up to settle, and the next hold waits for it.\n void release(holder).catch((cause) => console.warn(\"[GlassesWifi] Giving back a failed hold failed\", cause))\n throw error\n } finally {\n options.signal?.removeEventListener(\"abort\", abort)\n }\n console.log(`[GlassesWifi] ${options.consumer} holds the link (${holders.size} holder(s))`)\n let released: Promise<void> | null = null\n return {\n get binding() {\n return binding ?? current\n },\n onChange(listener) {\n holder.listeners.add(listener)\n return () => holder.listeners.delete(listener)\n },\n ready(signal) {\n if (binding) return Promise.resolve(binding)\n if (endedReason) return Promise.reject(new Error(endedReason))\n return new Promise((resolve, reject) => {\n const done = () => {\n holder.listeners.delete(listener)\n signal?.removeEventListener(\"abort\", onAbort)\n }\n const listener = (event: GlassesWifiEvent) => {\n if (event.type === \"lost\") return\n done()\n if (event.type === \"restored\") resolve(event.binding)\n else reject(new Error(event.reason))\n }\n const onAbort = () => {\n done()\n reject(new Error(\"Glasses Wi-Fi wait cancelled\"))\n }\n holder.listeners.add(listener)\n signal?.addEventListener(\"abort\", onAbort, {once: true})\n })\n },\n release() {\n released ??= release(holder)\n return released\n },\n }\n}\n\n/**\n * The radio, chosen once per bring-up from the platform and the glasses' capability: Wi-Fi Direct\n * on Android with glasses that advertise `wifi_direct_version`, the hotspot otherwise.\n */\nfunction chooseLink(): Link {\n return native.wifiDirectAvailable() ? \"wifi_direct\" : \"hotspot\"\n}\n\nconst purpose = (): native.JoinPurpose =>\n [...holders].some((holder) => holder.options.purpose === \"incoming-server\") ? \"incoming-server\" : \"outgoing-client\"\n\nfunction bringUp(first: Holder | null): Promise<GlassesWifiBinding> {\n const attempt = (async () => {\n const report = (line: string) => first?.options.report?.(line)\n linkType = chooseLink()\n console.log(`[GlassesWifi] Bringing up the ${linkType} link`)\n const joined = linkType === \"wifi_direct\" ? await joinWifiDirect(report) : await joinHotspot(first, report)\n const wasLost = lostAt !== null\n setBinding(joined)\n lostAt = null\n endedReason = null\n if (wasLost) notify({type: \"restored\", binding: joined})\n return joined\n })()\n bringingUp = attempt\n const settled = () => {\n if (bringingUp === attempt) bringingUp = null\n }\n attempt.then(settled, settled)\n return attempt\n}\n\nasync function joinHotspot(first: Holder | null, report: (line: string) => void): Promise<GlassesWifiBinding> {\n const status = await enableHotspot(report).catch((error) => {\n throw new GlassesWifiError(\"enable\", error)\n })\n assertWanted()\n await beforeJoin(first, status.ssid)\n assertWanted()\n return await joinWithRetry(status, first, report).catch((error) => {\n throw error instanceof GlassesWifiError ? error : new GlassesWifiError(\"join\", error)\n })\n}\n\n/** The native join asks the glasses for their group over Bluetooth and joins it, with no prompt. */\nasync function joinWifiDirect(report: (line: string) => void): Promise<GlassesWifiBinding> {\n assertWanted()\n const joined = await native.joinWifiDirect(purpose()).catch((error) => {\n throw new GlassesWifiError(\"join\", error)\n })\n if (!joined.gateway) throw new GlassesWifiError(\"join\", new Error(\"The glasses reported no group address\"))\n report(`Joined the glasses' Wi-Fi Direct group ${joined.ssid}`)\n // A group has no password the consumers need: the phone joined it with the one the glasses sent.\n return {ssid: joined.ssid, password: \"\", gateway: joined.gateway, phoneIpv4: joined.localAddress}\n}\n\nasync function enableHotspot(report: (line: string) => void) {\n let status = await setHotspot(true).catch(async (error) => {\n // An unanswered enable may still land: ask again rather than turn it off.\n if (!/timed out waiting for glasses response|glasses did not answer/i.test(message(error))) throw error\n report(\"Glasses did not answer; asking again\")\n return setHotspot(true)\n })\n if (!isEnabledHotspotStatus(status)) {\n // A start racing the previous stop reports disabled: turn it off and start again once.\n report(\"Glasses hotspot did not start; turning it off and trying again\")\n await setHotspot(false).catch(() => undefined)\n await native.delay(1_000)\n status = await setHotspot(true)\n }\n if (!isEnabledHotspotStatus(status) || !status.password) {\n throw new Error(`The glasses hotspot did not start (state=${status.state})`)\n }\n report(`Glasses report hotspot ${status.ssid} enabled`)\n await native.delay(BROADCAST_WAIT_MS)\n return status\n}\n\nasync function joinWithRetry(\n status: Extract<HotspotStatus, {state: \"enabled\"}>,\n first: Holder | null,\n report: (line: string) => void,\n): Promise<GlassesWifiBinding> {\n try {\n return await join(status, first)\n } catch (error) {\n // Leaving the phone's previous Wi-Fi can make Android's first join fail as Unavailable.\n // Cycle the AP and join again from an idle radio.\n if (!/SOFTAP_UNAVAILABLE/.test(`${(error as {code?: string})?.code} ${message(error)}`)) throw error\n if (holders.size === 0) throw error\n report(\"Phone couldn't join; cycling the glasses hotspot and trying again\")\n await setHotspot(false)\n const again = await enableHotspot(report)\n return await join(again, first)\n }\n}\n\n/**\n * The first holder's step before the join, such as gallery's one-time explanation. It belongs to\n * that holder: once it cancels, the bring-up stops waiting for it and goes on for anyone else.\n */\nasync function beforeJoin(first: Holder | null, ssid: string): Promise<void> {\n const step = first?.options.beforeJoin\n const signal = first?.options.signal\n if (!step || signal?.aborted) return\n let onAbort = () => {}\n const cancelled = new Promise<void>((resolve) => {\n onAbort = resolve\n signal?.addEventListener(\"abort\", onAbort, {once: true})\n })\n try {\n await Promise.race([\n step(ssid).catch((error) => {\n if (!signal?.aborted) throw error\n }),\n cancelled,\n ])\n } finally {\n signal?.removeEventListener(\"abort\", onAbort)\n }\n}\n\n/** A bring-up nobody holds any more stops before it starts a join, which has no time limit. */\nfunction assertWanted(): void {\n if (holders.size === 0) throw new Error(\"Glasses Wi-Fi hold cancelled\")\n}\n\nasync function join(\n status: Extract<HotspotStatus, {state: \"enabled\"}>,\n first: Holder | null,\n): Promise<GlassesWifiBinding> {\n assertWanted()\n const joining = native.joinHotspot(status.ssid, status.password, {\n gateway: status.localIp,\n frequency: status.frequency,\n purpose: purpose(),\n onPermissionRequired: (answer) => first?.options.onPermissionRequired?.(answer),\n })\n // The join has no time limit, so a person can take their time with the phone's prompt. Keep\n // the AP up meanwhile: a repeated enable restarts the glasses' idle clock.\n let keepAlive = () => {}\n const scheduleKeepAlive = () => {\n keepAlive = after(JOIN_KEEPALIVE_MS, () => {\n setHotspot(true).then(\n (current) => {\n if (current.state !== \"enabled\") void native.leave().catch(() => undefined)\n },\n (error) => console.warn(\"[GlassesWifi] Keeping the hotspot up during the join failed\", error),\n )\n scheduleKeepAlive()\n })\n }\n scheduleKeepAlive()\n try {\n const phoneIpv4 = await joining\n return {\n ssid: status.ssid,\n password: status.password,\n gateway: status.localIp,\n phoneIpv4,\n frequency: status.frequency,\n }\n } finally {\n keepAlive()\n }\n}\n\nasync function release(holder: Holder): Promise<void> {\n if (!holders.delete(holder)) return\n console.log(`[GlassesWifi] ${holder.options.consumer} released the link (${holders.size} left)`)\n if (holders.size > 0) return\n takingDown = takeDown().finally(() => {\n takingDown = null\n })\n await takingDown\n}\n\nasync function takeDown(): Promise<void> {\n unwatch()\n if (bringingUp) {\n void native.leave().catch(() => undefined)\n await bringingUp.catch(() => undefined)\n }\n setBinding(null)\n lostAt = null\n endedReason = null\n await native.leave().catch((error) => console.warn(\"[GlassesWifi] Leaving the glasses network failed\", error))\n releasedAt = Date.now()\n // Leaving the Wi-Fi Direct group above also told the glasses to remove it.\n const down = linkType\n linkType = null\n if (down === \"wifi_direct\") return\n // Glasses away now get their AP turned off on return, by the late-hotspot watch, or by their idle stop.\n if (!isConnectedGlassesConnectionStatus(glassesConnection())) return\n for (let attempt = 1; attempt <= 2; attempt++) {\n const status = await setHotspot(false).catch(() => null)\n if (status?.state === \"disabled\") return\n // A just-replaced ASG can drop the first command while its command path settles.\n await native.delay(500)\n }\n console.warn(\"[GlassesWifi] The glasses did not confirm their hotspot is off\")\n}\n\nfunction notify(event: GlassesWifiEvent): void {\n for (const holder of holders) {\n for (const listener of holder.listeners) {\n try {\n listener(event)\n } catch (error) {\n console.warn(`[GlassesWifi] ${holder.options.consumer} failed handling ${event.type}`, error)\n }\n }\n }\n}\n\nfunction lose(reason: string): void {\n if (!binding || holders.size === 0) return\n console.warn(`[GlassesWifi] The link went down: ${reason}`)\n setBinding(null)\n lostAt = Date.now()\n void native.leave().catch(() => undefined)\n notify({type: \"lost\", reason})\n scheduleRestore()\n // Glasses that never come back still end the link at the deadline.\n cancelDeadline?.()\n cancelDeadline = after(RESTORE_DEADLINE_MS + 1, () => {\n cancelDeadline = null\n void restore()\n })\n}\n\n/** Ask for the link again once the glasses are ready, until it is back or the deadline passes. */\nfunction scheduleRestore(delayMs = 0): void {\n cancelRestore?.()\n cancelRestore = after(delayMs, () => {\n cancelRestore = null\n void restore()\n })\n}\n\nasync function restore(): Promise<void> {\n if (binding || bringingUp || holders.size === 0 || lostAt === null) return\n if (Date.now() - lostAt > RESTORE_DEADLINE_MS) {\n lostAt = null\n endedReason = \"the glasses did not bring the link back\"\n notify({type: \"ended\", reason: endedReason})\n return\n }\n if (!isReadyGlassesConnectionStatus(glassesConnection())) return // the connection watch calls again\n try {\n await bringUp(null)\n } catch (error) {\n console.warn(\"[GlassesWifi] Bringing the link back failed; trying again\", error)\n scheduleRestore(5_000)\n }\n}\n\nasync function watch(): Promise<void> {\n if (watching) return\n const unsubscribeStatus = onGlassesConnection(onConnection)\n const networkLost = native.onLost(() => lose(\"the phone left the glasses network\"))\n const hotspot = PrivateBluetoothSdkModule.addListener(\"hotspot_status_change\", (event) => {\n if (linkType === \"hotspot\" && event.state !== \"enabled\" && !bringingUp) lose(\"the glasses turned their hotspot off\")\n })\n watching = () => {\n unsubscribeStatus()\n networkLost()\n hotspot.remove()\n }\n await watchGlassesConnection()\n}\n\nfunction onConnection(next: GlassesConnectionStatus): void {\n if (!isConnectedGlassesConnectionStatus(next)) {\n // A join still waiting cannot finish without the glasses: end it, as a loss does.\n if (bringingUp) void native.leave().catch(() => undefined)\n lose(\"the glasses left Bluetooth\")\n } else if (lostAt !== null && isReadyGlassesConnectionStatus(next)) scheduleRestore()\n}\n\nfunction unwatch(): void {\n watching?.()\n watching = null\n cancelRestore?.()\n cancelRestore = null\n cancelDeadline?.()\n cancelDeadline = null\n}\n\n/**\n * Hold the link only if it is up now (someone else brought it up): for a use that is just as well\n * served over Bluetooth, like a file fetch, and must not bring the link up itself. Null when it\n * is down, coming up or going down.\n */\nexport async function holdGlassesWifiIfUp(consumer: string): Promise<GlassesWifiHold | null> {\n if (holders.size === 0 || !binding || lostAt !== null || bringingUp || takingDown) return null\n return holdGlassesWifi({consumer})\n}\n\n/** Whether anyone holds the link now. */\nfunction held(): boolean {\n return holders.size > 0 || takingDown !== null\n}\n\n/**\n * Turn off a hotspot that came up with no holder soon after the last release: a hotspot command\n * can wait in the BLE queue past its caller and reach the glasses after the release (OS-2133).\n * An AP the glasses start on their own, long after any phone use, is left alone. Watched from the\n * first hold on, since only a release opens the window.\n */\nfunction watchLateHotspots(): void {\n if (reclaiming) return\n reclaiming = PrivateBluetoothSdkModule.addListener(\"hotspot_status_change\", (event) => {\n if (event.state !== \"enabled\" || held() || Date.now() - releasedAt >= LATE_ENABLE_WINDOW_MS) return\n console.warn(\"[GlassesWifi] An enabled hotspot has no holder after a release; turning it off\")\n void setHotspot(false).catch((error) => console.warn(\"[GlassesWifi] Could not turn off the late hotspot\", error))\n })\n}\n\n/** Whether the glasses Wi-Fi link is up now, for whoever holds it. */\nexport function glassesWifiUp(): boolean {\n return binding !== null\n}\n\n/** Hear the glasses Wi-Fi link go up and down, whoever holds it. */\nexport function onGlassesWifiUp(listener: (up: boolean) => void): () => void {\n upListeners.add(listener)\n return () => {\n upListeners.delete(listener)\n }\n}\n"]}
|
package/build/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { BluetoothSdkPublicModule } from "./BluetoothSdk.types";
|
|
2
2
|
export declare const BluetoothSdk: BluetoothSdkPublicModule;
|
|
3
3
|
export default BluetoothSdk;
|
|
4
|
-
export {
|
|
5
|
-
export type {
|
|
4
|
+
export type { GlassesLink, LinkState } from "./glasses-wifi/link";
|
|
5
|
+
export type { ContinuousCapture, ContinuousState } from "./glasses-wifi/continuous";
|
|
6
|
+
export { CAMERA_FOV_DEFAULT, CAMERA_FOV_MAX, CAMERA_FOV_MIN, DeviceModels, isBusyGlassesConnectionStatus, isConnectedGlassesConnectionStatus, isConnectedWifiStatus, isReadyGlassesConnectionStatus, } from "./BluetoothSdk.types";
|
|
7
|
+
export type { AccelEvent, Ar99OtaStatusEvent, AudioConnectedEvent, AudioDisconnectedEvent, AudioPairingNeededEvent, BatteryStatusEvent, BesCrashDetectedEvent, BesCrashEviction, BesCrashIncidentState, BesCrashSummary, BluetoothSdkEvent, BluetoothSdkEventListener, BluetoothSdkEventMap, BluetoothSdkEventName, BluetoothSdkPublicModule as BluetoothSdkModule, BluetoothSdkSubscription, ButtonPhotoSize, PhotoCaptureDefaults, ButtonPressEvent, CameraFovPreset, CameraFovRequest, CameraFovResult, CameraRoiPosition, CompatibleGlassesSearchStopEvent, ConnectOptions, ConnectedGlassesConnectionStatus, ConnectedWifiStatus, Device, DeviceModel, GalleryStatusEvent, GlassesConnectionStatus, GlassesMediaVolumeGetResult, GlassesMediaVolumeSetResult, GlassesNotReadyEvent, HeadUpEvent, GlassesSessionChangedEvent, KeepAliveAckEvent, LocalTranscriptionEvent, WakeWordEvent, SpeechActivityEvent, LogEvent, MicLc3Event, MicHealthEvent, MicMode, MicPcmEvent, MicPreference, OtaStartAckEvent, OtaProgress, OtaProgressStatus, OtaStage, OtaStatus, OtaStatusEvent, OtaQueryResult, OtaUpdateInfo, ReleaseChangelog, MtkUpdateCompleteEvent, PairFailureCode, PairFailureEvent, PairingInfoEvent, EnteringPairingModeEvent, MentraLivePairingState, PairingModeEndedEvent, PairingModeEndedReason, PairingStateChangedEvent, GlassesAudioSetupState, AudioSetupChangedEvent, OwnerReplacedEvent, PhotoCaptureMetadata, PhotoResolvedConfig, PhotoCompression, PhotoFpsRange, PhotoMeteredPreview, PhotoMode, PublicBluetoothStatus, PublicGlassesStatus, PhotoTransferMethod, PhotoResponseEvent, PhotoRequestedCaptureConfig, PhotoCapture, PhotoCaptureParams, PhotoPreview, PhotoTaken, PhotoUploadParams, PhotoSize, PhotoStatusEvent, PhotoStatusState, PhotoSuccessResponseEvent, RgbLedAction, RgbLedColor, RgbLedControlResponseEvent, RgbLedControlSuccessResponseEvent, ScanModelOptions, ScanDiagnostic, ScanOptions, ScanResultsCallback, SpeakingStatusEvent, SettingsAckEvent, SettingsAckSetting, SettingsAckSuccessEvent, SettingsAckSuccessStatus, SettingsAckStatus, StreamAudioConfig, StreamDegradationPreference, StreamResolvedConfig, StreamStartRequest, StreamStatusEvent, StreamStatusLifecycleState, StreamStatusReconnectState, StreamStatusState, StreamVideoConfig, SwipeVolumeStatusEvent, SwitchStatusEvent, TouchEvent, TouchGesture, VideoRecordingDefaults, VideoRecordingStartedStatusEvent, VideoRecordingStatusEvent, VideoRecordingStatusState, VideoRecordingStoppedStatusEvent, VideoRecordingSuccessStatusEvent, VersionInfoEvent, VersionInfoResult, SavedWifiNetworksEvent, SavedWifiNetworksOutcome, SavedWifiNetworksResult, WifiForgetOutcome, WifiForgetResult, WifiForgetResultEvent, LegacyWifiForgetResultEvent, ModernWifiForgetResultEvent, WifiScanResultEvent, VoiceActivityDetectionStatusEvent, WifiSearchResult, WifiStatus, WifiStatusChangeEvent, } from "./BluetoothSdk.types";
|
|
6
8
|
export type { NativeNotificationConfig, NativeNotificationStatus, NativeNotificationDelivery } from "./BluetoothSdk.types";
|
|
7
9
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAGV,wBAAwB,EAOzB,MAAM,sBAAsB,CAAA;AA2F7B,eAAO,MAAM,YAAY,EAAE,wBAkIzB,CAAA;AAEF,eAAe,YAAY,CAAA;AAE3B,YAAY,EAAC,WAAW,EAAE,SAAS,EAAC,MAAM,qBAAqB,CAAA;AAC/D,YAAY,EAAC,iBAAiB,EAAE,eAAe,EAAC,MAAM,2BAA2B,CAAA;AAEjF,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,YAAY,EACZ,6BAA6B,EAC7B,kCAAkC,EAClC,qBAAqB,EACrB,8BAA8B,GAC/B,MAAM,sBAAsB,CAAA;AAE7B,YAAY,EACV,UAAU,EACV,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACv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