Communication
Overview
The SDK handles the communication functionality via the M2GlassesService (accessed from Evs.glassesService).
The communication with the glasses is performed over BLE 4.2 and above, whereas BLE 5 is recommended to achieve better performance and throughput.
The glasses are connectable using GATT over BLE protocol whereas the glasses act as a BLE peripheral device.
Connection States
The glasses connection follows this state machine:
┌──────────────┐
│ BluetoothOff │
└──────┬───────┘
│ Bluetooth enabled
▼
┌──────────┐ connect() ┌──────────────┐
│ Failed │◄─────────────│ Disconnected │
└──────────┘ error └──────┬───────┘
│ │ connect()
│ connect() ▼
└──────────────────►┌──────────────┐
│ Connecting │
└──────┬───────┘
│ BLE link established
▼
┌──────────────┐
│ Connected │
└──────┬───────┘
│ handshake + certificate OK
▼
┌──────────────┐
│ Ready │
└──────────────┘
The Ready state indicates the glasses are fully connected and the SDK is ready for screen rendering and service calls. Register for state changes via IM2GlassesConnectionEvents.
Configuring Maverick AI
The SDK handles all communication with the glasses through Evs.glassesService.
The glasses are discoverable when they are powered on, if no other device is currently connected to them.
Stock UI
The quickest way to get started is using the SDK's built-in scanning and configuration UI:
Scanning with M2BLEScanner
For a custom scan experience, use M2BLEScanner which handles platform-specific BLE APIs and filters for Maverick AI devices automatically:
Native BLE Scanning
If you prefer to use platform BLE APIs directly, scan for devices advertising the Maverick AI GATT service UUID:
val serviceUuid = ParcelUuid(UUID.fromString("e73f41ea-45e9-f9aa-514b-fa5349b08e50"))
val filter = ScanFilter.Builder().setServiceUuid(serviceUuid).build()
val settings = ScanSettings.Builder()
.setScanMode(ScanSettings.SCAN_MODE_BALANCED)
.build()
bluetoothLeScanner.startScan(listOf(filter), settings, scanCallback)
The glasses Bluetooth name format is: EV[GLASSES_NUMBER], for example: EV0080.
Connecting
Once you have a device (from M2BLEScanner or native scanning), configure the SDK with its address and name, then connect:
The SDK will maintain the connection until Evs.glassesService.disconnect() is called.
Persistent Configuration
The SDK persists the configured device address. On subsequent launches you can reconnect without re-scanning:
BLE Permissions
See Starting Application Development for the full list of required BLE permissions for Android and iOS.
See Also