Compare commits

...

19 Commits

Author SHA1 Message Date
d81587646e merge from developer on commit b6db097800 to properly clear udp destination in fpga for jungfrau mainly 2022-09-02 09:57:11 +02:00
5508f0135d merge fix 2022-03-21 11:08:02 +01:00
f2b8aa9dbd Merge branch 'developer' into rr_rxr 2022-03-21 10:56:41 +01:00
e554099bd9 binaries in 2022-03-21 10:34:09 +01:00
001fcf03d9 merge fix 2022-03-21 10:32:49 +01:00
1c6369a5a8 binaries in 2021-11-26 11:57:53 +01:00
4012f139ec merge fix from 6.1.0 2021-11-26 10:59:23 +01:00
630b7cd539 fixed 2021-10-26 15:35:56 +02:00
3ebb3e7508 wip 2021-10-25 17:22:50 +02:00
a1c4eb6d05 wip 2021-10-25 12:33:02 +02:00
b9b5c623ec rx_hostname, port, port2, dstlist works 2021-10-25 11:10:12 +02:00
41dc8329ab first try on setrxhostname 2021-10-22 17:15:04 +02:00
c3499c0b93 Merge branch 'developer' into rr_rxr 2021-10-22 16:12:04 +02:00
578528eb59 merge fix 2021-10-19 14:54:39 +02:00
0658d1c843 merge fix 2021-10-08 09:50:36 +02:00
ce6dc589c8 merge fix 2021-09-30 16:07:30 +02:00
0b45fdfed8 merge fix 2021-09-28 16:09:51 +02:00
9217d9f22c Merge branch 'developer' into rr_rxr 2021-09-15 11:41:29 +02:00
7d4e2470a3 hacky version compiles 2021-09-13 15:45:46 +02:00
16 changed files with 961 additions and 423 deletions

View File

@ -0,0 +1,12 @@
hostname bchip258+
0:rx_hostname pc13784:1954+pc13784:1955+
udp_srcip 10.0.2.184
udp_dstip 10.0.2.1
0:0 udp_dstport 50000
0:1 udp_dstport 50001
#0:0 udp_dstlist port=50001
#0:1 udp_dstlist port=50002

View File

@ -9220,8 +9220,25 @@ int clear_all_udp_dst(int file_des) {
if (check_detector_idle("clear all udp destinations") == OK) {
memset(udpDetails, 0, sizeof(udpDetails));
// minimum 1 destination in fpga
numUdpDestinations = 1;
configure_mac();
int numdest = 1;
// set number of destinations
#if defined(JUNGFRAUD) || defined(EIGERD)
if (setNumberofDestinations(numdest) == FAIL) {
ret = FAIL;
strcpy(mess, "Could not clear udp destinations to 1 entry.\n");
LOG(logERROR, (mess));
} else
#endif
{
numUdpDestinations = numdest;
LOG(logINFOBLUE, ("Number of UDP Destinations: %d\n",
numUdpDestinations));
ret = configureMAC();
if (ret == FAIL) {
strcpy(mess, "Could not clear all destinations in the fpga.\n");
LOG(logERROR, (mess));
}
}
}
}
return Server_SendResult(file_des, INT32, NULL, 0);

View File

@ -699,48 +699,60 @@ class Detector {
/**[Jungfrau] Options 0-31 (or number of udp destinations) */
void setFirstUDPDestination(const int value, Positions pos = {});
Result<IpAddr> getDestinationUDPIP(Positions pos = {}) const;
Result<IpAddr> getDestinationUDPIP(Positions pos = {},
const int rx_index = 0) const;
/** IP of the interface in receiver that the detector sends data to */
void setDestinationUDPIP(const IpAddr ip, Positions pos = {});
void setDestinationUDPIP(const IpAddr ip, Positions pos = {},
const int rx_index = 0);
/** [Jungfrau] bottom half \n [Gotthard2] veto debugging */
Result<IpAddr> getDestinationUDPIP2(Positions pos = {}) const;
Result<IpAddr> getDestinationUDPIP2(Positions pos = {},
const int rx_index = 0) const;
/** [Jungfrau] bottom half \n [Gotthard2] veto debugging */
void setDestinationUDPIP2(const IpAddr ip, Positions pos = {});
void setDestinationUDPIP2(const IpAddr ip, Positions pos = {},
const int rx_index = 0);
Result<MacAddr> getDestinationUDPMAC(Positions pos = {}) const;
Result<MacAddr> getDestinationUDPMAC(Positions pos = {},
const int rxIndex = 0) const;
/** Mac address of the receiver (destination) udp interface. Not mandatory
* to set as setDestinationUDPIP (udp_dstip) retrieves it from slsReceiver
* process but must be set if you use a custom receiver (not slsReceiver).
*/
void setDestinationUDPMAC(const MacAddr mac, Positions pos = {});
void setDestinationUDPMAC(const MacAddr mac, Positions pos = {},
const int rx_index = 0);
/** [Jungfrau] bottom half \n [Gotthard2] veto debugging */
Result<MacAddr> getDestinationUDPMAC2(Positions pos = {}) const;
Result<MacAddr> getDestinationUDPMAC2(Positions pos = {},
const int rx_index = 0) const;
/* [Jungfrau][Gotthard2] Mac address of the receiver (destination) udp
interface 2. \n Not mandatory to set as udp_dstip2 retrieves it from
slsReceiver process but must be set if you use a custom receiver (not
slsReceiver). \n [Jungfrau] bottom half \n [Gotthard2] veto debugging \n
*/
void setDestinationUDPMAC2(const MacAddr mac, Positions pos = {});
void setDestinationUDPMAC2(const MacAddr mac, Positions pos = {},
const int rx_index = 0);
Result<int> getDestinationUDPPort(Positions pos = {}) const;
Result<int> getDestinationUDPPort(Positions pos = {},
const int rx_index = 0) const;
/** Default is 50001. \n If module_id is -1, ports for each module is
* calculated (incremented by 1 if no 2nd interface) */
void setDestinationUDPPort(int port, int module_id = -1);
void setDestinationUDPPort(int port, int module_id = -1,
const int rxIndex = 0);
/** [Eiger] right port[Jungfrau] bottom half [Gotthard2] veto debugging */
Result<int> getDestinationUDPPort2(Positions pos = {}) const;
Result<int> getDestinationUDPPort2(Positions pos = {},
const int rx_index = 0) const;
/** [Eiger] right port[Jungfrau] bottom half [Gotthard2] veto debugging \n
* Default is 50002. \n If module_id is -1, ports for each module is
* calculated (incremented by 1 if no 2nd interface)*/
void setDestinationUDPPort2(int port, int module_id = -1);
void setDestinationUDPPort2(int port, int module_id = -1,
const int rxIndex = 0);
/** Reconfigures Detector with UDP destination. More for debugging as the
* configuration is done automatically when the detector has sufficient UDP
@ -752,7 +764,8 @@ class Detector {
* information */
void validateUDPConfiguration(Positions pos = {});
Result<std::string> printRxConfiguration(Positions pos = {}) const;
Result<std::string> printRxConfiguration(Positions pos = {},
const int rx_index = 0) const;
/** [Eiger][CTB][Moench][Mythen3] */
Result<bool> getTenGiga(Positions pos = {}) const;
@ -811,7 +824,8 @@ class Detector {
/** true when slsReceiver is used */
Result<bool> getUseReceiverFlag(Positions pos = {}) const;
Result<std::string> getRxHostname(Positions pos = {}) const;
Result<std::string> getRxHostname(Positions pos = {},
const int rx_index = 0) const;
/**
* Sets receiver hostname or IP address for each module. \n Used for TCP
@ -819,20 +833,24 @@ class Detector {
* Also updates receiver with detector parameters. \n Also resets any prior
* receiver property (not on detector). \n receiver is receiver hostname or
* IP address, can include tcp port eg. hostname:port
*
* rxIndex of -1 is rewritten as 0 (for backwards compatibility)
*/
void setRxHostname(const std::string &receiver, Positions pos = {});
void setRxHostname(const std::string &receiver, Positions pos = {}, const int rxIndex = 0);
/** multiple rx hostnames. Single element will set it for all */
void setRxHostname(const std::vector<std::string> &name);
/** - single element, assumes rxIndex is 0 (for backwards compatibility).
* - muliple element with pos empty or -1, sets each element for each module (1:1 for backwards compatibility, rxIndex = 0)
* multiple element for specific position, each element for each RR rxr */
void setRxHostname(const std::vector<std::string> &name, Positions pos);
Result<int> getRxPort(Positions pos = {}) const;
Result<int> getRxPort(Positions pos = {}, const int rx_index = 0) const;
/** TCP port for client-receiver communication. \n
* Default is 1954. \n Must be different if multiple receivers on same pc.
* \n Must be first command to set a receiver parameter to be able to
* communicate. \n Multi command will automatically increment port for
* individual modules.*/
void setRxPort(int port, int module_id = -1);
void setRxPort(int port, int module_id = -1, const int rx_index = 0);
Result<int> getRxFifoDepth(Positions pos = {}) const;
@ -1010,13 +1028,15 @@ class Detector {
*/
void setRxZmqPort(int port, int module_id = -1);
Result<IpAddr> getRxZmqIP(Positions pos = {}) const;
Result<IpAddr> getRxZmqIP(Positions pos = {},
const int rx_index = 0) const;
/** Zmq Ip Address from which data is to be streamed out of the receiver. \n
* Also restarts receiver zmq streaming if enabled. \n Default is from
* rx_hostname. \n Modified only when using an intermediate process between
* receiver. */
void setRxZmqIP(const IpAddr ip, Positions pos = {});
void setRxZmqIP(const IpAddr ip, Positions pos = {},
const int rx_index = 0);
Result<int> getClientZmqPort(Positions pos = {}) const;

View File

@ -1484,7 +1484,7 @@ std::string CmdProxy::UDPDestinationList(int action) {
}
if (rx_id < 0 || rx_id >= MAX_UDP_DESTINATION) {
throw sls::RuntimeError(
"Invalid receiver index to set round robin entry.");
std::string("Invalid receiver index ") + std::to_string(rx_id) + std::string(" to set round robin entry."));
}
auto t = getUdpEntry();
det->setDestinationUDPList(t, det_id);
@ -1504,7 +1504,7 @@ std::string CmdProxy::UDPDestinationIP(int action) {
"rx_hostname."
<< '\n';
} else if (action == defs::GET_ACTION) {
auto t = det->getDestinationUDPIP(std::vector<int>{det_id});
auto t = det->getDestinationUDPIP(std::vector<int>{det_id}, rx_id);
if (!args.empty()) {
WrongNumberOfParameters(0);
}
@ -1517,11 +1517,11 @@ std::string CmdProxy::UDPDestinationIP(int action) {
auto val = getIpFromAuto();
LOG(logINFO) << "Setting udp_dstip of detector " << det_id << " to "
<< val;
det->setDestinationUDPIP(val, std::vector<int>{det_id});
det->setDestinationUDPIP(val, std::vector<int>{det_id}, rx_id);
os << val << '\n';
} else {
auto val = IpAddr(args[0]);
det->setDestinationUDPIP(val, std::vector<int>{det_id});
det->setDestinationUDPIP(val, std::vector<int>{det_id}, rx_id);
os << args.front() << '\n';
}
} else {
@ -1540,7 +1540,7 @@ std::string CmdProxy::UDPDestinationIP2(int action) {
"\n\t[Gotthard2] veto debugging. "
<< '\n';
} else if (action == defs::GET_ACTION) {
auto t = det->getDestinationUDPIP2(std::vector<int>{det_id});
auto t = det->getDestinationUDPIP2(std::vector<int>{det_id}, rx_id);
if (!args.empty()) {
WrongNumberOfParameters(0);
}
@ -1553,11 +1553,11 @@ std::string CmdProxy::UDPDestinationIP2(int action) {
auto val = getIpFromAuto();
LOG(logINFO) << "Setting udp_dstip2 of detector " << det_id
<< " to " << val;
det->setDestinationUDPIP2(val, std::vector<int>{det_id});
det->setDestinationUDPIP2(val, std::vector<int>{det_id}, rx_id);
os << val << '\n';
} else {
auto val = IpAddr(args[0]);
det->setDestinationUDPIP2(val, std::vector<int>{det_id});
det->setDestinationUDPIP2(val, std::vector<int>{det_id}, rx_id);
os << args.front() << '\n';
}
} else {
@ -1593,33 +1593,54 @@ std::string CmdProxy::ReceiverHostname(int action) {
}
// multiple arguments
if (args.size() > 1) {
// multiple in mulitple
if (rx_id != -1) {
throw sls::RuntimeError(
"Cannot add multiple receivers at RR level");
}
// multiple arguments (multiple rxr each)// backwards compatibility
if (args[0].find('+') != std::string::npos) {
throw sls::RuntimeError(
"Cannot add multiple receivers at module level");
if (det_id != -1) {
throw sls::RuntimeError(
"Cannot add multiple receivers for multiple modules at module level");
}
for (int i = 0; i < (int)args.size(); ++i) {
auto t = sls::split(args[i], '+');
det->setRxHostname(t, {i});
os << ToString(t) << '\n';
}
}
if (det_id != -1) {
throw sls::RuntimeError(
"Cannot add multiple receivers at module level");
// multiple arguments (single rxr each) (for both: each module and RR)
else {
det->setRxHostname(args, {det_id});
os << ToString(args) << '\n';
}
det->setRxHostname(args);
os << ToString(args) << '\n';
}
// single argument
else {
// multiple receivers concatenated with +
if (args[0].find('+') != std::string::npos) {
if (det_id != -1) {
throw sls::RuntimeError(
"Cannot add multiple receivers at module level");
}
auto t = sls::split(args[0], '+');
det->setRxHostname(t);
os << ToString(t) << '\n';
if (t.size() <= 0) {
throw sls::RuntimeError("Invalid argument for rx_hostname");
}
// single receiver
if (t.size() == 1) {
det->setRxHostname(t[0], std::vector<int>{det_id});
os << ToString(t[0]) << '\n';
}
// multiple receivers
else {
if (rx_id != -1) {
throw sls::RuntimeError(
"Cannot add multiple receivers at RR level");
}
det->setRxHostname(t, {det_id});
os << ToString(t) << '\n';
}
}
// single receiver
else {
det->setRxHostname(args[0], std::vector<int>{det_id});
det->setRxHostname(args[0], std::vector<int>{det_id}, rx_id);
os << ToString(args) << '\n';
}
}

View File

@ -185,8 +185,34 @@
return os.str(); \
}
#define INTEGER_COMMAND_VEC_ID_RX(CMDNAME, GETFCN, SETFCN, CONV, HLPSTR) \
std::string CMDNAME(const int action) { \
std::ostringstream os; \
os << cmd << ' '; \
if (action == slsDetectorDefs::HELP_ACTION) \
os << HLPSTR << '\n'; \
else if (action == slsDetectorDefs::GET_ACTION) { \
if (!args.empty()) { \
WrongNumberOfParameters(0); \
} \
auto t = det->GETFCN(std::vector<int>{det_id}, rx_id); \
os << OutString(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
if (args.size() != 1) { \
WrongNumberOfParameters(1); \
} \
auto val = CONV(args[0]); \
det->SETFCN(val, std::vector<int>{det_id}, rx_id); \
os << args.front() << '\n'; \
} else { \
throw sls::RuntimeError("Unknown action"); \
} \
return os.str(); \
}
/** int or enum */
#define INTEGER_COMMAND_VEC_ID_GET(CMDNAME, GETFCN, SETFCN, CONV, HLPSTR) \
#define INTEGER_COMMAND_VEC_ID_PUT_SINGLE_ID(CMDNAME, GETFCN, SETFCN, CONV, \
HLPSTR) \
std::string CMDNAME(const int action) { \
std::ostringstream os; \
os << cmd << ' '; \
@ -211,6 +237,32 @@
return os.str(); \
}
#define INTEGER_COMMAND_VEC_ID_P_RX_SINGLE_ID(CMDNAME, GETFCN, SETFCN, CONV, \
HLPSTR) \
std::string CMDNAME(const int action) { \
std::ostringstream os; \
os << cmd << ' '; \
if (action == slsDetectorDefs::HELP_ACTION) \
os << HLPSTR << '\n'; \
else if (action == slsDetectorDefs::GET_ACTION) { \
if (!args.empty()) { \
WrongNumberOfParameters(0); \
} \
auto t = det->GETFCN(std::vector<int>{det_id}, rx_id); \
os << OutString(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
if (args.size() != 1) { \
WrongNumberOfParameters(1); \
} \
auto val = CONV(args[0]); \
det->SETFCN(val, det_id, rx_id); \
os << args.front() << '\n'; \
} else { \
throw sls::RuntimeError("Unknown action"); \
} \
return os.str(); \
}
/** int or enum */
#define INTEGER_COMMAND_SINGLE_ID(CMDNAME, GETFCN, SETFCN, CONV, HLPSTR) \
std::string CMDNAME(const int action) { \
@ -461,6 +513,26 @@
return os.str(); \
}
#define GET_COMMAND_RX(CMDNAME, GETFCN, HLPSTR) \
std::string CMDNAME(const int action) { \
std::ostringstream os; \
os << cmd << ' '; \
if (action == slsDetectorDefs::HELP_ACTION) \
os << HLPSTR << '\n'; \
else if (action == slsDetectorDefs::GET_ACTION) { \
if (!args.empty()) { \
WrongNumberOfParameters(0); \
} \
auto t = det->GETFCN(std::vector<int>{det_id}); \
os << OutString(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
throw sls::RuntimeError("Cannot put"); \
} else { \
throw sls::RuntimeError("Unknown action"); \
} \
return os.str(); \
}
/** get only no id (vector, not result) */
#define GET_COMMAND_NOID(CMDNAME, GETFCN, HLPSTR) \
std::string CMDNAME(const int action) { \
@ -1282,7 +1354,7 @@ class CmdProxy {
"interfaces must be set to 2. slsReceiver and slsDetectorGui "
"does not handle.");
INTEGER_COMMAND_VEC_ID_GET(
INTEGER_COMMAND_VEC_ID_PUT_SINGLE_ID(
master, getMaster, setMaster, StringTo<int>,
"[0, 1]\n\t[Eiger] Sets half module to master and "
"others to slaves.\n\t[Gotthard][Gotthard2][Mythen3][Eiger] "
@ -1617,14 +1689,14 @@ class CmdProxy {
"[x:x:x:x:x:x]\n\t[Jungfrau] Mac address of the top "
"half or inner (source) udp interface. ");
INTEGER_COMMAND_VEC_ID(
INTEGER_COMMAND_VEC_ID_RX(
udp_dstmac, getDestinationUDPMAC, setDestinationUDPMAC, MacAddr,
"[x:x:x:x:x:x]\n\tMac address of the receiver (destination) udp "
"interface. Not mandatory to set as udp_dstip retrieves it from "
"slsReceiver process, but must be set if you use a custom receiver "
"(not slsReceiver).");
INTEGER_COMMAND_VEC_ID(
INTEGER_COMMAND_VEC_ID_RX(
udp_dstmac2, getDestinationUDPMAC2, setDestinationUDPMAC2, MacAddr,
"[x:x:x:x:x:x]\n\t[Jungfrau] Mac address of the receiver (destination) "
"udp interface 2. Not mandatory to set as udp_dstip2 retrieves it from "
@ -1633,14 +1705,14 @@ class CmdProxy {
"[Gotthard2] veto "
"debugging.");
INTEGER_COMMAND_VEC_ID_GET(
INTEGER_COMMAND_VEC_ID_P_RX_SINGLE_ID(
udp_dstport, getDestinationUDPPort, setDestinationUDPPort,
StringTo<int>,
"[n]\n\tPort number of the receiver (destination) udp "
"interface. Default is 50001. \n\tIf multi command, ports for each "
"module is calculated (incremented by 1 if no 2nd interface)");
INTEGER_COMMAND_VEC_ID_GET(
INTEGER_COMMAND_VEC_ID_P_RX_SINGLE_ID(
udp_dstport2, getDestinationUDPPort2, setDestinationUDPPort2,
StringTo<int>,
"[n]\n\t[Jungfrau][Eiger][Gotthard2] Port number of the "
@ -1662,8 +1734,8 @@ class CmdProxy {
"valid. If not configured, it will throw with error message "
"requesting missing udp information.");
GET_COMMAND(rx_printconfig, printRxConfiguration,
"\n\tPrints the receiver configuration.");
GET_COMMAND_RX(rx_printconfig, printRxConfiguration,
"\n\tPrints the receiver configuration.");
INTEGER_COMMAND_VEC_ID(
tengiga, getTenGiga, setTenGiga, StringTo<int>,
@ -1699,7 +1771,7 @@ class CmdProxy {
/* Receiver Config */
INTEGER_COMMAND_VEC_ID_GET(
INTEGER_COMMAND_VEC_ID_P_RX_SINGLE_ID(
rx_tcpport, getRxPort, setRxPort, StringTo<int>,
"[port]\n\tTCP port for client-receiver communication. Default is "
"1954. Must be different if multiple receivers on same pc. Must be "
@ -1824,7 +1896,7 @@ class CmdProxy {
"default, which streams the first frame in an acquisition, "
"and then depending on the rx zmq frequency/ timer");
INTEGER_COMMAND_VEC_ID_GET(
INTEGER_COMMAND_VEC_ID_PUT_SINGLE_ID(
rx_zmqport, getRxZmqPort, setRxZmqPort, StringTo<int>,
"[port]\n\tZmq port for data to be streamed out of the receiver. Also "
"restarts receiver zmq streaming if enabled. Default is 30001. "
@ -1832,7 +1904,7 @@ class CmdProxy {
"client(gui). Must be different for every detector (and udp port). "
"Multi command will automatically increment for individual modules.");
INTEGER_COMMAND_VEC_ID_GET(
INTEGER_COMMAND_VEC_ID_PUT_SINGLE_ID(
zmqport, getClientZmqPort, setClientZmqPort, StringTo<int>,
"[port]\n\tZmq port in client(gui) or intermediate process for data to "
"be streamed to from receiver. Default connects to receiver zmq "
@ -1842,7 +1914,7 @@ class CmdProxy {
"port). Multi command will automatically increment for individual "
"modules.");
INTEGER_COMMAND_VEC_ID(
INTEGER_COMMAND_VEC_ID_RX(
rx_zmqip, getRxZmqIP, setRxZmqIP, IpAddr,
"[x.x.x.x]\n\tZmq Ip Address from which data is to be streamed out of "
"the receiver. Also restarts receiver zmq streaming if enabled. "

View File

@ -977,67 +977,81 @@ 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);
Result<IpAddr> Detector::getDestinationUDPIP(Positions pos,
const int rx_index) const {
return pimpl->Parallel(&Module::getDestinationUDPIP, pos, rx_index);
}
void Detector::setDestinationUDPIP(const IpAddr ip, Positions pos) {
pimpl->Parallel(&Module::setDestinationUDPIP, pos, ip);
void Detector::setDestinationUDPIP(const IpAddr ip, Positions pos,
const int rx_index) {
pimpl->Parallel(&Module::setDestinationUDPIP, pos, ip, rx_index);
}
Result<IpAddr> Detector::getDestinationUDPIP2(Positions pos) const {
return pimpl->Parallel(&Module::getDestinationUDPIP2, pos);
Result<IpAddr> Detector::getDestinationUDPIP2(Positions pos,
const int rx_index) const {
return pimpl->Parallel(&Module::getDestinationUDPIP2, pos, rx_index);
}
void Detector::setDestinationUDPIP2(const IpAddr ip, Positions pos) {
pimpl->Parallel(&Module::setDestinationUDPIP2, pos, ip);
void Detector::setDestinationUDPIP2(const IpAddr ip, Positions pos,
const int rx_index) {
pimpl->Parallel(&Module::setDestinationUDPIP2, pos, ip, rx_index);
}
Result<MacAddr> Detector::getDestinationUDPMAC(Positions pos) const {
return pimpl->Parallel(&Module::getDestinationUDPMAC, pos);
Result<MacAddr> Detector::getDestinationUDPMAC(Positions pos,
const int rx_index) const {
return pimpl->Parallel(&Module::getDestinationUDPMAC, pos, rx_index);
}
void Detector::setDestinationUDPMAC(const MacAddr mac, Positions pos) {
pimpl->Parallel(&Module::setDestinationUDPMAC, pos, mac);
void Detector::setDestinationUDPMAC(const MacAddr mac, Positions pos,
const int rx_index) {
pimpl->Parallel(&Module::setDestinationUDPMAC, pos, mac, rx_index);
}
Result<MacAddr> Detector::getDestinationUDPMAC2(Positions pos) const {
return pimpl->Parallel(&Module::getDestinationUDPMAC2, pos);
Result<MacAddr> Detector::getDestinationUDPMAC2(Positions pos,
const int rx_index) const {
return pimpl->Parallel(&Module::getDestinationUDPMAC2, pos, rx_index);
}
void Detector::setDestinationUDPMAC2(const MacAddr mac, Positions pos) {
pimpl->Parallel(&Module::setDestinationUDPMAC2, pos, mac);
void Detector::setDestinationUDPMAC2(const MacAddr mac, Positions pos,
const int rx_index) {
pimpl->Parallel(&Module::setDestinationUDPMAC2, pos, mac, rx_index);
}
Result<int> Detector::getDestinationUDPPort(Positions pos) const {
return pimpl->Parallel(&Module::getDestinationUDPPort, pos);
Result<int> Detector::getDestinationUDPPort(Positions pos,
const int rx_index) const {
return pimpl->Parallel(&Module::getDestinationUDPPort, pos, rx_index);
}
void Detector::setDestinationUDPPort(int port, int module_id) {
void Detector::setDestinationUDPPort(int port, int module_id,
const int rx_index) {
if (module_id == -1) {
std::vector<int> port_list = getPortNumbers(port);
for (int idet = 0; idet < size(); ++idet) {
pimpl->Parallel(&Module::setDestinationUDPPort, {idet},
port_list[idet]);
port_list[idet], rx_index);
}
} else {
pimpl->Parallel(&Module::setDestinationUDPPort, {module_id}, port);
pimpl->Parallel(&Module::setDestinationUDPPort, {module_id}, port,
rx_index);
}
}
Result<int> Detector::getDestinationUDPPort2(Positions pos) const {
return pimpl->Parallel(&Module::getDestinationUDPPort2, pos);
Result<int> Detector::getDestinationUDPPort2(Positions pos,
const int rx_index) const {
return pimpl->Parallel(&Module::getDestinationUDPPort2, pos, rx_index);
}
void Detector::setDestinationUDPPort2(int port, int module_id) {
void Detector::setDestinationUDPPort2(int port, int module_id,
const int rx_index) {
if (module_id == -1) {
std::vector<int> port_list = getPortNumbers(port);
for (int idet = 0; idet < size(); ++idet) {
pimpl->Parallel(&Module::setDestinationUDPPort2, {idet},
port_list[idet]);
port_list[idet], rx_index);
}
} else {
pimpl->Parallel(&Module::setDestinationUDPPort2, {module_id}, port);
pimpl->Parallel(&Module::setDestinationUDPPort2, {module_id}, port,
rx_index);
}
}
@ -1049,8 +1063,9 @@ void Detector::validateUDPConfiguration(Positions pos) {
pimpl->Parallel(&Module::validateUDPConfiguration, pos);
}
Result<std::string> Detector::printRxConfiguration(Positions pos) const {
return pimpl->Parallel(&Module::printReceiverConfiguration, pos);
Result<std::string> Detector::printRxConfiguration(Positions pos,
const int rx_index) const {
return pimpl->Parallel(&Module::printReceiverConfiguration, pos, rx_index);
}
Result<bool> Detector::getTenGiga(Positions pos) const {
@ -1099,48 +1114,61 @@ Result<bool> Detector::getUseReceiverFlag(Positions pos) const {
return pimpl->Parallel(&Module::getUseReceiverFlag, pos);
}
Result<std::string> Detector::getRxHostname(Positions pos) const {
return pimpl->Parallel(&Module::getReceiverHostname, pos);
Result<std::string> Detector::getRxHostname(Positions pos,
const int rx_index) const {
return pimpl->Parallel(&Module::getReceiverHostname, pos, rx_index);
}
void Detector::setRxHostname(const std::string &receiver, Positions pos) {
pimpl->Parallel(&Module::setReceiverHostname, pos, receiver);
// rr added using + at module level
void Detector::setRxHostname(const std::string &receiver, Positions pos,
const int rxIndex) {
// for backwards compatibility
if (rxIndex == -1) {
pimpl->Parallel(&Module::setReceiverHostname, pos, receiver, 0);
} else {
pimpl->Parallel(&Module::setReceiverHostname, pos, receiver, rxIndex);
}
updateRxRateCorrections();
}
void Detector::setRxHostname(const std::vector<std::string> &name) {
// set all to same rx_hostname
if (name.size() == 1) {
pimpl->Parallel(&Module::setReceiverHostname, {}, name[0]);
} else {
void Detector::setRxHostname(const std::vector<std::string> &name,
Positions pos) {
// multi module (backwards compatibility: every element for every module)
if (name.size() > 1 && ((pos.empty() || pos[0] == -1))) {
if ((int)name.size() != size()) {
throw RuntimeError(
"Receiver hostnames size " + std::to_string(name.size()) +
" does not match detector size " + std::to_string(size()));
}
// set each rx_hostname
for (int idet = 0; idet < size(); ++idet) {
pimpl->Parallel(&Module::setReceiverHostname, {idet}, name[idet]);
pimpl->Parallel(&Module::setReceiverHostname, {idet}, name[idet],
0);
}
}
// setting rr for specific module (backwards compaibility: single element is
// only for 0th RR)
else {
pimpl->Parallel(&Module::setAllReceiverHostnames, {pos}, name);
}
updateRxRateCorrections();
}
Result<int> Detector::getRxPort(Positions pos) const {
return pimpl->Parallel(&Module::getReceiverPort, pos);
Result<int> Detector::getRxPort(Positions pos, const int rx_index) const {
return pimpl->Parallel(&Module::getReceiverPort, pos, rx_index);
}
void Detector::setRxPort(int port, int module_id) {
void Detector::setRxPort(int port, int module_id, const int rx_index) {
if (module_id == -1) {
std::vector<int> port_list(size());
for (auto &it : port_list) {
it = port++;
}
for (int idet = 0; idet < size(); ++idet) {
pimpl->Parallel(&Module::setReceiverPort, {idet}, port_list[idet]);
pimpl->Parallel(&Module::setReceiverPort, {idet}, port_list[idet],
rx_index);
}
} else {
pimpl->Parallel(&Module::setReceiverPort, {module_id}, port);
pimpl->Parallel(&Module::setReceiverPort, {module_id}, port, rx_index);
}
}
@ -1338,13 +1366,13 @@ void Detector::setRxZmqPort(int port, int module_id) {
}
}
Result<IpAddr> Detector::getRxZmqIP(Positions pos) const {
return pimpl->Parallel(&Module::getReceiverStreamingIP, pos);
Result<IpAddr> Detector::getRxZmqIP(Positions pos, const int rx_index) const {
return pimpl->Parallel(&Module::getReceiverStreamingIP, pos, rx_index);
}
void Detector::setRxZmqIP(const IpAddr ip, Positions pos) {
void Detector::setRxZmqIP(const IpAddr ip, Positions pos, const int rx_index) {
bool previouslyReceiverStreaming = getRxZmqDataStream(pos).squash(false);
pimpl->Parallel(&Module::setReceiverStreamingIP, pos, ip);
pimpl->Parallel(&Module::setReceiverStreamingIP, pos, ip, rx_index);
if (previouslyReceiverStreaming) {
setRxZmqDataStream(false, pos);
setRxZmqDataStream(true, pos);

File diff suppressed because it is too large Load Diff

View File

@ -17,10 +17,15 @@
class ServerInterface;
#define MODULE_SHMAPIVERSION 0x190726
#define MODULE_SHMVERSION 0x200402
#define MODULE_SHMVERSION 0x210913
namespace sls {
struct sharedReceiver {
char hostname[MAX_STR_LENGTH]{};
int tcpPort{};
};
/**
* @short structure allocated in shared memory to store Module settings for
* IPC and cache
@ -45,8 +50,11 @@ struct sharedModule {
slsDetectorDefs::xy nChan;
slsDetectorDefs::xy nChip;
int nDacs;
char rxHostname[MAX_STR_LENGTH];
int rxTCPPort;
/** receiver details for each module */
int numReceivers;
sharedReceiver receivers[MAX_UDP_DESTINATION];
/** if rxHostname and rxTCPPort can be connected to */
bool useReceiverFlag;
/** Listening tcp port from gui (only data) */
@ -236,21 +244,21 @@ class Module : public virtual slsDetectorDefs {
void clearUDPDestinations();
int getFirstUDPDestination() const;
void setFirstUDPDestination(const int value);
sls::IpAddr getDestinationUDPIP() const;
void setDestinationUDPIP(const sls::IpAddr ip);
sls::IpAddr getDestinationUDPIP2() const;
void setDestinationUDPIP2(const sls::IpAddr ip);
sls::MacAddr getDestinationUDPMAC() const;
void setDestinationUDPMAC(const sls::MacAddr mac);
sls::MacAddr getDestinationUDPMAC2() const;
void setDestinationUDPMAC2(const sls::MacAddr mac);
int getDestinationUDPPort() const;
void setDestinationUDPPort(int udpport);
int getDestinationUDPPort2() const;
void setDestinationUDPPort2(int udpport);
sls::IpAddr getDestinationUDPIP(const int rxIndex) const;
void setDestinationUDPIP(const sls::IpAddr ip, const int rxIndex);
sls::IpAddr getDestinationUDPIP2(const int rxIndex) const;
void setDestinationUDPIP2(const sls::IpAddr ip, const int rxIndex);
sls::MacAddr getDestinationUDPMAC(const int rxIndex) const;
void setDestinationUDPMAC(const sls::MacAddr mac, const int rxIndex);
sls::MacAddr getDestinationUDPMAC2(const int rxIndex) const;
void setDestinationUDPMAC2(const sls::MacAddr mac, const int rxIndex);
int getDestinationUDPPort(const int rxIndex) const;
void setDestinationUDPPort(int udpport, const int rxIndex);
int getDestinationUDPPort2(const int rxIndex) const;
void setDestinationUDPPort2(int udpport, const int rxIndex);
void reconfigureUDPDestination();
void validateUDPConfiguration();
std::string printReceiverConfiguration();
std::string printReceiverConfiguration(const int rxIndex);
bool getTenGiga() const;
void setTenGiga(bool value);
bool getTenGigaFlowControl() const;
@ -268,10 +276,11 @@ class Module : public virtual slsDetectorDefs {
* *
* ************************************************/
bool getUseReceiverFlag() const;
std::string getReceiverHostname() const;
void setReceiverHostname(const std::string &receiver);
int getReceiverPort() const;
int setReceiverPort(int port_number);
std::string getReceiverHostname(const int rxIndex) const;
void setAllReceiverHostnames(const std::vector<std::string> &receiver);
void setReceiverHostname(const std::string &receiver, const int rxIndex);
int getReceiverPort(const int rxIndex) const;
void setReceiverPort(int port_number, const int rxIndex);
int getReceiverFifoDepth() const;
void setReceiverFifoDepth(int n_frames);
bool getReceiverSilentMode() const;
@ -330,8 +339,8 @@ class Module : public virtual slsDetectorDefs {
void setReceiverStreamingStartingFrame(int fnum);
int getReceiverStreamingPort() const;
void setReceiverStreamingPort(int port);
sls::IpAddr getReceiverStreamingIP() const;
void setReceiverStreamingIP(const sls::IpAddr ip);
sls::IpAddr getReceiverStreamingIP(const int rxIndex) const;
void setReceiverStreamingIP(const sls::IpAddr ip, const int rxIndex);
int getClientStreamingPort() const;
void setClientStreamingPort(int port);
sls::IpAddr getClientStreamingIP() const;
@ -671,43 +680,52 @@ class Module : public virtual slsDetectorDefs {
Ret sendToDetectorStop(int fnum, const Arg &args) const;
/** Send function parameters to receiver */
void sendToReceiver(int fnum, const void *args, size_t args_size,
void *retval, size_t retval_size);
std::vector<int> getEntryList(const int rxIndex) const;
void sendToReceiver(const int rxIndex, int fnum, const void *args,
size_t args_size, void *retval, size_t retval_size);
void sendToReceiver(int fnum, const void *args, size_t args_size,
void *retval, size_t retval_size) const;
void sendToReceiver(const int rxIndex, int fnum, const void *args,
size_t args_size, void *retval,
size_t retval_size) const;
template <typename Arg, typename Ret>
void sendToReceiver(int fnum, const Arg &args, Ret &retval);
void sendToReceiver(const int rxIndex, int fnum, const Arg &args,
Ret &retval);
template <typename Arg, typename Ret>
void sendToReceiver(int fnum, const Arg &args, Ret &retval) const;
void sendToReceiver(const int rxIndex, int fnum, const Arg &args,
Ret &retval) const;
template <typename Arg>
void sendToReceiver(int fnum, const Arg &args, std::nullptr_t);
void sendToReceiver(const int rxIndex, int fnum, const Arg &args,
std::nullptr_t);
template <typename Arg>
void sendToReceiver(int fnum, const Arg &args, std::nullptr_t) const;
void sendToReceiver(const int rxIndex, int fnum, const Arg &args,
std::nullptr_t) const;
template <typename Ret>
void sendToReceiver(int fnum, std::nullptr_t, Ret &retval);
void sendToReceiver(const int rxIndex, int fnum, std::nullptr_t,
Ret &retval);
template <typename Ret>
void sendToReceiver(int fnum, std::nullptr_t, Ret &retval) const;
void sendToReceiver(const int rxIndex, int fnum, std::nullptr_t,
Ret &retval) const;
template <typename Ret> Ret sendToReceiver(int fnum);
template <typename Ret> Ret sendToReceiver(const int rxIndex, int fnum);
template <typename Ret> Ret sendToReceiver(int fnum) const;
template <typename Ret>
Ret sendToReceiver(const int rxIndex, int fnum) const;
void sendToReceiver(int fnum);
void sendToReceiver(const int rxIndex, int fnum);
void sendToReceiver(int fnum) const;
void sendToReceiver(const int rxIndex, int fnum) const;
template <typename Ret, typename Arg>
Ret sendToReceiver(int fnum, const Arg &args);
Ret sendToReceiver(const int rxIndex, int fnum, const Arg &args);
template <typename Ret, typename Arg>
Ret sendToReceiver(int fnum, const Arg &args) const;
Ret sendToReceiver(const int rxIndex, int fnum, const Arg &args) const;
/** Get Detector Type from Shared Memory
verify is if shm size matches existing one */
@ -725,7 +743,7 @@ class Module : public virtual slsDetectorDefs {
void checkReceiverVersionCompatibility();
void setModule(sls_detector_module &module, bool trimbits = true);
int sendModule(sls_detector_module *myMod, sls::ClientSocket &client);
void updateReceiverStreamingIP();
void updateReceiverStreamingIP(const int rxIndex);
void updateRateCorrection();
/** Template function to do linear interpolation between two points (Eiger

View File

@ -1,15 +1,15 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
/** API versions */
#define GITBRANCH "developer"
#define APILIB 0x211125
#define APIRECEIVER 0x211124
#define APIGUI 0x211124
#define GITBRANCH "developer"
#define APILIB 0x211125
#define APIRECEIVER 0x211124
#define APIGUI 0x211124
#define APICTB 0x220318
#define APIGOTTHARD 0x220318
#define APIGOTTHARD2 0x220318
#define APIJUNGFRAU 0x220318
#define APIMYTHEN3 0x220318
#define APIMOENCH 0x220318
#define APIEIGER 0x220318
#define APICTB 0x220902
#define APIGOTTHARD 0x220902
#define APIGOTTHARD2 0x220902
#define APIJUNGFRAU 0x220902
#define APIMYTHEN3 0x220902
#define APIMOENCH 0x220902
#define APIEIGER 0x220902