@mentra/bluetooth-sdk 0.1.14 → 0.1.17
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/README.md +4 -6
- package/android/src/main/java/com/mentra/bluetoothsdk/BluetoothSdkModule.kt +22 -9
- package/android/src/main/java/com/mentra/bluetoothsdk/Bridge.kt +5 -20
- package/android/src/main/java/com/mentra/bluetoothsdk/DeviceManager.kt +358 -261
- package/android/src/main/java/com/mentra/bluetoothsdk/DeviceStore.kt +3 -3
- package/android/src/main/java/com/mentra/bluetoothsdk/MentraBluetoothSdk.kt +133 -52
- package/android/src/main/java/com/mentra/bluetoothsdk/OtaManifest.kt +12 -12
- package/android/src/main/java/com/mentra/bluetoothsdk/camera/CameraModels.kt +22 -6
- package/android/src/main/java/com/mentra/bluetoothsdk/events/BluetoothEvents.kt +1 -22
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/G1.kt +50 -3
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/G2.kt +1184 -795
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLive.kt +422 -78
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraNex.kt +3 -4
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/Nimo.kt +2532 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/SGCManager.kt +15 -1
- package/android/src/main/java/com/mentra/bluetoothsdk/types/DeviceModels.kt +5 -3
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/Constants.kt +2 -1
- package/android/src/test/java/com/mentra/bluetoothsdk/camera/PhotoRequestTest.kt +60 -1
- package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/NimoProtocolTest.kt +333 -0
- package/build/BluetoothSdk.types.d.ts +39 -14
- package/build/BluetoothSdk.types.d.ts.map +1 -1
- package/build/BluetoothSdk.types.js +1 -0
- package/build/BluetoothSdk.types.js.map +1 -1
- package/build/_internal.d.ts +4 -4
- package/build/_internal.js +4 -4
- package/build/_internal.js.map +1 -1
- package/build/_private/BluetoothSdkModule.d.ts +11 -3
- package/build/_private/BluetoothSdkModule.d.ts.map +1 -1
- package/build/_private/BluetoothSdkModule.js +5 -0
- package/build/_private/BluetoothSdkModule.js.map +1 -1
- package/build/_private/cameraRequestPayload.d.ts +4 -0
- package/build/_private/cameraRequestPayload.d.ts.map +1 -0
- package/build/_private/cameraRequestPayload.js +25 -0
- package/build/_private/cameraRequestPayload.js.map +1 -0
- package/build/_private/photoRequestPayload.d.ts.map +1 -1
- package/build/_private/photoRequestPayload.js +8 -2
- package/build/_private/photoRequestPayload.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +72 -54
- package/build/index.js.map +1 -1
- package/ios/BluetoothSdkModule.swift +40 -12
- package/ios/Source/BluetoothSdkDefaults.swift +2 -30
- package/ios/Source/Bridge.swift +4 -16
- package/ios/Source/DeviceManager.swift +72 -12
- package/ios/Source/MentraBluetoothSDK.swift +120 -50
- package/ios/Source/OtaManifest.swift +13 -13
- package/ios/Source/camera/CameraModels.swift +75 -9
- package/ios/Source/errors/{BluetoothError.swift → BluetoothSdkError.swift} +1 -1
- package/ios/Source/events/BluetoothEvents.swift +5 -27
- package/ios/Source/internal/BluetoothAvailability.swift +5 -5
- package/ios/Source/sgcs/G1.swift +51 -1
- package/ios/Source/sgcs/G2.swift +643 -203
- package/ios/Source/sgcs/MentraLive.swift +53 -39
- package/ios/Source/sgcs/Nimo.swift +1928 -0
- package/ios/Source/sgcs/SGCManager.swift +12 -5
- package/ios/Source/stt/STTTools.swift +1 -1
- package/ios/Source/types/DeviceModels.swift +5 -0
- package/ios/Source/utils/Constants.swift +2 -0
- package/package.json +9 -1
- package/scripts/inject-ios-sdk-version.mjs +65 -0
- package/src/BluetoothSdk.types.ts +42 -17
- package/src/_internal.ts +4 -4
- package/src/_private/BluetoothSdkModule.ts +18 -2
- package/src/_private/cameraRequestPayload.ts +29 -0
- package/src/_private/photoRequestPayload.ts +9 -2
- package/src/index.ts +76 -58
|
@@ -1616,13 +1616,12 @@ class MentraLive: NSObject, SGCManager {
|
|
|
1616
1616
|
|
|
1617
1617
|
func requestPhoto(_ request: PhotoRequest) {
|
|
1618
1618
|
Bridge.log(
|
|
1619
|
-
"LIVE: PHOTO PIPELINE [5/6] requestPhoto() entry requestId=\(request.requestId)
|
|
1619
|
+
"LIVE: PHOTO PIPELINE [5/6] requestPhoto() entry requestId=\(request.requestId) save=\(request.save) sound=\(request.sound) iso=\(request.iso.map { String($0) } ?? "auto") aeDivisor=\(request.aeExposureDivisor.map { String($0) } ?? "nil")"
|
|
1620
1620
|
)
|
|
1621
1621
|
|
|
1622
1622
|
var json: [String: Any] = [
|
|
1623
1623
|
"type": "take_photo",
|
|
1624
1624
|
"requestId": request.requestId,
|
|
1625
|
-
"appId": request.appId,
|
|
1626
1625
|
]
|
|
1627
1626
|
|
|
1628
1627
|
// Always generate BLE ID for potential fallback
|
|
@@ -1675,6 +1674,32 @@ class MentraLive: NSObject, SGCManager {
|
|
|
1675
1674
|
sendJson(json, wakeUp: true)
|
|
1676
1675
|
}
|
|
1677
1676
|
|
|
1677
|
+
func warmUpCamera(
|
|
1678
|
+
requestId: String,
|
|
1679
|
+
size: PhotoSize,
|
|
1680
|
+
exposureTimeNs: Double?,
|
|
1681
|
+
durationMs: Int
|
|
1682
|
+
) {
|
|
1683
|
+
Bridge.log(
|
|
1684
|
+
"LIVE: warmUpCamera() entry requestId=\(requestId) size=\(size.rawValue) durationMs=\(durationMs)"
|
|
1685
|
+
)
|
|
1686
|
+
|
|
1687
|
+
let allowedSizes = ["low", "medium", "high", "max"]
|
|
1688
|
+
let sizeRaw = size.rawValue
|
|
1689
|
+
var json: [String: Any] = [
|
|
1690
|
+
"type": "camera_warm_up",
|
|
1691
|
+
"requestId": requestId,
|
|
1692
|
+
"size": allowedSizes.contains(sizeRaw) ? sizeRaw : "medium",
|
|
1693
|
+
"durationMs": durationMs > 0 ? durationMs : 15000,
|
|
1694
|
+
]
|
|
1695
|
+
|
|
1696
|
+
if let e = exposureTimeNs, e.isFinite, e > 0, e <= Double(Int64.max) {
|
|
1697
|
+
json["exposureTimeNs"] = Int64(e)
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
sendJson(json, wakeUp: true)
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1678
1703
|
func startStream(_ message: [String: Any]) {
|
|
1679
1704
|
Bridge.log("Starting stream")
|
|
1680
1705
|
var json = message
|
|
@@ -2172,6 +2197,9 @@ class MentraLive: NSObject, SGCManager {
|
|
|
2172
2197
|
case "photo_status":
|
|
2173
2198
|
emitPhotoStatus(json)
|
|
2174
2199
|
|
|
2200
|
+
case "camera_status":
|
|
2201
|
+
emitCameraStatus(json)
|
|
2202
|
+
|
|
2175
2203
|
case "photo_response":
|
|
2176
2204
|
emitPhotoResponse(json)
|
|
2177
2205
|
|
|
@@ -2283,32 +2311,6 @@ class MentraLive: NSObject, SGCManager {
|
|
|
2283
2311
|
// Send to React Native via Bridge
|
|
2284
2312
|
Bridge.sendMtkUpdateComplete(message: updateMessage, timestamp: timestamp)
|
|
2285
2313
|
|
|
2286
|
-
case "ota_update_available":
|
|
2287
|
-
// Process OTA update available notification from glasses (background mode)
|
|
2288
|
-
Bridge.log("📱 Received ota_update_available from glasses")
|
|
2289
|
-
|
|
2290
|
-
let versionCode = json["version_code"] as? Int64 ?? 0
|
|
2291
|
-
let versionName = json["version_name"] as? String ?? ""
|
|
2292
|
-
let totalSize = json["total_size"] as? Int64 ?? 0
|
|
2293
|
-
|
|
2294
|
-
// Parse updates array
|
|
2295
|
-
var updates: [String] = []
|
|
2296
|
-
if let updatesArray = json["updates"] as? [String] {
|
|
2297
|
-
updates = updatesArray
|
|
2298
|
-
}
|
|
2299
|
-
|
|
2300
|
-
Bridge.log(
|
|
2301
|
-
"📱 OTA available - version: \(versionName) (\(versionCode)), updates: \(updates), size: \(totalSize) bytes"
|
|
2302
|
-
)
|
|
2303
|
-
|
|
2304
|
-
// Send to React Native
|
|
2305
|
-
Bridge.sendOtaUpdateAvailable(
|
|
2306
|
-
versionCode: versionCode,
|
|
2307
|
-
versionName: versionName,
|
|
2308
|
-
updates: updates,
|
|
2309
|
-
totalSize: totalSize
|
|
2310
|
-
)
|
|
2311
|
-
|
|
2312
2314
|
case "ota_start_ack":
|
|
2313
2315
|
// Glasses acknowledged receipt of ota_start — phone can cancel its retry timer
|
|
2314
2316
|
Bridge.log("LIVE: 📱 Received ota_start_ack from glasses")
|
|
@@ -2904,17 +2906,6 @@ class MentraLive: NSObject, SGCManager {
|
|
|
2904
2906
|
sendJson(json, wakeUp: true)
|
|
2905
2907
|
}
|
|
2906
2908
|
|
|
2907
|
-
func sendOtaRetryVersionCheck() {
|
|
2908
|
-
Bridge.log("LIVE: ⏰ Sending ota_retry_version_check command to glasses")
|
|
2909
|
-
|
|
2910
|
-
let json: [String: Any] = [
|
|
2911
|
-
"type": "ota_retry_version_check",
|
|
2912
|
-
"timestamp": Int(Date().timeIntervalSince1970 * 1000),
|
|
2913
|
-
]
|
|
2914
|
-
|
|
2915
|
-
sendJson(json, wakeUp: true)
|
|
2916
|
-
}
|
|
2917
|
-
|
|
2918
2909
|
func keepAwake() {
|
|
2919
2910
|
Bridge.log("LIVE: 📱 Sending keep_awake command to glasses")
|
|
2920
2911
|
|
|
@@ -4346,6 +4337,10 @@ class MentraLive: NSObject, SGCManager {
|
|
|
4346
4337
|
Bridge.sendPhotoStatus(json)
|
|
4347
4338
|
}
|
|
4348
4339
|
|
|
4340
|
+
private func emitCameraStatus(_ json: [String: Any]) {
|
|
4341
|
+
Bridge.sendCameraStatus(json)
|
|
4342
|
+
}
|
|
4343
|
+
|
|
4349
4344
|
private func emitPhotoResponse(_ json: [String: Any]) {
|
|
4350
4345
|
Bridge.sendPhotoResponse(json)
|
|
4351
4346
|
}
|
|
@@ -5341,6 +5336,25 @@ extension MentraLive {
|
|
|
5341
5336
|
sendJson(json, wakeUp: true)
|
|
5342
5337
|
}
|
|
5343
5338
|
|
|
5339
|
+
func sendCameraTuningConfig(requestId: String?, anrOn: Bool, gainOn: Bool) {
|
|
5340
|
+
Bridge.log("Sending camera tuning config: anr=\(anrOn), gain=\(gainOn)")
|
|
5341
|
+
|
|
5342
|
+
guard connectionState == ConnTypes.CONNECTED else {
|
|
5343
|
+
Bridge.log("Cannot send camera tuning config - not connected")
|
|
5344
|
+
return
|
|
5345
|
+
}
|
|
5346
|
+
|
|
5347
|
+
var json: [String: Any] = [
|
|
5348
|
+
"type": "camera_tuning_config",
|
|
5349
|
+
"anr": anrOn,
|
|
5350
|
+
"gain": gainOn,
|
|
5351
|
+
]
|
|
5352
|
+
if let requestId, !requestId.isEmpty {
|
|
5353
|
+
json["request_id"] = requestId
|
|
5354
|
+
}
|
|
5355
|
+
sendJson(json, wakeUp: true)
|
|
5356
|
+
}
|
|
5357
|
+
|
|
5344
5358
|
func startVideoRecording(requestId: String, save: Bool, sound: Bool) {
|
|
5345
5359
|
startVideoRecording(
|
|
5346
5360
|
requestId: requestId, save: save, sound: sound, width: 0, height: 0, fps: 0,
|