@mentra/glasses-media 3.5.0-dev.1360 → 3.5.0-dev.1367

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,7 +4,7 @@ Native receivers, WHIP publishers and network helpers shared by the Mentra App.
4
4
 
5
5
  - Android: the existing `GlassesMediaSource`, local WHIP and WHEP receivers, scoped SoftAP networking, decoded I420/PCM delivery, and transport diagnostics moved here. The ACS session and raw outgoing streams remain in `acs-meeting`.
6
6
  - iOS: `DecodedGlassesMediaSource` delivers `CVPixelBuffer` video and interleaved PCM16. `LocalWhipIngestSource` answers the glasses' existing WHIP client; `WhepVideoSource` retains the cloud subscription path.
7
- - `GlassesHotspotNetwork` owns hotspot association for OTA, gallery transfers and media. iPhone uses persistent `NEHotspotConfiguration`; iOS-on-Mac uses public CoreWLAN in the app process and the standard Location permission needed to identify Wi-Fi networks. Wi-Fi carries the glasses link; cellular carries the call. The owner verifies the requested SSID and actual Wi-Fi interface address, retains that interface for loss checks and ACS binding, and serializes network writers across consumers. Cancellation retains custody until blocking native work and cleanup finish. Cleanup preserves a network the user joined afterward; a failed release rejects and retains ownership for a later cleanup attempt.
7
+ - `GlassesHotspotNetwork` owns hotspot association for OTA, gallery transfers and media. iPhone uses persistent `NEHotspotConfiguration`, and keeps only the one it is joining: every join first removes the app's configurations for other hotspots, and each launch removes leftovers, so a phone near many pairs never rejoins another pair by itself; iOS-on-Mac uses public CoreWLAN in the app process and the standard Location permission needed to identify Wi-Fi networks. Wi-Fi carries the glasses link; cellular carries the call. The owner verifies the requested SSID and actual Wi-Fi interface address, retains that interface for loss checks and ACS binding, and serializes network writers across consumers. Cancellation retains custody until blocking native work and cleanup finish. Cleanup preserves a network the user joined afterward; a failed release rejects and retains ownership for a later cleanup attempt.
8
8
 
9
9
  The publisher owns its outgoing encoders, audio policy, and destination. Receivers do not open the phone microphone or play the glasses microphone locally. iOS uses a receive-only audio device to drive decoded PCM delivery without changing the app's audio session.
10
10
 
@@ -42,7 +42,20 @@ public final class GlassesHotspotNetwork {
42
42
  public var onLost: ((String) -> Void)?
43
43
  /// Gets the system's answer that left the join waiting for Local Network access.
44
44
  public var onPermissionRequired: ((String) -> Void)?
45
- public init() {}
45
+ public init() { _ = Self.startupCleanup }
46
+
47
+ /// iOS keeps every applied configuration and joins it again by itself whenever that hotspot is up.
48
+ /// A configuration left by a crash or a kill mid-session would let a phone near many pairs wander onto
49
+ /// one it is not using. This app's configurations are all glasses hotspots, so each join removes the
50
+ /// others, and this clears leftovers once per launch, unless a join already owns the network: that join clears them itself.
51
+ private static let startupCleanup: Void = {
52
+ guard !ProcessInfo.processInfo.isiOSAppOnMac else { return }
53
+ NEHotspotConfigurationManager.shared.getConfiguredSSIDs { saved in
54
+ guard !saved.isEmpty, let token = HotspotNetworkOwnership.shared.acquire() else { return }
55
+ saved.forEach { NEHotspotConfigurationManager.shared.removeConfiguration(forSSID: $0) }
56
+ HotspotNetworkOwnership.shared.release(token)
57
+ }
58
+ }()
46
59
 
47
60
  public func join(ssid: String, passphrase: String, gateway: String? = nil, purpose: HotspotAccessPurpose = .outgoingClient, completion: @escaping (Result<String, Error>) -> Void) {
48
61
  queue.async {
@@ -75,7 +88,14 @@ public final class GlassesHotspotNetwork {
75
88
  if ProcessInfo.processInfo.isiOSAppOnMac {
76
89
  self.authorizeMacAssociation(ssid: ssid, passphrase: passphrase, generation: gen, deadline: deadline)
77
90
  } else {
78
- self.applyConfiguration(ssid: ssid, passphrase: passphrase, generation: gen)
91
+ NEHotspotConfigurationManager.shared.getConfiguredSSIDs { saved in
92
+ self.queue.async {
93
+ // A cancelled join's late answer must not remove the next pair's configuration.
94
+ guard gen == self.generation, !self.cancelled else { return }
95
+ for other in saved where other != ssid { NEHotspotConfigurationManager.shared.removeConfiguration(forSSID: other) }
96
+ self.applyConfiguration(ssid: ssid, passphrase: passphrase, generation: gen)
97
+ }
98
+ }
79
99
  }
80
100
  self.scheduleJoinDeadline(ssid: ssid, generation: gen)
81
101
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mentra/glasses-media",
3
- "version": "3.5.0-dev.1360",
3
+ "version": "3.5.0-dev.1367",
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.1360"
19
+ "@mentra/bluetooth-sdk": "3.5.0-dev.1367"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "expo-modules-core": "~55.0.25"