@mentra/bluetooth-sdk 3.4.0-beta.1297 → 3.4.0-beta.1298

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.
@@ -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>,
@@ -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.4.0"
6
- const val RELEASE_IDENTITY: String = "3.4.0-beta.1297"
7
- const val RELEASE_SET_ID: String = "mentra-3.4.0-beta.1297"
8
- const val SOURCE_COMMIT: String = "0380ba8fea16ed46215a90d762f595577994ec88"
9
- const val OTA_MANIFEST_URL: String = "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-beta.1297.json"
10
- const val OTA_MANIFEST_SHA256: String = "2144f4c7a33ec9bbde4a577bc3804bac8774e4e3d164e3dc55b2804bd5c8e0c7"
6
+ const val RELEASE_IDENTITY: String = "3.4.0-beta.1298"
7
+ const val RELEASE_SET_ID: String = "mentra-3.4.0-beta.1298"
8
+ const val SOURCE_COMMIT: String = "da505cc7c363e458588c70353bf21667a2397803"
9
+ const val OTA_MANIFEST_URL: String = "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-beta.1298.json"
10
+ const val OTA_MANIFEST_SHA256: String = "f9987322fefc5896ce7e95778d1df190f15041a00aa6000d0dfcd97f20e8ed06"
11
11
  }
@@ -1637,29 +1637,17 @@ class MentraLive : SGCManager() {
1637
1637
  savedDeviceName.isNotEmpty() && savedDeviceName == deviceName
1638
1638
  val isNamedConnectTarget =
1639
1639
  isSavedGlasses && (isReconnecting || explicitConnectByName)
1640
- if (MentraLiveOwnerLossPolicy.shouldExposeAsNonPairable(
1640
+ if (MentraLiveOwnerLossPolicy.shouldIgnoreNotPairable(
1641
1641
  savedGlasses = isSavedGlasses,
1642
1642
  reconnectScan = isReconnecting,
1643
1643
  secureTrailer = advertisesPairingFlag(result),
1644
1644
  pairingDiscoverable = isPairingDiscoverable(result),
1645
1645
  )
1646
1646
  ) {
1647
- // Other secure units stay visible with pairing-mode guidance, and
1648
- // the scan screen blocks the connection until they are pairable.
1647
+ // Only glasses that can pair now are listed; a closed window drops them.
1649
1648
  // The saved glasses fall through so the pause watch scan can see
1650
1649
  // the pairing flag clear and reconnect.
1651
- Bridge.log(
1652
- "LIVE: Nearby $deviceName is secure firmware not in pairing mode — exposing as non-pairable"
1653
- )
1654
- Bridge.sendDiscoveredDevice(
1655
- DeviceTypes.LIVE,
1656
- deviceName,
1657
- deviceAddress,
1658
- result.rssi,
1659
- pairingMode = false,
1660
- pairingCode = null,
1661
- securePairingCapable = true,
1662
- )
1650
+ Bridge.removeDiscoveredDevice(DeviceTypes.LIVE, deviceName)
1663
1651
  return
1664
1652
  }
1665
1653
  val glassType = if (deviceName == "Xy_A") "Standard" else "K900"
@@ -1672,17 +1660,21 @@ class MentraLive : SGCManager() {
1672
1660
  if (secureCapable) " (pairingMode=$pairingMode)"
1673
1661
  else " (legacy firmware, pairable)"
1674
1662
  )
1675
- Bridge.sendDiscoveredDevice(
1676
- DeviceTypes.LIVE,
1677
- deviceName,
1678
- deviceAddress,
1679
- result.rssi,
1680
- // Field firmware has no pairing flag. Treat it as pairable so the
1681
- // new Mentra App can still find old glasses.
1682
- pairingMode = if (secureCapable) pairingMode else true,
1683
- pairingCode = pairingCode,
1684
- securePairingCapable = secureCapable,
1685
- )
1663
+ // Field firmware has no pairing flag. Treat it as pairable so the new
1664
+ // Mentra App can still find old glasses.
1665
+ if (secureCapable && !pairingMode) {
1666
+ Bridge.removeDiscoveredDevice(DeviceTypes.LIVE, deviceName)
1667
+ } else {
1668
+ Bridge.sendDiscoveredDevice(
1669
+ DeviceTypes.LIVE,
1670
+ deviceName,
1671
+ deviceAddress,
1672
+ result.rssi,
1673
+ pairingMode = true,
1674
+ pairingCode = pairingCode,
1675
+ securePairingCapable = secureCapable,
1676
+ )
1677
+ }
1686
1678
 
1687
1679
  if (savedDeviceName.isNotEmpty() && savedDeviceName == deviceName) {
1688
1680
  observeSavedGlassesAdvertisement(result)
@@ -142,12 +142,12 @@ internal object MentraLiveOwnerLossPolicy {
142
142
  ): Boolean = pairingMode && savedGlasses && !explicitPairing
143
143
 
144
144
  /**
145
- * A discovery scan lists other secure glasses that are not in pairing mode as non-pairable
146
- * and does not connect to them. The saved glasses are the exception: the pause watch scan
147
- * has to read their trailer, so a cleared pairing flag ends the pause and reconnects.
148
- * Mirrors iOS, which skips this return when the advertisement is the saved device.
145
+ * A discovery scan neither lists nor connects to other secure glasses that are not in pairing
146
+ * mode. The saved glasses are the exception: the pause watch scan has to read their trailer,
147
+ * so a cleared pairing flag ends the pause and reconnects. Mirrors iOS, which skips this
148
+ * return when the advertisement is the saved device.
149
149
  */
150
- fun shouldExposeAsNonPairable(
150
+ fun shouldIgnoreNotPairable(
151
151
  savedGlasses: Boolean,
152
152
  reconnectScan: Boolean,
153
153
  secureTrailer: Boolean,
@@ -193,7 +193,7 @@ class MentraLiveOwnerLossPolicyTest {
193
193
  @Test
194
194
  fun aClearedPairingFlagOnTheSavedGlassesIsNotHiddenFromThePauseWatchScan() {
195
195
  assertFalse(
196
- MentraLiveOwnerLossPolicy.shouldExposeAsNonPairable(
196
+ MentraLiveOwnerLossPolicy.shouldIgnoreNotPairable(
197
197
  savedGlasses = true,
198
198
  reconnectScan = false,
199
199
  secureTrailer = true,
@@ -201,7 +201,7 @@ class MentraLiveOwnerLossPolicyTest {
201
201
  )
202
202
  )
203
203
  assertTrue(
204
- MentraLiveOwnerLossPolicy.shouldExposeAsNonPairable(
204
+ MentraLiveOwnerLossPolicy.shouldIgnoreNotPairable(
205
205
  savedGlasses = false,
206
206
  reconnectScan = false,
207
207
  secureTrailer = true,
@@ -209,7 +209,7 @@ class MentraLiveOwnerLossPolicyTest {
209
209
  )
210
210
  )
211
211
  assertFalse(
212
- MentraLiveOwnerLossPolicy.shouldExposeAsNonPairable(
212
+ MentraLiveOwnerLossPolicy.shouldIgnoreNotPairable(
213
213
  savedGlasses = false,
214
214
  reconnectScan = false,
215
215
  secureTrailer = true,
@@ -1,10 +1,10 @@
1
1
  export const BLUETOOTH_SDK_RELEASE_METADATA = Object.freeze({
2
2
  "schemaVersion": 1,
3
3
  "familyBaseVersion": "3.4.0",
4
- "releaseIdentity": "3.4.0-beta.1297",
5
- "releaseSetId": "mentra-3.4.0-beta.1297",
6
- "sourceCommit": "0380ba8fea16ed46215a90d762f595577994ec88",
7
- "otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-beta.1297.json",
8
- "otaManifestSha256": "2144f4c7a33ec9bbde4a577bc3804bac8774e4e3d164e3dc55b2804bd5c8e0c7"
4
+ "releaseIdentity": "3.4.0-beta.1298",
5
+ "releaseSetId": "mentra-3.4.0-beta.1298",
6
+ "sourceCommit": "da505cc7c363e458588c70353bf21667a2397803",
7
+ "otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-beta.1298.json",
8
+ "otaManifestSha256": "f9987322fefc5896ce7e95778d1df190f15041a00aa6000d0dfcd97f20e8ed06"
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,iBAAiB;IACpC,cAAc,EAAE,wBAAwB;IACxC,cAAc,EAAE,0CAA0C;IAC1D,gBAAgB,EAAE,mIAAmI;IACrJ,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.4.0\",\n \"releaseIdentity\": \"3.4.0-beta.1297\",\n \"releaseSetId\": \"mentra-3.4.0-beta.1297\",\n \"sourceCommit\": \"0380ba8fea16ed46215a90d762f595577994ec88\",\n \"otaManifestUrl\": \"https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-beta.1297.json\",\n \"otaManifestSha256\": \"2144f4c7a33ec9bbde4a577bc3804bac8774e4e3d164e3dc55b2804bd5c8e0c7\"\n})\n"]}
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,iBAAiB;IACpC,cAAc,EAAE,wBAAwB;IACxC,cAAc,EAAE,0CAA0C;IAC1D,gBAAgB,EAAE,mIAAmI;IACrJ,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.4.0\",\n \"releaseIdentity\": \"3.4.0-beta.1298\",\n \"releaseSetId\": \"mentra-3.4.0-beta.1298\",\n \"sourceCommit\": \"da505cc7c363e458588c70353bf21667a2397803\",\n \"otaManifestUrl\": \"https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-beta.1298.json\",\n \"otaManifestSha256\": \"f9987322fefc5896ce7e95778d1df190f15041a00aa6000d0dfcd97f20e8ed06\"\n})\n"]}
@@ -16,7 +16,7 @@ enum BluetoothSdkDefaults {
16
16
  /// 20-minute unworn power-off on every pair the app touches.
17
17
  static let autoPowerOffEnabled = false
18
18
  private static let infoSdkVersionKey = "MentraBluetoothSdkVersion"
19
- private static let swiftPackageSdkVersion = "3.4.0-beta.1297"
19
+ private static let swiftPackageSdkVersion = "3.4.0-beta.1298"
20
20
  private static let swiftPackageSdkVersionPlaceholder = "__MENTRA" + "_BLUETOOTH_SDK_VERSION__"
21
21
 
22
22
  private static func normalizedSdkVersion(_ value: String?) -> String? {
@@ -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.4.0"
6
- static let releaseIdentity = "3.4.0-beta.1297"
7
- static let releaseSetId = "mentra-3.4.0-beta.1297"
8
- static let sourceCommit = "0380ba8fea16ed46215a90d762f595577994ec88"
9
- static let otaManifestUrl = "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-beta.1297.json"
10
- static let otaManifestSha256 = "2144f4c7a33ec9bbde4a577bc3804bac8774e4e3d164e3dc55b2804bd5c8e0c7"
6
+ static let releaseIdentity = "3.4.0-beta.1298"
7
+ static let releaseSetId = "mentra-3.4.0-beta.1298"
8
+ static let sourceCommit = "da505cc7c363e458588c70353bf21667a2397803"
9
+ static let otaManifestUrl = "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-beta.1298.json"
10
+ static let otaManifestSha256 = "f9987322fefc5896ce7e95778d1df190f15041a00aa6000d0dfcd97f20e8ed06"
11
11
  }
@@ -786,26 +786,8 @@ extension MentraLive: CBCentralManagerDelegate {
786
786
  if !isReconnectTarget && advertisesPairingFlag(advertisementData)
787
787
  && !isPairingDiscoverable(advertisementData)
788
788
  {
789
- // Keep nearby secure units visible with pairing-mode guidance, while RN blocks
790
- // the connection until a pairable advertisement arrives.
791
- pairFlow(
792
- "discover",
793
- "name=\(name) id=\(peripheral.identifier.uuidString) saved=\(savedDeviceName ?? "-") pairingMode=false secure=true connect=false"
794
- )
795
- discoveredPeripherals[name] = peripheral
796
- rememberPeripheral(peripheral, name: name)
797
- if cacheAdvPairing(
798
- name,
799
- pairingMode: false,
800
- pairingCode: nil,
801
- securePairingCapable: true
802
- ) {
803
- emitDiscoveredDeviceFromCache(
804
- name,
805
- identifier: peripheral.identifier.uuidString,
806
- rssi: rssi?.intValue
807
- )
808
- }
789
+ // Only glasses that can pair now are listed; a closed window drops them.
790
+ unlistNotPairable(name)
809
791
  return
810
792
  }
811
793
 
@@ -831,11 +813,13 @@ extension MentraLive: CBCentralManagerDelegate {
831
813
  discoveredPeripherals[name] = peripheral
832
814
  rememberPeripheral(peripheral, name: name)
833
815
 
834
- if !partialAdvertisement, cacheAdvPairing(
816
+ if trailer.secureCapable && !trailer.pairingMode {
817
+ unlistNotPairable(name)
818
+ } else if !partialAdvertisement, cacheAdvPairing(
835
819
  name,
836
820
  // Field firmware has no pairing flag. Treat it as pairable so the
837
821
  // new Mentra App can still find old glasses.
838
- pairingMode: trailer.secureCapable ? trailer.pairingMode : true,
822
+ pairingMode: true,
839
823
  pairingCode: trailer.pairingCode,
840
824
  securePairingCapable: trailer.secureCapable
841
825
  ) {
@@ -2925,7 +2909,7 @@ class MentraLive: NSObject, SGCManager {
2925
2909
 
2926
2910
  // The choose-glasses scan has to hear a later advertisement when the glasses
2927
2911
  // enter pairing mode. iOS reports each peripheral once unless duplicates are
2928
- // allowed, so the row would stay "Not in pairing mode". Reconnect scans stay
2912
+ // allowed, so the glasses would stay off the list. Reconnect scans stay
2929
2913
  // duplicate-free so a saved glasses advertisement cannot start another connect.
2930
2914
  let scanOptions: [String: Any] = [
2931
2915
  CBCentralManagerScanOptionAllowDuplicatesKey: manualDiscoveryActive,
@@ -6941,6 +6925,14 @@ class MentraLive: NSObject, SGCManager {
6941
6925
  return true
6942
6926
  }
6943
6927
 
6928
+ /// Drops glasses that are not in pairing mode from the search results, once per change, so the
6929
+ /// next pairable advertisement lists them again.
6930
+ private func unlistNotPairable(_ name: String) {
6931
+ if cacheAdvPairing(name, pairingMode: false, pairingCode: nil, securePairingCapable: true) {
6932
+ Bridge.removeDiscoveredDevice("Mentra Live", name)
6933
+ }
6934
+ }
6935
+
6944
6936
  private func emitDiscoveredDeviceFromCache(
6945
6937
  _ name: String,
6946
6938
  identifier: String = "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mentra/bluetooth-sdk",
3
- "version": "3.4.0-beta.1297",
3
+ "version": "3.4.0-beta.1298",
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.4.0-beta.1297"
118
+ "@mentra/cloud-protocol": "3.4.0-beta.1298"
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.4.0",
15
- "releaseIdentity": "3.4.0-beta.1297",
16
- "releaseSetId": "mentra-3.4.0-beta.1297",
17
- "sourceCommit": "0380ba8fea16ed46215a90d762f595577994ec88",
18
- "otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-beta.1297.json",
19
- "otaManifestSha256": "2144f4c7a33ec9bbde4a577bc3804bac8774e4e3d164e3dc55b2804bd5c8e0c7"
15
+ "releaseIdentity": "3.4.0-beta.1298",
16
+ "releaseSetId": "mentra-3.4.0-beta.1298",
17
+ "sourceCommit": "da505cc7c363e458588c70353bf21667a2397803",
18
+ "otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-beta.1298.json",
19
+ "otaManifestSha256": "f9987322fefc5896ce7e95778d1df190f15041a00aa6000d0dfcd97f20e8ed06"
20
20
  })