* @brief Get list of available CAN plugins */
| 254 | * @brief Get list of available CAN plugins |
| 255 | */ |
| 256 | API::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 |
nothing calls this directly
no test coverage detected