mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-29 17:40:01 +02:00
fixed
This commit is contained in:
parent
3ebb3e7508
commit
630b7cd539
@ -1077,7 +1077,8 @@ Result<std::string> Detector::getRxHostname(Positions pos,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// rr added using + at module level
|
// rr added using + at module level
|
||||||
void Detector::setRxHostname(const std::string &receiver, Positions pos, const int rxIndex) {
|
void Detector::setRxHostname(const std::string &receiver, Positions pos,
|
||||||
|
const int rxIndex) {
|
||||||
// for backwards compatibility
|
// for backwards compatibility
|
||||||
if (rxIndex == -1) {
|
if (rxIndex == -1) {
|
||||||
pimpl->Parallel(&Module::setReceiverHostname, pos, receiver, 0);
|
pimpl->Parallel(&Module::setReceiverHostname, pos, receiver, 0);
|
||||||
@ -1087,7 +1088,8 @@ void Detector::setRxHostname(const std::string &receiver, Positions pos, const i
|
|||||||
updateRxRateCorrections();
|
updateRxRateCorrections();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setRxHostname(const std::vector<std::string> &name, Positions pos) {
|
void Detector::setRxHostname(const std::vector<std::string> &name,
|
||||||
|
Positions pos) {
|
||||||
// multi module (backwards compatibility: every element for every module)
|
// multi module (backwards compatibility: every element for every module)
|
||||||
if (name.size() > 1 && ((pos.empty() || pos[0] == -1))) {
|
if (name.size() > 1 && ((pos.empty() || pos[0] == -1))) {
|
||||||
if ((int)name.size() != size()) {
|
if ((int)name.size() != size()) {
|
||||||
@ -1096,10 +1098,12 @@ void Detector::setRxHostname(const std::vector<std::string> &name, Positions pos
|
|||||||
" does not match detector size " + std::to_string(size()));
|
" does not match detector size " + std::to_string(size()));
|
||||||
}
|
}
|
||||||
for (int idet = 0; idet < size(); ++idet) {
|
for (int idet = 0; idet < size(); ++idet) {
|
||||||
pimpl->Parallel(&Module::setReceiverHostname, {idet}, name[idet], 0);
|
pimpl->Parallel(&Module::setReceiverHostname, {idet}, name[idet],
|
||||||
|
0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// setting rr for specific module (backwards compaibility: single element is only for 0th RR)
|
// setting rr for specific module (backwards compaibility: single element is
|
||||||
|
// only for 0th RR)
|
||||||
else {
|
else {
|
||||||
pimpl->Parallel(&Module::setAllReceiverHostnames, {pos}, name);
|
pimpl->Parallel(&Module::setAllReceiverHostnames, {pos}, name);
|
||||||
}
|
}
|
||||||
|
@ -1015,9 +1015,14 @@ void Module::setFirstUDPDestination(const int value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sls::IpAddr Module::getDestinationUDPIP(const int rxIndex) const {
|
sls::IpAddr Module::getDestinationUDPIP(const int rxIndex) const {
|
||||||
|
if (rxIndex < 0 || rxIndex >= MAX_UDP_DESTINATION) {
|
||||||
|
throw RuntimeError("Invalid receiver index");
|
||||||
|
}
|
||||||
|
|
||||||
if (rxIndex == 0) {
|
if (rxIndex == 0) {
|
||||||
return sendToDetector<sls::IpAddr>(F_GET_DEST_UDP_IP);
|
return sendToDetector<sls::IpAddr>(F_GET_DEST_UDP_IP);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto t = getDestinationUDPList(rxIndex);
|
auto t = getDestinationUDPList(rxIndex);
|
||||||
return t.ip;
|
return t.ip;
|
||||||
}
|
}
|
||||||
@ -1027,29 +1032,37 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
throw RuntimeError("Invalid destination udp ip address");
|
throw RuntimeError("Invalid destination udp ip address");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rxIndex == 0) {
|
std::vector<int> entries = getEntryList(rxIndex);
|
||||||
sendToDetector(F_SET_DEST_UDP_IP, ip, nullptr);
|
for (int iEntry = 0; iEntry != (int)entries.size(); ++iEntry) {
|
||||||
} else {
|
if (entries[iEntry] == 0) {
|
||||||
auto t = getDestinationUDPList(rxIndex);
|
sendToDetector(F_SET_DEST_UDP_IP, ip, nullptr);
|
||||||
t.ip = ip;
|
|
||||||
setDestinationUDPList(t);
|
|
||||||
}
|
|
||||||
if (shm()->useReceiverFlag) {
|
|
||||||
sls::MacAddr retval(0LU);
|
|
||||||
sendToReceiver(rxIndex, F_SET_RECEIVER_UDP_IP, ip, retval);
|
|
||||||
LOG(logINFO) << "Setting destination udp mac of Module [" << moduleIndex
|
|
||||||
<< ", " << rxIndex << "] to " << retval;
|
|
||||||
if (rxIndex == 0) {
|
|
||||||
sendToDetector(F_SET_DEST_UDP_MAC, retval, nullptr);
|
|
||||||
} else {
|
} else {
|
||||||
auto t = getDestinationUDPList(rxIndex);
|
auto t = getDestinationUDPList(entries[iEntry]);
|
||||||
t.mac = retval;
|
t.ip = ip;
|
||||||
setDestinationUDPList(t);
|
setDestinationUDPList(t);
|
||||||
}
|
}
|
||||||
|
if (shm()->useReceiverFlag) {
|
||||||
|
sls::MacAddr retval(0LU);
|
||||||
|
sendToReceiver(entries[iEntry], F_SET_RECEIVER_UDP_IP, ip, retval);
|
||||||
|
LOG(logINFO) << "Setting destination udp mac of Module ["
|
||||||
|
<< moduleIndex << ", " << entries[iEntry] << "] to "
|
||||||
|
<< retval;
|
||||||
|
if (entries[iEntry] == 0) {
|
||||||
|
sendToDetector(F_SET_DEST_UDP_MAC, retval, nullptr);
|
||||||
|
} else {
|
||||||
|
auto t = getDestinationUDPList(entries[iEntry]);
|
||||||
|
t.mac = retval;
|
||||||
|
setDestinationUDPList(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sls::IpAddr Module::getDestinationUDPIP2(const int rxIndex) const {
|
sls::IpAddr Module::getDestinationUDPIP2(const int rxIndex) const {
|
||||||
|
if (rxIndex < 0 || rxIndex >= MAX_UDP_DESTINATION) {
|
||||||
|
throw RuntimeError("Invalid receiver index");
|
||||||
|
}
|
||||||
|
|
||||||
if (rxIndex == 0) {
|
if (rxIndex == 0) {
|
||||||
return sendToDetector<sls::IpAddr>(F_GET_DEST_UDP_IP2);
|
return sendToDetector<sls::IpAddr>(F_GET_DEST_UDP_IP2);
|
||||||
}
|
}
|
||||||
@ -1063,30 +1076,38 @@ void Module::setDestinationUDPIP2(const IpAddr ip, const int rxIndex) {
|
|||||||
throw RuntimeError("Invalid destination udp ip address2");
|
throw RuntimeError("Invalid destination udp ip address2");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rxIndex == 0) {
|
std::vector<int> entries = getEntryList(rxIndex);
|
||||||
sendToDetector(F_SET_DEST_UDP_IP2, ip, nullptr);
|
for (int iEntry = 0; iEntry != (int)entries.size(); ++iEntry) {
|
||||||
} else {
|
if (entries[iEntry] == 0) {
|
||||||
auto t = getDestinationUDPList(rxIndex);
|
sendToDetector(F_SET_DEST_UDP_IP2, ip, nullptr);
|
||||||
t.ip2 = ip;
|
|
||||||
setDestinationUDPList(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shm()->useReceiverFlag) {
|
|
||||||
sls::MacAddr retval(0LU);
|
|
||||||
sendToReceiver(rxIndex, F_SET_RECEIVER_UDP_IP2, ip, retval);
|
|
||||||
LOG(logINFO) << "Setting destination udp mac2 of Module " << moduleIndex
|
|
||||||
<< " to " << retval;
|
|
||||||
if (rxIndex == 0) {
|
|
||||||
sendToDetector(F_SET_DEST_UDP_MAC2, retval, nullptr);
|
|
||||||
} else {
|
} else {
|
||||||
auto t = getDestinationUDPList(rxIndex);
|
auto t = getDestinationUDPList(entries[iEntry]);
|
||||||
t.mac2 = retval;
|
t.ip2 = ip;
|
||||||
setDestinationUDPList(t);
|
setDestinationUDPList(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (shm()->useReceiverFlag) {
|
||||||
|
sls::MacAddr retval(0LU);
|
||||||
|
sendToReceiver(entries[iEntry], F_SET_RECEIVER_UDP_IP2, ip, retval);
|
||||||
|
LOG(logINFO) << "Setting destination udp mac2 of Module "
|
||||||
|
<< moduleIndex << ", " << entries[iEntry] << "] to "
|
||||||
|
<< retval;
|
||||||
|
if (entries[iEntry] == 0) {
|
||||||
|
sendToDetector(F_SET_DEST_UDP_MAC2, retval, nullptr);
|
||||||
|
} else {
|
||||||
|
auto t = getDestinationUDPList(entries[iEntry]);
|
||||||
|
t.mac2 = retval;
|
||||||
|
setDestinationUDPList(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sls::MacAddr Module::getDestinationUDPMAC(const int rxIndex) const {
|
sls::MacAddr Module::getDestinationUDPMAC(const int rxIndex) const {
|
||||||
|
if (rxIndex < 0 || rxIndex >= MAX_UDP_DESTINATION) {
|
||||||
|
throw RuntimeError("Invalid receiver index");
|
||||||
|
}
|
||||||
|
|
||||||
if (rxIndex == 0) {
|
if (rxIndex == 0) {
|
||||||
return sendToDetector<sls::MacAddr>(F_GET_DEST_UDP_MAC);
|
return sendToDetector<sls::MacAddr>(F_GET_DEST_UDP_MAC);
|
||||||
}
|
}
|
||||||
@ -1098,16 +1119,23 @@ void Module::setDestinationUDPMAC(const MacAddr mac, const int rxIndex) {
|
|||||||
if (mac == 0) {
|
if (mac == 0) {
|
||||||
throw RuntimeError("Invalid destination udp mac address");
|
throw RuntimeError("Invalid destination udp mac address");
|
||||||
}
|
}
|
||||||
if (rxIndex == 0) {
|
std::vector<int> entries = getEntryList(rxIndex);
|
||||||
sendToDetector(F_SET_DEST_UDP_MAC, mac, nullptr);
|
for (int iEntry = 0; iEntry != (int)entries.size(); ++iEntry) {
|
||||||
} else {
|
if (entries[iEntry] == 0) {
|
||||||
auto t = getDestinationUDPList(rxIndex);
|
sendToDetector(F_SET_DEST_UDP_MAC, mac, nullptr);
|
||||||
t.mac = mac;
|
} else {
|
||||||
setDestinationUDPList(t);
|
auto t = getDestinationUDPList(entries[iEntry]);
|
||||||
|
t.mac = mac;
|
||||||
|
setDestinationUDPList(t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sls::MacAddr Module::getDestinationUDPMAC2(const int rxIndex) const {
|
sls::MacAddr Module::getDestinationUDPMAC2(const int rxIndex) const {
|
||||||
|
if (rxIndex < 0 || rxIndex >= MAX_UDP_DESTINATION) {
|
||||||
|
throw RuntimeError("Invalid receiver index");
|
||||||
|
}
|
||||||
|
|
||||||
if (rxIndex == 0) {
|
if (rxIndex == 0) {
|
||||||
return sendToDetector<sls::MacAddr>(F_GET_DEST_UDP_MAC2);
|
return sendToDetector<sls::MacAddr>(F_GET_DEST_UDP_MAC2);
|
||||||
}
|
}
|
||||||
@ -1119,16 +1147,22 @@ void Module::setDestinationUDPMAC2(const MacAddr mac, const int rxIndex) {
|
|||||||
if (mac == 0) {
|
if (mac == 0) {
|
||||||
throw RuntimeError("Invalid desinaion udp mac address2");
|
throw RuntimeError("Invalid desinaion udp mac address2");
|
||||||
}
|
}
|
||||||
if (rxIndex == 0) {
|
std::vector<int> entries = getEntryList(rxIndex);
|
||||||
sendToDetector(F_SET_DEST_UDP_MAC2, mac, nullptr);
|
for (int iEntry = 0; iEntry != (int)entries.size(); ++iEntry) {
|
||||||
} else {
|
if (entries[iEntry] == 0) {
|
||||||
auto t = getDestinationUDPList(rxIndex);
|
sendToDetector(F_SET_DEST_UDP_MAC2, mac, nullptr);
|
||||||
t.mac2 = mac;
|
} else {
|
||||||
setDestinationUDPList(t);
|
auto t = getDestinationUDPList(entries[iEntry]);
|
||||||
|
t.mac2 = mac;
|
||||||
|
setDestinationUDPList(t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Module::getDestinationUDPPort(const int rxIndex) const {
|
int Module::getDestinationUDPPort(const int rxIndex) const {
|
||||||
|
if (rxIndex < 0 || rxIndex >= MAX_UDP_DESTINATION) {
|
||||||
|
throw RuntimeError("Invalid receiver index");
|
||||||
|
}
|
||||||
if (rxIndex == 0) {
|
if (rxIndex == 0) {
|
||||||
return sendToDetector<int>(F_GET_DEST_UDP_PORT);
|
return sendToDetector<int>(F_GET_DEST_UDP_PORT);
|
||||||
}
|
}
|
||||||
@ -1137,19 +1171,26 @@ int Module::getDestinationUDPPort(const int rxIndex) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Module::setDestinationUDPPort(const int port, const int rxIndex) {
|
void Module::setDestinationUDPPort(const int port, const int rxIndex) {
|
||||||
if (rxIndex == 0) {
|
std::vector<int> entries = getEntryList(rxIndex);
|
||||||
sendToDetector(F_SET_DEST_UDP_PORT, port, nullptr);
|
for (int iEntry = 0; iEntry != (int)entries.size(); ++iEntry) {
|
||||||
} else {
|
if (entries[iEntry] == 0) {
|
||||||
auto t = getDestinationUDPList(rxIndex);
|
sendToDetector(F_SET_DEST_UDP_PORT, port, nullptr);
|
||||||
t.port = port;
|
} else {
|
||||||
setDestinationUDPList(t);
|
auto t = getDestinationUDPList(entries[iEntry]);
|
||||||
}
|
t.port = port;
|
||||||
if (shm()->useReceiverFlag) {
|
setDestinationUDPList(t);
|
||||||
sendToReceiver(rxIndex, F_SET_RECEIVER_UDP_PORT, port, nullptr);
|
}
|
||||||
|
if (shm()->useReceiverFlag) {
|
||||||
|
sendToReceiver(entries[iEntry], F_SET_RECEIVER_UDP_PORT, port,
|
||||||
|
nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Module::getDestinationUDPPort2(const int rxIndex) const {
|
int Module::getDestinationUDPPort2(const int rxIndex) const {
|
||||||
|
if (rxIndex < 0 || rxIndex >= MAX_UDP_DESTINATION) {
|
||||||
|
throw RuntimeError("Invalid receiver index");
|
||||||
|
}
|
||||||
if (rxIndex == 0) {
|
if (rxIndex == 0) {
|
||||||
return sendToDetector<int>(F_GET_DEST_UDP_PORT2);
|
return sendToDetector<int>(F_GET_DEST_UDP_PORT2);
|
||||||
}
|
}
|
||||||
@ -1158,15 +1199,19 @@ int Module::getDestinationUDPPort2(const int rxIndex) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Module::setDestinationUDPPort2(const int port, const int rxIndex) {
|
void Module::setDestinationUDPPort2(const int port, const int rxIndex) {
|
||||||
if (rxIndex == 0) {
|
std::vector<int> entries = getEntryList(rxIndex);
|
||||||
sendToDetector(F_SET_DEST_UDP_PORT2, port, nullptr);
|
for (int iEntry = 0; iEntry != (int)entries.size(); ++iEntry) {
|
||||||
} else {
|
if (entries[iEntry] == 0) {
|
||||||
auto t = getDestinationUDPList(rxIndex);
|
sendToDetector(F_SET_DEST_UDP_PORT2, port, nullptr);
|
||||||
t.port2 = port;
|
} else {
|
||||||
setDestinationUDPList(t);
|
auto t = getDestinationUDPList(entries[iEntry]);
|
||||||
}
|
t.port2 = port;
|
||||||
if (shm()->useReceiverFlag) {
|
setDestinationUDPList(t);
|
||||||
sendToReceiver(rxIndex, F_SET_RECEIVER_UDP_PORT2, port, nullptr);
|
}
|
||||||
|
if (shm()->useReceiverFlag) {
|
||||||
|
sendToReceiver(entries[iEntry], F_SET_RECEIVER_UDP_PORT2, port,
|
||||||
|
nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1178,30 +1223,33 @@ void Module::validateUDPConfiguration() {
|
|||||||
|
|
||||||
std::string Module::printReceiverConfiguration(const int rxIndex) {
|
std::string Module::printReceiverConfiguration(const int rxIndex) {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "\n\nModule " << moduleIndex << "\nReceiver [" << rxIndex
|
std::vector<int> entries = getEntryList(rxIndex);
|
||||||
<< "] Hostname:\t" << getReceiverHostname(rxIndex);
|
for (int iEntry = 0; iEntry != (int)entries.size(); ++iEntry) {
|
||||||
|
os << "\n\nModule " << moduleIndex << "\nReceiver [" << entries[iEntry]
|
||||||
|
<< "] Hostname:\t" << getReceiverHostname(entries[iEntry]);
|
||||||
|
|
||||||
if (shm()->detType == JUNGFRAU) {
|
if (shm()->detType == JUNGFRAU) {
|
||||||
os << "\nNumber of Interfaces:\t" << getNumberofUDPInterfaces()
|
os << "\nNumber of Interfaces:\t" << getNumberofUDPInterfaces()
|
||||||
<< "\nSelected Interface:\t" << getSelectedUDPInterface();
|
<< "\nSelected Interface:\t" << getSelectedUDPInterface();
|
||||||
}
|
}
|
||||||
auto t = getDestinationUDPList(rxIndex);
|
auto t = getDestinationUDPList(entries[iEntry]);
|
||||||
|
|
||||||
os << "\nSource UDP IP:\t" << getSourceUDPIP() << "\nSource UDP MAC:\t"
|
os << "\nSource UDP IP:\t" << getSourceUDPIP() << "\nSource UDP MAC:\t"
|
||||||
<< getSourceUDPMAC() << "\nDestination UDP IP:\t" << t.ip
|
<< getSourceUDPMAC() << "\nDestination UDP IP:\t" << t.ip
|
||||||
<< "\nDestination UDP MAC:\t" << t.mac;
|
<< "\nDestination UDP MAC:\t" << t.mac;
|
||||||
|
|
||||||
if (shm()->detType == JUNGFRAU) {
|
if (shm()->detType == JUNGFRAU) {
|
||||||
os << "\nSource UDP IP2:\t" << getSourceUDPIP2()
|
os << "\nSource UDP IP2:\t" << getSourceUDPIP2()
|
||||||
<< "\nSource UDP MAC2:\t" << getSourceUDPMAC2()
|
<< "\nSource UDP MAC2:\t" << getSourceUDPMAC2()
|
||||||
<< "\nDestination UDP IP2:\t" << t.ip2 << "\nDestination UDP MAC2:\t"
|
<< "\nDestination UDP IP2:\t" << t.ip2
|
||||||
<< t.mac2;
|
<< "\nDestination UDP MAC2:\t" << t.mac2;
|
||||||
|
}
|
||||||
|
os << "\nDestination UDP Port:\t" << t.port;
|
||||||
|
if (shm()->detType == JUNGFRAU || shm()->detType == EIGER) {
|
||||||
|
os << "\nDestination UDP Port2:\t" << t.port2;
|
||||||
|
}
|
||||||
|
os << "\n";
|
||||||
}
|
}
|
||||||
os << "\nDestination UDP Port:\t" << t.port;
|
|
||||||
if (shm()->detType == JUNGFRAU || shm()->detType == EIGER) {
|
|
||||||
os << "\nDestination UDP Port2:\t" << t.port2;
|
|
||||||
}
|
|
||||||
os << "\n";
|
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1267,7 +1315,9 @@ void Module::setAllReceiverHostnames(const std::vector<std::string> &receiver) {
|
|||||||
} else {
|
} else {
|
||||||
if (receiver.size() >= MAX_UDP_DESTINATION) {
|
if (receiver.size() >= MAX_UDP_DESTINATION) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "Receiver hostnames size " << receiver.size() << " exceeded max " << MAX_UDP_DESTINATION << " entries allowed.";
|
oss << "Receiver hostnames size " << receiver.size()
|
||||||
|
<< " exceeded max " << MAX_UDP_DESTINATION
|
||||||
|
<< " entries allowed.";
|
||||||
throw RuntimeError(oss.str());
|
throw RuntimeError(oss.str());
|
||||||
}
|
}
|
||||||
for (size_t irr = 0; irr < receiver.size(); ++irr) {
|
for (size_t irr = 0; irr < receiver.size(); ++irr) {
|
||||||
@ -1276,9 +1326,11 @@ void Module::setAllReceiverHostnames(const std::vector<std::string> &receiver) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::setReceiverHostname(const std::string &receiverIP, const int rxIndex) {
|
void Module::setReceiverHostname(const std::string &receiverIP,
|
||||||
|
const int rxIndex) {
|
||||||
if (rxIndex < 0 || rxIndex >= MAX_UDP_DESTINATION) {
|
if (rxIndex < 0 || rxIndex >= MAX_UDP_DESTINATION) {
|
||||||
throw RuntimeError(std::string("Invalid receiver Index") + std::to_string(rxIndex));
|
throw RuntimeError(std::string("Invalid receiver Index") +
|
||||||
|
std::to_string(rxIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getRunStatus() == RUNNING) {
|
if (getRunStatus() == RUNNING) {
|
||||||
@ -1286,9 +1338,8 @@ void Module::setReceiverHostname(const std::string &receiverIP, const int rxInde
|
|||||||
"Cannot set rx hostname when detector is acquiring.");
|
"Cannot set rx hostname when detector is acquiring.");
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(logDEBUG1) << "Setting up Receiver " << rxIndex << " with " << receiverIP;
|
LOG(logDEBUG1) << "Setting up Receiver " << rxIndex << " with "
|
||||||
|
<< receiverIP;
|
||||||
|
|
||||||
|
|
||||||
// clear current receiver for current module
|
// clear current receiver for current module
|
||||||
memset(shm()->receivers[rxIndex].hostname, 0, MAX_STR_LENGTH);
|
memset(shm()->receivers[rxIndex].hostname, 0, MAX_STR_LENGTH);
|
||||||
@ -1338,13 +1389,13 @@ void Module::setReceiverHostname(const std::string &receiverIP, const int rxInde
|
|||||||
if (retval.udp_dstmac == 0 && retvals[0] != 0) {
|
if (retval.udp_dstmac == 0 && retvals[0] != 0) {
|
||||||
LOG(logINFO) << "Setting destination udp mac of "
|
LOG(logINFO) << "Setting destination udp mac of "
|
||||||
"Module "
|
"Module "
|
||||||
<< moduleIndex << " to " << retvals[0];
|
<< moduleIndex << " to " << retvals[0];
|
||||||
sendToDetector(F_SET_DEST_UDP_MAC, retvals[0], nullptr);
|
sendToDetector(F_SET_DEST_UDP_MAC, retvals[0], nullptr);
|
||||||
}
|
}
|
||||||
if (retval.udp_dstmac2 == 0 && retvals[1] != 0) {
|
if (retval.udp_dstmac2 == 0 && retvals[1] != 0) {
|
||||||
LOG(logINFO) << "Setting destination udp mac2 of "
|
LOG(logINFO) << "Setting destination udp mac2 of "
|
||||||
"Module "
|
"Module "
|
||||||
<< moduleIndex << " to " << retvals[1];
|
<< moduleIndex << " to " << retvals[1];
|
||||||
sendToDetector(F_SET_DEST_UDP_MAC2, retvals[1], nullptr);
|
sendToDetector(F_SET_DEST_UDP_MAC2, retvals[1], nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1356,14 +1407,19 @@ void Module::setReceiverHostname(const std::string &receiverIP, const int rxInde
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Module::getReceiverPort(const int rxIndex) const {
|
int Module::getReceiverPort(const int rxIndex) const {
|
||||||
|
if (rxIndex < 0 || rxIndex >= MAX_UDP_DESTINATION) {
|
||||||
|
throw RuntimeError("Invalid receiver index");
|
||||||
|
}
|
||||||
return shm()->receivers[rxIndex].tcpPort;
|
return shm()->receivers[rxIndex].tcpPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Module::setReceiverPort(int port_number, const int rxIndex) {
|
void Module::setReceiverPort(int port_number, const int rxIndex) {
|
||||||
if (port_number >= 0 && port_number != shm()->receivers[rxIndex].tcpPort) {
|
std::vector<int> entries = getEntryList(rxIndex);
|
||||||
shm()->receivers[rxIndex].tcpPort = port_number;
|
for (int iEntry = 0; iEntry != (int)entries.size(); ++iEntry) {
|
||||||
|
if (port_number >= 0) {
|
||||||
|
shm()->receivers[entries[iEntry]].tcpPort = port_number;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return shm()->receivers[rxIndex].tcpPort;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Module::getReceiverFifoDepth() const {
|
int Module::getReceiverFifoDepth() const {
|
||||||
@ -1613,6 +1669,9 @@ void Module::setReceiverStreamingPort(int port) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sls::IpAddr Module::getReceiverStreamingIP(const int rxIndex) const {
|
sls::IpAddr Module::getReceiverStreamingIP(const int rxIndex) const {
|
||||||
|
if (rxIndex < 0 || rxIndex >= MAX_UDP_DESTINATION) {
|
||||||
|
throw RuntimeError("Invalid receiver index");
|
||||||
|
}
|
||||||
return sendToReceiver<sls::IpAddr>(rxIndex,
|
return sendToReceiver<sls::IpAddr>(rxIndex,
|
||||||
F_GET_RECEIVER_STREAMING_SRC_IP);
|
F_GET_RECEIVER_STREAMING_SRC_IP);
|
||||||
}
|
}
|
||||||
@ -1625,7 +1684,11 @@ void Module::setReceiverStreamingIP(const sls::IpAddr ip, const int rxIndex) {
|
|||||||
if (shm()->zmqip == 0) {
|
if (shm()->zmqip == 0) {
|
||||||
shm()->zmqip = ip;
|
shm()->zmqip = ip;
|
||||||
}
|
}
|
||||||
sendToReceiver(rxIndex, F_SET_RECEIVER_STREAMING_SRC_IP, ip, nullptr);
|
std::vector<int> entries = getEntryList(rxIndex);
|
||||||
|
for (int iEntry = 0; iEntry != (int)entries.size(); ++iEntry) {
|
||||||
|
sendToReceiver(entries[iEntry], F_SET_RECEIVER_STREAMING_SRC_IP, ip,
|
||||||
|
nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Module::getClientStreamingPort() const { return shm()->zmqport; }
|
int Module::getClientStreamingPort() const { return shm()->zmqport; }
|
||||||
@ -2975,13 +3038,14 @@ Ret Module::sendToDetector(int fnum, const Arg &args) {
|
|||||||
return static_cast<const Module &>(*this).sendToDetector<Ret>(fnum, args);
|
return static_cast<const Module &>(*this).sendToDetector<Ret>(fnum, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------- sendToDetectorStop
|
//----------------------------------------------------------
|
||||||
|
// sendToDetectorStop
|
||||||
|
|
||||||
void Module::sendToDetectorStop(int fnum, const void *args, size_t args_size,
|
void Module::sendToDetectorStop(int fnum, const void *args, size_t args_size,
|
||||||
void *retval, size_t retval_size) const {
|
void *retval, size_t retval_size) const {
|
||||||
// This is the only function that actually sends data to the detector stop
|
// This is the only function that actually sends data to the detector
|
||||||
// the other versions use templates to deduce sizes and create
|
// stop the other versions use templates to deduce sizes and create the
|
||||||
// the return type
|
// return type
|
||||||
checkArgs(args, args_size, retval, retval_size);
|
checkArgs(args, args_size, retval, retval_size);
|
||||||
auto stop = DetectorSocket(shm()->hostname, shm()->stopPort);
|
auto stop = DetectorSocket(shm()->hostname, shm()->stopPort);
|
||||||
stop.sendCommandThenRead(fnum, args, args_size, retval, retval_size);
|
stop.sendCommandThenRead(fnum, args, args_size, retval, retval_size);
|
||||||
@ -3091,7 +3155,29 @@ Ret Module::sendToDetectorStop(int fnum, const Arg &args) {
|
|||||||
args);
|
args);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- sendToReceiver
|
//--------------------------------------------------------------
|
||||||
|
// sendToReceiver
|
||||||
|
|
||||||
|
std::vector<int> Module::getEntryList(const int rxIndex) const {
|
||||||
|
if (rxIndex >= MAX_UDP_DESTINATION) {
|
||||||
|
throw RuntimeError("Invalid destination index " +
|
||||||
|
std::to_string(rxIndex));
|
||||||
|
}
|
||||||
|
std::vector<int> list;
|
||||||
|
int startReceiver = 0;
|
||||||
|
int endReceiver = MAX_UDP_DESTINATION;
|
||||||
|
if (rxIndex >= 0) {
|
||||||
|
startReceiver = rxIndex;
|
||||||
|
endReceiver = rxIndex + 1;
|
||||||
|
}
|
||||||
|
for (int i = startReceiver; i != endReceiver; ++i) {
|
||||||
|
if (!strcmp(shm()->receivers[i].hostname, "none")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
list.push_back(i);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
void Module::sendToReceiver(const int rxIndex, int fnum, const void *args,
|
void Module::sendToReceiver(const int rxIndex, int fnum, const void *args,
|
||||||
size_t args_size, void *retval,
|
size_t args_size, void *retval,
|
||||||
@ -3106,32 +3192,24 @@ void Module::sendToReceiver(const int rxIndex, int fnum, const void *args,
|
|||||||
throw RuntimeError(oss.str());
|
throw RuntimeError(oss.str());
|
||||||
}
|
}
|
||||||
checkArgs(args, args_size, retval, retval_size);
|
checkArgs(args, args_size, retval, retval_size);
|
||||||
if (rxIndex >= MAX_UDP_DESTINATION) {
|
std::vector<int> entries = getEntryList(rxIndex);
|
||||||
throw RuntimeError("Invalid destination index " +
|
for (int i = 0; i != (int)entries.size(); ++i) {
|
||||||
std::to_string(rxIndex));
|
if (!strcmp(shm()->receivers[entries[i]].hostname, "none")) {
|
||||||
}
|
|
||||||
int startReceiver = 0;
|
|
||||||
int endReceiver = MAX_UDP_DESTINATION;
|
|
||||||
if (rxIndex > 0) {
|
|
||||||
startReceiver = rxIndex;
|
|
||||||
endReceiver = rxIndex + 1;
|
|
||||||
}
|
|
||||||
for (int i = startReceiver; i != endReceiver; ++i) {
|
|
||||||
if (!strcmp(shm()->receivers[i].hostname, "none")) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
LOG(logDEBUG1) << "Receiver [" << shm()->receivers[i].hostname << ", "
|
LOG(logDEBUG1) << "Receiver [" << shm()->receivers[entries[i]].hostname
|
||||||
<< shm()->receivers[i].tcpPort << ']';
|
<< ", " << shm()->receivers[entries[i]].tcpPort << ']';
|
||||||
try {
|
try {
|
||||||
auto receiver = ReceiverSocket(shm()->receivers[i].hostname,
|
auto receiver =
|
||||||
shm()->receivers[i].tcpPort);
|
ReceiverSocket(shm()->receivers[entries[i]].hostname,
|
||||||
|
shm()->receivers[entries[i]].tcpPort);
|
||||||
receiver.sendCommandThenRead(fnum, args, args_size, retval,
|
receiver.sendCommandThenRead(fnum, args, args_size, retval,
|
||||||
retval_size);
|
retval_size);
|
||||||
receiver.close();
|
receiver.close();
|
||||||
} catch (ReceiverError &e) {
|
} catch (ReceiverError &e) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << e.what() << '[' << shm()->receivers[i].hostname << ", "
|
oss << e.what() << '[' << shm()->receivers[entries[i]].hostname
|
||||||
<< shm()->receivers[i].tcpPort << ']';
|
<< ", " << shm()->receivers[entries[i]].tcpPort << ']';
|
||||||
throw ReceiverError(oss.str());
|
throw ReceiverError(oss.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3345,8 +3423,8 @@ void Module::checkDetectorVersionCompatibility() {
|
|||||||
arg = APIGOTTHARD2;
|
arg = APIGOTTHARD2;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw NotImplementedError(
|
throw NotImplementedError("Check version compatibility is not "
|
||||||
"Check version compatibility is not implemented for this detector");
|
"implemented for this detector");
|
||||||
}
|
}
|
||||||
sendToDetector(F_CHECK_VERSION, arg, nullptr);
|
sendToDetector(F_CHECK_VERSION, arg, nullptr);
|
||||||
sendToDetectorStop(F_CHECK_VERSION, arg, nullptr);
|
sendToDetectorStop(F_CHECK_VERSION, arg, nullptr);
|
||||||
@ -3451,8 +3529,8 @@ sls_detector_module Module::interpolateTrim(sls_detector_module *a,
|
|||||||
const int e2, bool trimbits) {
|
const int e2, bool trimbits) {
|
||||||
// dacs specified only for eiger and mythen3
|
// dacs specified only for eiger and mythen3
|
||||||
if (shm()->detType != EIGER && shm()->detType != MYTHEN3) {
|
if (shm()->detType != EIGER && shm()->detType != MYTHEN3) {
|
||||||
throw NotImplementedError(
|
throw NotImplementedError("Interpolation of Trim values not "
|
||||||
"Interpolation of Trim values not implemented for this detector!");
|
"implemented for this detector!");
|
||||||
}
|
}
|
||||||
|
|
||||||
sls_detector_module myMod{shm()->detType};
|
sls_detector_module myMod{shm()->detType};
|
||||||
|
@ -275,7 +275,7 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
void setAllReceiverHostnames(const std::vector<std::string> &receiver);
|
void setAllReceiverHostnames(const std::vector<std::string> &receiver);
|
||||||
void setReceiverHostname(const std::string &receiver, const int rxIndex);
|
void setReceiverHostname(const std::string &receiver, const int rxIndex);
|
||||||
int getReceiverPort(const int rxIndex) const;
|
int getReceiverPort(const int rxIndex) const;
|
||||||
int setReceiverPort(int port_number, const int rxIndex);
|
void setReceiverPort(int port_number, const int rxIndex);
|
||||||
int getReceiverFifoDepth() const;
|
int getReceiverFifoDepth() const;
|
||||||
void setReceiverFifoDepth(int n_frames);
|
void setReceiverFifoDepth(int n_frames);
|
||||||
bool getReceiverSilentMode() const;
|
bool getReceiverSilentMode() const;
|
||||||
@ -667,6 +667,7 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
Ret sendToDetectorStop(int fnum, const Arg &args) const;
|
Ret sendToDetectorStop(int fnum, const Arg &args) const;
|
||||||
|
|
||||||
/** Send function parameters to receiver */
|
/** Send function parameters to receiver */
|
||||||
|
std::vector<int> getEntryList(const int rxIndex) const;
|
||||||
void sendToReceiver(const int rxIndex, int fnum, const void *args,
|
void sendToReceiver(const int rxIndex, int fnum, const void *args,
|
||||||
size_t args_size, void *retval, size_t retval_size);
|
size_t args_size, void *retval, size_t retval_size);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user