@mentra/bluetooth-sdk 3.3.0-dev.944 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/BluetoothSdkModule.kt +4 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/DeviceManager.kt +5 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/GeneratedChangelogCatalog.kt +1 -1
- package/android/src/main/java/com/mentra/bluetoothsdk/GeneratedReleaseMetadata.kt +5 -5
- package/android/src/main/java/com/mentra/bluetoothsdk/MentraBluetoothSdk.kt +8 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/TouchGesture.kt +19 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLive.kt +77 -2
- package/android/src/test/java/com/mentra/bluetoothsdk/TouchGestureCommandTest.kt +112 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/MentraLiveGlassesReadyBurstTest.kt +137 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/MentraLiveRgbLedResponseTest.kt +76 -0
- package/build/BluetoothSdk.types.d.ts +6 -1
- package/build/BluetoothSdk.types.d.ts.map +1 -1
- package/build/BluetoothSdk.types.js.map +1 -1
- package/build/_private/BluetoothSdkModule.d.ts +2 -1
- package/build/_private/BluetoothSdkModule.d.ts.map +1 -1
- package/build/_private/BluetoothSdkModule.js.map +1 -1
- package/build/generated/changelogCatalog.d.ts +1 -1
- package/build/generated/changelogCatalog.js +1 -1
- package/build/generated/changelogCatalog.js.map +1 -1
- package/build/generated/releaseMetadata.js +5 -5
- 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 +1 -0
- package/build/index.js.map +1 -1
- package/ios/BluetoothSdkModule.swift +8 -0
- package/ios/Source/BluetoothSdkDefaults.swift +1 -1
- package/ios/Source/DeviceManager.swift +4 -0
- package/ios/Source/GeneratedChangelogCatalog.swift +1 -1
- package/ios/Source/GeneratedReleaseMetadata.swift +5 -5
- package/ios/Source/MentraBluetoothSDK.swift +11 -0
- package/ios/Source/TouchGesture.swift +13 -0
- package/ios/Source/events/BluetoothEvents.swift +4 -0
- package/ios/Source/sgcs/MentraLive.swift +96 -23
- package/ios/Tests/MentraLiveCommandQueueTests.swift +35 -0
- package/ios/Tests/MentraLiveSessionReadinessTests.swift +129 -0
- package/ios/Tests/TouchGestureCommandTests.swift +87 -0
- package/package.json +2 -2
- package/src/BluetoothSdk.types.ts +15 -0
- package/src/_private/BluetoothSdkModule.ts +2 -0
- package/src/generated/changelogCatalog.ts +1 -1
- package/src/generated/releaseMetadata.ts +5 -5
- package/src/index.ts +2 -0
package/README.md
CHANGED
|
@@ -751,6 +751,37 @@ export function HardwareEventLogger() {
|
|
|
751
751
|
|
|
752
752
|
For non-React modules, `BluetoothSdk.addListener(...)` is the low-level subscription API. Keep the returned subscription and call `remove()` when the listener is no longer needed.
|
|
753
753
|
|
|
754
|
+
### Claiming touchpad gestures
|
|
755
|
+
|
|
756
|
+
On Mentra Live, disable a gesture's stock action before using it in your app:
|
|
757
|
+
|
|
758
|
+
```ts
|
|
759
|
+
await BluetoothSdk.setTouchGestureDefaultBehaviorEnabled("double_tap", false)
|
|
760
|
+
// double_tap events still reach useBluetoothEvent("touch_event", ...).
|
|
761
|
+
// Restore play/pause when your app releases the gesture:
|
|
762
|
+
await BluetoothSdk.setTouchGestureDefaultBehaviorEnabled("double_tap", true)
|
|
763
|
+
```
|
|
764
|
+
|
|
765
|
+
The supported names are `single_tap`, `double_tap`, `triple_tap`, `long_press`,
|
|
766
|
+
`forward_swipe`, `backward_swipe`, `up_swipe`, and `down_swipe`. Each setting
|
|
767
|
+
changes only that gesture. Stock media actions (play/pause, volume, previous/next
|
|
768
|
+
track) and gesture feedback are suppressed; the gesture event itself is still
|
|
769
|
+
sent. This applies on both Android and iOS, without claiming a phone media player
|
|
770
|
+
or relying on remote media-key interception.
|
|
771
|
+
|
|
772
|
+
Overrides are RAM-only on the glasses and reset to the normal stock behavior on
|
|
773
|
+
BLE disconnect or reboot. Set them again after reconnecting. They do not change
|
|
774
|
+
camera-button behavior or gallery mode. Gestures without a stock action still
|
|
775
|
+
produce events. On native Android use `TouchGesture.DOUBLE_TAP`; on native iOS
|
|
776
|
+
use `.doubleTap` with `setTouchGestureDefaultBehaviorEnabled(_:enabled:)`.
|
|
777
|
+
|
|
778
|
+
This requires BES firmware implementing `cs_tpdef` / `sr_tpdef`. The promise
|
|
779
|
+
resolves only after the matching firmware `settings_ack` with
|
|
780
|
+
`setting: "touch_gesture_default"`, `gesture`, and `enabled`. Unsupported devices
|
|
781
|
+
and invalid gesture names reject. Older firmware cannot suppress these actions
|
|
782
|
+
and will time out; do not treat that timeout as success. A release containing this
|
|
783
|
+
SDK API alone does not update BES firmware.
|
|
784
|
+
|
|
754
785
|
Common event names include `button_press`, `touch_event`, `head_up`, `battery_status`, `wifi_status_change`, `wifi_scan_result`, `hotspot_status_change`, `photo_status`, `photo_response`, `gallery_status`, `settings_ack`, `version_info`, `stream_status`, `ota_start_ack`, `ota_status`, `mic_pcm`, `mic_lc3`, `mic_health`, `local_transcription`, `rgb_led_control_response`, `audio_connected`, `audio_disconnected`, and `log`.
|
|
755
786
|
|
|
756
787
|
React Native event payload fields usually use camelCase. OTA events intentionally mirror the glasses firmware field names, such as `overall_percent` and `version_name`. For example, `touch_event` includes `gestureName`, `wifi_scan_result` includes `networks` and `scanComplete`, `version_info` matches the `requestVersionInfo()` result shape, `photo_response` success includes `uploadUrl` and may include webhook-returned `photoUrl`, `statusUrl`, `contentType`, and `fileSizeBytes`, and `gallery_status` includes `hasContent`, `cameraBusy`, and optional `cameraBusyReason`. `photo_status` reports intermediate photo states such as `accepted`, `queued`, `configuring`, `capturing`, `captured`, `compressing`, `ble_fallback_compression`, `uploading`, `ready_for_transfer`, `transferring`, and `failed`; the `configuring` event includes `resolvedConfig` with the effective JPEG dimensions, quality, requested size, transfer method, compression, and manual exposure fields when present. The `capturing` event may include `requestedCaptureConfig` and `meteredPreview`; the `captured` event may include `captureMetadata` with the HAL-applied exposure, ISO, frame duration, and AE state. `mic_pcm` includes `sampleRate`, `bitsPerSample`, `channels`, and `encoding`; `mic_lc3` includes `sampleRate`, `channels`, `encoding`, `frameDurationMs`, `frameSizeBytes`, `bitrate`, and `packetizedFromGlasses`.
|
|
@@ -666,6 +666,10 @@ class BluetoothSdkModule : Module() {
|
|
|
666
666
|
requireSdk().setGalleryServerEnabled(enabled).values
|
|
667
667
|
}
|
|
668
668
|
|
|
669
|
+
SdkCoroutineFunction("setTouchGestureDefaultBehaviorEnabled") { gesture: String, enabled: Boolean ->
|
|
670
|
+
requireSdk().setTouchGestureDefaultBehaviorEnabled(TouchGesture.fromWireName(gesture), enabled).values
|
|
671
|
+
}
|
|
672
|
+
|
|
669
673
|
SdkCoroutineFunction("setGalleryModeEnabled") { enabled: Boolean ->
|
|
670
674
|
requireSdk().setGalleryModeEnabled(enabled).values
|
|
671
675
|
}
|
|
@@ -2065,6 +2065,11 @@ class DeviceManager internal constructor(initializeHardware: Boolean) {
|
|
|
2065
2065
|
live.sendGalleryServerEnabled(requestId, enabled)
|
|
2066
2066
|
}
|
|
2067
2067
|
|
|
2068
|
+
fun sendTouchGestureDefaultBehaviorEnabled(requestId: String, gesture: TouchGesture, enabled: Boolean) {
|
|
2069
|
+
val live = sgc as? MentraLive ?: throw BluetoothSdkException("unsupported_device", "This command requires Mentra Live glasses.")
|
|
2070
|
+
live.sendTouchGestureDefaultBehaviorEnabled(requestId, gesture, enabled)
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2068
2073
|
fun sendGalleryMode(requestId: String, enabled: Boolean) {
|
|
2069
2074
|
val live = sgc as? MentraLive ?: throw IllegalStateException("unsupported_device")
|
|
2070
2075
|
live.sendGalleryMode(requestId, enabled)
|
|
@@ -3,7 +3,7 @@ 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.3.0", markdown = "
|
|
6
|
+
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."),
|
|
7
7
|
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."),
|
|
8
8
|
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`."),
|
|
9
9
|
ReleaseChangelog(version = "3.1.1", markdown = "- Improved Google login on iOS.\n- Pairing no longer requires phone microphone access."),
|
|
@@ -3,9 +3,9 @@ package com.mentra.bluetoothsdk
|
|
|
3
3
|
/** Generated by release CI. Do not edit in a release checkout. */
|
|
4
4
|
internal object GeneratedReleaseMetadata {
|
|
5
5
|
const val FAMILY_BASE_VERSION: String = "3.3.0"
|
|
6
|
-
const val RELEASE_IDENTITY: String = "3.3.0
|
|
7
|
-
const val RELEASE_SET_ID: String = "mentra-3.3.0
|
|
8
|
-
const val SOURCE_COMMIT: String = "
|
|
9
|
-
const val OTA_MANIFEST_URL: String = "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.3.0/mentra-live-ota-3.3.0-
|
|
10
|
-
const val OTA_MANIFEST_SHA256: String = "
|
|
6
|
+
const val RELEASE_IDENTITY: String = "3.3.0"
|
|
7
|
+
const val RELEASE_SET_ID: String = "mentra-3.3.0"
|
|
8
|
+
const val SOURCE_COMMIT: String = "5bd50400b076b758691429755b6e1bd7b77268fb"
|
|
9
|
+
const val OTA_MANIFEST_URL: String = "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.3.0/mentra-live-ota-3.3.0-beta.1188.json"
|
|
10
|
+
const val OTA_MANIFEST_SHA256: String = "66070872d18ee11303347e1be71b7385af96aab30adc3d226ceb4a82c2c4848f"
|
|
11
11
|
}
|
|
@@ -640,6 +640,14 @@ class MentraBluetoothSdk private constructor(
|
|
|
640
640
|
send = { requestId -> deviceManager.sendGalleryServerEnabled(requestId, enabled) },
|
|
641
641
|
)
|
|
642
642
|
|
|
643
|
+
/** Disable a stock action while retaining touch events. Reset by BES on BLE disconnect. */
|
|
644
|
+
suspend fun setTouchGestureDefaultBehaviorEnabled(gesture: TouchGesture, enabled: Boolean): SettingsAckEvent =
|
|
645
|
+
performSettingsCommand(
|
|
646
|
+
setting = "touch_gesture_default",
|
|
647
|
+
updateStore = {},
|
|
648
|
+
send = { requestId -> deviceManager.sendTouchGestureDefaultBehaviorEnabled(requestId, gesture, enabled) },
|
|
649
|
+
)
|
|
650
|
+
|
|
643
651
|
suspend fun setGalleryModeEnabled(enabled: Boolean): SettingsAckEvent =
|
|
644
652
|
performSettingsCommand(
|
|
645
653
|
setting = "gallery_mode",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
package com.mentra.bluetoothsdk
|
|
2
|
+
|
|
3
|
+
/** Mentra Live touchpad gestures, using the public touch_event names. */
|
|
4
|
+
enum class TouchGesture(val wireName: String) {
|
|
5
|
+
SINGLE_TAP("single_tap"),
|
|
6
|
+
DOUBLE_TAP("double_tap"),
|
|
7
|
+
TRIPLE_TAP("triple_tap"),
|
|
8
|
+
LONG_PRESS("long_press"),
|
|
9
|
+
FORWARD_SWIPE("forward_swipe"),
|
|
10
|
+
BACKWARD_SWIPE("backward_swipe"),
|
|
11
|
+
UP_SWIPE("up_swipe"),
|
|
12
|
+
DOWN_SWIPE("down_swipe");
|
|
13
|
+
|
|
14
|
+
companion object {
|
|
15
|
+
fun fromWireName(value: String): TouchGesture =
|
|
16
|
+
entries.firstOrNull { it.wireName == value }
|
|
17
|
+
?: throw BluetoothSdkException("invalid_touch_gesture", "Unknown touch gesture: $value")
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -40,6 +40,7 @@ import com.mentra.bluetoothsdk.DeviceManager
|
|
|
40
40
|
import com.mentra.bluetoothsdk.PhotoRequest
|
|
41
41
|
import com.mentra.bluetoothsdk.PhotoSize
|
|
42
42
|
import com.mentra.bluetoothsdk.PhotoMode
|
|
43
|
+
import com.mentra.bluetoothsdk.TouchGesture
|
|
43
44
|
import com.mentra.bluetoothsdk.DeviceStore
|
|
44
45
|
import com.mentra.bluetoothsdk.ObservableStore
|
|
45
46
|
import com.mentra.bluetoothsdk.incomingGlassesMessageAckId
|
|
@@ -565,6 +566,13 @@ class MentraLive : SGCManager() {
|
|
|
565
566
|
// the physical connection (never on heartbeat readiness flaps), so a first-seen sid
|
|
566
567
|
// after an upgrade OTA is always detected as a restart.
|
|
567
568
|
private var readinessCompletedThisBleSession = false
|
|
569
|
+
// Readiness exchange the phone is waiting on. Every phone_ready carries it until the
|
|
570
|
+
// matching glasses_ready arrives, so retries and the copies the BES buffers while the
|
|
571
|
+
// glasses boot are one exchange: the glasses reset their transport once for it and answer
|
|
572
|
+
// later copies without resetting. Both exchange fields are scoped to the BLE session.
|
|
573
|
+
private var pendingReadyId: String? = null
|
|
574
|
+
// `sid` of the glasses process whose glasses_ready this BLE session last handled.
|
|
575
|
+
private var readyGlassesSessionId: String? = null
|
|
568
576
|
// Note: appVersion, buildNumber, deviceModel, androidVersion
|
|
569
577
|
// are inherited from SGCManager parent class
|
|
570
578
|
|
|
@@ -1193,6 +1201,7 @@ class MentraLive : SGCManager() {
|
|
|
1193
1201
|
if (state == ConnTypes.DISCONNECTED) {
|
|
1194
1202
|
resetWireNegotiationState()
|
|
1195
1203
|
resetPendingAckState()
|
|
1204
|
+
resetReadinessExchange()
|
|
1196
1205
|
// Queued writes are session-bound: transmitting them into the NEXT session
|
|
1197
1206
|
// (e.g. a stale handshake whose reply activates v2 before the new session
|
|
1198
1207
|
// negotiated) is the bug class this clear removes. Higher layers re-send
|
|
@@ -1248,6 +1257,7 @@ class MentraLive : SGCManager() {
|
|
|
1248
1257
|
DeviceStore.apply("glasses", "signalStrengthUpdatedAt", 0L)
|
|
1249
1258
|
resetWireNegotiationState()
|
|
1250
1259
|
resetPendingAckState()
|
|
1260
|
+
resetReadinessExchange()
|
|
1251
1261
|
// The glasses reset mic and wear tuning on BLE disconnect, so the
|
|
1252
1262
|
// next link must be allowed to send them again.
|
|
1253
1263
|
lastSentMicTuningBody = null
|
|
@@ -4601,6 +4611,16 @@ class MentraLive : SGCManager() {
|
|
|
4601
4611
|
|
|
4602
4612
|
handleSwitchStatus(switchType, switchValue, switchTimestamp)
|
|
4603
4613
|
}
|
|
4614
|
+
"rgb_led_control_response" -> {
|
|
4615
|
+
// Settles the sendRgbLedControl request this reply echoes (matches iOS).
|
|
4616
|
+
val requestId = json.optString("requestId", "")
|
|
4617
|
+
val success =
|
|
4618
|
+
json.optString("state", "") == "success" ||
|
|
4619
|
+
json.optBoolean("success", false)
|
|
4620
|
+
val error =
|
|
4621
|
+
json.optString("errorCode", "").ifEmpty { json.optString("error", "") }
|
|
4622
|
+
Bridge.sendRgbLedControlResponse(requestId, success, error.ifEmpty { null })
|
|
4623
|
+
}
|
|
4604
4624
|
"sensor_data" -> {
|
|
4605
4625
|
// Process sensor data
|
|
4606
4626
|
// ...
|
|
@@ -4611,6 +4631,19 @@ class MentraLive : SGCManager() {
|
|
|
4611
4631
|
Bridge.log("LIVE: Ignoring stale glasses_ready during pairing yield")
|
|
4612
4632
|
return
|
|
4613
4633
|
}
|
|
4634
|
+
val sid = json.optString("sid", "").takeIf { it.isNotEmpty() }
|
|
4635
|
+
val readyId = json.optString("readyId", "").takeIf { it.isNotEmpty() }
|
|
4636
|
+
if (readyId != null && isRepeatedGlassesReady(readyId, sid)) {
|
|
4637
|
+
Bridge.log(
|
|
4638
|
+
"LIVE: Ignoring repeated glasses_ready for readiness exchange $readyId - " +
|
|
4639
|
+
"the glasses did not reset for it"
|
|
4640
|
+
)
|
|
4641
|
+
return
|
|
4642
|
+
}
|
|
4643
|
+
if (readyId != null && readyId == pendingReadyId) {
|
|
4644
|
+
pendingReadyId = null
|
|
4645
|
+
}
|
|
4646
|
+
readyGlassesSessionId = sid
|
|
4614
4647
|
Bridge.log("LIVE: 🎉 Received glasses_ready message - SOC is booted and ready!")
|
|
4615
4648
|
pairingYieldAwaitingReclaim = false
|
|
4616
4649
|
pairingYieldActive = false
|
|
@@ -4632,7 +4665,7 @@ class MentraLive : SGCManager() {
|
|
|
4632
4665
|
// Record the session id BEFORE marking ready: an unsolicited glasses_ready
|
|
4633
4666
|
// already runs this full remote-reset flow, so recording (not re-triggering)
|
|
4634
4667
|
// is correct here; version_info detection covers the restart case.
|
|
4635
|
-
glassesSessionId =
|
|
4668
|
+
glassesSessionId = sid
|
|
4636
4669
|
streamControlVersion = json.optInt("streamControlVersion", 0)
|
|
4637
4670
|
Bridge.sendTypedMessage(
|
|
4638
4671
|
"wifi_protocol_session_ready",
|
|
@@ -5470,6 +5503,14 @@ class MentraLive : SGCManager() {
|
|
|
5470
5503
|
// Bridge.log("LIVE: Processing K900 command: " + command);
|
|
5471
5504
|
|
|
5472
5505
|
when (command) {
|
|
5506
|
+
"sr_tpdef" -> {
|
|
5507
|
+
val body = when (val value = json.opt("B")) {
|
|
5508
|
+
is JSONObject -> value
|
|
5509
|
+
is String -> runCatching { JSONObject(value) }.getOrNull()
|
|
5510
|
+
else -> null
|
|
5511
|
+
}
|
|
5512
|
+
if (body != null && body.optString("setting") == "touch_gesture_default") emitSettingsAck(body)
|
|
5513
|
+
}
|
|
5473
5514
|
"sr_hrt" -> {
|
|
5474
5515
|
try {
|
|
5475
5516
|
val bodyObj = json.optJSONObject("B")
|
|
@@ -6210,6 +6251,19 @@ class MentraLive : SGCManager() {
|
|
|
6210
6251
|
}
|
|
6211
6252
|
}
|
|
6212
6253
|
|
|
6254
|
+
fun sendTouchGestureDefaultBehaviorEnabled(requestId: String, gesture: TouchGesture, enabled: Boolean) {
|
|
6255
|
+
val sessionGeneration = bleSessionGeneration.get()
|
|
6256
|
+
if (!isConnected) throw BluetoothSdkException("not_connected", "Mentra Live glasses are not connected.")
|
|
6257
|
+
val body = JSONObject().put("request_id", requestId).put("gesture", gesture.wireName).put("enabled", enabled)
|
|
6258
|
+
val command = JSONObject().put("C", "cs_tpdef").put("V", 1).put("B", body.toString())
|
|
6259
|
+
val packet = K900ProtocolUtils.packDataToK900(
|
|
6260
|
+
command.toString().toByteArray(StandardCharsets.UTF_8),
|
|
6261
|
+
K900ProtocolUtils.CMD_TYPE_STRING,
|
|
6262
|
+
k900LengthEndian(),
|
|
6263
|
+
) ?: throw BluetoothSdkException("command_send_failed", "Could not encode the touch gesture setting.")
|
|
6264
|
+
queueData(packet, sessionGeneration = sessionGeneration)
|
|
6265
|
+
}
|
|
6266
|
+
|
|
6213
6267
|
fun sendGalleryServerEnabled(requestId: String, enabled: Boolean) {
|
|
6214
6268
|
val json = JSONObject()
|
|
6215
6269
|
.put("type", "set_gallery_server_enabled")
|
|
@@ -9088,13 +9142,34 @@ class MentraLive : SGCManager() {
|
|
|
9088
9142
|
wireHandshakeSentGeneration = -1
|
|
9089
9143
|
}
|
|
9090
9144
|
|
|
9145
|
+
/**
|
|
9146
|
+
* A glasses_ready that echoes a readyId answers a phone_ready exchange. The answer to the
|
|
9147
|
+
* exchange the phone is waiting on, and any answer from a glasses process other than the one
|
|
9148
|
+
* this link last handled (an asg restart resets for every exchange it first sees), followed a
|
|
9149
|
+
* transport reset. Any other answer repeats an exchange that process already reset for, or one
|
|
9150
|
+
* superseded by the pending exchange, whose answer is still to come.
|
|
9151
|
+
*/
|
|
9152
|
+
private fun isRepeatedGlassesReady(readyId: String, sid: String?): Boolean =
|
|
9153
|
+
readyId != pendingReadyId && sid == readyGlassesSessionId
|
|
9154
|
+
|
|
9155
|
+
private fun resetReadinessExchange() {
|
|
9156
|
+
pendingReadyId = null
|
|
9157
|
+
readyGlassesSessionId = null
|
|
9158
|
+
}
|
|
9159
|
+
|
|
9091
9160
|
/** Sends phone_ready to (re)start the glasses-driven readiness flow. */
|
|
9092
9161
|
private fun sendPhoneReady(reason: String) {
|
|
9093
|
-
|
|
9162
|
+
val readyId = pendingReadyId ?: UUID.randomUUID().toString()
|
|
9163
|
+
pendingReadyId = readyId
|
|
9164
|
+
Bridge.log(
|
|
9165
|
+
"LIVE: 📱 Sending phone_ready to glasses ($reason, exchange $readyId) - " +
|
|
9166
|
+
"waiting for glasses_ready response"
|
|
9167
|
+
)
|
|
9094
9168
|
markPairingTiming("phone_ready_sent", "reason=$reason queueSize=${sendQueue.size}")
|
|
9095
9169
|
val readyMsg = JSONObject()
|
|
9096
9170
|
readyMsg.put("type", "phone_ready")
|
|
9097
9171
|
readyMsg.put("timestamp", System.currentTimeMillis())
|
|
9172
|
+
readyMsg.put("readyId", readyId)
|
|
9098
9173
|
sendJson(readyMsg, true)
|
|
9099
9174
|
}
|
|
9100
9175
|
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
package com.mentra.bluetoothsdk
|
|
2
|
+
|
|
3
|
+
import androidx.test.core.app.ApplicationProvider
|
|
4
|
+
import com.mentra.bluetoothsdk.sgcs.G1PairingTest
|
|
5
|
+
import com.mentra.bluetoothsdk.sgcs.MentraLive
|
|
6
|
+
import java.util.concurrent.ConcurrentLinkedQueue
|
|
7
|
+
import com.mentra.bluetoothsdk.utils.K900ProtocolUtils
|
|
8
|
+
import com.mentra.bluetoothsdk.utils.K900LengthCodec
|
|
9
|
+
import org.robolectric.annotation.Implementation
|
|
10
|
+
import org.robolectric.annotation.Implements
|
|
11
|
+
import org.robolectric.shadow.api.Shadow
|
|
12
|
+
import org.robolectric.util.ReflectionHelpers.ClassParameter
|
|
13
|
+
import java.util.concurrent.atomic.AtomicLong
|
|
14
|
+
import org.json.JSONObject
|
|
15
|
+
import org.junit.Assert.*
|
|
16
|
+
import org.junit.Test
|
|
17
|
+
import org.junit.runner.RunWith
|
|
18
|
+
import org.robolectric.RobolectricTestRunner
|
|
19
|
+
import org.robolectric.annotation.Config
|
|
20
|
+
|
|
21
|
+
@RunWith(RobolectricTestRunner::class)
|
|
22
|
+
@Config(sdk = [33], shadows = [G1PairingTest.ShadowLc3Cpp::class, TouchGestureCommandTest.ShadowK900Encoder::class], instrumentedPackages = ["com.mentra.lc3Lib"])
|
|
23
|
+
class TouchGestureCommandTest {
|
|
24
|
+
@Implements(K900ProtocolUtils::class)
|
|
25
|
+
class ShadowK900Encoder {
|
|
26
|
+
companion object {
|
|
27
|
+
var beforeEncode: (() -> Unit)? = null
|
|
28
|
+
@JvmStatic
|
|
29
|
+
@Implementation
|
|
30
|
+
fun packDataToK900(data: ByteArray, cmdType: Byte, endian: K900LengthCodec.Endian): ByteArray? {
|
|
31
|
+
beforeEncode?.invoke()
|
|
32
|
+
return Shadow.directlyOn(K900ProtocolUtils::class.java, "packDataToK900",
|
|
33
|
+
ClassParameter.from(ByteArray::class.java, data),
|
|
34
|
+
ClassParameter.from(Byte::class.javaPrimitiveType!!, cmdType),
|
|
35
|
+
ClassParameter.from(K900LengthCodec.Endian::class.java, endian))
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@Test
|
|
41
|
+
fun `disconnect during encoding cannot promote touch setting into next session`() {
|
|
42
|
+
Bridge.initialize(ApplicationProvider.getApplicationContext())
|
|
43
|
+
val live = MentraLive()
|
|
44
|
+
val connection = MentraLive::class.java.getDeclaredField("isConnected").apply { isAccessible = true }
|
|
45
|
+
connection.setBoolean(live, true)
|
|
46
|
+
val queue = MentraLive::class.java.getDeclaredField("sendQueue").apply { isAccessible = true }
|
|
47
|
+
.get(live) as ConcurrentLinkedQueue<*>
|
|
48
|
+
val generation = MentraLive::class.java.getDeclaredField("bleSessionGeneration").apply { isAccessible = true }
|
|
49
|
+
.get(live) as AtomicLong
|
|
50
|
+
val admittedGeneration = generation.get()
|
|
51
|
+
val reset = MentraLive::class.java.getDeclaredMethod("resetPendingAckState").apply { isAccessible = true }
|
|
52
|
+
ShadowK900Encoder.beforeEncode = {
|
|
53
|
+
connection.setBoolean(live, false)
|
|
54
|
+
reset.invoke(live)
|
|
55
|
+
queue.clear()
|
|
56
|
+
connection.setBoolean(live, true)
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
live.sendTouchGestureDefaultBehaviorEnabled("old-session", TouchGesture.DOUBLE_TAP, false)
|
|
60
|
+
val queued = queue.poll()!!
|
|
61
|
+
val queuedGeneration = queued.javaClass.getDeclaredField("sessionGeneration").apply { isAccessible = true }.getLong(queued)
|
|
62
|
+
assertEquals(admittedGeneration, queuedGeneration)
|
|
63
|
+
assertNotEquals(generation.get(), queuedGeneration)
|
|
64
|
+
} finally { ShadowK900Encoder.beforeEncode = null }
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@Test
|
|
68
|
+
fun `each gesture serializes independently and acknowledgements retain typed event values`() {
|
|
69
|
+
Bridge.initialize(ApplicationProvider.getApplicationContext())
|
|
70
|
+
val live = MentraLive()
|
|
71
|
+
val connection = MentraLive::class.java.getDeclaredField("isConnected").apply { isAccessible = true }
|
|
72
|
+
connection.setBoolean(live, true)
|
|
73
|
+
val queue = MentraLive::class.java.getDeclaredField("sendQueue").apply { isAccessible = true }
|
|
74
|
+
.get(live) as ConcurrentLinkedQueue<*>
|
|
75
|
+
val receive = MentraLive::class.java.getDeclaredMethod("processK900JsonMessage", JSONObject::class.java)
|
|
76
|
+
.apply { isAccessible = true }
|
|
77
|
+
val events = mutableListOf<Map<String, Any>>()
|
|
78
|
+
val sink = Bridge.addEventSink { name, values -> if (name == "settings_ack") events.add(values) }
|
|
79
|
+
try {
|
|
80
|
+
for (gesture in TouchGesture.entries) for (enabled in listOf(false, true)) {
|
|
81
|
+
live.sendTouchGestureDefaultBehaviorEnabled("request-${gesture.wireName}-$enabled", gesture, enabled)
|
|
82
|
+
val queued = queue.poll()!!
|
|
83
|
+
val bytes = queued.javaClass.getDeclaredField("data").apply { isAccessible = true }.get(queued) as ByteArray
|
|
84
|
+
assertEquals('#'.code.toByte(), bytes[0])
|
|
85
|
+
assertEquals('$'.code.toByte(), bytes.last())
|
|
86
|
+
val envelope = JSONObject(String(bytes, 5, bytes.size - 7, Charsets.UTF_8))
|
|
87
|
+
assertEquals("cs_tpdef", envelope.getString("C"))
|
|
88
|
+
val body = JSONObject(envelope.getString("B"))
|
|
89
|
+
assertEquals(gesture.wireName, body.getString("gesture"))
|
|
90
|
+
assertEquals(enabled, body.getBoolean("enabled"))
|
|
91
|
+
val ack = JSONObject().put("type", "settings_ack").put("setting", "touch_gesture_default")
|
|
92
|
+
.put("status", "applied").put("request_id", body.getString("request_id"))
|
|
93
|
+
.put("gesture", gesture.wireName).put("enabled", enabled)
|
|
94
|
+
receive.invoke(live, JSONObject().put("C", "sr_tpdef").put("B", if (enabled) ack.toString() else ack))
|
|
95
|
+
assertEquals(body.getString("request_id"), events.last()["requestId"])
|
|
96
|
+
assertEquals(enabled, events.last()["enabled"])
|
|
97
|
+
assertEquals(gesture.wireName, events.last()["gesture"])
|
|
98
|
+
}
|
|
99
|
+
assertEquals(16, events.size)
|
|
100
|
+
} finally { Bridge.removeEventSink(sink) }
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@Test
|
|
104
|
+
fun `invalid gesture and disconnected radio reject before sending`() {
|
|
105
|
+
assertThrows(BluetoothSdkException::class.java) { TouchGesture.fromWireName("unknown") }
|
|
106
|
+
Bridge.initialize(ApplicationProvider.getApplicationContext())
|
|
107
|
+
val live = MentraLive()
|
|
108
|
+
assertThrows(BluetoothSdkException::class.java) {
|
|
109
|
+
live.sendTouchGestureDefaultBehaviorEnabled("request", TouchGesture.DOUBLE_TAP, false)
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
package com.mentra.bluetoothsdk.sgcs
|
|
2
|
+
|
|
3
|
+
import android.os.Looper
|
|
4
|
+
import androidx.test.core.app.ApplicationProvider
|
|
5
|
+
import com.mentra.bluetoothsdk.Bridge
|
|
6
|
+
import com.mentra.bluetoothsdk.utils.ConnTypes
|
|
7
|
+
import java.time.Duration
|
|
8
|
+
import org.json.JSONObject
|
|
9
|
+
import org.junit.Assert.assertEquals
|
|
10
|
+
import org.junit.Assert.assertNotEquals
|
|
11
|
+
import org.junit.Assert.assertNotNull
|
|
12
|
+
import org.junit.Test
|
|
13
|
+
import org.junit.runner.RunWith
|
|
14
|
+
import org.robolectric.RobolectricTestRunner
|
|
15
|
+
import org.robolectric.Shadows.shadowOf
|
|
16
|
+
import org.robolectric.annotation.Config
|
|
17
|
+
import org.robolectric.annotation.LooperMode
|
|
18
|
+
|
|
19
|
+
@RunWith(RobolectricTestRunner::class)
|
|
20
|
+
@Config(sdk = [33], shadows = [G1PairingTest.ShadowLc3Cpp::class], instrumentedPackages = ["com.mentra.lc3Lib"])
|
|
21
|
+
@LooperMode(LooperMode.Mode.PAUSED)
|
|
22
|
+
class MentraLiveGlassesReadyBurstTest {
|
|
23
|
+
@Test fun `buffered phone_ready copies are one exchange with one init`() = withLive { live, inits ->
|
|
24
|
+
// Two SOC-ready heartbeats while the glasses boot: one exchange, sent twice.
|
|
25
|
+
receive(live, socReady())
|
|
26
|
+
val readyId = pendingReadyId(live)
|
|
27
|
+
receive(live, socReady())
|
|
28
|
+
assertEquals(readyId, pendingReadyId(live))
|
|
29
|
+
|
|
30
|
+
// The glasses answer every buffered copy; only the first followed a reset.
|
|
31
|
+
repeat(7) { receive(live, glassesReady("booted", readyId)) }
|
|
32
|
+
assertEquals(1, inits())
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@Test fun `answers to a superseded exchange are ignored until the pending one arrives`() = withLive { live, inits ->
|
|
36
|
+
receive(live, socReady())
|
|
37
|
+
val first = pendingReadyId(live)
|
|
38
|
+
receive(live, glassesReady("booted", first))
|
|
39
|
+
invoke(live, "sendPhoneReady", "readiness re-run")
|
|
40
|
+
val second = pendingReadyId(live)
|
|
41
|
+
|
|
42
|
+
// The same process already reset for the first exchange; the pending one is still to come.
|
|
43
|
+
receive(live, glassesReady("booted", first))
|
|
44
|
+
assertEquals(1, inits())
|
|
45
|
+
receive(live, glassesReady("booted", second))
|
|
46
|
+
assertEquals(2, inits())
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@Test fun `an answer from another glasses process is handled with no exchange pending`() = withLive { live, inits ->
|
|
50
|
+
receive(live, socReady())
|
|
51
|
+
val readyId = pendingReadyId(live)
|
|
52
|
+
receive(live, glassesReady("booted", readyId))
|
|
53
|
+
|
|
54
|
+
// A restarted process reset its transport for this copy, so it is not a repeat.
|
|
55
|
+
receive(live, glassesReady("restarted", readyId))
|
|
56
|
+
assertEquals(2, inits())
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@Test fun `a restarted process answering an older copy is handled and the pending exchange still counts`() = withLive { live, inits ->
|
|
60
|
+
receive(live, socReady())
|
|
61
|
+
val first = pendingReadyId(live)
|
|
62
|
+
receive(live, glassesReady("booted", first))
|
|
63
|
+
invoke(live, "sendPhoneReady", "glasses session changed")
|
|
64
|
+
val second = pendingReadyId(live)
|
|
65
|
+
|
|
66
|
+
// The restarted process reset for a buffered copy of the old exchange, then resets
|
|
67
|
+
// again for the pending one: both answers follow a reset.
|
|
68
|
+
receive(live, glassesReady("restarted", first))
|
|
69
|
+
assertEquals(2, inits())
|
|
70
|
+
receive(live, glassesReady("restarted", second))
|
|
71
|
+
assertEquals(3, inits())
|
|
72
|
+
receive(live, glassesReady("restarted", second))
|
|
73
|
+
assertEquals(3, inits())
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@Test fun `the readiness exchange ends with the BLE session`() = withLive { live, _ ->
|
|
77
|
+
receive(live, socReady())
|
|
78
|
+
val first = pendingReadyId(live)
|
|
79
|
+
invoke(live, "updateConnectionState", ConnTypes.DISCONNECTED)
|
|
80
|
+
|
|
81
|
+
receive(live, socReady())
|
|
82
|
+
assertNotEquals(first, pendingReadyId(live))
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@Test fun `glasses without readyId keep initializing on every answer`() = withLive { live, inits ->
|
|
86
|
+
receive(live, glassesReady("legacy", null))
|
|
87
|
+
receive(live, glassesReady("legacy", null))
|
|
88
|
+
assertEquals(2, inits())
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** Runs `body` on a fresh MentraLive, counting SOC inits (one version request each). */
|
|
92
|
+
private fun withLive(body: (MentraLive, () -> Int) -> Unit) {
|
|
93
|
+
Bridge.initialize(ApplicationProvider.getApplicationContext())
|
|
94
|
+
val live = MentraLive()
|
|
95
|
+
var inits = 0
|
|
96
|
+
val sink = Bridge.addEventSink { type, event ->
|
|
97
|
+
if (type == "log" && event["message"].toString().contains("Requesting version info from ASG client")) {
|
|
98
|
+
inits++
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
try {
|
|
102
|
+
body(live) { inits }
|
|
103
|
+
} finally {
|
|
104
|
+
Bridge.removeEventSink(sink)
|
|
105
|
+
live.destroy()
|
|
106
|
+
shadowOf(Looper.getMainLooper()).idleFor(Duration.ofSeconds(2))
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
private fun socReady() = JSONObject().put("C", "sr_hrt").put("B", JSONObject().put("ready", 1))
|
|
111
|
+
|
|
112
|
+
private fun glassesReady(sid: String, readyId: String?) = JSONObject().apply {
|
|
113
|
+
put("type", "glasses_ready")
|
|
114
|
+
put("sid", sid)
|
|
115
|
+
if (readyId != null) put("readyId", readyId)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
private fun pendingReadyId(live: MentraLive): String {
|
|
119
|
+
val readyId = MentraLive::class.java.getDeclaredField("pendingReadyId")
|
|
120
|
+
.apply { isAccessible = true }
|
|
121
|
+
.get(live) as String?
|
|
122
|
+
assertNotNull("SOC ready should start a readiness exchange", readyId)
|
|
123
|
+
return readyId!!
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
private fun receive(live: MentraLive, json: JSONObject) {
|
|
127
|
+
MentraLive::class.java.getDeclaredMethod("processJsonMessage", JSONObject::class.java)
|
|
128
|
+
.apply { isAccessible = true }
|
|
129
|
+
.invoke(live, json)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
private fun invoke(live: MentraLive, name: String, argument: String) {
|
|
133
|
+
MentraLive::class.java.getDeclaredMethod(name, String::class.java)
|
|
134
|
+
.apply { isAccessible = true }
|
|
135
|
+
.invoke(live, argument)
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
package com.mentra.bluetoothsdk.sgcs
|
|
2
|
+
|
|
3
|
+
import android.os.Looper
|
|
4
|
+
import androidx.test.core.app.ApplicationProvider
|
|
5
|
+
import com.mentra.bluetoothsdk.Bridge
|
|
6
|
+
import java.time.Duration
|
|
7
|
+
import org.json.JSONObject
|
|
8
|
+
import org.junit.Assert.assertEquals
|
|
9
|
+
import org.junit.Assert.assertTrue
|
|
10
|
+
import org.junit.Test
|
|
11
|
+
import org.junit.runner.RunWith
|
|
12
|
+
import org.robolectric.RobolectricTestRunner
|
|
13
|
+
import org.robolectric.Shadows.shadowOf
|
|
14
|
+
import org.robolectric.annotation.Config
|
|
15
|
+
import org.robolectric.annotation.LooperMode
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The glasses answer every RGB LED command with `rgb_led_control_response` echoing the command's
|
|
19
|
+
* requestId. MentraLive must forward that reply so the pending SDK request settles instead of
|
|
20
|
+
* timing out.
|
|
21
|
+
*/
|
|
22
|
+
@RunWith(RobolectricTestRunner::class)
|
|
23
|
+
@Config(sdk = [33], shadows = [G1PairingTest.ShadowLc3Cpp::class], instrumentedPackages = ["com.mentra.lc3Lib"])
|
|
24
|
+
@LooperMode(LooperMode.Mode.PAUSED)
|
|
25
|
+
class MentraLiveRgbLedResponseTest {
|
|
26
|
+
@Test fun `success reply settles the request it echoes`() {
|
|
27
|
+
val replies = forwardedReplies(
|
|
28
|
+
JSONObject().put("type", "rgb_led_control_response").put("requestId", "led-1")
|
|
29
|
+
.put("state", "success").put("success", true),
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
assertEquals(1, replies.size)
|
|
33
|
+
assertEquals("led-1", replies[0]["requestId"])
|
|
34
|
+
assertEquals("success", replies[0]["state"])
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@Test fun `error reply carries the glasses error code`() {
|
|
38
|
+
val replies = forwardedReplies(
|
|
39
|
+
JSONObject().put("type", "rgb_led_control_response").put("requestId", "led-2")
|
|
40
|
+
.put("state", "error").put("success", false)
|
|
41
|
+
.put("errorCode", "device_not_supported").put("error", "RGB LED not supported"),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
assertEquals(1, replies.size)
|
|
45
|
+
assertEquals("error", replies[0]["state"])
|
|
46
|
+
assertEquals("device_not_supported", replies[0]["errorCode"])
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@Test fun `reply without a requestId is not forwarded`() {
|
|
50
|
+
val replies = forwardedReplies(
|
|
51
|
+
JSONObject().put("type", "rgb_led_control_response").put("state", "success"),
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
assertTrue(replies.isEmpty())
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
private fun forwardedReplies(reply: JSONObject): List<Map<String, Any?>> {
|
|
58
|
+
Bridge.initialize(ApplicationProvider.getApplicationContext())
|
|
59
|
+
val live = MentraLive()
|
|
60
|
+
val replies = mutableListOf<Map<String, Any?>>()
|
|
61
|
+
val sink = Bridge.addEventSink { type, body ->
|
|
62
|
+
if (type == "rgb_led_control_response") replies.add(body.toMap())
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
MentraLive::class.java.getDeclaredMethod("processJsonMessage", JSONObject::class.java)
|
|
66
|
+
.apply { isAccessible = true }
|
|
67
|
+
.invoke(live, reply)
|
|
68
|
+
shadowOf(Looper.getMainLooper()).idle()
|
|
69
|
+
} finally {
|
|
70
|
+
Bridge.removeEventSink(sink)
|
|
71
|
+
live.destroy()
|
|
72
|
+
shadowOf(Looper.getMainLooper()).idleFor(Duration.ofSeconds(2))
|
|
73
|
+
}
|
|
74
|
+
return replies
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -480,12 +480,15 @@ export type RgbLedControlResponseEvent = {
|
|
|
480
480
|
export type RgbLedControlSuccessResponseEvent = Extract<RgbLedControlResponseEvent, {
|
|
481
481
|
state: "success";
|
|
482
482
|
}>;
|
|
483
|
+
export type TouchGesture = "single_tap" | "double_tap" | "triple_tap" | "long_press" | "forward_swipe" | "backward_swipe" | "up_swipe" | "down_swipe";
|
|
483
484
|
export type SettingsAckStatus = "applied" | "ready" | "error" | "failed" | "failure" | "rejected";
|
|
484
|
-
export type SettingsAckSetting = "gallery_server" | "gallery_mode" | "button_photo" | "button_video_recording" | "button_max_recording_time" | "camera_fov" | "camera_fov_override" | "camera_tuning";
|
|
485
|
+
export type SettingsAckSetting = "touch_gesture_default" | "gallery_server" | "gallery_mode" | "button_photo" | "button_video_recording" | "button_max_recording_time" | "camera_fov" | "camera_fov_override" | "camera_tuning";
|
|
485
486
|
export type SettingsAckEvent = {
|
|
486
487
|
type: "settings_ack";
|
|
487
488
|
requestId: string;
|
|
488
489
|
setting: SettingsAckSetting;
|
|
490
|
+
/** Gesture whose stock behavior was changed; present for touch_gesture_default. */
|
|
491
|
+
gesture?: TouchGesture;
|
|
489
492
|
status: SettingsAckStatus;
|
|
490
493
|
timestamp: number;
|
|
491
494
|
fov?: number;
|
|
@@ -1213,6 +1216,8 @@ export interface BluetoothSdkPublicModule {
|
|
|
1213
1216
|
* Returns saved enabled state plus current listening/url. No Wi-Fi means listening=false.
|
|
1214
1217
|
*/
|
|
1215
1218
|
setGalleryServerEnabled(enabled: boolean): Promise<SettingsAckSuccessEvent>;
|
|
1219
|
+
/** Mentra Live only. Keep gesture events; reset stock actions on BLE disconnect. Requires compatible BES firmware. */
|
|
1220
|
+
setTouchGestureDefaultBehaviorEnabled(gesture: TouchGesture, enabled: boolean): Promise<SettingsAckSuccessEvent>;
|
|
1216
1221
|
setGalleryModeEnabled(enabled: boolean): Promise<SettingsAckSuccessEvent>;
|
|
1217
1222
|
setVoiceActivityDetectionEnabled(enabled: boolean): Promise<void>;
|
|
1218
1223
|
setLoudnessGateEnabled(enabled: boolean): Promise<void>;
|