@mentra/glasses-media 3.5.0-dev.1268 → 3.5.0-dev.1270

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.
@@ -57,13 +57,7 @@ class GlassesMediaRelayModule : Module() {
57
57
  override fun onAvailable(network: android.net.Network, localIpv4: String) = Unit
58
58
  override fun onLost(error: ScopedNetworkError) { emit(id, "failed", "Glasses hotspot connection was lost") }
59
59
  }
60
- try {
61
- scoped.join(ssid, password, listener)
62
- } catch (error: ScopedNetworkError.Unavailable) {
63
- // Same recovery as ACS: the first specifier can reject while leaving office Wi-Fi.
64
- Thread.sleep(ScopedSoftApNetwork.UNAVAILABLE_RETRY_SETTLE_MS)
65
- scoped.join(ssid, password, listener)
66
- }
60
+ scoped.join(ssid, password, listener)
67
61
  ScopedNetworkChangeDetector.registerRelayNetwork(scoped)
68
62
  val outgoing = PhoneWhipPublisher(context, endpoint, options["captureAudio"] != false,
69
63
  (options["bitrate"] as? Number)?.toInt() ?: 2_000_000) { state, reason -> emit(id, state, reason) }
@@ -195,7 +195,8 @@ class ScopedSoftApNetwork(private val context: Context) {
195
195
  }
196
196
 
197
197
  /**
198
- * Join [ssid] and block until it is usable or the request fails.
198
+ * Join [ssid] and block until it is usable or the request fails. An Unavailable request is
199
+ * made once more after a short settle; every caller gets that retry.
199
200
  *
200
201
  * @throws ScopedNetworkError on permission denial, timeout, or an unavailable network
201
202
  */
@@ -221,6 +222,20 @@ class ScopedSoftApNetwork(private val context: Context) {
221
222
  throw ScopedNetworkError.VpnCapturesApp()
222
223
  }
223
224
 
225
+ return try {
226
+ requestOnce(ssid, passphrase, listener)
227
+ } catch (error: ScopedNetworkError.Unavailable) {
228
+ // Leaving the phone's current Wi-Fi (office AP, a phone hotspot) can make the first
229
+ // specifier fail as Unavailable: Samsung assoc-rejects the glasses SoftAP (status 1025)
230
+ // after dropping the old network. The same request from the now idle STA succeeds.
231
+ SoftApTrace.stage("scoped_join_unavailable_retry", "ssid" to ssid, "settleMs" to UNAVAILABLE_RETRY_SETTLE_MS)
232
+ Thread.sleep(UNAVAILABLE_RETRY_SETTLE_MS)
233
+ requestOnce(ssid, passphrase, listener)
234
+ }
235
+ }
236
+
237
+ @Throws(ScopedNetworkError::class)
238
+ private fun requestOnce(ssid: String, passphrase: String, listener: Listener?): Network {
224
239
  release()
225
240
 
226
241
  val requestSpec = ScopedNetworkRequestSpec.forSoftAp(ssid, passphrase)
@@ -546,12 +561,8 @@ class ScopedSoftApNetwork(private val context: Context) {
546
561
  /** Radio + scan need a beat after `isWifiEnabled` flips before specifier can see the AP. */
547
562
  const val WIFI_ENABLE_SETTLE_MS = 1_500L
548
563
 
549
- /**
550
- * After `WifiNetworkSpecifier` returns Unavailable while leaving another AP (office Wi-Fi
551
- * or a phone hotspot), Samsung has already dropped that network. A second specifier from
552
- * an idle STA is the join that succeeds; this is the gap before we issue it.
553
- */
554
- const val UNAVAILABLE_RETRY_SETTLE_MS = 2_000L
564
+ /** The gap before [join] asks again after an Unavailable while leaving another AP. */
565
+ private const val UNAVAILABLE_RETRY_SETTLE_MS = 2_000L
555
566
 
556
567
  /**
557
568
  * dnsmasq (DHCP/DNS) on the hotspot, then the glasses' local HTTP servers. Any answer —
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mentra/glasses-media",
3
- "version": "3.5.0-dev.1268",
3
+ "version": "3.5.0-dev.1270",
4
4
  "description": "Shared native glasses media receivers and local network transport",
5
5
  "license": "MIT",
6
6
  "author": "Mentra Community",