@mentra/bluetooth-sdk 3.5.0-dev.1506 → 3.5.0-dev.1508

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.
Files changed (44) hide show
  1. package/android/src/main/AndroidManifest.xml +0 -5
  2. package/android/src/main/java/com/mentra/bluetoothsdk/BluetoothSdkModule.kt +0 -21
  3. package/android/src/main/java/com/mentra/bluetoothsdk/DeviceManager.kt +0 -35
  4. package/android/src/main/java/com/mentra/bluetoothsdk/DeviceStore.kt +0 -1
  5. package/android/src/main/java/com/mentra/bluetoothsdk/GeneratedReleaseMetadata.kt +5 -5
  6. package/android/src/main/java/com/mentra/bluetoothsdk/MentraBluetoothSdk.kt +1 -64
  7. package/android/src/main/java/com/mentra/bluetoothsdk/camera/CameraModels.kt +0 -36
  8. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLive.kt +6 -190
  9. package/android/src/main/java/com/mentra/bluetoothsdk/status/DeviceStatus.kt +0 -7
  10. package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/MentraLiveFileTransferSessionTest.kt +0 -16
  11. package/build/BluetoothSdk.types.d.ts +0 -75
  12. package/build/BluetoothSdk.types.d.ts.map +1 -1
  13. package/build/BluetoothSdk.types.js.map +1 -1
  14. package/build/_private/BluetoothSdkModule.d.ts +1 -3
  15. package/build/_private/BluetoothSdkModule.d.ts.map +1 -1
  16. package/build/_private/BluetoothSdkModule.js +0 -14
  17. package/build/_private/BluetoothSdkModule.js.map +1 -1
  18. package/build/_private/photoRequestPayload.d.ts.map +1 -1
  19. package/build/_private/photoRequestPayload.js +0 -3
  20. package/build/_private/photoRequestPayload.js.map +1 -1
  21. package/build/generated/releaseMetadata.js +5 -5
  22. package/build/generated/releaseMetadata.js.map +1 -1
  23. package/build/index.d.ts +1 -1
  24. package/build/index.d.ts.map +1 -1
  25. package/build/index.js +0 -14
  26. package/build/index.js.map +1 -1
  27. package/ios/BluetoothSdkModule.swift +0 -15
  28. package/ios/Source/BluetoothSdkDefaults.swift +1 -1
  29. package/ios/Source/DeviceManager.swift +0 -10
  30. package/ios/Source/DeviceStore.swift +0 -1
  31. package/ios/Source/GeneratedReleaseMetadata.swift +5 -5
  32. package/ios/Source/MentraBluetoothSDK.swift +2 -53
  33. package/ios/Source/camera/CameraModels.swift +8 -44
  34. package/ios/Source/sgcs/MentraLive.swift +6 -83
  35. package/ios/Source/sgcs/MentraLiveFileTransferSession.swift +0 -5
  36. package/ios/Source/status/DeviceStatus.swift +0 -9
  37. package/ios/Tests/PhotoRequestRoutingTests.swift +0 -31
  38. package/package.json +2 -2
  39. package/src/BluetoothSdk.types.ts +0 -80
  40. package/src/_private/BluetoothSdkModule.ts +0 -22
  41. package/src/_private/photoRequestPayload.ts +0 -3
  42. package/src/generated/releaseMetadata.ts +5 -5
  43. package/src/index.ts +0 -26
  44. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/WifiDirectLink.kt +0 -488
@@ -1217,15 +1217,12 @@ public final class MentraBluetoothSDK {
1217
1217
  Bridge.log(
1218
1218
  "NATIVE: PHOTO PIPELINE [3b/6] MentraBluetoothSdk.requestPhoto requestId=\(routedRequest.requestId)"
1219
1219
  )
1220
- if routedRequest.holdsPhoto { try requireHeldPhotos() }
1221
1220
  let pending = PendingResponse<PhotoResponseEvent>(operation: "photo request \(routedRequest.requestId)", telemetryOperation: "photo request", onTimeout: requestTimeoutReporter)
1222
1221
  pendingPhotoRequests[routedRequest.requestId] = pending
1223
1222
  do {
1224
1223
  let event = try await withUsageOutcome(record: { (latencyMs, errorCode, event: PhotoResponseEvent?) in
1225
1224
  var fileSizeBytes: Int64?
1226
- if case let .success(_, _, _, _, _, size?, _, _, _, _) = event?.response {
1227
- fileSizeBytes = Int64(size)
1228
- }
1225
+ if case let .success(_, _, _, _, _, size?, _) = event?.response { fileSizeBytes = Int64(size) }
1229
1226
  analytics.recordUsage {
1230
1227
  $0.photoSettled(
1231
1228
  size: routedRequest.size.rawValue,
@@ -1240,7 +1237,7 @@ public final class MentraBluetoothSDK {
1240
1237
  }
1241
1238
  }) {
1242
1239
  DeviceManager.shared.requestPhoto(routedRequest)
1243
- return try await pending.wait(timeoutMs: routedRequest.presendThumbnail || routedRequest.holdsPhoto
1240
+ return try await pending.wait(timeoutMs: routedRequest.presendThumbnail
1244
1241
  ? MentraBluetoothSDK.photoThumbnailRequestTimeoutMs
1245
1242
  : MentraBluetoothSDK.photoRequestTimeoutMs)
1246
1243
  }
@@ -1252,54 +1249,6 @@ public final class MentraBluetoothSDK {
1252
1249
  }
1253
1250
  }
1254
1251
 
1255
- private func requireHeldPhotos() throws {
1256
- if glassesStatus.heldPhotosVersion <= 0 {
1257
- throw BluetoothSdkError(
1258
- code: "held_photos_unsupported",
1259
- message: "These glasses can't hold photos. Update the glasses software, or request whole photos."
1260
- )
1261
- }
1262
- }
1263
-
1264
- /// Fetch the full size of a photo the glasses hold (a request with `deliver = "thumbnail"`),
1265
- /// over Bluetooth. Resolves like `requestPhoto`: with the file's URI as `photoUrl` when
1266
- /// `localFile`, else once it is uploaded to `webhookUrl`. The glasses keep the photo until
1267
- /// `releaseHeldPhotos` or 30 minutes after capture, so a failed fetch can be retried.
1268
- public func fetchHeldPhoto(
1269
- requestId: String,
1270
- localFile: Bool = true,
1271
- webhookUrl: String? = nil,
1272
- authToken: String? = nil
1273
- ) async throws -> PhotoResponseEvent {
1274
- guard let id = nonBlankRequestId(requestId) else {
1275
- throw BluetoothSdkError(code: "invalid_request", message: "A photo request ID is required.")
1276
- }
1277
- if !localFile, webhookUrl?.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty ?? true {
1278
- throw BluetoothSdkError(code: "invalid_request", message: "Fetch to a file, or give a webhookUrl.")
1279
- }
1280
- try requireHeldPhotos()
1281
- if pendingPhotoRequests[id] != nil {
1282
- throw BluetoothSdkError(code: "request_in_flight", message: "This photo is already being fetched.")
1283
- }
1284
- let pending = PendingResponse<PhotoResponseEvent>(operation: "held photo fetch \(id)", telemetryOperation: "held photo fetch", onTimeout: requestTimeoutReporter)
1285
- pendingPhotoRequests[id] = pending
1286
- defer {
1287
- if pendingPhotoRequests[id] === pending {
1288
- pendingPhotoRequests.removeValue(forKey: id)
1289
- }
1290
- }
1291
- try DeviceManager.shared.fetchHeldPhoto(
1292
- requestId: id, localFile: localFile, webhookUrl: webhookUrl, authToken: authToken
1293
- )
1294
- return try await pending.wait(timeoutMs: MentraBluetoothSDK.photoThumbnailRequestTimeoutMs)
1295
- }
1296
-
1297
- /// Delete held photos on the glasses: these request IDs, or every held photo when nil.
1298
- public func releaseHeldPhotos(requestIds: [String]? = nil) throws {
1299
- try requireHeldPhotos()
1300
- try DeviceManager.shared.releaseHeldPhotos(requestIds: requestIds)
1301
- }
1302
-
1303
1252
  public func warmUpCamera(
1304
1253
  requestId: String? = nil,
1305
1254
  size: PhotoSize,
@@ -278,17 +278,6 @@ public struct PhotoRequest {
278
278
  /// success response carries that file's URL as `photoUrl`. Nothing is uploaded, and
279
279
  /// `webhookUrl` and `transferMethod` are ignored.
280
280
  public let localFile: Bool
281
- /// `"thumbnail"`: the glasses hold the full photo and send only its preview; the response
282
- /// comes once the preview arrived, with `held` and `thumbnailUrl`. Fetch the full photo later
283
- /// with `fetchHeldPhoto`, and release the rest with `releaseHeldPhotos`. Needs glasses whose
284
- /// status has `heldPhotosVersion` > 0. `webhookUrl` and `transferMethod` are ignored.
285
- public let deliver: String?
286
-
287
- public static let deliverThumbnail = "thumbnail"
288
-
289
- public var holdsPhoto: Bool {
290
- deliver == PhotoRequest.deliverThumbnail
291
- }
292
281
 
293
282
  public init(
294
283
  requestId: String? = nil,
@@ -311,8 +300,7 @@ public struct PhotoRequest {
311
300
  mode: PhotoMode = .photo,
312
301
  transferMethod: String = "auto",
313
302
  presendThumbnail: Bool = false,
314
- localFile: Bool = false,
315
- deliver: String? = nil
303
+ localFile: Bool = false
316
304
  ) {
317
305
  self.requestId = nonBlankRequestId(requestId) ?? generatedCameraRequestId("photo")
318
306
  self.size = size
@@ -335,7 +323,6 @@ public struct PhotoRequest {
335
323
  self.transferMethod = transferMethod
336
324
  self.presendThumbnail = presendThumbnail
337
325
  self.localFile = localFile
338
- self.deliver = deliver
339
326
  }
340
327
 
341
328
  public static func from(params: [String: Any]) throws -> PhotoRequest {
@@ -420,8 +407,7 @@ public struct PhotoRequest {
420
407
  mode: PhotoMode(normalizedRawValue: params["mode"] as? String),
421
408
  transferMethod: transferMethod,
422
409
  presendThumbnail: params["presend_thumbnail"] as? Bool ?? false,
423
- localFile: params["localFile"] as? Bool ?? false,
424
- deliver: (params["deliver"] as? String).flatMap { $0 == deliverThumbnail ? $0 : nil }
410
+ localFile: params["localFile"] as? Bool ?? false
425
411
  )
426
412
  }
427
413
 
@@ -487,8 +473,7 @@ public struct PhotoRequest {
487
473
  mode: mode,
488
474
  transferMethod: transferMethod,
489
475
  presendThumbnail: presendThumbnail,
490
- localFile: localFile,
491
- deliver: deliver
476
+ localFile: localFile
492
477
  )
493
478
  }
494
479
  }
@@ -660,13 +645,7 @@ public enum PhotoResponse: CustomStringConvertible, Equatable {
660
645
  statusUrl: String?,
661
646
  contentType: String?,
662
647
  fileSizeBytes: Int?,
663
- timestamp: Int,
664
- // The glasses hold the full photo (a `deliver = "thumbnail"` request).
665
- held: Bool = false,
666
- // The held photo's preview, as a `data:image/jpeg;base64,` URI.
667
- thumbnailUrl: String? = nil,
668
- // When the glasses captured the held photo (ms since the epoch).
669
- capturedAt: Int? = nil
648
+ timestamp: Int
670
649
  )
671
650
  case error(requestId: String, errorCode: String?, errorMessage: String, timestamp: Int)
672
651
 
@@ -684,10 +663,7 @@ public enum PhotoResponse: CustomStringConvertible, Equatable {
684
663
  contentType: stringValue(values, "contentType") ?? stringValue(values, "mimeType"),
685
664
  fileSizeBytes: intValue(values["fileSizeBytes"]) ?? intValue(values["bytes"])
686
665
  ?? intValue(values["size"]),
687
- timestamp: timestamp,
688
- held: boolValue(values, "held") == true,
689
- thumbnailUrl: stringValue(values, "thumbnailUrl"),
690
- capturedAt: intValue(values["capturedAt"])
666
+ timestamp: timestamp
691
667
  )
692
668
  } else {
693
669
  self = .error(
@@ -711,24 +687,21 @@ public enum PhotoResponse: CustomStringConvertible, Equatable {
711
687
 
712
688
  public var requestId: String {
713
689
  switch self {
714
- case let .success(requestId, _, _, _, _, _, _, _, _, _), let .error(requestId, _, _, _):
690
+ case let .success(requestId, _, _, _, _, _, _), let .error(requestId, _, _, _):
715
691
  requestId
716
692
  }
717
693
  }
718
694
 
719
695
  public var timestamp: Int {
720
696
  switch self {
721
- case let .success(_, _, _, _, _, _, timestamp, _, _, _), let .error(_, _, _, timestamp):
697
+ case let .success(_, _, _, _, _, _, timestamp), let .error(_, _, _, timestamp):
722
698
  timestamp
723
699
  }
724
700
  }
725
701
 
726
702
  public var values: [String: Any] {
727
703
  switch self {
728
- case let .success(
729
- requestId, uploadUrl, photoUrl, statusUrl, contentType, fileSizeBytes, timestamp, held, thumbnailUrl,
730
- capturedAt
731
- ):
704
+ case let .success(requestId, uploadUrl, photoUrl, statusUrl, contentType, fileSizeBytes, timestamp):
732
705
  var values: [String: Any] = [
733
706
  "state": State.success.rawValue,
734
707
  "requestId": requestId,
@@ -747,15 +720,6 @@ public enum PhotoResponse: CustomStringConvertible, Equatable {
747
720
  if let fileSizeBytes {
748
721
  values["fileSizeBytes"] = fileSizeBytes
749
722
  }
750
- if held {
751
- values["held"] = true
752
- }
753
- if let thumbnailUrl, !thumbnailUrl.isEmpty {
754
- values["thumbnailUrl"] = thumbnailUrl
755
- }
756
- if let capturedAt {
757
- values["capturedAt"] = capturedAt
758
- }
759
723
  return values
760
724
  case let .error(requestId, errorCode, errorMessage, timestamp):
761
725
  var values: [String: Any] = [
@@ -711,8 +711,6 @@ enum K900ProtocolUtils {
711
711
 
712
712
  private struct BlePhotoTransfer {
713
713
  var isThumbnail = false
714
- /// A held-photo request (deliver "thumbnail"): no full photo follows its preview.
715
- var held = false
716
714
  /// The photo stays on the phone as a file instead of being uploaded.
717
715
  var localFile = false
718
716
  let bleImgId: String
@@ -1537,8 +1535,6 @@ class MentraLive: NSObject, SGCManager {
1537
1535
  DeviceStore.shared.apply("glasses", "bluetoothMacAddress", "")
1538
1536
  DeviceStore.shared.apply("glasses", "wifiMacAddress", "")
1539
1537
  DeviceStore.shared.apply("glasses", "hotspotOtaVersion", 0)
1540
- DeviceStore.shared.apply("glasses", "heldPhotosVersion", 0)
1541
- heldPreviews.removeAll()
1542
1538
  }
1543
1539
  connectionState = state
1544
1540
  pairFlow(
@@ -1694,19 +1690,6 @@ class MentraLive: NSObject, SGCManager {
1694
1690
  private var fileWriteCharacteristic: CBCharacteristic?
1695
1691
  private var activeFileTransfers = [String: MentraLiveFileTransferSession]()
1696
1692
  private var blePhotoTransfers = [String: BlePhotoTransfer]()
1697
- /// Held photos' previews (data URIs) by requestId, until the request's terminal response.
1698
- private var heldPreviews = [String: String]()
1699
- private var lastBleImgNumber = 0
1700
- private let bleImgIdLock = NSLock()
1701
-
1702
- /// A Bluetooth image ID no other transfer of this process has: the clock's milliseconds, or one
1703
- /// past the last ID when two requests fall in the same millisecond (a burst, concurrent fetches).
1704
- private func nextBleImgId() -> String {
1705
- bleImgIdLock.lock()
1706
- defer { bleImgIdLock.unlock() }
1707
- lastBleImgNumber = max(Int(Date().timeIntervalSince1970 * 1000), lastBleImgNumber + 1)
1708
- return "I" + String(format: "%09d", lastBleImgNumber % 100_000_000)
1709
- }
1710
1693
  private(set) var bleIncidentLogRelays = [String: BleIncidentLogRelayEntry]()
1711
1694
  /// BES bytes kept on the phone until the MTK log for the same report has been uploaded.
1712
1695
  private var heldBesLogs = [String: HeldBesLog]()
@@ -2636,25 +2619,13 @@ class MentraLive: NSObject, SGCManager {
2636
2619
  ]
2637
2620
 
2638
2621
  // Always generate BLE ID for potential fallback
2639
- let bleImgId = nextBleImgId()
2622
+ let bleImgId =
2623
+ "I" + String(format: "%09d", Int(Date().timeIntervalSince1970 * 1000) % 100_000_000)
2640
2624
  json["bleImgId"] = bleImgId
2641
2625
  json["transferMethod"] = request.localFile ? "ble" : request.transferMethod
2642
2626
  if request.presendThumbnail { json["presend_thumbnail"] = true }
2643
- if request.holdsPhoto {
2644
- json["deliver"] = PhotoRequest.deliverThumbnail
2645
- }
2646
2627
 
2647
- if request.holdsPhoto {
2648
- // Only the preview crosses now; it finds this request by its "T" ID.
2649
- var transfer = BlePhotoTransfer(
2650
- bleImgId: bleImgId, requestId: request.requestId, webhookUrl: ""
2651
- )
2652
- transfer.held = true
2653
- blePhotoTransfers[bleImgId] = transfer
2654
- if let webhookUrl = request.webhookUrl, !webhookUrl.isEmpty {
2655
- json["webhookUrl"] = webhookUrl
2656
- }
2657
- } else if request.localFile {
2628
+ if request.localFile {
2658
2629
  var transfer = BlePhotoTransfer(
2659
2630
  bleImgId: bleImgId, requestId: request.requestId, webhookUrl: ""
2660
2631
  )
@@ -2712,35 +2683,6 @@ class MentraLive: NSObject, SGCManager {
2712
2683
  sendJson(json, wakeUp: true)
2713
2684
  }
2714
2685
 
2715
- /// Send a held photo's full size over Bluetooth, through the ordinary BLE photo transfer for
2716
- /// its request: saved on the phone (`localFile`) or uploaded to `webhookUrl`, then the usual
2717
- /// terminal `photo_response` for `requestId`.
2718
- func fetchHeldPhoto(requestId: String, localFile: Bool, webhookUrl: String?, authToken: String?) {
2719
- let bleImgId = nextBleImgId()
2720
- var transfer = BlePhotoTransfer(
2721
- bleImgId: bleImgId, requestId: requestId, webhookUrl: localFile ? "" : webhookUrl ?? ""
2722
- )
2723
- transfer.localFile = localFile
2724
- transfer.authToken = authToken
2725
- blePhotoTransfers[bleImgId] = transfer
2726
- Bridge.log("LIVE: Fetching held photo \(requestId) as \(bleImgId)")
2727
- sendJson(
2728
- ["type": "fetch_photo", "requestId": requestId, "bleImgId": bleImgId],
2729
- wakeUp: true
2730
- )
2731
- }
2732
-
2733
- /// Delete held photos on the glasses: these, or all of them when `requestIds` is nil.
2734
- func releaseHeldPhotos(requestIds: [String]?) {
2735
- var json: [String: Any] = ["type": "release_photos"]
2736
- if let requestIds {
2737
- json["requestIds"] = requestIds
2738
- } else {
2739
- json["all"] = true
2740
- }
2741
- sendJson(json, wakeUp: true)
2742
- }
2743
-
2744
2686
  func warmUpCamera(
2745
2687
  requestId: String,
2746
2688
  size: PhotoSize,
@@ -3688,15 +3630,6 @@ class MentraLive: NSObject, SGCManager {
3688
3630
  emitCameraStatus(json)
3689
3631
 
3690
3632
  case "photo_response":
3691
- var json = json
3692
- if json["fetch"] as? Bool != true {
3693
- // A held photo's request ended (or failed): no full photo follows its preview.
3694
- let requestId = json["requestId"] as? String ?? ""
3695
- blePhotoTransfers = blePhotoTransfers.filter { !($0.value.held && $0.value.requestId == requestId) }
3696
- let preview = heldPreviews.removeValue(forKey: requestId)
3697
- let photoSuccess = json["state"] as? String == "success" || json["success"] as? Bool == true
3698
- if photoSuccess, let preview { json["thumbnailUrl"] = preview }
3699
- }
3700
3633
  emitPhotoResponse(json)
3701
3634
 
3702
3635
  case "gallery_status":
@@ -4064,9 +3997,6 @@ class MentraLive: NSObject, SGCManager {
4064
3997
  if let systemTimeMs = fields["system_time_ms"] as? NSNumber {
4065
3998
  DeviceStore.shared.apply("glasses", "systemTimeMs", systemTimeMs.int64Value)
4066
3999
  }
4067
- if let heldPhotosVersion = fields["held_photos"] as? NSNumber {
4068
- DeviceStore.shared.apply("glasses", "heldPhotosVersion", heldPhotosVersion.intValue)
4069
- }
4070
4000
  if let hotspotOtaVersion = fields["hotspot_ota_version"] as? NSNumber {
4071
4001
  DeviceStore.shared.apply(
4072
4002
  "glasses",
@@ -5253,12 +5183,9 @@ class MentraLive: NSObject, SGCManager {
5253
5183
  let requestId = json["requestId"] as? String ?? ""
5254
5184
  let compressionDurationMs = json["compressionDurationMs"] as? Int64 ?? 0
5255
5185
  if json["thumbnail"] as? Bool == true, !bleImgId.isEmpty, !requestId.isEmpty {
5256
- let parent = blePhotoTransfers.values.first(where: {
5186
+ guard blePhotoTransfers.values.contains(where: {
5257
5187
  !$0.isThumbnail && $0.requestId == requestId && bleImgId == "T" + $0.bleImgId.dropFirst()
5258
- })
5259
- // A held preview names itself: after a reconnect this connection has no parent.
5260
- let held = json["held"] as? Bool == true || parent?.held == true
5261
- if parent == nil && !held {
5188
+ }) else {
5262
5189
  Bridge.log("LIVE: Ignoring thumbnail for an unknown photo request")
5263
5190
  return
5264
5191
  }
@@ -5266,7 +5193,6 @@ class MentraLive: NSObject, SGCManager {
5266
5193
  if blePhotoTransfers[bleImgId] == nil {
5267
5194
  var transfer = BlePhotoTransfer(bleImgId: bleImgId, requestId: requestId, webhookUrl: "")
5268
5195
  transfer.isThumbnail = true
5269
- transfer.held = held
5270
5196
  blePhotoTransfers[bleImgId] = transfer
5271
5197
  }
5272
5198
  }
@@ -6005,15 +5931,12 @@ class MentraLive: NSObject, SGCManager {
6005
5931
 
6006
5932
  private func processAndUploadBlePhoto(_ transfer: BlePhotoTransfer, imageData: Data) {
6007
5933
  if transfer.isThumbnail {
6008
- let thumbnailUrl = "data:image/jpeg;base64," + imageData.base64EncodedString()
6009
- // The held request's terminal response follows this preview's acknowledgement.
6010
- if transfer.held { heldPreviews[transfer.requestId] = thumbnailUrl }
6011
5934
  Bridge.sendPhotoStatus([
6012
5935
  "type": "photo_status",
6013
5936
  "requestId": transfer.requestId,
6014
5937
  "status": "thumbnail_received",
6015
5938
  "timestamp": Int64(Date().timeIntervalSince1970 * 1000),
6016
- "thumbnailUrl": thumbnailUrl,
5939
+ "thumbnailUrl": "data:image/jpeg;base64," + imageData.base64EncodedString(),
6017
5940
  "fileSizeBytes": imageData.count,
6018
5941
  ])
6019
5942
  return
@@ -81,11 +81,6 @@ struct MentraLiveFileTransferSession {
81
81
  if receivedPackets.isEmpty && actualPackSize == 0 && !data.isEmpty {
82
82
  recalculateTotalPackets(actualPackSize: data.count)
83
83
  }
84
- // The first packet seen can be the file's short last one (the ones before it lost on a
85
- // link still settling after a reconnect): a larger packet gives the real pack size.
86
- if actualPackSize > 0 && data.count > actualPackSize {
87
- recalculateTotalPackets(actualPackSize: data.count)
88
- }
89
84
 
90
85
  guard index < totalPackets else { return false }
91
86
  if dynamicPayload {
@@ -231,11 +231,6 @@ struct GlassesStatus: CustomStringConvertible {
231
231
  intValue(values["hotspotOtaVersion"]) ?? 0
232
232
  }
233
233
 
234
- /// Held photos (take_photo deliver "thumbnail"): the glasses' version, 0 without.
235
- var heldPhotosVersion: Int {
236
- intValue(values["heldPhotosVersion"]) ?? 0
237
- }
238
-
239
234
  var bluetoothName: String {
240
235
  stringValue(values, "bluetoothName") ?? ""
241
236
  }
@@ -791,10 +786,6 @@ struct GlassesStatusUpdate: CustomStringConvertible {
791
786
  optionalIntValue(values, "hotspotOtaVersion")
792
787
  }
793
788
 
794
- var heldPhotosVersion: Int? {
795
- optionalIntValue(values, "heldPhotosVersion")
796
- }
797
-
798
789
  var bluetoothName: String? {
799
790
  optionalStringValue(values, "bluetoothName")
800
791
  }
@@ -24,7 +24,6 @@ final class PhotoRequestRoutingTests: XCTestCase {
24
24
  "ispAnalogGain": "4x",
25
25
  "presend_thumbnail": true,
26
26
  "localFile": true,
27
- "deliver": "thumbnail",
28
27
  ]
29
28
 
30
29
  private func assertSameCapture(_ routed: PhotoRequest, _ request: PhotoRequest, line: UInt = #line) {
@@ -46,7 +45,6 @@ final class PhotoRequestRoutingTests: XCTestCase {
46
45
  XCTAssertEqual(routed.ispAnalogGain, request.ispAnalogGain, line: line)
47
46
  XCTAssertEqual(routed.presendThumbnail, request.presendThumbnail, line: line)
48
47
  XCTAssertEqual(routed.localFile, request.localFile, line: line)
49
- XCTAssertEqual(routed.deliver, request.deliver, line: line)
50
48
  }
51
49
 
52
50
  /// The glasses were never asked for a thumbnail on iOS: routing rebuilt the request without the flag.
@@ -89,33 +87,4 @@ final class PhotoRequestRoutingTests: XCTestCase {
89
87
  XCTAssertEqual(manual.exposureTimeNs, 8_000_000)
90
88
  XCTAssertNil(manual.iso)
91
89
  }
92
-
93
- func testHeldPhotoOptionsAreParsedAndOnlyKnownValuesKept() throws {
94
- let held = try PhotoRequest.from(params: ["deliver": "thumbnail"])
95
- XCTAssertTrue(held.holdsPhoto)
96
-
97
- let whole = try PhotoRequest.from(params: ["deliver": "full"])
98
- XCTAssertNil(whole.deliver)
99
- XCTAssertFalse(whole.holdsPhoto)
100
- }
101
-
102
- func testHeldPhotoResponseKeepsItsMetadata() {
103
- let event = PhotoResponseEvent(values: [
104
- "requestId": "photo-1",
105
- "success": true,
106
- "held": true,
107
- "thumbnailUrl": "data:image/jpeg;base64,AA==",
108
- "capturedAt": 1_700_000_000_000,
109
- "bytes": 1234,
110
- ])
111
- XCTAssertEqual(event.values["held"] as? Bool, true)
112
- XCTAssertEqual(event.values["thumbnailUrl"] as? String, "data:image/jpeg;base64,AA==")
113
- XCTAssertEqual(event.values["capturedAt"] as? Int, 1_700_000_000_000)
114
- XCTAssertEqual(event.values["fileSizeBytes"] as? Int, 1234)
115
-
116
- let whole = PhotoResponseEvent(values: ["requestId": "photo-2", "success": true])
117
- XCTAssertNil(whole.values["held"])
118
- XCTAssertNil(whole.values["thumbnailUrl"])
119
- XCTAssertNil(whole.values["capturedAt"])
120
- }
121
90
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mentra/bluetooth-sdk",
3
- "version": "3.5.0-dev.1506",
3
+ "version": "3.5.0-dev.1508",
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.1506"
118
+ "@mentra/cloud-protocol": "3.5.0-dev.1508"
119
119
  },
120
120
  "devDependencies": {
121
121
  "@types/node": "^25.9.3",
@@ -237,34 +237,6 @@ export type HotspotStatusChangeEvent = HotspotStatus & {
237
237
  type: "hotspot_status_change"
238
238
  }
239
239
 
240
- /**
241
- * The fast photo link: Wi-Fi Direct between an Android phone and Mentra Live. While it is
242
- * `open`, photos travel over it; otherwise over Bluetooth. `unavailable` carries a `reason`,
243
- * such as `glasses_unsupported`, `permission` (NEARBY_WIFI_DEVICES, or location before Android 13), `wifi_off`,
244
- * `glasses_not_connected`, `join_timeout` or a `glasses_...` error.
245
- */
246
- export type FastLinkState = "closed" | "opening" | "open" | "unavailable"
247
-
248
- export type FastLinkStatus = {
249
- state: FastLinkState
250
- link: "wifi_direct"
251
- /**
252
- * Whether the connected glasses can hold a Wi-Fi Direct group (they advertise
253
- * `wifi_direct_version`). Without it, use the glasses hotspot.
254
- */
255
- glassesSupported: boolean
256
- reason?: string
257
- /** How long the link took to open, from the request. */
258
- openedAfterMs?: number
259
- }
260
-
261
- export type FastLinkStatusEvent = FastLinkStatus & {
262
- type: "fast_link_status"
263
- }
264
-
265
- /** How a photo reached the phone. */
266
- export type PhotoTransport = "ble" | "wifi_direct" | "hotspot"
267
-
268
240
  export type HotspotErrorEvent = {
269
241
  type: "hotspot_error"
270
242
  errorMessage: string
@@ -325,18 +297,6 @@ export type PhotoResponseEvent =
325
297
  contentType?: string
326
298
  fileSizeBytes?: number
327
299
  timestamp: number
328
- /** How the photo reached the phone (Android `localFile` requests). */
329
- transport?: PhotoTransport
330
- /** Its last hop: the fetch over a fast link, or the Bluetooth packets. */
331
- transferMs?: number
332
- /** From the phone's request to the saved file. */
333
- totalMs?: number
334
- /** The glasses hold the full photo: a `deliver: "thumbnail"` request. */
335
- held?: boolean
336
- /** A held photo's preview (≤500 px JPEG), as a `data:image/jpeg;base64,` URI. */
337
- thumbnailUrl?: string
338
- /** When the glasses captured the held photo, in ms since the epoch. */
339
- capturedAt?: number
340
300
  }
341
301
  | {
342
302
  type: "photo_response"
@@ -837,26 +797,7 @@ type NativeCameraFovSetting = {
837
797
  export type MicPreference = "auto" | "phone" | "glasses" | "bluetooth"
838
798
  export type MicMode = "phone" | "glasses" | "bluetoothClassic" | "bluetooth"
839
799
 
840
- /** Fetch a held photo's full size: see {@link BluetoothSdkPublicModule.fetchHeldPhoto}. */
841
- export type FetchHeldPhotoParams = {
842
- /** The `requestId` of the `deliver: "thumbnail"` request that took it. */
843
- requestId: string
844
- /** Save it as a file on the phone (default true); otherwise upload it to `webhookUrl`. */
845
- localFile?: boolean
846
- webhookUrl?: string
847
- authToken?: string
848
- }
849
-
850
800
  export type PhotoRequestParams = {
851
- /**
852
- * `"thumbnail"`: the glasses hold the full photo and send only its preview, and the request
853
- * resolves once the preview arrived, with `held: true` and `thumbnailUrl`. The camera is free
854
- * for the next request as soon as the capture is written. Fetch the full photo with
855
- * `fetchHeldPhoto` and delete the rest with `releaseHeldPhotos`; the glasses delete held photos
856
- * 30 minutes after capture. Needs `heldPhotosVersion > 0` in the glasses status. A preview that
857
- * fails rejects with `PREVIEW_FAILED`, and the photo is still held.
858
- */
859
- deliver?: "thumbnail"
860
801
  /**
861
802
  * Send an oriented <=500px, quality-50 JPEG preview before the full photo. Default false.
862
803
  * Enables a 110-second end-to-end native deadline (ordinary requests: 30 seconds).
@@ -1383,7 +1324,6 @@ export type BluetoothSdkModuleEvents = {
1383
1324
  saved_wifi_networks: (event: SavedWifiNetworksEvent) => void
1384
1325
  hotspot_status_change: (event: HotspotStatusChangeEvent) => void
1385
1326
  hotspot_error: (event: HotspotErrorEvent) => void
1386
- fast_link_status: (event: FastLinkStatusEvent) => void
1387
1327
  photo_response: (event: PhotoResponseEvent) => void
1388
1328
  photo_status: (event: PhotoStatusEvent) => void
1389
1329
  camera_status: (event: CameraStatusEvent) => void
@@ -1557,7 +1497,6 @@ export type BluetoothSdkEventMap = {
1557
1497
  saved_wifi_networks: SavedWifiNetworksEvent
1558
1498
  hotspot_status_change: HotspotStatusChangeEvent
1559
1499
  hotspot_error: HotspotErrorEvent
1560
- fast_link_status: FastLinkStatusEvent
1561
1500
  photo_response: PhotoResponseEvent
1562
1501
  photo_status: PhotoStatusEvent
1563
1502
  camera_status: CameraStatusEvent
@@ -1666,15 +1605,6 @@ export interface BluetoothSdkPublicModule {
1666
1605
  /** Forget a saved network and return its correlated semantic outcome. */
1667
1606
  forgetWifiNetwork(ssid: string): Promise<WifiForgetResult>
1668
1607
  setHotspotState(enabled: boolean): Promise<HotspotStatusChangeEvent>
1669
- /**
1670
- * Open the fast photo link (Wi-Fi Direct to Mentra Live, Android only). Returns the state now;
1671
- * `fast_link_status` reports each change. Photos use the link while it is open, and Bluetooth
1672
- * otherwise, with no change to `requestPhoto`. Needs NEARBY_WIFI_DEVICES on Android 13+.
1673
- */
1674
- openFastLink(): FastLinkStatus
1675
- /** Close the fast photo link; photos go over Bluetooth again. */
1676
- closeFastLink(): void
1677
- getFastLinkStatus(): FastLinkStatus
1678
1608
  /** Set the glasses clock from the phone after an OTA clock-skew failure. */
1679
1609
  setSystemTime(timestampMs: number): Promise<void>
1680
1610
  /** Enable or disable Wi-Fi ADB on Mentra Live (no-op on other devices). */
@@ -1723,14 +1653,6 @@ export interface BluetoothSdkPublicModule {
1723
1653
  setCameraTuningConfig(anrOn: boolean, gainOn: boolean): Promise<SettingsAckSuccessEvent>
1724
1654
  queryGalleryStatus(): Promise<GalleryStatusEvent>
1725
1655
  requestPhoto(params: PhotoRequestParams): Promise<PhotoSuccessResponseEvent>
1726
- /**
1727
- * Fetch the full size of a photo the glasses hold (`deliver: "thumbnail"`), over Bluetooth.
1728
- * Resolves like `requestPhoto`: with the file's `file://` URI as `photoUrl`, or once uploaded.
1729
- * The glasses keep the photo, so a failed fetch can be retried.
1730
- */
1731
- fetchHeldPhoto(params: FetchHeldPhotoParams): Promise<PhotoSuccessResponseEvent>
1732
- /** Delete held photos on the glasses: these request IDs, or all of them when omitted. */
1733
- releaseHeldPhotos(requestIds?: string[] | null): Promise<void>
1734
1656
  warmUpCamera(params: WarmUpCameraParams): Promise<CameraStatusEvent>
1735
1657
  /** Release one request-owned warm-up. Opening requests reject with camera_warm_up_cancelled. */
1736
1658
  stopCameraWarmUp(requestId: string): Promise<void>
@@ -1953,8 +1875,6 @@ export interface GlassesStatus {
1953
1875
  packageName: string
1954
1876
  /** Phone-served hotspot OTA protocol version; 0 means unsupported/legacy glasses. */
1955
1877
  hotspotOtaVersion: number
1956
- /** Held photos (`requestPhoto` with `deliver: "thumbnail"`); 0 means the glasses can't hold photos. */
1957
- heldPhotosVersion?: number
1958
1878
  bluetoothName: string
1959
1879
  serialNumber: string
1960
1880
  style: string
@@ -37,7 +37,6 @@ import {
37
37
  ObservableStoreCategory,
38
38
  OtaQueryResult,
39
39
  OtaStartAckEvent,
40
- FetchHeldPhotoParams,
41
40
  PhotoRequestParams,
42
41
  PhotoSuccessResponseEvent,
43
42
  PublicBluetoothStatus,
@@ -212,8 +211,6 @@ declare class BluetoothSdkNativeModule extends NativeModule<BluetoothSdkModuleEv
212
211
  setCameraTuningConfig(anrOn: boolean, gainOn: boolean): Promise<SettingsAckSuccessEvent>
213
212
  queryGalleryStatus(): Promise<GalleryStatusEvent>
214
213
  requestPhoto(params: PhotoRequestParams): Promise<PhotoSuccessResponseEvent>
215
- fetchHeldPhoto(params: FetchHeldPhotoParams): Promise<PhotoSuccessResponseEvent>
216
- releaseHeldPhotos(requestIds?: string[] | null): Promise<void>
217
214
  warmUpCamera(params: WarmUpCameraParams): Promise<CameraStatusEvent>
218
215
  stopCameraWarmUp(requestId: string): Promise<void>
219
216
 
@@ -766,25 +763,6 @@ NativeBluetoothSdkModule.requestPhoto = function (params: PhotoRequestParams) {
766
763
  return nativeRequestPhoto(photoRequestParamsForNative(params) as unknown as PhotoRequestParams)
767
764
  }
768
765
 
769
- const nativeFetchHeldPhoto = bindNativeMethod<(params: Record<string, string | boolean>) => Promise<PhotoSuccessResponseEvent>>(
770
- NativeBluetoothSdkModule as unknown as Record<string, unknown>,
771
- "fetchHeldPhoto",
772
- )
773
- NativeBluetoothSdkModule.fetchHeldPhoto = function (params: FetchHeldPhotoParams) {
774
- // Expo's Android bridge rejects nulls in a map: send only what is set.
775
- const payload: Record<string, string | boolean> = {requestId: params.requestId, localFile: params.localFile ?? true}
776
- if (params.webhookUrl) payload.webhookUrl = params.webhookUrl
777
- if (params.authToken) payload.authToken = params.authToken
778
- return nativeFetchHeldPhoto(payload)
779
- }
780
- const nativeReleaseHeldPhotos = bindNativeMethod<(requestIds: string[] | null) => Promise<void>>(
781
- NativeBluetoothSdkModule as unknown as Record<string, unknown>,
782
- "releaseHeldPhotos",
783
- )
784
- NativeBluetoothSdkModule.releaseHeldPhotos = function (requestIds?: string[] | null) {
785
- return nativeReleaseHeldPhotos(requestIds ?? null)
786
- }
787
-
788
766
  const nativeWarmUpCamera = NativeBluetoothSdkModule.warmUpCamera.bind(NativeBluetoothSdkModule)
789
767
  NativeBluetoothSdkModule.warmUpCamera = function (params: WarmUpCameraParams) {
790
768
  return nativeWarmUpCamera(warmUpCameraParamsForNative(params) as unknown as WarmUpCameraParams)
@@ -52,9 +52,6 @@ export function photoRequestParamsForNative(params: PhotoRequestParams): Record<
52
52
  if (params.localFile === true) {
53
53
  payload.localFile = true
54
54
  }
55
- if (params.deliver === "thumbnail") {
56
- payload.deliver = "thumbnail"
57
- }
58
55
  if (requestId != null) {
59
56
  payload.requestId = requestId
60
57
  }