@mentra/bluetooth-sdk 3.5.0-dev.1239 → 3.5.0-dev.1242

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.
@@ -34,7 +34,7 @@ internal object ConnectedDeviceMatcher {
34
34
  if (savedAddress != null && address != null) {
35
35
  address.equals(savedAddress, ignoreCase = true)
36
36
  } else {
37
- !candidateName.isNullOrBlank() && candidateName == defaultDevice.name
37
+ sameSavedName(model, defaultDevice.name, candidateName)
38
38
  }
39
39
  } else {
40
40
  false
@@ -66,4 +66,18 @@ internal object ConnectedDeviceMatcher {
66
66
  name.startsWith("MENTRA_DISPLAY_")
67
67
  else -> false
68
68
  }
69
+
70
+ /**
71
+ * Saved-name equality, plus the generic factory fallback that moved from
72
+ * `XyBLE_3008` / `XyBT_3008` to `Mentra_Live_3008`. Unique shipped names
73
+ * such as `XyBLE_1234` stay exact. Address matching remains the primary
74
+ * identity check when both sides have an address.
75
+ */
76
+ fun sameSavedName(model: DeviceModel, saved: String?, advertised: String?): Boolean {
77
+ if (saved.isNullOrBlank() || advertised.isNullOrBlank()) return false
78
+ if (saved == advertised) return true
79
+ if (model != DeviceModel.MENTRA_LIVE) return false
80
+ val generic = setOf("XyBLE_3008", "XyBT_3008", "Mentra_Live_3008")
81
+ return saved in generic && advertised in generic
82
+ }
69
83
  }
@@ -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.1239"
7
- const val RELEASE_SET_ID: String = "mentra-3.5.0-dev.1239"
8
- const val SOURCE_COMMIT: String = "e8aa2cac40175a5b7b1dfd1611283d81bbc7fa6a"
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.1239.json"
10
- const val OTA_MANIFEST_SHA256: String = "22eff2798c8bc376ca3afd708efd0eaa385b9241be8e44c07da1911be82130a4"
6
+ const val RELEASE_IDENTITY: String = "3.5.0-dev.1242"
7
+ const val RELEASE_SET_ID: String = "mentra-3.5.0-dev.1242"
8
+ const val SOURCE_COMMIT: String = "26732cbf8d52867f8b14be623c33cfeb8cede88f"
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.1242.json"
10
+ const val OTA_MANIFEST_SHA256: String = "77202073c5cb692e80be1f07dfaba7b348468f51f788e0e902e2479cae43ab25"
11
11
  }
@@ -41,6 +41,8 @@ import com.mentra.bluetoothsdk.PhotoRequest
41
41
  import com.mentra.bluetoothsdk.PhotoSize
42
42
  import com.mentra.bluetoothsdk.PhotoMode
43
43
  import com.mentra.bluetoothsdk.TouchGesture
44
+ import com.mentra.bluetoothsdk.ConnectedDeviceMatcher
45
+ import com.mentra.bluetoothsdk.DeviceModel
44
46
  import com.mentra.bluetoothsdk.DeviceStore
45
47
  import com.mentra.bluetoothsdk.ObservableStore
46
48
  import com.mentra.bluetoothsdk.incomingGlassesMessageAckId
@@ -1634,7 +1636,11 @@ class MentraLive : SGCManager() {
1634
1636
  // this name. A discovery-only pairing scan must not auto-connect just
1635
1637
  // because savedDeviceName still matches (spoof risk).
1636
1638
  val isSavedGlasses =
1637
- savedDeviceName.isNotEmpty() && savedDeviceName == deviceName
1639
+ ConnectedDeviceMatcher.sameSavedName(
1640
+ DeviceModel.MENTRA_LIVE,
1641
+ savedDeviceName,
1642
+ deviceName,
1643
+ )
1638
1644
  val isNamedConnectTarget =
1639
1645
  isSavedGlasses && (isReconnecting || explicitConnectByName)
1640
1646
  if (MentraLiveOwnerLossPolicy.shouldExposeAsNonPairable(
@@ -1662,7 +1668,7 @@ class MentraLive : SGCManager() {
1662
1668
  )
1663
1669
  return
1664
1670
  }
1665
- val glassType = if (deviceName == "Xy_A") "Standard" else "K900"
1671
+ val glassType = if (deviceName == "Xy_A") "Standard" else "Mentra Live"
1666
1672
  val (pairingMode, pairingCode, secureCapable) = parseSecurePairingTrailer(result)
1667
1673
  Bridge.log(
1668
1674
  "LIVE: Found compatible " +
@@ -1684,7 +1690,12 @@ class MentraLive : SGCManager() {
1684
1690
  securePairingCapable = secureCapable,
1685
1691
  )
1686
1692
 
1687
- if (savedDeviceName.isNotEmpty() && savedDeviceName == deviceName) {
1693
+ if (ConnectedDeviceMatcher.sameSavedName(
1694
+ DeviceModel.MENTRA_LIVE,
1695
+ savedDeviceName,
1696
+ deviceName,
1697
+ )
1698
+ ) {
1688
1699
  observeSavedGlassesAdvertisement(result)
1689
1700
  }
1690
1701
 
@@ -25,6 +25,28 @@ class ConnectedDeviceMatcherTest {
25
25
  }
26
26
  }
27
27
 
28
+ @Test
29
+ fun `generic factory fallback names are the same saved glasses`() {
30
+ for (saved in listOf("XyBLE_3008", "XyBT_3008", "Mentra_Live_3008")) {
31
+ for (advertised in listOf("XyBLE_3008", "XyBT_3008", "Mentra_Live_3008")) {
32
+ assertThat(
33
+ ConnectedDeviceMatcher.sameSavedName(DeviceModel.MENTRA_LIVE, saved, advertised),
34
+ ).isTrue()
35
+ }
36
+ }
37
+ assertThat(
38
+ ConnectedDeviceMatcher.sameSavedName(DeviceModel.MENTRA_LIVE, "XyBLE_1234", "Mentra_Live_3008"),
39
+ ).isFalse()
40
+ assertThat(
41
+ ConnectedDeviceMatcher.matches(
42
+ model = DeviceModel.MENTRA_LIVE,
43
+ defaultDevice = Device(DeviceModel.MENTRA_LIVE, "XyBLE_3008"),
44
+ candidateName = "Mentra_Live_3008",
45
+ candidateAddress = null,
46
+ ),
47
+ ).isTrue()
48
+ }
49
+
28
50
  @Test
29
51
  fun `matches Mentra Nex advertised name prefixes`() {
30
52
  for (name in listOf("Nex1-77", "MENTRA_DISPLAY_02")) {
@@ -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.1239",
5
- "releaseSetId": "mentra-3.5.0-dev.1239",
6
- "sourceCommit": "e8aa2cac40175a5b7b1dfd1611283d81bbc7fa6a",
7
- "otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.1239.json",
8
- "otaManifestSha256": "22eff2798c8bc376ca3afd708efd0eaa385b9241be8e44c07da1911be82130a4"
4
+ "releaseIdentity": "3.5.0-dev.1242",
5
+ "releaseSetId": "mentra-3.5.0-dev.1242",
6
+ "sourceCommit": "26732cbf8d52867f8b14be623c33cfeb8cede88f",
7
+ "otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.1242.json",
8
+ "otaManifestSha256": "77202073c5cb692e80be1f07dfaba7b348468f51f788e0e902e2479cae43ab25"
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.1239\",\n \"releaseSetId\": \"mentra-3.5.0-dev.1239\",\n \"sourceCommit\": \"e8aa2cac40175a5b7b1dfd1611283d81bbc7fa6a\",\n \"otaManifestUrl\": \"https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.1239.json\",\n \"otaManifestSha256\": \"22eff2798c8bc376ca3afd708efd0eaa385b9241be8e44c07da1911be82130a4\"\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,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.1242\",\n \"releaseSetId\": \"mentra-3.5.0-dev.1242\",\n \"sourceCommit\": \"26732cbf8d52867f8b14be623c33cfeb8cede88f\",\n \"otaManifestUrl\": \"https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.1242.json\",\n \"otaManifestSha256\": \"77202073c5cb692e80be1f07dfaba7b348468f51f788e0e902e2479cae43ab25\"\n})\n"]}
@@ -16,7 +16,7 @@ enum BluetoothSdkDefaults {
16
16
  /// silently disable it on every pair the app touches.
17
17
  static let autoPowerOffEnabled = true
18
18
  private static let infoSdkVersionKey = "MentraBluetoothSdkVersion"
19
- private static let swiftPackageSdkVersion = "3.5.0-dev.1239"
19
+ private static let swiftPackageSdkVersion = "3.5.0-dev.1242"
20
20
  private static let swiftPackageSdkVersionPlaceholder = "__MENTRA" + "_BLUETOOTH_SDK_VERSION__"
21
21
 
22
22
  private static func normalizedSdkVersion(_ value: String?) -> String? {
@@ -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.1239"
7
- static let releaseSetId = "mentra-3.5.0-dev.1239"
8
- static let sourceCommit = "e8aa2cac40175a5b7b1dfd1611283d81bbc7fa6a"
9
- static let otaManifestUrl = "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.1239.json"
10
- static let otaManifestSha256 = "22eff2798c8bc376ca3afd708efd0eaa385b9241be8e44c07da1911be82130a4"
6
+ static let releaseIdentity = "3.5.0-dev.1242"
7
+ static let releaseSetId = "mentra-3.5.0-dev.1242"
8
+ static let sourceCommit = "26732cbf8d52867f8b14be623c33cfeb8cede88f"
9
+ static let otaManifestUrl = "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.1242.json"
10
+ static let otaManifestSha256 = "77202073c5cb692e80be1f07dfaba7b348468f51f788e0e902e2479cae43ab25"
11
11
  }
@@ -9,7 +9,8 @@ enum ConnectedDeviceMatcher {
9
9
  let candidateID = identifier.flatMap { $0.isEmpty ? nil : $0 }
10
10
  if let savedID, let candidateID {
11
11
  if savedID.caseInsensitiveCompare(candidateID) == .orderedSame { return true }
12
- } else if let name, !name.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty, name == saved.name {
12
+ } else if let name, !name.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty,
13
+ Self.sameSavedName(model, saved: saved.name, advertised: name) {
13
14
  return true
14
15
  }
15
16
  }
@@ -24,6 +25,16 @@ enum ConnectedDeviceMatcher {
24
25
  }
25
26
  }
26
27
 
28
+ /// Saved-name equality, plus the generic factory fallback that moved from
29
+ /// `XyBLE_3008` / `XyBT_3008` to `Mentra_Live_3008`. Unique names such as
30
+ /// `XyBLE_1234` stay exact.
31
+ static func sameSavedName(_ model: DeviceModel, saved: String, advertised: String) -> Bool {
32
+ if saved == advertised { return true }
33
+ guard model == .mentraLive else { return false }
34
+ let generic: Set<String> = ["XyBLE_3008", "XyBT_3008", "Mentra_Live_3008"]
35
+ return generic.contains(saved) && generic.contains(advertised)
36
+ }
37
+
27
38
  /// Service IDs used by the corresponding SGCs. CoreBluetooth cannot enumerate
28
39
  /// every system connection without service filters; unsupported models stay silent.
29
40
  static func serviceUUIDs(for model: DeviceModel) -> [String] {
@@ -778,7 +778,9 @@ extension MentraLive: CBCentralManagerDelegate {
778
778
  || name.hasPrefix("MENTRA_LIVE_BT") || name.lowercased().hasPrefix("mentra_live")
779
779
  {
780
780
  let savedDeviceName = UserDefaults.standard.string(forKey: PREFS_DEVICE_NAME)
781
- let isReconnectTarget = savedDeviceName != nil && savedDeviceName == name
781
+ let isReconnectTarget = savedDeviceName.map {
782
+ ConnectedDeviceMatcher.sameSavedName(.mentraLive, saved: $0, advertised: name)
783
+ } ?? false
782
784
  let discoveredAtMs = Self.monotonicNowMs()
783
785
  if advertisesPairingFlag(advertisementData) {
784
786
  Self.secureTrailerMemory.recordSecureTrailer(peripheral.identifier, nowMs: discoveredAtMs)
@@ -809,7 +811,7 @@ extension MentraLive: CBCentralManagerDelegate {
809
811
  return
810
812
  }
811
813
 
812
- let glassType = name == "Xy_A" ? "Standard" : "K900"
814
+ let glassType = name == "Xy_A" ? "Standard" : "Mentra Live"
813
815
  let trailer = parseSecurePairingTrailer(advertisementData)
814
816
  // A packet without the trailer from a peripheral that just showed it is a partial
815
817
  // advertisement, not legacy firmware. Do not publish it: the scan list would show a
@@ -846,7 +848,9 @@ extension MentraLive: CBCentralManagerDelegate {
846
848
  )
847
849
  }
848
850
 
849
- let isSavedGlasses = savedDeviceName == name
851
+ let isSavedGlasses = savedDeviceName.map {
852
+ ConnectedDeviceMatcher.sameSavedName(.mentraLive, saved: $0, advertised: name)
853
+ } ?? false
850
854
  if isSavedGlasses, trailer.secureCapable {
851
855
  observeSavedGlassesAdvertisement(trailer)
852
856
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mentra/bluetooth-sdk",
3
- "version": "3.5.0-dev.1239",
3
+ "version": "3.5.0-dev.1242",
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.1239"
118
+ "@mentra/cloud-protocol": "3.5.0-dev.1242"
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.1239",
16
- "releaseSetId": "mentra-3.5.0-dev.1239",
17
- "sourceCommit": "e8aa2cac40175a5b7b1dfd1611283d81bbc7fa6a",
18
- "otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.1239.json",
19
- "otaManifestSha256": "22eff2798c8bc376ca3afd708efd0eaa385b9241be8e44c07da1911be82130a4"
15
+ "releaseIdentity": "3.5.0-dev.1242",
16
+ "releaseSetId": "mentra-3.5.0-dev.1242",
17
+ "sourceCommit": "26732cbf8d52867f8b14be623c33cfeb8cede88f",
18
+ "otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.1242.json",
19
+ "otaManifestSha256": "77202073c5cb692e80be1f07dfaba7b348468f51f788e0e902e2479cae43ab25"
20
20
  })