Add rx_streamdummyheader command (#1442)

* add rx_restream_stop command. This allows to send a ZMQ dummy header any time user wants to do so. For example this allows to pre-configure the ZMQ processing software before the acquisition begins. Therefore, the dummy header was adapted in order to contain the fields stored in the receiver.

* renamed command, changed inherit, moved commands to zmq related section

* update filename in restreamstop

* renamed helper function, sorted header fields alphabetically

* fixed fnametostream set

* renamed functions, add SetFileName method, format JSON parameters order

* added python bindings and formatting (does nothing really)

* renamed restream stop functions to stream dummy

* checkout .github files from ed8c885

* release notes

---------

Co-authored-by: Dhanya Thattil <dhanya.thattil@psi.ch>
This commit is contained in:
2026-08-03 09:27:53 +02:00
committed by mazzol_a
co-authored by maliakal_d
parent 504e5c0d58
commit faedb0acf1
25 changed files with 185 additions and 91 deletions
+39
View File
@@ -11574,6 +11574,45 @@ std::string Caller::rx_stop(int action) {
return os.str();
}
std::string Caller::rx_streamdummyheader(int action) {
std::ostringstream os;
// print help
if (action == slsDetectorDefs::HELP_ACTION) {
os << R"V0G0N(
Sends ZMQ dummy header. The detector related fields are not set, the receiver related fields are set. )V0G0N"
<< std::endl;
return os.str();
}
// check if action and arguments are valid
if (action == slsDetectorDefs::PUT_ACTION) {
if (1 && args.size() != 0) {
throw RuntimeError("Wrong number of arguments for action PUT");
}
if (args.size() == 0) {
}
}
else {
throw RuntimeError(
"INTERNAL ERROR: Invalid action: supported actions are ['PUT']");
}
// generate code for each action
if (action == slsDetectorDefs::PUT_ACTION) {
if (args.size() == 0) {
det->streamRxDummyHeader(std::vector<int>{det_id});
os << "successful" << '\n';
}
}
return os.str();
}
std::string Caller::rx_tcpport(int action) {
std::ostringstream os;
+2
View File
@@ -258,6 +258,7 @@ class Caller {
std::string rx_start(int action);
std::string rx_status(int action);
std::string rx_stop(int action);
std::string rx_streamdummyheader(int action);
std::string rx_tcpport(int action);
std::string rx_threads(int action);
std::string rx_udpsocksize(int action);
@@ -605,6 +606,7 @@ class Caller {
{"rx_start", &Caller::rx_start},
{"rx_status", &Caller::rx_status},
{"rx_stop", &Caller::rx_stop},
{"rx_streamdummyheader", &Caller::rx_streamdummyheader},
{"rx_tcpport", &Caller::rx_tcpport},
{"rx_threads", &Caller::rx_threads},
{"rx_udpsocksize", &Caller::rx_udpsocksize},
+4
View File
@@ -1636,6 +1636,10 @@ void Detector::setRxZmqHwm(const int limit) {
}
}
void Detector::streamRxDummyHeader(Positions pos) const {
pimpl->Parallel(&Module::streamRxDummyHeader, pos);
}
// Eiger Specific
Result<ns> Detector::getSubExptime(Positions pos) const {
+1 -1
View File
@@ -1151,7 +1151,7 @@ int DetectorImpl::acquire() {
setJoinThreadFlag(true);
} else if (receiver) {
while (numZmqRunning != 0) {
Parallel(&Module::restreamStopFromReceiver, {});
Parallel(&Module::streamRxDummyHeader, {});
std::this_thread::sleep_for(std::chrono::milliseconds(200));
}
}
+3 -3
View File
@@ -946,15 +946,15 @@ void Module::stopAcquisition() {
try {
if (shm()->useReceiverFlag && getReceiverStreaming()) {
if (detStatus == IDLE && getReceiverStatus() == IDLE) {
restreamStopFromReceiver();
streamRxDummyHeader();
}
}
} catch (...) {
}
}
void Module::restreamStopFromReceiver() {
sendToReceiver(F_RESTREAM_STOP_FROM_RECEIVER);
void Module::streamRxDummyHeader() {
sendToReceiver(F_STREAM_RX_DUMMY_HEADER_FROM_RECEIVER);
}
void Module::startAndReadAll() {
+1 -1
View File
@@ -206,7 +206,7 @@ class Module : public virtual slsDetectorDefs {
void startAcquisition();
void startReadout();
void stopAcquisition();
void restreamStopFromReceiver();
void streamRxDummyHeader();
void startAndReadAll();
runStatus getRunStatus() const;
runStatus getReceiverStatus() const;
+12
View File
@@ -2819,6 +2819,18 @@ int InferAction::rx_stop() {
}
}
int InferAction::rx_streamdummyheader() {
if (args.size() == 0) {
return slsDetectorDefs::PUT_ACTION;
}
else {
throw RuntimeError("Could not infer action: Wrong number of arguments");
}
}
int InferAction::rx_tcpport() {
if (args.size() == 0) {
+2
View File
@@ -213,6 +213,7 @@ class InferAction {
int rx_start();
int rx_status();
int rx_stop();
int rx_streamdummyheader();
int rx_tcpport();
int rx_threads();
int rx_udpsocksize();
@@ -548,6 +549,7 @@ class InferAction {
{"rx_start", &InferAction::rx_start},
{"rx_status", &InferAction::rx_status},
{"rx_stop", &InferAction::rx_stop},
{"rx_streamdummyheader", &InferAction::rx_streamdummyheader},
{"rx_tcpport", &InferAction::rx_tcpport},
{"rx_threads", &InferAction::rx_threads},
{"rx_udpsocksize", &InferAction::rx_udpsocksize},