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

Method frameParserGetConfig

app/src/API/Handlers/ProjectHandler.cpp:4128–4157  ·  view source on GitHub ↗

* @brief Get current frame parser configuration */

Source from the content-addressed store, hash-verified

4126 * @brief Get current frame parser configuration
4127 */
4128API::CommandResponse API::Handlers::ProjectHandler::frameParserGetConfig(const QString& id,
4129 const QJsonObject& params)
4130{
4131 Q_UNUSED(params)
4132
4133 const auto& cfg = AppState::instance().frameConfig();
4134
4135 QJsonArray startArr, endArr;
4136 for (const auto& s : cfg.startSequences)
4137 startArr.append(QString::fromUtf8(s));
4138
4139 for (const auto& f : cfg.finishSequences)
4140 endArr.append(QString::fromUtf8(f));
4141
4142 const QString primaryStart =
4143 cfg.startSequences.isEmpty() ? QString() : QString::fromUtf8(cfg.startSequences.first());
4144 const QString primaryEnd =
4145 cfg.finishSequences.isEmpty() ? QString() : QString::fromUtf8(cfg.finishSequences.first());
4146
4147 QJsonObject result;
4148 result[QStringLiteral("startSequence")] = primaryStart;
4149 result[QStringLiteral("endSequence")] = primaryEnd;
4150 result[QStringLiteral("startSequences")] = startArr;
4151 result[QStringLiteral("endSequences")] = endArr;
4152 result[Keys::ChecksumAlgorithm] = cfg.checksumAlgorithm;
4153 result[QStringLiteral("operationMode")] = static_cast<int>(cfg.operationMode);
4154 result[Keys::FrameDetection] = static_cast<int>(cfg.frameDetection);
4155
4156 return CommandResponse::makeSuccess(id, result);
4157}
4158
4159/**
4160 * @brief Export current project configuration as JSON

Callers

nothing calls this directly

Calls 4

frameConfigMethod · 0.80
isEmptyMethod · 0.80
firstMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected