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

Method getPluginList

app/src/API/Handlers/CANBusHandler.cpp:256–277  ·  view source on GitHub ↗

* @brief Get list of available CAN plugins */

Source from the content-addressed store, hash-verified

254 * @brief Get list of available CAN plugins
255 */
256API::CommandResponse API::Handlers::CANBusHandler::getPluginList(const QString& id,
257 const QJsonObject& params)
258{
259 Q_UNUSED(params)
260
261 auto* canbus = IO::ConnectionManager::instance().canBus();
262 const auto& pluginList = canbus->pluginList();
263
264 QJsonArray plugins;
265 for (int i = 0; i < pluginList.count(); ++i) {
266 QJsonObject plugin;
267 plugin[QStringLiteral("index")] = i;
268 plugin[QStringLiteral("name")] = pluginList.at(i);
269 plugin[QStringLiteral("displayName")] = canbus->pluginDisplayName(pluginList.at(i));
270 plugins.append(plugin);
271 }
272
273 QJsonObject result;
274 result[QStringLiteral("pluginList")] = plugins;
275 result[QStringLiteral("currentPluginIndex")] = canbus->pluginIndex();
276 return CommandResponse::makeSuccess(id, result);
277}
278
279/**
280 * @brief Get list of available CAN interfaces

Callers

nothing calls this directly

Calls 6

canBusMethod · 0.80
pluginListMethod · 0.80
pluginDisplayNameMethod · 0.80
pluginIndexMethod · 0.80
countMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected