@mentra/bluetooth-sdk 3.3.0-dev.944 → 3.4.0-beta.1237
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 +111 -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 +89 -6
- package/android/src/main/java/com/mentra/bluetoothsdk/Bridge.kt +35 -1
- package/android/src/main/java/com/mentra/bluetoothsdk/DeviceManager.kt +159 -110
- package/android/src/main/java/com/mentra/bluetoothsdk/DeviceStore.kt +21 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/GeneratedChangelogCatalog.kt +2 -1
- package/android/src/main/java/com/mentra/bluetoothsdk/GeneratedReleaseMetadata.kt +6 -6
- package/android/src/main/java/com/mentra/bluetoothsdk/MentraBluetoothSdk.kt +35 -2
- package/android/src/main/java/com/mentra/bluetoothsdk/TouchGesture.kt +19 -0
- 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 +1002 -157
- 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/TouchGestureCommandTest.kt +112 -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 +141 -0
- 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/MentraLiveRgbLedResponseTest.kt +76 -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 +207 -2
- package/build/BluetoothSdk.types.d.ts.map +1 -1
- package/build/BluetoothSdk.types.js.map +1 -1
- package/build/_private/BluetoothSdkModule.d.ts +45 -6
- 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 +4 -1
- package/build/generated/changelogCatalog.d.ts.map +1 -1
- package/build/generated/changelogCatalog.js +5 -1
- 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 +10 -0
- package/build/index.js.map +1 -1
- package/ios/BluetoothSdkModule.swift +84 -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 +135 -18
- package/ios/Source/DeviceStore.swift +27 -0
- package/ios/Source/GeneratedChangelogCatalog.swift +2 -1
- package/ios/Source/GeneratedReleaseMetadata.swift +6 -6
- package/ios/Source/MentraBluetoothSDK.swift +51 -5
- package/ios/Source/TouchGesture.swift +13 -0
- 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 +45 -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 +1366 -212
- 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/MentraLiveCommandQueueTests.swift +35 -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 +497 -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/TouchGestureCommandTests.swift +87 -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 +216 -1
- package/src/_private/BluetoothSdkModule.ts +49 -5
- package/src/generated/changelogCatalog.ts +5 -1
- package/src/generated/releaseMetadata.ts +6 -6
- package/src/index.ts +24 -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.1237",
|
|
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.1237"
|
|
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
|
|
@@ -584,9 +606,20 @@ export type RgbLedControlResponseEvent =
|
|
|
584
606
|
|
|
585
607
|
export type RgbLedControlSuccessResponseEvent = Extract<RgbLedControlResponseEvent, {state: "success"}>
|
|
586
608
|
|
|
609
|
+
export type TouchGesture =
|
|
610
|
+
| "single_tap"
|
|
611
|
+
| "double_tap"
|
|
612
|
+
| "triple_tap"
|
|
613
|
+
| "long_press"
|
|
614
|
+
| "forward_swipe"
|
|
615
|
+
| "backward_swipe"
|
|
616
|
+
| "up_swipe"
|
|
617
|
+
| "down_swipe"
|
|
618
|
+
|
|
587
619
|
export type SettingsAckStatus = "applied" | "ready" | "error" | "failed" | "failure" | "rejected"
|
|
588
620
|
|
|
589
621
|
export type SettingsAckSetting =
|
|
622
|
+
| "touch_gesture_default"
|
|
590
623
|
| "gallery_server"
|
|
591
624
|
| "gallery_mode"
|
|
592
625
|
| "button_photo"
|
|
@@ -600,6 +633,8 @@ export type SettingsAckEvent = {
|
|
|
600
633
|
type: "settings_ack"
|
|
601
634
|
requestId: string
|
|
602
635
|
setting: SettingsAckSetting
|
|
636
|
+
/** Gesture whose stock behavior was changed; present for touch_gesture_default. */
|
|
637
|
+
gesture?: TouchGesture
|
|
603
638
|
status: SettingsAckStatus
|
|
604
639
|
timestamp: number
|
|
605
640
|
fov?: number
|
|
@@ -863,9 +898,69 @@ export type StreamKeepAliveRequest = {
|
|
|
863
898
|
ackId: string
|
|
864
899
|
}
|
|
865
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
|
+
|
|
866
908
|
export type PairFailureEvent = {
|
|
867
909
|
type: "pair_failure"
|
|
868
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
|
|
869
964
|
}
|
|
870
965
|
|
|
871
966
|
export type PairingInfoEvent = {
|
|
@@ -874,13 +969,27 @@ export type PairingInfoEvent = {
|
|
|
874
969
|
classic_bond_ready?: boolean
|
|
875
970
|
secure_pairing_capable?: boolean
|
|
876
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
|
|
877
978
|
}
|
|
878
979
|
|
|
879
980
|
export type EnteringPairingModeEvent = {
|
|
880
981
|
window_ms: number
|
|
982
|
+
/** Identifies this pairing window. Also carried in `pairing_mode_ended` and the advertisement. */
|
|
983
|
+
window_id?: number
|
|
881
984
|
reason?: string
|
|
985
|
+
/** The glasses kept their bonds when the window opened; they change only if another phone pairs. */
|
|
986
|
+
owner_retained?: boolean
|
|
882
987
|
}
|
|
883
988
|
|
|
989
|
+
/**
|
|
990
|
+
* @deprecated No longer emitted. Observe `pairing_state_changed` (or `GlassesStatus.pairingState`)
|
|
991
|
+
* and render Pair Again for `pairing_rejected`.
|
|
992
|
+
*/
|
|
884
993
|
export type OwnerReplacedEvent = {
|
|
885
994
|
reason: string
|
|
886
995
|
}
|
|
@@ -1106,6 +1215,54 @@ export type OtaStatusEvent = {
|
|
|
1106
1215
|
|
|
1107
1216
|
export type OtaQueryResult = OtaStatusEvent
|
|
1108
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
|
+
|
|
1109
1266
|
/** Nex BLE protobuf trace (NexEventUtils); payload matches native Map keys. */
|
|
1110
1267
|
export type BleCommandTraceEvent = {
|
|
1111
1268
|
command: string
|
|
@@ -1137,6 +1294,8 @@ export type BluetoothSdkModuleEvents = {
|
|
|
1137
1294
|
voice_activity_detection_status: (event: VoiceActivityDetectionStatusEvent) => void
|
|
1138
1295
|
speaking_status: (event: SpeakingStatusEvent) => void
|
|
1139
1296
|
battery_status: (event: BatteryStatusEvent) => void
|
|
1297
|
+
wake_word: (event: WakeWordEvent) => void
|
|
1298
|
+
speech_activity: (event: SpeechActivityEvent) => void
|
|
1140
1299
|
local_transcription: (event: LocalTranscriptionEvent) => void
|
|
1141
1300
|
native_notification_status: (event: NativeNotificationStatus) => void
|
|
1142
1301
|
native_notification_delivery: (event: NativeNotificationDelivery) => void
|
|
@@ -1169,6 +1328,10 @@ export type BluetoothSdkModuleEvents = {
|
|
|
1169
1328
|
pair_failure: (event: PairFailureEvent) => void
|
|
1170
1329
|
pairing_info: (event: PairingInfoEvent) => void
|
|
1171
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`. */
|
|
1172
1335
|
owner_replaced: (event: OwnerReplacedEvent) => void
|
|
1173
1336
|
audio_pairing_needed: (event: AudioPairingNeededEvent) => void
|
|
1174
1337
|
audio_connected: (event: AudioConnectedEvent) => void
|
|
@@ -1186,6 +1349,7 @@ export type BluetoothSdkModuleEvents = {
|
|
|
1186
1349
|
ota_start_ack: (event: OtaStartAckEvent) => void
|
|
1187
1350
|
ota_status: (event: OtaStatusEvent) => void
|
|
1188
1351
|
ar99_ota_status: (event: Ar99OtaStatusEvent) => void
|
|
1352
|
+
bes_crash_detected: (event: BesCrashDetectedEvent) => void
|
|
1189
1353
|
version_info: (event: VersionInfoEvent) => void
|
|
1190
1354
|
send_command_to_ble: (event: BleCommandTraceEvent) => void
|
|
1191
1355
|
receive_command_from_ble: (event: BleCommandTraceEvent) => void
|
|
@@ -1307,6 +1471,8 @@ export type BluetoothSdkEventMap = {
|
|
|
1307
1471
|
voice_activity_detection_status: VoiceActivityDetectionStatusEvent
|
|
1308
1472
|
speaking_status: SpeakingStatusEvent
|
|
1309
1473
|
battery_status: BatteryStatusEvent
|
|
1474
|
+
wake_word: WakeWordEvent
|
|
1475
|
+
speech_activity: SpeechActivityEvent
|
|
1310
1476
|
local_transcription: LocalTranscriptionEvent
|
|
1311
1477
|
wifi_status_change: WifiStatusChangeEvent
|
|
1312
1478
|
wifi_scan_result: WifiScanResultEvent
|
|
@@ -1333,6 +1499,10 @@ export type BluetoothSdkEventMap = {
|
|
|
1333
1499
|
pair_failure: PairFailureEvent
|
|
1334
1500
|
pairing_info: PairingInfoEvent
|
|
1335
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`. */
|
|
1336
1506
|
owner_replaced: OwnerReplacedEvent
|
|
1337
1507
|
audio_pairing_needed: AudioPairingNeededEvent
|
|
1338
1508
|
audio_connected: AudioConnectedEvent
|
|
@@ -1348,6 +1518,8 @@ export type BluetoothSdkEventMap = {
|
|
|
1348
1518
|
ota_start_ack: OtaStartAckEvent
|
|
1349
1519
|
ota_status: OtaStatusEvent
|
|
1350
1520
|
ar99_ota_status: Ar99OtaStatusEvent
|
|
1521
|
+
/** Mentra Live stored a BES crash incident for the phone to report. */
|
|
1522
|
+
bes_crash_detected: BesCrashDetectedEvent
|
|
1351
1523
|
version_info: VersionInfoEvent
|
|
1352
1524
|
extraction_progress: ExtractionProgressEvent
|
|
1353
1525
|
}
|
|
@@ -1417,7 +1589,9 @@ export interface BluetoothSdkPublicModule {
|
|
|
1417
1589
|
/** Set the glasses clock from the phone after an OTA clock-skew failure. */
|
|
1418
1590
|
setSystemTime(timestampMs: number): Promise<void>
|
|
1419
1591
|
/** Enable or disable Wi-Fi ADB on Mentra Live (no-op on other devices). */
|
|
1420
|
-
|
|
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>
|
|
1421
1595
|
|
|
1422
1596
|
/**
|
|
1423
1597
|
* Persistently enable/disable unauthenticated HTTP gallery access on the glasses' Wi-Fi.
|
|
@@ -1425,6 +1599,8 @@ export interface BluetoothSdkPublicModule {
|
|
|
1425
1599
|
* Returns saved enabled state plus current listening/url. No Wi-Fi means listening=false.
|
|
1426
1600
|
*/
|
|
1427
1601
|
setGalleryServerEnabled(enabled: boolean): Promise<SettingsAckSuccessEvent>
|
|
1602
|
+
/** Mentra Live only. Keep gesture events; reset stock actions on BLE disconnect. Requires compatible BES firmware. */
|
|
1603
|
+
setTouchGestureDefaultBehaviorEnabled(gesture: TouchGesture, enabled: boolean): Promise<SettingsAckSuccessEvent>
|
|
1428
1604
|
setGalleryModeEnabled(enabled: boolean): Promise<SettingsAckSuccessEvent>
|
|
1429
1605
|
setVoiceActivityDetectionEnabled(enabled: boolean): Promise<void>
|
|
1430
1606
|
setLoudnessGateEnabled(enabled: boolean): Promise<void>
|
|
@@ -1549,7 +1725,30 @@ export interface BluetoothSdkPublicModule {
|
|
|
1549
1725
|
checkSttModelAvailable(): Promise<boolean>
|
|
1550
1726
|
validateSttModel(path: string): Promise<boolean>
|
|
1551
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
|
+
*/
|
|
1552
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>
|
|
1553
1752
|
|
|
1554
1753
|
// TTS Commands (TODO: MOVE TO CRUST)
|
|
1555
1754
|
setTtsModelDetails(path: string, languageCode: string): Promise<void>
|
|
@@ -1622,6 +1821,10 @@ export interface GlassesStatus {
|
|
|
1622
1821
|
micEnabled: boolean
|
|
1623
1822
|
voiceActivityDetectionEnabled: boolean
|
|
1624
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
|
|
1625
1828
|
signalStrength: number
|
|
1626
1829
|
/** Milliseconds since epoch when signalStrength was last refreshed by the phone BLE stack. */
|
|
1627
1830
|
signalStrengthUpdatedAt: number
|
|
@@ -1636,6 +1839,10 @@ export interface GlassesStatus {
|
|
|
1636
1839
|
leftMacAddress: string
|
|
1637
1840
|
rightMacAddress: string
|
|
1638
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
|
|
1639
1846
|
/** Glasses System.currentTimeMillis() from last version_info (clock skew detection). */
|
|
1640
1847
|
systemTimeMs?: number
|
|
1641
1848
|
otaVersionUrl: string
|
|
@@ -1730,6 +1937,14 @@ export interface ConnectOptions {
|
|
|
1730
1937
|
* Android accepts this option as a no-op.
|
|
1731
1938
|
*/
|
|
1732
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
|
|
1733
1948
|
}
|
|
1734
1949
|
|
|
1735
1950
|
export type ScanResultsCallback = (devices: Device[]) => void
|