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

Method getAvailableCommands

app/src/API/CommandHandler.cpp:198–213  ·  view source on GitHub ↗

* @brief Get information about all available commands */

Source from the content-addressed store, hash-verified

196 * @brief Get information about all available commands
197 */
198QJsonObject API::CommandHandler::getAvailableCommands() const
199{
200 QJsonObject result;
201 QJsonArray commandList;
202
203 const auto& commands = CommandRegistry::instance().commands();
204 for (auto it = commands.constBegin(); it != commands.constEnd(); ++it) {
205 QJsonObject cmdInfo;
206 cmdInfo[QStringLiteral("name")] = it.key();
207 cmdInfo[QStringLiteral("description")] = it.value().description;
208 commandList.append(cmdInfo);
209 }
210
211 result[QStringLiteral("commands")] = commandList;
212 return result;
213}
214
215/**
216 * @brief Initialize all command handlers

Callers

nothing calls this directly

Calls 3

keyMethod · 0.80
valueMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected