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

Method getDeviceList

app/src/API/Handlers/USBHandler.cpp:248–263  ·  view source on GitHub ↗

* @brief List all available USB devices. */

Source from the content-addressed store, hash-verified

246 * @brief List all available USB devices.
247 */
248API::CommandResponse API::Handlers::USBHandler::getDeviceList(const QString& id,
249 const QJsonObject& params)
250{
251 Q_UNUSED(params)
252
253 const auto& devices = IO::ConnectionManager::instance().usb()->deviceList();
254
255 QJsonArray devices_array;
256 for (const auto& device : devices)
257 devices_array.append(device);
258
259 QJsonObject result;
260 result[QStringLiteral("devices")] = devices_array;
261 result[QStringLiteral("selectedIndex")] = IO::ConnectionManager::instance().usb()->deviceIndex();
262 return CommandResponse::makeSuccess(id, result);
263}
264
265/**
266 * @brief Get the complete USB driver configuration.

Callers

nothing calls this directly

Calls 4

usbMethod · 0.80
deviceListMethod · 0.45
appendMethod · 0.45
deviceIndexMethod · 0.45

Tested by

no test coverage detected