@mentra/bluetooth-sdk 3.4.0-dev.999 → 3.4.1-beta.1409
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 +16 -7
- package/README.md +41 -14
- package/android/build.gradle +60 -51
- package/android/gradle.properties +3 -0
- package/android/settings.gradle +47 -3
- package/android/src/main/assets/nimo/nimo-firmware-0.1.1.1-537cf1.bin +0 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/BesCrashReportWaiters.kt +68 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/BluetoothSdkDefaults.kt +5 -1
- package/android/src/main/java/com/mentra/bluetoothsdk/BluetoothSdkModule.kt +77 -6
- package/android/src/main/java/com/mentra/bluetoothsdk/Bridge.kt +41 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/DeviceManager.kt +131 -122
- package/android/src/main/java/com/mentra/bluetoothsdk/GeneratedChangelogCatalog.kt +3 -2
- package/android/src/main/java/com/mentra/bluetoothsdk/GeneratedReleaseMetadata.kt +6 -6
- package/android/src/main/java/com/mentra/bluetoothsdk/MentraBluetoothSdk.kt +31 -10
- package/android/src/main/java/com/mentra/bluetoothsdk/MentraLocalNetworkModule.kt +57 -196
- package/android/src/main/java/com/mentra/bluetoothsdk/OtaManifest.kt +1 -16
- package/android/src/main/java/com/mentra/bluetoothsdk/debug/BleTraceLogger.kt +10 -1
- package/android/src/main/java/com/mentra/bluetoothsdk/events/BluetoothEvents.kt +16 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/hotspot/Ipv4Prefix.kt +51 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/hotspot/NetworkFacts.kt +81 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/hotspot/ScopedNetworkError.kt +108 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/hotspot/ScopedNetworkReadiness.kt +103 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/hotspot/ScopedNetworkRequestSpec.kt +44 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/hotspot/ScopedNetworkState.kt +117 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/hotspot/ScopedSoftApNetwork.kt +598 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/hotspot/SoftApTrace.kt +143 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/otaserver/MentraOtaServerModule.kt +0 -7
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/ClassicAudioConnectionTracker.kt +15 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLive.kt +308 -60
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLiveOwnerLossPolicy.kt +14 -5
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/Nimo.kt +210 -325
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/NimoCanvasCoordinator.kt +0 -35
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/NimoCanvasSession.kt +2 -10
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/NimoFirmwareUpdater.kt +213 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/NimoOtaProtocol.kt +112 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/SGCManager.kt +6 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/streaming/StreamModels.kt +17 -6
- 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/StreamRequestCaptureAudioTest.kt +23 -4
- package/android/src/test/java/com/mentra/bluetoothsdk/hotspot/Ipv4PrefixTest.kt +59 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/hotspot/NetworkFactsTest.kt +59 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/hotspot/ScopedLocalNetworkPermissionTest.kt +35 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/hotspot/ScopedNetworkErrorTest.kt +85 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/hotspot/ScopedNetworkLifecycleTest.kt +164 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/hotspot/ScopedNetworkReadinessTest.kt +141 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/hotspot/ScopedNetworkRequestSpecTest.kt +56 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/hotspot/SoftApTraceTest.kt +97 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/hotspot/UnavailableRetryTest.kt +47 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/ClassicAudioConnectionTrackerTest.kt +26 -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 +9 -3
- 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/sgcs/NimoFirmwareTargetTest.kt +15 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/NimoFirmwareUpdaterTest.kt +76 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/NimoOtaProtocolTest.kt +77 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/utils/IncidentLogBleRelayNamingTest.kt +23 -0
- package/android/src/testDebug/java/com/mentra/bluetoothsdk/sgcs/NimoReadinessDriverTest.kt +31 -1
- 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 +103 -5
- package/build/BluetoothSdk.types.d.ts.map +1 -1
- package/build/BluetoothSdk.types.js.map +1 -1
- package/build/_private/BluetoothSdkModule.d.ts +42 -8
- package/build/_private/BluetoothSdkModule.d.ts.map +1 -1
- package/build/_private/BluetoothSdkModule.js +1 -0
- package/build/_private/BluetoothSdkModule.js.map +1 -1
- package/build/_private/MentraLocalNetworkModule.d.ts +1 -1
- package/build/_private/MentraLocalNetworkModule.d.ts.map +1 -1
- package/build/_private/MentraLocalNetworkModule.js.map +1 -1
- package/build/generated/changelogCatalog.d.ts +5 -2
- package/build/generated/changelogCatalog.d.ts.map +1 -1
- package/build/generated/changelogCatalog.js +6 -2
- 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 +7 -1
- package/build/index.js.map +1 -1
- package/build/ota-server/MentraOtaServerModule.d.ts +0 -2
- package/build/ota-server/MentraOtaServerModule.d.ts.map +1 -1
- package/build/ota-server/MentraOtaServerModule.js.map +1 -1
- package/build/ota-server/MentraOtaServerModule.web.d.ts +0 -1
- package/build/ota-server/MentraOtaServerModule.web.d.ts.map +1 -1
- package/build/ota-server/MentraOtaServerModule.web.js +0 -3
- package/build/ota-server/MentraOtaServerModule.web.js.map +1 -1
- package/build/ota-transport/index.d.ts +3 -3
- package/build/ota-transport/index.d.ts.map +1 -1
- package/build/ota-transport/index.js +4 -4
- package/build/ota-transport/index.js.map +1 -1
- package/build/react/useGlassesConnection.d.ts +1 -1
- package/build/react/useGlassesConnection.d.ts.map +1 -1
- package/build/react/useGlassesConnection.js +3 -3
- package/build/react/useGlassesConnection.js.map +1 -1
- package/build/react/useMentraBluetooth.d.ts +1 -1
- package/build/react/useMentraBluetooth.d.ts.map +1 -1
- package/build/react/useMentraBluetooth.js +1 -1
- package/build/react/useMentraBluetooth.js.map +1 -1
- package/ios/BluetoothSdkModule.swift +73 -22
- package/ios/LocalIPv4.swift +0 -61
- package/ios/MentraBluetoothSDK.podspec +7 -1
- package/ios/MentraOtaServerModule.swift +0 -16
- package/ios/Packages/SherpaOnnx/SherpaOnnx.swift +23 -5
- package/ios/Resources/NimoFirmware/nimo-firmware-0.1.1.1-537cf1.bin +0 -0
- package/ios/Resources/SileroVad/silero_vad.onnx +0 -0
- package/ios/Source/BesCrashReportWaiters.swift +64 -0
- package/ios/Source/BluetoothSdkDefaults.swift +4 -4
- package/ios/Source/Bridge.swift +14 -0
- package/ios/Source/DeviceManager.swift +52 -22
- package/ios/Source/GeneratedChangelogCatalog.swift +3 -2
- package/ios/Source/GeneratedReleaseMetadata.swift +6 -6
- package/ios/Source/MentraBluetoothSDK.swift +35 -16
- package/ios/Source/OtaManifest.swift +1 -17
- 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/events/BluetoothEvents.swift +41 -0
- package/ios/Source/internal/BleTraceLogger.swift +14 -1
- package/ios/Source/internal/BluetoothAvailability.swift +15 -5
- package/ios/Source/sgcs/GlassesAudioSetupPolicy.swift +5 -0
- package/ios/Source/sgcs/MentraLive.swift +207 -66
- package/ios/Source/sgcs/Nimo.swift +249 -276
- package/ios/Source/sgcs/NimoCanvasCoordinator.swift +9 -38
- package/ios/Source/sgcs/NimoCanvasSession.swift +0 -1
- package/ios/Source/sgcs/NimoFirmwareUpdater.swift +260 -0
- package/ios/Source/sgcs/NimoOtaProtocol.swift +159 -0
- package/ios/Source/sgcs/SGCManager.swift +6 -0
- package/ios/Source/streaming/StreamModels.swift +15 -6
- 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/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/DemandDrivenAudioWorkerTests.swift +171 -0
- package/ios/Tests/DeviceManagerReconnectTests.swift +0 -71
- package/ios/Tests/GlassesAudioSetupPolicyTests.swift +9 -3
- package/ios/Tests/IncidentLogDispatchTests.swift +158 -0
- package/ios/Tests/MentraLiveAudioSetupTests.swift +6 -12
- package/ios/Tests/MentraLiveCommandQueueTests.swift +35 -0
- package/ios/Tests/MentraLiveSessionReadinessTests.swift +179 -10
- package/ios/Tests/NimoCanvasTransportTests.swift +0 -89
- package/ios/Tests/NimoOtaProtocolTests.swift +78 -0
- package/ios/Tests/PcmStreamTests.swift +299 -0
- package/ios/Tests/SpeechActivityTests.swift +238 -0
- package/ios/Tests/StreamRequestTests.swift +18 -0
- package/ios/Tests/SttModelTraitsTests.swift +62 -0
- package/package.json +2 -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 +107 -5
- package/src/_private/BluetoothSdkModule.ts +45 -8
- package/src/_private/MentraLocalNetworkModule.ts +5 -1
- package/src/generated/changelogCatalog.ts +6 -2
- package/src/generated/releaseMetadata.ts +6 -6
- package/src/index.ts +13 -1
- package/src/ota-server/MentraOtaServerModule.ts +0 -2
- package/src/ota-server/MentraOtaServerModule.web.ts +0 -4
- package/src/ota-transport/index.ts +4 -5
- package/src/react/useGlassesConnection.ts +4 -4
- package/src/react/useMentraBluetooth.ts +2 -2
- 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/debug/java/com/mentra/bluetoothsdk/sgcs/NimoResourceDiagnostics.kt +0 -274
- package/android/src/main/java/com/mentra/bluetoothsdk/ScopedNetworkReadiness.kt +0 -17
- 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/release/java/com/mentra/bluetoothsdk/sgcs/NimoResourceDiagnostics.kt +0 -16
- package/android/src/test/java/com/mentra/bluetoothsdk/ScopedNetworkReadinessTest.kt +0 -39
- 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 -851
- package/ios/Source/sgcs/NimoMacResourceTransport.swift +0 -217
- package/ios/Source/sgcs/NimoResourceFixture.swift +0 -384
- package/ios/Source/sgcs/NimoResourceSession.swift +0 -406
- package/ios/Tests/NimoResourceSessionTests.swift +0 -476
- /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
|
@@ -255,6 +255,33 @@ public class Bridge private constructor() {
|
|
|
255
255
|
sendTypedMessage("speaking_status", body as Map<String, Any>)
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
+
/**
|
|
259
|
+
* Send a phone-side speech activity transition from the on-device Silero detector.
|
|
260
|
+
* [silentForMs] is 0 while speaking; on a silence transition, how long it has been quiet.
|
|
261
|
+
*/
|
|
262
|
+
@JvmStatic
|
|
263
|
+
fun sendSpeechActivity(speaking: Boolean, silentForMs: Long) {
|
|
264
|
+
val body = HashMap<String, Any>()
|
|
265
|
+
body["speaking"] = speaking
|
|
266
|
+
body["silentForMs"] = silentForMs
|
|
267
|
+
body["timestamp"] = System.currentTimeMillis()
|
|
268
|
+
sendTypedMessage("speech_activity", body as Map<String, Any>)
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Send on-device keyword spotter state or a detection. [kind] is "loading", "ready",
|
|
273
|
+
* "detected" or "error"; it describes only the wake-word model.
|
|
274
|
+
*/
|
|
275
|
+
@JvmStatic
|
|
276
|
+
fun sendWakeWord(kind: String, phrase: String, message: String? = null) {
|
|
277
|
+
val body = HashMap<String, Any>()
|
|
278
|
+
body["kind"] = kind
|
|
279
|
+
body["phrase"] = phrase
|
|
280
|
+
body["timestamp"] = System.currentTimeMillis()
|
|
281
|
+
if (message != null) body["message"] = message
|
|
282
|
+
sendTypedMessage("wake_word", body as Map<String, Any>)
|
|
283
|
+
}
|
|
284
|
+
|
|
258
285
|
/** Send battery status */
|
|
259
286
|
@JvmStatic
|
|
260
287
|
fun sendBatteryStatus(level: Int, charging: Boolean) {
|
|
@@ -309,6 +336,20 @@ public class Bridge private constructor() {
|
|
|
309
336
|
DeviceStore.set("bluetooth", "searchResults", uniqueResults)
|
|
310
337
|
}
|
|
311
338
|
|
|
339
|
+
/** Drop glasses from the search results, for example when their pairing window closed. */
|
|
340
|
+
@JvmStatic
|
|
341
|
+
fun removeDiscoveredDevice(deviceModel: String, deviceName: String) {
|
|
342
|
+
val searchResults =
|
|
343
|
+
DeviceStore.store.getCategory("bluetooth")["searchResults"] as? List<*> ?: return
|
|
344
|
+
val remaining =
|
|
345
|
+
searchResults.filterNot { result ->
|
|
346
|
+
val values = result as? Map<*, *>
|
|
347
|
+
values?.get("model") == deviceModel && values["name"] == deviceName
|
|
348
|
+
}
|
|
349
|
+
if (remaining.size == searchResults.size) return
|
|
350
|
+
DeviceStore.set("bluetooth", "searchResults", remaining)
|
|
351
|
+
}
|
|
352
|
+
|
|
312
353
|
private fun mergeStableSearchResults(
|
|
313
354
|
currentResults: List<Map<String, Any>>,
|
|
314
355
|
newResult: Map<String, Any>,
|
|
@@ -23,10 +23,10 @@ import com.mentra.bluetoothsdk.sgcs.SceneElement
|
|
|
23
23
|
import com.mentra.bluetoothsdk.sgcs.SceneFrame
|
|
24
24
|
import com.mentra.bluetoothsdk.sgcs.Mach1
|
|
25
25
|
import com.mentra.bluetoothsdk.sgcs.MentraLive
|
|
26
|
+
import com.mentra.bluetoothsdk.sgcs.MentraLiveOwnerLossPolicy
|
|
26
27
|
import com.mentra.bluetoothsdk.sgcs.MentraLivePairingStateStore
|
|
27
28
|
import com.mentra.bluetoothsdk.sgcs.MentraNex
|
|
28
29
|
import com.mentra.bluetoothsdk.sgcs.Nimo
|
|
29
|
-
import com.mentra.bluetoothsdk.sgcs.NimoResourceDiagnostics
|
|
30
30
|
import com.mentra.bluetoothsdk.sgcs.SGCManager
|
|
31
31
|
import com.mentra.bluetoothsdk.sgcs.Simulated
|
|
32
32
|
import com.mentra.bluetoothsdk.utils.ControllerTypes
|
|
@@ -36,7 +36,11 @@ import com.mentra.bluetoothsdk.utils.MicSourcePin
|
|
|
36
36
|
import com.mentra.bluetoothsdk.utils.MicTypes
|
|
37
37
|
import com.mentra.bluetoothsdk.utils.PhoneAudioMonitor
|
|
38
38
|
import com.mentra.lc3Lib.Lc3Cpp
|
|
39
|
+
import com.mentra.bluetoothsdk.stt.OnDeviceRecognizerHost
|
|
40
|
+
import com.mentra.bluetoothsdk.stt.STTTools
|
|
39
41
|
import com.mentra.bluetoothsdk.stt.SherpaOnnxTranscriber
|
|
42
|
+
import com.mentra.bluetoothsdk.stt.SpeechActivityDetector
|
|
43
|
+
import com.mentra.bluetoothsdk.stt.WakeWordDetector
|
|
40
44
|
import kotlin.coroutines.resume
|
|
41
45
|
import kotlinx.coroutines.suspendCancellableCoroutine
|
|
42
46
|
import kotlinx.coroutines.CoroutineScope
|
|
@@ -46,6 +50,7 @@ import kotlinx.coroutines.launch
|
|
|
46
50
|
import java.text.SimpleDateFormat
|
|
47
51
|
import java.util.*
|
|
48
52
|
import java.util.concurrent.CountDownLatch
|
|
53
|
+
import java.util.concurrent.ExecutionException
|
|
49
54
|
import java.util.concurrent.ExecutorService
|
|
50
55
|
import java.util.concurrent.Executors
|
|
51
56
|
import java.util.concurrent.TimeUnit
|
|
@@ -165,13 +170,6 @@ class DeviceManager internal constructor(initializeHardware: Boolean) {
|
|
|
165
170
|
get() = DeviceStore.store.get("bluetooth", "power_saving_mode") as? Boolean ?: false
|
|
166
171
|
set(value) = DeviceStore.apply("bluetooth", "power_saving_mode", value)
|
|
167
172
|
|
|
168
|
-
// Phone-side VAD gating switch. Default is OFF (VAD runs) so the
|
|
169
|
-
// coordinator can drive per-utterance offline/online STT switching from
|
|
170
|
-
// `vad_status` events. Set to `true` only as an emergency kill-switch.
|
|
171
|
-
private var bypassVad: Boolean
|
|
172
|
-
get() = DeviceStore.store.get("bluetooth", "bypass_vad") as? Boolean ?: false
|
|
173
|
-
set(value) = DeviceStore.apply("bluetooth", "bypass_vad", value)
|
|
174
|
-
|
|
175
173
|
private var localSttFallbackActive: Boolean
|
|
176
174
|
get() = DeviceStore.store.get("bluetooth", "local_stt_fallback_active") as? Boolean ?: false
|
|
177
175
|
set(value) = DeviceStore.apply("bluetooth", "local_stt_fallback_active", value)
|
|
@@ -284,13 +282,23 @@ class DeviceManager internal constructor(initializeHardware: Boolean) {
|
|
|
284
282
|
private var micReinitRunnable: Runnable? = null
|
|
285
283
|
private var systemMicAvailabilityRecheckRunnable: Runnable? = null
|
|
286
284
|
|
|
287
|
-
//
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
private
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
285
|
+
// STT: one recognizer, loaded only while on-device transcription is in demand. Models
|
|
286
|
+
// load on sttLoader (never on the audio thread or under a DeviceManager lock) and are
|
|
287
|
+
// swapped in afterwards; see OnDeviceRecognizerHost.
|
|
288
|
+
private val sttLoader: ExecutorService =
|
|
289
|
+
Executors.newSingleThreadExecutor { runnable ->
|
|
290
|
+
Thread(runnable, "SttModelLoader").apply { isDaemon = true }
|
|
291
|
+
}
|
|
292
|
+
private val transcription =
|
|
293
|
+
OnDeviceRecognizerHost(
|
|
294
|
+
selection = ::selectedSttModel,
|
|
295
|
+
loadModel = ::loadTranscriber,
|
|
296
|
+
pathMatches = { transcriber, path -> transcriber.isModelLoaded(path) },
|
|
297
|
+
// Returns at once; the model is released on its worker after queued audio.
|
|
298
|
+
release = { transcriber -> transcriber.shutdown() },
|
|
299
|
+
loader = sttLoader,
|
|
300
|
+
log = { message -> Bridge.log(message) },
|
|
301
|
+
)
|
|
294
302
|
|
|
295
303
|
// View states
|
|
296
304
|
private val viewStates = mutableListOf<ViewState>()
|
|
@@ -309,7 +317,6 @@ class DeviceManager internal constructor(initializeHardware: Boolean) {
|
|
|
309
317
|
initializeViewStates()
|
|
310
318
|
if (initializeHardware) {
|
|
311
319
|
initializeHardwareServices()
|
|
312
|
-
NimoResourceDiagnostics.start(Bridge.getContext())
|
|
313
320
|
}
|
|
314
321
|
}
|
|
315
322
|
|
|
@@ -336,30 +343,6 @@ class DeviceManager internal constructor(initializeHardware: Boolean) {
|
|
|
336
343
|
lc3DecoderPtr = 0
|
|
337
344
|
}
|
|
338
345
|
|
|
339
|
-
// Initialize phone-side Silero VAD. Used by handlePcm to gate audio
|
|
340
|
-
// fan-out and to drive per-utterance offline/online STT switching
|
|
341
|
-
// (see LocalSttFallbackCoordinator on the JS side). If a previous
|
|
342
|
-
// policy somehow exists (re-init on hot reload), stop it first to
|
|
343
|
-
// release the ONNX session.
|
|
344
|
-
try {
|
|
345
|
-
vadPolicy?.stop()
|
|
346
|
-
val ctx = Bridge.getContext()
|
|
347
|
-
val policy = com.mentra.bluetoothsdk.stt.VadGateSpeechPolicy(ctx)
|
|
348
|
-
policy.init(blockSizeSamples = 512)
|
|
349
|
-
policy.onSpeechStateChanged = { speaking ->
|
|
350
|
-
isSpeaking = speaking
|
|
351
|
-
Bridge.sendVoiceActivityDetectionStatus(speaking)
|
|
352
|
-
}
|
|
353
|
-
vadPolicy = policy
|
|
354
|
-
Bridge.log("VadGateSpeechPolicy initialized")
|
|
355
|
-
} catch (e: Exception) {
|
|
356
|
-
Bridge.log("Failed to initialize VadGateSpeechPolicy: ${e.message}")
|
|
357
|
-
vadPolicy = null
|
|
358
|
-
} catch (e: LinkageError) {
|
|
359
|
-
Bridge.log("Failed to initialize VadGateSpeechPolicy: ${e.message}")
|
|
360
|
-
vadPolicy = null
|
|
361
|
-
}
|
|
362
|
-
|
|
363
346
|
// Mic reinit check every 10 seconds
|
|
364
347
|
val micReinitR =
|
|
365
348
|
object : Runnable {
|
|
@@ -579,8 +562,9 @@ class DeviceManager internal constructor(initializeHardware: Boolean) {
|
|
|
579
562
|
Bridge.log(
|
|
580
563
|
"MAN: Bluetooth restored, attempting reconnect to: $deviceName"
|
|
581
564
|
)
|
|
565
|
+
// A disconnect during the delay still counts.
|
|
582
566
|
handler.postDelayed(
|
|
583
|
-
{ connectDefault() },
|
|
567
|
+
{ if (shouldReconnectAfterBluetoothOn()) connectDefault() },
|
|
584
568
|
2000
|
|
585
569
|
) // Small delay to let BT stack stabilize
|
|
586
570
|
}
|
|
@@ -966,22 +950,15 @@ class DeviceManager internal constructor(initializeHardware: Boolean) {
|
|
|
966
950
|
// #endregion
|
|
967
951
|
|
|
968
952
|
fun handlePcm(pcmData: ByteArray) {
|
|
969
|
-
// Audio always flows. The
|
|
970
|
-
//
|
|
971
|
-
//
|
|
972
|
-
//
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
// VADs server-side. VadGateSpeechPolicy is kept around because
|
|
976
|
-
// hardware-side VAD events from the glasses route through the same
|
|
977
|
-
// class to fire `vad_status` (a separate signal the cloud SDK
|
|
978
|
-
// surfaces as `session.audio.isSpeaking`).
|
|
953
|
+
// Audio always flows; nothing here gates it. The on-device consumers below only
|
|
954
|
+
// copy and queue on this (glasses or phone mic) audio thread: model loading and
|
|
955
|
+
// inference run on their own workers. The glasses' hardware voice detection
|
|
956
|
+
// (Mentra Live sr_vad -> speaking_status) is separate and unaffected.
|
|
957
|
+
WakeWordDetector.accept(pcmData)
|
|
958
|
+
SpeechActivityDetector.accept(pcmData)
|
|
979
959
|
handleSendingPcm(pcmData)
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
transcriber?.acceptAudio(pcmData)
|
|
983
|
-
}
|
|
984
|
-
}
|
|
960
|
+
// Non-null only while on-device transcription is in demand.
|
|
961
|
+
transcription.current?.acceptAudio(pcmData)
|
|
985
962
|
}
|
|
986
963
|
|
|
987
964
|
// turns a single mic on and turns off all other mics:
|
|
@@ -1382,7 +1359,6 @@ class DeviceManager internal constructor(initializeHardware: Boolean) {
|
|
|
1382
1359
|
// MARK: - Auxiliary Commands
|
|
1383
1360
|
|
|
1384
1361
|
fun initSGC(wearable: String) {
|
|
1385
|
-
if (!NimoResourceDiagnostics.allowManagerConnect(wearable)) return
|
|
1386
1362
|
Bridge.log("Initializing manager for wearable: $wearable")
|
|
1387
1363
|
if (sgc != null && sgc?.type != wearable) {
|
|
1388
1364
|
Bridge.log("MAN: Manager already initialized, cleaning up previous sgc")
|
|
@@ -1454,55 +1430,67 @@ class DeviceManager internal constructor(initializeHardware: Boolean) {
|
|
|
1454
1430
|
}
|
|
1455
1431
|
}
|
|
1456
1432
|
|
|
1433
|
+
/**
|
|
1434
|
+
* Finish the active recognizer's current utterance. Returns the final text once its
|
|
1435
|
+
* `local_transcription` event has been sent, `""` when nothing was pending, or null when
|
|
1436
|
+
* no streaming model is active, the loaded model can't finalize early, or the 3 s wait
|
|
1437
|
+
* expires. Never throws. Call from a background thread: the final event is delivered on
|
|
1438
|
+
* the main thread before this returns.
|
|
1439
|
+
*/
|
|
1440
|
+
fun finishTranscription(): String? =
|
|
1441
|
+
try {
|
|
1442
|
+
transcription.current?.finishUtterance()
|
|
1443
|
+
} catch (e: Exception) {
|
|
1444
|
+
Bridge.log("STT: finishTranscription failed: ${e.message}")
|
|
1445
|
+
null
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
/** Whether the active recognizer has [path] loaded. Lock-free; never waits on a load. */
|
|
1449
|
+
fun isSttModelLoaded(path: String): Boolean = transcription.isLoaded(path)
|
|
1450
|
+
|
|
1451
|
+
/**
|
|
1452
|
+
* Load the selected speech model if on-device transcription is in demand, and wait until
|
|
1453
|
+
* it is loaded. Returns at once when there is no demand or the model is already loaded;
|
|
1454
|
+
* throws when loading fails. Call from a background thread.
|
|
1455
|
+
*/
|
|
1457
1456
|
fun restartTranscriber() {
|
|
1458
1457
|
Bridge.log("MAN: Restarting transcriber via command")
|
|
1459
|
-
|
|
1460
|
-
|
|
1458
|
+
try {
|
|
1459
|
+
transcription.restart().get()
|
|
1460
|
+
} catch (e: ExecutionException) {
|
|
1461
|
+
throw e.cause ?: e
|
|
1461
1462
|
}
|
|
1462
1463
|
}
|
|
1463
1464
|
|
|
1464
|
-
private fun
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1465
|
+
private fun selectedSttModel(): OnDeviceRecognizerHost.Selection? {
|
|
1466
|
+
val context =
|
|
1467
|
+
try {
|
|
1468
|
+
Bridge.getContext()
|
|
1469
|
+
} catch (_: IllegalStateException) {
|
|
1470
|
+
return null
|
|
1471
|
+
}
|
|
1472
|
+
val path = STTTools.getSttModelPath(context).takeIf { it.isNotBlank() } ?: return null
|
|
1473
|
+
return OnDeviceRecognizerHost.Selection(path, STTTools.getSttModelLanguage(context))
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
/** Runs on [sttLoader]. Throws when the model can't be loaded. */
|
|
1477
|
+
private fun loadTranscriber(selection: OnDeviceRecognizerHost.Selection): SherpaOnnxTranscriber {
|
|
1478
|
+
val next = SherpaOnnxTranscriber(Bridge.getContext(), selection.path, selection.language)
|
|
1479
|
+
next.setTranscriptListener(
|
|
1480
|
+
object : SherpaOnnxTranscriber.TranscriptListener {
|
|
1481
|
+
override fun onPartialResult(text: String, language: String) {
|
|
1482
|
+
Bridge.log("STT: Partial result: $text")
|
|
1483
|
+
Bridge.sendLocalTranscription(text, false, language)
|
|
1484
|
+
}
|
|
1479
1485
|
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
// output to match the rest of the pipeline (parity with iOS).
|
|
1484
|
-
val formatted = if (language == "en-US") text.lowercase() else text
|
|
1485
|
-
Bridge.sendLocalTranscription(formatted, true, language)
|
|
1486
|
-
}
|
|
1486
|
+
override fun onFinalResult(text: String, language: String) {
|
|
1487
|
+
Bridge.log("STT: Final result: $text")
|
|
1488
|
+
Bridge.sendLocalTranscription(text, true, language)
|
|
1487
1489
|
}
|
|
1488
|
-
)
|
|
1489
|
-
nextTranscriber.initialize()
|
|
1490
|
-
if (!nextTranscriber.isInitialized()) {
|
|
1491
|
-
Bridge.log("SherpaOnnxTranscriber initialize() returned without becoming ready")
|
|
1492
|
-
return false
|
|
1493
1490
|
}
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
} catch (e: Exception) {
|
|
1498
|
-
Bridge.log("Failed to initialize SherpaOnnxTranscriber: ${e.message}")
|
|
1499
|
-
transcriber = null
|
|
1500
|
-
false
|
|
1501
|
-
} catch (e: LinkageError) {
|
|
1502
|
-
Bridge.log("Failed to initialize SherpaOnnxTranscriber: ${e.message}")
|
|
1503
|
-
transcriber = null
|
|
1504
|
-
false
|
|
1505
|
-
}
|
|
1491
|
+
)
|
|
1492
|
+
next.load()
|
|
1493
|
+
return next
|
|
1506
1494
|
}
|
|
1507
1495
|
|
|
1508
1496
|
// MARK: - connection state management
|
|
@@ -2006,6 +1994,13 @@ class DeviceManager internal constructor(initializeHardware: Boolean) {
|
|
|
2006
1994
|
driver.sendIncidentId(incidentId, apiBaseUrl)
|
|
2007
1995
|
}
|
|
2008
1996
|
|
|
1997
|
+
fun sendBesCrashReported(incidentKey: String, reportId: String) {
|
|
1998
|
+
val driver = sgc ?: throw BluetoothSdkException(
|
|
1999
|
+
"glasses_not_connected", "Cannot report the BES crash because glasses are not connected.",
|
|
2000
|
+
)
|
|
2001
|
+
driver.sendBesCrashReported(incidentKey, reportId)
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2009
2004
|
/** Push a notification into the glasses' own notification centre; rejects unsupported or disconnected devices. */
|
|
2010
2005
|
fun sendPhoneNotification(notification: Map<String, Any>) {
|
|
2011
2006
|
// Package only - never the notification text.
|
|
@@ -2304,14 +2299,9 @@ class DeviceManager internal constructor(initializeHardware: Boolean) {
|
|
|
2304
2299
|
val willSendPcm = shouldSendPcm || shouldSendLc3
|
|
2305
2300
|
val willSendTranscript = shouldSendTranscript || localSttFallbackActive
|
|
2306
2301
|
val nextEnabled = willSendPcm || willSendTranscript
|
|
2307
|
-
//
|
|
2308
|
-
|
|
2309
|
-
// audio stops flowing.
|
|
2310
|
-
if (micEnabled && !nextEnabled) {
|
|
2311
|
-
vadPolicy?.microphoneStateChanged(false)
|
|
2312
|
-
}
|
|
2302
|
+
// Load the recognizer while on-device transcription is in demand; release it when not.
|
|
2303
|
+
transcription.setDemand(willSendTranscript)
|
|
2313
2304
|
micEnabled = nextEnabled
|
|
2314
|
-
vadBuffer.clear()
|
|
2315
2305
|
updateMicState()
|
|
2316
2306
|
}
|
|
2317
2307
|
|
|
@@ -2355,8 +2345,21 @@ class DeviceManager internal constructor(initializeHardware: Boolean) {
|
|
|
2355
2345
|
sgc?.sendRgbLedControl(requestId, packageName, action, color, onDurationMs, offDurationMs, count)
|
|
2356
2346
|
}
|
|
2357
2347
|
|
|
2348
|
+
/**
|
|
2349
|
+
* The person disconnected the glasses outside the app, in Android's Bluetooth settings. Like
|
|
2350
|
+
* the app's Disconnect, nothing reconnects them until the person connects again.
|
|
2351
|
+
*/
|
|
2352
|
+
fun disconnectByUser() {
|
|
2353
|
+
Bridge.log("MAN: Glasses disconnected in Android's Bluetooth settings")
|
|
2354
|
+
DeviceStore.apply("bluetooth", "glasses_user_disconnected", true)
|
|
2355
|
+
Bridge.saveSetting("glasses_user_disconnected", true)
|
|
2356
|
+
disconnect()
|
|
2357
|
+
}
|
|
2358
|
+
|
|
2359
|
+
/** Glasses the person disconnected in the app stay disconnected. */
|
|
2358
2360
|
internal fun shouldReconnectAfterBluetoothOn(): Boolean =
|
|
2359
|
-
defaultWearable.isNotEmpty() && deviceName.isNotEmpty()
|
|
2361
|
+
defaultWearable.isNotEmpty() && deviceName.isNotEmpty() &&
|
|
2362
|
+
DeviceStore.store.get("bluetooth", "glasses_user_disconnected") != true
|
|
2360
2363
|
|
|
2361
2364
|
/**
|
|
2362
2365
|
* A ready Mentra Live session. Only an explicit pair (a pending target) clears
|
|
@@ -2386,8 +2389,14 @@ class DeviceManager internal constructor(initializeHardware: Boolean) {
|
|
|
2386
2389
|
Bridge.saveSetting("mentra_live_secure_firmware", false)
|
|
2387
2390
|
}
|
|
2388
2391
|
|
|
2392
|
+
/** Whether the forgotten glasses keep former owners' keys is learned again from the next glasses. */
|
|
2393
|
+
private fun clearFormerOwnerKeys() {
|
|
2394
|
+
if (DeviceStore.store.get("bluetooth", "mentra_live_former_owner_keys") as? Boolean != true) return
|
|
2395
|
+
DeviceStore.apply("bluetooth", "mentra_live_former_owner_keys", false)
|
|
2396
|
+
Bridge.saveSetting("mentra_live_former_owner_keys", false)
|
|
2397
|
+
}
|
|
2398
|
+
|
|
2389
2399
|
fun connectDefault() {
|
|
2390
|
-
if (NimoResourceDiagnostics.dispatchCapturedEntry { connectDefault() }) return
|
|
2391
2400
|
if (defaultWearable.isEmpty()) {
|
|
2392
2401
|
Bridge.log("MAN: No default wearable, returning")
|
|
2393
2402
|
return
|
|
@@ -2409,7 +2418,6 @@ class DeviceManager internal constructor(initializeHardware: Boolean) {
|
|
|
2409
2418
|
Bridge.log("MAN: connectDefault skipped — bluetooth runtime permissions not granted")
|
|
2410
2419
|
return
|
|
2411
2420
|
}
|
|
2412
|
-
if (!NimoResourceDiagnostics.allowManagerConnect(defaultWearable, reconnectTarget)) return
|
|
2413
2421
|
initSGC(defaultWearable)
|
|
2414
2422
|
val live = sgc as? MentraLive
|
|
2415
2423
|
if (live != null && MentraLivePairingStateStore.isRejected) {
|
|
@@ -2446,7 +2454,6 @@ class DeviceManager internal constructor(initializeHardware: Boolean) {
|
|
|
2446
2454
|
}
|
|
2447
2455
|
|
|
2448
2456
|
fun connectByName(dName: String) {
|
|
2449
|
-
if (NimoResourceDiagnostics.dispatchCapturedEntry { connectByName(dName) }) return
|
|
2450
2457
|
Bridge.log("MAN: Connecting to wearable: $dName")
|
|
2451
2458
|
|
|
2452
2459
|
var name = dName
|
|
@@ -2461,7 +2468,6 @@ class DeviceManager internal constructor(initializeHardware: Boolean) {
|
|
|
2461
2468
|
return
|
|
2462
2469
|
}
|
|
2463
2470
|
|
|
2464
|
-
if (!NimoResourceDiagnostics.allowManagerConnect(pendingWearable.ifEmpty { defaultWearable }, name)) return
|
|
2465
2471
|
if (pendingWearable.isEmpty() && !defaultWearable.isEmpty()) {
|
|
2466
2472
|
Bridge.log("MAN: No pending wearable, using default wearable")
|
|
2467
2473
|
pendingWearable = defaultWearable
|
|
@@ -2476,11 +2482,8 @@ class DeviceManager internal constructor(initializeHardware: Boolean) {
|
|
|
2476
2482
|
return
|
|
2477
2483
|
}
|
|
2478
2484
|
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
disconnect(clearPendingIdentity = false)
|
|
2482
|
-
Thread.sleep(100)
|
|
2483
|
-
}
|
|
2485
|
+
disconnect(clearPendingIdentity = false)
|
|
2486
|
+
Thread.sleep(100)
|
|
2484
2487
|
searching = true
|
|
2485
2488
|
pendingDeviceName = name
|
|
2486
2489
|
|
|
@@ -2489,10 +2492,8 @@ class DeviceManager internal constructor(initializeHardware: Boolean) {
|
|
|
2489
2492
|
}
|
|
2490
2493
|
|
|
2491
2494
|
fun connectDevice(deviceModel: String, deviceName: String) {
|
|
2492
|
-
if (NimoResourceDiagnostics.dispatchCapturedEntry { connectDevice(deviceModel, deviceName) }) return
|
|
2493
2495
|
Bridge.log("MAN: Connecting to device: $deviceModel $deviceName")
|
|
2494
2496
|
if (DeviceTypes.ALL.contains(deviceModel)) {
|
|
2495
|
-
if (!NimoResourceDiagnostics.allowManagerConnect(deviceModel, deviceName)) return
|
|
2496
2497
|
pendingWearable = deviceModel
|
|
2497
2498
|
initSGC(pendingWearable)
|
|
2498
2499
|
sgc?.connectById(deviceName)
|
|
@@ -2612,11 +2613,19 @@ class DeviceManager internal constructor(initializeHardware: Boolean) {
|
|
|
2612
2613
|
connectionRecovery.clear()
|
|
2613
2614
|
}
|
|
2614
2615
|
Bridge.log("MAN: Forgetting smart glasses")
|
|
2616
|
+
// Read before it is cleared: glasses that keep former owners' keys (pairing-spec V9)
|
|
2617
|
+
// take this phone back later with the bond it has, so Unpair keeps it.
|
|
2618
|
+
val keepLiveBonds =
|
|
2619
|
+
!MentraLiveOwnerLossPolicy.removesBondWhenGlassesLetGo(
|
|
2620
|
+
DeviceStore.store.get("bluetooth", "mentra_live_former_owner_keys") as? Boolean == true
|
|
2621
|
+
)
|
|
2615
2622
|
clearPairingStateOnForget()
|
|
2616
2623
|
clearSecureFirmware()
|
|
2624
|
+
clearFormerOwnerKeys()
|
|
2617
2625
|
|
|
2618
2626
|
val live = sgc as? MentraLive
|
|
2619
2627
|
if (live != null) {
|
|
2628
|
+
live.keepBondsOnForget = keepLiveBonds
|
|
2620
2629
|
// MentraLive.forget() disconnects GATT then removeBond. Do not refuse
|
|
2621
2630
|
// during CTKD bonding — Unpair is an explicit user request to drop the pair.
|
|
2622
2631
|
live.forget()
|
|
@@ -2667,6 +2676,7 @@ class DeviceManager internal constructor(initializeHardware: Boolean) {
|
|
|
2667
2676
|
MentraLive.unbondBondedMentraLiveDevices(
|
|
2668
2677
|
Bridge.getContext(),
|
|
2669
2678
|
extraAddress,
|
|
2679
|
+
!keepLiveBonds,
|
|
2670
2680
|
)
|
|
2671
2681
|
}
|
|
2672
2682
|
sgc?.forget()
|
|
@@ -2698,8 +2708,6 @@ class DeviceManager internal constructor(initializeHardware: Boolean) {
|
|
|
2698
2708
|
}
|
|
2699
2709
|
|
|
2700
2710
|
fun findCompatibleDevices(deviceModel: String) {
|
|
2701
|
-
if (NimoResourceDiagnostics.dispatchCapturedEntry { findCompatibleDevices(deviceModel) }) return
|
|
2702
|
-
if (!NimoResourceDiagnostics.allowManagerConnect(deviceModel)) return
|
|
2703
2711
|
Bridge.log("MAN: Searching for compatible device names for: $deviceModel")
|
|
2704
2712
|
|
|
2705
2713
|
// reset the search results:
|
|
@@ -2739,9 +2747,10 @@ class DeviceManager internal constructor(initializeHardware: Boolean) {
|
|
|
2739
2747
|
systemMicAvailabilityRecheckRunnable?.let { mainHandler.removeCallbacks(it) }
|
|
2740
2748
|
systemMicAvailabilityRecheckRunnable = null
|
|
2741
2749
|
|
|
2742
|
-
//
|
|
2743
|
-
|
|
2744
|
-
|
|
2750
|
+
// Release on-device voice models (each on its own worker).
|
|
2751
|
+
transcription.setDemand(false)
|
|
2752
|
+
WakeWordDetector.shutdown()
|
|
2753
|
+
SpeechActivityDetector.shutdown()
|
|
2745
2754
|
|
|
2746
2755
|
// Clean up LC3 encoder/decoder (synchronized to prevent use-after-free
|
|
2747
2756
|
// if the recording thread is mid-encode/decode)
|
|
@@ -3,8 +3,9 @@ package com.mentra.bluetoothsdk
|
|
|
3
3
|
/** Generated from /changelogs. Do not edit directly. */
|
|
4
4
|
internal val GENERATED_RELEASE_CHANGELOGS: List<ReleaseChangelog> =
|
|
5
5
|
listOf(
|
|
6
|
-
ReleaseChangelog(version = "3.4.
|
|
7
|
-
ReleaseChangelog(version = "3.
|
|
6
|
+
ReleaseChangelog(version = "3.4.1", markdown = "- **Pairing:** Pairing your glasses is simpler, with new voice prompts to guide you. Glasses paired before this update keep working with your current phone.\n- **Mentra Call:** Simpler call controls and a free first month.\n- **Miniapps:** Add miniapps from a link or QR code.\n- **Glasses updates:** Updates keep going when your phone switches networks, with clearer messages if something goes wrong.\n- **Photos and gallery:** More reliable photo syncing on iPhone. Your glasses now tell you when their storage is full.\n- **Livestreaming:** Smoother livestreams.\n- **Sound:** Music no longer stays off after a call.\n- **Notes:** Short conversations now get notes too.\n- **Reliability:** Fewer glasses crashes and disconnects."),
|
|
7
|
+
ReleaseChangelog(version = "3.4.0", markdown = "- **Pairing:** Pairing your glasses is simpler, with new voice prompts to guide you.\n- **Mentra Call:** Simpler call controls and a free first month.\n- **Miniapps:** Add miniapps from a link or QR code.\n- **Glasses updates:** Updates keep going when your phone switches networks, with clearer messages if something goes wrong.\n- **Photos and gallery:** More reliable photo syncing on iPhone. Your glasses now tell you when their storage is full.\n- **Livestreaming:** Smoother livestreams.\n- **Sound:** Better speaker sound on Mentra Live, and music no longer stays off after a call.\n- **Notes:** Short conversations now get notes too.\n- **Reliability:** Fewer glasses crashes and disconnects."),
|
|
8
|
+
ReleaseChangelog(version = "3.3.0", 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."),
|
|
8
9
|
ReleaseChangelog(version = "3.2.1", markdown = "- **Livestreamer:** \"Stream Here\" now works without a Wi-Fi network. Improved stream startup and connection reliability.\n- **Photos and gallery:** More reliable photo capture and gallery syncing.\n- **Mentra AI:** Reliability improvements and bug fixes.\n- **Miniapps:** Smoother transitions, with back buttons and gestures that take you to the previous screen inside a miniapp.\n- **Pairing and connections:** Improved G1 pairing and G2 background reconnection.\n- **Glasses updates:** Fixed repeated update checks and improved recovery after interrupted updates.\n- **Mentra Maps:** Bug fixes.\n- **NIMO:** Improved text and map layouts.\n- **Self-hosting:** Connect the Mentra App to your own self-hosted Mentra backend."),
|
|
9
10
|
ReleaseChangelog(version = "3.2.0", markdown = "- Improved glasses connectivity and Wi-Fi setup.\n\n- Breaking Bluetooth SDK change: `forgetWifiNetwork(ssid)` now returns `WifiForgetResult` instead of `WifiStatusChangeEvent`. Migrate status-only consumers to the semantic `outcome`; the requested network remains `ssid`, while optional post-command connectivity is reported by `connected`, `currentSsid`, and `localIp`."),
|
|
10
11
|
ReleaseChangelog(version = "3.1.1", markdown = "- Improved Google login on iOS.\n- Pairing no longer requires phone microphone access."),
|
|
@@ -2,10 +2,10 @@ package com.mentra.bluetoothsdk
|
|
|
2
2
|
|
|
3
3
|
/** Generated by release CI. Do not edit in a release checkout. */
|
|
4
4
|
internal object GeneratedReleaseMetadata {
|
|
5
|
-
const val FAMILY_BASE_VERSION: String = "3.4.
|
|
6
|
-
const val RELEASE_IDENTITY: String = "3.4.
|
|
7
|
-
const val RELEASE_SET_ID: String = "mentra-3.4.
|
|
8
|
-
const val SOURCE_COMMIT: String = "
|
|
9
|
-
const val OTA_MANIFEST_URL: String = "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.
|
|
10
|
-
const val OTA_MANIFEST_SHA256: String = "
|
|
5
|
+
const val FAMILY_BASE_VERSION: String = "3.4.1"
|
|
6
|
+
const val RELEASE_IDENTITY: String = "3.4.1-beta.1409"
|
|
7
|
+
const val RELEASE_SET_ID: String = "mentra-3.4.1-beta.1409"
|
|
8
|
+
const val SOURCE_COMMIT: String = "0ac9bbe8869f3e269f43ca87f37382076eca8301"
|
|
9
|
+
const val OTA_MANIFEST_URL: String = "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.1/mentra-live-ota-3.4.1-beta.1409.json"
|
|
10
|
+
const val OTA_MANIFEST_SHA256: String = "c31a58bc0159c019e95a450eda8d546484210ca4ee39f1220951d2e3b2c5abaf"
|
|
11
11
|
}
|