@mentra/bluetooth-sdk 3.5.0-dev.1512 → 3.5.0-dev.1513

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.
@@ -1143,23 +1143,9 @@ class BluetoothSdkModule : Module() {
1143
1143
  }
1144
1144
  }
1145
1145
 
1146
- private fun Map<String, Any>?.toMentraDevice(): Device? {
1147
- val values = this ?: return null
1148
- val model = values["model"] as? String ?: return null
1149
- val name = values["name"] as? String ?: return null
1150
- val address = values["address"] as? String
1151
- val projectName = values["projectName"] as? String
1152
- val rssi = (values["rssi"] as? Number)?.toInt()
1153
- val id = values["id"] as? String
1154
- return Device(
1155
- model = DeviceModel.fromDeviceType(model),
1156
- name = name,
1157
- address = address?.takeIf { it.isNotBlank() },
1158
- projectName = projectName?.takeIf { it.isNotBlank() },
1159
- rssi = rssi,
1160
- id = id?.takeIf { it.isNotBlank() } ?: address?.takeIf { it.isNotBlank() } ?: "$model:$name",
1161
- )
1162
- }
1146
+ // Every field the scan reported, securePairingCapable included: the pairing flow reads it to tell a declined secure
1147
+ // pair from a failed legacy one before the glasses send pairing_info.
1148
+ private fun Map<String, Any>?.toMentraDevice(): Device? = this?.let(Device::fromMap)
1163
1149
 
1164
1150
  private fun Map<String, Any>?.toMentraConnectOptions(): ConnectOptions {
1165
1151
  val values = this ?: return ConnectOptions()
@@ -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.1512"
7
- const val RELEASE_SET_ID: String = "mentra-3.5.0-dev.1512"
8
- const val SOURCE_COMMIT: String = "c12a062f19cf41ea664379185dc85cd73e5fe861"
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.1512.json"
10
- const val OTA_MANIFEST_SHA256: String = "70c7edf1f3556a1d88eacb95946fac834be8e6bc0dea9a4734dad929b6341c09"
6
+ const val RELEASE_IDENTITY: String = "3.5.0-dev.1513"
7
+ const val RELEASE_SET_ID: String = "mentra-3.5.0-dev.1513"
8
+ const val SOURCE_COMMIT: String = "027fbe5f4c4109d8b48bc3aac3982ec69f99ae90"
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.1513.json"
10
+ const val OTA_MANIFEST_SHA256: String = "1ffa737ac3a6141e4bda0055188ed608c555100f3e0ab90ecda72f0877e9b45b"
11
11
  }
@@ -8022,14 +8022,31 @@ class MentraLive : SGCManager() {
8022
8022
  }
8023
8023
  audioConnected = false
8024
8024
  if (previousBondState == BluetoothDevice.BOND_BONDING &&
8025
+ isExplicitPairingAttempt() &&
8026
+ isSecurePairingTarget() &&
8027
+ !MentraLiveOwnerLossPolicy.isSecurePairingDeclined(
8028
+ // AOSP's EXTRA_UNBOND_REASON key is
8029
+ // "extra.REASON".
8030
+ reason
8031
+ )
8032
+ ) {
8033
+ // Not a decline, such as Android removing a stale bond
8034
+ // while it bonds again: no result yet. The owner commit
8035
+ // and bond decide, within the secure bond wait.
8036
+ Bridge.log(
8037
+ "LIVE: CTKD: secure pairing bond reset (reason=$reason), not declined — waiting for the bond"
8038
+ )
8039
+ armSecureBondWait()
8040
+ } else if (previousBondState == BluetoothDevice.BOND_BONDING &&
8025
8041
  isExplicitPairingAttempt() &&
8026
8042
  isSecurePairingTarget()
8027
8043
  ) {
8028
- // Secure glasses own a phone only through this bond.
8029
- // Re-prompting after a decline only repeats the
8030
- // system dialog; let the pairing screen offer Try again.
8044
+ // The person declined Android's pairing request. Secure
8045
+ // glasses own a phone only through this bond, and
8046
+ // re-prompting only repeats the system dialog; let the
8047
+ // pairing screen offer Try again.
8031
8048
  Bridge.log(
8032
- "LIVE: CTKD: secure pairing bond not completed — reporting pairing failure"
8049
+ "LIVE: CTKD: secure pairing declined (reason=$reason) — reporting pairing failure"
8033
8050
  )
8034
8051
  bondingRetryCount = 0
8035
8052
  cancelSecureBondWait()
@@ -197,6 +197,23 @@ internal object MentraLiveOwnerLossPolicy {
197
197
  (bondState != BluetoothDevice.BOND_BONDED ||
198
198
  !pairingInfoConfirmsOwner(ownerCommitted))
199
199
 
200
+ /**
201
+ * Android's hidden unbond reasons for a person declining a pairing request: auth failed (1),
202
+ * rejected (2), cancelled (3) and remote auth cancelled (8). Samsung reports Cancel on its
203
+ * pairing request as 1. Hidden constants with stable values; the bond-state broadcast carries
204
+ * them under `android.bluetooth.device.extra.REASON`.
205
+ */
206
+ private val DECLINE_UNBOND_REASONS = setOf(1, 2, 3, 8)
207
+
208
+ /**
209
+ * Whether a bond that went BONDING→NONE during an explicit secure pair was declined. Only a
210
+ * decline ends the attempt at once. Success comes from the glasses (`pairing_info`
211
+ * `owner_committed`) with the bond reaching BONDED. Any other reason, such as 9 (removed:
212
+ * Android dropping a stale bond while it bonds again), is not a result: the attempt stays
213
+ * bounded by [SECURE_BOND_WAIT_MS].
214
+ */
215
+ fun isSecurePairingDeclined(unbondReason: Int): Boolean = unbondReason in DECLINE_UNBOND_REASONS
216
+
200
217
  /** How long an explicit secure pair may wait for a bond result before the attempt fails. */
201
218
  const val SECURE_BOND_WAIT_MS = 40_000L
202
219
 
@@ -0,0 +1,19 @@
1
+ package com.mentra.bluetoothsdk
2
+
3
+ import org.junit.Assert.assertEquals
4
+ import org.junit.Test
5
+
6
+ class DeviceMapTest {
7
+ /** The scan row that JS hands back to connect: the pairing flow needs its capability before pairing_info. */
8
+ @Test fun `a selected scan row keeps its secure pairing capability`() {
9
+ val row = Device(
10
+ model = DeviceModel.MENTRA_LIVE,
11
+ name = "Mentra_Live_0BB0",
12
+ address = "AA:BB:CC:DD:0B:B0",
13
+ pairingMode = true,
14
+ pairingCode = "1A2B",
15
+ securePairingCapable = true,
16
+ )
17
+ assertEquals(row, Device.fromMap(row.toMap()))
18
+ }
19
+ }
@@ -379,4 +379,25 @@ class MentraLiveOwnerLossPolicyTest {
379
379
  msSinceAutoReconnectLink = msSinceAutoReconnectLink,
380
380
  secureFirmware = secureFirmware,
381
381
  )
382
+
383
+ @Test
384
+ fun onlyADeclineEndsASecurePairAtOnce() {
385
+ // auth failed (Samsung's Cancel), rejected, cancelled, remote auth cancelled
386
+ for (reason in listOf(1, 2, 3, 8)) {
387
+ assertTrue(MentraLiveOwnerLossPolicy.isSecurePairingDeclined(reason))
388
+ }
389
+ }
390
+
391
+ @Test
392
+ fun aStaleBondRemovedWhileRebondingIsNotADecline() {
393
+ assertFalse(MentraLiveOwnerLossPolicy.isSecurePairingDeclined(9))
394
+ }
395
+
396
+ @Test
397
+ fun otherBondEndingsWaitForTheSecureBondWait() {
398
+ // remote device down, timeout, repeated attempts, no reason
399
+ for (reason in listOf(4, 6, 7, -1)) {
400
+ assertFalse(MentraLiveOwnerLossPolicy.isSecurePairingDeclined(reason))
401
+ }
402
+ }
382
403
  }
@@ -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.1512",
5
- "releaseSetId": "mentra-3.5.0-dev.1512",
6
- "sourceCommit": "c12a062f19cf41ea664379185dc85cd73e5fe861",
7
- "otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.1512.json",
8
- "otaManifestSha256": "70c7edf1f3556a1d88eacb95946fac834be8e6bc0dea9a4734dad929b6341c09"
4
+ "releaseIdentity": "3.5.0-dev.1513",
5
+ "releaseSetId": "mentra-3.5.0-dev.1513",
6
+ "sourceCommit": "027fbe5f4c4109d8b48bc3aac3982ec69f99ae90",
7
+ "otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.1513.json",
8
+ "otaManifestSha256": "1ffa737ac3a6141e4bda0055188ed608c555100f3e0ab90ecda72f0877e9b45b"
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.1512\",\n \"releaseSetId\": \"mentra-3.5.0-dev.1512\",\n \"sourceCommit\": \"c12a062f19cf41ea664379185dc85cd73e5fe861\",\n \"otaManifestUrl\": \"https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.1512.json\",\n \"otaManifestSha256\": \"70c7edf1f3556a1d88eacb95946fac834be8e6bc0dea9a4734dad929b6341c09\"\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.1513\",\n \"releaseSetId\": \"mentra-3.5.0-dev.1513\",\n \"sourceCommit\": \"027fbe5f4c4109d8b48bc3aac3982ec69f99ae90\",\n \"otaManifestUrl\": \"https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.1513.json\",\n \"otaManifestSha256\": \"1ffa737ac3a6141e4bda0055188ed608c555100f3e0ab90ecda72f0877e9b45b\"\n})\n"]}
@@ -1126,8 +1126,13 @@ private extension Device {
1126
1126
  model: DeviceModel.fromDeviceType(model),
1127
1127
  name: name,
1128
1128
  identifier: identifier?.isEmpty == true ? nil : identifier,
1129
+ projectName: (values["projectName"] as? String).flatMap { $0.isEmpty ? nil : $0 },
1129
1130
  rssi: rssi,
1130
- id: id
1131
+ id: id,
1132
+ pairingMode: values["pairingMode"] as? Bool,
1133
+ pairingCode: (values["pairingCode"] as? String).flatMap { $0.isEmpty ? nil : $0 },
1134
+ // The pairing flow reads it to tell a declined secure pair from a failed legacy one.
1135
+ securePairingCapable: values["securePairingCapable"] as? Bool
1131
1136
  )
1132
1137
  }
1133
1138
  }
@@ -17,7 +17,7 @@ enum BluetoothSdkDefaults {
17
17
  /// persist.mentra.wear_detection_off=1.
18
18
  static let autoPowerOffEnabled = true
19
19
  private static let infoSdkVersionKey = "MentraBluetoothSdkVersion"
20
- private static let swiftPackageSdkVersion = "3.5.0-dev.1512"
20
+ private static let swiftPackageSdkVersion = "3.5.0-dev.1513"
21
21
  private static let swiftPackageSdkVersionPlaceholder = "__MENTRA" + "_BLUETOOTH_SDK_VERSION__"
22
22
 
23
23
  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.1512"
7
- static let releaseSetId = "mentra-3.5.0-dev.1512"
8
- static let sourceCommit = "c12a062f19cf41ea664379185dc85cd73e5fe861"
9
- static let otaManifestUrl = "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.1512.json"
10
- static let otaManifestSha256 = "70c7edf1f3556a1d88eacb95946fac834be8e6bc0dea9a4734dad929b6341c09"
6
+ static let releaseIdentity = "3.5.0-dev.1513"
7
+ static let releaseSetId = "mentra-3.5.0-dev.1513"
8
+ static let sourceCommit = "027fbe5f4c4109d8b48bc3aac3982ec69f99ae90"
9
+ static let otaManifestUrl = "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.1513.json"
10
+ static let otaManifestSha256 = "1ffa737ac3a6141e4bda0055188ed608c555100f3e0ab90ecda72f0877e9b45b"
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mentra/bluetooth-sdk",
3
- "version": "3.5.0-dev.1512",
3
+ "version": "3.5.0-dev.1513",
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.1512"
118
+ "@mentra/cloud-protocol": "3.5.0-dev.1513"
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.1512",
16
- "releaseSetId": "mentra-3.5.0-dev.1512",
17
- "sourceCommit": "c12a062f19cf41ea664379185dc85cd73e5fe861",
18
- "otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.1512.json",
19
- "otaManifestSha256": "70c7edf1f3556a1d88eacb95946fac834be8e6bc0dea9a4734dad929b6341c09"
15
+ "releaseIdentity": "3.5.0-dev.1513",
16
+ "releaseSetId": "mentra-3.5.0-dev.1513",
17
+ "sourceCommit": "027fbe5f4c4109d8b48bc3aac3982ec69f99ae90",
18
+ "otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.1513.json",
19
+ "otaManifestSha256": "1ffa737ac3a6141e4bda0055188ed608c555100f3e0ab90ecda72f0877e9b45b"
20
20
  })