# `bluetooth`

Bluetooth, from BlueZ, followed live: the first adapter, the devices
paired with it, and the devices in range while a pairing page reads
them.

| Field | Type | |
| --- | --- | --- |
| `powered` | `bool rw` | The adapter is on. Writable. |
| `devices` | `[BluetoothDevice]` | Paired devices, keyed by `address`. |
| `available` | `bool` | BlueZ answers and has an adapter: false without them (or without a system bus), so a menu can hide what cannot work. |
| `nearby` | `[BluetoothDevice]` | Unpaired devices in range that have a name, keyed by `address`, found by discovery. Discovery runs only while a visible reader reads them (a pairing page that is open). |
| `scanning` | `bool` | The adapter is discovering devices, for `nearby` or for another program. |

| Event | |
| --- | --- |
| `on bluetooth.failed(address: text, error: text)` | Connecting, disconnecting, pairing or forgetting a device failed (out of range, turned off, timed out, or the service not running): `on bluetooth.failed(address, error) { … }`. |
