@mentra/bluetooth-sdk 0.1.13 → 0.1.14
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 +15 -3
- package/android/src/main/java/com/mentra/bluetoothsdk/BluetoothSdkModule.kt +27 -40
- package/android/src/main/java/com/mentra/bluetoothsdk/DeviceManager.kt +7 -13
- package/android/src/main/java/com/mentra/bluetoothsdk/DeviceStore.kt +0 -4
- package/android/src/main/java/com/mentra/bluetoothsdk/MentraBluetoothSdk.kt +19 -20
- package/android/src/main/java/com/mentra/bluetoothsdk/camera/CameraModels.kt +3 -5
- package/android/src/main/java/com/mentra/bluetoothsdk/controllers/ControllerManager.kt +1 -2
- package/android/src/main/java/com/mentra/bluetoothsdk/controllers/R1.kt +1 -2
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/G1.kt +1 -5
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/G2.kt +0 -5
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/Mach1.kt +1 -5
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLive.kt +1 -39
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraNex.kt +1 -2
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/SGCManager.kt +2 -4
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/Simulated.kt +3 -7
- package/android/src/main/java/com/mentra/bluetoothsdk/status/DeviceStatus.kt +0 -6
- package/android/src/main/java/com/mentra/bluetoothsdk/streaming/StreamModels.kt +16 -33
- package/build/BluetoothSdk.types.d.ts +12 -11
- package/build/BluetoothSdk.types.d.ts.map +1 -1
- package/build/BluetoothSdk.types.js.map +1 -1
- package/build/_private/BluetoothSdkModule.d.ts +4 -6
- package/build/_private/BluetoothSdkModule.d.ts.map +1 -1
- package/build/_private/BluetoothSdkModule.js +0 -4
- package/build/_private/BluetoothSdkModule.js.map +1 -1
- package/build/_private/photoRequestPayload.d.ts.map +1 -1
- package/build/_private/photoRequestPayload.js +3 -1
- 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 +3 -12
- package/build/index.js.map +1 -1
- package/ios/BluetoothSdkModule.swift +11 -16
- package/ios/Source/DeviceManager.swift +5 -11
- package/ios/Source/DeviceStore.swift +0 -4
- package/ios/Source/MentraBluetoothSDK.swift +24 -28
- package/ios/Source/camera/CameraModels.swift +7 -11
- package/ios/Source/controllers/ControllerManager.swift +1 -2
- package/ios/Source/controllers/R1.swift +1 -2
- package/ios/Source/sgcs/Frame.swift +0 -2
- package/ios/Source/sgcs/G1.swift +1 -3
- package/ios/Source/sgcs/G2.swift +1 -2
- package/ios/Source/sgcs/Mach1.swift +1 -3
- package/ios/Source/sgcs/MentraLive.swift +12 -39
- package/ios/Source/sgcs/MentraNex.swift +1 -3
- package/ios/Source/sgcs/SGCManager.swift +4 -5
- package/ios/Source/sgcs/Simulated.swift +2 -6
- package/ios/Source/status/DeviceStatus.swift +0 -8
- package/ios/Source/streaming/StreamModels.swift +7 -32
- package/package.json +1 -1
- package/src/BluetoothSdk.types.ts +12 -11
- package/src/_private/BluetoothSdkModule.ts +4 -11
- package/src/_private/photoRequestPayload.ts +3 -1
- package/src/index.ts +7 -15
|
@@ -47,8 +47,8 @@ public enum PhotoCompression: String {
|
|
|
47
47
|
case heavy
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
public struct
|
|
51
|
-
public let size:
|
|
50
|
+
public struct PhotoCaptureDefaults {
|
|
51
|
+
public let size: PhotoSize?
|
|
52
52
|
public let mfnr: Bool?
|
|
53
53
|
public let zsl: Bool?
|
|
54
54
|
public let noiseReduction: Bool?
|
|
@@ -62,7 +62,7 @@ public struct ButtonPhotoSettings {
|
|
|
62
62
|
public let resetCaptureTuning: Bool?
|
|
63
63
|
|
|
64
64
|
public init(
|
|
65
|
-
size:
|
|
65
|
+
size: PhotoSize? = nil,
|
|
66
66
|
mfnr: Bool? = nil,
|
|
67
67
|
zsl: Bool? = nil,
|
|
68
68
|
noiseReduction: Bool? = nil,
|
|
@@ -89,12 +89,12 @@ public struct ButtonPhotoSettings {
|
|
|
89
89
|
self.resetCaptureTuning = resetCaptureTuning
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
static func from(params: [String: Any]) ->
|
|
93
|
-
let size = (params["size"] as? String).map {
|
|
92
|
+
static func from(params: [String: Any]) -> PhotoCaptureDefaults {
|
|
93
|
+
let size = (params["size"] as? String).map { PhotoSize(normalizedRawValue: $0) }
|
|
94
94
|
let aeExposureDivisor =
|
|
95
95
|
optionalIntValue(params, "aeExposureDivisor").flatMap { $0 > 1 ? $0 : nil }
|
|
96
96
|
let isoCap = optionalIntValue(params, "isoCap").flatMap { $0 > 0 ? $0 : nil }
|
|
97
|
-
return
|
|
97
|
+
return PhotoCaptureDefaults(
|
|
98
98
|
size: size,
|
|
99
99
|
mfnr: optionalBoolValue(params, "mfnr"),
|
|
100
100
|
zsl: optionalBoolValue(params, "zsl"),
|
|
@@ -111,7 +111,7 @@ public struct ButtonPhotoSettings {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
public struct
|
|
114
|
+
public struct VideoRecordingDefaults {
|
|
115
115
|
public let width: Int
|
|
116
116
|
public let height: Int
|
|
117
117
|
public let fps: Int
|
|
@@ -228,7 +228,6 @@ public struct PhotoRequest {
|
|
|
228
228
|
public let webhookUrl: String?
|
|
229
229
|
public let authToken: String?
|
|
230
230
|
public let compress: PhotoCompression?
|
|
231
|
-
public let flash: Bool
|
|
232
231
|
public let save: Bool
|
|
233
232
|
public let sound: Bool
|
|
234
233
|
/// Sensor exposure time for this capture only (ns), or nil for auto exposure
|
|
@@ -251,7 +250,6 @@ public struct PhotoRequest {
|
|
|
251
250
|
webhookUrl: String? = nil,
|
|
252
251
|
authToken: String? = nil,
|
|
253
252
|
compress: PhotoCompression? = nil,
|
|
254
|
-
flash: Bool = true,
|
|
255
253
|
save: Bool = false,
|
|
256
254
|
sound: Bool,
|
|
257
255
|
exposureTimeNs: Double? = nil,
|
|
@@ -271,7 +269,6 @@ public struct PhotoRequest {
|
|
|
271
269
|
self.webhookUrl = webhookUrl
|
|
272
270
|
self.authToken = authToken
|
|
273
271
|
self.compress = compress
|
|
274
|
-
self.flash = flash
|
|
275
272
|
self.save = save
|
|
276
273
|
self.sound = sound
|
|
277
274
|
self.exposureTimeNs = exposureTimeNs
|
|
@@ -340,7 +337,6 @@ public struct PhotoRequest {
|
|
|
340
337
|
webhookUrl: params["webhookUrl"] as? String,
|
|
341
338
|
authToken: (params["authToken"] as? String)?.nilIfBlank,
|
|
342
339
|
compress: PhotoCompression(rawValue: compressRaw),
|
|
343
|
-
flash: params["flash"] as? Bool ?? true,
|
|
344
340
|
save: (params["save"] as? Bool) ?? (params["saveToGallery"] as? Bool) ?? false,
|
|
345
341
|
sound: params["sound"] as? Bool ?? true,
|
|
346
342
|
exposureTimeNs: exposureTimeNs,
|
|
@@ -22,7 +22,7 @@ protocol ControllerManager {
|
|
|
22
22
|
func startStream(_ message: [String: Any])
|
|
23
23
|
func stopStream()
|
|
24
24
|
func sendStreamKeepAlive(_ message: [String: Any])
|
|
25
|
-
func startVideoRecording(requestId: String, save: Bool,
|
|
25
|
+
func startVideoRecording(requestId: String, save: Bool, sound: Bool)
|
|
26
26
|
func stopVideoRecording(requestId: String)
|
|
27
27
|
|
|
28
28
|
// MARK: - Button Settings
|
|
@@ -30,7 +30,6 @@ protocol ControllerManager {
|
|
|
30
30
|
func sendButtonPhotoSettings()
|
|
31
31
|
func sendButtonVideoRecordingSettings()
|
|
32
32
|
func sendButtonMaxRecordingTime()
|
|
33
|
-
func sendButtonCameraLedSetting()
|
|
34
33
|
|
|
35
34
|
// MARK: - Display Control
|
|
36
35
|
|
|
@@ -505,7 +505,7 @@ class R1: NSObject, ControllerManager {
|
|
|
505
505
|
|
|
506
506
|
func sendJson(_: [String: Any], wakeUp _: Bool, requireAck _: Bool) {}
|
|
507
507
|
func requestPhoto(_: PhotoRequest) {}
|
|
508
|
-
func startVideoRecording(requestId _: String, save _: Bool,
|
|
508
|
+
func startVideoRecording(requestId _: String, save _: Bool, sound _: Bool) {}
|
|
509
509
|
func stopVideoRecording(requestId _: String) {}
|
|
510
510
|
func startStream(_: [String: Any]) {}
|
|
511
511
|
func stopStream() {}
|
|
@@ -513,7 +513,6 @@ class R1: NSObject, ControllerManager {
|
|
|
513
513
|
func sendButtonPhotoSettings() {}
|
|
514
514
|
func sendButtonVideoRecordingSettings() {}
|
|
515
515
|
func sendButtonMaxRecordingTime() {}
|
|
516
|
-
func sendButtonCameraLedSetting() {}
|
|
517
516
|
func setBrightness(_: Int, autoMode _: Bool) {}
|
|
518
517
|
func clearDisplay() {}
|
|
519
518
|
func sendTextWall(_: String) {}
|
|
@@ -75,8 +75,6 @@
|
|
|
75
75
|
|
|
76
76
|
// func sendButtonMaxRecordingTime(_: Int) {}
|
|
77
77
|
|
|
78
|
-
// func sendButtonCameraLedSetting() {}
|
|
79
|
-
|
|
80
78
|
func exit() {}
|
|
81
79
|
|
|
82
80
|
func sendRgbLedControl(requestId: String, packageName _: String?, action _: String, color _: String?, onDurationMs _: Int, offDurationMs _: Int, count _: Int) {
|
package/ios/Source/sgcs/G1.swift
CHANGED
|
@@ -284,7 +284,7 @@ class G1: NSObject, SGCManager {
|
|
|
284
284
|
|
|
285
285
|
func sendStreamKeepAlive(_: [String: Any]) {}
|
|
286
286
|
|
|
287
|
-
func startVideoRecording(requestId _: String, save _: Bool,
|
|
287
|
+
func startVideoRecording(requestId _: String, save _: Bool, sound _: Bool) {}
|
|
288
288
|
|
|
289
289
|
func stopVideoRecording(requestId _: String) {}
|
|
290
290
|
|
|
@@ -294,8 +294,6 @@ class G1: NSObject, SGCManager {
|
|
|
294
294
|
|
|
295
295
|
func sendButtonMaxRecordingTime() {}
|
|
296
296
|
|
|
297
|
-
func sendButtonCameraLedSetting() {}
|
|
298
|
-
|
|
299
297
|
func sendCameraFovSetting() {}
|
|
300
298
|
|
|
301
299
|
func showDashboard() {}
|
package/ios/Source/sgcs/G2.swift
CHANGED
|
@@ -3147,7 +3147,7 @@ class G2: NSObject, SGCManager {
|
|
|
3147
3147
|
// MARK: - SGCManager: Camera & Media (not supported on G2)
|
|
3148
3148
|
|
|
3149
3149
|
func requestPhoto(_: PhotoRequest) {}
|
|
3150
|
-
func startVideoRecording(requestId _: String, save _: Bool,
|
|
3150
|
+
func startVideoRecording(requestId _: String, save _: Bool, sound _: Bool) {}
|
|
3151
3151
|
func startStream(_: [String: Any]) {}
|
|
3152
3152
|
func stopStream() {}
|
|
3153
3153
|
func sendStreamKeepAlive(_: [String: Any]) {}
|
|
@@ -3155,7 +3155,6 @@ class G2: NSObject, SGCManager {
|
|
|
3155
3155
|
func sendButtonPhotoSettings() {}
|
|
3156
3156
|
func sendButtonVideoRecordingSettings() {}
|
|
3157
3157
|
func sendButtonMaxRecordingTime() {}
|
|
3158
|
-
func sendButtonCameraLedSetting() {}
|
|
3159
3158
|
|
|
3160
3159
|
func sendCameraFovSetting() {}
|
|
3161
3160
|
|
|
@@ -34,8 +34,6 @@ class Mach1: UltraliteBaseViewController, SGCManager {
|
|
|
34
34
|
|
|
35
35
|
func sendButtonMaxRecordingTime(_: Int) {}
|
|
36
36
|
|
|
37
|
-
func sendButtonCameraLedSetting() {}
|
|
38
|
-
|
|
39
37
|
func sendCameraFovSetting() {}
|
|
40
38
|
|
|
41
39
|
func exit() {}
|
|
@@ -87,7 +85,7 @@ class Mach1: UltraliteBaseViewController, SGCManager {
|
|
|
87
85
|
|
|
88
86
|
func sendStreamKeepAlive(_: [String: Any]) {}
|
|
89
87
|
|
|
90
|
-
func startVideoRecording(requestId _: String, save _: Bool,
|
|
88
|
+
func startVideoRecording(requestId _: String, save _: Bool, sound _: Bool) {}
|
|
91
89
|
|
|
92
90
|
func stopVideoRecording(requestId _: String) {}
|
|
93
91
|
|
|
@@ -1616,7 +1616,7 @@ 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) appId=\(request.appId)
|
|
1619
|
+
"LIVE: PHOTO PIPELINE [5/6] requestPhoto() entry requestId=\(request.requestId) appId=\(request.appId) 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] = [
|
|
@@ -1656,7 +1656,6 @@ class MentraLive: NSObject, SGCManager {
|
|
|
1656
1656
|
json["size"] = allowedSizes.contains(size) ? size : "medium"
|
|
1657
1657
|
|
|
1658
1658
|
json["compress"] = request.compress?.rawValue ?? "none"
|
|
1659
|
-
json["flash"] = request.flash
|
|
1660
1659
|
json["save"] = request.save
|
|
1661
1660
|
json["sound"] = request.sound
|
|
1662
1661
|
|
|
@@ -5085,9 +5084,6 @@ extension MentraLive {
|
|
|
5085
5084
|
// Send button photo settings
|
|
5086
5085
|
sendButtonPhotoSettings()
|
|
5087
5086
|
|
|
5088
|
-
// Send button camera LED setting
|
|
5089
|
-
sendButtonCameraLedSetting()
|
|
5090
|
-
|
|
5091
5087
|
// Send camera FOV setting (K900 / Mentra Live)
|
|
5092
5088
|
sendCameraFovSetting()
|
|
5093
5089
|
|
|
@@ -5197,7 +5193,9 @@ extension MentraLive {
|
|
|
5197
5193
|
}
|
|
5198
5194
|
|
|
5199
5195
|
func sendButtonPhotoSettings() {
|
|
5200
|
-
let size = DeviceStore.shared.get("bluetooth", "button_photo_size") as? String
|
|
5196
|
+
let size = (DeviceStore.shared.get("bluetooth", "button_photo_size") as? String).flatMap { rawSize in
|
|
5197
|
+
rawSize.isEmpty ? nil : PhotoSize(normalizedRawValue: rawSize)
|
|
5198
|
+
}
|
|
5201
5199
|
let mfnr = DeviceStore.shared.get("bluetooth", "button_photo_mfnr") as? Bool
|
|
5202
5200
|
let zsl = DeviceStore.shared.get("bluetooth", "button_photo_zsl") as? Bool
|
|
5203
5201
|
let noiseReduction = DeviceStore.shared.get("bluetooth", "button_photo_noise_reduction") as? Bool
|
|
@@ -5209,8 +5207,8 @@ extension MentraLive {
|
|
|
5209
5207
|
let compressStr = DeviceStore.shared.get("bluetooth", "button_photo_compress") as? String
|
|
5210
5208
|
let sound = DeviceStore.shared.get("bluetooth", "button_photo_sound") as? Bool
|
|
5211
5209
|
|
|
5212
|
-
let settings =
|
|
5213
|
-
size:
|
|
5210
|
+
let settings = PhotoCaptureDefaults(
|
|
5211
|
+
size: size,
|
|
5214
5212
|
mfnr: mfnr,
|
|
5215
5213
|
zsl: zsl,
|
|
5216
5214
|
noiseReduction: noiseReduction,
|
|
@@ -5228,10 +5226,10 @@ extension MentraLive {
|
|
|
5228
5226
|
}
|
|
5229
5227
|
|
|
5230
5228
|
func sendButtonPhotoSettings(requestId: String?, size: String) {
|
|
5231
|
-
sendButtonPhotoSettings(requestId: requestId, settings:
|
|
5229
|
+
sendButtonPhotoSettings(requestId: requestId, settings: PhotoCaptureDefaults(size: PhotoSize(normalizedRawValue: size)))
|
|
5232
5230
|
}
|
|
5233
5231
|
|
|
5234
|
-
func sendButtonPhotoSettings(requestId: String?, settings:
|
|
5232
|
+
func sendButtonPhotoSettings(requestId: String?, settings: PhotoCaptureDefaults) {
|
|
5235
5233
|
var details = settings.size.map { "size=\($0.rawValue)" } ?? "size=unchanged"
|
|
5236
5234
|
if let mfnr = settings.mfnr {
|
|
5237
5235
|
details += ", mfnr=\(mfnr)"
|
|
@@ -5315,29 +5313,6 @@ extension MentraLive {
|
|
|
5315
5313
|
sendJson(json, wakeUp: true)
|
|
5316
5314
|
}
|
|
5317
5315
|
|
|
5318
|
-
func sendButtonCameraLedSetting() {
|
|
5319
|
-
let enabled = DeviceStore.shared.get("bluetooth", "button_camera_led") as! Bool
|
|
5320
|
-
sendButtonCameraLedSetting(requestId: nil, enabled: enabled)
|
|
5321
|
-
}
|
|
5322
|
-
|
|
5323
|
-
func sendButtonCameraLedSetting(requestId: String?, enabled: Bool) {
|
|
5324
|
-
Bridge.log("Sending button camera LED setting: \(enabled)")
|
|
5325
|
-
|
|
5326
|
-
guard connectionState == ConnTypes.CONNECTED else {
|
|
5327
|
-
Bridge.log("Cannot send button camera LED setting - not connected")
|
|
5328
|
-
return
|
|
5329
|
-
}
|
|
5330
|
-
|
|
5331
|
-
var json: [String: Any] = [
|
|
5332
|
-
"type": "button_camera_led",
|
|
5333
|
-
"enabled": enabled,
|
|
5334
|
-
]
|
|
5335
|
-
if let requestId, !requestId.isEmpty {
|
|
5336
|
-
json["request_id"] = requestId
|
|
5337
|
-
}
|
|
5338
|
-
sendJson(json, wakeUp: true)
|
|
5339
|
-
}
|
|
5340
|
-
|
|
5341
5316
|
func sendCameraFovSetting() {
|
|
5342
5317
|
let settings = DeviceStore.shared.get("bluetooth", "camera_fov") as? [String: Any] ?? ["fov": 118, "roi_position": 0]
|
|
5343
5318
|
let fov = settings["fov"] as? Int ?? 118
|
|
@@ -5366,9 +5341,9 @@ extension MentraLive {
|
|
|
5366
5341
|
sendJson(json, wakeUp: true)
|
|
5367
5342
|
}
|
|
5368
5343
|
|
|
5369
|
-
func startVideoRecording(requestId: String, save: Bool,
|
|
5344
|
+
func startVideoRecording(requestId: String, save: Bool, sound: Bool) {
|
|
5370
5345
|
startVideoRecording(
|
|
5371
|
-
requestId: requestId, save: save,
|
|
5346
|
+
requestId: requestId, save: save, sound: sound, width: 0, height: 0, fps: 0,
|
|
5372
5347
|
maxRecordingTimeMinutes: 0
|
|
5373
5348
|
)
|
|
5374
5349
|
}
|
|
@@ -5380,11 +5355,11 @@ extension MentraLive {
|
|
|
5380
5355
|
}
|
|
5381
5356
|
|
|
5382
5357
|
func startVideoRecording(
|
|
5383
|
-
requestId: String, save: Bool,
|
|
5358
|
+
requestId: String, save: Bool, sound: Bool, width: Int, height: Int, fps: Int,
|
|
5384
5359
|
maxRecordingTimeMinutes: Int
|
|
5385
5360
|
) {
|
|
5386
5361
|
Bridge.log(
|
|
5387
|
-
"Starting video recording on glasses: requestId=\(requestId), save=\(save),
|
|
5362
|
+
"Starting video recording on glasses: requestId=\(requestId), save=\(save), sound=\(sound), resolution=\(width)x\(height)@\(fps)fps, maxRecordingTimeMinutes=\(maxRecordingTimeMinutes)"
|
|
5388
5363
|
)
|
|
5389
5364
|
|
|
5390
5365
|
guard connectionState == ConnTypes.CONNECTED else {
|
|
@@ -5396,10 +5371,8 @@ extension MentraLive {
|
|
|
5396
5371
|
"type": "start_video_recording",
|
|
5397
5372
|
"requestId": requestId,
|
|
5398
5373
|
"save": save,
|
|
5399
|
-
"flash": flash,
|
|
5400
5374
|
"sound": sound,
|
|
5401
5375
|
]
|
|
5402
|
-
|
|
5403
5376
|
// Auto-stop timer; only sent when set (> 0). 0 = record until stopped.
|
|
5404
5377
|
if maxRecordingTimeMinutes > 0 {
|
|
5405
5378
|
json["maxRecordingTimeMinutes"] = maxRecordingTimeMinutes
|
|
@@ -59,7 +59,7 @@ class MentraNexSGC: NSObject, CBCentralManagerDelegate, CBPeripheralDelegate, SG
|
|
|
59
59
|
|
|
60
60
|
func sendStreamKeepAlive(_: [String: Any]) {}
|
|
61
61
|
|
|
62
|
-
func startVideoRecording(requestId _: String, save _: Bool,
|
|
62
|
+
func startVideoRecording(requestId _: String, save _: Bool, sound _: Bool) {}
|
|
63
63
|
|
|
64
64
|
func stopVideoRecording(requestId _: String) {}
|
|
65
65
|
|
|
@@ -69,8 +69,6 @@ class MentraNexSGC: NSObject, CBCentralManagerDelegate, CBPeripheralDelegate, SG
|
|
|
69
69
|
|
|
70
70
|
func sendButtonMaxRecordingTime() {}
|
|
71
71
|
|
|
72
|
-
func sendButtonCameraLedSetting() {}
|
|
73
|
-
|
|
74
72
|
func sendCameraFovSetting() {}
|
|
75
73
|
|
|
76
74
|
func setBrightness(_ level: Int, autoMode: Bool) {
|
|
@@ -22,13 +22,13 @@ protocol SGCManager {
|
|
|
22
22
|
func startStream(_ message: [String: Any])
|
|
23
23
|
func stopStream()
|
|
24
24
|
func sendStreamKeepAlive(_ message: [String: Any])
|
|
25
|
-
func startVideoRecording(requestId: String, save: Bool,
|
|
25
|
+
func startVideoRecording(requestId: String, save: Bool, sound: Bool)
|
|
26
26
|
/// Start video recording with optional per-recording resolution/fps. A width,
|
|
27
27
|
/// height, or fps of 0 means "use the device's saved button-video default".
|
|
28
28
|
/// Defaulted in an extension to delegate to the basic recording path; devices
|
|
29
29
|
/// that support custom settings (e.g. Mentra Live) override this.
|
|
30
30
|
func startVideoRecording(
|
|
31
|
-
requestId: String, save: Bool,
|
|
31
|
+
requestId: String, save: Bool, sound: Bool, width: Int, height: Int, fps: Int,
|
|
32
32
|
maxRecordingTimeMinutes: Int
|
|
33
33
|
)
|
|
34
34
|
func stopVideoRecording(requestId: String)
|
|
@@ -44,7 +44,6 @@ protocol SGCManager {
|
|
|
44
44
|
func sendButtonPhotoSettings()
|
|
45
45
|
func sendButtonVideoRecordingSettings()
|
|
46
46
|
func sendButtonMaxRecordingTime()
|
|
47
|
-
func sendButtonCameraLedSetting()
|
|
48
47
|
func sendCameraFovSetting()
|
|
49
48
|
|
|
50
49
|
// MARK: - Display Control
|
|
@@ -149,10 +148,10 @@ extension SGCManager {
|
|
|
149
148
|
// MARK: - Video recording (default: ignore custom settings, use saved defaults)
|
|
150
149
|
|
|
151
150
|
func startVideoRecording(
|
|
152
|
-
requestId: String, save: Bool,
|
|
151
|
+
requestId: String, save: Bool, sound: Bool, width _: Int, height _: Int,
|
|
153
152
|
fps _: Int, maxRecordingTimeMinutes _: Int
|
|
154
153
|
) {
|
|
155
|
-
startVideoRecording(requestId: requestId, save: save,
|
|
154
|
+
startVideoRecording(requestId: requestId, save: save, sound: sound)
|
|
156
155
|
}
|
|
157
156
|
|
|
158
157
|
func stopVideoRecording(requestId: String, webhookUrl _: String?, authToken _: String?) {
|
|
@@ -80,7 +80,7 @@ class Simulated: SGCManager {
|
|
|
80
80
|
// MARK: - Camera & Media
|
|
81
81
|
|
|
82
82
|
func requestPhoto(_ request: PhotoRequest) {
|
|
83
|
-
Bridge.log("requestPhoto
|
|
83
|
+
Bridge.log("requestPhoto save=\(request.save) sound=\(request.sound)")
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
func startStream(_: [String: Any]) {
|
|
@@ -95,7 +95,7 @@ class Simulated: SGCManager {
|
|
|
95
95
|
Bridge.log("sendStreamKeepAlive")
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
func startVideoRecording(requestId _: String, save _: Bool,
|
|
98
|
+
func startVideoRecording(requestId _: String, save _: Bool, sound _: Bool) {
|
|
99
99
|
Bridge.log("startVideoRecording")
|
|
100
100
|
}
|
|
101
101
|
|
|
@@ -113,10 +113,6 @@ class Simulated: SGCManager {
|
|
|
113
113
|
Bridge.log("sendButtonVideoRecordingSettings")
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
func sendButtonCameraLedSetting() {
|
|
117
|
-
Bridge.log("sendButtonCameraLedSetting")
|
|
118
|
-
}
|
|
119
|
-
|
|
120
116
|
func sendCameraFovSetting() {
|
|
121
117
|
Bridge.log("sendCameraFovSetting")
|
|
122
118
|
}
|
|
@@ -552,10 +552,6 @@ struct BluetoothStatus: CustomStringConvertible {
|
|
|
552
552
|
ButtonPhotoSize(rawValue: stringValue(values, "button_photo_size") ?? "") ?? .medium
|
|
553
553
|
}
|
|
554
554
|
|
|
555
|
-
var buttonCameraLed: Bool {
|
|
556
|
-
boolValue(values, "button_camera_led") ?? true
|
|
557
|
-
}
|
|
558
|
-
|
|
559
555
|
var buttonMaxRecordingTime: Int {
|
|
560
556
|
intValue(values["button_max_recording_time"]) ?? 10
|
|
561
557
|
}
|
|
@@ -924,10 +920,6 @@ struct BluetoothStatusUpdate: CustomStringConvertible {
|
|
|
924
920
|
optionalStringValue(values, "button_photo_size").map { ButtonPhotoSize(normalizedRawValue: $0) }
|
|
925
921
|
}
|
|
926
922
|
|
|
927
|
-
var buttonCameraLed: Bool? {
|
|
928
|
-
optionalBoolValue(values, "button_camera_led")
|
|
929
|
-
}
|
|
930
|
-
|
|
931
923
|
var buttonMaxRecordingTime: Int? {
|
|
932
924
|
optionalIntValue(values, "button_max_recording_time")
|
|
933
925
|
}
|
|
@@ -23,6 +23,7 @@ public struct StreamVideoConfig {
|
|
|
23
23
|
if let width { values["width"] = width }
|
|
24
24
|
if let height { values["height"] = height }
|
|
25
25
|
if let bitrate { values["bitrate"] = bitrate }
|
|
26
|
+
// ASG stream parsers shipped with the BLE key named "frameRate".
|
|
26
27
|
if let fps { values["frameRate"] = fps }
|
|
27
28
|
return values
|
|
28
29
|
}
|
|
@@ -219,31 +220,22 @@ public struct StreamResolvedConfig: Equatable {
|
|
|
219
220
|
public struct StreamRequest {
|
|
220
221
|
public let streamUrl: String
|
|
221
222
|
public let streamId: String
|
|
222
|
-
public let keepAlive: Bool
|
|
223
|
-
public let keepAliveIntervalSeconds: Int
|
|
224
223
|
public let sound: Bool
|
|
225
224
|
public let video: StreamVideoConfig?
|
|
226
225
|
public let audio: StreamAudioConfig?
|
|
227
|
-
public let extraValues: [String: Any]
|
|
228
226
|
|
|
229
227
|
public init(
|
|
230
228
|
streamUrl: String,
|
|
231
229
|
streamId: String = "",
|
|
232
|
-
keepAlive: Bool = true,
|
|
233
|
-
keepAliveIntervalSeconds: Int = 5,
|
|
234
230
|
sound: Bool = true,
|
|
235
231
|
video: StreamVideoConfig? = nil,
|
|
236
|
-
audio: StreamAudioConfig? = nil
|
|
237
|
-
extraValues: [String: Any] = [:]
|
|
232
|
+
audio: StreamAudioConfig? = nil
|
|
238
233
|
) {
|
|
239
234
|
self.streamUrl = streamUrl
|
|
240
235
|
self.streamId = streamId
|
|
241
|
-
self.keepAlive = keepAlive
|
|
242
|
-
self.keepAliveIntervalSeconds = keepAliveIntervalSeconds
|
|
243
236
|
self.sound = sound
|
|
244
237
|
self.video = video
|
|
245
238
|
self.audio = audio
|
|
246
|
-
self.extraValues = extraValues
|
|
247
239
|
}
|
|
248
240
|
|
|
249
241
|
init(values: [String: Any]) {
|
|
@@ -254,25 +246,17 @@ public struct StreamRequest {
|
|
|
254
246
|
?? values["whipUrl"] as? String
|
|
255
247
|
?? "",
|
|
256
248
|
streamId: values["streamId"] as? String ?? "",
|
|
257
|
-
keepAlive: values["keepAlive"] as? Bool ?? true,
|
|
258
|
-
keepAliveIntervalSeconds: intValue(values["keepAliveIntervalSeconds"]) ?? 5,
|
|
259
249
|
sound: values["sound"] as? Bool ?? true,
|
|
260
250
|
video: StreamVideoConfig(values: values["video"] as? [String: Any]),
|
|
261
|
-
audio: StreamAudioConfig(values: values["audio"] as? [String: Any])
|
|
262
|
-
extraValues: values
|
|
251
|
+
audio: StreamAudioConfig(values: values["audio"] as? [String: Any])
|
|
263
252
|
)
|
|
264
253
|
}
|
|
265
254
|
|
|
266
255
|
public var values: [String: Any] {
|
|
267
|
-
var values =
|
|
268
|
-
values.removeValue(forKey: "keepAliveMode")
|
|
256
|
+
var values: [String: Any] = [:]
|
|
269
257
|
values["type"] = "start_stream"
|
|
270
258
|
values["streamUrl"] = streamUrl
|
|
271
259
|
values["streamId"] = streamId
|
|
272
|
-
values["keepAlive"] = keepAlive
|
|
273
|
-
values["keepAliveIntervalSeconds"] = keepAliveIntervalSeconds
|
|
274
|
-
// The camera light is a privacy indicator and cannot be disabled by SDK callers.
|
|
275
|
-
values["flash"] = true
|
|
276
260
|
values["sound"] = sound
|
|
277
261
|
if let videoValues = video?.dictionary, !videoValues.isEmpty {
|
|
278
262
|
values["video"] = videoValues
|
|
@@ -284,33 +268,24 @@ public struct StreamRequest {
|
|
|
284
268
|
}
|
|
285
269
|
}
|
|
286
270
|
|
|
287
|
-
extension StreamRequest {
|
|
288
|
-
var isExternallyManagedKeepAlive: Bool {
|
|
289
|
-
stringValue(extraValues, "keepAliveMode") == "external"
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
|
|
293
271
|
struct StreamKeepAliveRequest {
|
|
294
272
|
let streamId: String
|
|
295
273
|
let ackId: String
|
|
296
|
-
let extraValues: [String: Any]
|
|
297
274
|
|
|
298
|
-
init(streamId: String, ackId: String
|
|
275
|
+
init(streamId: String, ackId: String) {
|
|
299
276
|
self.streamId = streamId
|
|
300
277
|
self.ackId = ackId
|
|
301
|
-
self.extraValues = extraValues
|
|
302
278
|
}
|
|
303
279
|
|
|
304
280
|
init(values: [String: Any]) {
|
|
305
281
|
self.init(
|
|
306
282
|
streamId: values["streamId"] as? String ?? "",
|
|
307
|
-
ackId: values["ackId"] as? String ?? ""
|
|
308
|
-
extraValues: values
|
|
283
|
+
ackId: values["ackId"] as? String ?? ""
|
|
309
284
|
)
|
|
310
285
|
}
|
|
311
286
|
|
|
312
287
|
var values: [String: Any] {
|
|
313
|
-
var values =
|
|
288
|
+
var values: [String: Any] = [:]
|
|
314
289
|
values["type"] = "keep_stream_alive"
|
|
315
290
|
values["streamId"] = streamId
|
|
316
291
|
values["ackId"] = ackId
|
package/package.json
CHANGED
|
@@ -396,7 +396,6 @@ export type SettingsAckSetting =
|
|
|
396
396
|
| "gallery_mode"
|
|
397
397
|
| "button_photo"
|
|
398
398
|
| "button_video_recording"
|
|
399
|
-
| "button_camera_led"
|
|
400
399
|
| "button_max_recording_time"
|
|
401
400
|
| "camera_fov"
|
|
402
401
|
|
|
@@ -431,8 +430,8 @@ export type RgbLedColor = "red" | "green" | "blue" | "orange" | "white"
|
|
|
431
430
|
export type PhotoSize = "low" | "medium" | "high" | "max"
|
|
432
431
|
export type ButtonPhotoSize = "low" | "medium" | "high" | "max"
|
|
433
432
|
|
|
434
|
-
export type
|
|
435
|
-
size
|
|
433
|
+
export type PhotoCaptureDefaults = {
|
|
434
|
+
size?: PhotoSize
|
|
436
435
|
mfnr?: boolean
|
|
437
436
|
zsl?: boolean
|
|
438
437
|
noiseReduction?: boolean
|
|
@@ -448,9 +447,15 @@ export type ButtonPhotoSettings = {
|
|
|
448
447
|
}
|
|
449
448
|
export type PhotoCompression = "none" | "medium" | "heavy"
|
|
450
449
|
|
|
450
|
+
export type VideoRecordingDefaults = {
|
|
451
|
+
width: number
|
|
452
|
+
height: number
|
|
453
|
+
fps: number
|
|
454
|
+
}
|
|
455
|
+
|
|
451
456
|
/**
|
|
452
457
|
* Optional per-recording video settings for {@link startVideoRecording}. When
|
|
453
|
-
* omitted, the glasses fall back to their saved
|
|
458
|
+
* omitted, the glasses fall back to their saved video recording defaults. Any
|
|
454
459
|
* field left undefined is omitted from the BLE command (glasses default applies).
|
|
455
460
|
*/
|
|
456
461
|
export interface VideoRecordingSettings {
|
|
@@ -565,8 +570,6 @@ export type StreamStartRequest = {
|
|
|
565
570
|
type?: "start_stream"
|
|
566
571
|
streamUrl: string
|
|
567
572
|
streamId?: string
|
|
568
|
-
keepAlive?: boolean
|
|
569
|
-
keepAliveIntervalSeconds?: number
|
|
570
573
|
sound?: boolean
|
|
571
574
|
video?: StreamVideoConfig
|
|
572
575
|
audio?: StreamAudioConfig
|
|
@@ -946,10 +949,9 @@ export interface BluetoothSdkPublicModule {
|
|
|
946
949
|
|
|
947
950
|
setGalleryModeEnabled(enabled: boolean): Promise<SettingsAckSuccessEvent>
|
|
948
951
|
setVoiceActivityDetectionEnabled(enabled: boolean): Promise<void>
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
setButtonMaxRecordingTime(minutes: number): Promise<SettingsAckSuccessEvent>
|
|
952
|
+
setPhotoCaptureDefaults(settings: PhotoCaptureDefaults): Promise<SettingsAckSuccessEvent>
|
|
953
|
+
setVideoRecordingDefaults(settings: VideoRecordingDefaults): Promise<SettingsAckSuccessEvent>
|
|
954
|
+
setMaxVideoRecordingDuration(minutes: number): Promise<SettingsAckSuccessEvent>
|
|
953
955
|
setCameraFov(request: CameraFovRequest): Promise<CameraFovResult>
|
|
954
956
|
queryGalleryStatus(): Promise<GalleryStatusEvent>
|
|
955
957
|
requestPhoto(params: PhotoRequestParams): Promise<PhotoSuccessResponseEvent>
|
|
@@ -1237,7 +1239,6 @@ export type BluetoothSettingsUpdate = Partial<{
|
|
|
1237
1239
|
button_video_width: number
|
|
1238
1240
|
button_video_height: number
|
|
1239
1241
|
button_video_fps: number
|
|
1240
|
-
button_camera_led: boolean
|
|
1241
1242
|
button_max_recording_time: number
|
|
1242
1243
|
camera_fov: NativeCameraFovSetting
|
|
1243
1244
|
should_send_pcm: boolean
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
BluetoothSettingsUpdate,
|
|
5
5
|
BluetoothSdkModuleEvents,
|
|
6
6
|
BluetoothStatus,
|
|
7
|
-
|
|
7
|
+
PhotoCaptureDefaults,
|
|
8
8
|
CalendarEvent,
|
|
9
9
|
CAMERA_FOV_DEFAULT,
|
|
10
10
|
CAMERA_FOV_MAX,
|
|
@@ -121,11 +121,9 @@ declare class BluetoothSdkNativeModule extends NativeModule<BluetoothSdkModuleEv
|
|
|
121
121
|
// Gallery Commands
|
|
122
122
|
setGalleryModeEnabled(enabled: boolean): Promise<SettingsAckSuccessEvent>
|
|
123
123
|
setVoiceActivityDetectionEnabled(enabled: boolean): Promise<void>
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
setButtonCameraLed(enabled: boolean): Promise<SettingsAckSuccessEvent>
|
|
128
|
-
setButtonMaxRecordingTime(minutes: number): Promise<SettingsAckSuccessEvent>
|
|
124
|
+
setPhotoCaptureDefaults(settings: PhotoCaptureDefaults): Promise<SettingsAckSuccessEvent>
|
|
125
|
+
setVideoRecordingDefaults(width: number, height: number, fps: number): Promise<SettingsAckSuccessEvent>
|
|
126
|
+
setMaxVideoRecordingDuration(minutes: number): Promise<SettingsAckSuccessEvent>
|
|
129
127
|
setCameraFov(request: CameraFovRequest): Promise<CameraFovResult>
|
|
130
128
|
queryGalleryStatus(): Promise<GalleryStatusEvent>
|
|
131
129
|
requestPhoto(params: PhotoRequestParams): Promise<PhotoSuccessResponseEvent>
|
|
@@ -568,10 +566,5 @@ NativeBluetoothSdkModule.requestPhoto = function (params: PhotoRequestParams) {
|
|
|
568
566
|
return nativeRequestPhoto(photoRequestParamsForNative(params) as unknown as PhotoRequestParams)
|
|
569
567
|
}
|
|
570
568
|
|
|
571
|
-
const nativeStartStream = NativeBluetoothSdkModule.startStream.bind(NativeBluetoothSdkModule)
|
|
572
|
-
NativeBluetoothSdkModule.startExternallyManagedStream = function (params: StreamStartRequest) {
|
|
573
|
-
return nativeStartStream({...params, keepAliveMode: "external"} as StreamStartRequest)
|
|
574
|
-
}
|
|
575
|
-
|
|
576
569
|
export default NativeBluetoothSdkModule
|
|
577
570
|
export const BluetoothSdk = NativeBluetoothSdkModule as BluetoothSdkInternalModule
|
|
@@ -29,9 +29,11 @@ export function photoRequestParamsForNative(
|
|
|
29
29
|
size: normalizePhotoSizeTier(params.size),
|
|
30
30
|
webhookUrl: params.webhookUrl ?? "",
|
|
31
31
|
compress: params.compress,
|
|
32
|
-
flash: true,
|
|
33
32
|
sound: params.sound,
|
|
34
33
|
}
|
|
34
|
+
if (params.save != null) {
|
|
35
|
+
payload.save = params.save
|
|
36
|
+
}
|
|
35
37
|
if (params.authToken != null && params.authToken.length > 0) {
|
|
36
38
|
payload.authToken = params.authToken
|
|
37
39
|
}
|