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

Method processItems

app/src/Console/Export.cpp:70–90  ·  view source on GitHub ↗

* @brief Processes a batch of console data items, routing to per-device files. */

Source from the content-addressed store, hash-verified

68 * @brief Processes a batch of console data items, routing to per-device files.
69 */
70void Console::ExportWorker::processItems(const std::vector<ExportDataPtr>& items)
71{
72 if (items.empty())
73 return;
74
75 if (!IO::ConnectionManager::instance().isConnected())
76 return;
77
78 for (const auto& dataPtr : items) {
79 const int devId = dataPtr->deviceId;
80 auto it = m_deviceFiles.find(devId);
81 if (it == m_deviceFiles.end() || !it->second.file || !it->second.file->isOpen())
82 createFile(devId);
83
84 it = m_deviceFiles.find(devId);
85 if (it != m_deviceFiles.end() && it->second.stream && it->second.stream->device()) {
86 *it->second.stream << dataPtr->data;
87 it->second.stream->flush();
88 }
89 }
90}
91
92/**
93 * @brief Closes all per-device output files.

Callers

nothing calls this directly

Calls 5

emptyMethod · 0.80
findMethod · 0.80
isConnectedMethod · 0.45
isOpenMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected