@mentra/glasses-media 3.5.0-dev.1444 → 3.5.0-dev.1462
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.
|
@@ -13,6 +13,12 @@ final class MacHotspotAssociation {
|
|
|
13
13
|
static let autoJoinWait: TimeInterval = 15
|
|
14
14
|
/// Auto-join after a Wi-Fi power cycle: 2 s on lab air-1.
|
|
15
15
|
static let powerCycleWait: TimeInterval = 30
|
|
16
|
+
/// macOS answers an app without the scan entitlement from its cache until 10 s after its last live
|
|
17
|
+
/// scan returned (airportd, 2026-11-17), so scanning sooner only reads the scan that just missed.
|
|
18
|
+
static let scanInterval: TimeInterval = 10
|
|
19
|
+
/// Time to find and join the hotspot. A live scan takes about 22 s while the Mac is on another network,
|
|
20
|
+
/// so a minute holds two, and either can miss an AP that just came up (lab Mac, 2026-11-17). This holds four.
|
|
21
|
+
static let joinWindow: TimeInterval = 120
|
|
16
22
|
|
|
17
23
|
private let condition = NSCondition()
|
|
18
24
|
private var cancelled = false
|
|
@@ -26,7 +32,7 @@ final class MacHotspotAssociation {
|
|
|
26
32
|
private let makeInterface: () throws -> MacWifiInterface
|
|
27
33
|
private let authorization: MacHotspotAuthorization?
|
|
28
34
|
|
|
29
|
-
init(deadline: TimeInterval = ProcessInfo.processInfo.systemUptime +
|
|
35
|
+
init(deadline: TimeInterval = ProcessInfo.processInfo.systemUptime + MacHotspotAssociation.joinWindow,
|
|
30
36
|
now: @escaping () -> TimeInterval = { ProcessInfo.processInfo.systemUptime },
|
|
31
37
|
pause: ((TimeInterval) -> Void)? = nil,
|
|
32
38
|
makeInterface: (() throws -> MacWifiInterface)? = nil,
|
|
@@ -174,9 +180,9 @@ final class MacHotspotAssociation {
|
|
|
174
180
|
try checkDiscoveryCurrent()
|
|
175
181
|
if try readSSID(interface) == ssid { return nil }
|
|
176
182
|
if let network { return network }
|
|
177
|
-
// Successful empty scans remain pending within this same join window
|
|
178
|
-
// Native scan errors escape immediately.
|
|
179
|
-
wait(min(
|
|
183
|
+
// Successful empty scans remain pending within this same join window, rescanning when
|
|
184
|
+
// macOS allows the next live scan. Native scan errors escape immediately.
|
|
185
|
+
wait(min(Self.scanInterval, max(0, deadline - now())))
|
|
180
186
|
}
|
|
181
187
|
}
|
|
182
188
|
|
|
@@ -72,7 +72,8 @@ public final class GlassesHotspotNetwork {
|
|
|
72
72
|
self.ownershipToken = token
|
|
73
73
|
self.generation += 1
|
|
74
74
|
let gen = self.generation
|
|
75
|
-
let
|
|
75
|
+
let window = ProcessInfo.processInfo.isiOSAppOnMac ? MacHotspotAssociation.joinWindow : 60
|
|
76
|
+
let deadline = ProcessInfo.processInfo.systemUptime + window
|
|
76
77
|
self.joinDeadline = deadline
|
|
77
78
|
self.promptSince = nil
|
|
78
79
|
self.ssid = ssid
|
|
@@ -103,9 +104,12 @@ public final class GlassesHotspotNetwork {
|
|
|
103
104
|
|
|
104
105
|
/// Time to associate after the person answers a join prompt late in the join.
|
|
105
106
|
private static let afterAnswer: TimeInterval = 30
|
|
107
|
+
/// Time for a Mac that has associated to get its hotspot address. Each Mac scan takes about
|
|
108
|
+
/// 23 s while it is on another network, so it can find the hotspot near the join deadline.
|
|
109
|
+
private static let macAddressWait: TimeInterval = 30
|
|
106
110
|
|
|
107
|
-
/// The join gets 60 s of its own, plus however long the person takes to answer iOS's join
|
|
108
|
-
/// prompt. The engine keeps the glasses AP up meanwhile.
|
|
111
|
+
/// The join gets 60 s of its own (a Mac's longer scan window on a Mac), plus however long the person takes to answer iOS's join
|
|
112
|
+
/// prompt, or a Mac's address wait once it has associated. The engine keeps the glasses AP up meanwhile.
|
|
109
113
|
private func scheduleJoinDeadline(ssid: String, generation gen: Int) {
|
|
110
114
|
queue.asyncAfter(deadline: .now() + max(1, joinDeadline - ProcessInfo.processInfo.systemUptime)) {
|
|
111
115
|
// Once associated, the user may still be reading the Local Network alert.
|
|
@@ -332,7 +336,9 @@ public final class GlassesHotspotNetwork {
|
|
|
332
336
|
self.finishLeave(); return
|
|
333
337
|
}
|
|
334
338
|
self.wifiIdentity.observe([HotspotInterfaceReport(name: name, index: index, isWifi: true)])
|
|
335
|
-
self.
|
|
339
|
+
self.joinDeadline = max(self.joinDeadline, ProcessInfo.processInfo.systemUptime + Self.macAddressWait)
|
|
340
|
+
self.waitForMacAddress(ssid: ssid, association: association, generation: gen,
|
|
341
|
+
remaining: Int(Self.macAddressWait * 2))
|
|
336
342
|
case let .failure(error):
|
|
337
343
|
self.finishJoin(.failure(error)); self.finishLeave()
|
|
338
344
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mentra/glasses-media",
|
|
3
|
-
"version": "3.5.0-dev.
|
|
3
|
+
"version": "3.5.0-dev.1462",
|
|
4
4
|
"description": "Shared native glasses media receivers and local network transport",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Mentra Community",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@mentra/bluetooth-sdk": "3.5.0-dev.
|
|
19
|
+
"@mentra/bluetooth-sdk": "3.5.0-dev.1462"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"expo-modules-core": "~55.0.25"
|