MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / getConfiguration

Method getConfiguration

app/src/API/Handlers/BluetoothLEHandler.cpp:481–505  ·  view source on GitHub ↗

* @brief Get current Bluetooth LE configuration */

Source from the content-addressed store, hash-verified

479 * @brief Get current Bluetooth LE configuration
480 */
481API::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

Callers

nothing calls this directly

Calls 8

connectedBluetoothLEMethod · 0.80
deviceNamesMethod · 0.80
characteristicIndexMethod · 0.80
characteristicNamesMethod · 0.80
deviceIndexMethod · 0.45
countMethod · 0.45
isOpenMethod · 0.45
configurationOkMethod · 0.45

Tested by

no test coverage detected