mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-07-08 15:26:07 +02:00
first draft of disabling data port at the receiver side. Todo: master file and stream for gui to use
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,7 @@ 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;
|
||||
|
||||
for (int i = NUM_DET_FUNCTIONS + 1; i < NUM_REC_FUNCTIONS ; i++) {
|
||||
LOG(logDEBUG1) << "function fnum: " << i << " (" <<
|
||||
@@ -383,8 +384,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 +1654,55 @@ 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 "
|
||||
if (!exists) {
|
||||
modeNotImplemented("Port type", port);
|
||||
}
|
||||
}
|
||||
|
||||
int ClientInterface::set_port_udp_datastream(Interface &socket) {
|
||||
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]);
|
||||
LOG(logDEBUG1) << "Setting udp datastream (" << ToString(port) << ") to "
|
||||
<< ToString(enable);
|
||||
if (detType != EIGER)
|
||||
functionNotImplemented();
|
||||
verifyIdle(socket);
|
||||
impl()->setDetectorDataStream(port, enable);
|
||||
if (detType != EIGER && detType != JUNGFRAU && detType != MOENCH)
|
||||
functionNotImplemented();
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user