Download examples/bluetooth/docs/hardware-integration.md from Anirudh1950/MentraOS: direct link, hf CLI and curl.
- Browser
- Download file 3.63 kB
-
https://huggingface.co/Anirudh1950/MentraOS/resolve/main/examples/bluetooth/docs/hardware-integration.md
- Command line
-
hf download hf://Anirudh1950/MentraOS/examples/bluetooth/docs/hardware-integration.md
-
curl -L -o hardware-integration.md https://huggingface.co/Anirudh1950/MentraOS/resolve/main/examples/bluetooth/docs/hardware-integration.md
Hardware Integration Notes
The SDK presents a common native API over multiple glasses models. Capabilities differ by model and firmware, so apps should treat advanced features as optional.
Recommended Flow
- Ask the user which glasses model they are pairing.
- Call
scan()for that model. - Present typed discovered devices from the progressive scan results.
- Connect using the discovered device or default-device helper.
- Read grouped runtime state, firmware fields, and capability-related status before enabling advanced features.
- Keep app UI derived from SDK status rather than from command success alone.
Android:
val devices = mutableListOf<Device>()
sdk.scan(DeviceModel.MENTRA_LIVE, timeoutMs = 10_000) { nextDevices ->
devices.clear()
devices.addAll(nextDevices)
renderDevicePicker(nextDevices)
}
sdk.connect(chooseDevice(devices))
iOS:
var devices: [Device] = []
try sdk.scan(model: .mentraLive, timeout: 10) { nextDevices in
devices = nextDevices
renderDevicePicker(nextDevices)
}
try sdk.connect(to: chooseDevice(devices))
React Native:
import {DeviceModels} from '@mentra/bluetooth-sdk';
const devices = await BluetoothSdk.scan(DeviceModels.MentraLive, {
timeoutMs: 10_000,
onResults: (nextDevices) => renderDevicePicker(nextDevices),
});
await BluetoothSdk.connect(await chooseDevice(devices));
In these examples, the scan callback is the progressive UI path and the final returned list is the completion/control-flow path. Keep picker rendering in the callback; keep final selection or fallback behavior after scan completion.
In multi-device environments, keep the picker explicit. Do not auto-connect to the first scan result; let the user choose the glasses they expect.
Capability Areas
- Display: text, dashboard, brightness, head-up angle, and screen enable/disable commands.
- Input: button, touch, head-up, and switch events.
- Audio: PCM, LC3, audio pairing, preferred microphone, and local transcription.
- Camera: photo, gallery, video recording, and streaming.
- Network: Wi-Fi scan, credentials, and hotspot state.
- Maintenance: version info, diagnostics, and reconnect/recovery flows.
Model Differences
Treat each advanced feature as optional. Your app should degrade gracefully if a model does not support camera, Wi-Fi, display batching, local transcription, streaming, RGB LEDs, or controller pairing.
| Model | Display | Camera | Microphone | Speaker | Primary strengths |
|---|---|---|---|---|---|
| Mentra Live | No | Yes | Yes | Yes | Camera, microphone, speaker, Wi-Fi, streaming, phone-connected workflows |
Mentra Live uses negotiated BLE wire capabilities (wire_caps) for K900 length endianness and optional binary transport. Apps only need a current SDK version; see Mentra Live BLE Wire Protocol Notes.
| G2 | Yes | No | Yes | No | Display and glanceable UI workflows |
Treat unsupported operations as recoverable SDK errors and keep UI state aligned with the latest status callback.
Connection Resilience
- Subscribe to status callbacks before connecting.
- Retry scans manually from the UI instead of scanning forever in the background.
- On mobile OS background transitions, expect Bluetooth behavior to vary by platform.
- Reconcile command failures with the latest status snapshot before showing destructive UI.
- Provide a visible "forget device" path that clears both the SDK default device and any app-persisted default-device record.