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

Method writeRawData

app/src/API/Server.cpp:204–217  ·  view source on GitHub ↗

* @brief Writes raw data to all connected sockets (worker thread) */

Source from the content-addressed store, hash-verified

202 * @brief Writes raw data to all connected sockets (worker thread)
203 */
204void API::ServerWorker::writeRawData(const QByteArray& data)
205{
206 if (data.isEmpty() || m_sockets.isEmpty())
207 return;
208
209 QJsonObject object;
210 object.insert(QStringLiteral("data"), QString::fromUtf8(data.toBase64()));
211 const QJsonDocument document(object);
212 const auto json = document.toJson(QJsonDocument::Compact) + "\n";
213
214 for (auto* socket : std::as_const(m_sockets))
215 if (socket && socket->isWritable())
216 socket->write(json);
217}
218
219/**
220 * @brief Broadcasts a lifecycle event JSON object to all connected API clients.

Callers 1

largeFileMethod · 0.80

Calls 4

isEmptyMethod · 0.80
toJsonMethod · 0.45
isWritableMethod · 0.45
writeMethod · 0.45

Tested by 1

largeFileMethod · 0.64