@mentra/bluetooth-sdk 0.1.13 → 0.1.16
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 +18 -8
- package/android/src/main/java/com/mentra/bluetoothsdk/BluetoothSdkModule.kt +48 -48
- package/android/src/main/java/com/mentra/bluetoothsdk/Bridge.kt +5 -20
- package/android/src/main/java/com/mentra/bluetoothsdk/DeviceManager.kt +360 -269
- package/android/src/main/java/com/mentra/bluetoothsdk/DeviceStore.kt +3 -7
- package/android/src/main/java/com/mentra/bluetoothsdk/MentraBluetoothSdk.kt +152 -72
- package/android/src/main/java/com/mentra/bluetoothsdk/OtaManifest.kt +12 -12
- package/android/src/main/java/com/mentra/bluetoothsdk/camera/CameraModels.kt +25 -11
- package/android/src/main/java/com/mentra/bluetoothsdk/controllers/ControllerManager.kt +1 -2
- package/android/src/main/java/com/mentra/bluetoothsdk/controllers/R1.kt +1 -2
- package/android/src/main/java/com/mentra/bluetoothsdk/events/BluetoothEvents.kt +1 -22
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/G1.kt +51 -8
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/G2.kt +1184 -800
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/Mach1.kt +1 -5
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLive.kt +423 -117
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraNex.kt +4 -6
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/Nimo.kt +2532 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/SGCManager.kt +17 -5
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/Simulated.kt +3 -7
- package/android/src/main/java/com/mentra/bluetoothsdk/status/DeviceStatus.kt +0 -6
- package/android/src/main/java/com/mentra/bluetoothsdk/streaming/StreamModels.kt +16 -33
- package/android/src/main/java/com/mentra/bluetoothsdk/types/DeviceModels.kt +5 -3
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/Constants.kt +2 -1
- package/android/src/test/java/com/mentra/bluetoothsdk/camera/PhotoRequestTest.kt +60 -1
- package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/NimoProtocolTest.kt +333 -0
- package/build/BluetoothSdk.types.d.ts +50 -24
- package/build/BluetoothSdk.types.d.ts.map +1 -1
- package/build/BluetoothSdk.types.js +1 -0
- package/build/BluetoothSdk.types.js.map +1 -1
- package/build/_internal.d.ts +4 -4
- package/build/_internal.js +4 -4
- package/build/_internal.js.map +1 -1
- package/build/_private/BluetoothSdkModule.d.ts +14 -8
- package/build/_private/BluetoothSdkModule.d.ts.map +1 -1
- package/build/_private/BluetoothSdkModule.js +4 -3
- package/build/_private/BluetoothSdkModule.js.map +1 -1
- package/build/_private/cameraRequestPayload.d.ts +4 -0
- package/build/_private/cameraRequestPayload.d.ts.map +1 -0
- package/build/_private/cameraRequestPayload.js +25 -0
- package/build/_private/cameraRequestPayload.js.map +1 -0
- package/build/_private/photoRequestPayload.d.ts.map +1 -1
- package/build/_private/photoRequestPayload.js +11 -3
- package/build/_private/photoRequestPayload.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +70 -61
- package/build/index.js.map +1 -1
- package/ios/BluetoothSdkModule.swift +51 -28
- package/ios/Source/Bridge.swift +4 -16
- package/ios/Source/DeviceManager.swift +76 -22
- package/ios/Source/DeviceStore.swift +0 -4
- package/ios/Source/MentraBluetoothSDK.swift +144 -78
- package/ios/Source/OtaManifest.swift +13 -13
- package/ios/Source/camera/CameraModels.swift +82 -20
- package/ios/Source/controllers/ControllerManager.swift +1 -2
- package/ios/Source/controllers/R1.swift +1 -2
- package/ios/Source/errors/{BluetoothError.swift → BluetoothSdkError.swift} +1 -1
- package/ios/Source/events/BluetoothEvents.swift +5 -27
- package/ios/Source/internal/BluetoothAvailability.swift +5 -5
- package/ios/Source/sgcs/Frame.swift +0 -2
- package/ios/Source/sgcs/G1.swift +52 -4
- package/ios/Source/sgcs/G2.swift +643 -204
- package/ios/Source/sgcs/Mach1.swift +1 -3
- package/ios/Source/sgcs/MentraLive.swift +64 -77
- package/ios/Source/sgcs/MentraNex.swift +1 -3
- package/ios/Source/sgcs/Nimo.swift +1928 -0
- package/ios/Source/sgcs/SGCManager.swift +16 -10
- package/ios/Source/sgcs/Simulated.swift +2 -6
- package/ios/Source/status/DeviceStatus.swift +0 -8
- package/ios/Source/streaming/StreamModels.swift +7 -32
- package/ios/Source/stt/STTTools.swift +1 -1
- package/ios/Source/types/DeviceModels.swift +5 -0
- package/ios/Source/utils/Constants.swift +2 -0
- package/package.json +6 -1
- package/src/BluetoothSdk.types.ts +54 -28
- package/src/_internal.ts +4 -4
- package/src/_private/BluetoothSdkModule.ts +20 -11
- package/src/_private/cameraRequestPayload.ts +29 -0
- package/src/_private/photoRequestPayload.ts +12 -3
- package/src/index.ts +77 -67
package/src/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type {
|
|
|
3
3
|
BluetoothSdkEventListener,
|
|
4
4
|
BluetoothSdkEventName,
|
|
5
5
|
BluetoothSdkPublicModule,
|
|
6
|
-
|
|
6
|
+
VideoRecordingDefaults,
|
|
7
7
|
} from "./BluetoothSdk.types"
|
|
8
8
|
|
|
9
9
|
const PUBLIC_EVENT_NAMES = new Set<BluetoothSdkEventName>([
|
|
@@ -25,6 +25,7 @@ const PUBLIC_EVENT_NAMES = new Set<BluetoothSdkEventName>([
|
|
|
25
25
|
"hotspot_error",
|
|
26
26
|
"photo_response",
|
|
27
27
|
"photo_status",
|
|
28
|
+
"camera_status",
|
|
28
29
|
"video_recording_status",
|
|
29
30
|
"media_success",
|
|
30
31
|
"media_error",
|
|
@@ -58,74 +59,84 @@ const startOtaUpdate: BluetoothSdkPublicModule["startOtaUpdate"] = () => {
|
|
|
58
59
|
return PrivateBluetoothSdkModule.startOtaUpdate()
|
|
59
60
|
}
|
|
60
61
|
|
|
62
|
+
const bindPublicMethod = <K extends keyof BluetoothSdkPublicModule>(name: K): BluetoothSdkPublicModule[K] => {
|
|
63
|
+
const method = (PrivateBluetoothSdkModule as unknown as Record<string, unknown>)[name]
|
|
64
|
+
if (typeof method === "function") {
|
|
65
|
+
return method.bind(PrivateBluetoothSdkModule) as BluetoothSdkPublicModule[K]
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return (async () => {
|
|
69
|
+
throw new Error(`BluetoothSdk.${String(name)} is not available in this native build. Rebuild the app.`)
|
|
70
|
+
}) as unknown as BluetoothSdkPublicModule[K]
|
|
71
|
+
}
|
|
72
|
+
|
|
61
73
|
export const BluetoothSdk: BluetoothSdkPublicModule = Object.freeze({
|
|
62
74
|
addListener,
|
|
63
|
-
getDefaultDevice:
|
|
64
|
-
setDefaultDevice:
|
|
65
|
-
clearDefaultDevice:
|
|
66
|
-
startScan:
|
|
67
|
-
stopScan:
|
|
68
|
-
scan:
|
|
69
|
-
connect:
|
|
70
|
-
connectDefault:
|
|
71
|
-
cancelConnectionAttempt:
|
|
72
|
-
disconnect:
|
|
73
|
-
forget:
|
|
74
|
-
displayText:
|
|
75
|
-
clearDisplay:
|
|
76
|
-
showDashboard:
|
|
77
|
-
setDashboardPosition:
|
|
78
|
-
setHeadUpAngle:
|
|
79
|
-
setImuEnabled:
|
|
80
|
-
setScreenDisabled:
|
|
81
|
-
requestWifiScan:
|
|
82
|
-
sendWifiCredentials:
|
|
83
|
-
forgetWifiNetwork:
|
|
84
|
-
setHotspotState:
|
|
85
|
-
setGalleryModeEnabled:
|
|
86
|
-
setVoiceActivityDetectionEnabled:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
75
|
+
getDefaultDevice: bindPublicMethod("getDefaultDevice"),
|
|
76
|
+
setDefaultDevice: bindPublicMethod("setDefaultDevice"),
|
|
77
|
+
clearDefaultDevice: bindPublicMethod("clearDefaultDevice"),
|
|
78
|
+
startScan: bindPublicMethod("startScan"),
|
|
79
|
+
stopScan: bindPublicMethod("stopScan"),
|
|
80
|
+
scan: bindPublicMethod("scan") as BluetoothSdkPublicModule["scan"],
|
|
81
|
+
connect: bindPublicMethod("connect"),
|
|
82
|
+
connectDefault: bindPublicMethod("connectDefault"),
|
|
83
|
+
cancelConnectionAttempt: bindPublicMethod("cancelConnectionAttempt"),
|
|
84
|
+
disconnect: bindPublicMethod("disconnect"),
|
|
85
|
+
forget: bindPublicMethod("forget"),
|
|
86
|
+
displayText: bindPublicMethod("displayText"),
|
|
87
|
+
clearDisplay: bindPublicMethod("clearDisplay"),
|
|
88
|
+
showDashboard: bindPublicMethod("showDashboard"),
|
|
89
|
+
setDashboardPosition: bindPublicMethod("setDashboardPosition"),
|
|
90
|
+
setHeadUpAngle: bindPublicMethod("setHeadUpAngle"),
|
|
91
|
+
setImuEnabled: bindPublicMethod("setImuEnabled"),
|
|
92
|
+
setScreenDisabled: bindPublicMethod("setScreenDisabled"),
|
|
93
|
+
requestWifiScan: bindPublicMethod("requestWifiScan"),
|
|
94
|
+
sendWifiCredentials: bindPublicMethod("sendWifiCredentials"),
|
|
95
|
+
forgetWifiNetwork: bindPublicMethod("forgetWifiNetwork"),
|
|
96
|
+
setHotspotState: bindPublicMethod("setHotspotState"),
|
|
97
|
+
setGalleryModeEnabled: bindPublicMethod("setGalleryModeEnabled"),
|
|
98
|
+
setVoiceActivityDetectionEnabled: bindPublicMethod("setVoiceActivityDetectionEnabled"),
|
|
99
|
+
setPhotoCaptureDefaults: bindPublicMethod("setPhotoCaptureDefaults"),
|
|
100
|
+
setVideoRecordingDefaults: ({width, height, fps}: VideoRecordingDefaults) => {
|
|
101
|
+
const method = (PrivateBluetoothSdkModule as unknown as Record<string, unknown>).setVideoRecordingDefaults
|
|
102
|
+
if (typeof method !== "function") {
|
|
103
|
+
return Promise.reject(
|
|
104
|
+
new Error("BluetoothSdk.setVideoRecordingDefaults is not available in this native build. Rebuild the app."),
|
|
105
|
+
)
|
|
93
106
|
}
|
|
94
|
-
|
|
95
|
-
return PrivateBluetoothSdkModule.setButtonPhotoSettings({size: settings.size ?? "max"} as any)
|
|
107
|
+
return PrivateBluetoothSdkModule.setVideoRecordingDefaults(width, height, fps)
|
|
96
108
|
},
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
checkForOtaUpdate: PrivateBluetoothSdkModule.checkForOtaUpdate.bind(PrivateBluetoothSdkModule),
|
|
109
|
+
setMaxVideoRecordingDuration: bindPublicMethod("setMaxVideoRecordingDuration"),
|
|
110
|
+
setCameraFov: bindPublicMethod("setCameraFov"),
|
|
111
|
+
setCameraTuningConfig: bindPublicMethod("setCameraTuningConfig"),
|
|
112
|
+
queryGalleryStatus: bindPublicMethod("queryGalleryStatus"),
|
|
113
|
+
requestPhoto: bindPublicMethod("requestPhoto"),
|
|
114
|
+
warmUpCamera: bindPublicMethod("warmUpCamera"),
|
|
115
|
+
startVideoRecording: bindPublicMethod("startVideoRecording"),
|
|
116
|
+
stopVideoRecording: bindPublicMethod("stopVideoRecording"),
|
|
117
|
+
startStream: bindPublicMethod("startStream"),
|
|
118
|
+
stopStream: bindPublicMethod("stopStream"),
|
|
119
|
+
setMicState: bindPublicMethod("setMicState"),
|
|
120
|
+
setPreferredMic: bindPublicMethod("setPreferredMic"),
|
|
121
|
+
setOwnAppAudioPlaying: bindPublicMethod("setOwnAppAudioPlaying"),
|
|
122
|
+
getGlassesMediaVolume: bindPublicMethod("getGlassesMediaVolume"),
|
|
123
|
+
setGlassesMediaVolume: bindPublicMethod("setGlassesMediaVolume"),
|
|
124
|
+
rgbLedControl: bindPublicMethod("rgbLedControl"),
|
|
125
|
+
requestVersionInfo: bindPublicMethod("requestVersionInfo"),
|
|
126
|
+
checkForOtaUpdate: bindPublicMethod("checkForOtaUpdate"),
|
|
116
127
|
startOtaUpdate,
|
|
117
|
-
setSttModelDetails:
|
|
118
|
-
getSttModelPath:
|
|
119
|
-
checkSttModelAvailable:
|
|
120
|
-
validateSttModel:
|
|
121
|
-
extractTarBz2:
|
|
122
|
-
restartTranscriber:
|
|
123
|
-
setTtsModelDetails:
|
|
124
|
-
getTtsModelPath:
|
|
125
|
-
getTtsModelLanguage:
|
|
126
|
-
checkTtsModelAvailable:
|
|
127
|
-
validateTtsModel:
|
|
128
|
-
generateTtsAudio:
|
|
128
|
+
setSttModelDetails: bindPublicMethod("setSttModelDetails"),
|
|
129
|
+
getSttModelPath: bindPublicMethod("getSttModelPath"),
|
|
130
|
+
checkSttModelAvailable: bindPublicMethod("checkSttModelAvailable"),
|
|
131
|
+
validateSttModel: bindPublicMethod("validateSttModel"),
|
|
132
|
+
extractTarBz2: bindPublicMethod("extractTarBz2"),
|
|
133
|
+
restartTranscriber: bindPublicMethod("restartTranscriber"),
|
|
134
|
+
setTtsModelDetails: bindPublicMethod("setTtsModelDetails"),
|
|
135
|
+
getTtsModelPath: bindPublicMethod("getTtsModelPath"),
|
|
136
|
+
getTtsModelLanguage: bindPublicMethod("getTtsModelLanguage"),
|
|
137
|
+
checkTtsModelAvailable: bindPublicMethod("checkTtsModelAvailable"),
|
|
138
|
+
validateTtsModel: bindPublicMethod("validateTtsModel"),
|
|
139
|
+
generateTtsAudio: bindPublicMethod("generateTtsAudio"),
|
|
129
140
|
})
|
|
130
141
|
|
|
131
142
|
export default BluetoothSdk
|
|
@@ -155,7 +166,7 @@ export type {
|
|
|
155
166
|
BluetoothSdkPublicModule as BluetoothSdkModule,
|
|
156
167
|
BluetoothSdkSubscription,
|
|
157
168
|
ButtonPhotoSize,
|
|
158
|
-
|
|
169
|
+
PhotoCaptureDefaults,
|
|
159
170
|
ButtonPressEvent,
|
|
160
171
|
CameraFovPreset,
|
|
161
172
|
CameraFovRequest,
|
|
@@ -187,8 +198,6 @@ export type {
|
|
|
187
198
|
OtaStatus,
|
|
188
199
|
OtaStatusEvent,
|
|
189
200
|
OtaQueryResult,
|
|
190
|
-
OtaUpdateAvailableEvent,
|
|
191
|
-
OtaUpdateInfo,
|
|
192
201
|
PairFailureEvent,
|
|
193
202
|
PhotoCaptureMetadata,
|
|
194
203
|
PhotoResolvedConfig,
|
|
@@ -226,6 +235,7 @@ export type {
|
|
|
226
235
|
SwipeVolumeStatusEvent,
|
|
227
236
|
SwitchStatusEvent,
|
|
228
237
|
TouchEvent,
|
|
238
|
+
VideoRecordingDefaults,
|
|
229
239
|
VideoRecordingStartedStatusEvent,
|
|
230
240
|
VideoRecordingStatusEvent,
|
|
231
241
|
VideoRecordingStatusState,
|