@mentra/bluetooth-sdk 3.3.0 → 3.4.0-beta.1241
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/MIGRATION.md +61 -0
- package/README.md +80 -11
- package/android/build.gradle +60 -51
- package/android/gradle.properties +3 -0
- package/android/settings.gradle +47 -3
- package/android/src/main/java/com/mentra/bluetoothsdk/BesCrashReportWaiters.kt +68 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/BluetoothSdkDefaults.kt +5 -2
- package/android/src/main/java/com/mentra/bluetoothsdk/BluetoothSdkModule.kt +85 -6
- package/android/src/main/java/com/mentra/bluetoothsdk/Bridge.kt +35 -1
- package/android/src/main/java/com/mentra/bluetoothsdk/DeviceManager.kt +154 -110
- package/android/src/main/java/com/mentra/bluetoothsdk/DeviceStore.kt +21 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/GeneratedChangelogCatalog.kt +1 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/GeneratedReleaseMetadata.kt +6 -6
- package/android/src/main/java/com/mentra/bluetoothsdk/MentraBluetoothSdk.kt +27 -2
- package/android/src/main/java/com/mentra/bluetoothsdk/connection/ConnectionModels.kt +5 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/events/BluetoothEvents.kt +16 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/GlassesAudioSetupPolicy.kt +64 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLive.kt +925 -155
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLiveOwnerLossPolicy.kt +227 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLivePairingAdvertisement.kt +19 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLivePairingReadinessPolicy.kt +94 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLivePairingStateMachine.kt +411 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLivePairingStateStore.kt +124 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/Nimo.kt +54 -59
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/NimoCanvasCoordinator.kt +5 -32
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/NimoCanvasEncoder.kt +8 -1
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/NimoCanvasSession.kt +3 -10
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/SGCManager.kt +6 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/status/DeviceStatus.kt +50 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/stt/BoundedAudioQueue.kt +92 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/stt/OnDeviceRecognizerHost.kt +169 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/stt/STTTools.kt +74 -115
- package/android/src/main/java/com/mentra/bluetoothsdk/stt/SherpaOnnxTranscriber.kt +348 -357
- package/android/src/main/java/com/mentra/bluetoothsdk/stt/SpeechActivityDetector.kt +211 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/stt/SpeechActivityEngine.kt +137 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/stt/SttTextFormatter.kt +52 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/stt/WakeWordDetector.kt +235 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/AvifExifStripper.java +2 -2
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/BlePhotoUploadService.java +3 -3
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/IncidentLogBleRelayNaming.java +11 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/audio/AudioRouteWatcher.kt +120 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/audio/PcmStreamPlayer.kt +181 -16
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/audio/PcmUrlPlayback.kt +177 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/BesCrashReportWaitersTest.kt +112 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/DeviceManagerOwnerLossTest.kt +146 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/GlassesStatusAudioSetupTest.kt +51 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/GlassesStatusClassicAudioTest.kt +2 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/WifiAdbPeerIntentTest.kt +19 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/GlassesAudioSetupPolicyTest.kt +65 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/MentraLiveAudioSetupReadinessTest.kt +231 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/MentraLiveGlassesReadyBurstTest.kt +5 -1
- package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/MentraLiveIncidentDispatchTest.kt +183 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/MentraLiveOwnerLossPolicyTest.kt +368 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/MentraLivePairingAdvertisementParserTest.kt +20 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/MentraLivePairingReadinessPolicyTest.kt +136 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/MentraLivePairingStateMachineTest.kt +346 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/NimoCanvasCoordinatorTest.kt +1 -56
- package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/NimoCanvasSessionTest.kt +0 -22
- package/android/src/test/java/com/mentra/bluetoothsdk/utils/IncidentLogBleRelayNamingTest.kt +23 -0
- package/android/src/testDebug/java/com/mentra/bluetoothsdk/stt/BoundedAudioQueueTest.kt +81 -0
- package/android/src/testDebug/java/com/mentra/bluetoothsdk/stt/OnDeviceRecognizerHostTest.kt +216 -0
- package/android/src/testDebug/java/com/mentra/bluetoothsdk/stt/STTToolsExtractionTest.kt +108 -0
- package/android/src/testDebug/java/com/mentra/bluetoothsdk/stt/SpeechActivityDetectorTest.kt +126 -0
- package/android/src/testDebug/java/com/mentra/bluetoothsdk/stt/SpeechActivityEngineTest.kt +245 -0
- package/android/src/testDebug/java/com/mentra/bluetoothsdk/stt/SttTextFormatterTest.kt +67 -0
- package/android/src/testDebug/java/com/mentra/bluetoothsdk/utils/audio/PcmUrlPlaybackTest.kt +76 -0
- package/build/BluetoothSdk.types.d.ts +201 -1
- package/build/BluetoothSdk.types.d.ts.map +1 -1
- package/build/BluetoothSdk.types.js.map +1 -1
- package/build/_private/BluetoothSdkModule.d.ts +43 -5
- package/build/_private/BluetoothSdkModule.d.ts.map +1 -1
- package/build/_private/BluetoothSdkModule.js +2 -0
- package/build/_private/BluetoothSdkModule.js.map +1 -1
- package/build/generated/changelogCatalog.d.ts +3 -0
- package/build/generated/changelogCatalog.d.ts.map +1 -1
- package/build/generated/changelogCatalog.js +4 -0
- package/build/generated/changelogCatalog.js.map +1 -1
- package/build/generated/releaseMetadata.js +6 -6
- package/build/generated/releaseMetadata.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +9 -0
- package/build/index.js.map +1 -1
- package/ios/BluetoothSdkModule.swift +76 -12
- package/ios/MentraBluetoothSDK.podspec +4 -0
- package/ios/Packages/SherpaOnnx/SherpaOnnx.swift +23 -5
- package/ios/Resources/SileroVad/silero_vad.onnx +0 -0
- package/ios/Source/BesCrashReportWaiters.swift +64 -0
- package/ios/Source/BluetoothSdkDefaults.swift +2 -2
- package/ios/Source/Bridge.swift +11 -3
- package/ios/Source/DeviceManager.swift +131 -18
- package/ios/Source/DeviceStore.swift +27 -0
- package/ios/Source/GeneratedChangelogCatalog.swift +1 -0
- package/ios/Source/GeneratedReleaseMetadata.swift +6 -6
- package/ios/Source/MentraBluetoothSDK.swift +40 -5
- package/ios/Source/audio/PcmStreamPlayer.swift +290 -57
- package/ios/Source/audio/PcmUrlPlayback.swift +231 -0
- package/ios/Source/audio/SpeechActivity.swift +277 -0
- package/ios/Source/errors/BluetoothSdkError.swift +5 -1
- package/ios/Source/events/BluetoothEvents.swift +41 -0
- package/ios/Source/internal/BleTraceLogger.swift +9 -6
- package/ios/Source/internal/BluetoothAvailability.swift +15 -5
- package/ios/Source/sgcs/GlassesAudioSetupPolicy.swift +186 -0
- package/ios/Source/sgcs/MentraLive.swift +1270 -189
- package/ios/Source/sgcs/MentraLivePairingAdvertisement.swift +260 -1
- package/ios/Source/sgcs/MentraLivePairingStateMachine.swift +385 -0
- package/ios/Source/sgcs/MentraLivePairingStateStore.swift +121 -0
- package/ios/Source/sgcs/Nimo.swift +10 -3
- package/ios/Source/sgcs/NimoCanvasCoordinator.swift +39 -9
- package/ios/Source/sgcs/SGCManager.swift +13 -0
- package/ios/Source/sgcs/Simulated.swift +2 -0
- package/ios/Source/status/DeviceStatus.swift +35 -0
- package/ios/Source/stt/STTTools.swift +13 -31
- package/ios/Source/stt/SherpaOnnxTranscriber.swift +204 -162
- package/ios/Source/stt/SileroSpeechActivity.swift +87 -0
- package/ios/Source/stt/WakeWordDetector.swift +145 -0
- package/ios/Source/types/DeviceModels.swift +8 -1
- package/ios/Source/utils/AudioSessionMonitor.swift +158 -5
- package/ios/Source/utils/BoundedWait.swift +44 -0
- package/ios/Source/utils/DemandDrivenAudioWorker.swift +79 -0
- package/ios/Source/utils/SttModelTraits.swift +62 -0
- package/ios/Tests/BesCrashReportTests.swift +142 -0
- package/ios/Tests/BluetoothAudioRouteTests.swift +82 -0
- package/ios/Tests/DemandDrivenAudioWorkerTests.swift +171 -0
- package/ios/Tests/DeviceManagerReconnectTests.swift +4 -2
- package/ios/Tests/GlassesAudioSetupPolicyTests.swift +197 -0
- package/ios/Tests/IncidentLogDispatchTests.swift +158 -0
- package/ios/Tests/MentraLiveAudioSetupTests.swift +209 -0
- package/ios/Tests/MentraLiveConnectionOptionsTests.swift +55 -0
- package/ios/Tests/MentraLivePairingAdvertisementTests.swift +327 -0
- package/ios/Tests/MentraLivePairingStateMachineTests.swift +402 -0
- package/ios/Tests/MentraLiveSessionReadinessTests.swift +368 -26
- package/ios/Tests/NimoCanvasTransportTests.swift +58 -0
- package/ios/Tests/PcmStreamTests.swift +299 -0
- package/ios/Tests/SpeechActivityTests.swift +238 -0
- package/ios/Tests/SttModelTraitsTests.swift +62 -0
- package/ios/Tests/WifiAdbDispatchTests.swift +118 -0
- package/package.json +3 -2
- package/plugin/build/withAndroid.js +9 -11
- package/plugin/build/withKotlinVersion.d.ts +2 -0
- package/plugin/build/withKotlinVersion.js +46 -0
- package/src/BluetoothSdk.types.ts +201 -1
- package/src/_private/BluetoothSdkModule.ts +47 -5
- package/src/generated/changelogCatalog.ts +4 -0
- package/src/generated/releaseMetadata.ts +6 -6
- package/src/index.ts +22 -0
- package/android/silero/LICENSE.md +0 -17
- package/android/silero/build.gradle +0 -50
- package/android/silero/proguard-rules.pro +0 -24
- package/android/silero/src/androidTest/assets/hello.wav +0 -0
- package/android/silero/src/androidTest/java/com/konovalov/vad/silero/VadSileroTest.kt +0 -79
- package/android/silero/src/main/java/com/konovalov/vad/silero/Vad.kt +0 -160
- package/android/silero/src/main/java/com/konovalov/vad/silero/VadSilero.kt +0 -449
- package/android/silero/src/main/java/com/konovalov/vad/silero/config/FrameSize.kt +0 -15
- package/android/silero/src/main/java/com/konovalov/vad/silero/config/Mode.kt +0 -14
- package/android/silero/src/main/java/com/konovalov/vad/silero/config/SampleRate.kt +0 -12
- package/android/silero/src/main/java/com/konovalov/vad/silero/utils/AudioUtils.kt +0 -47
- package/android/silero/src/main/java/com/konovalov/vad/silero/utils/TensorMap.kt +0 -41
- package/android/silero/src/test/java/com/konovalov/vad/silero/utils/AudioUtilsTest.kt +0 -44
- package/android/src/debug/java/com/mentra/bluetoothsdk/sgcs/NimoDiagnostics.kt +0 -368
- package/android/src/debug/java/com/mentra/bluetoothsdk/sgcs/NimoFramebufferProtocol.kt +0 -156
- package/android/src/main/java/com/mentra/bluetoothsdk/stt/VadGateSpeechPolicy.kt +0 -229
- package/android/src/release/java/com/mentra/bluetoothsdk/sgcs/NimoDiagnostics.kt +0 -20
- package/android/src/testDebug/java/com/mentra/bluetoothsdk/sgcs/NimoDiagnosticsTest.kt +0 -287
- package/android/src/testDebug/java/com/mentra/bluetoothsdk/sgcs/NimoFramebufferProtocolTest.kt +0 -127
- package/android/src/testDebug/java/com/mentra/bluetoothsdk/sgcs/NimoLifecycleTest.kt +0 -288
- /package/android/{silero/src/main/assets/LICENSE → src/main/assets/vad/LICENSE.silero_vad} +0 -0
- /package/android/{silero/src/main/assets → src/main/assets/vad}/silero_vad.onnx +0 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
@testable import MentraBluetoothSDK
|
|
2
|
+
import XCTest
|
|
3
|
+
|
|
4
|
+
@MainActor
|
|
5
|
+
private final class WifiAdbRecordingLive: MentraLive {
|
|
6
|
+
var ready = true
|
|
7
|
+
var accepts = true
|
|
8
|
+
var beforeEnqueue: (() -> Void)?
|
|
9
|
+
override var wifiAdbLinkReady: Bool { ready }
|
|
10
|
+
override func enqueueWifiAdbState(_ enabled: Bool) -> Bool {
|
|
11
|
+
guard accepts else { return false }
|
|
12
|
+
beforeEnqueue?()
|
|
13
|
+
return super.enqueueWifiAdbState(enabled)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@MainActor
|
|
18
|
+
final class WifiAdbDispatchTests: XCTestCase {
|
|
19
|
+
let first = "AA:BB:CC:DD:EE:01"
|
|
20
|
+
let second = "AA:BB:CC:DD:EE:02"
|
|
21
|
+
|
|
22
|
+
func frame(_ mac: String) throws -> Data {
|
|
23
|
+
try JSONSerialization.data(withJSONObject: ["type": "version_info", "bt_mac_address": mac, "build_number": "0"])
|
|
24
|
+
}
|
|
25
|
+
@discardableResult func receive(_ live: MentraLive, source: NSObject, mac: String) throws -> MentraLiveNotificationIngress.Token {
|
|
26
|
+
let token = try XCTUnwrap(live.beginBleNotificationSession(source: source))
|
|
27
|
+
live.receiveBleNotification(try frame(mac), token: token)
|
|
28
|
+
return token
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
func testRetargetBeforeNativeDispatchCannotQueueForTheOtherPair() throws {
|
|
32
|
+
let manager = DeviceManager()
|
|
33
|
+
let old = WifiAdbRecordingLive(), replacement = WifiAdbRecordingLive()
|
|
34
|
+
defer { manager.sgc = nil; manager.cleanup(); old.cleanup(); replacement.cleanup() }
|
|
35
|
+
try receive(old, source: NSObject(), mac: first)
|
|
36
|
+
try receive(replacement, source: NSObject(), mac: second)
|
|
37
|
+
manager.sgc = old
|
|
38
|
+
manager.sgc = replacement
|
|
39
|
+
XCTAssertThrowsError(try manager.setWifiAdbState(true, expectedBluetoothMac: first))
|
|
40
|
+
XCTAssertEqual(old.pendingBleCommandCount, 0)
|
|
41
|
+
XCTAssertEqual(replacement.pendingBleCommandCount, 0)
|
|
42
|
+
try manager.setWifiAdbState(false, expectedBluetoothMac: second)
|
|
43
|
+
XCTAssertEqual(replacement.pendingBleCommandCount, 1)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
func testDelayedOldNotificationCannotRestoreIdentityAfterReconnectIncludingSamePeripheral() throws {
|
|
47
|
+
for samePeripheral in [false, true] {
|
|
48
|
+
let live = WifiAdbRecordingLive(), oldSource = NSObject()
|
|
49
|
+
defer { live.cleanup() }
|
|
50
|
+
let oldToken = try receive(live, source: oldSource, mac: first)
|
|
51
|
+
live.endBleNotificationSession()
|
|
52
|
+
let newSource = samePeripheral ? oldSource : NSObject()
|
|
53
|
+
let newToken = try XCTUnwrap(live.beginBleNotificationSession(source: newSource))
|
|
54
|
+
live.receiveBleNotification(try frame(first), token: oldToken)
|
|
55
|
+
XCTAssertThrowsError(try live.sendWifiAdbState(true, expectedBluetoothMac: first))
|
|
56
|
+
live.receiveBleNotification(try frame(second), token: newToken)
|
|
57
|
+
live.receiveBleNotification(try frame(first), token: oldToken)
|
|
58
|
+
XCTAssertThrowsError(try live.sendWifiAdbState(true, expectedBluetoothMac: first))
|
|
59
|
+
try live.sendWifiAdbState(false, expectedBluetoothMac: second)
|
|
60
|
+
XCTAssertEqual(live.pendingBleCommandCount, 1)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
func testIngressCapturesSourceAndEpochBeforeTheActorHop() throws {
|
|
65
|
+
let ingress = MentraLiveNotificationIngress(), first = NSObject(), second = NSObject()
|
|
66
|
+
let old = try XCTUnwrap(ingress.begin(first))
|
|
67
|
+
XCTAssertEqual(ingress.capture(first), old)
|
|
68
|
+
_ = ingress.begin(second)
|
|
69
|
+
XCTAssertNil(ingress.capture(first))
|
|
70
|
+
XCTAssertFalse(ingress.current(old))
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
func testNativeOnlyLoggingAndActualQueueRejectSynchronousDelegateReset() throws {
|
|
74
|
+
let live = WifiAdbRecordingLive(), source = NSObject()
|
|
75
|
+
defer { live.cleanup() }
|
|
76
|
+
try receive(live, source: source, mac: first)
|
|
77
|
+
var logs = 0
|
|
78
|
+
let sink = Bridge.addEventSink { event, _ in
|
|
79
|
+
guard event == "log" else { return }
|
|
80
|
+
MainActor.assumeIsolated {
|
|
81
|
+
logs += 1
|
|
82
|
+
live.ready = false
|
|
83
|
+
live.endBleNotificationSession()
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
defer { Bridge.removeEventSink(sink) }
|
|
87
|
+
try live.sendWifiAdbState(true, expectedBluetoothMac: first)
|
|
88
|
+
XCTAssertEqual(logs, 0) // real framing/queue insertion never invokes the public log sink
|
|
89
|
+
XCTAssertEqual(live.pendingBleCommandCount, 1)
|
|
90
|
+
// Simulate reentry at the former public-log boundary, retaining real framing and enqueue.
|
|
91
|
+
live.beforeEnqueue = { Bridge.log("test synchronous reset") }
|
|
92
|
+
XCTAssertThrowsError(try live.sendWifiAdbState(false, expectedBluetoothMac: first))
|
|
93
|
+
XCTAssertEqual(logs, 1)
|
|
94
|
+
XCTAssertEqual(live.pendingBleCommandCount, 0) // no newly stamped command entered the reset epoch
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
func testMissingSessionIdentityDisconnectedAndSuffixInputsQueueNothing() throws {
|
|
98
|
+
let live = WifiAdbRecordingLive()
|
|
99
|
+
defer { live.cleanup() }
|
|
100
|
+
XCTAssertThrowsError(try live.sendWifiAdbState(true, expectedBluetoothMac: first))
|
|
101
|
+
try receive(live, source: NSObject(), mac: first)
|
|
102
|
+
for invalid in ["EE:01", first + ":00", " " + first, second] {
|
|
103
|
+
XCTAssertThrowsError(try live.sendWifiAdbState(true, expectedBluetoothMac: invalid))
|
|
104
|
+
}
|
|
105
|
+
live.ready = false
|
|
106
|
+
XCTAssertThrowsError(try live.sendWifiAdbState(true, expectedBluetoothMac: first))
|
|
107
|
+
XCTAssertEqual(live.pendingBleCommandCount, 0)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
func testRejectedQueueDoesNotResolveAsSuccessfulDispatch() throws {
|
|
111
|
+
let live = WifiAdbRecordingLive()
|
|
112
|
+
defer { live.cleanup() }
|
|
113
|
+
try receive(live, source: NSObject(), mac: first)
|
|
114
|
+
live.accepts = false
|
|
115
|
+
XCTAssertThrowsError(try live.sendWifiAdbState(true, expectedBluetoothMac: first))
|
|
116
|
+
XCTAssertEqual(live.pendingBleCommandCount, 0)
|
|
117
|
+
}
|
|
118
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mentra/bluetooth-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0-beta.1241",
|
|
4
4
|
"description": "SDK for communicating with smart glasses",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"!ios/Pods",
|
|
69
69
|
"!ios/Pods/**",
|
|
70
70
|
"plugin/build",
|
|
71
|
+
"MIGRATION.md",
|
|
71
72
|
"README.md",
|
|
72
73
|
"scripts",
|
|
73
74
|
"src",
|
|
@@ -114,7 +115,7 @@
|
|
|
114
115
|
"registry": "https://registry.npmjs.org/"
|
|
115
116
|
},
|
|
116
117
|
"dependencies": {
|
|
117
|
-
"@mentra/cloud-protocol": "3.
|
|
118
|
+
"@mentra/cloud-protocol": "3.4.0-beta.1241"
|
|
118
119
|
},
|
|
119
120
|
"devDependencies": {
|
|
120
121
|
"@types/node": "^25.9.3",
|
|
@@ -8,6 +8,7 @@ const child_process_1 = require("child_process");
|
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const config_plugins_1 = require("expo/config-plugins");
|
|
10
10
|
const analyticsProps_1 = require("./analyticsProps");
|
|
11
|
+
const withKotlinVersion_1 = require("./withKotlinVersion");
|
|
11
12
|
const META_ANALYTICS_DISABLED = "com.mentra.bluetoothsdk.analytics.disabled";
|
|
12
13
|
const META_ANALYTICS_ENVIRONMENT = "com.mentra.bluetoothsdk.analytics.environment";
|
|
13
14
|
const STALE_META_POSTHOG_API_KEY = "com.mentra.bluetoothsdk.analytics.posthog_api_key";
|
|
@@ -25,7 +26,7 @@ function toGroovyString(value) {
|
|
|
25
26
|
return JSON.stringify(value);
|
|
26
27
|
}
|
|
27
28
|
/**
|
|
28
|
-
* Modify settings.gradle to include lc3Lib
|
|
29
|
+
* Modify settings.gradle to include the lc3Lib module
|
|
29
30
|
*/
|
|
30
31
|
function withSettingsGradleModifications(config) {
|
|
31
32
|
return (0, config_plugins_1.withSettingsGradle)(config, (config) => {
|
|
@@ -53,16 +54,12 @@ function withSettingsGradleModifications(config) {
|
|
|
53
54
|
project(':lc3Lib').projectDir = new File(${bluetoothSdkRootExpression}, 'android/lc3Lib')
|
|
54
55
|
`;
|
|
55
56
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
settingsGradle += `
|
|
63
|
-
project(':silero').projectDir = new File(${bluetoothSdkRootExpression}, 'android/silero')
|
|
64
|
-
`;
|
|
65
|
-
}
|
|
57
|
+
// Earlier versions of this plugin added a `:silero` module, which no longer exists. Prebuild
|
|
58
|
+
// runs without --clean, so remove those lines from an already generated settings.gradle.
|
|
59
|
+
settingsGradle = settingsGradle
|
|
60
|
+
.split("\n")
|
|
61
|
+
.filter((line) => !line.includes("include ':silero'") && !line.includes("project(':silero')"))
|
|
62
|
+
.join("\n");
|
|
66
63
|
config.modResults.contents = settingsGradle;
|
|
67
64
|
return config;
|
|
68
65
|
});
|
|
@@ -173,6 +170,7 @@ function withAnalyticsManifestMetadata(config, props) {
|
|
|
173
170
|
});
|
|
174
171
|
}
|
|
175
172
|
const withAndroidConfiguration = (config, props) => {
|
|
173
|
+
config = (0, withKotlinVersion_1.withKotlinVersion)(config);
|
|
176
174
|
config = withSettingsGradleModifications(config);
|
|
177
175
|
config = withSherpaOnnxLocalMavenRepo(config);
|
|
178
176
|
config = withAnalyticsManifestMetadata(config, props);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withKotlinVersion = void 0;
|
|
4
|
+
const config_plugins_1 = require("expo/config-plugins");
|
|
5
|
+
// avif-coder 3.0.0 contains Kotlin 2.3 metadata. Match the standalone SDK
|
|
6
|
+
// compiler and @mentra/crust; Expo SDK 55 also has a KSP mapping for 2.3.0.
|
|
7
|
+
const MIN_KOTLIN_VERSION = "2.3.0";
|
|
8
|
+
const UNVERSIONED_KOTLIN_PLUGIN = "classpath('org.jetbrains.kotlin:kotlin-gradle-plugin')";
|
|
9
|
+
const PINNED_KOTLIN_PLUGIN = `classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:\${findProperty('android.kotlinVersion')}")`;
|
|
10
|
+
const ROOT_KOTLIN_VERSION = "ext.kotlinVersion = findProperty('android.kotlinVersion')";
|
|
11
|
+
const EXPO_ROOT_PROJECT = 'apply plugin: "expo-root-project"';
|
|
12
|
+
function isOlderVersion(version) {
|
|
13
|
+
const actual = version.split(".").map(Number);
|
|
14
|
+
const minimum = MIN_KOTLIN_VERSION.split(".").map(Number);
|
|
15
|
+
for (let index = 0; index < minimum.length; index++) {
|
|
16
|
+
if ((actual[index] ?? 0) !== minimum[index])
|
|
17
|
+
return (actual[index] ?? 0) < minimum[index];
|
|
18
|
+
}
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
const withKotlinVersion = (config) => {
|
|
22
|
+
config = (0, config_plugins_1.withGradleProperties)(config, (cfg) => {
|
|
23
|
+
const property = cfg.modResults.find((item) => item.type === "property" && item.key === "android.kotlinVersion");
|
|
24
|
+
if (property?.type !== "property") {
|
|
25
|
+
cfg.modResults.push({ type: "property", key: "android.kotlinVersion", value: MIN_KOTLIN_VERSION });
|
|
26
|
+
}
|
|
27
|
+
else if (isOlderVersion(property.value)) {
|
|
28
|
+
property.value = MIN_KOTLIN_VERSION;
|
|
29
|
+
}
|
|
30
|
+
return cfg;
|
|
31
|
+
});
|
|
32
|
+
return (0, config_plugins_1.withProjectBuildGradle)(config, (cfg) => {
|
|
33
|
+
if (cfg.modResults.language !== "groovy")
|
|
34
|
+
return cfg;
|
|
35
|
+
// Expo 55's unversioned classpath resolves React Native's Kotlin 2.1.20
|
|
36
|
+
// compiler even when android.kotlinVersion is set. Pin the actual plugin
|
|
37
|
+
// and Expo's version catalog, as @mentra/crust does for QuickJS.
|
|
38
|
+
let gradle = cfg.modResults.contents.replace(UNVERSIONED_KOTLIN_PLUGIN, PINNED_KOTLIN_PLUGIN);
|
|
39
|
+
if (!gradle.includes(ROOT_KOTLIN_VERSION)) {
|
|
40
|
+
gradle = gradle.replace(EXPO_ROOT_PROJECT, `// Kotlin compiler required by @mentra/bluetooth-sdk's AVIF decoder.\n${ROOT_KOTLIN_VERSION}\n${EXPO_ROOT_PROJECT}`);
|
|
41
|
+
}
|
|
42
|
+
cfg.modResults.contents = gradle;
|
|
43
|
+
return cfg;
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
exports.withKotlinVersion = withKotlinVersion;
|
|
@@ -100,6 +100,28 @@ export type GlassesMediaVolumeSetResult = {
|
|
|
100
100
|
statusCode: number
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
/** On-device keyword spotter state and detections. Describes only the wake-word model. */
|
|
104
|
+
export type WakeWordEvent = {
|
|
105
|
+
kind: "loading" | "ready" | "detected" | "error"
|
|
106
|
+
phrase: string
|
|
107
|
+
/** Unix epoch milliseconds. */
|
|
108
|
+
timestamp: number
|
|
109
|
+
message?: string
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Phone-side speech activity from the on-device Silero detector
|
|
114
|
+
* ([setSpeechActivityDetection]). Sent on transitions only. A gap in incoming
|
|
115
|
+
* microphone audio counts as silence.
|
|
116
|
+
*/
|
|
117
|
+
export type SpeechActivityEvent = {
|
|
118
|
+
speaking: boolean
|
|
119
|
+
/** 0 while speaking; on a silence transition, how long the audio has been silent. */
|
|
120
|
+
silentForMs: number
|
|
121
|
+
/** Unix epoch milliseconds. */
|
|
122
|
+
timestamp: number
|
|
123
|
+
}
|
|
124
|
+
|
|
103
125
|
export type LocalTranscriptionEvent = {
|
|
104
126
|
text: string
|
|
105
127
|
isFinal?: boolean
|
|
@@ -876,9 +898,69 @@ export type StreamKeepAliveRequest = {
|
|
|
876
898
|
ackId: string
|
|
877
899
|
}
|
|
878
900
|
|
|
901
|
+
/**
|
|
902
|
+
* Stable machine-readable `pair_failure` causes. Unknown native codes still typecheck.
|
|
903
|
+
* `ios_forget_pairing`: iOS holds a stale Bluetooth pairing for these glasses during an
|
|
904
|
+
* explicit attempt; the user must remove it in Settings > Bluetooth before pairing again.
|
|
905
|
+
*/
|
|
906
|
+
export type PairFailureCode = "ios_forget_pairing" | string
|
|
907
|
+
|
|
879
908
|
export type PairFailureEvent = {
|
|
880
909
|
type: "pair_failure"
|
|
881
910
|
error: string
|
|
911
|
+
/** Stable cause, when the SDK can classify the failure. */
|
|
912
|
+
code?: PairFailureCode
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* Mentra Live pairing state, owned by the SDK.
|
|
917
|
+
* - `normal`: no pairing mode in effect; automatic reconnect is allowed.
|
|
918
|
+
* - `pairing_mode`: the glasses opened a pairing window. Automatic reconnect is paused until
|
|
919
|
+
* `endsAtMs` or until the glasses report the window ended. `windowId` identifies the
|
|
920
|
+
* window and survives a cold restart.
|
|
921
|
+
* - `pairing_rejected`: the glasses no longer accept this phone (another phone paired, or repeated
|
|
922
|
+
* authentication rejections on secure-pairing firmware). Reconnect has stopped. Render Pair Again.
|
|
923
|
+
*/
|
|
924
|
+
export type MentraLivePairingState =
|
|
925
|
+
| {state: "normal"}
|
|
926
|
+
| {state: "pairing_mode"; windowId: number; endsAtMs: number}
|
|
927
|
+
| {state: "pairing_rejected"}
|
|
928
|
+
|
|
929
|
+
export type PairingStateChangedEvent = {
|
|
930
|
+
state: MentraLivePairingState
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
/**
|
|
934
|
+
* Whether the user has to do anything to get glasses audio working, decided by the SDK for
|
|
935
|
+
* every glasses model. Render it; do not add your own audio timers or platform checks.
|
|
936
|
+
*
|
|
937
|
+
* - `idle`: no glasses session.
|
|
938
|
+
* - `not_applicable`: no user step for audio. Android attaches Classic audio from the BLE bond,
|
|
939
|
+
* and glasses without Classic audio have nothing to set up.
|
|
940
|
+
* - `connecting`: the glasses are connected, audio is not, and the SDK still expects audio to
|
|
941
|
+
* come up on its own (for example iPhone audio derived from the BLE pair). After setup, Mentra
|
|
942
|
+
* Live firmware that reports `classic_link` reconnects audio itself and stays here.
|
|
943
|
+
* - `connected`: Classic audio (A2DP or HFP) to the glasses is up.
|
|
944
|
+
* - `needs_user`: audio did not come up on its own. Ask the user to connect the glasses in the
|
|
945
|
+
* system Bluetooth settings (iPhone: Settings > Bluetooth). The state moves to `connected`
|
|
946
|
+
* as soon as audio comes up.
|
|
947
|
+
*/
|
|
948
|
+
export type GlassesAudioSetupState =
|
|
949
|
+
| {state: "idle"}
|
|
950
|
+
| {state: "not_applicable"}
|
|
951
|
+
| {state: "connecting"}
|
|
952
|
+
| {state: "connected"}
|
|
953
|
+
| {state: "needs_user"; action: "connect_in_settings"}
|
|
954
|
+
|
|
955
|
+
export type AudioSetupChangedEvent = {
|
|
956
|
+
state: GlassesAudioSetupState
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
export type PairingModeEndedReason = "paired" | "cancelled" | "timeout" | string
|
|
960
|
+
|
|
961
|
+
export type PairingModeEndedEvent = {
|
|
962
|
+
reason: PairingModeEndedReason
|
|
963
|
+
window_id?: number
|
|
882
964
|
}
|
|
883
965
|
|
|
884
966
|
export type PairingInfoEvent = {
|
|
@@ -887,13 +969,27 @@ export type PairingInfoEvent = {
|
|
|
887
969
|
classic_bond_ready?: boolean
|
|
888
970
|
secure_pairing_capable?: boolean
|
|
889
971
|
protocol_version?: number
|
|
972
|
+
/** Present when the glasses build includes ownership transfer. */
|
|
973
|
+
ownership_transfer?: boolean
|
|
974
|
+
/** True when the glasses derive Classic audio from the LE pair (CTKD), so audio should connect on its own. */
|
|
975
|
+
auto_audio?: boolean
|
|
976
|
+
/** True only after a BLE bond committed the owner and the window closed. */
|
|
977
|
+
owner_committed?: boolean
|
|
890
978
|
}
|
|
891
979
|
|
|
892
980
|
export type EnteringPairingModeEvent = {
|
|
893
981
|
window_ms: number
|
|
982
|
+
/** Identifies this pairing window. Also carried in `pairing_mode_ended` and the advertisement. */
|
|
983
|
+
window_id?: number
|
|
894
984
|
reason?: string
|
|
985
|
+
/** The glasses kept their bonds when the window opened; they change only if another phone pairs. */
|
|
986
|
+
owner_retained?: boolean
|
|
895
987
|
}
|
|
896
988
|
|
|
989
|
+
/**
|
|
990
|
+
* @deprecated No longer emitted. Observe `pairing_state_changed` (or `GlassesStatus.pairingState`)
|
|
991
|
+
* and render Pair Again for `pairing_rejected`.
|
|
992
|
+
*/
|
|
897
993
|
export type OwnerReplacedEvent = {
|
|
898
994
|
reason: string
|
|
899
995
|
}
|
|
@@ -1119,6 +1215,54 @@ export type OtaStatusEvent = {
|
|
|
1119
1215
|
|
|
1120
1216
|
export type OtaQueryResult = OtaStatusEvent
|
|
1121
1217
|
|
|
1218
|
+
/** Lifecycle of a BES crash incident bundle on Mentra Live glasses. */
|
|
1219
|
+
export type BesCrashIncidentState = "COLLECTING" | "STORED" | "REPORTED" | "UPLOADED" | "EVICTED"
|
|
1220
|
+
|
|
1221
|
+
/** One incident bundle the glasses dropped to stay within their storage budget. */
|
|
1222
|
+
export type BesCrashEviction = {
|
|
1223
|
+
incidentKey: string
|
|
1224
|
+
reason: string
|
|
1225
|
+
bytes: number
|
|
1226
|
+
ms: number
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
/**
|
|
1230
|
+
* Glasses-side summary of a BES crash incident. Fields the glasses could not
|
|
1231
|
+
* determine (for example `dumpId` of a reset without a dump) may be absent or null.
|
|
1232
|
+
*/
|
|
1233
|
+
export type BesCrashSummary = {
|
|
1234
|
+
attribution: "match" | "older" | "unknown"
|
|
1235
|
+
dumpId?: string | null
|
|
1236
|
+
bootId?: string | null
|
|
1237
|
+
resetHw?: number | null
|
|
1238
|
+
resetSw?: number | null
|
|
1239
|
+
crashUnixMs?: number | null
|
|
1240
|
+
coveredFromMs?: number | null
|
|
1241
|
+
coveredToMs?: number | null
|
|
1242
|
+
traceGaps: number
|
|
1243
|
+
truncated: boolean
|
|
1244
|
+
torn: boolean
|
|
1245
|
+
tailCaptured: boolean
|
|
1246
|
+
dumpGap: boolean
|
|
1247
|
+
evictedCount: number
|
|
1248
|
+
recentEvictions: BesCrashEviction[]
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
/**
|
|
1252
|
+
* Mentra Live stored a BES crash or unexpected-reset incident. Sent when the
|
|
1253
|
+
* incident becomes `STORED`, and again on every reconnect while it is `STORED`
|
|
1254
|
+
* or `REPORTED`, so handlers must be idempotent per `incidentKey`.
|
|
1255
|
+
*/
|
|
1256
|
+
export type BesCrashDetectedEvent = {
|
|
1257
|
+
type: "bes_crash_detected"
|
|
1258
|
+
incidentKey: string
|
|
1259
|
+
reason: "bes_crash" | "bes_unexpected_reset"
|
|
1260
|
+
state: BesCrashIncidentState
|
|
1261
|
+
/** Cloud report already recorded for this incident, or null before one is reported. */
|
|
1262
|
+
reportId: string | null
|
|
1263
|
+
summary: BesCrashSummary
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1122
1266
|
/** Nex BLE protobuf trace (NexEventUtils); payload matches native Map keys. */
|
|
1123
1267
|
export type BleCommandTraceEvent = {
|
|
1124
1268
|
command: string
|
|
@@ -1150,6 +1294,8 @@ export type BluetoothSdkModuleEvents = {
|
|
|
1150
1294
|
voice_activity_detection_status: (event: VoiceActivityDetectionStatusEvent) => void
|
|
1151
1295
|
speaking_status: (event: SpeakingStatusEvent) => void
|
|
1152
1296
|
battery_status: (event: BatteryStatusEvent) => void
|
|
1297
|
+
wake_word: (event: WakeWordEvent) => void
|
|
1298
|
+
speech_activity: (event: SpeechActivityEvent) => void
|
|
1153
1299
|
local_transcription: (event: LocalTranscriptionEvent) => void
|
|
1154
1300
|
native_notification_status: (event: NativeNotificationStatus) => void
|
|
1155
1301
|
native_notification_delivery: (event: NativeNotificationDelivery) => void
|
|
@@ -1182,6 +1328,10 @@ export type BluetoothSdkModuleEvents = {
|
|
|
1182
1328
|
pair_failure: (event: PairFailureEvent) => void
|
|
1183
1329
|
pairing_info: (event: PairingInfoEvent) => void
|
|
1184
1330
|
entering_pairing_mode: (event: EnteringPairingModeEvent) => void
|
|
1331
|
+
pairing_mode_ended: (event: PairingModeEndedEvent) => void
|
|
1332
|
+
pairing_state_changed: (event: PairingStateChangedEvent) => void
|
|
1333
|
+
audio_setup_changed: (event: AudioSetupChangedEvent) => void
|
|
1334
|
+
/** @deprecated No longer emitted. Use `pairing_state_changed`. */
|
|
1185
1335
|
owner_replaced: (event: OwnerReplacedEvent) => void
|
|
1186
1336
|
audio_pairing_needed: (event: AudioPairingNeededEvent) => void
|
|
1187
1337
|
audio_connected: (event: AudioConnectedEvent) => void
|
|
@@ -1199,6 +1349,7 @@ export type BluetoothSdkModuleEvents = {
|
|
|
1199
1349
|
ota_start_ack: (event: OtaStartAckEvent) => void
|
|
1200
1350
|
ota_status: (event: OtaStatusEvent) => void
|
|
1201
1351
|
ar99_ota_status: (event: Ar99OtaStatusEvent) => void
|
|
1352
|
+
bes_crash_detected: (event: BesCrashDetectedEvent) => void
|
|
1202
1353
|
version_info: (event: VersionInfoEvent) => void
|
|
1203
1354
|
send_command_to_ble: (event: BleCommandTraceEvent) => void
|
|
1204
1355
|
receive_command_from_ble: (event: BleCommandTraceEvent) => void
|
|
@@ -1320,6 +1471,8 @@ export type BluetoothSdkEventMap = {
|
|
|
1320
1471
|
voice_activity_detection_status: VoiceActivityDetectionStatusEvent
|
|
1321
1472
|
speaking_status: SpeakingStatusEvent
|
|
1322
1473
|
battery_status: BatteryStatusEvent
|
|
1474
|
+
wake_word: WakeWordEvent
|
|
1475
|
+
speech_activity: SpeechActivityEvent
|
|
1323
1476
|
local_transcription: LocalTranscriptionEvent
|
|
1324
1477
|
wifi_status_change: WifiStatusChangeEvent
|
|
1325
1478
|
wifi_scan_result: WifiScanResultEvent
|
|
@@ -1346,6 +1499,10 @@ export type BluetoothSdkEventMap = {
|
|
|
1346
1499
|
pair_failure: PairFailureEvent
|
|
1347
1500
|
pairing_info: PairingInfoEvent
|
|
1348
1501
|
entering_pairing_mode: EnteringPairingModeEvent
|
|
1502
|
+
pairing_mode_ended: PairingModeEndedEvent
|
|
1503
|
+
pairing_state_changed: PairingStateChangedEvent
|
|
1504
|
+
audio_setup_changed: AudioSetupChangedEvent
|
|
1505
|
+
/** @deprecated No longer emitted. Use `pairing_state_changed`. */
|
|
1349
1506
|
owner_replaced: OwnerReplacedEvent
|
|
1350
1507
|
audio_pairing_needed: AudioPairingNeededEvent
|
|
1351
1508
|
audio_connected: AudioConnectedEvent
|
|
@@ -1361,6 +1518,8 @@ export type BluetoothSdkEventMap = {
|
|
|
1361
1518
|
ota_start_ack: OtaStartAckEvent
|
|
1362
1519
|
ota_status: OtaStatusEvent
|
|
1363
1520
|
ar99_ota_status: Ar99OtaStatusEvent
|
|
1521
|
+
/** Mentra Live stored a BES crash incident for the phone to report. */
|
|
1522
|
+
bes_crash_detected: BesCrashDetectedEvent
|
|
1364
1523
|
version_info: VersionInfoEvent
|
|
1365
1524
|
extraction_progress: ExtractionProgressEvent
|
|
1366
1525
|
}
|
|
@@ -1430,7 +1589,9 @@ export interface BluetoothSdkPublicModule {
|
|
|
1430
1589
|
/** Set the glasses clock from the phone after an OTA clock-skew failure. */
|
|
1431
1590
|
setSystemTime(timestampMs: number): Promise<void>
|
|
1432
1591
|
/** Enable or disable Wi-Fi ADB on Mentra Live (no-op on other devices). */
|
|
1433
|
-
|
|
1592
|
+
/** When supplied, binds native admission to this full MAC observed in the current BLE session.
|
|
1593
|
+
* Resolves on queue admission, without confirming glasses-side state. */
|
|
1594
|
+
setWifiAdbState(enabled: boolean, expectedBluetoothMac?: string): Promise<void>
|
|
1434
1595
|
|
|
1435
1596
|
/**
|
|
1436
1597
|
* Persistently enable/disable unauthenticated HTTP gallery access on the glasses' Wi-Fi.
|
|
@@ -1564,7 +1725,30 @@ export interface BluetoothSdkPublicModule {
|
|
|
1564
1725
|
checkSttModelAvailable(): Promise<boolean>
|
|
1565
1726
|
validateSttModel(path: string): Promise<boolean>
|
|
1566
1727
|
extractTarBz2(sourcePath: string, destinationPath: string): Promise<boolean>
|
|
1728
|
+
/**
|
|
1729
|
+
* Start or stop on-device keyword spotting on microphone PCM. `modelDir` must contain
|
|
1730
|
+
* `encoder.int8.onnx`, `decoder.onnx`, `joiner.int8.onnx`, `tokens.txt` and `keywords.txt`;
|
|
1731
|
+
* it is required when enabling. Disabling releases the model.
|
|
1732
|
+
*/
|
|
1733
|
+
setWakeWordDetection(enabled: boolean, modelDir?: string | null): Promise<void>
|
|
1734
|
+
/**
|
|
1735
|
+
* Finalize the active on-device recognizer's current utterance now. Resolves after the final
|
|
1736
|
+
* `local_transcription` event for it has been emitted, with that final text (empty when nothing
|
|
1737
|
+
* was pending). Resolves `null` when no streaming model is active or the loaded model can't
|
|
1738
|
+
* finalize early.
|
|
1739
|
+
*/
|
|
1740
|
+
finishTranscription(): Promise<string | null>
|
|
1741
|
+
/**
|
|
1742
|
+
* Reload the selected speech model when on-device transcription is in demand. Resolves after
|
|
1743
|
+
* it is loaded; rejects when loading fails; resolves immediately when there is no demand.
|
|
1744
|
+
*/
|
|
1567
1745
|
restartTranscriber(): Promise<void>
|
|
1746
|
+
/**
|
|
1747
|
+
* Start or stop the on-device Silero speech detector on microphone PCM. While enabled it emits
|
|
1748
|
+
* `speech_activity` transitions; `minSilenceMs` (default 300) is the quiet gap before a silence
|
|
1749
|
+
* transition. Disabling releases the model.
|
|
1750
|
+
*/
|
|
1751
|
+
setSpeechActivityDetection(enabled: boolean, options?: {minSilenceMs?: number}): Promise<void>
|
|
1568
1752
|
|
|
1569
1753
|
// TTS Commands (TODO: MOVE TO CRUST)
|
|
1570
1754
|
setTtsModelDetails(path: string, languageCode: string): Promise<void>
|
|
@@ -1637,6 +1821,10 @@ export interface GlassesStatus {
|
|
|
1637
1821
|
micEnabled: boolean
|
|
1638
1822
|
voiceActivityDetectionEnabled: boolean
|
|
1639
1823
|
bluetoothClassicConnected: boolean
|
|
1824
|
+
/** iOS: an HFP input is available or a matching Bluetooth output is active. Android: same as `bluetoothClassicConnected`. */
|
|
1825
|
+
bluetoothClassicProfilesConnected: boolean
|
|
1826
|
+
/** iOS: a matching Bluetooth output is the active audio route. Android: same as `bluetoothClassicConnected`. */
|
|
1827
|
+
bluetoothAudioRouted: boolean
|
|
1640
1828
|
signalStrength: number
|
|
1641
1829
|
/** Milliseconds since epoch when signalStrength was last refreshed by the phone BLE stack. */
|
|
1642
1830
|
signalStrengthUpdatedAt: number
|
|
@@ -1651,6 +1839,10 @@ export interface GlassesStatus {
|
|
|
1651
1839
|
leftMacAddress: string
|
|
1652
1840
|
rightMacAddress: string
|
|
1653
1841
|
buildNumber: string
|
|
1842
|
+
/** Mentra Live pairing state owned by the SDK. Absent on other models. */
|
|
1843
|
+
pairingState?: MentraLivePairingState
|
|
1844
|
+
/** Audio setup state owned by the SDK, on every model. See `GlassesAudioSetupState`. */
|
|
1845
|
+
audioSetup?: GlassesAudioSetupState
|
|
1654
1846
|
/** Glasses System.currentTimeMillis() from last version_info (clock skew detection). */
|
|
1655
1847
|
systemTimeMs?: number
|
|
1656
1848
|
otaVersionUrl: string
|
|
@@ -1745,6 +1937,14 @@ export interface ConnectOptions {
|
|
|
1745
1937
|
* Android accepts this option as a no-op.
|
|
1746
1938
|
*/
|
|
1747
1939
|
requiresAncs?: boolean
|
|
1940
|
+
/**
|
|
1941
|
+
* iOS Mentra Live only. When true, CoreBluetooth is asked to bring up the
|
|
1942
|
+
* Classic profiles (A2DP/HFP) after the BLE connection
|
|
1943
|
+
* (CBConnectPeripheralOptionEnableTransportBridgingKey). Defaults to true:
|
|
1944
|
+
* without it the pairing screen waits for an audio route that never appears.
|
|
1945
|
+
* Android accepts this option as a no-op.
|
|
1946
|
+
*/
|
|
1947
|
+
enableTransportBridging?: boolean
|
|
1748
1948
|
}
|
|
1749
1949
|
|
|
1750
1950
|
export type ScanResultsCallback = (devices: Device[]) => void
|
|
@@ -97,6 +97,8 @@ declare class BluetoothSdkNativeModule extends NativeModule<BluetoothSdkModuleEv
|
|
|
97
97
|
connectDefaultWithOptions(options: Required<ConnectOptions>): Promise<void>
|
|
98
98
|
setDefaultDevice(device: Device | null): Promise<void>
|
|
99
99
|
clearDefaultDevice(): Promise<void>
|
|
100
|
+
/** Android only: iOS cannot read its Bluetooth bonds. */
|
|
101
|
+
getBondedGlasses?: () => Promise<{name: string; address: string} | null>
|
|
100
102
|
getScanDiagnostic?: (model: DeviceModel) => Promise<ScanDiagnostic | null>
|
|
101
103
|
startScan(model: DeviceModel): Promise<void>
|
|
102
104
|
stopScan(): Promise<void>
|
|
@@ -128,6 +130,12 @@ declare class BluetoothSdkNativeModule extends NativeModule<BluetoothSdkModuleEv
|
|
|
128
130
|
|
|
129
131
|
// Incident Reporting
|
|
130
132
|
sendIncidentId(incidentId: string, apiBaseUrl?: string | null): Promise<void>
|
|
133
|
+
/**
|
|
134
|
+
* Tell Mentra Live that Cloud recorded `reportId` for the BES crash incident
|
|
135
|
+
* `incidentKey`. Resolves only on the glasses' matching `ok:true` ack; rejects
|
|
136
|
+
* on `ok:false`, disconnect, or after 10 s. Call `sendIncidentId` only after it resolves.
|
|
137
|
+
*/
|
|
138
|
+
sendBesCrashReported(incidentKey: string, reportId: string): Promise<void>
|
|
131
139
|
|
|
132
140
|
// WiFi Commands
|
|
133
141
|
requestWifiScan(): Promise<WifiSearchResult[]>
|
|
@@ -136,7 +144,7 @@ declare class BluetoothSdkNativeModule extends NativeModule<BluetoothSdkModuleEv
|
|
|
136
144
|
forgetWifiNetwork(ssid: string): Promise<WifiForgetResult>
|
|
137
145
|
setHotspotState(enabled: boolean): Promise<HotspotStatusChangeEvent>
|
|
138
146
|
/** Enable or disable Wi-Fi ADB on Mentra Live (no-op on other devices). */
|
|
139
|
-
setWifiAdbState(enabled: boolean): Promise<void>
|
|
147
|
+
setWifiAdbState(enabled: boolean, expectedBluetoothMac?: string): Promise<void>
|
|
140
148
|
/** Set the glasses system clock when phone detects clock skew (Mentra Live and G2). */
|
|
141
149
|
setSystemTime(timestampMs: number): Promise<void>
|
|
142
150
|
/** Logs current WiFi frequency (MHz) and 5 GHz band to Android logcat. */
|
|
@@ -257,7 +265,16 @@ declare class BluetoothSdkNativeModule extends NativeModule<BluetoothSdkModuleEv
|
|
|
257
265
|
* so a caller that depends on the guarantee must gate on platform.
|
|
258
266
|
*/
|
|
259
267
|
setMicSourcePin(source: string | null): Promise<void>
|
|
268
|
+
/** See the public `setWakeWordDetection`. `modelDir` is required when enabling. */
|
|
269
|
+
setWakeWordDetection(enabled: boolean, modelDir?: string | null): Promise<void>
|
|
270
|
+
/** Whether the active recognizer has `path` loaded. Never blocks on a model load. */
|
|
271
|
+
isSttModelLoaded(path: string): Promise<boolean>
|
|
272
|
+
/** See the public `finishTranscription`. */
|
|
273
|
+
finishTranscription(): Promise<string | null>
|
|
274
|
+
/** See the public `restartTranscriber`. */
|
|
260
275
|
restartTranscriber(): Promise<void>
|
|
276
|
+
/** See the public `setSpeechActivityDetection`. */
|
|
277
|
+
setSpeechActivityDetection(enabled: boolean, options?: {minSilenceMs?: number}): Promise<void>
|
|
261
278
|
|
|
262
279
|
// Audio Playback Monitoring
|
|
263
280
|
// Notify native side when our app starts/stops playing audio
|
|
@@ -271,10 +288,15 @@ declare class BluetoothSdkNativeModule extends NativeModule<BluetoothSdkModuleEv
|
|
|
271
288
|
/**
|
|
272
289
|
* Open a PCM stream session. One AudioTrack per id; caller manages ids.
|
|
273
290
|
*
|
|
274
|
-
* `jitterMs`
|
|
275
|
-
*
|
|
276
|
-
*
|
|
277
|
-
*
|
|
291
|
+
* `jitterMs` (default 500) is how much audio is queued before playback starts, and the playout
|
|
292
|
+
* cushion after that. Omit it for one-way media, where the default cushion is inaudible; pass a
|
|
293
|
+
* small value for conversational audio, where the same cushion is delay before the far end is
|
|
294
|
+
* heard. Both platforms honor it: playback starts once `jitterMs` is queued or the stream is
|
|
295
|
+
* closed, so a sound shorter than `jitterMs` still plays.
|
|
296
|
+
*
|
|
297
|
+
* A stream that has not received audio yet is aborted when the audio route changes (Bluetooth
|
|
298
|
+
* or glasses connect/disconnect, a call starting or ending, an audio-session interruption), so
|
|
299
|
+
* its next write rejects with "stream not open" instead of playing on a stale route.
|
|
278
300
|
*/
|
|
279
301
|
pcmStreamOpen(
|
|
280
302
|
streamId: string,
|
|
@@ -293,6 +315,21 @@ declare class BluetoothSdkNativeModule extends NativeModule<BluetoothSdkModuleEv
|
|
|
293
315
|
pcmStreamClose(streamId: string): Promise<{durationMs: number}>
|
|
294
316
|
/** Stop immediately, dropping any backlog. Idempotent. */
|
|
295
317
|
pcmStreamAbort(streamId: string): Promise<void>
|
|
318
|
+
/**
|
|
319
|
+
* Fetch `url` (HTTP GET) and play its body as raw 16-bit little-endian mono PCM at `sampleRate`
|
|
320
|
+
* while it downloads, through the same stream player as `pcmStreamOpen`. Native code reads the
|
|
321
|
+
* body; audio never crosses into JavaScript. Resolves with the played duration after the whole
|
|
322
|
+
* body has played. Rejects on a non-2xx response or a network error (whatever already played
|
|
323
|
+
* stays played), and with "aborted" after `pcmStreamAbort(streamId)`. Must not block the shared
|
|
324
|
+
* module queue while it runs.
|
|
325
|
+
*/
|
|
326
|
+
pcmStreamPlayUrl(
|
|
327
|
+
streamId: string,
|
|
328
|
+
url: string,
|
|
329
|
+
sampleRate: number,
|
|
330
|
+
volume: number,
|
|
331
|
+
jitterMs?: number,
|
|
332
|
+
): Promise<{durationMs: number}>
|
|
296
333
|
|
|
297
334
|
/** Mentra Live only: K900 `cs_getvol` / `sr_getvol`. */
|
|
298
335
|
getGlassesMediaVolume(): Promise<GlassesMediaVolumeGetResult>
|
|
@@ -358,6 +395,7 @@ const DEFAULT_CONNECT_OPTIONS: Required<ConnectOptions> = {
|
|
|
358
395
|
saveAsDefault: true,
|
|
359
396
|
cancelExistingConnectionAttempt: true,
|
|
360
397
|
requiresAncs: true,
|
|
398
|
+
enableTransportBridging: true,
|
|
361
399
|
}
|
|
362
400
|
|
|
363
401
|
const DEFAULT_SCAN_TIMEOUT_MS = 15_000
|
|
@@ -752,5 +790,9 @@ NativeBluetoothSdkModule.requestWearTuning = bindNativeMethod<() => Promise<void
|
|
|
752
790
|
)
|
|
753
791
|
NativeBluetoothSdkModule.resetWearTuning = bindNativeMethod<() => Promise<void>>(nativeWearModule, "resetWearTuning")
|
|
754
792
|
|
|
793
|
+
NativeBluetoothSdkModule.sendBesCrashReported = bindNativeMethod<
|
|
794
|
+
(incidentKey: string, reportId: string) => Promise<void>
|
|
795
|
+
>(NativeBluetoothSdkModule as unknown as Record<string, unknown>, "sendBesCrashReported")
|
|
796
|
+
|
|
755
797
|
export default NativeBluetoothSdkModule
|
|
756
798
|
export const BluetoothSdk = NativeBluetoothSdkModule as BluetoothSdkInternalModule
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/** Generated from /changelogs. Do not edit directly. */
|
|
2
2
|
export const GENERATED_RELEASE_CHANGELOGS = Object.freeze(
|
|
3
3
|
[
|
|
4
|
+
{
|
|
5
|
+
"version": "3.4.0",
|
|
6
|
+
"markdown": "This release is under active development. User-facing changes will be documented as they land."
|
|
7
|
+
},
|
|
4
8
|
{
|
|
5
9
|
"version": "3.3.0",
|
|
6
10
|
"markdown": "- **Mentra Call:** Now available on iPhone, with a redesigned call screen and photo sharing during calls.\n- **Microphone:** Improved glasses microphone reliability, including after phone calls.\n- **Photos and gallery:** More reliable photo capture and gallery syncing.\n- **Glasses updates:** More reliable glasses updates, with clearer progress.\n- **Miniapps:** Miniapps now update automatically. Fixed miniapps getting stuck on loading screens.\n- **Mentra AI:** Reliability improvements and bug fixes.\n- **Notes:** Take photos with the glasses camera button, and add meeting and location details to your notes.\n- **Pairing and connections:** Improved glasses audio reconnection on Android.\n- **G1 and NIMO:** Improved text display, including accented letters.\n- **Android tablets:** The Mentra App now rotates to landscape."
|