@mentra/bluetooth-sdk 3.5.0-dev.1294 → 3.5.0-dev.1309
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/android/src/main/java/com/mentra/bluetoothsdk/BluetoothSdkDefaults.kt +4 -3
- package/android/src/main/java/com/mentra/bluetoothsdk/Bridge.kt +14 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/DeviceManager.kt +11 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/GeneratedReleaseMetadata.kt +5 -5
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/ClassicAudioConnectionTracker.kt +15 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLive.kt +78 -26
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLiveOwnerLossPolicy.kt +5 -5
- package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/ClassicAudioConnectionTrackerTest.kt +26 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/MentraLiveOwnerLossPolicyTest.kt +3 -3
- package/build/generated/releaseMetadata.js +5 -5
- package/build/generated/releaseMetadata.js.map +1 -1
- package/ios/Source/BluetoothSdkDefaults.swift +5 -5
- package/ios/Source/Bridge.swift +14 -0
- package/ios/Source/GeneratedReleaseMetadata.swift +5 -5
- package/ios/Source/sgcs/MentraLive.swift +15 -23
- package/package.json +2 -2
- package/src/generated/releaseMetadata.ts +5 -5
|
@@ -6,8 +6,9 @@ object BluetoothSdkDefaults {
|
|
|
6
6
|
const val LOUDNESS_GATE_ENABLED = true
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Must match the firmware default (
|
|
10
|
-
*
|
|
9
|
+
* Must match the firmware and Mentra App default (off). Re-pushed on
|
|
10
|
+
* connect, so a true value here turns on the 20-minute unworn power-off on
|
|
11
|
+
* every pair the app touches.
|
|
11
12
|
*/
|
|
12
|
-
const val AUTO_POWER_OFF_ENABLED =
|
|
13
|
+
const val AUTO_POWER_OFF_ENABLED = false
|
|
13
14
|
}
|
|
@@ -336,6 +336,20 @@ public class Bridge private constructor() {
|
|
|
336
336
|
DeviceStore.set("bluetooth", "searchResults", uniqueResults)
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
+
/** Drop glasses from the search results, for example when their pairing window closed. */
|
|
340
|
+
@JvmStatic
|
|
341
|
+
fun removeDiscoveredDevice(deviceModel: String, deviceName: String) {
|
|
342
|
+
val searchResults =
|
|
343
|
+
DeviceStore.store.getCategory("bluetooth")["searchResults"] as? List<*> ?: return
|
|
344
|
+
val remaining =
|
|
345
|
+
searchResults.filterNot { result ->
|
|
346
|
+
val values = result as? Map<*, *>
|
|
347
|
+
values?.get("model") == deviceModel && values["name"] == deviceName
|
|
348
|
+
}
|
|
349
|
+
if (remaining.size == searchResults.size) return
|
|
350
|
+
DeviceStore.set("bluetooth", "searchResults", remaining)
|
|
351
|
+
}
|
|
352
|
+
|
|
339
353
|
private fun mergeStableSearchResults(
|
|
340
354
|
currentResults: List<Map<String, Any>>,
|
|
341
355
|
newResult: Map<String, Any>,
|
|
@@ -2344,6 +2344,17 @@ class DeviceManager internal constructor(initializeHardware: Boolean) {
|
|
|
2344
2344
|
sgc?.sendRgbLedControl(requestId, packageName, action, color, onDurationMs, offDurationMs, count)
|
|
2345
2345
|
}
|
|
2346
2346
|
|
|
2347
|
+
/**
|
|
2348
|
+
* The person disconnected the glasses outside the app, in Android's Bluetooth settings. Like
|
|
2349
|
+
* the app's Disconnect, nothing reconnects them until the person connects again.
|
|
2350
|
+
*/
|
|
2351
|
+
fun disconnectByUser() {
|
|
2352
|
+
Bridge.log("MAN: Glasses disconnected in Android's Bluetooth settings")
|
|
2353
|
+
DeviceStore.apply("bluetooth", "glasses_user_disconnected", true)
|
|
2354
|
+
Bridge.saveSetting("glasses_user_disconnected", true)
|
|
2355
|
+
disconnect()
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2347
2358
|
/** Glasses the person disconnected in the app stay disconnected. */
|
|
2348
2359
|
internal fun shouldReconnectAfterBluetoothOn(): Boolean =
|
|
2349
2360
|
defaultWearable.isNotEmpty() && deviceName.isNotEmpty() &&
|
|
@@ -3,9 +3,9 @@ package com.mentra.bluetoothsdk
|
|
|
3
3
|
/** Generated by release CI. Do not edit in a release checkout. */
|
|
4
4
|
internal object GeneratedReleaseMetadata {
|
|
5
5
|
const val FAMILY_BASE_VERSION: String = "3.5.0"
|
|
6
|
-
const val RELEASE_IDENTITY: String = "3.5.0-dev.
|
|
7
|
-
const val RELEASE_SET_ID: String = "mentra-3.5.0-dev.
|
|
8
|
-
const val SOURCE_COMMIT: String = "
|
|
9
|
-
const val OTA_MANIFEST_URL: String = "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.
|
|
10
|
-
const val OTA_MANIFEST_SHA256: String = "
|
|
6
|
+
const val RELEASE_IDENTITY: String = "3.5.0-dev.1309"
|
|
7
|
+
const val RELEASE_SET_ID: String = "mentra-3.5.0-dev.1309"
|
|
8
|
+
const val SOURCE_COMMIT: String = "7188808115197f675b5665797f6681e782ee222c"
|
|
9
|
+
const val OTA_MANIFEST_URL: String = "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.1309.json"
|
|
10
|
+
const val OTA_MANIFEST_SHA256: String = "469b27f58d0a3fee62053f7f8636f8651e4c98618a0ad26ac3d6bbae7ed83707"
|
|
11
11
|
}
|
|
@@ -11,6 +11,18 @@ internal fun readyClassicAudioSnapshot(states: Map<ClassicAudioProfile, Boolean>
|
|
|
11
11
|
return if (connected.isNotEmpty() || states.size == ClassicAudioProfile.entries.size) connected else null
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Android is disconnecting the whole device, not one profile: every profile that was connected
|
|
16
|
+
* started disconnecting within [windowMs] of [nowMs]. Turning off Media or Call audio leaves the
|
|
17
|
+
* other one up.
|
|
18
|
+
*/
|
|
19
|
+
internal fun wholeClassicDeviceDisconnecting(
|
|
20
|
+
wereUp: Set<ClassicAudioProfile>,
|
|
21
|
+
disconnectingAt: Map<ClassicAudioProfile, Long>,
|
|
22
|
+
nowMs: Long,
|
|
23
|
+
windowMs: Long,
|
|
24
|
+
): Boolean = wereUp.all { profile -> disconnectingAt[profile]?.let { nowMs - it <= windowMs } == true }
|
|
25
|
+
|
|
14
26
|
/**
|
|
15
27
|
* Tracks the Android Classic audio profiles for one dual-mode glasses device.
|
|
16
28
|
*
|
|
@@ -29,6 +41,9 @@ internal class ClassicAudioConnectionTracker(
|
|
|
29
41
|
val connected: Boolean
|
|
30
42
|
get() = connectedProfiles.isNotEmpty()
|
|
31
43
|
|
|
44
|
+
@Synchronized
|
|
45
|
+
fun connectedProfiles(): Set<ClassicAudioProfile> = connectedProfiles.toSet()
|
|
46
|
+
|
|
32
47
|
/** BLE may already be gone when the user explicitly disconnects Classic audio. */
|
|
33
48
|
@Synchronized
|
|
34
49
|
fun targetForDisconnect(): String? = targetAddress
|
|
@@ -157,6 +157,12 @@ class MentraLive : SGCManager() {
|
|
|
157
157
|
private const val A2DP_CONNECT_MAX_ATTEMPTS = 5
|
|
158
158
|
private const val A2DP_CONNECT_RETRY_MS = 800L
|
|
159
159
|
private const val UNPAIR_FLUSH_MS = 400L
|
|
160
|
+
/** Classic profile disconnects this soon after the app's own teardown are the app's. */
|
|
161
|
+
private const val OWN_CLASSIC_TEARDOWN_MS = 10_000L
|
|
162
|
+
/** Classic profiles going down this close together are one disconnect of the whole device. */
|
|
163
|
+
private const val CLASSIC_DISCONNECT_PAIR_MS = 3_000L
|
|
164
|
+
/** How long after the Classic drop the glasses must still be answering over BLE. */
|
|
165
|
+
private const val CLASSIC_DISCONNECT_CONFIRM_MS = 2_000L
|
|
160
166
|
// Longer than the glasses' bounded relay of one report (BES logs, two file transfers,
|
|
161
167
|
// the phone POST), so an unreleased name cannot be reused while its report is in flight.
|
|
162
168
|
internal const val INCIDENT_RELAY_OWNERSHIP_MS = 10 * 60_000L
|
|
@@ -706,6 +712,13 @@ class MentraLive : SGCManager() {
|
|
|
706
712
|
private var secureFirmwareRefreshRunnable: Runnable? = null
|
|
707
713
|
/** elapsedRealtime of the last GATT link that was not an explicit pairing attempt. */
|
|
708
714
|
private var lastAutoReconnectLinkAt: Long? = null
|
|
715
|
+
/** elapsedRealtime of the app's last own A2DP/HFP teardown. */
|
|
716
|
+
private var lastOwnClassicTeardownAt: Long? = null
|
|
717
|
+
/** elapsedRealtime when Android started disconnecting each Classic profile. */
|
|
718
|
+
private val classicDisconnectingAt = mutableMapOf<ClassicAudioProfile, Long>()
|
|
719
|
+
private var classicDisconnectCheck: Runnable? = null
|
|
720
|
+
/** elapsedRealtime of the last message from the glasses. */
|
|
721
|
+
private var lastInboundAt = 0L
|
|
709
722
|
/** Hold GATT teardown until the unpair write can leave the phone. */
|
|
710
723
|
private var unpairFlushPending = false
|
|
711
724
|
private var unpairFlushRunnable: Runnable? = null
|
|
@@ -1670,29 +1683,17 @@ class MentraLive : SGCManager() {
|
|
|
1670
1683
|
)
|
|
1671
1684
|
val isNamedConnectTarget =
|
|
1672
1685
|
isSavedGlasses && (isReconnecting || explicitConnectByName)
|
|
1673
|
-
if (MentraLiveOwnerLossPolicy.
|
|
1686
|
+
if (MentraLiveOwnerLossPolicy.shouldIgnoreNotPairable(
|
|
1674
1687
|
savedGlasses = isSavedGlasses,
|
|
1675
1688
|
reconnectScan = isReconnecting,
|
|
1676
1689
|
secureTrailer = advertisesPairingFlag(result),
|
|
1677
1690
|
pairingDiscoverable = isPairingDiscoverable(result),
|
|
1678
1691
|
)
|
|
1679
1692
|
) {
|
|
1680
|
-
//
|
|
1681
|
-
// the scan screen blocks the connection until they are pairable.
|
|
1693
|
+
// Only glasses that can pair now are listed; a closed window drops them.
|
|
1682
1694
|
// The saved glasses fall through so the pause watch scan can see
|
|
1683
1695
|
// the pairing flag clear and reconnect.
|
|
1684
|
-
Bridge.
|
|
1685
|
-
"LIVE: Nearby $deviceName is secure firmware not in pairing mode — exposing as non-pairable"
|
|
1686
|
-
)
|
|
1687
|
-
Bridge.sendDiscoveredDevice(
|
|
1688
|
-
DeviceTypes.LIVE,
|
|
1689
|
-
deviceName,
|
|
1690
|
-
deviceAddress,
|
|
1691
|
-
result.rssi,
|
|
1692
|
-
pairingMode = false,
|
|
1693
|
-
pairingCode = null,
|
|
1694
|
-
securePairingCapable = true,
|
|
1695
|
-
)
|
|
1696
|
+
Bridge.removeDiscoveredDevice(DeviceTypes.LIVE, deviceName)
|
|
1696
1697
|
return
|
|
1697
1698
|
}
|
|
1698
1699
|
val glassType = if (deviceName == "Xy_A") "Standard" else "Mentra Live"
|
|
@@ -1705,17 +1706,21 @@ class MentraLive : SGCManager() {
|
|
|
1705
1706
|
if (secureCapable) " (pairingMode=$pairingMode)"
|
|
1706
1707
|
else " (legacy firmware, pairable)"
|
|
1707
1708
|
)
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1709
|
+
// Field firmware has no pairing flag. Treat it as pairable so the new
|
|
1710
|
+
// Mentra App can still find old glasses.
|
|
1711
|
+
if (secureCapable && !pairingMode) {
|
|
1712
|
+
Bridge.removeDiscoveredDevice(DeviceTypes.LIVE, deviceName)
|
|
1713
|
+
} else {
|
|
1714
|
+
Bridge.sendDiscoveredDevice(
|
|
1715
|
+
DeviceTypes.LIVE,
|
|
1716
|
+
deviceName,
|
|
1717
|
+
deviceAddress,
|
|
1718
|
+
result.rssi,
|
|
1719
|
+
pairingMode = true,
|
|
1720
|
+
pairingCode = pairingCode,
|
|
1721
|
+
securePairingCapable = secureCapable,
|
|
1722
|
+
)
|
|
1723
|
+
}
|
|
1719
1724
|
|
|
1720
1725
|
if (ConnectedDeviceMatcher.sameSavedName(
|
|
1721
1726
|
DeviceModel.MENTRA_LIVE,
|
|
@@ -4393,6 +4398,7 @@ class MentraLive : SGCManager() {
|
|
|
4393
4398
|
}
|
|
4394
4399
|
BleTraceLogger.logJson("glasses_to_phone", "sdk_ble_event", json, null)
|
|
4395
4400
|
GlassesLinkDiagnostics.recordInbound()
|
|
4401
|
+
lastInboundAt = SystemClock.elapsedRealtime()
|
|
4396
4402
|
|
|
4397
4403
|
if (MessageChunker.isChunkedMessage(json)) {
|
|
4398
4404
|
processChunkedJsonMessage(json)
|
|
@@ -8074,11 +8080,56 @@ class MentraLive : SGCManager() {
|
|
|
8074
8080
|
if (intent?.action != BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED &&
|
|
8075
8081
|
intent?.action != BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED) return
|
|
8076
8082
|
val device = intent.bluetoothDeviceExtra() ?: return
|
|
8083
|
+
noteClassicDisconnecting(device, intent)
|
|
8077
8084
|
refreshClassicAudioConnectionState(device)
|
|
8078
8085
|
}
|
|
8079
8086
|
}
|
|
8080
8087
|
}
|
|
8081
8088
|
|
|
8089
|
+
/**
|
|
8090
|
+
* Android's Bluetooth settings Disconnect drops every Classic profile of the glasses (A2DP,
|
|
8091
|
+
* and HFP unless the unworn glasses closed it) and leaves the app's BLE link up, so Home went
|
|
8092
|
+
* on showing them connected. When all the connected profiles start disconnecting within
|
|
8093
|
+
* [CLASSIC_DISCONNECT_PAIR_MS] while the app neither asked nor lost BLE, and the glasses
|
|
8094
|
+
* answer over BLE within [CLASSIC_DISCONNECT_CONFIRM_MS], the person disconnected them: it
|
|
8095
|
+
* lasts like the app's Disconnect, even if the glasses paged their audio back meanwhile. A
|
|
8096
|
+
* restart, power off, pairing window or range loss takes BLE down too; turning off Media or
|
|
8097
|
+
* Call audio leaves the other profile up.
|
|
8098
|
+
*/
|
|
8099
|
+
private fun noteClassicDisconnecting(device: BluetoothDevice, intent: Intent) {
|
|
8100
|
+
if (intent.getIntExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, -1) != BluetoothProfile.STATE_CONNECTED ||
|
|
8101
|
+
intent.getIntExtra(BluetoothProfile.EXTRA_STATE, -1) != BluetoothProfile.STATE_DISCONNECTING
|
|
8102
|
+
) {
|
|
8103
|
+
return
|
|
8104
|
+
}
|
|
8105
|
+
if (isKilled || !isConnected || connectedDevice?.address != device.address) return
|
|
8106
|
+
if (bluetoothAdapter?.state != BluetoothAdapter.STATE_ON) return
|
|
8107
|
+
val now = SystemClock.elapsedRealtime()
|
|
8108
|
+
val ownTeardownAt = lastOwnClassicTeardownAt
|
|
8109
|
+
if (ownTeardownAt != null && now - ownTeardownAt < OWN_CLASSIC_TEARDOWN_MS) return
|
|
8110
|
+
val profile =
|
|
8111
|
+
if (intent.action == BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED) ClassicAudioProfile.A2DP
|
|
8112
|
+
else ClassicAudioProfile.HEADSET
|
|
8113
|
+
classicDisconnectingAt[profile] = now
|
|
8114
|
+
val wereUp = classicAudioConnectionTracker.connectedProfiles() + profile
|
|
8115
|
+
if (!wholeClassicDeviceDisconnecting(wereUp, classicDisconnectingAt, now, CLASSIC_DISCONNECT_PAIR_MS)) return
|
|
8116
|
+
if (classicDisconnectCheck != null) return
|
|
8117
|
+
Bridge.log("LIVE: Classic: Android is disconnecting the glasses' audio - checking the glasses stay up")
|
|
8118
|
+
val session = gattEpoch
|
|
8119
|
+
sendJsonWithoutAck(JSONObject().put("type", "ping"))
|
|
8120
|
+
val check =
|
|
8121
|
+
Runnable {
|
|
8122
|
+
classicDisconnectCheck = null
|
|
8123
|
+
if (isKilled || !isConnected || gattEpoch != session || lastInboundAt <= now) {
|
|
8124
|
+
return@Runnable
|
|
8125
|
+
}
|
|
8126
|
+
Bridge.log("LIVE: Classic: Android disconnected the glasses - staying disconnected")
|
|
8127
|
+
DeviceManager.getInstance().disconnectByUser()
|
|
8128
|
+
}
|
|
8129
|
+
classicDisconnectCheck = check
|
|
8130
|
+
handler.postDelayed(check, CLASSIC_DISCONNECT_CONFIRM_MS)
|
|
8131
|
+
}
|
|
8132
|
+
|
|
8082
8133
|
private fun registerClassicAudioReceiver() {
|
|
8083
8134
|
val ctx = context ?: return
|
|
8084
8135
|
val receiver = classicAudioReceiver ?: return
|
|
@@ -8712,6 +8763,7 @@ class MentraLive : SGCManager() {
|
|
|
8712
8763
|
// The BLE device reference may already be cleared after a GATT drop. The tracker owns the
|
|
8713
8764
|
// authoritative target address, so let it decide whether this teardown belongs to the
|
|
8714
8765
|
// active Classic session instead of consulting connectedDevice.
|
|
8766
|
+
lastOwnClassicTeardownAt = SystemClock.elapsedRealtime()
|
|
8715
8767
|
if (classicAudioConnectionTracker.invalidate(device.address)) {
|
|
8716
8768
|
audioConnected = false
|
|
8717
8769
|
}
|
|
@@ -153,12 +153,12 @@ internal object MentraLiveOwnerLossPolicy {
|
|
|
153
153
|
): Boolean = pairingMode && savedGlasses && !explicitPairing
|
|
154
154
|
|
|
155
155
|
/**
|
|
156
|
-
* A discovery scan lists other secure glasses that are not in pairing
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
156
|
+
* A discovery scan neither lists nor connects to other secure glasses that are not in pairing
|
|
157
|
+
* mode. The saved glasses are the exception: the pause watch scan has to read their trailer,
|
|
158
|
+
* so a cleared pairing flag ends the pause and reconnects. Mirrors iOS, which skips this
|
|
159
|
+
* return when the advertisement is the saved device.
|
|
160
160
|
*/
|
|
161
|
-
fun
|
|
161
|
+
fun shouldIgnoreNotPairable(
|
|
162
162
|
savedGlasses: Boolean,
|
|
163
163
|
reconnectScan: Boolean,
|
|
164
164
|
secureTrailer: Boolean,
|
package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/ClassicAudioConnectionTrackerTest.kt
CHANGED
|
@@ -19,6 +19,32 @@ class ClassicAudioConnectionTrackerTest {
|
|
|
19
19
|
ClassicAudioProfile.HEADSET to false))).isEmpty()
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
private val both = setOf(ClassicAudioProfile.A2DP, ClassicAudioProfile.HEADSET)
|
|
23
|
+
|
|
24
|
+
@Test
|
|
25
|
+
fun `android Disconnect drops every connected profile together`() {
|
|
26
|
+
val at = mapOf(ClassicAudioProfile.HEADSET to 1_000L, ClassicAudioProfile.A2DP to 1_001L)
|
|
27
|
+
assertThat(wholeClassicDeviceDisconnecting(both, at, 1_001L, 3_000L)).isTrue()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@Test
|
|
31
|
+
fun `turning off Media or Call audio is not a disconnect`() {
|
|
32
|
+
assertThat(wholeClassicDeviceDisconnecting(both, mapOf(ClassicAudioProfile.A2DP to 1_000L), 1_000L, 3_000L)).isFalse()
|
|
33
|
+
assertThat(wholeClassicDeviceDisconnecting(both, mapOf(ClassicAudioProfile.HEADSET to 1_000L), 1_000L, 3_000L)).isFalse()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@Test
|
|
37
|
+
fun `unworn glasses with only A2DP up are disconnected by that profile alone`() {
|
|
38
|
+
val a2dp = setOf(ClassicAudioProfile.A2DP)
|
|
39
|
+
assertThat(wholeClassicDeviceDisconnecting(a2dp, mapOf(ClassicAudioProfile.A2DP to 1_000L), 1_000L, 3_000L)).isTrue()
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@Test
|
|
43
|
+
fun `two profile toggles far apart are not one disconnect`() {
|
|
44
|
+
val at = mapOf(ClassicAudioProfile.HEADSET to 1_000L, ClassicAudioProfile.A2DP to 10_000L)
|
|
45
|
+
assertThat(wholeClassicDeviceDisconnecting(both, at, 10_000L, 3_000L)).isFalse()
|
|
46
|
+
}
|
|
47
|
+
|
|
22
48
|
private val address = "AA:BB:CC:DD:EE:FF"
|
|
23
49
|
|
|
24
50
|
private fun snapshot(tracker: ClassicAudioConnectionTracker, vararg profiles: ClassicAudioProfile) {
|
|
@@ -201,7 +201,7 @@ class MentraLiveOwnerLossPolicyTest {
|
|
|
201
201
|
@Test
|
|
202
202
|
fun aClearedPairingFlagOnTheSavedGlassesIsNotHiddenFromThePauseWatchScan() {
|
|
203
203
|
assertFalse(
|
|
204
|
-
MentraLiveOwnerLossPolicy.
|
|
204
|
+
MentraLiveOwnerLossPolicy.shouldIgnoreNotPairable(
|
|
205
205
|
savedGlasses = true,
|
|
206
206
|
reconnectScan = false,
|
|
207
207
|
secureTrailer = true,
|
|
@@ -209,7 +209,7 @@ class MentraLiveOwnerLossPolicyTest {
|
|
|
209
209
|
)
|
|
210
210
|
)
|
|
211
211
|
assertTrue(
|
|
212
|
-
MentraLiveOwnerLossPolicy.
|
|
212
|
+
MentraLiveOwnerLossPolicy.shouldIgnoreNotPairable(
|
|
213
213
|
savedGlasses = false,
|
|
214
214
|
reconnectScan = false,
|
|
215
215
|
secureTrailer = true,
|
|
@@ -217,7 +217,7 @@ class MentraLiveOwnerLossPolicyTest {
|
|
|
217
217
|
)
|
|
218
218
|
)
|
|
219
219
|
assertFalse(
|
|
220
|
-
MentraLiveOwnerLossPolicy.
|
|
220
|
+
MentraLiveOwnerLossPolicy.shouldIgnoreNotPairable(
|
|
221
221
|
savedGlasses = false,
|
|
222
222
|
reconnectScan = false,
|
|
223
223
|
secureTrailer = true,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export const BLUETOOTH_SDK_RELEASE_METADATA = Object.freeze({
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"familyBaseVersion": "3.5.0",
|
|
4
|
-
"releaseIdentity": "3.5.0-dev.
|
|
5
|
-
"releaseSetId": "mentra-3.5.0-dev.
|
|
6
|
-
"sourceCommit": "
|
|
7
|
-
"otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.
|
|
8
|
-
"otaManifestSha256": "
|
|
4
|
+
"releaseIdentity": "3.5.0-dev.1309",
|
|
5
|
+
"releaseSetId": "mentra-3.5.0-dev.1309",
|
|
6
|
+
"sourceCommit": "7188808115197f675b5665797f6681e782ee222c",
|
|
7
|
+
"otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.1309.json",
|
|
8
|
+
"otaManifestSha256": "469b27f58d0a3fee62053f7f8636f8651e4c98618a0ad26ac3d6bbae7ed83707"
|
|
9
9
|
});
|
|
10
10
|
//# sourceMappingURL=releaseMetadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"releaseMetadata.js","sourceRoot":"","sources":["../../src/generated/releaseMetadata.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,8BAA8B,GAA0C,MAAM,CAAC,MAAM,CAAC;IACjG,eAAe,EAAE,CAAC;IAClB,mBAAmB,EAAE,OAAO;IAC5B,iBAAiB,EAAE,gBAAgB;IACnC,cAAc,EAAE,uBAAuB;IACvC,cAAc,EAAE,0CAA0C;IAC1D,gBAAgB,EAAE,kIAAkI;IACpJ,mBAAmB,EAAE,kEAAkE;CACxF,CAAC,CAAA","sourcesContent":["/** Generated by release CI. Do not edit in a release checkout. */\nexport interface BluetoothSdkReleaseMetadata {\n schemaVersion: 1\n familyBaseVersion: string | null\n releaseIdentity: string | null\n releaseSetId: string | null\n sourceCommit: string | null\n otaManifestUrl: string | null\n otaManifestSha256: string | null\n}\n\nexport const BLUETOOTH_SDK_RELEASE_METADATA: Readonly<BluetoothSdkReleaseMetadata> = Object.freeze({\n \"schemaVersion\": 1,\n \"familyBaseVersion\": \"3.5.0\",\n \"releaseIdentity\": \"3.5.0-dev.
|
|
1
|
+
{"version":3,"file":"releaseMetadata.js","sourceRoot":"","sources":["../../src/generated/releaseMetadata.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,8BAA8B,GAA0C,MAAM,CAAC,MAAM,CAAC;IACjG,eAAe,EAAE,CAAC;IAClB,mBAAmB,EAAE,OAAO;IAC5B,iBAAiB,EAAE,gBAAgB;IACnC,cAAc,EAAE,uBAAuB;IACvC,cAAc,EAAE,0CAA0C;IAC1D,gBAAgB,EAAE,kIAAkI;IACpJ,mBAAmB,EAAE,kEAAkE;CACxF,CAAC,CAAA","sourcesContent":["/** Generated by release CI. Do not edit in a release checkout. */\nexport interface BluetoothSdkReleaseMetadata {\n schemaVersion: 1\n familyBaseVersion: string | null\n releaseIdentity: string | null\n releaseSetId: string | null\n sourceCommit: string | null\n otaManifestUrl: string | null\n otaManifestSha256: string | null\n}\n\nexport const BLUETOOTH_SDK_RELEASE_METADATA: Readonly<BluetoothSdkReleaseMetadata> = Object.freeze({\n \"schemaVersion\": 1,\n \"familyBaseVersion\": \"3.5.0\",\n \"releaseIdentity\": \"3.5.0-dev.1309\",\n \"releaseSetId\": \"mentra-3.5.0-dev.1309\",\n \"sourceCommit\": \"7188808115197f675b5665797f6681e782ee222c\",\n \"otaManifestUrl\": \"https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.1309.json\",\n \"otaManifestSha256\": \"469b27f58d0a3fee62053f7f8636f8651e4c98618a0ad26ac3d6bbae7ed83707\"\n})\n"]}
|
|
@@ -11,12 +11,12 @@ enum BluetoothSdkDefaults {
|
|
|
11
11
|
static let voiceActivityDetectionEnabled = false
|
|
12
12
|
static let loudnessGateEnabled = true
|
|
13
13
|
|
|
14
|
-
/// Must
|
|
15
|
-
///
|
|
16
|
-
///
|
|
17
|
-
static let autoPowerOffEnabled =
|
|
14
|
+
/// Must match the firmware and Mentra App default (off). We re-push every
|
|
15
|
+
/// Bluetooth setting on connect, so a true default here turns on the
|
|
16
|
+
/// 20-minute unworn power-off on every pair the app touches.
|
|
17
|
+
static let autoPowerOffEnabled = false
|
|
18
18
|
private static let infoSdkVersionKey = "MentraBluetoothSdkVersion"
|
|
19
|
-
private static let swiftPackageSdkVersion = "3.5.0-dev.
|
|
19
|
+
private static let swiftPackageSdkVersion = "3.5.0-dev.1309"
|
|
20
20
|
private static let swiftPackageSdkVersionPlaceholder = "__MENTRA" + "_BLUETOOTH_SDK_VERSION__"
|
|
21
21
|
|
|
22
22
|
private static func normalizedSdkVersion(_ value: String?) -> String? {
|
package/ios/Source/Bridge.swift
CHANGED
|
@@ -253,6 +253,20 @@ class Bridge {
|
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
+
/// Drops glasses from the search results, for example when their pairing window closed.
|
|
257
|
+
static func removeDiscoveredDevice(_ deviceModel: String, _ deviceName: String) {
|
|
258
|
+
Task {
|
|
259
|
+
await MainActor.run {
|
|
260
|
+
let searchResults = DeviceStore.shared.get("bluetooth", "searchResults") as? [[String: Any]] ?? []
|
|
261
|
+
let remaining = searchResults.filter {
|
|
262
|
+
!($0["model"] as? String == deviceModel && $0["name"] as? String == deviceName)
|
|
263
|
+
}
|
|
264
|
+
if remaining.count == searchResults.count { return }
|
|
265
|
+
DeviceStore.shared.set("bluetooth", "searchResults", remaining)
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
256
270
|
private static func mergeStableSearchResults(
|
|
257
271
|
_ currentResults: [[String: Any]],
|
|
258
272
|
newResult: [String: Any],
|
|
@@ -3,9 +3,9 @@ import Foundation
|
|
|
3
3
|
/// Generated by release CI. Do not edit in a release checkout.
|
|
4
4
|
enum GeneratedReleaseMetadata {
|
|
5
5
|
static let familyBaseVersion = "3.5.0"
|
|
6
|
-
static let releaseIdentity = "3.5.0-dev.
|
|
7
|
-
static let releaseSetId = "mentra-3.5.0-dev.
|
|
8
|
-
static let sourceCommit = "
|
|
9
|
-
static let otaManifestUrl = "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.
|
|
10
|
-
static let otaManifestSha256 = "
|
|
6
|
+
static let releaseIdentity = "3.5.0-dev.1309"
|
|
7
|
+
static let releaseSetId = "mentra-3.5.0-dev.1309"
|
|
8
|
+
static let sourceCommit = "7188808115197f675b5665797f6681e782ee222c"
|
|
9
|
+
static let otaManifestUrl = "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.1309.json"
|
|
10
|
+
static let otaManifestSha256 = "469b27f58d0a3fee62053f7f8636f8651e4c98618a0ad26ac3d6bbae7ed83707"
|
|
11
11
|
}
|
|
@@ -807,26 +807,8 @@ extension MentraLive: CBCentralManagerDelegate {
|
|
|
807
807
|
if !isReconnectTarget && advertisesPairingFlag(advertisementData)
|
|
808
808
|
&& !isPairingDiscoverable(advertisementData)
|
|
809
809
|
{
|
|
810
|
-
//
|
|
811
|
-
|
|
812
|
-
pairFlow(
|
|
813
|
-
"discover",
|
|
814
|
-
"name=\(name) id=\(peripheral.identifier.uuidString) saved=\(savedDeviceName ?? "-") pairingMode=false secure=true connect=false"
|
|
815
|
-
)
|
|
816
|
-
discoveredPeripherals[name] = peripheral
|
|
817
|
-
rememberPeripheral(peripheral, name: name)
|
|
818
|
-
if cacheAdvPairing(
|
|
819
|
-
name,
|
|
820
|
-
pairingMode: false,
|
|
821
|
-
pairingCode: nil,
|
|
822
|
-
securePairingCapable: true
|
|
823
|
-
) {
|
|
824
|
-
emitDiscoveredDeviceFromCache(
|
|
825
|
-
name,
|
|
826
|
-
identifier: peripheral.identifier.uuidString,
|
|
827
|
-
rssi: rssi?.intValue
|
|
828
|
-
)
|
|
829
|
-
}
|
|
810
|
+
// Only glasses that can pair now are listed; a closed window drops them.
|
|
811
|
+
unlistNotPairable(name)
|
|
830
812
|
return
|
|
831
813
|
}
|
|
832
814
|
|
|
@@ -852,11 +834,13 @@ extension MentraLive: CBCentralManagerDelegate {
|
|
|
852
834
|
discoveredPeripherals[name] = peripheral
|
|
853
835
|
rememberPeripheral(peripheral, name: name)
|
|
854
836
|
|
|
855
|
-
if !
|
|
837
|
+
if trailer.secureCapable && !trailer.pairingMode {
|
|
838
|
+
unlistNotPairable(name)
|
|
839
|
+
} else if !partialAdvertisement, cacheAdvPairing(
|
|
856
840
|
name,
|
|
857
841
|
// Field firmware has no pairing flag. Treat it as pairable so the
|
|
858
842
|
// new Mentra App can still find old glasses.
|
|
859
|
-
pairingMode:
|
|
843
|
+
pairingMode: true,
|
|
860
844
|
pairingCode: trailer.pairingCode,
|
|
861
845
|
securePairingCapable: trailer.secureCapable
|
|
862
846
|
) {
|
|
@@ -2963,7 +2947,7 @@ class MentraLive: NSObject, SGCManager {
|
|
|
2963
2947
|
|
|
2964
2948
|
// The choose-glasses scan has to hear a later advertisement when the glasses
|
|
2965
2949
|
// enter pairing mode. iOS reports each peripheral once unless duplicates are
|
|
2966
|
-
// allowed, so the
|
|
2950
|
+
// allowed, so the glasses would stay off the list. Reconnect scans stay
|
|
2967
2951
|
// duplicate-free so a saved glasses advertisement cannot start another connect.
|
|
2968
2952
|
let scanOptions: [String: Any] = [
|
|
2969
2953
|
CBCentralManagerScanOptionAllowDuplicatesKey: manualDiscoveryActive,
|
|
@@ -7223,6 +7207,14 @@ class MentraLive: NSObject, SGCManager {
|
|
|
7223
7207
|
return true
|
|
7224
7208
|
}
|
|
7225
7209
|
|
|
7210
|
+
/// Drops glasses that are not in pairing mode from the search results, once per change, so the
|
|
7211
|
+
/// next pairable advertisement lists them again.
|
|
7212
|
+
private func unlistNotPairable(_ name: String) {
|
|
7213
|
+
if cacheAdvPairing(name, pairingMode: false, pairingCode: nil, securePairingCapable: true) {
|
|
7214
|
+
Bridge.removeDiscoveredDevice("Mentra Live", name)
|
|
7215
|
+
}
|
|
7216
|
+
}
|
|
7217
|
+
|
|
7226
7218
|
private func emitDiscoveredDeviceFromCache(
|
|
7227
7219
|
_ name: String,
|
|
7228
7220
|
identifier: String = "",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mentra/bluetooth-sdk",
|
|
3
|
-
"version": "3.5.0-dev.
|
|
3
|
+
"version": "3.5.0-dev.1309",
|
|
4
4
|
"description": "SDK for communicating with smart glasses",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"registry": "https://registry.npmjs.org/"
|
|
116
116
|
},
|
|
117
117
|
"dependencies": {
|
|
118
|
-
"@mentra/cloud-protocol": "3.5.0-dev.
|
|
118
|
+
"@mentra/cloud-protocol": "3.5.0-dev.1309"
|
|
119
119
|
},
|
|
120
120
|
"devDependencies": {
|
|
121
121
|
"@types/node": "^25.9.3",
|
|
@@ -12,9 +12,9 @@ export interface BluetoothSdkReleaseMetadata {
|
|
|
12
12
|
export const BLUETOOTH_SDK_RELEASE_METADATA: Readonly<BluetoothSdkReleaseMetadata> = Object.freeze({
|
|
13
13
|
"schemaVersion": 1,
|
|
14
14
|
"familyBaseVersion": "3.5.0",
|
|
15
|
-
"releaseIdentity": "3.5.0-dev.
|
|
16
|
-
"releaseSetId": "mentra-3.5.0-dev.
|
|
17
|
-
"sourceCommit": "
|
|
18
|
-
"otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.
|
|
19
|
-
"otaManifestSha256": "
|
|
15
|
+
"releaseIdentity": "3.5.0-dev.1309",
|
|
16
|
+
"releaseSetId": "mentra-3.5.0-dev.1309",
|
|
17
|
+
"sourceCommit": "7188808115197f675b5665797f6681e782ee222c",
|
|
18
|
+
"otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.1309.json",
|
|
19
|
+
"otaManifestSha256": "469b27f58d0a3fee62053f7f8636f8651e4c98618a0ad26ac3d6bbae7ed83707"
|
|
20
20
|
})
|