I made this to understand the bluetooth streaming and websocket implementation in the Omi app. Then realized this is a pretty good point to push it since its basic enough that someone else may find it useful. Moving forawrd I want to implement the same or better memory features as in the Omi app, and definitely better overall context handling with a better backend. Maybe wakeword etc. Wainting for my dev kit 2 honestly.
Anyway, to go from Friend to Friend-lite, the steps are:
- Modified main.dart to have bluetooth connection page
- Modified android manifest to include bluetooth permissions
- Added flutter_blue_plus and permission_handler dependencies
- Created bluetooth_page.dart to handle bluetooth connection and scanning (_checkBluetoothPermission, _startScan, _connectToDevice)
- Update bluetooth_page.dart within lib/ to handle the actual streaming of data. This also handles the charactaristic, which is basically services defined by a bluetooth device to describe the data that can be streamed. (_startAudioStreaming)
- Created the websocket server within backend/main.py along with the pyproject.toml file. Implement the websocket and opus decoding using opuslib. First 3 bytes are metadata packets for the rest of the data.
- Websocket kept disconnecting, implement reconnect.