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

Function parseMessage

app/src/API/CommandProtocol.h:182–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180};
181
182inline bool parseMessage(const QByteArray& data, QString& type, QJsonObject& json)
183{
184 QJsonParseError error;
185 const auto doc = QJsonDocument::fromJson(data, &error);
186
187 if (error.error != QJsonParseError::NoError)
188 return false;
189
190 if (!doc.isObject())
191 return false;
192
193 json = doc.object();
194 type = json.value(QStringLiteral("type")).toString();
195
196 return !type.isEmpty();
197}
198
199inline bool isApiMessage(const QByteArray& data)
200{

Callers 6

processMessageMethod · 0.85
handleJsonMessageMethod · 0.85
processBufferedJsonMethod · 0.85
isApiMessageFunction · 0.85
parseFileMethod · 0.85

Calls 3

fromJsonFunction · 0.85
isEmptyMethod · 0.80
valueMethod · 0.45

Tested by

no test coverage detected