* @brief Returns the BLE driver that owns the live connection, or the UI-config instance when * none is open. Project mode connects through a per-source driver, so GATT operations * (writes, service/characteristic selection) must resolve this instance, not the UI one. */
| 364 | * (writes, service/characteristic selection) must resolve this instance, not the UI one. |
| 365 | */ |
| 366 | IO::Drivers::BluetoothLE* IO::ConnectionManager::connectedBluetoothLE() const noexcept |
| 367 | { |
| 368 | for (const auto& [deviceId, dm] : m_devices) { |
| 369 | if (!dm) |
| 370 | continue; |
| 371 | |
| 372 | auto* ble = qobject_cast<IO::Drivers::BluetoothLE*>(dm->driver()); |
| 373 | if (ble && ble->isOpen()) |
| 374 | return ble; |
| 375 | } |
| 376 | |
| 377 | return m_bluetoothLEUi.get(); |
| 378 | } |
| 379 | |
| 380 | #ifdef BUILD_COMMERCIAL |
| 381 | /** |
no test coverage detected