mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-08-07 03:02:25 +02:00
Dev/rx disable datastream port (#1448)
Build and Deploy on local RHEL9 / build (push) Successful in 2m13s
Build on RHEL9 docker image / build (push) Successful in 3m53s
Build and Deploy on local RHEL8 / build (push) Successful in 4m58s
Build on RHEL8 docker image / build (push) Successful in 5m47s
Run Simulator Tests on local RHEL9 / build (push) Successful in 18m55s
Run Simulator Tests on local RHEL8 / build (push) Successful in 22m26s
Build and Deploy on local RHEL9 / build (push) Successful in 2m13s
Build on RHEL9 docker image / build (push) Successful in 3m53s
Build and Deploy on local RHEL8 / build (push) Successful in 4m58s
Build on RHEL8 docker image / build (push) Successful in 5m47s
Run Simulator Tests on local RHEL9 / build (push) Successful in 18m55s
Run Simulator Tests on local RHEL8 / build (push) Successful in 22m26s
- changed
- command from `datastream` to `udp_datastream` to be more specific
- Detector API:
- setNumberofUDPInterfaces(pos) =>setNumberofUDPInterfaces() # no position anymore
- getDataStream(portPosition, pos) =>getUDPDataStream(portPosition, pos)
- setDataStream(portPosition, pos) => setUDPDataStream(portPosition) # no position anymore
- modified the dataprocessing thread:
- if gui or call back, start zmq processing (connecting sockets) before starting receiver (disabled ports sends dummy that the client zmq sockets are not ready for)
- if only progress, starting progress processing thread after startReceiver
-
- added
- Detector API:
- getRxDisabledUDPPortIndices()
- getPortPositionList()
- allow disabling/enabling udp interface in receiver for Jungfrua/Moench when both udp interfaces is enabled (This is to go fast, where only one half of the module matters)
- write ports type and disabled ports to master file (tests for it as well)
- tests for python commands as well
- datastream command to deprecated commands
- refactored tests to make the new parameters fit
* first draft of disabling data port at the receiver side. Todo: master file and stream for gui to use
* updated help in command
* formatting
* md5 unchanged
* fix test, check port position for detector type
* wip, udp port enable metadata in client, to:receiver, zmq streaming
* wip, master attributes
* wip, imple=> save only disabled ports with port index, 1 interface, is empty
* works in file. still needs refactoring
* updated writer versions
* udp ports type pass, disabled with api yet
* fixed disabled ports meta data as well
* fixed in developer via other PR
* renamed.more intuitive
* fix in gui that wont wait for disabled ports
* added tests for master file
* extra tests
* move the master fiel tests into its own tests with the disable marker for github tests
* refactoring
* python test
* more intuitive and doc
* release notes
* example for python
* back to before
* minor documentation fix and sending nports unnecessarily for getRxUDPPortDisableMetadata
* doc
* review fixes, 1. using std::array instead of vector, 2. moving udp_datastream command testing with different values into master attributes testing file because we test the master file
* minor
* review: update help
* progress printed before assigned
* try catch inside hdf5
* auto generated code for CLI and formatting
* missing packets should not be checked at github workflow level
* formatting
* improved python doc for udp_datastream help
* indent doc python done
This commit is contained in:
@@ -207,7 +207,7 @@ int ClientInterface::functionTable(){
|
||||
flist[F_GET_RECEIVER_STREAMING_HWM] = &ClientInterface::get_streaming_hwm;
|
||||
flist[F_SET_RECEIVER_STREAMING_HWM] = &ClientInterface::set_streaming_hwm;
|
||||
flist[F_RECEIVER_SET_ALL_THRESHOLD] = &ClientInterface::set_all_threshold;
|
||||
flist[F_RECEIVER_SET_DATASTREAM] = &ClientInterface::set_detector_datastream;
|
||||
flist[F_RECEIVER_SET_UDP_DATASTREAM] = &ClientInterface::set_port_udp_datastream;
|
||||
flist[F_GET_RECEIVER_ARPING] = &ClientInterface::get_arping;
|
||||
flist[F_SET_RECEIVER_ARPING] = &ClientInterface::set_arping;
|
||||
flist[F_RECEIVER_GET_RECEIVER_ROI] = &ClientInterface::get_receiver_roi;
|
||||
@@ -221,6 +221,10 @@ int ClientInterface::functionTable(){
|
||||
flist[F_SET_RECEIVER_DBIT_REORDER] = &ClientInterface::set_dbit_reorder;
|
||||
flist[F_RECEIVER_GET_ROI_METADATA] = &ClientInterface::get_roi_metadata;
|
||||
flist[F_SET_RECEIVER_READOUT_SPEED] = &ClientInterface::set_readout_speed;
|
||||
flist[F_RECEIVER_GET_UDP_DATASTREAM] = &ClientInterface::get_port_udp_datastream;
|
||||
flist[F_RECEIVER_SET_UDP_PORT_DISABLE_META] = &ClientInterface::set_udp_port_disable_meta;
|
||||
flist[F_RECEIVER_GET_UDP_PORT_DISABLE_META] = &ClientInterface::get_udp_port_disable_meta;
|
||||
|
||||
|
||||
for (int i = NUM_DET_FUNCTIONS + 1; i < NUM_REC_FUNCTIONS ; i++) {
|
||||
LOG(logDEBUG1) << "function fnum: " << i << " (" <<
|
||||
@@ -383,8 +387,8 @@ int ClientInterface::setup_receiver(Interface &socket) {
|
||||
impl()->setSubPeriod(std::chrono::nanoseconds(arg.subExpTimeNs) +
|
||||
std::chrono::nanoseconds(arg.subDeadTimeNs));
|
||||
impl()->setActivate(static_cast<bool>(arg.activate));
|
||||
impl()->setDetectorDataStream(LEFT, arg.dataStreamLeft);
|
||||
impl()->setDetectorDataStream(RIGHT, arg.dataStreamRight);
|
||||
impl()->setUDPDataStream(LEFT, arg.dataStreamLeft);
|
||||
impl()->setUDPDataStream(RIGHT, arg.dataStreamRight);
|
||||
impl()->setQuad(arg.quad == 0 ? false : true);
|
||||
impl()->setThresholdEnergy(arg.thresholdEnergyeV[0]);
|
||||
}
|
||||
@@ -1653,27 +1657,58 @@ int ClientInterface::set_all_threshold(Interface &socket) {
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int ClientInterface::set_detector_datastream(Interface &socket) {
|
||||
int args[2]{-1, -1};
|
||||
socket.Receive(args);
|
||||
portPosition port = static_cast<portPosition>(args[0]);
|
||||
void ClientInterface::validate_port_position(const portPosition port) {
|
||||
bool exists = false;
|
||||
switch (port) {
|
||||
case LEFT:
|
||||
case RIGHT:
|
||||
if (detType == EIGER) {
|
||||
exists = true;
|
||||
}
|
||||
break;
|
||||
case TOP:
|
||||
case BOTTOM:
|
||||
if (detType == JUNGFRAU || detType == MOENCH) {
|
||||
exists = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw RuntimeError("Invalid port type");
|
||||
}
|
||||
bool enable = static_cast<int>(args[1]);
|
||||
LOG(logDEBUG1) << "Setting datastream (" << ToString(port) << ") to "
|
||||
<< ToString(enable);
|
||||
if (detType != EIGER)
|
||||
if (!exists) {
|
||||
modeNotImplemented("Port type", port);
|
||||
}
|
||||
}
|
||||
|
||||
int ClientInterface::set_port_udp_datastream(Interface &socket) {
|
||||
if (detType != EIGER && detType != JUNGFRAU && detType != MOENCH)
|
||||
functionNotImplemented();
|
||||
int args[2]{-1, -1};
|
||||
socket.Receive(args);
|
||||
portPosition port = static_cast<portPosition>(args[0]);
|
||||
validate_port_position(port);
|
||||
bool enable = static_cast<bool>(args[1]);
|
||||
if (impl()->getNumberofUDPInterfaces() == 1)
|
||||
throw RuntimeError("Cannot change UDP port datastream with only 1 "
|
||||
"interface enabled. Hint: set 'numinterfaces' to 2");
|
||||
LOG(logDEBUG1) << "Setting udp datastream (" << ToString(port) << ") to "
|
||||
<< ToString(enable);
|
||||
verifyIdle(socket);
|
||||
impl()->setDetectorDataStream(port, enable);
|
||||
impl()->setUDPDataStream(port, enable);
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int ClientInterface::get_port_udp_datastream(Interface &socket) {
|
||||
auto arg = socket.Receive<int>();
|
||||
portPosition port = static_cast<portPosition>(arg);
|
||||
validate_port_position(port);
|
||||
LOG(logDEBUG1) << "Getting udp datastream (" << ToString(port) << ")";
|
||||
if (detType != EIGER && detType != JUNGFRAU && detType != MOENCH)
|
||||
functionNotImplemented();
|
||||
auto retval = static_cast<int>(impl()->getUDPDataStream(port));
|
||||
return socket.sendResult(retval);
|
||||
}
|
||||
|
||||
int ClientInterface::get_arping(Interface &socket) {
|
||||
auto retval = static_cast<int>(impl()->getArping());
|
||||
LOG(logDEBUG1) << "arping thread status:" << retval;
|
||||
@@ -1884,4 +1919,35 @@ int ClientInterface::set_readout_speed(Interface &socket) {
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int ClientInterface::set_udp_port_disable_meta(Interface &socket) {
|
||||
auto nports = socket.Receive<int>();
|
||||
std::vector<int> portsDisabled;
|
||||
if (nports > 0) {
|
||||
portsDisabled.resize(nports);
|
||||
socket.Receive(portsDisabled);
|
||||
LOG(logDEBUG1) << "Disabled Ports Metadata:" << ToString(portsDisabled);
|
||||
}
|
||||
verifyIdle(socket);
|
||||
try {
|
||||
|
||||
impl()->setUDPPortsDisabledMetadata(portsDisabled);
|
||||
} catch (const std::exception &e) {
|
||||
throw RuntimeError("Could not update UDP ports disabled metadata [" +
|
||||
std::string(e.what()) + ']');
|
||||
}
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int ClientInterface::get_udp_port_disable_meta(Interface &socket) {
|
||||
auto retvals = impl()->getUDPPortsDisabledMetadata();
|
||||
LOG(logDEBUG1) << "Receiver disabled udp ports retval:"
|
||||
<< ToString(retvals);
|
||||
socket.Send(OK);
|
||||
auto size = static_cast<int>(retvals.size());
|
||||
socket.Send(size);
|
||||
if (size > 0)
|
||||
socket.Send(retvals);
|
||||
return OK;
|
||||
}
|
||||
|
||||
} // namespace sls
|
||||
|
||||
Reference in New Issue
Block a user