> Bluetooth

As of the release of AsteroidOS Alpha 1.0, Bluetooth capabilities are only available on dory. An app named AsteroidOSSync can be downloaded on Android to synchronize data from a phone to an AsteroidOS watch. Several profiles are already coded: Notifications, Weather, Music and Battery, more could come in the future.

On the phone, AsteroidOSSync uses the SweetBlue library to access the Bluetooth Low Energy capabilities of Bluedroid as a central device. It scans for watches and implements the client part of the aforementioned profiles.

On the watch, data are received by a BCM20715 BT chip from Broadcom, this chip needs a proprietary firmware which is uploaded by the patchram systemd service. Once the firmware is uploaded an hci0 interface is created and can be set up with hciconfig.

The Linux Kernel can then receive BLE payloads. A newer Bluetooth subsystem (4.1) has been backported to provide newer MGMT API functionalities needed by the userspace (e.g: DBus advertisement). This MGMT API is only used by the BlueZ5’s bluetoothd daemon which exposes various DBus abstraction API. Bluetoothd also had to be patched to expose more complete advertisement payloads.

Simple and common interactions with the bluetoothd’s DBus API like checking for the powered/connected status are implemented in org.asteroid.utils.BluetoothStatus of qml-asteroid. This class is for example used in asteroid-launcher, asteroid-music and asteroid-settings.

More complex interactions with bluetoothd are implemented in asteroid-btsyncd, a user-space daemon running as a standard user (ceres) and acting as a DBus multiplexer between BlueZ and the apps. On the BlueZ side it registers BLE Services, Characteristics and Advertisement payloads. On the user side, it exposes specific API for each and every usage needed. For example, it communicates with asteroid-music with to the MPRIS API, with asteroid-launcher based on the FreeDesktop’s notification API or with asteroid-weather thanks to data saved in the dconf “register”.

About the author: kido