* @brief Get list of available CAN interfaces */
| 280 | * @brief Get list of available CAN interfaces |
| 281 | */ |
| 282 | API::CommandResponse API::Handlers::CANBusHandler::getInterfaceList(const QString& id, |
| 283 | const QJsonObject& params) |
| 284 | { |
| 285 | Q_UNUSED(params) |
| 286 | |
| 287 | auto* canbus = IO::ConnectionManager::instance().canBus(); |
| 288 | const auto& interfaceList = canbus->interfaceList(); |
| 289 | |
| 290 | QJsonArray interfaces; |
| 291 | for (int i = 0; i < interfaceList.count(); ++i) { |
| 292 | QJsonObject interface; |
| 293 | interface[QStringLiteral("index")] = i; |
| 294 | interface[QStringLiteral("name")] = interfaceList.at(i); |
| 295 | interfaces.append(interface); |
| 296 | } |
| 297 | |
| 298 | QJsonObject result; |
| 299 | result[QStringLiteral("interfaceList")] = interfaces; |
| 300 | result[QStringLiteral("currentInterfaceIndex")] = canbus->interfaceIndex(); |
| 301 | return CommandResponse::makeSuccess(id, result); |
| 302 | } |
| 303 | |
| 304 | /** |
| 305 | * @brief Get list of supported bitrates |
nothing calls this directly
no test coverage detected