@mentra/bluetooth-sdk 0.1.5 → 0.1.6
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 +29 -13
- package/android/src/main/java/com/mentra/bluetoothsdk/BluetoothSdkModule.kt +15 -7
- package/android/src/main/java/com/mentra/bluetoothsdk/DeviceStore.kt +1 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/MentraBluetoothSdk.kt +34 -46
- package/android/src/main/java/com/mentra/bluetoothsdk/audio/AudioModels.kt +125 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/camera/CameraModels.kt +187 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/connection/ConnectionModels.kt +78 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/events/BluetoothEvents.kt +60 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/internal/MapParsing.kt +132 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/requests/DisplayRequests.kt +39 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/status/DeviceStatus.kt +605 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/status/RuntimeState.kt +199 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/status/WifiHotspotStatus.kt +173 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/streaming/StreamModels.kt +348 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/types/DeviceModels.kt +75 -0
- package/build/BluetoothSdk.types.d.ts +4 -0
- package/build/BluetoothSdk.types.d.ts.map +1 -1
- package/build/BluetoothSdk.types.js.map +1 -1
- package/build/_private/BluetoothSdkModule.d.ts.map +1 -1
- package/build/_private/BluetoothSdkModule.js +3 -0
- package/build/_private/BluetoothSdkModule.js.map +1 -1
- package/ios/BluetoothSdkModule.swift +4 -4
- package/ios/Source/Audio/AudioModels.swift +159 -0
- package/ios/Source/Camera/CameraModels.swift +246 -0
- package/ios/Source/Connection/ScanSession.swift +27 -0
- package/ios/Source/DeviceStore.swift +1 -0
- package/ios/Source/Errors/BluetoothError.swift +19 -0
- package/ios/Source/Events/BluetoothEvents.swift +115 -0
- package/ios/Source/Internal/BluetoothAvailability.swift +58 -0
- package/ios/Source/Internal/ValueParsing.swift +90 -0
- package/ios/Source/MentraBluetoothSDK.swift +25 -2140
- package/ios/Source/Requests/DisplayRequests.swift +58 -0
- package/ios/Source/Status/DeviceStatus.swift +463 -0
- package/ios/Source/Status/RuntimeState.swift +350 -0
- package/ios/Source/Status/WifiHotspotStatus.swift +326 -0
- package/ios/Source/Streaming/StreamModels.swift +436 -0
- package/ios/Source/Types/DeviceModels.swift +134 -0
- package/ios/Source/sgcs/G2.swift +97 -36
- package/package.json +1 -1
- package/src/BluetoothSdk.types.ts +4 -0
- package/src/_private/BluetoothSdkModule.ts +3 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/MentraBluetoothModels.kt +0 -1810
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BluetoothSdk.types.js","sourceRoot":"","sources":["../src/BluetoothSdk.types.ts"],"names":[],"mappings":"AA6CA,MAAM,UAAU,kCAAkC,CAChD,MAA+B;IAE/B,OAAO,MAAM,CAAC,KAAK,KAAK,WAAW,CAAA;AACrC,CAAC;AAED,MAAM,UAAU,8BAA8B,CAAC,MAA+B;IAC5E,OAAO,MAAM,CAAC,KAAK,KAAK,WAAW,IAAI,MAAM,CAAC,WAAW,CAAA;AAC3D,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,MAA+B;IAC3E,OAAO,MAAM,CAAC,KAAK,KAAK,UAAU,IAAI,MAAM,CAAC,KAAK,KAAK,YAAY,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,CAAA;AACnG,CAAC;AAED,MAAM,UAAU,+BAA+B;IAC7C,OAAO;QACL,UAAU,EAAE,EAAC,KAAK,EAAE,cAAc,EAAC;QACnC,OAAO,EAAE,EAAC,KAAK,EAAE,UAAU,EAAC;QAC5B,IAAI,EAAE,EAAC,KAAK,EAAE,cAAc,EAAC;KAC9B,CAAA;AACH,CAAC;AA2BD,MAAM,UAAU,qBAAqB,CAAC,MAAkB;IACtD,OAAO,MAAM,CAAC,KAAK,KAAK,WAAW,CAAA;AACrC,CAAC;AAUD,MAAM,UAAU,sBAAsB,CAAC,MAAqB;IAC1D,OAAO,MAAM,CAAC,KAAK,KAAK,SAAS,CAAA;AACnC,CAAC;AA2FD,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,SAAS,EAAE,mBAAmB;IAC9B,EAAE,EAAE,mBAAmB;IACvB,EAAE,EAAE,mBAAmB;IACvB,UAAU,EAAE,aAAa;IACzB,SAAS,EAAE,gBAAgB;IAC3B,KAAK,EAAE,cAAc;IACrB,IAAI,EAAE,YAAY;IAClB,KAAK,EAAE,iBAAiB;IACxB,EAAE,EAAE,mBAAmB;CACf,CAAA","sourcesContent":["// Bluetooth SDK Event Types\nexport type GlassesNotReadyEvent = {\n type: \"glasses_not_ready\"\n message: string\n}\n\nexport type ButtonPressEvent = {\n type: \"button_press\"\n buttonId: string\n pressType: \"long\" | \"short\"\n timestamp: number\n}\n\nexport type TouchEvent = {\n type: \"touch_event\"\n deviceModel: DeviceModel\n gestureName: string\n timestamp: number\n}\n\nexport type HeadUpEvent = {\n up: boolean\n}\n\nexport type VadStatusEvent = {\n type: \"vad_status\"\n status: boolean\n}\n\nexport type BatteryStatusEvent = {\n type: \"battery_status\"\n level: number\n charging: boolean\n timestamp: number\n}\n\nexport type GlassesConnectionStatus =\n | {state: 'disconnected'}\n | {state: 'scanning'}\n | {state: 'connecting'}\n | {state: 'bonding'}\n | {state: 'connected'; fullyBooted: boolean}\n\nexport type ConnectedGlassesConnectionStatus = Extract<GlassesConnectionStatus, {state: 'connected'}>\n\nexport function isConnectedGlassesConnectionStatus(\n status: GlassesConnectionStatus,\n): status is ConnectedGlassesConnectionStatus {\n return status.state === 'connected'\n}\n\nexport function isReadyGlassesConnectionStatus(status: GlassesConnectionStatus): boolean {\n return status.state === 'connected' && status.fullyBooted\n}\n\nexport function isBusyGlassesConnectionStatus(status: GlassesConnectionStatus): boolean {\n return status.state === 'scanning' || status.state === 'connecting' || status.state === 'bonding'\n}\n\nexport function createDisconnectedGlassesStatus(): Partial<GlassesStatus> {\n return {\n connection: {state: 'disconnected'},\n hotspot: {state: 'disabled'},\n wifi: {state: 'disconnected'},\n }\n}\n\n/** K900 `sr_getvol` response (Mentra Live glasses media step volume 0–15). */\nexport type GlassesMediaVolumeGetResult = {\n level: number\n statusCode: number\n}\n\n/** K900 `sr_vol` acknowledgment. */\nexport type GlassesMediaVolumeSetResult = {\n statusCode: number\n}\n\nexport type LocalTranscriptionEvent = {\n text: string\n isFinal?: boolean\n transcribeLanguage?: string\n}\n\nexport type LogEvent = {\n message: string\n}\n\nexport type WifiStatus = {state: 'disconnected'} | {state: 'connected'; ssid: string; localIp?: string}\n\nexport type ConnectedWifiStatus = Extract<WifiStatus, {state: 'connected'}>\n\nexport function isConnectedWifiStatus(status: WifiStatus): status is ConnectedWifiStatus {\n return status.state === 'connected'\n}\n\nexport type WifiStatusChangeEvent = WifiStatus & {\n type: \"wifi_status_change\"\n}\n\nexport type HotspotStatus = {state: 'disabled'} | {state: 'enabled'; ssid: string; password: string; localIp: string}\n\nexport type EnabledHotspotStatus = Extract<HotspotStatus, {state: 'enabled'}>\n\nexport function isEnabledHotspotStatus(status: HotspotStatus): status is EnabledHotspotStatus {\n return status.state === 'enabled'\n}\n\nexport type HotspotStatusChangeEvent = HotspotStatus & {\n type: \"hotspot_status_change\"\n}\n\nexport type HotspotErrorEvent = {\n type: \"hotspot_error\"\n errorMessage: string\n timestamp: number\n}\n\nexport type PhotoResponseEvent =\n | {\n type: \"photo_response\"\n state: \"success\"\n requestId: string\n uploadUrl: string\n timestamp: number\n }\n | {\n type: \"photo_response\"\n state: \"error\"\n requestId: string\n timestamp: number\n errorCode?: string\n errorMessage: string\n }\n\nexport type GalleryStatusEvent = {\n type: \"gallery_status\"\n photos: number\n videos: number\n total: number\n totalSize?: number\n hasContent: boolean\n cameraBusy: boolean\n}\n\nexport type CompatibleGlassesSearchStopEvent = {\n type: \"compatible_glasses_search_stop\"\n deviceModel: DeviceModel\n}\n\nexport type HeartbeatSentEvent = {\n type: \"heartbeat_sent\"\n heartbeat_sent: {\n timestamp: number\n }\n}\n\nexport type HeartbeatReceivedEvent = {\n type: \"heartbeat_received\"\n heartbeat_received: {\n timestamp: number\n }\n}\n\nexport type SwipeVolumeStatusEvent = {\n type: \"swipe_volume_status\"\n enabled: boolean\n timestamp: number\n}\n\nexport type SwitchStatusEvent = {\n type: \"switch_status\"\n switchType?: number\n switchValue?: number\n timestamp: number\n}\n\nexport type RgbLedControlResponseEvent =\n | {\n type: \"rgb_led_control_response\"\n state: \"success\"\n requestId: string\n }\n | {\n type: \"rgb_led_control_response\"\n state: \"error\"\n requestId: string\n errorCode: string\n }\n\nexport type RgbLedAction = \"on\" | \"off\"\nexport type RgbLedColor = \"red\" | \"green\" | \"blue\" | \"orange\" | \"white\"\n/** `\"auto\"` enables local button photo/video capture; `\"manual\"` reports button events without local gallery capture. */\nexport type GalleryMode = \"auto\" | \"manual\"\nexport type PhotoSize = \"small\" | \"medium\" | \"large\" | \"full\"\nexport type ButtonPhotoSize = \"small\" | \"medium\" | \"large\"\nexport type PhotoCompression = \"none\" | \"medium\" | \"heavy\"\nexport const DeviceModels = {\n Simulated: \"Simulated Glasses\",\n G1: \"Even Realities G1\",\n G2: \"Even Realities G2\",\n MentraLive: \"Mentra Live\",\n MentraNex: \"Mentra Display\",\n Mach1: \"Mentra Mach1\",\n Z100: \"Vuzix Z100\",\n Frame: \"Brilliant Frame\",\n R1: \"Even Realities R1\",\n} as const\n\nexport type DeviceModel = (typeof DeviceModels)[keyof typeof DeviceModels]\nexport type ObservableStoreCategory = \"glasses\" | \"bluetooth\" | \"core\"\n\nexport type DashboardMenuItem = {\n title: string\n packageName: string\n values?: Record<string, unknown>\n}\n\nexport type CameraFov = \"standard\" | \"wide\"\n\nexport type CameraFovSetting = {\n fov: number\n roiPosition: number\n}\n\nexport type MicPreference = \"auto\" | \"phone\" | \"glasses\" | \"bluetooth\"\nexport type MicMode = \"phone\" | \"glasses\" | \"bluetoothClassic\" | \"bluetooth\"\n\nexport type StreamVideoConfig = {\n width?: number\n height?: number\n bitrate?: number\n frameRate?: number\n}\n\nexport type StreamAudioConfig = {\n bitrate?: number\n sampleRate?: number\n echoCancellation?: boolean\n noiseSuppression?: boolean\n}\n\nexport type StreamStartRequest = {\n type?: \"start_stream\"\n streamUrl: string\n streamId?: string\n keepAlive?: boolean\n keepAliveIntervalSeconds?: number\n sound?: boolean\n video?: StreamVideoConfig\n audio?: StreamAudioConfig\n}\n\nexport type StreamKeepAliveRequest = {\n type?: \"keep_stream_alive\"\n streamId: string\n ackId: string\n}\n\nexport type PairFailureEvent = {\n type: \"pair_failure\"\n error: string\n}\n\nexport type AudioPairingNeededEvent = {\n type: \"audio_pairing_needed\"\n deviceName: string\n}\n\nexport type AudioConnectedEvent = {\n type: \"audio_connected\"\n deviceName: string\n}\n\nexport type AudioDisconnectedEvent = {\n type: \"audio_disconnected\"\n}\n\nexport type SaveSettingEvent = {\n type: \"save_setting\"\n key: string\n value: any\n}\n\nexport type WsTextEvent = {\n type: \"ws_text\"\n text: string\n}\n\nexport type WsBinEvent = {\n type: \"ws_bin\"\n base64: string\n}\n\nexport type MicPcmEvent = {\n type: \"mic_pcm\"\n pcm: ArrayBuffer\n sampleRate: 16000\n bitsPerSample: 16\n channels: 1\n encoding: \"pcm_s16le\"\n vadGated: boolean\n}\n\nexport type MicLc3Event = {\n type: \"mic_lc3\"\n lc3: ArrayBuffer\n sampleRate: 16000\n channels: 1\n encoding: \"lc3\"\n frameDurationMs: 10\n frameSizeBytes: number\n bitrate: number\n packetizedFromGlasses: boolean\n vadGated: boolean\n}\n\nexport type StreamStatusLifecycleState = \"initializing\" | \"streaming\" | \"stopping\" | \"stopped\"\nexport type StreamStatusReconnectState = \"reconnecting\" | \"reconnected\" | \"reconnect_failed\"\nexport type StreamStatusState = StreamStatusLifecycleState | StreamStatusReconnectState | \"error\"\n\nexport type StreamStatusEvent =\n | {\n type: \"stream_status\"\n kind: \"lifecycle\"\n status: StreamStatusLifecycleState\n streamId?: string\n timestamp?: number\n }\n | {\n type: \"stream_status\"\n kind: \"reconnect\"\n status: \"reconnecting\"\n streamId?: string\n attempt: number\n maxAttempts: number\n reason: string\n timestamp?: number\n }\n | {\n type: \"stream_status\"\n kind: \"reconnect\"\n status: \"reconnected\"\n streamId?: string\n attempt: number\n timestamp?: number\n }\n | {\n type: \"stream_status\"\n kind: \"reconnect\"\n status: \"reconnect_failed\"\n streamId?: string\n maxAttempts: number\n timestamp?: number\n }\n | {\n type: \"stream_status\"\n kind: \"error\"\n status: \"error\"\n streamId?: string\n errorDetails: string\n timestamp?: number\n }\n | {\n type: \"stream_status\"\n kind: \"snapshot\"\n status: \"streaming\" | \"reconnecting\" | \"stopped\"\n streaming: boolean\n reconnecting: boolean\n streamId?: string\n attempt?: number\n timestamp?: number\n }\n\nexport type KeepAliveAckEvent = {\n type: \"keep_alive_ack\"\n streamId: string\n ackId: string\n timestamp?: number\n}\n\nexport type MtkUpdateCompleteEvent = {\n type: \"mtk_update_complete\"\n message: string\n timestamp: number\n}\n\nexport type OtaUpdateAvailableEvent = {\n type: \"ota_update_available\"\n version_code?: number\n version_name?: string\n updates?: string[]\n total_size?: number\n cache_ready?: boolean\n}\n\n/** @deprecated Glasses no longer emit ota_progress; use {@link OtaStatusEvent} and status-store mapping. */\nexport type OtaProgressEvent = {\n type: \"ota_progress\"\n stage?: OtaStage\n status?: OtaProgressStatus\n progress?: number\n bytes_downloaded?: number\n total_bytes?: number\n current_update?: string\n error_message?: string\n}\n\nexport type OtaStartAckEvent = {\n type: \"ota_start_ack\"\n timestamp: number\n}\n\nexport type OtaStatusEvent = {\n type: \"ota_status\"\n session_id: string\n total_steps: number\n current_step: number\n step_type: 'apk' | 'mtk' | 'bes'\n phase: 'download' | 'install'\n step_percent: number\n overall_percent: number\n status: 'in_progress' | 'step_complete' | 'complete' | 'failed' | 'idle'\n error_message?: string\n}\n\n/** Nex BLE protobuf trace (NexEventUtils); payload matches native Map keys. */\nexport type BleCommandTraceEvent = {\n command: string\n commandText: string\n timestamp: number\n}\n\nexport type MiniappSelectedEvent = {\n type: \"miniapp_selected\"\n packageName: string\n}\n\n// Union type of all native/internal Bluetooth SDK events.\nexport type BluetoothSdkInternalEvent = Parameters<BluetoothSdkModuleEvents[keyof BluetoothSdkModuleEvents]>[0]\n\nexport type BluetoothSdkModuleEvents = {\n glasses_status: (changed: Partial<GlassesStatus>) => void\n bluetooth_status: (changed: Partial<BluetoothStatus>) => void\n log: (event: LogEvent) => void\n device_discovered: (device: Device) => void\n default_device_changed: (event: {device?: Device}) => void\n // Individual event handlers\n glasses_not_ready: (event: GlassesNotReadyEvent) => void\n button_press: (event: ButtonPressEvent) => void\n touch_event: (event: TouchEvent) => void\n head_up: (event: HeadUpEvent) => void\n vad_status: (event: VadStatusEvent) => void\n battery_status: (event: BatteryStatusEvent) => void\n local_transcription: (event: LocalTranscriptionEvent) => void\n wifi_status_change: (event: WifiStatusChangeEvent) => void\n hotspot_status_change: (event: HotspotStatusChangeEvent) => void\n hotspot_error: (event: HotspotErrorEvent) => void\n photo_response: (event: PhotoResponseEvent) => void\n gallery_status: (event: GalleryStatusEvent) => void\n compatible_glasses_search_stop: (event: CompatibleGlassesSearchStopEvent) => void\n heartbeat_sent: (event: HeartbeatSentEvent) => void\n heartbeat_received: (event: HeartbeatReceivedEvent) => void\n swipe_volume_status: (event: SwipeVolumeStatusEvent) => void\n switch_status: (event: SwitchStatusEvent) => void\n rgb_led_control_response: (event: RgbLedControlResponseEvent) => void\n pair_failure: (event: PairFailureEvent) => void\n audio_pairing_needed: (event: AudioPairingNeededEvent) => void\n audio_connected: (event: AudioConnectedEvent) => void\n audio_disconnected: (event: AudioDisconnectedEvent) => void\n save_setting: (event: SaveSettingEvent) => void\n ws_text: (event: WsTextEvent) => void\n ws_bin: (event: WsBinEvent) => void\n mic_pcm: (event: MicPcmEvent) => void\n mic_lc3: (event: MicLc3Event) => void\n stream_status: (event: StreamStatusEvent) => void\n keep_alive_ack: (event: KeepAliveAckEvent) => void\n mtk_update_complete: (event: MtkUpdateCompleteEvent) => void\n ota_update_available: (event: OtaUpdateAvailableEvent) => void\n ota_start_ack: (event: OtaStartAckEvent) => void\n ota_status: (event: OtaStatusEvent) => void\n send_command_to_ble: (event: BleCommandTraceEvent) => void\n receive_command_from_ble: (event: BleCommandTraceEvent) => void\n miniapp_selected: (event: MiniappSelectedEvent) => void\n}\n\nexport type PublicGlassesStatus = Omit<\n GlassesStatus,\n \"otaUpdateAvailable\" | \"otaProgress\" | \"otaInProgress\" | \"otaVersionUrl\"\n>\n\nexport type PublicBluetoothStatus = Pick<\n BluetoothStatus,\n | \"searching\"\n | \"searchingController\"\n | \"systemMicUnavailable\"\n | \"micRanking\"\n | \"currentMic\"\n | \"searchResults\"\n | \"wifiScanResults\"\n | \"lastLog\"\n | \"otherBtConnected\"\n | \"galleryModeAuto\"\n>\n\nexport type BluetoothSdkEventMap = {\n log: LogEvent\n device_discovered: Device\n default_device_changed: {device?: Device}\n glasses_not_ready: GlassesNotReadyEvent\n button_press: ButtonPressEvent\n touch_event: TouchEvent\n head_up: HeadUpEvent\n vad_status: VadStatusEvent\n battery_status: BatteryStatusEvent\n local_transcription: LocalTranscriptionEvent\n wifi_status_change: WifiStatusChangeEvent\n hotspot_status_change: HotspotStatusChangeEvent\n hotspot_error: HotspotErrorEvent\n photo_response: PhotoResponseEvent\n gallery_status: GalleryStatusEvent\n compatible_glasses_search_stop: CompatibleGlassesSearchStopEvent\n swipe_volume_status: SwipeVolumeStatusEvent\n switch_status: SwitchStatusEvent\n rgb_led_control_response: RgbLedControlResponseEvent\n pair_failure: PairFailureEvent\n audio_pairing_needed: AudioPairingNeededEvent\n audio_connected: AudioConnectedEvent\n audio_disconnected: AudioDisconnectedEvent\n mic_pcm: MicPcmEvent\n mic_lc3: MicLc3Event\n stream_status: StreamStatusEvent\n keep_alive_ack: KeepAliveAckEvent\n}\n\nexport type BluetoothSdkEventName = keyof BluetoothSdkEventMap\n\nexport type BluetoothSdkEventListener<EventName extends BluetoothSdkEventName> = (\n event: BluetoothSdkEventMap[EventName],\n) => void\n\nexport type BluetoothSdkSubscription = {\n remove(): void\n}\n\nexport type BluetoothSdkEvent = BluetoothSdkEventMap[BluetoothSdkEventName]\n\nexport interface BluetoothSdkPublicModule {\n addListener<EventName extends BluetoothSdkEventName>(\n eventName: EventName,\n listener: BluetoothSdkEventListener<EventName>,\n ): BluetoothSdkSubscription\n\n getDefaultDevice(): Promise<Device | null>\n setDefaultDevice(device: Device | null): Promise<void>\n clearDefaultDevice(): Promise<void>\n\n startScan(model: DeviceModel): Promise<void>\n stopScan(): Promise<void>\n scan(options: ScanOptions): Promise<Device[]>\n scan(model: DeviceModel, options?: ScanModelOptions): Promise<Device[]>\n connect(device: Device, options?: ConnectOptions): Promise<void>\n connectDefault(options?: ConnectOptions): Promise<void>\n cancelConnectionAttempt(): Promise<void>\n disconnect(): Promise<void>\n forget(): Promise<void>\n\n displayText(text: string, x?: number, y?: number, size?: number): Promise<void>\n clearDisplay(): Promise<void>\n showDashboard(): Promise<void>\n setDashboardPosition(height: number, depth: number): Promise<void>\n setHeadUpAngle(angleDegrees: number): Promise<void>\n setScreenDisabled(disabled: boolean): Promise<void>\n\n requestWifiScan(): Promise<void>\n sendWifiCredentials(ssid: string, password: string): Promise<void>\n forgetWifiNetwork(ssid: string): Promise<void>\n setHotspotState(enabled: boolean): Promise<void>\n\n setGalleryMode(mode: GalleryMode): Promise<void>\n setButtonPhotoSettings(size: ButtonPhotoSize): Promise<void>\n setButtonVideoRecordingSettings(width: number, height: number, frameRate: number): Promise<void>\n setButtonCameraLed(enabled: boolean): Promise<void>\n setButtonMaxRecordingTime(minutes: number): Promise<void>\n setCameraFov(fov: CameraFov): Promise<void>\n queryGalleryStatus(): Promise<void>\n requestPhoto(\n requestId: string,\n appId: string,\n size: PhotoSize,\n webhookUrl: string | null,\n authToken: string | null,\n compress: PhotoCompression,\n sound: boolean,\n ): Promise<void>\n startVideoRecording(requestId: string, save: boolean, sound: boolean): Promise<void>\n stopVideoRecording(requestId: string): Promise<void>\n\n startStream(params: StreamStartRequest): Promise<void>\n stopStream(): Promise<void>\n keepStreamAlive(params: StreamKeepAliveRequest): Promise<void>\n\n setMicState(\n enabled: boolean,\n useGlassesMic?: boolean,\n bypassVad?: boolean,\n sendTranscript?: boolean,\n sendLc3Data?: boolean,\n ): Promise<void>\n setPreferredMic(preferredMic: MicPreference): Promise<void>\n setOwnAppAudioPlaying(playing: boolean): Promise<void>\n getGlassesMediaVolume(): Promise<GlassesMediaVolumeGetResult>\n setGlassesMediaVolume(level: number): Promise<GlassesMediaVolumeSetResult>\n\n rgbLedControl(\n requestId: string,\n packageName: string | null,\n action: RgbLedAction,\n color: RgbLedColor | null,\n onDurationMs: number,\n offDurationMs: number,\n count: number,\n ): Promise<void>\n\n requestVersionInfo(): Promise<void>\n}\n\n// OTA update status types\nexport type OtaStage = \"download\" | \"install\"\nexport type OtaProgressStatus = \"STARTED\" | \"PROGRESS\" | \"FINISHED\" | \"FAILED\"\n\nexport interface OtaStatus {\n sessionId: string\n totalSteps: number\n currentStep: number\n stepType: 'apk' | 'mtk' | 'bes'\n phase: 'download' | 'install'\n stepPercent: number\n overallPercent: number\n status: 'in_progress' | 'step_complete' | 'complete' | 'failed' | 'idle'\n error?: string\n}\n\nexport interface OtaUpdateInfo {\n available: boolean\n versionCode: number\n versionName: string\n updates: string[] // [\"apk\", \"mtk\", \"bes\"]\n totalSize: number\n cacheReady?: boolean\n}\n\nexport interface OtaProgress {\n stage: OtaStage\n status: OtaProgressStatus\n progress: number\n bytesDownloaded: number\n totalBytes: number\n currentUpdate: string\n errorMessage?: string\n}\n\nexport interface GlassesStatus {\n // state:\n connection: GlassesConnectionStatus\n micEnabled: boolean\n bluetoothClassicConnected: boolean\n signalStrength: number\n /** Milliseconds since epoch when signalStrength was last refreshed by the phone BLE stack. */\n signalStrengthUpdatedAt: number\n // device info\n deviceModel: string\n androidVersion: string\n firmwareVersion: string\n besFirmwareVersion: string\n mtkFirmwareVersion: string\n bluetoothMacAddress: string\n leftMacAddress: string\n rightMacAddress: string\n buildNumber: string\n otaVersionUrl: string\n appVersion: string\n bluetoothName: string\n serialNumber: string\n style: string\n color: string\n // wifi info\n wifi: WifiStatus\n // battery info\n batteryLevel: number\n charging: boolean\n caseBatteryLevel: number\n caseCharging: boolean\n caseOpen: boolean\n caseRemoved: boolean\n // hotspot info\n hotspot: HotspotStatus\n // OTA update info\n otaUpdateAvailable: OtaUpdateInfo | null\n otaProgress: OtaProgress | null\n otaInProgress: boolean\n // ring info\n controllerConnected: boolean\n controllerFullyBooted: boolean\n controllerMacAddress: string\n controllerBatteryLevel: number\n controllerSignalStrength: number\n}\n\nexport interface CoreDashboardMenuItem {\n name: string\n packageName: string\n running: boolean\n}\n\nexport interface CoreSettings {\n menu_apps: CoreDashboardMenuItem[]\n}\n\nexport interface Device {\n /**\n * Stable app-facing key for this scan result, within the limits of the\n * platform identifier available to the SDK. Do not parse this value; use the\n * typed model, name, address, and rssi fields instead.\n */\n id: string\n model: DeviceModel\n name: string\n /** Platform address/identifier when available: Android Bluetooth address, iOS CoreBluetooth identifier. */\n address?: string\n rssi?: number\n}\n\nexport interface ConnectOptions {\n saveAsDefault?: boolean\n cancelExistingConnectionAttempt?: boolean\n}\n\nexport type ScanResultsCallback = (devices: Device[]) => void\n\nexport interface ScanOptions {\n model: DeviceModel\n /** Defaults to 15000. */\n timeoutMs?: number\n /** Alias for `timeoutMs`, useful when mirroring native examples. */\n timeout?: number\n /** Called every time the discovered device list changes during the scan. */\n onResults?: ScanResultsCallback\n}\n\nexport type ScanModelOptions = Omit<ScanOptions, \"model\">\n\nexport interface WifiSearchResult {\n ssid: string\n requiresPassword: boolean\n signalStrength: number\n /** Frequency in MHz (from glasses scan). 5 GHz band is typically 5170–5825. Omitted if unknown. */\n frequency?: number\n}\n\nexport interface BluetoothStatus {\n // state:\n searching: boolean\n searchingController: boolean\n default_wearable?: DeviceModel | \"\"\n pending_wearable?: DeviceModel | \"\"\n device_name?: string\n device_address?: string\n default_controller?: DeviceModel | \"\"\n pending_controller?: DeviceModel | \"\"\n controller_device_name?: string\n controller_address?: string\n systemMicUnavailable: boolean\n micRanking: MicMode[]\n currentMic: MicMode | \"\" | null\n /**\n * Nearby glasses in stable discovery order.\n * Existing entries keep their array position as details refresh; new glasses append at the end,\n * and removals should not reorder remaining entries.\n */\n searchResults: Device[]\n wifiScanResults: WifiSearchResult[]\n lastLog: string[]\n otherBtConnected: boolean\n // desired settings the SDK sends to compatible connected glasses:\n galleryModeAuto: boolean\n}\n\nexport type BluetoothSettingsUpdate = Partial<{\n auth_email: string\n core_token: string\n sensing_enabled: boolean\n power_saving_mode: boolean\n lc3_frame_size: number\n preferred_mic: MicPreference\n screen_disabled: boolean\n contextual_dashboard: boolean\n head_up_angle: number\n brightness: number\n auto_brightness: boolean\n dashboard_height: number\n dashboard_depth: number\n menu_apps: DashboardMenuItem[] | CoreDashboardMenuItem[] | Array<Record<string, unknown>> | null\n galleryModeAuto: boolean\n button_photo_size: ButtonPhotoSize\n button_video_settings: {width: number; height: number; frameRate: number}\n button_video_width: number\n button_video_height: number\n button_video_fps: number\n button_camera_led: boolean\n button_max_recording_time: number\n camera_fov: CameraFovSetting\n should_send_pcm: boolean\n should_send_lc3: boolean\n should_send_transcript: boolean\n bypass_vad: boolean\n offline_mode: boolean\n offline_captions_running: boolean\n local_stt_fallback_active: boolean\n pending_wearable: DeviceModel | \"\"\n default_wearable: DeviceModel | \"\"\n device_name: string\n device_address: string\n default_controller: DeviceModel | \"\"\n pending_controller: DeviceModel | \"\"\n controller_device_name: string\n controller_address: string\n}>\n"]}
|
|
1
|
+
{"version":3,"file":"BluetoothSdk.types.js","sourceRoot":"","sources":["../src/BluetoothSdk.types.ts"],"names":[],"mappings":"AA6CA,MAAM,UAAU,kCAAkC,CAChD,MAA+B;IAE/B,OAAO,MAAM,CAAC,KAAK,KAAK,WAAW,CAAA;AACrC,CAAC;AAED,MAAM,UAAU,8BAA8B,CAAC,MAA+B;IAC5E,OAAO,MAAM,CAAC,KAAK,KAAK,WAAW,IAAI,MAAM,CAAC,WAAW,CAAA;AAC3D,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,MAA+B;IAC3E,OAAO,MAAM,CAAC,KAAK,KAAK,UAAU,IAAI,MAAM,CAAC,KAAK,KAAK,YAAY,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,CAAA;AACnG,CAAC;AAED,MAAM,UAAU,+BAA+B;IAC7C,OAAO;QACL,UAAU,EAAE,EAAC,KAAK,EAAE,cAAc,EAAC;QACnC,OAAO,EAAE,EAAC,KAAK,EAAE,UAAU,EAAC;QAC5B,IAAI,EAAE,EAAC,KAAK,EAAE,cAAc,EAAC;KAC9B,CAAA;AACH,CAAC;AA2BD,MAAM,UAAU,qBAAqB,CAAC,MAAkB;IACtD,OAAO,MAAM,CAAC,KAAK,KAAK,WAAW,CAAA;AACrC,CAAC;AAUD,MAAM,UAAU,sBAAsB,CAAC,MAAqB;IAC1D,OAAO,MAAM,CAAC,KAAK,KAAK,SAAS,CAAA;AACnC,CAAC;AA2FD,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,SAAS,EAAE,mBAAmB;IAC9B,EAAE,EAAE,mBAAmB;IACvB,EAAE,EAAE,mBAAmB;IACvB,UAAU,EAAE,aAAa;IACzB,SAAS,EAAE,gBAAgB;IAC3B,KAAK,EAAE,cAAc;IACrB,IAAI,EAAE,YAAY;IAClB,KAAK,EAAE,iBAAiB;IACxB,EAAE,EAAE,mBAAmB;CACf,CAAA","sourcesContent":["// Bluetooth SDK Event Types\nexport type GlassesNotReadyEvent = {\n type: \"glasses_not_ready\"\n message: string\n}\n\nexport type ButtonPressEvent = {\n type: \"button_press\"\n buttonId: string\n pressType: \"long\" | \"short\"\n timestamp: number\n}\n\nexport type TouchEvent = {\n type: \"touch_event\"\n deviceModel: DeviceModel\n gestureName: string\n timestamp: number\n}\n\nexport type HeadUpEvent = {\n up: boolean\n}\n\nexport type VadStatusEvent = {\n type: \"vad_status\"\n status: boolean\n}\n\nexport type BatteryStatusEvent = {\n type: \"battery_status\"\n level: number\n charging: boolean\n timestamp: number\n}\n\nexport type GlassesConnectionStatus =\n | {state: 'disconnected'}\n | {state: 'scanning'}\n | {state: 'connecting'}\n | {state: 'bonding'}\n | {state: 'connected'; fullyBooted: boolean}\n\nexport type ConnectedGlassesConnectionStatus = Extract<GlassesConnectionStatus, {state: 'connected'}>\n\nexport function isConnectedGlassesConnectionStatus(\n status: GlassesConnectionStatus,\n): status is ConnectedGlassesConnectionStatus {\n return status.state === 'connected'\n}\n\nexport function isReadyGlassesConnectionStatus(status: GlassesConnectionStatus): boolean {\n return status.state === 'connected' && status.fullyBooted\n}\n\nexport function isBusyGlassesConnectionStatus(status: GlassesConnectionStatus): boolean {\n return status.state === 'scanning' || status.state === 'connecting' || status.state === 'bonding'\n}\n\nexport function createDisconnectedGlassesStatus(): Partial<GlassesStatus> {\n return {\n connection: {state: 'disconnected'},\n hotspot: {state: 'disabled'},\n wifi: {state: 'disconnected'},\n }\n}\n\n/** K900 `sr_getvol` response (Mentra Live glasses media step volume 0–15). */\nexport type GlassesMediaVolumeGetResult = {\n level: number\n statusCode: number\n}\n\n/** K900 `sr_vol` acknowledgment. */\nexport type GlassesMediaVolumeSetResult = {\n statusCode: number\n}\n\nexport type LocalTranscriptionEvent = {\n text: string\n isFinal?: boolean\n transcribeLanguage?: string\n}\n\nexport type LogEvent = {\n message: string\n}\n\nexport type WifiStatus = {state: 'disconnected'} | {state: 'connected'; ssid: string; localIp?: string}\n\nexport type ConnectedWifiStatus = Extract<WifiStatus, {state: 'connected'}>\n\nexport function isConnectedWifiStatus(status: WifiStatus): status is ConnectedWifiStatus {\n return status.state === 'connected'\n}\n\nexport type WifiStatusChangeEvent = WifiStatus & {\n type: \"wifi_status_change\"\n}\n\nexport type HotspotStatus = {state: 'disabled'} | {state: 'enabled'; ssid: string; password: string; localIp: string}\n\nexport type EnabledHotspotStatus = Extract<HotspotStatus, {state: 'enabled'}>\n\nexport function isEnabledHotspotStatus(status: HotspotStatus): status is EnabledHotspotStatus {\n return status.state === 'enabled'\n}\n\nexport type HotspotStatusChangeEvent = HotspotStatus & {\n type: \"hotspot_status_change\"\n}\n\nexport type HotspotErrorEvent = {\n type: \"hotspot_error\"\n errorMessage: string\n timestamp: number\n}\n\nexport type PhotoResponseEvent =\n | {\n type: \"photo_response\"\n state: \"success\"\n requestId: string\n uploadUrl: string\n timestamp: number\n }\n | {\n type: \"photo_response\"\n state: \"error\"\n requestId: string\n timestamp: number\n errorCode?: string\n errorMessage: string\n }\n\nexport type GalleryStatusEvent = {\n type: \"gallery_status\"\n photos: number\n videos: number\n total: number\n totalSize?: number\n hasContent: boolean\n cameraBusy: boolean\n}\n\nexport type CompatibleGlassesSearchStopEvent = {\n type: \"compatible_glasses_search_stop\"\n deviceModel: DeviceModel\n}\n\nexport type HeartbeatSentEvent = {\n type: \"heartbeat_sent\"\n heartbeat_sent: {\n timestamp: number\n }\n}\n\nexport type HeartbeatReceivedEvent = {\n type: \"heartbeat_received\"\n heartbeat_received: {\n timestamp: number\n }\n}\n\nexport type SwipeVolumeStatusEvent = {\n type: \"swipe_volume_status\"\n enabled: boolean\n timestamp: number\n}\n\nexport type SwitchStatusEvent = {\n type: \"switch_status\"\n switchType?: number\n switchValue?: number\n timestamp: number\n}\n\nexport type RgbLedControlResponseEvent =\n | {\n type: \"rgb_led_control_response\"\n state: \"success\"\n requestId: string\n }\n | {\n type: \"rgb_led_control_response\"\n state: \"error\"\n requestId: string\n errorCode: string\n }\n\nexport type RgbLedAction = \"on\" | \"off\"\nexport type RgbLedColor = \"red\" | \"green\" | \"blue\" | \"orange\" | \"white\"\n/** `\"auto\"` enables local button photo/video capture; `\"manual\"` reports button events without local gallery capture. */\nexport type GalleryMode = \"auto\" | \"manual\"\nexport type PhotoSize = \"small\" | \"medium\" | \"large\" | \"full\"\nexport type ButtonPhotoSize = \"small\" | \"medium\" | \"large\"\nexport type PhotoCompression = \"none\" | \"medium\" | \"heavy\"\nexport const DeviceModels = {\n Simulated: \"Simulated Glasses\",\n G1: \"Even Realities G1\",\n G2: \"Even Realities G2\",\n MentraLive: \"Mentra Live\",\n MentraNex: \"Mentra Display\",\n Mach1: \"Mentra Mach1\",\n Z100: \"Vuzix Z100\",\n Frame: \"Brilliant Frame\",\n R1: \"Even Realities R1\",\n} as const\n\nexport type DeviceModel = (typeof DeviceModels)[keyof typeof DeviceModels]\nexport type ObservableStoreCategory = \"glasses\" | \"bluetooth\" | \"core\"\n\nexport type DashboardMenuItem = {\n title: string\n packageName: string\n values?: Record<string, unknown>\n}\n\nexport type CameraFov = \"standard\" | \"wide\"\n\nexport type CameraFovSetting = {\n fov: number\n roiPosition: number\n}\n\nexport type MicPreference = \"auto\" | \"phone\" | \"glasses\" | \"bluetooth\"\nexport type MicMode = \"phone\" | \"glasses\" | \"bluetoothClassic\" | \"bluetooth\"\n\nexport type StreamVideoConfig = {\n width?: number\n height?: number\n bitrate?: number\n frameRate?: number\n}\n\nexport type StreamAudioConfig = {\n bitrate?: number\n sampleRate?: number\n echoCancellation?: boolean\n noiseSuppression?: boolean\n}\n\nexport type StreamStartRequest = {\n type?: \"start_stream\"\n streamUrl: string\n streamId?: string\n keepAlive?: boolean\n keepAliveIntervalSeconds?: number\n sound?: boolean\n video?: StreamVideoConfig\n audio?: StreamAudioConfig\n}\n\nexport type StreamKeepAliveRequest = {\n type?: \"keep_stream_alive\"\n streamId: string\n ackId: string\n}\n\nexport type PairFailureEvent = {\n type: \"pair_failure\"\n error: string\n}\n\nexport type AudioPairingNeededEvent = {\n type: \"audio_pairing_needed\"\n deviceName: string\n}\n\nexport type AudioConnectedEvent = {\n type: \"audio_connected\"\n deviceName: string\n}\n\nexport type AudioDisconnectedEvent = {\n type: \"audio_disconnected\"\n}\n\nexport type SaveSettingEvent = {\n type: \"save_setting\"\n key: string\n value: any\n}\n\nexport type WsTextEvent = {\n type: \"ws_text\"\n text: string\n}\n\nexport type WsBinEvent = {\n type: \"ws_bin\"\n base64: string\n}\n\nexport type MicPcmEvent = {\n type: \"mic_pcm\"\n pcm: ArrayBuffer\n sampleRate: 16000\n bitsPerSample: 16\n channels: 1\n encoding: \"pcm_s16le\"\n vadGated: boolean\n}\n\nexport type MicLc3Event = {\n type: \"mic_lc3\"\n lc3: ArrayBuffer\n sampleRate: 16000\n channels: 1\n encoding: \"lc3\"\n frameDurationMs: 10\n frameSizeBytes: number\n bitrate: number\n packetizedFromGlasses: boolean\n vadGated: boolean\n}\n\nexport type StreamStatusLifecycleState = \"initializing\" | \"streaming\" | \"stopping\" | \"stopped\"\nexport type StreamStatusReconnectState = \"reconnecting\" | \"reconnected\" | \"reconnect_failed\"\nexport type StreamStatusState = StreamStatusLifecycleState | StreamStatusReconnectState | \"error\"\n\nexport type StreamStatusEvent =\n | {\n type: \"stream_status\"\n kind: \"lifecycle\"\n status: StreamStatusLifecycleState\n streamId?: string\n timestamp?: number\n }\n | {\n type: \"stream_status\"\n kind: \"reconnect\"\n status: \"reconnecting\"\n streamId?: string\n attempt: number\n maxAttempts: number\n reason: string\n timestamp?: number\n }\n | {\n type: \"stream_status\"\n kind: \"reconnect\"\n status: \"reconnected\"\n streamId?: string\n attempt: number\n timestamp?: number\n }\n | {\n type: \"stream_status\"\n kind: \"reconnect\"\n status: \"reconnect_failed\"\n streamId?: string\n maxAttempts: number\n timestamp?: number\n }\n | {\n type: \"stream_status\"\n kind: \"error\"\n status: \"error\"\n streamId?: string\n errorDetails: string\n timestamp?: number\n }\n | {\n type: \"stream_status\"\n kind: \"snapshot\"\n status: \"streaming\" | \"reconnecting\" | \"stopped\"\n streaming: boolean\n reconnecting: boolean\n streamId?: string\n attempt?: number\n timestamp?: number\n }\n\nexport type KeepAliveAckEvent = {\n type: \"keep_alive_ack\"\n streamId: string\n ackId: string\n timestamp?: number\n}\n\nexport type MtkUpdateCompleteEvent = {\n type: \"mtk_update_complete\"\n message: string\n timestamp: number\n}\n\nexport type OtaUpdateAvailableEvent = {\n type: \"ota_update_available\"\n version_code?: number\n version_name?: string\n updates?: string[]\n total_size?: number\n cache_ready?: boolean\n}\n\n/** @deprecated Glasses no longer emit ota_progress; use {@link OtaStatusEvent} and status-store mapping. */\nexport type OtaProgressEvent = {\n type: \"ota_progress\"\n stage?: OtaStage\n status?: OtaProgressStatus\n progress?: number\n bytes_downloaded?: number\n total_bytes?: number\n current_update?: string\n error_message?: string\n}\n\nexport type OtaStartAckEvent = {\n type: \"ota_start_ack\"\n timestamp: number\n}\n\nexport type OtaStatusEvent = {\n type: \"ota_status\"\n session_id: string\n total_steps: number\n current_step: number\n step_type: 'apk' | 'mtk' | 'bes'\n phase: 'download' | 'install'\n step_percent: number\n overall_percent: number\n status: 'in_progress' | 'step_complete' | 'complete' | 'failed' | 'idle'\n error_message?: string\n}\n\n/** Nex BLE protobuf trace (NexEventUtils); payload matches native Map keys. */\nexport type BleCommandTraceEvent = {\n command: string\n commandText: string\n timestamp: number\n}\n\nexport type MiniappSelectedEvent = {\n type: \"miniapp_selected\"\n packageName: string\n}\n\n// Union type of all native/internal Bluetooth SDK events.\nexport type BluetoothSdkInternalEvent = Parameters<BluetoothSdkModuleEvents[keyof BluetoothSdkModuleEvents]>[0]\n\nexport type BluetoothSdkModuleEvents = {\n glasses_status: (changed: Partial<GlassesStatus>) => void\n bluetooth_status: (changed: Partial<BluetoothStatus>) => void\n log: (event: LogEvent) => void\n device_discovered: (device: Device) => void\n default_device_changed: (event: {device?: Device}) => void\n // Individual event handlers\n glasses_not_ready: (event: GlassesNotReadyEvent) => void\n button_press: (event: ButtonPressEvent) => void\n touch_event: (event: TouchEvent) => void\n head_up: (event: HeadUpEvent) => void\n vad_status: (event: VadStatusEvent) => void\n battery_status: (event: BatteryStatusEvent) => void\n local_transcription: (event: LocalTranscriptionEvent) => void\n wifi_status_change: (event: WifiStatusChangeEvent) => void\n hotspot_status_change: (event: HotspotStatusChangeEvent) => void\n hotspot_error: (event: HotspotErrorEvent) => void\n photo_response: (event: PhotoResponseEvent) => void\n gallery_status: (event: GalleryStatusEvent) => void\n compatible_glasses_search_stop: (event: CompatibleGlassesSearchStopEvent) => void\n heartbeat_sent: (event: HeartbeatSentEvent) => void\n heartbeat_received: (event: HeartbeatReceivedEvent) => void\n swipe_volume_status: (event: SwipeVolumeStatusEvent) => void\n switch_status: (event: SwitchStatusEvent) => void\n rgb_led_control_response: (event: RgbLedControlResponseEvent) => void\n pair_failure: (event: PairFailureEvent) => void\n audio_pairing_needed: (event: AudioPairingNeededEvent) => void\n audio_connected: (event: AudioConnectedEvent) => void\n audio_disconnected: (event: AudioDisconnectedEvent) => void\n save_setting: (event: SaveSettingEvent) => void\n ws_text: (event: WsTextEvent) => void\n ws_bin: (event: WsBinEvent) => void\n mic_pcm: (event: MicPcmEvent) => void\n mic_lc3: (event: MicLc3Event) => void\n stream_status: (event: StreamStatusEvent) => void\n keep_alive_ack: (event: KeepAliveAckEvent) => void\n mtk_update_complete: (event: MtkUpdateCompleteEvent) => void\n ota_update_available: (event: OtaUpdateAvailableEvent) => void\n ota_start_ack: (event: OtaStartAckEvent) => void\n ota_status: (event: OtaStatusEvent) => void\n send_command_to_ble: (event: BleCommandTraceEvent) => void\n receive_command_from_ble: (event: BleCommandTraceEvent) => void\n miniapp_selected: (event: MiniappSelectedEvent) => void\n}\n\nexport type PublicGlassesStatus = Omit<\n GlassesStatus,\n \"otaUpdateAvailable\" | \"otaProgress\" | \"otaInProgress\" | \"otaVersionUrl\"\n>\n\nexport type PublicBluetoothStatus = Pick<\n BluetoothStatus,\n | \"searching\"\n | \"searchingController\"\n | \"systemMicUnavailable\"\n | \"micRanking\"\n | \"currentMic\"\n | \"searchResults\"\n | \"wifiScanResults\"\n | \"lastLog\"\n | \"otherBtConnected\"\n | \"galleryModeAuto\"\n>\n\nexport type BluetoothSdkEventMap = {\n log: LogEvent\n device_discovered: Device\n default_device_changed: {device?: Device}\n glasses_not_ready: GlassesNotReadyEvent\n button_press: ButtonPressEvent\n touch_event: TouchEvent\n head_up: HeadUpEvent\n vad_status: VadStatusEvent\n battery_status: BatteryStatusEvent\n local_transcription: LocalTranscriptionEvent\n wifi_status_change: WifiStatusChangeEvent\n hotspot_status_change: HotspotStatusChangeEvent\n hotspot_error: HotspotErrorEvent\n photo_response: PhotoResponseEvent\n gallery_status: GalleryStatusEvent\n compatible_glasses_search_stop: CompatibleGlassesSearchStopEvent\n swipe_volume_status: SwipeVolumeStatusEvent\n switch_status: SwitchStatusEvent\n rgb_led_control_response: RgbLedControlResponseEvent\n pair_failure: PairFailureEvent\n audio_pairing_needed: AudioPairingNeededEvent\n audio_connected: AudioConnectedEvent\n audio_disconnected: AudioDisconnectedEvent\n mic_pcm: MicPcmEvent\n mic_lc3: MicLc3Event\n stream_status: StreamStatusEvent\n keep_alive_ack: KeepAliveAckEvent\n}\n\nexport type BluetoothSdkEventName = keyof BluetoothSdkEventMap\n\nexport type BluetoothSdkEventListener<EventName extends BluetoothSdkEventName> = (\n event: BluetoothSdkEventMap[EventName],\n) => void\n\nexport type BluetoothSdkSubscription = {\n remove(): void\n}\n\nexport type BluetoothSdkEvent = BluetoothSdkEventMap[BluetoothSdkEventName]\n\nexport interface BluetoothSdkPublicModule {\n addListener<EventName extends BluetoothSdkEventName>(\n eventName: EventName,\n listener: BluetoothSdkEventListener<EventName>,\n ): BluetoothSdkSubscription\n\n getDefaultDevice(): Promise<Device | null>\n setDefaultDevice(device: Device | null): Promise<void>\n clearDefaultDevice(): Promise<void>\n\n startScan(model: DeviceModel): Promise<void>\n stopScan(): Promise<void>\n scan(options: ScanOptions): Promise<Device[]>\n scan(model: DeviceModel, options?: ScanModelOptions): Promise<Device[]>\n connect(device: Device, options?: ConnectOptions): Promise<void>\n connectDefault(options?: ConnectOptions): Promise<void>\n cancelConnectionAttempt(): Promise<void>\n disconnect(): Promise<void>\n forget(): Promise<void>\n\n displayText(text: string, x?: number, y?: number, size?: number): Promise<void>\n clearDisplay(): Promise<void>\n showDashboard(): Promise<void>\n setDashboardPosition(height: number, depth: number): Promise<void>\n setHeadUpAngle(angleDegrees: number): Promise<void>\n setScreenDisabled(disabled: boolean): Promise<void>\n\n requestWifiScan(): Promise<void>\n sendWifiCredentials(ssid: string, password: string): Promise<void>\n forgetWifiNetwork(ssid: string): Promise<void>\n setHotspotState(enabled: boolean): Promise<void>\n\n setGalleryMode(mode: GalleryMode): Promise<void>\n setButtonPhotoSettings(size: ButtonPhotoSize): Promise<void>\n setButtonVideoRecordingSettings(width: number, height: number, frameRate: number): Promise<void>\n setButtonCameraLed(enabled: boolean): Promise<void>\n setButtonMaxRecordingTime(minutes: number): Promise<void>\n setCameraFov(fov: CameraFov): Promise<void>\n queryGalleryStatus(): Promise<void>\n requestPhoto(\n requestId: string,\n appId: string,\n size: PhotoSize,\n webhookUrl: string | null,\n authToken: string | null,\n compress: PhotoCompression,\n sound: boolean,\n ): Promise<void>\n startVideoRecording(requestId: string, save: boolean, sound: boolean): Promise<void>\n stopVideoRecording(requestId: string): Promise<void>\n\n startStream(params: StreamStartRequest): Promise<void>\n stopStream(): Promise<void>\n keepStreamAlive(params: StreamKeepAliveRequest): Promise<void>\n\n setMicState(\n enabled: boolean,\n useGlassesMic?: boolean,\n bypassVad?: boolean,\n sendTranscript?: boolean,\n sendLc3Data?: boolean,\n ): Promise<void>\n setPreferredMic(preferredMic: MicPreference): Promise<void>\n setOwnAppAudioPlaying(playing: boolean): Promise<void>\n getGlassesMediaVolume(): Promise<GlassesMediaVolumeGetResult>\n setGlassesMediaVolume(level: number): Promise<GlassesMediaVolumeSetResult>\n\n rgbLedControl(\n requestId: string,\n packageName: string | null,\n action: RgbLedAction,\n color: RgbLedColor | null,\n onDurationMs: number,\n offDurationMs: number,\n count: number,\n ): Promise<void>\n\n requestVersionInfo(): Promise<void>\n}\n\n// OTA update status types\nexport type OtaStage = \"download\" | \"install\"\nexport type OtaProgressStatus = \"STARTED\" | \"PROGRESS\" | \"FINISHED\" | \"FAILED\"\n\nexport interface OtaStatus {\n sessionId: string\n totalSteps: number\n currentStep: number\n stepType: 'apk' | 'mtk' | 'bes'\n phase: 'download' | 'install'\n stepPercent: number\n overallPercent: number\n status: 'in_progress' | 'step_complete' | 'complete' | 'failed' | 'idle'\n error?: string\n}\n\nexport interface OtaUpdateInfo {\n available: boolean\n versionCode: number\n versionName: string\n updates: string[] // [\"apk\", \"mtk\", \"bes\"]\n totalSize: number\n cacheReady?: boolean\n}\n\nexport interface OtaProgress {\n stage: OtaStage\n status: OtaProgressStatus\n progress: number\n bytesDownloaded: number\n totalBytes: number\n currentUpdate: string\n errorMessage?: string\n}\n\nexport interface GlassesStatus {\n // state:\n connection: GlassesConnectionStatus\n micEnabled: boolean\n bluetoothClassicConnected: boolean\n signalStrength: number\n /** Milliseconds since epoch when signalStrength was last refreshed by the phone BLE stack. */\n signalStrengthUpdatedAt: number\n // device info\n deviceModel: string\n androidVersion: string\n firmwareVersion: string\n besFirmwareVersion: string\n mtkFirmwareVersion: string\n bluetoothMacAddress: string\n leftMacAddress: string\n rightMacAddress: string\n buildNumber: string\n otaVersionUrl: string\n appVersion: string\n bluetoothName: string\n serialNumber: string\n style: string\n color: string\n // wifi info\n wifi: WifiStatus\n // battery info\n batteryLevel: number\n charging: boolean\n caseBatteryLevel: number\n caseCharging: boolean\n caseOpen: boolean\n caseRemoved: boolean\n // hotspot info\n hotspot: HotspotStatus\n // OTA update info\n otaUpdateAvailable: OtaUpdateInfo | null\n otaProgress: OtaProgress | null\n otaInProgress: boolean\n // ring info\n controllerConnected: boolean\n controllerFullyBooted: boolean\n controllerMacAddress: string\n controllerBatteryLevel: number\n controllerSignalStrength: number\n}\n\nexport interface CoreDashboardMenuItem {\n name: string\n packageName: string\n running: boolean\n}\n\nexport interface CoreSettings {\n menu_apps: CoreDashboardMenuItem[]\n}\n\nexport interface Device {\n /**\n * Stable app-facing key for this scan result, within the limits of the\n * platform identifier available to the SDK. Do not parse this value; use the\n * typed model, name, address, and rssi fields instead.\n */\n id: string\n model: DeviceModel\n name: string\n /** Platform address/identifier when available: Android Bluetooth address, iOS CoreBluetooth identifier. */\n address?: string\n /**\n * Optional scan signal strength. It may be undefined at first discovery and\n * appear in a later scan update when the platform reports RSSI metadata.\n */\n rssi?: number\n}\n\nexport interface ConnectOptions {\n saveAsDefault?: boolean\n cancelExistingConnectionAttempt?: boolean\n}\n\nexport type ScanResultsCallback = (devices: Device[]) => void\n\nexport interface ScanOptions {\n model: DeviceModel\n /** Defaults to 15000. */\n timeoutMs?: number\n /** Alias for `timeoutMs`, useful when mirroring native examples. */\n timeout?: number\n /** Called every time the discovered device list changes during the scan. */\n onResults?: ScanResultsCallback\n}\n\nexport type ScanModelOptions = Omit<ScanOptions, \"model\">\n\nexport interface WifiSearchResult {\n ssid: string\n requiresPassword: boolean\n signalStrength: number\n /** Frequency in MHz (from glasses scan). 5 GHz band is typically 5170–5825. Omitted if unknown. */\n frequency?: number\n}\n\nexport interface BluetoothStatus {\n // state:\n searching: boolean\n searchingController: boolean\n default_wearable?: DeviceModel | \"\"\n pending_wearable?: DeviceModel | \"\"\n device_name?: string\n device_address?: string\n default_controller?: DeviceModel | \"\"\n pending_controller?: DeviceModel | \"\"\n controller_device_name?: string\n controller_address?: string\n systemMicUnavailable: boolean\n micRanking: MicMode[]\n currentMic: MicMode | \"\" | null\n /**\n * Nearby glasses in stable discovery order.\n * Existing entries keep their array position as details refresh; new glasses append at the end,\n * and removals should not reorder remaining entries.\n */\n searchResults: Device[]\n wifiScanResults: WifiSearchResult[]\n lastLog: string[]\n otherBtConnected: boolean\n // desired settings the SDK sends to compatible connected glasses:\n galleryModeAuto: boolean\n}\n\nexport type BluetoothSettingsUpdate = Partial<{\n auth_email: string\n core_token: string\n sensing_enabled: boolean\n power_saving_mode: boolean\n lc3_frame_size: number\n preferred_mic: MicPreference\n screen_disabled: boolean\n contextual_dashboard: boolean\n head_up_angle: number\n brightness: number\n auto_brightness: boolean\n dashboard_height: number\n dashboard_depth: number\n menu_apps: DashboardMenuItem[] | CoreDashboardMenuItem[] | Array<Record<string, unknown>> | null\n galleryModeAuto: boolean\n button_photo_size: ButtonPhotoSize\n button_video_settings: {width: number; height: number; frameRate: number}\n button_video_width: number\n button_video_height: number\n button_video_fps: number\n button_camera_led: boolean\n button_max_recording_time: number\n camera_fov: CameraFovSetting\n should_send_pcm: boolean\n should_send_lc3: boolean\n should_send_transcript: boolean\n bypass_vad: boolean\n offline_mode: boolean\n offline_captions_running: boolean\n local_stt_fallback_active: boolean\n pending_wearable: DeviceModel | \"\"\n default_wearable: DeviceModel | \"\"\n device_name: string\n device_address: string\n default_controller: DeviceModel | \"\"\n pending_controller: DeviceModel | \"\"\n controller_device_name: string\n controller_address: string\n}>\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BluetoothSdkModule.d.ts","sourceRoot":"","sources":["../../src/_private/BluetoothSdkModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAsB,MAAM,MAAM,CAAA;AAEtD,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,wBAAwB,EAExB,eAAe,EACf,SAAS,EAET,cAAc,EACd,iBAAiB,EACjB,MAAM,EACN,WAAW,EACX,WAAW,EACX,2BAA2B,EAC3B,2BAA2B,EAC3B,aAAa,EACb,aAAa,EACb,uBAAuB,EACvB,gBAAgB,EAChB,SAAS,EACT,qBAAqB,EACrB,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,uBAAuB,CAAA;AAE9B;;;;;;;GAOG;AAEH,KAAK,eAAe,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,KAAK,IAAI,CAAA;AAChE,KAAK,uBAAuB,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,qB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,OAAO,CAAC,IAAI,CAAC;IAGhB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IACrE,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;IAClC,sBAAsB,IAAI,OAAO,CAAC,OAAO,CAAC;IAC1C,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAChD,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAG5E,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAC5D,uBAAuB,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IACvE,eAAe,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,IAAI;IACtD,iBAAiB,CAAC,QAAQ,EAAE,uBAAuB,GAAG,MAAM,IAAI;IAGhE,WAAW,IAAI,MAAM;CACtB;AAED,MAAM,MAAM,0BAA0B,GAAG,wBAAwB,CAAA;AAIjE,QAAA,MAAM,wBAAwB,0BAAgE,CAAA;AAiT9F,eAAe,wBAAwB,CAAA;AACvC,eAAO,MAAM,YAAY,EAA+B,wBAAwB,CAAA"}
|
|
@@ -216,6 +216,9 @@ NativeBluetoothSdkModule.scan = async function (modelOrOptions, options) {
|
|
|
216
216
|
}
|
|
217
217
|
};
|
|
218
218
|
const handleBluetoothStatus = (status) => {
|
|
219
|
+
if (!Array.isArray(status.searchResults)) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
219
222
|
emitResults(searchResultsForModel(status, scanOptions.model));
|
|
220
223
|
};
|
|
221
224
|
removeBluetoothListener = this.onBluetoothStatus(handleBluetoothStatus);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BluetoothSdkModule.js","sourceRoot":"","sources":["../../src/_private/BluetoothS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AA;IACxF,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,eAAe,wBAAwB,CAAA;AACvC,MAAM,CAAC,MAAM,YAAY,GAAG,wBAAoD,CAAA","sourcesContent":["import {NativeModule, requireNativeModule} from \"expo\"\n\nimport {\n BluetoothSettingsUpdate,\n BluetoothSdkPublicModule,\n BluetoothSdkModuleEvents,\n BluetoothStatus,\n ButtonPhotoSize,\n CameraFov,\n CameraFovSetting,\n ConnectOptions,\n DashboardMenuItem,\n Device,\n DeviceModel,\n GalleryMode,\n GlassesMediaVolumeGetResult,\n GlassesMediaVolumeSetResult,\n GlassesStatus,\n MicPreference,\n ObservableStoreCategory,\n PhotoCompression,\n PhotoSize,\n PublicBluetoothStatus,\n RgbLedAction,\n RgbLedColor,\n ScanModelOptions,\n ScanOptions,\n StreamKeepAliveRequest,\n StreamStartRequest,\n} from \"../BluetoothSdk.types\"\n\n/**\n * Private React Native native-module facade.\n *\n * This file intentionally lives under `_private` so the package root can expose\n * a small SDK surface while MentraOS uses its monorepo-only internal alias\n * during migration. Raw status getters/listeners stay here so React hooks can\n * shape native store snapshots before app code sees them.\n */\n\ntype GlassesListener = (changed: Partial<GlassesStatus>) => void\ntype BluetoothStatusListener = (changed: Partial<PublicBluetoothStatus>) => void\ntype MaybePromise<T> = T | Promise<T>\n\ndeclare class BluetoothSdkNativeModule extends NativeModule<BluetoothSdkModuleEvents> {\n // Observable Store Functions (native)\n getGlassesStatus(): Promise<GlassesStatus>\n getBluetoothStatus(): Promise<PublicBluetoothStatus>\n getDefaultDevice(): Promise<Device | null>\n update(category: ObservableStoreCategory, values: object): Promise<void>\n\n // Display Commands\n displayEvent(params: Record<string, unknown>): Promise<void>\n displayText(text: string, x?: number, y?: number, size?: number): Promise<void>\n clearDisplay(): Promise<void>\n\n // Connection Commands\n requestStatus(): Promise<void>\n connectDefault(options?: ConnectOptions): Promise<void>\n connectDefaultWithOptions(options: Required<ConnectOptions>): Promise<void>\n setDefaultDevice(device: Device | null): Promise<void>\n clearDefaultDevice(): Promise<void>\n startScan(model: DeviceModel): Promise<void>\n stopScan(): Promise<void>\n scan(options: ScanOptions): Promise<Device[]>\n scan(model: DeviceModel, options?: ScanModelOptions): Promise<Device[]>\n connect(device: Device, options?: ConnectOptions): Promise<void>\n connectWithOptions(device: Device, options: Required<ConnectOptions>): Promise<void>\n cancelConnectionAttempt(): Promise<void>\n connectDefaultController(): Promise<void>\n disconnectController(): Promise<void>\n connectSimulated(): Promise<void>\n disconnect(): Promise<void>\n forget(): Promise<void>\n forgetController(): Promise<void>\n showDashboard(): Promise<void>\n setBrightness(level: number, autoMode?: boolean | null): Promise<void>\n setAutoBrightness(enabled: boolean): Promise<void>\n setDashboardPosition(height: number, depth: number): Promise<void>\n setDashboardMenu(items: DashboardMenuItem[]): Promise<void>\n setHeadUpAngle(angleDegrees: number): Promise<void>\n setScreenDisabled(disabled: boolean): Promise<void>\n ping(): Promise<void>\n dbg1(): Promise<void>\n dbg2(): Promise<void>\n\n // Incident Reporting\n sendIncidentId(incidentId: string, apiBaseUrl?: string | null): Promise<void>\n\n // WiFi Commands\n requestWifiScan(): Promise<void>\n sendWifiCredentials(ssid: string, password: string): Promise<void>\n forgetWifiNetwork(ssid: string): Promise<void>\n setHotspotState(enabled: boolean): Promise<void>\n /** Logs current WiFi frequency (MHz) and 5 GHz band to Android logcat. */\n logCurrentWifiFrequency(): Promise<void>\n\n // Gallery Commands\n setGalleryMode(mode: GalleryMode): Promise<void>\n setButtonPhotoSettings(size: ButtonPhotoSize): Promise<void>\n setButtonVideoRecordingSettings(width: number, height: number, frameRate: number): Promise<void>\n setButtonCameraLed(enabled: boolean): Promise<void>\n setButtonMaxRecordingTime(minutes: number): Promise<void>\n setCameraFov(fov: CameraFov): Promise<void>\n queryGalleryStatus(): Promise<void>\n requestPhoto(\n requestId: string,\n appId: string,\n size: PhotoSize,\n webhookUrl: string | null,\n authToken: string | null,\n compress: PhotoCompression,\n sound: boolean,\n ): Promise<void>\n\n // OTA Commands\n sendOtaStart(): Promise<void>\n sendOtaQueryStatus(): Promise<void>\n\n // Version Info Commands\n requestVersionInfo(): Promise<void>\n\n // Video Recording Commands\n startVideoRecording(requestId: string, save: boolean, sound: boolean): Promise<void>\n stopVideoRecording(requestId: string): Promise<void>\n\n // Stream Commands\n startStream(params: StreamStartRequest): Promise<void>\n stopStream(): Promise<void>\n keepStreamAlive(params: StreamKeepAliveRequest): Promise<void>\n\n // Microphone Commands\n setMicState(\n enabled: boolean,\n useGlassesMic?: boolean,\n bypassVad?: boolean,\n sendTranscript?: boolean,\n sendLc3Data?: boolean,\n ): Promise<void>\n setPreferredMic(preferredMic: MicPreference): Promise<void>\n restartTranscriber(): Promise<void>\n\n // Audio Playback Monitoring\n // Notify native side when our app starts/stops playing audio\n // Used to suspend LC3 mic during audio playback to avoid MCU overload\n setOwnAppAudioPlaying(playing: boolean): Promise<void>\n\n /** Mentra Live only: K900 `cs_getvol` / `sr_getvol`. */\n getGlassesMediaVolume(): Promise<GlassesMediaVolumeGetResult>\n /** Mentra Live only: K900 `cs_vol` / `sr_vol`; level clamped 0–15 on native. */\n setGlassesMediaVolume(level: number): Promise<GlassesMediaVolumeSetResult>\n\n // RGB LED Control\n rgbLedControl(\n requestId: string,\n packageName: string | null,\n action: RgbLedAction,\n color: RgbLedColor | null,\n onDurationMs: number,\n offDurationMs: number,\n count: number,\n ): Promise<void>\n\n // STT Commands\n setSttModelDetails(path: string, languageCode: string): Promise<void>\n getSttModelPath(): Promise<string>\n checkSttModelAvailable(): Promise<boolean>\n validateSttModel(path: string): Promise<boolean>\n extractTarBz2(sourcePath: string, destinationPath: string): Promise<boolean>\n\n // Helper methods for type-safe observable store access\n updateGlasses(values: Partial<GlassesStatus>): Promise<void>\n updateBluetoothSettings(values: BluetoothSettingsUpdate): Promise<void>\n onGlassesStatus(callback: GlassesListener): () => void\n onBluetoothStatus(callback: BluetoothStatusListener): () => void\n\n // Process resident-set-size in MB. iOS-only; Android stub returns 0.\n getMemoryMB(): number\n}\n\nexport type BluetoothSdkInternalModule = BluetoothSdkNativeModule\n\n// This call loads the native module object from the JSI.\n// NativeModule<BluetoothSdkModuleEvents> already extends EventEmitter<BluetoothSdkModuleEvents>\nconst NativeBluetoothSdkModule = requireNativeModule<BluetoothSdkNativeModule>(\"BluetoothSdk\")\n\nconst DEFAULT_CONNECT_OPTIONS: Required<ConnectOptions> = {\n saveAsDefault: true,\n cancelExistingConnectionAttempt: true,\n}\n\nconst DEFAULT_SCAN_TIMEOUT_MS = 15_000\n\nconst CAMERA_FOV_SETTINGS: Record<CameraFov, CameraFovSetting> = {\n standard: {fov: 118, roiPosition: 0},\n wide: {fov: 118, roiPosition: 0},\n}\n\nfunction searchResultsForModel(status: Partial<PublicBluetoothStatus>, model: DeviceModel): Device[] {\n return status.searchResults?.filter((device) => device.model === model) ?? []\n}\n\nfunction normalizeScanArgs(modelOrOptions: DeviceModel | ScanOptions, options?: ScanModelOptions): ScanOptions {\n if (typeof modelOrOptions === \"string\") {\n return {model: modelOrOptions, ...options}\n }\n return modelOrOptions\n}\n\nfunction normalizeTimeoutMs(timeoutMs: number | undefined, defaultTimeoutMs: number): number {\n return typeof timeoutMs === \"number\" && Number.isFinite(timeoutMs) && timeoutMs > 0 ? timeoutMs : defaultTimeoutMs\n}\n\nfunction dashboardMenuItemToNative(item: DashboardMenuItem): Record<string, unknown> {\n return {\n ...(item.values ?? {}),\n title: item.title,\n packageName: item.packageName,\n }\n}\n\nfunction adaptConnectionStatusToNative(connection: GlassesStatus[\"connection\"]): Record<string, unknown> {\n switch (connection.state) {\n case \"connected\":\n return {connectionState: \"CONNECTED\", connected: true, fullyBooted: connection.fullyBooted}\n case \"scanning\":\n return {connectionState: \"SCANNING\", connected: false, fullyBooted: false}\n case \"connecting\":\n return {connectionState: \"CONNECTING\", connected: false, fullyBooted: false}\n case \"bonding\":\n return {connectionState: \"BONDING\", connected: false, fullyBooted: false}\n case \"disconnected\":\n return {connectionState: \"DISCONNECTED\", connected: false, fullyBooted: false}\n }\n}\n\nfunction adaptGlassesUpdateToNative(values: Partial<GlassesStatus>): Record<string, unknown> {\n const {wifi, hotspot, connection, ...rest} = values\n let update: Record<string, unknown> = {...rest}\n if (connection) {\n update = {\n ...update,\n ...adaptConnectionStatusToNative(connection),\n }\n }\n if (wifi?.state === \"connected\") {\n update = {\n ...update,\n wifiConnected: true,\n wifiSsid: wifi.ssid,\n wifiLocalIp: wifi.localIp ?? \"\",\n }\n } else if (wifi?.state === \"disconnected\") {\n update = {\n ...update,\n wifiConnected: false,\n wifiSsid: \"\",\n wifiLocalIp: \"\",\n }\n }\n if (hotspot?.state === \"enabled\") {\n update = {\n ...update,\n hotspotEnabled: true,\n hotspotSsid: hotspot.ssid,\n hotspotPassword: hotspot.password,\n hotspotGatewayIp: hotspot.localIp,\n }\n } else if (hotspot?.state === \"disabled\") {\n update = {\n ...update,\n hotspotEnabled: false,\n hotspotSsid: \"\",\n hotspotPassword: \"\",\n hotspotGatewayIp: \"\",\n }\n }\n return update\n}\n\n// Add helper methods to the module\nconst nativeGetGlassesStatus = NativeBluetoothSdkModule.getGlassesStatus.bind(\n NativeBluetoothSdkModule,\n) as () => MaybePromise<GlassesStatus>\nNativeBluetoothSdkModule.getGlassesStatus = function () {\n return Promise.resolve(nativeGetGlassesStatus())\n}\n\nconst nativeGetBluetoothStatus = NativeBluetoothSdkModule.getBluetoothStatus.bind(NativeBluetoothSdkModule) as () => MaybePromise<BluetoothStatus>\nNativeBluetoothSdkModule.getBluetoothStatus = function () {\n return Promise.resolve(nativeGetBluetoothStatus())\n}\n\nconst nativeGetDefaultDevice = NativeBluetoothSdkModule.getDefaultDevice.bind(\n NativeBluetoothSdkModule,\n) as () => MaybePromise<Device | null>\nNativeBluetoothSdkModule.getDefaultDevice = function () {\n return Promise.resolve(nativeGetDefaultDevice())\n}\n\nconst nativeSetMicState = NativeBluetoothSdkModule.setMicState.bind(NativeBluetoothSdkModule) as (\n enabled: boolean,\n useGlassesMic: boolean,\n bypassVad: boolean,\n sendTranscript: boolean,\n sendLc3Data: boolean,\n) => MaybePromise<void>\n\nconst nativeDisplayText = NativeBluetoothSdkModule.displayText.bind(NativeBluetoothSdkModule) as (\n text: string,\n x: number,\n y: number,\n size: number,\n) => MaybePromise<void>\n\nNativeBluetoothSdkModule.updateGlasses = function (values: Partial<GlassesStatus>) {\n return this.update(\"glasses\", adaptGlassesUpdateToNative(values))\n}\n\nNativeBluetoothSdkModule.updateBluetoothSettings = function (values: BluetoothSettingsUpdate) {\n return this.update(\"bluetooth\", values)\n}\n\nNativeBluetoothSdkModule.displayText = function (text: string, x?: number, y?: number, size?: number) {\n return Promise.resolve(nativeDisplayText(text, x ?? 0, y ?? 0, size ?? 24))\n}\n\nNativeBluetoothSdkModule.setBrightness = function (level: number, autoMode?: boolean | null) {\n return this.updateBluetoothSettings({\n ...(autoMode == null ? {} : {auto_brightness: autoMode}),\n brightness: level,\n })\n}\n\nNativeBluetoothSdkModule.setAutoBrightness = function (enabled: boolean) {\n return this.updateBluetoothSettings({auto_brightness: enabled})\n}\n\nNativeBluetoothSdkModule.setDashboardPosition = function (height: number, depth: number) {\n return this.updateBluetoothSettings({\n dashboard_height: height,\n dashboard_depth: depth,\n })\n}\n\nNativeBluetoothSdkModule.setDashboardMenu = function (items: DashboardMenuItem[]) {\n return this.updateBluetoothSettings({menu_apps: items.map(dashboardMenuItemToNative)})\n}\n\nNativeBluetoothSdkModule.setHeadUpAngle = function (angleDegrees: number) {\n return this.updateBluetoothSettings({head_up_angle: angleDegrees})\n}\n\nNativeBluetoothSdkModule.setScreenDisabled = function (disabled: boolean) {\n return this.updateBluetoothSettings({screen_disabled: disabled})\n}\n\nNativeBluetoothSdkModule.setButtonPhotoSettings = function (size: ButtonPhotoSize) {\n return this.updateBluetoothSettings({button_photo_size: size})\n}\n\nNativeBluetoothSdkModule.setButtonVideoRecordingSettings = function (width: number, height: number, frameRate: number) {\n return this.updateBluetoothSettings({\n button_video_width: width,\n button_video_height: height,\n button_video_fps: frameRate,\n })\n}\n\nNativeBluetoothSdkModule.setButtonCameraLed = function (enabled: boolean) {\n return this.updateBluetoothSettings({button_camera_led: enabled})\n}\n\nNativeBluetoothSdkModule.setButtonMaxRecordingTime = function (minutes: number) {\n return this.updateBluetoothSettings({button_max_recording_time: minutes})\n}\n\nNativeBluetoothSdkModule.setCameraFov = function (fov: CameraFov) {\n return this.updateBluetoothSettings({camera_fov: CAMERA_FOV_SETTINGS[fov]})\n}\n\nNativeBluetoothSdkModule.setMicState = function (\n enabled: boolean,\n useGlassesMic?: boolean,\n bypassVad?: boolean,\n sendTranscript?: boolean,\n sendLc3Data?: boolean,\n) {\n return Promise.resolve(\n nativeSetMicState(\n enabled,\n useGlassesMic ?? true,\n bypassVad ?? true,\n sendTranscript ?? false,\n sendLc3Data ?? false,\n ),\n )\n}\n\nNativeBluetoothSdkModule.setPreferredMic = function (preferredMic: MicPreference) {\n return this.updateBluetoothSettings({preferred_mic: preferredMic})\n}\n\nNativeBluetoothSdkModule.onGlassesStatus = function (callback: GlassesListener) {\n const subscription = this.addListener(\"glasses_status\", callback)\n return () => subscription.remove()\n}\n\nNativeBluetoothSdkModule.onBluetoothStatus = function (callback: BluetoothStatusListener) {\n const subscription = this.addListener(\"bluetooth_status\", callback)\n return () => subscription.remove()\n}\n\nconst nativeConnectDefault = NativeBluetoothSdkModule.connectDefault.bind(NativeBluetoothSdkModule)\nNativeBluetoothSdkModule.connectDefault = function (options?: ConnectOptions) {\n if (!options) {\n return nativeConnectDefault()\n }\n return this.connectDefaultWithOptions({...DEFAULT_CONNECT_OPTIONS, ...options})\n}\n\nNativeBluetoothSdkModule.connect = function (device: Device, options?: ConnectOptions) {\n return this.connectWithOptions(device, {...DEFAULT_CONNECT_OPTIONS, ...options})\n}\n\nNativeBluetoothSdkModule.scan = async function (\n modelOrOptions: DeviceModel | ScanOptions,\n options?: ScanModelOptions,\n) {\n const scanOptions = normalizeScanArgs(modelOrOptions, options)\n const timeoutMs = normalizeTimeoutMs(scanOptions.timeoutMs ?? scanOptions.timeout, DEFAULT_SCAN_TIMEOUT_MS)\n let latestResults: Device[] = []\n\n return new Promise<Device[]>((resolve, reject) => {\n let timeout: ReturnType<typeof setTimeout> | null = null\n let removeBluetoothListener = () => {}\n let settled = false\n let scanStarted = false\n\n const emitResults = (devices: Device[]) => {\n latestResults = devices\n scanOptions.onResults?.([...devices])\n }\n\n const cleanup = () => {\n if (timeout) {\n clearTimeout(timeout)\n }\n removeBluetoothListener()\n if (scanStarted) {\n void Promise.resolve(this.stopScan()).catch(() => undefined)\n }\n }\n\n const settle = (error?: Error) => {\n if (settled) {\n return\n }\n settled = true\n cleanup()\n if (error) {\n reject(error)\n } else {\n resolve([...latestResults])\n }\n }\n\n const handleBluetoothStatus = (status: Partial<BluetoothStatus>) => {\n emitResults(searchResultsForModel(status, scanOptions.model))\n }\n\n removeBluetoothListener = this.onBluetoothStatus(handleBluetoothStatus)\n emitResults([])\n\n timeout = setTimeout(() => settle(), timeoutMs)\n\n Promise.resolve(this.startScan(scanOptions.model))\n .then(() => {\n scanStarted = true\n return this.getBluetoothStatus()\n })\n .then(handleBluetoothStatus)\n .catch((error) => settle(error instanceof Error ? error : new Error(String(error))))\n })\n}\n\nexport default NativeBluetoothSdkModule\nexport const BluetoothSdk = NativeBluetoothSdkModule as BluetoothSdkPublicModule\n"]}
|
|
1
|
+
{"version":3,"file":"BluetoothSdkModule.js","sourceRoot":"","sources":["../../src/_private/BluetoothSdkModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,mBAAmB,EAAC,MAAM,MAAM,CAAA;AAsLtD,yDAAyD;AACzD,gGAAgG;AAChG,MAAM,wBAAwB,GAAG,mBAAmB,CAA2B,cAAc,CAAC,CAAA;AAE9F,MAAM,uBAAuB,GAA6B;IACxD,aAAa,EAAE,IAAI;IACnB,+BAA+B,EAAE,IAAI;CACtC,CAAA;AAED,MAAM,uBAAuB,GAAG,MAAM,CAAA;AAEtC,MAAM,mBAAmB,GAAwC;IAC/D,QA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MAAM,CAAC,KAAK,CAAC,CAAA;YACf,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAA;YAC7B,CAAC;QACH,CAAC,CAAA;QAED,MAAM,qBAAqB,GAAG,CAAC,MAAgC,EAAE,EAAE;YACjE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;gBACzC,OAAM;YACR,CAAC;YACD,WAAW,CAAC,qBAAqB,CAAC,MAAM,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,CAAA;QAC/D,CAAC,CAAA;QAED,uBAAuB,GAAG,IAAI,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,CAAA;QACvE,WAAW,CAAC,EAAE,CAAC,CAAA;QAEf,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,SAAS,CAAC,CAAA;QAE/C,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;aAC/C,IAAI,CAAC,GAAG,EAAE;YACT,WAAW,GAAG,IAAI,CAAA;YAClB,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAA;QAClC,CAAC,CAAC;aACD,IAAI,CAAC,qBAAqB,CAAC;aAC3B,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;IACxF,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,eAAe,wBAAwB,CAAA;AACvC,MAAM,CAAC,MAAM,YAAY,GAAG,wBAAoD,CAAA","sourcesContent":["import {NativeModule, requireNativeModule} from \"expo\"\n\nimport {\n BluetoothSettingsUpdate,\n BluetoothSdkPublicModule,\n BluetoothSdkModuleEvents,\n BluetoothStatus,\n ButtonPhotoSize,\n CameraFov,\n CameraFovSetting,\n ConnectOptions,\n DashboardMenuItem,\n Device,\n DeviceModel,\n GalleryMode,\n GlassesMediaVolumeGetResult,\n GlassesMediaVolumeSetResult,\n GlassesStatus,\n MicPreference,\n ObservableStoreCategory,\n PhotoCompression,\n PhotoSize,\n PublicBluetoothStatus,\n RgbLedAction,\n RgbLedColor,\n ScanModelOptions,\n ScanOptions,\n StreamKeepAliveRequest,\n StreamStartRequest,\n} from \"../BluetoothSdk.types\"\n\n/**\n * Private React Native native-module facade.\n *\n * This file intentionally lives under `_private` so the package root can expose\n * a small SDK surface while MentraOS uses its monorepo-only internal alias\n * during migration. Raw status getters/listeners stay here so React hooks can\n * shape native store snapshots before app code sees them.\n */\n\ntype GlassesListener = (changed: Partial<GlassesStatus>) => void\ntype BluetoothStatusListener = (changed: Partial<PublicBluetoothStatus>) => void\ntype MaybePromise<T> = T | Promise<T>\n\ndeclare class BluetoothSdkNativeModule extends NativeModule<BluetoothSdkModuleEvents> {\n // Observable Store Functions (native)\n getGlassesStatus(): Promise<GlassesStatus>\n getBluetoothStatus(): Promise<PublicBluetoothStatus>\n getDefaultDevice(): Promise<Device | null>\n update(category: ObservableStoreCategory, values: object): Promise<void>\n\n // Display Commands\n displayEvent(params: Record<string, unknown>): Promise<void>\n displayText(text: string, x?: number, y?: number, size?: number): Promise<void>\n clearDisplay(): Promise<void>\n\n // Connection Commands\n requestStatus(): Promise<void>\n connectDefault(options?: ConnectOptions): Promise<void>\n connectDefaultWithOptions(options: Required<ConnectOptions>): Promise<void>\n setDefaultDevice(device: Device | null): Promise<void>\n clearDefaultDevice(): Promise<void>\n startScan(model: DeviceModel): Promise<void>\n stopScan(): Promise<void>\n scan(options: ScanOptions): Promise<Device[]>\n scan(model: DeviceModel, options?: ScanModelOptions): Promise<Device[]>\n connect(device: Device, options?: ConnectOptions): Promise<void>\n connectWithOptions(device: Device, options: Required<ConnectOptions>): Promise<void>\n cancelConnectionAttempt(): Promise<void>\n connectDefaultController(): Promise<void>\n disconnectController(): Promise<void>\n connectSimulated(): Promise<void>\n disconnect(): Promise<void>\n forget(): Promise<void>\n forgetController(): Promise<void>\n showDashboard(): Promise<void>\n setBrightness(level: number, autoMode?: boolean | null): Promise<void>\n setAutoBrightness(enabled: boolean): Promise<void>\n setDashboardPosition(height: number, depth: number): Promise<void>\n setDashboardMenu(items: DashboardMenuItem[]): Promise<void>\n setHeadUpAngle(angleDegrees: number): Promise<void>\n setScreenDisabled(disabled: boolean): Promise<void>\n ping(): Promise<void>\n dbg1(): Promise<void>\n dbg2(): Promise<void>\n\n // Incident Reporting\n sendIncidentId(incidentId: string, apiBaseUrl?: string | null): Promise<void>\n\n // WiFi Commands\n requestWifiScan(): Promise<void>\n sendWifiCredentials(ssid: string, password: string): Promise<void>\n forgetWifiNetwork(ssid: string): Promise<void>\n setHotspotState(enabled: boolean): Promise<void>\n /** Logs current WiFi frequency (MHz) and 5 GHz band to Android logcat. */\n logCurrentWifiFrequency(): Promise<void>\n\n // Gallery Commands\n setGalleryMode(mode: GalleryMode): Promise<void>\n setButtonPhotoSettings(size: ButtonPhotoSize): Promise<void>\n setButtonVideoRecordingSettings(width: number, height: number, frameRate: number): Promise<void>\n setButtonCameraLed(enabled: boolean): Promise<void>\n setButtonMaxRecordingTime(minutes: number): Promise<void>\n setCameraFov(fov: CameraFov): Promise<void>\n queryGalleryStatus(): Promise<void>\n requestPhoto(\n requestId: string,\n appId: string,\n size: PhotoSize,\n webhookUrl: string | null,\n authToken: string | null,\n compress: PhotoCompression,\n sound: boolean,\n ): Promise<void>\n\n // OTA Commands\n sendOtaStart(): Promise<void>\n sendOtaQueryStatus(): Promise<void>\n\n // Version Info Commands\n requestVersionInfo(): Promise<void>\n\n // Video Recording Commands\n startVideoRecording(requestId: string, save: boolean, sound: boolean): Promise<void>\n stopVideoRecording(requestId: string): Promise<void>\n\n // Stream Commands\n startStream(params: StreamStartRequest): Promise<void>\n stopStream(): Promise<void>\n keepStreamAlive(params: StreamKeepAliveRequest): Promise<void>\n\n // Microphone Commands\n setMicState(\n enabled: boolean,\n useGlassesMic?: boolean,\n bypassVad?: boolean,\n sendTranscript?: boolean,\n sendLc3Data?: boolean,\n ): Promise<void>\n setPreferredMic(preferredMic: MicPreference): Promise<void>\n restartTranscriber(): Promise<void>\n\n // Audio Playback Monitoring\n // Notify native side when our app starts/stops playing audio\n // Used to suspend LC3 mic during audio playback to avoid MCU overload\n setOwnAppAudioPlaying(playing: boolean): Promise<void>\n\n /** Mentra Live only: K900 `cs_getvol` / `sr_getvol`. */\n getGlassesMediaVolume(): Promise<GlassesMediaVolumeGetResult>\n /** Mentra Live only: K900 `cs_vol` / `sr_vol`; level clamped 0–15 on native. */\n setGlassesMediaVolume(level: number): Promise<GlassesMediaVolumeSetResult>\n\n // RGB LED Control\n rgbLedControl(\n requestId: string,\n packageName: string | null,\n action: RgbLedAction,\n color: RgbLedColor | null,\n onDurationMs: number,\n offDurationMs: number,\n count: number,\n ): Promise<void>\n\n // STT Commands\n setSttModelDetails(path: string, languageCode: string): Promise<void>\n getSttModelPath(): Promise<string>\n checkSttModelAvailable(): Promise<boolean>\n validateSttModel(path: string): Promise<boolean>\n extractTarBz2(sourcePath: string, destinationPath: string): Promise<boolean>\n\n // Helper methods for type-safe observable store access\n updateGlasses(values: Partial<GlassesStatus>): Promise<void>\n updateBluetoothSettings(values: BluetoothSettingsUpdate): Promise<void>\n onGlassesStatus(callback: GlassesListener): () => void\n onBluetoothStatus(callback: BluetoothStatusListener): () => void\n\n // Process resident-set-size in MB. iOS-only; Android stub returns 0.\n getMemoryMB(): number\n}\n\nexport type BluetoothSdkInternalModule = BluetoothSdkNativeModule\n\n// This call loads the native module object from the JSI.\n// NativeModule<BluetoothSdkModuleEvents> already extends EventEmitter<BluetoothSdkModuleEvents>\nconst NativeBluetoothSdkModule = requireNativeModule<BluetoothSdkNativeModule>(\"BluetoothSdk\")\n\nconst DEFAULT_CONNECT_OPTIONS: Required<ConnectOptions> = {\n saveAsDefault: true,\n cancelExistingConnectionAttempt: true,\n}\n\nconst DEFAULT_SCAN_TIMEOUT_MS = 15_000\n\nconst CAMERA_FOV_SETTINGS: Record<CameraFov, CameraFovSetting> = {\n standard: {fov: 118, roiPosition: 0},\n wide: {fov: 118, roiPosition: 0},\n}\n\nfunction searchResultsForModel(status: Partial<PublicBluetoothStatus>, model: DeviceModel): Device[] {\n return status.searchResults?.filter((device) => device.model === model) ?? []\n}\n\nfunction normalizeScanArgs(modelOrOptions: DeviceModel | ScanOptions, options?: ScanModelOptions): ScanOptions {\n if (typeof modelOrOptions === \"string\") {\n return {model: modelOrOptions, ...options}\n }\n return modelOrOptions\n}\n\nfunction normalizeTimeoutMs(timeoutMs: number | undefined, defaultTimeoutMs: number): number {\n return typeof timeoutMs === \"number\" && Number.isFinite(timeoutMs) && timeoutMs > 0 ? timeoutMs : defaultTimeoutMs\n}\n\nfunction dashboardMenuItemToNative(item: DashboardMenuItem): Record<string, unknown> {\n return {\n ...(item.values ?? {}),\n title: item.title,\n packageName: item.packageName,\n }\n}\n\nfunction adaptConnectionStatusToNative(connection: GlassesStatus[\"connection\"]): Record<string, unknown> {\n switch (connection.state) {\n case \"connected\":\n return {connectionState: \"CONNECTED\", connected: true, fullyBooted: connection.fullyBooted}\n case \"scanning\":\n return {connectionState: \"SCANNING\", connected: false, fullyBooted: false}\n case \"connecting\":\n return {connectionState: \"CONNECTING\", connected: false, fullyBooted: false}\n case \"bonding\":\n return {connectionState: \"BONDING\", connected: false, fullyBooted: false}\n case \"disconnected\":\n return {connectionState: \"DISCONNECTED\", connected: false, fullyBooted: false}\n }\n}\n\nfunction adaptGlassesUpdateToNative(values: Partial<GlassesStatus>): Record<string, unknown> {\n const {wifi, hotspot, connection, ...rest} = values\n let update: Record<string, unknown> = {...rest}\n if (connection) {\n update = {\n ...update,\n ...adaptConnectionStatusToNative(connection),\n }\n }\n if (wifi?.state === \"connected\") {\n update = {\n ...update,\n wifiConnected: true,\n wifiSsid: wifi.ssid,\n wifiLocalIp: wifi.localIp ?? \"\",\n }\n } else if (wifi?.state === \"disconnected\") {\n update = {\n ...update,\n wifiConnected: false,\n wifiSsid: \"\",\n wifiLocalIp: \"\",\n }\n }\n if (hotspot?.state === \"enabled\") {\n update = {\n ...update,\n hotspotEnabled: true,\n hotspotSsid: hotspot.ssid,\n hotspotPassword: hotspot.password,\n hotspotGatewayIp: hotspot.localIp,\n }\n } else if (hotspot?.state === \"disabled\") {\n update = {\n ...update,\n hotspotEnabled: false,\n hotspotSsid: \"\",\n hotspotPassword: \"\",\n hotspotGatewayIp: \"\",\n }\n }\n return update\n}\n\n// Add helper methods to the module\nconst nativeGetGlassesStatus = NativeBluetoothSdkModule.getGlassesStatus.bind(\n NativeBluetoothSdkModule,\n) as () => MaybePromise<GlassesStatus>\nNativeBluetoothSdkModule.getGlassesStatus = function () {\n return Promise.resolve(nativeGetGlassesStatus())\n}\n\nconst nativeGetBluetoothStatus = NativeBluetoothSdkModule.getBluetoothStatus.bind(NativeBluetoothSdkModule) as () => MaybePromise<BluetoothStatus>\nNativeBluetoothSdkModule.getBluetoothStatus = function () {\n return Promise.resolve(nativeGetBluetoothStatus())\n}\n\nconst nativeGetDefaultDevice = NativeBluetoothSdkModule.getDefaultDevice.bind(\n NativeBluetoothSdkModule,\n) as () => MaybePromise<Device | null>\nNativeBluetoothSdkModule.getDefaultDevice = function () {\n return Promise.resolve(nativeGetDefaultDevice())\n}\n\nconst nativeSetMicState = NativeBluetoothSdkModule.setMicState.bind(NativeBluetoothSdkModule) as (\n enabled: boolean,\n useGlassesMic: boolean,\n bypassVad: boolean,\n sendTranscript: boolean,\n sendLc3Data: boolean,\n) => MaybePromise<void>\n\nconst nativeDisplayText = NativeBluetoothSdkModule.displayText.bind(NativeBluetoothSdkModule) as (\n text: string,\n x: number,\n y: number,\n size: number,\n) => MaybePromise<void>\n\nNativeBluetoothSdkModule.updateGlasses = function (values: Partial<GlassesStatus>) {\n return this.update(\"glasses\", adaptGlassesUpdateToNative(values))\n}\n\nNativeBluetoothSdkModule.updateBluetoothSettings = function (values: BluetoothSettingsUpdate) {\n return this.update(\"bluetooth\", values)\n}\n\nNativeBluetoothSdkModule.displayText = function (text: string, x?: number, y?: number, size?: number) {\n return Promise.resolve(nativeDisplayText(text, x ?? 0, y ?? 0, size ?? 24))\n}\n\nNativeBluetoothSdkModule.setBrightness = function (level: number, autoMode?: boolean | null) {\n return this.updateBluetoothSettings({\n ...(autoMode == null ? {} : {auto_brightness: autoMode}),\n brightness: level,\n })\n}\n\nNativeBluetoothSdkModule.setAutoBrightness = function (enabled: boolean) {\n return this.updateBluetoothSettings({auto_brightness: enabled})\n}\n\nNativeBluetoothSdkModule.setDashboardPosition = function (height: number, depth: number) {\n return this.updateBluetoothSettings({\n dashboard_height: height,\n dashboard_depth: depth,\n })\n}\n\nNativeBluetoothSdkModule.setDashboardMenu = function (items: DashboardMenuItem[]) {\n return this.updateBluetoothSettings({menu_apps: items.map(dashboardMenuItemToNative)})\n}\n\nNativeBluetoothSdkModule.setHeadUpAngle = function (angleDegrees: number) {\n return this.updateBluetoothSettings({head_up_angle: angleDegrees})\n}\n\nNativeBluetoothSdkModule.setScreenDisabled = function (disabled: boolean) {\n return this.updateBluetoothSettings({screen_disabled: disabled})\n}\n\nNativeBluetoothSdkModule.setButtonPhotoSettings = function (size: ButtonPhotoSize) {\n return this.updateBluetoothSettings({button_photo_size: size})\n}\n\nNativeBluetoothSdkModule.setButtonVideoRecordingSettings = function (width: number, height: number, frameRate: number) {\n return this.updateBluetoothSettings({\n button_video_width: width,\n button_video_height: height,\n button_video_fps: frameRate,\n })\n}\n\nNativeBluetoothSdkModule.setButtonCameraLed = function (enabled: boolean) {\n return this.updateBluetoothSettings({button_camera_led: enabled})\n}\n\nNativeBluetoothSdkModule.setButtonMaxRecordingTime = function (minutes: number) {\n return this.updateBluetoothSettings({button_max_recording_time: minutes})\n}\n\nNativeBluetoothSdkModule.setCameraFov = function (fov: CameraFov) {\n return this.updateBluetoothSettings({camera_fov: CAMERA_FOV_SETTINGS[fov]})\n}\n\nNativeBluetoothSdkModule.setMicState = function (\n enabled: boolean,\n useGlassesMic?: boolean,\n bypassVad?: boolean,\n sendTranscript?: boolean,\n sendLc3Data?: boolean,\n) {\n return Promise.resolve(\n nativeSetMicState(\n enabled,\n useGlassesMic ?? true,\n bypassVad ?? true,\n sendTranscript ?? false,\n sendLc3Data ?? false,\n ),\n )\n}\n\nNativeBluetoothSdkModule.setPreferredMic = function (preferredMic: MicPreference) {\n return this.updateBluetoothSettings({preferred_mic: preferredMic})\n}\n\nNativeBluetoothSdkModule.onGlassesStatus = function (callback: GlassesListener) {\n const subscription = this.addListener(\"glasses_status\", callback)\n return () => subscription.remove()\n}\n\nNativeBluetoothSdkModule.onBluetoothStatus = function (callback: BluetoothStatusListener) {\n const subscription = this.addListener(\"bluetooth_status\", callback)\n return () => subscription.remove()\n}\n\nconst nativeConnectDefault = NativeBluetoothSdkModule.connectDefault.bind(NativeBluetoothSdkModule)\nNativeBluetoothSdkModule.connectDefault = function (options?: ConnectOptions) {\n if (!options) {\n return nativeConnectDefault()\n }\n return this.connectDefaultWithOptions({...DEFAULT_CONNECT_OPTIONS, ...options})\n}\n\nNativeBluetoothSdkModule.connect = function (device: Device, options?: ConnectOptions) {\n return this.connectWithOptions(device, {...DEFAULT_CONNECT_OPTIONS, ...options})\n}\n\nNativeBluetoothSdkModule.scan = async function (\n modelOrOptions: DeviceModel | ScanOptions,\n options?: ScanModelOptions,\n) {\n const scanOptions = normalizeScanArgs(modelOrOptions, options)\n const timeoutMs = normalizeTimeoutMs(scanOptions.timeoutMs ?? scanOptions.timeout, DEFAULT_SCAN_TIMEOUT_MS)\n let latestResults: Device[] = []\n\n return new Promise<Device[]>((resolve, reject) => {\n let timeout: ReturnType<typeof setTimeout> | null = null\n let removeBluetoothListener = () => {}\n let settled = false\n let scanStarted = false\n\n const emitResults = (devices: Device[]) => {\n latestResults = devices\n scanOptions.onResults?.([...devices])\n }\n\n const cleanup = () => {\n if (timeout) {\n clearTimeout(timeout)\n }\n removeBluetoothListener()\n if (scanStarted) {\n void Promise.resolve(this.stopScan()).catch(() => undefined)\n }\n }\n\n const settle = (error?: Error) => {\n if (settled) {\n return\n }\n settled = true\n cleanup()\n if (error) {\n reject(error)\n } else {\n resolve([...latestResults])\n }\n }\n\n const handleBluetoothStatus = (status: Partial<BluetoothStatus>) => {\n if (!Array.isArray(status.searchResults)) {\n return\n }\n emitResults(searchResultsForModel(status, scanOptions.model))\n }\n\n removeBluetoothListener = this.onBluetoothStatus(handleBluetoothStatus)\n emitResults([])\n\n timeout = setTimeout(() => settle(), timeoutMs)\n\n Promise.resolve(this.startScan(scanOptions.model))\n .then(() => {\n scanStarted = true\n return this.getBluetoothStatus()\n })\n .then(handleBluetoothStatus)\n .catch((error) => settle(error instanceof Error ? error : new Error(String(error))))\n })\n}\n\nexport default NativeBluetoothSdkModule\nexport const BluetoothSdk = NativeBluetoothSdkModule as BluetoothSdkPublicModule\n"]}
|
|
@@ -527,13 +527,13 @@ public class BluetoothSdkModule: Module, MentraBluetoothSDKDelegate {
|
|
|
527
527
|
}
|
|
528
528
|
|
|
529
529
|
@MainActor
|
|
530
|
-
public func mentraBluetoothSDK(_: MentraBluetoothSDK,
|
|
531
|
-
sendEvent("glasses_status",
|
|
530
|
+
public func mentraBluetoothSDK(_ sdk: MentraBluetoothSDK, didUpdateGlasses _: GlassesRuntimeState) {
|
|
531
|
+
sendEvent("glasses_status", sdk.glassesStatus.dictionary)
|
|
532
532
|
}
|
|
533
533
|
|
|
534
534
|
@MainActor
|
|
535
|
-
public func mentraBluetoothSDK(_: MentraBluetoothSDK,
|
|
536
|
-
sendEvent("bluetooth_status",
|
|
535
|
+
public func mentraBluetoothSDK(_ sdk: MentraBluetoothSDK, didUpdateSdkState _: PhoneSdkRuntimeState) {
|
|
536
|
+
sendEvent("bluetooth_status", sdk.bluetoothStatus.values)
|
|
537
537
|
}
|
|
538
538
|
|
|
539
539
|
@MainActor
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
public enum MicPreference: String {
|
|
4
|
+
case auto
|
|
5
|
+
case phone
|
|
6
|
+
case glasses
|
|
7
|
+
case bluetooth
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
public struct LocalTranscriptionEvent: CustomStringConvertible {
|
|
11
|
+
public let text: String
|
|
12
|
+
public let isFinal: Bool
|
|
13
|
+
public let values: [String: Any]
|
|
14
|
+
|
|
15
|
+
public init(text: String, isFinal: Bool, values: [String: Any]) {
|
|
16
|
+
self.text = text
|
|
17
|
+
self.isFinal = isFinal
|
|
18
|
+
self.values = values
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public var description: String {
|
|
22
|
+
"LocalTranscriptionEvent(text: \(text), isFinal: \(isFinal))"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public struct MicPcmEvent: CustomStringConvertible {
|
|
27
|
+
public static let sampleRate = 16_000
|
|
28
|
+
public static let bitsPerSample = 16
|
|
29
|
+
public static let channels = 1
|
|
30
|
+
public static let encoding = "pcm_s16le"
|
|
31
|
+
|
|
32
|
+
public let pcm: Data
|
|
33
|
+
public let sampleRate: Int
|
|
34
|
+
public let bitsPerSample: Int
|
|
35
|
+
public let channels: Int
|
|
36
|
+
public let encoding: String
|
|
37
|
+
public let vadGated: Bool
|
|
38
|
+
public let values: [String: Any]
|
|
39
|
+
|
|
40
|
+
public init(values: [String: Any]) {
|
|
41
|
+
let pcm = values["pcm"] as? Data ?? Data()
|
|
42
|
+
let sampleRate = intValue(values["sampleRate"]) ?? Self.sampleRate
|
|
43
|
+
let bitsPerSample = intValue(values["bitsPerSample"]) ?? Self.bitsPerSample
|
|
44
|
+
let channels = intValue(values["channels"]) ?? Self.channels
|
|
45
|
+
let encoding = values["encoding"] as? String ?? Self.encoding
|
|
46
|
+
let vadGated = boolValue(values, "vadGated") ?? false
|
|
47
|
+
|
|
48
|
+
var normalized = values
|
|
49
|
+
normalized["type"] = "mic_pcm"
|
|
50
|
+
normalized["pcm"] = pcm
|
|
51
|
+
normalized["sampleRate"] = sampleRate
|
|
52
|
+
normalized["bitsPerSample"] = bitsPerSample
|
|
53
|
+
normalized["channels"] = channels
|
|
54
|
+
normalized["encoding"] = encoding
|
|
55
|
+
normalized["vadGated"] = vadGated
|
|
56
|
+
|
|
57
|
+
self.pcm = pcm
|
|
58
|
+
self.sampleRate = sampleRate
|
|
59
|
+
self.bitsPerSample = bitsPerSample
|
|
60
|
+
self.channels = channels
|
|
61
|
+
self.encoding = encoding
|
|
62
|
+
self.vadGated = vadGated
|
|
63
|
+
self.values = normalized
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
public var description: String {
|
|
67
|
+
"MicPcmEvent(bytes: \(pcm.count), sampleRate: \(sampleRate), bitsPerSample: \(bitsPerSample), channels: \(channels), encoding: \(encoding), vadGated: \(vadGated))"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
public struct MicLc3Event: CustomStringConvertible {
|
|
72
|
+
public static let sampleRate = 16_000
|
|
73
|
+
public static let channels = 1
|
|
74
|
+
public static let encoding = "lc3"
|
|
75
|
+
public static let frameDurationMs = 10
|
|
76
|
+
public static let defaultFrameSizeBytes = 60
|
|
77
|
+
|
|
78
|
+
public let lc3: Data
|
|
79
|
+
public let sampleRate: Int
|
|
80
|
+
public let channels: Int
|
|
81
|
+
public let encoding: String
|
|
82
|
+
public let frameDurationMs: Int
|
|
83
|
+
public let frameSizeBytes: Int
|
|
84
|
+
public let bitrate: Int
|
|
85
|
+
public let packetizedFromGlasses: Bool
|
|
86
|
+
public let vadGated: Bool
|
|
87
|
+
public let values: [String: Any]
|
|
88
|
+
|
|
89
|
+
public init(values: [String: Any]) {
|
|
90
|
+
let lc3 = values["lc3"] as? Data ?? Data()
|
|
91
|
+
let sampleRate = intValue(values["sampleRate"]) ?? Self.sampleRate
|
|
92
|
+
let channels = intValue(values["channels"]) ?? Self.channels
|
|
93
|
+
let encoding = values["encoding"] as? String ?? Self.encoding
|
|
94
|
+
let frameDurationMs = intValue(values["frameDurationMs"]) ?? Self.frameDurationMs
|
|
95
|
+
let frameSizeBytes = intValue(values["frameSizeBytes"]) ?? Self.defaultFrameSizeBytes
|
|
96
|
+
let bitrate = intValue(values["bitrate"]) ?? frameSizeBytes * 8 * (1000 / frameDurationMs)
|
|
97
|
+
let packetizedFromGlasses = boolValue(values, "packetizedFromGlasses") ?? false
|
|
98
|
+
let vadGated = boolValue(values, "vadGated") ?? false
|
|
99
|
+
|
|
100
|
+
var normalized = values
|
|
101
|
+
normalized["type"] = "mic_lc3"
|
|
102
|
+
normalized["lc3"] = lc3
|
|
103
|
+
normalized["sampleRate"] = sampleRate
|
|
104
|
+
normalized["channels"] = channels
|
|
105
|
+
normalized["encoding"] = encoding
|
|
106
|
+
normalized["frameDurationMs"] = frameDurationMs
|
|
107
|
+
normalized["frameSizeBytes"] = frameSizeBytes
|
|
108
|
+
normalized["bitrate"] = bitrate
|
|
109
|
+
normalized["packetizedFromGlasses"] = packetizedFromGlasses
|
|
110
|
+
normalized["vadGated"] = vadGated
|
|
111
|
+
|
|
112
|
+
self.lc3 = lc3
|
|
113
|
+
self.sampleRate = sampleRate
|
|
114
|
+
self.channels = channels
|
|
115
|
+
self.encoding = encoding
|
|
116
|
+
self.frameDurationMs = frameDurationMs
|
|
117
|
+
self.frameSizeBytes = frameSizeBytes
|
|
118
|
+
self.bitrate = bitrate
|
|
119
|
+
self.packetizedFromGlasses = packetizedFromGlasses
|
|
120
|
+
self.vadGated = vadGated
|
|
121
|
+
self.values = normalized
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
public var description: String {
|
|
125
|
+
"MicLc3Event(bytes: \(lc3.count), sampleRate: \(sampleRate), channels: \(channels), frameDurationMs: \(frameDurationMs), frameSizeBytes: \(frameSizeBytes), bitrate: \(bitrate), packetizedFromGlasses: \(packetizedFromGlasses), vadGated: \(vadGated))"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
public struct GlassesMediaVolumeGetResult: CustomStringConvertible {
|
|
130
|
+
public let level: Int?
|
|
131
|
+
public let statusCode: Int?
|
|
132
|
+
public let values: [String: Any]
|
|
133
|
+
|
|
134
|
+
public init(values: [String: Any]) {
|
|
135
|
+
self.level = intValue(values["level"])
|
|
136
|
+
self.statusCode = intValue(values["statusCode"])
|
|
137
|
+
self.values = values
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
public var description: String {
|
|
141
|
+
let levelText = level.map(String.init) ?? "unknown"
|
|
142
|
+
let statusCodeText = statusCode.map(String.init) ?? "unknown"
|
|
143
|
+
return "GlassesMediaVolumeGetResult(level: \(levelText), statusCode: \(statusCodeText))"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
public struct GlassesMediaVolumeSetResult: CustomStringConvertible {
|
|
148
|
+
public let statusCode: Int?
|
|
149
|
+
public let values: [String: Any]
|
|
150
|
+
|
|
151
|
+
public init(values: [String: Any]) {
|
|
152
|
+
self.statusCode = intValue(values["statusCode"])
|
|
153
|
+
self.values = values
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
public var description: String {
|
|
157
|
+
"GlassesMediaVolumeSetResult(statusCode: \(statusCode.map(String.init) ?? "unknown"))"
|
|
158
|
+
}
|
|
159
|
+
}
|