udp_firstdst for jungfrau

This commit is contained in:
2021-08-25 14:27:06 +02:00
parent 485b54994c
commit 1d989637e9
13 changed files with 162 additions and 24 deletions

View File

@ -677,6 +677,12 @@ class Detector {
/**[Jungfrau][Eiger] Options 1-32 */
void setNumberofUDPDestinations(const int value, Positions pos = {});
/** [Jungfrau][Eiger] */
Result<int> getFirstUDPDestination(Positions pos = {}) const;
/**[Jungfrau][Eiger] Options 0-31 */
void setFirstUDPDestination(const int value, Positions pos = {});
Result<IpAddr> getDestinationUDPIP(Positions pos = {}) const;
/** IP of the interface in receiver that the detector sends data to */

View File

@ -859,6 +859,7 @@ class CmdProxy {
{"selinterface", &CmdProxy::selinterface},
{"udp_dstlist", &CmdProxy::UDPDestinationList},
{"udp_numdst", &CmdProxy::udp_numdst},
{"udp_firstdst", &CmdProxy::udp_firstdst},
{"udp_srcip", &CmdProxy::udp_srcip},
{"udp_srcip2", &CmdProxy::udp_srcip2},
{"udp_dstip", &CmdProxy::UDPDestinationIP},
@ -1539,6 +1540,14 @@ class CmdProxy {
"destinations that the detector will stream images "
"out in a round robin fashion. Default: 1");
INTEGER_COMMAND_VEC_ID(
udp_firstdst, getFirstUDPDestination, setFirstUDPDestination,
StringTo<int>,
"[0 - 31]\n\t[Jungfrau][Eiger] One can set which is the first "
"destination that the detector will stream images "
"out from in a round robin fashion. The entry must not have been "
"empty. Default: 0");
INTEGER_COMMAND_VEC_ID(
udp_srcip, getSourceUDPIP, setSourceUDPIP, IpAddr,
"[x.x.x.x]\n\tIp address of the detector (source) udp "

View File

@ -929,6 +929,14 @@ void Detector::setNumberofUDPDestinations(const int value, Positions pos) {
pimpl->Parallel(&Module::setNumberofUDPDestinations, pos, value);
}
Result<int> Detector::getFirstUDPDestination(Positions pos) const {
return pimpl->Parallel(&Module::getFirstUDPDestination, pos);
}
void Detector::setFirstUDPDestination(const int value, Positions pos) {
pimpl->Parallel(&Module::setFirstUDPDestination, pos, value);
}
Result<IpAddr> Detector::getDestinationUDPIP(Positions pos) const {
return pimpl->Parallel(&Module::getDestinationUDPIP, pos);
}

View File

@ -970,6 +970,14 @@ void Module::setNumberofUDPDestinations(const int value) {
sendToDetector(F_SET_NUM_DEST_UDP, value, nullptr);
}
int Module::getFirstUDPDestination() const {
return sendToDetector<int>(F_GET_UDP_FIRST_DEST);
}
void Module::setFirstUDPDestination(const int value) {
sendToDetector(F_SET_UDP_FIRST_DEST, value, nullptr);
}
sls::IpAddr Module::getDestinationUDPIP() const {
return sendToDetector<sls::IpAddr>(F_GET_DEST_UDP_IP);
}

View File

@ -226,6 +226,8 @@ class Module : public virtual slsDetectorDefs {
void setDestinationUDPList(const defs::udpDestination dest);
int getNumberofUDPDestinations() const;
void setNumberofUDPDestinations(const int value);
int getFirstUDPDestination() const;
void setFirstUDPDestination(const int value);
sls::IpAddr getDestinationUDPIP() const;
void setDestinationUDPIP(const sls::IpAddr ip);
sls::IpAddr getDestinationUDPIP2() const;

View File

@ -2262,6 +2262,37 @@ TEST_CASE("udp_numdst", "[.cmd]") {
}
}
TEST_CASE("udp_firstdst", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::JUNGFRAU || det_type == defs::EIGER) {
auto prev_val = det.getFirstUDPDestination();
{
std::ostringstream oss;
proxy.Call("udp_firstdst", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "udp_firstdst 10\n");
}
{
std::ostringstream oss;
proxy.Call("udp_firstdst", {}, -1, GET, oss);
REQUIRE(oss.str() == "udp_firstdst 0\n");
}
{
std::ostringstream oss;
proxy.Call("udp_firstdst", {"31"}, -1, PUT, oss);
REQUIRE(oss.str() == "udp_firstdst 31\n");
}
REQUIRE_THROWS(proxy.Call("udp_firstdst", {"33"}, -1, PUT));
for (int i = 0; i != det.size(); ++i) {
det.setFirstUDPDestination(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("udp_numdst", {}, -1, GET));
}
}
TEST_CASE("udp_dstip", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);