mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-07-09 21:40:50 +02:00
wip, udp port enable metadata in client, to:receiver, zmq streaming
This commit is contained in:
@@ -1434,6 +1434,41 @@ void Module::setDataStream(const portPosition port, const bool enable) {
|
||||
}
|
||||
}
|
||||
|
||||
void Module::updateRxUDPDatastreamMetadata(
|
||||
const std::array<std::vector<bool>, 2> &res) {
|
||||
if (!shm()->useReceiverFlag) {
|
||||
return;
|
||||
}
|
||||
LOG(logDEBUG) << "Updating UDP data stream enable in receiver (metadata)";
|
||||
auto client = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort);
|
||||
|
||||
client.Send(F_RECEIVER_UDP_DATASTREAM_METADATA);
|
||||
client.setFnum(F_RECEIVER_UDP_DATASTREAM_METADATA);
|
||||
// ensure both port list size match
|
||||
if (res[0].size() != res[1].size()) {
|
||||
throw RuntimeError(
|
||||
"Size Mismatch of udp datastream enable list for ports");
|
||||
}
|
||||
// send udp data stream enable of all ports in all modules
|
||||
auto nports = static_cast<int>(res.size());
|
||||
auto nmods = static_cast<int>(res[0].size());
|
||||
client.Send(nports);
|
||||
client.Send(nmods);
|
||||
for (const auto &r : res) {
|
||||
// convert vector of bool to vector of int to send
|
||||
std::vector<int> tmp;
|
||||
tmp.reserve(r.size());
|
||||
for (bool b : r) {
|
||||
tmp.push_back(static_cast<int>(b));
|
||||
}
|
||||
client.Send(tmp);
|
||||
}
|
||||
if (client.Receive<int>() == FAIL) {
|
||||
throw ReceiverError("Receiver " + std::to_string(moduleIndex) +
|
||||
" returned error: " + client.readErrorMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// Receiver Config
|
||||
|
||||
bool Module::getUseReceiverFlag() const { return shm()->useReceiverFlag; }
|
||||
|
||||
Reference in New Issue
Block a user