* @brief Get current Bluetooth LE configuration */
| 479 | * @brief Get current Bluetooth LE configuration |
| 480 | */ |
| 481 | API::CommandResponse API::Handlers::BluetoothLEHandler::getConfiguration(const QString& id, |
| 482 | const QJsonObject& params) |
| 483 | { |
| 484 | Q_UNUSED(params) |
| 485 | |
| 486 | auto* ble = IO::ConnectionManager::instance().connectedBluetoothLE(); |
| 487 | |
| 488 | QJsonObject result; |
| 489 | |
| 490 | result[QStringLiteral("deviceIndex")] = ble->deviceIndex(); |
| 491 | const auto& deviceNames = ble->deviceNames(); |
| 492 | if (ble->deviceIndex() >= 0 && ble->deviceIndex() < deviceNames.count()) |
| 493 | result[QStringLiteral("deviceName")] = deviceNames.at(ble->deviceIndex()); |
| 494 | |
| 495 | result[QStringLiteral("characteristicIndex")] = ble->characteristicIndex(); |
| 496 | const auto& characteristicNames = ble->characteristicNames(); |
| 497 | if (ble->characteristicIndex() >= 0 && ble->characteristicIndex() < characteristicNames.count()) |
| 498 | result[QStringLiteral("characteristicName")] = |
| 499 | characteristicNames.at(ble->characteristicIndex()); |
| 500 | |
| 501 | result[QStringLiteral("isOpen")] = ble->isOpen(); |
| 502 | result[QStringLiteral("configurationOk")] = ble->configurationOk(); |
| 503 | |
| 504 | return CommandResponse::makeSuccess(id, result); |
| 505 | } |
| 506 | |
| 507 | /** |
| 508 | * @brief Get Bluetooth adapter availability and connection status |
nothing calls this directly
no test coverage detected