@mentra/bluetooth-sdk 3.3.0-dev.944 → 3.4.0-dev.1003
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 +78 -0
- package/android/src/debug/java/com/mentra/bluetoothsdk/sgcs/NimoResourceDiagnostics.kt +274 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/BluetoothSdkModule.kt +13 -3
- package/android/src/main/java/com/mentra/bluetoothsdk/Bridge.kt +8 -1
- package/android/src/main/java/com/mentra/bluetoothsdk/DeviceManager.kt +79 -8
- package/android/src/main/java/com/mentra/bluetoothsdk/DeviceStore.kt +21 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/GeneratedChangelogCatalog.kt +1 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/GeneratedReleaseMetadata.kt +6 -6
- package/android/src/main/java/com/mentra/bluetoothsdk/MentraBluetoothSdk.kt +22 -4
- 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/sgcs/GlassesAudioSetupPolicy.kt +64 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLive.kt +832 -134
- 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 +337 -39
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/NimoCanvasCoordinator.kt +8 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/NimoCanvasEncoder.kt +8 -1
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/NimoCanvasSession.kt +1 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/status/DeviceStatus.kt +50 -0
- package/android/src/release/java/com/mentra/bluetoothsdk/sgcs/NimoResourceDiagnostics.kt +16 -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/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/testDebug/java/com/mentra/bluetoothsdk/sgcs/NimoLifecycleTest.kt +564 -1
- package/build/BluetoothSdk.types.d.ts +110 -2
- package/build/BluetoothSdk.types.d.ts.map +1 -1
- package/build/BluetoothSdk.types.js.map +1 -1
- package/build/_private/BluetoothSdkModule.d.ts +6 -2
- 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/generated/changelogCatalog.d.ts +3 -0
- package/build/generated/changelogCatalog.d.ts.map +1 -1
- package/build/generated/changelogCatalog.js +4 -0
- package/build/generated/changelogCatalog.js.map +1 -1
- package/build/generated/releaseMetadata.js +6 -6
- package/build/generated/releaseMetadata.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4 -0
- package/build/index.js.map +1 -1
- package/ios/BluetoothSdkModule.swift +24 -4
- package/ios/Source/BluetoothSdkDefaults.swift +1 -1
- package/ios/Source/Bridge.swift +11 -3
- package/ios/Source/DeviceManager.swift +103 -7
- package/ios/Source/DeviceStore.swift +27 -0
- package/ios/Source/GeneratedChangelogCatalog.swift +1 -0
- package/ios/Source/GeneratedReleaseMetadata.swift +6 -6
- package/ios/Source/MentraBluetoothSDK.swift +41 -7
- package/ios/Source/TouchGesture.swift +13 -0
- package/ios/Source/errors/BluetoothSdkError.swift +5 -1
- package/ios/Source/events/BluetoothEvents.swift +4 -0
- package/ios/Source/internal/BleTraceLogger.swift +9 -6
- package/ios/Source/sgcs/GlassesAudioSetupPolicy.swift +181 -0
- package/ios/Source/sgcs/MentraLive.swift +1196 -173
- 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 +278 -38
- package/ios/Source/sgcs/NimoCanvasCoordinator.swift +77 -18
- package/ios/Source/sgcs/NimoCanvasSession.swift +1 -0
- package/ios/Source/sgcs/NimoMacResourceTransport.swift +217 -0
- package/ios/Source/sgcs/NimoResourceFixture.swift +384 -0
- package/ios/Source/sgcs/NimoResourceSession.swift +406 -0
- package/ios/Source/sgcs/SGCManager.swift +7 -0
- package/ios/Source/sgcs/Simulated.swift +2 -0
- package/ios/Source/status/DeviceStatus.swift +35 -0
- package/ios/Source/types/DeviceModels.swift +8 -1
- package/ios/Source/utils/AudioSessionMonitor.swift +158 -5
- package/ios/Tests/BluetoothAudioRouteTests.swift +82 -0
- package/ios/Tests/DeviceManagerReconnectTests.swift +75 -2
- package/ios/Tests/GlassesAudioSetupPolicyTests.swift +191 -0
- package/ios/Tests/MentraLiveAudioSetupTests.swift +215 -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 +328 -26
- package/ios/Tests/NimoCanvasTransportTests.swift +147 -0
- package/ios/Tests/NimoResourceSessionTests.swift +476 -0
- package/ios/Tests/TouchGestureCommandTests.swift +87 -0
- package/ios/Tests/WifiAdbDispatchTests.swift +118 -0
- package/package.json +3 -2
- package/src/BluetoothSdk.types.ts +115 -1
- package/src/_private/BluetoothSdkModule.ts +7 -1
- package/src/generated/changelogCatalog.ts +4 -0
- package/src/generated/releaseMetadata.ts +6 -6
- package/src/index.ts +12 -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-dev.1003",
|
|
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-dev.1003"
|
|
118
119
|
},
|
|
119
120
|
"devDependencies": {
|
|
120
121
|
"@types/node": "^25.9.3",
|
|
@@ -584,9 +584,20 @@ export type RgbLedControlResponseEvent =
|
|
|
584
584
|
|
|
585
585
|
export type RgbLedControlSuccessResponseEvent = Extract<RgbLedControlResponseEvent, {state: "success"}>
|
|
586
586
|
|
|
587
|
+
export type TouchGesture =
|
|
588
|
+
| "single_tap"
|
|
589
|
+
| "double_tap"
|
|
590
|
+
| "triple_tap"
|
|
591
|
+
| "long_press"
|
|
592
|
+
| "forward_swipe"
|
|
593
|
+
| "backward_swipe"
|
|
594
|
+
| "up_swipe"
|
|
595
|
+
| "down_swipe"
|
|
596
|
+
|
|
587
597
|
export type SettingsAckStatus = "applied" | "ready" | "error" | "failed" | "failure" | "rejected"
|
|
588
598
|
|
|
589
599
|
export type SettingsAckSetting =
|
|
600
|
+
| "touch_gesture_default"
|
|
590
601
|
| "gallery_server"
|
|
591
602
|
| "gallery_mode"
|
|
592
603
|
| "button_photo"
|
|
@@ -600,6 +611,8 @@ export type SettingsAckEvent = {
|
|
|
600
611
|
type: "settings_ack"
|
|
601
612
|
requestId: string
|
|
602
613
|
setting: SettingsAckSetting
|
|
614
|
+
/** Gesture whose stock behavior was changed; present for touch_gesture_default. */
|
|
615
|
+
gesture?: TouchGesture
|
|
603
616
|
status: SettingsAckStatus
|
|
604
617
|
timestamp: number
|
|
605
618
|
fov?: number
|
|
@@ -863,9 +876,68 @@ export type StreamKeepAliveRequest = {
|
|
|
863
876
|
ackId: string
|
|
864
877
|
}
|
|
865
878
|
|
|
879
|
+
/**
|
|
880
|
+
* Stable machine-readable `pair_failure` causes. Unknown native codes still typecheck.
|
|
881
|
+
* `ios_forget_pairing`: iOS holds a stale Bluetooth pairing for these glasses during an
|
|
882
|
+
* explicit attempt; the user must remove it in Settings > Bluetooth before pairing again.
|
|
883
|
+
*/
|
|
884
|
+
export type PairFailureCode = "ios_forget_pairing" | string
|
|
885
|
+
|
|
866
886
|
export type PairFailureEvent = {
|
|
867
887
|
type: "pair_failure"
|
|
868
888
|
error: string
|
|
889
|
+
/** Stable cause, when the SDK can classify the failure. */
|
|
890
|
+
code?: PairFailureCode
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* Mentra Live pairing state, owned by the SDK.
|
|
895
|
+
* - `normal`: no pairing mode in effect; automatic reconnect is allowed.
|
|
896
|
+
* - `pairing_mode`: the glasses opened a pairing window. Automatic reconnect is paused until
|
|
897
|
+
* `endsAtMs` or until the glasses report the window ended. `windowId` identifies the
|
|
898
|
+
* window and survives a cold restart.
|
|
899
|
+
* - `pairing_rejected`: the glasses no longer accept this phone (another phone paired, or repeated
|
|
900
|
+
* authentication rejections on secure-pairing firmware). Reconnect has stopped. Render Pair Again.
|
|
901
|
+
*/
|
|
902
|
+
export type MentraLivePairingState =
|
|
903
|
+
| {state: "normal"}
|
|
904
|
+
| {state: "pairing_mode"; windowId: number; endsAtMs: number}
|
|
905
|
+
| {state: "pairing_rejected"}
|
|
906
|
+
|
|
907
|
+
export type PairingStateChangedEvent = {
|
|
908
|
+
state: MentraLivePairingState
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
/**
|
|
912
|
+
* Whether the user has to do anything to get glasses audio working, decided by the SDK for
|
|
913
|
+
* every glasses model. Render it; do not add your own audio timers or platform checks.
|
|
914
|
+
*
|
|
915
|
+
* - `idle`: no glasses session.
|
|
916
|
+
* - `not_applicable`: no user step for audio. Android attaches Classic audio from the BLE bond,
|
|
917
|
+
* and glasses without Classic audio have nothing to set up.
|
|
918
|
+
* - `connecting`: the glasses are connected, audio is not, and the SDK still expects audio to
|
|
919
|
+
* come up on its own (for example iPhone audio derived from the BLE pair).
|
|
920
|
+
* - `connected`: Classic audio (A2DP or HFP) to the glasses is up.
|
|
921
|
+
* - `needs_user`: audio did not come up on its own. Ask the user to connect the glasses in the
|
|
922
|
+
* system Bluetooth settings (iPhone: Settings > Bluetooth). The state moves to `connected`
|
|
923
|
+
* as soon as audio comes up.
|
|
924
|
+
*/
|
|
925
|
+
export type GlassesAudioSetupState =
|
|
926
|
+
| {state: "idle"}
|
|
927
|
+
| {state: "not_applicable"}
|
|
928
|
+
| {state: "connecting"}
|
|
929
|
+
| {state: "connected"}
|
|
930
|
+
| {state: "needs_user"; action: "connect_in_settings"}
|
|
931
|
+
|
|
932
|
+
export type AudioSetupChangedEvent = {
|
|
933
|
+
state: GlassesAudioSetupState
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
export type PairingModeEndedReason = "paired" | "cancelled" | "timeout" | string
|
|
937
|
+
|
|
938
|
+
export type PairingModeEndedEvent = {
|
|
939
|
+
reason: PairingModeEndedReason
|
|
940
|
+
window_id?: number
|
|
869
941
|
}
|
|
870
942
|
|
|
871
943
|
export type PairingInfoEvent = {
|
|
@@ -874,13 +946,27 @@ export type PairingInfoEvent = {
|
|
|
874
946
|
classic_bond_ready?: boolean
|
|
875
947
|
secure_pairing_capable?: boolean
|
|
876
948
|
protocol_version?: number
|
|
949
|
+
/** Present when the glasses build includes ownership transfer. */
|
|
950
|
+
ownership_transfer?: boolean
|
|
951
|
+
/** True when the glasses derive Classic audio from the LE pair (CTKD), so audio should connect on its own. */
|
|
952
|
+
auto_audio?: boolean
|
|
953
|
+
/** True only after a BLE bond committed the owner and the window closed. */
|
|
954
|
+
owner_committed?: boolean
|
|
877
955
|
}
|
|
878
956
|
|
|
879
957
|
export type EnteringPairingModeEvent = {
|
|
880
958
|
window_ms: number
|
|
959
|
+
/** Identifies this pairing window. Also carried in `pairing_mode_ended` and the advertisement. */
|
|
960
|
+
window_id?: number
|
|
881
961
|
reason?: string
|
|
962
|
+
/** The glasses kept their bonds when the window opened; they change only if another phone pairs. */
|
|
963
|
+
owner_retained?: boolean
|
|
882
964
|
}
|
|
883
965
|
|
|
966
|
+
/**
|
|
967
|
+
* @deprecated No longer emitted. Observe `pairing_state_changed` (or `GlassesStatus.pairingState`)
|
|
968
|
+
* and render Pair Again for `pairing_rejected`.
|
|
969
|
+
*/
|
|
884
970
|
export type OwnerReplacedEvent = {
|
|
885
971
|
reason: string
|
|
886
972
|
}
|
|
@@ -1169,6 +1255,10 @@ export type BluetoothSdkModuleEvents = {
|
|
|
1169
1255
|
pair_failure: (event: PairFailureEvent) => void
|
|
1170
1256
|
pairing_info: (event: PairingInfoEvent) => void
|
|
1171
1257
|
entering_pairing_mode: (event: EnteringPairingModeEvent) => void
|
|
1258
|
+
pairing_mode_ended: (event: PairingModeEndedEvent) => void
|
|
1259
|
+
pairing_state_changed: (event: PairingStateChangedEvent) => void
|
|
1260
|
+
audio_setup_changed: (event: AudioSetupChangedEvent) => void
|
|
1261
|
+
/** @deprecated No longer emitted. Use `pairing_state_changed`. */
|
|
1172
1262
|
owner_replaced: (event: OwnerReplacedEvent) => void
|
|
1173
1263
|
audio_pairing_needed: (event: AudioPairingNeededEvent) => void
|
|
1174
1264
|
audio_connected: (event: AudioConnectedEvent) => void
|
|
@@ -1333,6 +1423,10 @@ export type BluetoothSdkEventMap = {
|
|
|
1333
1423
|
pair_failure: PairFailureEvent
|
|
1334
1424
|
pairing_info: PairingInfoEvent
|
|
1335
1425
|
entering_pairing_mode: EnteringPairingModeEvent
|
|
1426
|
+
pairing_mode_ended: PairingModeEndedEvent
|
|
1427
|
+
pairing_state_changed: PairingStateChangedEvent
|
|
1428
|
+
audio_setup_changed: AudioSetupChangedEvent
|
|
1429
|
+
/** @deprecated No longer emitted. Use `pairing_state_changed`. */
|
|
1336
1430
|
owner_replaced: OwnerReplacedEvent
|
|
1337
1431
|
audio_pairing_needed: AudioPairingNeededEvent
|
|
1338
1432
|
audio_connected: AudioConnectedEvent
|
|
@@ -1417,7 +1511,9 @@ export interface BluetoothSdkPublicModule {
|
|
|
1417
1511
|
/** Set the glasses clock from the phone after an OTA clock-skew failure. */
|
|
1418
1512
|
setSystemTime(timestampMs: number): Promise<void>
|
|
1419
1513
|
/** Enable or disable Wi-Fi ADB on Mentra Live (no-op on other devices). */
|
|
1420
|
-
|
|
1514
|
+
/** When supplied, binds native admission to this full MAC observed in the current BLE session.
|
|
1515
|
+
* Resolves on queue admission, without confirming glasses-side state. */
|
|
1516
|
+
setWifiAdbState(enabled: boolean, expectedBluetoothMac?: string): Promise<void>
|
|
1421
1517
|
|
|
1422
1518
|
/**
|
|
1423
1519
|
* Persistently enable/disable unauthenticated HTTP gallery access on the glasses' Wi-Fi.
|
|
@@ -1425,6 +1521,8 @@ export interface BluetoothSdkPublicModule {
|
|
|
1425
1521
|
* Returns saved enabled state plus current listening/url. No Wi-Fi means listening=false.
|
|
1426
1522
|
*/
|
|
1427
1523
|
setGalleryServerEnabled(enabled: boolean): Promise<SettingsAckSuccessEvent>
|
|
1524
|
+
/** Mentra Live only. Keep gesture events; reset stock actions on BLE disconnect. Requires compatible BES firmware. */
|
|
1525
|
+
setTouchGestureDefaultBehaviorEnabled(gesture: TouchGesture, enabled: boolean): Promise<SettingsAckSuccessEvent>
|
|
1428
1526
|
setGalleryModeEnabled(enabled: boolean): Promise<SettingsAckSuccessEvent>
|
|
1429
1527
|
setVoiceActivityDetectionEnabled(enabled: boolean): Promise<void>
|
|
1430
1528
|
setLoudnessGateEnabled(enabled: boolean): Promise<void>
|
|
@@ -1622,6 +1720,10 @@ export interface GlassesStatus {
|
|
|
1622
1720
|
micEnabled: boolean
|
|
1623
1721
|
voiceActivityDetectionEnabled: boolean
|
|
1624
1722
|
bluetoothClassicConnected: boolean
|
|
1723
|
+
/** iOS: an HFP input is available or a matching Bluetooth output is active. Android: same as `bluetoothClassicConnected`. */
|
|
1724
|
+
bluetoothClassicProfilesConnected: boolean
|
|
1725
|
+
/** iOS: a matching Bluetooth output is the active audio route. Android: same as `bluetoothClassicConnected`. */
|
|
1726
|
+
bluetoothAudioRouted: boolean
|
|
1625
1727
|
signalStrength: number
|
|
1626
1728
|
/** Milliseconds since epoch when signalStrength was last refreshed by the phone BLE stack. */
|
|
1627
1729
|
signalStrengthUpdatedAt: number
|
|
@@ -1636,6 +1738,10 @@ export interface GlassesStatus {
|
|
|
1636
1738
|
leftMacAddress: string
|
|
1637
1739
|
rightMacAddress: string
|
|
1638
1740
|
buildNumber: string
|
|
1741
|
+
/** Mentra Live pairing state owned by the SDK. Absent on other models. */
|
|
1742
|
+
pairingState?: MentraLivePairingState
|
|
1743
|
+
/** Audio setup state owned by the SDK, on every model. See `GlassesAudioSetupState`. */
|
|
1744
|
+
audioSetup?: GlassesAudioSetupState
|
|
1639
1745
|
/** Glasses System.currentTimeMillis() from last version_info (clock skew detection). */
|
|
1640
1746
|
systemTimeMs?: number
|
|
1641
1747
|
otaVersionUrl: string
|
|
@@ -1730,6 +1836,14 @@ export interface ConnectOptions {
|
|
|
1730
1836
|
* Android accepts this option as a no-op.
|
|
1731
1837
|
*/
|
|
1732
1838
|
requiresAncs?: boolean
|
|
1839
|
+
/**
|
|
1840
|
+
* iOS Mentra Live only. When true, CoreBluetooth is asked to bring up the
|
|
1841
|
+
* Classic profiles (A2DP/HFP) after the BLE connection
|
|
1842
|
+
* (CBConnectPeripheralOptionEnableTransportBridgingKey). Defaults to true:
|
|
1843
|
+
* without it the pairing screen waits for an audio route that never appears.
|
|
1844
|
+
* Android accepts this option as a no-op.
|
|
1845
|
+
*/
|
|
1846
|
+
enableTransportBridging?: boolean
|
|
1733
1847
|
}
|
|
1734
1848
|
|
|
1735
1849
|
export type ScanResultsCallback = (devices: Device[]) => void
|
|
@@ -49,6 +49,7 @@ import {
|
|
|
49
49
|
SettingsAckSuccessEvent,
|
|
50
50
|
StreamStartRequest,
|
|
51
51
|
StreamStatusEvent,
|
|
52
|
+
TouchGesture,
|
|
52
53
|
VideoRecordingStartedStatusEvent,
|
|
53
54
|
VideoRecordingSettings,
|
|
54
55
|
VideoRecordingStoppedStatusEvent,
|
|
@@ -92,6 +93,9 @@ declare class BluetoothSdkNativeModule extends NativeModule<BluetoothSdkModuleEv
|
|
|
92
93
|
|
|
93
94
|
// Connection Commands
|
|
94
95
|
requestStatus(): Promise<void>
|
|
96
|
+
/** Mac-only explicit fixture launch. Strict nimo-macos-resource-v1 Codable
|
|
97
|
+
* request/receipt JSON; ordinary launches refuse. No packet/path commands. */
|
|
98
|
+
nimoResourceSession?(requestJSON: string): Promise<string>
|
|
95
99
|
connectDefault(options?: ConnectOptions): Promise<void>
|
|
96
100
|
connectDefaultWithOptions(options: Required<ConnectOptions>): Promise<void>
|
|
97
101
|
setDefaultDevice(device: Device | null): Promise<void>
|
|
@@ -135,7 +139,7 @@ declare class BluetoothSdkNativeModule extends NativeModule<BluetoothSdkModuleEv
|
|
|
135
139
|
forgetWifiNetwork(ssid: string): Promise<WifiForgetResult>
|
|
136
140
|
setHotspotState(enabled: boolean): Promise<HotspotStatusChangeEvent>
|
|
137
141
|
/** Enable or disable Wi-Fi ADB on Mentra Live (no-op on other devices). */
|
|
138
|
-
setWifiAdbState(enabled: boolean): Promise<void>
|
|
142
|
+
setWifiAdbState(enabled: boolean, expectedBluetoothMac?: string): Promise<void>
|
|
139
143
|
/** Set the glasses system clock when phone detects clock skew (Mentra Live and G2). */
|
|
140
144
|
setSystemTime(timestampMs: number): Promise<void>
|
|
141
145
|
/** Logs current WiFi frequency (MHz) and 5 GHz band to Android logcat. */
|
|
@@ -143,6 +147,7 @@ declare class BluetoothSdkNativeModule extends NativeModule<BluetoothSdkModuleEv
|
|
|
143
147
|
|
|
144
148
|
// Gallery Commands
|
|
145
149
|
setGalleryServerEnabled(enabled: boolean): Promise<SettingsAckSuccessEvent>
|
|
150
|
+
setTouchGestureDefaultBehaviorEnabled(gesture: TouchGesture, enabled: boolean): Promise<SettingsAckSuccessEvent>
|
|
146
151
|
setGalleryModeEnabled(enabled: boolean): Promise<SettingsAckSuccessEvent>
|
|
147
152
|
setVoiceActivityDetectionEnabled(enabled: boolean): Promise<void>
|
|
148
153
|
/** Mentra Live center-mic loudness / Barrier gate (cs_swit type 10). */
|
|
@@ -356,6 +361,7 @@ const DEFAULT_CONNECT_OPTIONS: Required<ConnectOptions> = {
|
|
|
356
361
|
saveAsDefault: true,
|
|
357
362
|
cancelExistingConnectionAttempt: true,
|
|
358
363
|
requiresAncs: true,
|
|
364
|
+
enableTransportBridging: true,
|
|
359
365
|
}
|
|
360
366
|
|
|
361
367
|
const DEFAULT_SCAN_TIMEOUT_MS = 15_000
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/** Generated from /changelogs. Do not edit directly. */
|
|
2
2
|
export const GENERATED_RELEASE_CHANGELOGS = Object.freeze(
|
|
3
3
|
[
|
|
4
|
+
{
|
|
5
|
+
"version": "3.4.0",
|
|
6
|
+
"markdown": "This release is under active development. User-facing changes will be documented as they land."
|
|
7
|
+
},
|
|
4
8
|
{
|
|
5
9
|
"version": "3.3.0",
|
|
6
10
|
"markdown": "This release is under active development. User-facing changes will be documented as they land."
|
|
@@ -11,10 +11,10 @@ export interface BluetoothSdkReleaseMetadata {
|
|
|
11
11
|
|
|
12
12
|
export const BLUETOOTH_SDK_RELEASE_METADATA: Readonly<BluetoothSdkReleaseMetadata> = Object.freeze({
|
|
13
13
|
"schemaVersion": 1,
|
|
14
|
-
"familyBaseVersion": "3.
|
|
15
|
-
"releaseIdentity": "3.
|
|
16
|
-
"releaseSetId": "mentra-3.
|
|
17
|
-
"sourceCommit": "
|
|
18
|
-
"otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.
|
|
19
|
-
"otaManifestSha256": "
|
|
14
|
+
"familyBaseVersion": "3.4.0",
|
|
15
|
+
"releaseIdentity": "3.4.0-dev.1003",
|
|
16
|
+
"releaseSetId": "mentra-3.4.0-dev.1003",
|
|
17
|
+
"sourceCommit": "48d4c36700cb3f509f2bf831113d4f1344a8aaca",
|
|
18
|
+
"otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-dev.1003.json",
|
|
19
|
+
"otaManifestSha256": "cbd66999c0e1d5827a3202c9fc8ecfed3746e48ac6f2b03b68248c8d15b90498"
|
|
20
20
|
})
|
package/src/index.ts
CHANGED
|
@@ -47,6 +47,9 @@ const PUBLIC_EVENT_NAMES = new Set<BluetoothSdkEventName>([
|
|
|
47
47
|
"pair_failure",
|
|
48
48
|
"pairing_info",
|
|
49
49
|
"entering_pairing_mode",
|
|
50
|
+
"pairing_mode_ended",
|
|
51
|
+
"pairing_state_changed",
|
|
52
|
+
"audio_setup_changed",
|
|
50
53
|
"owner_replaced",
|
|
51
54
|
"audio_pairing_needed",
|
|
52
55
|
"audio_connected",
|
|
@@ -128,6 +131,7 @@ export const BluetoothSdk: BluetoothSdkPublicModule = Object.freeze({
|
|
|
128
131
|
setSystemTime: bindPublicMethod("setSystemTime"),
|
|
129
132
|
setWifiAdbState: bindPublicMethod("setWifiAdbState"),
|
|
130
133
|
setGalleryServerEnabled: bindPublicMethod("setGalleryServerEnabled"),
|
|
134
|
+
setTouchGestureDefaultBehaviorEnabled: bindPublicMethod("setTouchGestureDefaultBehaviorEnabled"),
|
|
131
135
|
setGalleryModeEnabled: bindPublicMethod("setGalleryModeEnabled"),
|
|
132
136
|
setVoiceActivityDetectionEnabled: bindPublicMethod("setVoiceActivityDetectionEnabled"),
|
|
133
137
|
setLoudnessGateEnabled: bindPublicMethod("setLoudnessGateEnabled"),
|
|
@@ -265,9 +269,16 @@ export type {
|
|
|
265
269
|
OtaUpdateInfo,
|
|
266
270
|
ReleaseChangelog,
|
|
267
271
|
MtkUpdateCompleteEvent,
|
|
272
|
+
PairFailureCode,
|
|
268
273
|
PairFailureEvent,
|
|
269
274
|
PairingInfoEvent,
|
|
270
275
|
EnteringPairingModeEvent,
|
|
276
|
+
MentraLivePairingState,
|
|
277
|
+
PairingModeEndedEvent,
|
|
278
|
+
PairingModeEndedReason,
|
|
279
|
+
PairingStateChangedEvent,
|
|
280
|
+
GlassesAudioSetupState,
|
|
281
|
+
AudioSetupChangedEvent,
|
|
271
282
|
OwnerReplacedEvent,
|
|
272
283
|
PhotoCaptureMetadata,
|
|
273
284
|
PhotoResolvedConfig,
|
|
@@ -311,6 +322,7 @@ export type {
|
|
|
311
322
|
SwipeVolumeStatusEvent,
|
|
312
323
|
SwitchStatusEvent,
|
|
313
324
|
TouchEvent,
|
|
325
|
+
TouchGesture,
|
|
314
326
|
VideoRecordingDefaults,
|
|
315
327
|
VideoRecordingStartedStatusEvent,
|
|
316
328
|
VideoRecordingStatusEvent,
|