* @brief Get list of discovered Bluetooth LE devices */
| 405 | * @brief Get list of discovered Bluetooth LE devices |
| 406 | */ |
| 407 | API::CommandResponse API::Handlers::BluetoothLEHandler::getDeviceList(const QString& id, |
| 408 | const QJsonObject& params) |
| 409 | { |
| 410 | Q_UNUSED(params) |
| 411 | |
| 412 | auto* ble = IO::ConnectionManager::instance().bluetoothLE(); |
| 413 | const auto& deviceNames = ble->deviceNames(); |
| 414 | |
| 415 | QJsonArray devices; |
| 416 | for (int i = 0; i < deviceNames.count(); ++i) { |
| 417 | QJsonObject device; |
| 418 | device[QStringLiteral("index")] = i; |
| 419 | device[QStringLiteral("name")] = deviceNames.at(i); |
| 420 | devices.append(device); |
| 421 | } |
| 422 | |
| 423 | QJsonObject result; |
| 424 | result[QStringLiteral("deviceList")] = devices; |
| 425 | result[QStringLiteral("currentDeviceIndex")] = ble->deviceIndex(); |
| 426 | return CommandResponse::makeSuccess(id, result); |
| 427 | } |
| 428 | |
| 429 | /** |
| 430 | * @brief Get list of services for the selected BLE device |
nothing calls this directly
no test coverage detected