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

Method startDiscovery

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

* @brief Start scanning for Bluetooth LE devices */

Source from the content-addressed store, hash-verified

168 * @brief Start scanning for Bluetooth LE devices
169 */
170API::CommandResponse API::Handlers::BluetoothLEHandler::startDiscovery(const QString& id,
171 const QJsonObject& params)
172{
173 Q_UNUSED(params)
174
175 auto* ble = IO::ConnectionManager::instance().bluetoothLE();
176
177 if (!ble->operatingSystemSupported()) {
178 return CommandResponse::makeError(
179 id,
180 ErrorCode::OperationFailed,
181 QStringLiteral("Bluetooth LE is not supported on this operating system"));
182 }
183
184 if (!ble->adapterAvailable()) {
185 return CommandResponse::makeError(
186 id, ErrorCode::OperationFailed, QStringLiteral("No Bluetooth adapter available"));
187 }
188
189 ble->startDiscovery();
190
191 QJsonObject result;
192 result[QStringLiteral("discoveryStarted")] = true;
193 return CommandResponse::makeSuccess(id, result);
194}
195
196/**
197 * @brief Select BLE device by index

Callers

nothing calls this directly

Calls 3

bluetoothLEMethod · 0.80
adapterAvailableMethod · 0.80

Tested by

no test coverage detected