@mentra/bluetooth-sdk 0.1.10 → 0.1.11
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 +1 -1
- package/android/src/main/java/com/mentra/bluetoothsdk/BluetoothSdkModule.kt +39 -16
- package/android/src/main/java/com/mentra/bluetoothsdk/Bridge.kt +14 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/DeviceManager.kt +22 -3
- package/android/src/main/java/com/mentra/bluetoothsdk/DeviceStore.kt +8 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/camera/CameraModels.kt +2 -1
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/G2.kt +829 -643
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraNex.kt +40 -64
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/SGCManager.kt +11 -1
- package/build/BluetoothSdk.types.d.ts +12 -1
- package/build/BluetoothSdk.types.d.ts.map +1 -1
- package/build/BluetoothSdk.types.js.map +1 -1
- package/build/_private/BluetoothSdkModule.d.ts +1 -0
- package/build/_private/BluetoothSdkModule.d.ts.map +1 -1
- package/build/_private/BluetoothSdkModule.js +14 -1
- package/build/_private/BluetoothSdkModule.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/ios/BluetoothSdkModule.swift +3 -0
- package/ios/Source/Bridge.swift +10 -0
- package/ios/Source/DeviceManager.swift +24 -21
- package/ios/Source/DeviceStore.swift +8 -2
- package/ios/Source/camera/CameraModels.swift +1 -0
- package/ios/Source/sgcs/G1.swift +3 -3
- package/ios/Source/sgcs/G2.swift +1022 -640
- package/ios/Source/sgcs/Mach1.swift +2 -2
- package/ios/Source/sgcs/MentraLive.swift +2 -2
- package/ios/Source/sgcs/MentraNex.swift +215 -85
- package/ios/Source/sgcs/SGCManager.swift +13 -4
- package/ios/Source/sgcs/Simulated.swift +2 -2
- package/package.json +1 -1
- package/src/BluetoothSdk.types.ts +13 -1
- package/src/_private/BluetoothSdkModule.ts +22 -3
- package/src/index.ts +3 -0
|
@@ -21,6 +21,14 @@ export type TouchEvent = {
|
|
|
21
21
|
timestamp: number
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
export type AccelEvent = {
|
|
25
|
+
type: "accel_event"
|
|
26
|
+
x: number
|
|
27
|
+
y: number
|
|
28
|
+
z: number
|
|
29
|
+
timestamp: number
|
|
30
|
+
}
|
|
31
|
+
|
|
24
32
|
export type HeadUpEvent = {
|
|
25
33
|
up: boolean
|
|
26
34
|
}
|
|
@@ -396,7 +404,7 @@ export type SettingsAckSuccessEvent = Omit<SettingsAckEvent, "status"> & {
|
|
|
396
404
|
export type RgbLedAction = "on" | "off"
|
|
397
405
|
export type RgbLedColor = "red" | "green" | "blue" | "orange" | "white"
|
|
398
406
|
export type PhotoSize = "small" | "medium" | "large" | "full"
|
|
399
|
-
export type ButtonPhotoSize = "small" | "medium" | "large"
|
|
407
|
+
export type ButtonPhotoSize = "small" | "medium" | "large" | "max"
|
|
400
408
|
export type PhotoCompression = "none" | "medium" | "heavy"
|
|
401
409
|
|
|
402
410
|
/**
|
|
@@ -722,6 +730,7 @@ export type BluetoothSdkModuleEvents = {
|
|
|
722
730
|
glasses_not_ready: (event: GlassesNotReadyEvent) => void
|
|
723
731
|
button_press: (event: ButtonPressEvent) => void
|
|
724
732
|
touch_event: (event: TouchEvent) => void
|
|
733
|
+
accel_event: (event: AccelEvent) => void
|
|
725
734
|
head_up: (event: HeadUpEvent) => void
|
|
726
735
|
voice_activity_detection_status: (event: VoiceActivityDetectionStatusEvent) => void
|
|
727
736
|
speaking_status: (event: SpeakingStatusEvent) => void
|
|
@@ -796,6 +805,7 @@ export type BluetoothSdkEventMap = {
|
|
|
796
805
|
glasses_not_ready: GlassesNotReadyEvent
|
|
797
806
|
button_press: ButtonPressEvent
|
|
798
807
|
touch_event: TouchEvent
|
|
808
|
+
accel_event: AccelEvent
|
|
799
809
|
head_up: HeadUpEvent
|
|
800
810
|
voice_activity_detection_status: VoiceActivityDetectionStatusEvent
|
|
801
811
|
speaking_status: SpeakingStatusEvent
|
|
@@ -865,6 +875,7 @@ export interface BluetoothSdkPublicModule {
|
|
|
865
875
|
showDashboard(): Promise<void>
|
|
866
876
|
setDashboardPosition(height: number, depth: number): Promise<void>
|
|
867
877
|
setHeadUpAngle(angleDegrees: number): Promise<void>
|
|
878
|
+
setImuEnabled(enabled: boolean): Promise<void>
|
|
868
879
|
setScreenDisabled(disabled: boolean): Promise<void>
|
|
869
880
|
|
|
870
881
|
requestWifiScan(): Promise<WifiSearchResult[]>
|
|
@@ -1140,6 +1151,7 @@ export type BluetoothSettingsUpdate = Partial<{
|
|
|
1140
1151
|
screen_disabled: boolean
|
|
1141
1152
|
contextual_dashboard: boolean
|
|
1142
1153
|
head_up_angle: number
|
|
1154
|
+
imu_enabled: boolean
|
|
1143
1155
|
brightness: number
|
|
1144
1156
|
auto_brightness: boolean
|
|
1145
1157
|
dashboard_height: number
|
|
@@ -100,6 +100,7 @@ declare class BluetoothSdkNativeModule extends NativeModule<BluetoothSdkModuleEv
|
|
|
100
100
|
setDashboardMenu(items: DashboardMenuItem[]): Promise<void>
|
|
101
101
|
setCalendarEvents(events: CalendarEvent[]): Promise<void>
|
|
102
102
|
setHeadUpAngle(angleDegrees: number): Promise<void>
|
|
103
|
+
setImuEnabled(enabled: boolean): Promise<void>
|
|
103
104
|
setScreenDisabled(disabled: boolean): Promise<void>
|
|
104
105
|
ping(): Promise<void>
|
|
105
106
|
dbg1(): Promise<void>
|
|
@@ -225,6 +226,20 @@ const DEFAULT_CONNECT_OPTIONS: Required<ConnectOptions> = {
|
|
|
225
226
|
|
|
226
227
|
const DEFAULT_SCAN_TIMEOUT_MS = 15_000
|
|
227
228
|
|
|
229
|
+
function bindNativeMethod<T extends (...args: never[]) => unknown>(
|
|
230
|
+
module: Record<string, unknown>,
|
|
231
|
+
name: string,
|
|
232
|
+
): T {
|
|
233
|
+
const method = module[name]
|
|
234
|
+
if (typeof method !== "function") {
|
|
235
|
+
console.warn(`[BluetoothSdk] Native method "${name}" is unavailable — rebuild the app (bun android / bun ios)`)
|
|
236
|
+
return (async () => {
|
|
237
|
+
throw new Error(`BluetoothSdk.${name} is not available in this native build. Rebuild the app.`)
|
|
238
|
+
}) as T
|
|
239
|
+
}
|
|
240
|
+
return method.bind(module) as T
|
|
241
|
+
}
|
|
242
|
+
|
|
228
243
|
const CAMERA_ROI_MIN = 0
|
|
229
244
|
const CAMERA_ROI_MAX = 2
|
|
230
245
|
const CAMERA_ROI_POSITION_VALUES: Record<CameraRoiPosition, CameraFovSetting["roiPosition"]> = {
|
|
@@ -425,6 +440,10 @@ NativeBluetoothSdkModule.setHeadUpAngle = function (angleDegrees: number) {
|
|
|
425
440
|
return this.updateBluetoothSettings({head_up_angle: angleDegrees})
|
|
426
441
|
}
|
|
427
442
|
|
|
443
|
+
NativeBluetoothSdkModule.setImuEnabled = function (enabled: boolean) {
|
|
444
|
+
return this.updateBluetoothSettings({imu_enabled: enabled})
|
|
445
|
+
}
|
|
446
|
+
|
|
428
447
|
NativeBluetoothSdkModule.setScreenDisabled = function (disabled: boolean) {
|
|
429
448
|
return this.updateBluetoothSettings({screen_disabled: disabled})
|
|
430
449
|
}
|
|
@@ -433,9 +452,9 @@ NativeBluetoothSdkModule.setVoiceActivityDetectionEnabled = function (enabled: b
|
|
|
433
452
|
return this.updateBluetoothSettings({voice_activity_detection_enabled: enabled})
|
|
434
453
|
}
|
|
435
454
|
|
|
436
|
-
const nativeSetCameraFov =
|
|
437
|
-
fov: CameraFovSetting
|
|
438
|
-
|
|
455
|
+
const nativeSetCameraFov = bindNativeMethod<
|
|
456
|
+
(fov: CameraFovSetting) => MaybePromise<CameraFovResult>
|
|
457
|
+
>(NativeBluetoothSdkModule as unknown as Record<string, unknown>, "setCameraFov")
|
|
439
458
|
NativeBluetoothSdkModule.setCameraFov = function (request: CameraFovRequest) {
|
|
440
459
|
const setting = normalizeCameraFov(request)
|
|
441
460
|
return Promise.resolve(nativeSetCameraFov(setting))
|
package/src/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ const PUBLIC_EVENT_NAMES = new Set<BluetoothSdkEventName>([
|
|
|
8
8
|
"glasses_not_ready",
|
|
9
9
|
"button_press",
|
|
10
10
|
"touch_event",
|
|
11
|
+
"accel_event",
|
|
11
12
|
"head_up",
|
|
12
13
|
"voice_activity_detection_status",
|
|
13
14
|
"speaking_status",
|
|
@@ -65,6 +66,7 @@ export const BluetoothSdk: BluetoothSdkPublicModule = Object.freeze({
|
|
|
65
66
|
showDashboard: PrivateBluetoothSdkModule.showDashboard.bind(PrivateBluetoothSdkModule),
|
|
66
67
|
setDashboardPosition: PrivateBluetoothSdkModule.setDashboardPosition.bind(PrivateBluetoothSdkModule),
|
|
67
68
|
setHeadUpAngle: PrivateBluetoothSdkModule.setHeadUpAngle.bind(PrivateBluetoothSdkModule),
|
|
69
|
+
setImuEnabled: PrivateBluetoothSdkModule.setImuEnabled.bind(PrivateBluetoothSdkModule),
|
|
68
70
|
setScreenDisabled: PrivateBluetoothSdkModule.setScreenDisabled.bind(PrivateBluetoothSdkModule),
|
|
69
71
|
requestWifiScan: PrivateBluetoothSdkModule.requestWifiScan.bind(PrivateBluetoothSdkModule),
|
|
70
72
|
sendWifiCredentials: PrivateBluetoothSdkModule.sendWifiCredentials.bind(PrivateBluetoothSdkModule),
|
|
@@ -124,6 +126,7 @@ export {
|
|
|
124
126
|
} from "./BluetoothSdk.types"
|
|
125
127
|
|
|
126
128
|
export type {
|
|
129
|
+
AccelEvent,
|
|
127
130
|
AudioConnectedEvent,
|
|
128
131
|
AudioDisconnectedEvent,
|
|
129
132
|
AudioPairingNeededEvent,
|