Removeudpcache (#65)

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* solved eiger 1-10g issue

* some fixes for remove udp cache to work

* bug fix virtual

* removed special handling of rx_udpip
This commit is contained in:
Dhanya Thattil
2019-09-30 14:46:25 +02:00
committed by GitHub
parent 6e6fcec698
commit ca054626e6
33 changed files with 1759 additions and 1379 deletions

View File

@ -303,10 +303,6 @@ void Detector::sendSoftwareTrigger(Positions pos) {
// Network Configuration (Detector<->Receiver)
void Detector::configureMAC(Positions pos) {
pimpl->Parallel(&slsDetector::configureMAC, pos);
}
Result<int> Detector::getNumberofUDPInterfaces(Positions pos) const {
return pimpl->Parallel(&slsDetector::getNumberofUDPInterfaces, pos);
}
@ -335,98 +331,98 @@ void Detector::selectUDPInterface(int interface, Positions pos) {
}
Result<IpAddr> Detector::getSourceUDPIP(Positions pos) const {
return pimpl->Parallel(&slsDetector::getDetectorIP, pos);
return pimpl->Parallel(&slsDetector::getSourceUDPIP, pos);
}
void Detector::setSourceUDPIP(const std::string &ip, Positions pos) {
pimpl->Parallel(&slsDetector::setDetectorIP, pos, ip);
void Detector::setSourceUDPIP(const IpAddr ip, Positions pos) {
pimpl->Parallel(&slsDetector::setSourceUDPIP, pos, ip);
}
Result<IpAddr> Detector::getSourceUDPIP2(Positions pos) const {
return pimpl->Parallel(&slsDetector::getDetectorIP2, pos);
return pimpl->Parallel(&slsDetector::getSourceUDPIP2, pos);
}
void Detector::setSourceUDPIP2(const std::string &ip, Positions pos) {
pimpl->Parallel(&slsDetector::setDetectorIP2, pos, ip);
void Detector::setSourceUDPIP2(const IpAddr ip, Positions pos) {
pimpl->Parallel(&slsDetector::setSourceUDPIP2, pos, ip);
}
Result<MacAddr> Detector::getSourceUDPMAC(Positions pos) const {
return pimpl->Parallel(&slsDetector::getDetectorMAC, pos);
return pimpl->Parallel(&slsDetector::getSourceUDPMAC, pos);
}
void Detector::setSourceUDPMAC(const std::string &mac, Positions pos) {
pimpl->Parallel(&slsDetector::setDetectorMAC, pos, mac);
void Detector::setSourceUDPMAC(const MacAddr mac, Positions pos) {
pimpl->Parallel(&slsDetector::setSourceUDPMAC, pos, mac);
}
Result<MacAddr> Detector::getSourceUDPMAC2(Positions pos) const {
return pimpl->Parallel(&slsDetector::getDetectorMAC2, pos);
return pimpl->Parallel(&slsDetector::getSourceUDPMAC2, pos);
}
void Detector::setSourceUDPMAC2(const std::string &mac, Positions pos) {
pimpl->Parallel(&slsDetector::setDetectorMAC2, pos, mac);
void Detector::setSourceUDPMAC2(const MacAddr mac, Positions pos) {
pimpl->Parallel(&slsDetector::setSourceUDPMAC2, pos, mac);
}
Result<IpAddr> Detector::getDestinationUDPIP(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReceiverUDPIP, pos);
return pimpl->Parallel(&slsDetector::getDestinationUDPIP, pos);
}
void Detector::setDestinationUDPIP(const std::string &ip, Positions pos) {
pimpl->Parallel(&slsDetector::setReceiverUDPIP, pos, ip);
void Detector::setDestinationUDPIP(const IpAddr ip, Positions pos) {
pimpl->Parallel(&slsDetector::setDestinationUDPIP, pos, ip);
}
Result<IpAddr> Detector::getDestinationUDPIP2(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReceiverUDPIP2, pos);
return pimpl->Parallel(&slsDetector::getDestinationUDPIP2, pos);
}
void Detector::setDestinationUDPIP2(const std::string &ip, Positions pos) {
pimpl->Parallel(&slsDetector::setReceiverUDPIP2, pos, ip);
void Detector::setDestinationUDPIP2(const IpAddr ip, Positions pos) {
pimpl->Parallel(&slsDetector::setDestinationUDPIP2, pos, ip);
}
Result<MacAddr> Detector::getDestinationUDPMAC(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReceiverUDPMAC, pos);
return pimpl->Parallel(&slsDetector::getDestinationUDPMAC, pos);
}
void Detector::setDestinationUDPMAC(const std::string &mac, Positions pos) {
pimpl->Parallel(&slsDetector::setReceiverUDPMAC, pos, mac);
void Detector::setDestinationUDPMAC(const MacAddr mac, Positions pos) {
pimpl->Parallel(&slsDetector::setDestinationUDPMAC, pos, mac);
}
Result<MacAddr> Detector::getDestinationUDPMAC2(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReceiverUDPMAC2, pos);
return pimpl->Parallel(&slsDetector::getDestinationUDPMAC2, pos);
}
void Detector::setDestinationUDPMAC2(const std::string &mac, Positions pos) {
pimpl->Parallel(&slsDetector::setReceiverUDPMAC2, pos, mac);
void Detector::setDestinationUDPMAC2(const MacAddr mac, Positions pos) {
pimpl->Parallel(&slsDetector::setDestinationUDPMAC2, pos, mac);
}
Result<int> Detector::getDestinationUDPPort(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReceiverUDPPort, pos);
return pimpl->Parallel(&slsDetector::getDestinationUDPPort, pos);
}
void Detector::setDestinationUDPPort(int port, int module_id) {
if (module_id == -1) {
std::vector<int> port_list = getPortNumbers(port);
for (int idet = 0; idet < size(); ++idet) {
pimpl->Parallel(&slsDetector::setReceiverUDPPort, {idet},
pimpl->Parallel(&slsDetector::setDestinationUDPPort, {idet},
port_list[idet]);
}
} else {
pimpl->Parallel(&slsDetector::setReceiverUDPPort, {module_id}, port);
pimpl->Parallel(&slsDetector::setDestinationUDPPort, {module_id}, port);
}
}
Result<int> Detector::getDestinationUDPPort2(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReceiverUDPPort2, pos);
return pimpl->Parallel(&slsDetector::getDestinationUDPPort2, pos);
}
void Detector::setDestinationUDPPort2(int port, int module_id) {
if (module_id == -1) {
std::vector<int> port_list = getPortNumbers(port);
for (int idet = 0; idet < size(); ++idet) {
pimpl->Parallel(&slsDetector::setReceiverUDPPort2, {idet},
pimpl->Parallel(&slsDetector::setDestinationUDPPort2, {idet},
port_list[idet]);
}
} else {
pimpl->Parallel(&slsDetector::setReceiverUDPPort2, {module_id}, port);
pimpl->Parallel(&slsDetector::setDestinationUDPPort2, {module_id}, port);
}
}

View File

@ -888,7 +888,7 @@ void multiSlsDetector::readAll(int detPos) {
// multi
parallelCall(&slsDetector::readAll);
}
/*
void multiSlsDetector::configureMAC(int detPos) {
// single
if (detPos >= 0) {
@ -898,6 +898,7 @@ void multiSlsDetector::configureMAC(int detPos) {
// multi
parallelCall(&slsDetector::configureMAC);
}
*/
void multiSlsDetector::setStartingFrameNumber(const uint64_t value,
int detPos) {
@ -1275,98 +1276,6 @@ uint32_t multiSlsDetector::clearBit(uint32_t addr, int n, int detPos) {
throw RuntimeError(ss.str());
}
std::string multiSlsDetector::setDetectorMAC(const std::string &detectorMAC,
int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setDetectorMAC(detectorMAC);
}
// multi
auto r = parallelCall(&slsDetector::setDetectorMAC, detectorMAC);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::getDetectorMAC(int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->getDetectorMAC().str();
}
// multi
auto r = serialCall(&slsDetector::getDetectorMAC);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::setDetectorMAC2(const std::string &detectorMAC,
int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setDetectorMAC2(detectorMAC);
}
// multi
auto r = parallelCall(&slsDetector::setDetectorMAC2, detectorMAC);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::getDetectorMAC2(int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->getDetectorMAC2().str();
}
// multi
auto r = serialCall(&slsDetector::getDetectorMAC2);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::setDetectorIP(const std::string &detectorIP,
int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setDetectorIP(detectorIP);
}
// multi
auto r = parallelCall(&slsDetector::setDetectorIP, detectorIP);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::getDetectorIP(int detPos) const {
// single
if (detPos >= 0) {
return detectors[detPos]->getDetectorIP().str();
}
// multi
auto r = serialCall(&slsDetector::getDetectorIP);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::setDetectorIP2(const std::string &detectorIP,
int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setDetectorIP2(detectorIP);
}
// multi
auto r = parallelCall(&slsDetector::setDetectorIP2, detectorIP);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::getDetectorIP2(int detPos) const {
// single
if (detPos >= 0) {
return detectors[detPos]->getDetectorIP2().str();
}
// multi
auto r = serialCall(&slsDetector::getDetectorIP2);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::setReceiverHostname(const std::string &receiver,
int detPos) {
// single
@ -1390,155 +1299,19 @@ std::string multiSlsDetector::getReceiverHostname(int detPos) const {
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::setReceiverUDPIP(const std::string &udpip,
int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setReceiverUDPIP(udpip);
}
// multi
auto r = parallelCall(&slsDetector::setReceiverUDPIP, udpip);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::getReceiverUDPIP(int detPos) const {
// single
if (detPos >= 0) {
return detectors[detPos]->getReceiverUDPIP().str();
}
// multi
auto r = serialCall(&slsDetector::getReceiverUDPIP);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::setReceiverUDPIP2(const std::string &udpip,
int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setReceiverUDPIP2(udpip);
}
// multi
auto r = parallelCall(&slsDetector::setReceiverUDPIP2, udpip);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::getReceiverUDPIP2(int detPos) const {
// single
if (detPos >= 0) {
return detectors[detPos]->getReceiverUDPIP2().str();
}
// multi
auto r = serialCall(&slsDetector::getReceiverUDPIP2);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::setReceiverUDPMAC(const std::string &udpmac,
int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setReceiverUDPMAC(udpmac);
}
// multi
auto r = parallelCall(&slsDetector::setReceiverUDPMAC, udpmac);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::getReceiverUDPMAC(int detPos) const {
// single
if (detPos >= 0) {
return detectors[detPos]->getReceiverUDPMAC().str();
}
// multi
auto r = serialCall(&slsDetector::getReceiverUDPMAC);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::setReceiverUDPMAC2(const std::string &udpmac,
int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setReceiverUDPMAC2(udpmac);
}
// multi
auto r = parallelCall(&slsDetector::setReceiverUDPMAC2, udpmac);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::getReceiverUDPMAC2(int detPos) const {
// single
if (detPos >= 0) {
return detectors[detPos]->getReceiverUDPMAC2().str();
}
// multi
auto r = serialCall(&slsDetector::getReceiverUDPMAC2);
return sls::concatenateIfDifferent(r);
}
int multiSlsDetector::setReceiverUDPPort(int udpport, int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setReceiverUDPPort(udpport);
}
// multi
auto r = parallelCall(&slsDetector::setReceiverUDPPort, udpport);
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::getReceiverUDPPort(int detPos) const {
// single
if (detPos >= 0) {
return detectors[detPos]->getReceiverUDPPort();
}
// multi
auto r = serialCall(&slsDetector::getReceiverUDPPort);
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::setReceiverUDPPort2(int udpport, int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setReceiverUDPPort2(udpport);
}
// multi
auto r = parallelCall(&slsDetector::setReceiverUDPPort2, udpport);
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::getReceiverUDPPort2(int detPos) const {
// single
if (detPos >= 0) {
return detectors[detPos]->getReceiverUDPPort2();
}
// multi
auto r = serialCall(&slsDetector::getReceiverUDPPort2);
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::setNumberofUDPInterfaces(int n, int detPos) {
void multiSlsDetector::setNumberofUDPInterfaces(int n, int detPos) {
bool previouslyClientStreaming = enableDataStreamingToClient();
int previouslyReceiverStreaming = enableDataStreamingFromReceiver();
// single
int ret = OK;
if (detPos >= 0) {
ret = detectors[detPos]->setNumberofUDPInterfaces(n);
detectors[detPos]->setNumberofUDPInterfaces(n);
}
// multi
auto r = parallelCall(&slsDetector::setNumberofUDPInterfaces, n);
parallelCall(&slsDetector::setNumberofUDPInterfaces, n);
// redo the zmq sockets
if (previouslyClientStreaming) {
@ -1549,45 +1322,37 @@ int multiSlsDetector::setNumberofUDPInterfaces(int n, int detPos) {
enableDataStreamingFromReceiver(0);
enableDataStreamingFromReceiver(1);
}
// return single
if (detPos >= 0)
return ret;
// return multi
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::getNumberofUDPInterfaces(int detPos) const {
int multiSlsDetector::getNumberofUDPInterfaces(int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->getNumberofUDPInterfaces();
}
// multi
auto r = serialCall(&slsDetector::getNumberofUDPInterfaces);
auto r = parallelCall(&slsDetector::getNumberofUDPInterfaces);
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::selectUDPInterface(int n, int detPos) {
void multiSlsDetector::selectUDPInterface(int n, int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->selectUDPInterface(n);
detectors[detPos]->selectUDPInterface(n);
}
// multi
auto r = parallelCall(&slsDetector::selectUDPInterface, n);
return sls::minusOneIfDifferent(r);
parallelCall(&slsDetector::selectUDPInterface, n);
}
int multiSlsDetector::getSelectedUDPInterface(int detPos) const {
int multiSlsDetector::getSelectedUDPInterface(int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->getSelectedUDPInterface();
}
// multi
auto r = serialCall(&slsDetector::getSelectedUDPInterface);
auto r = parallelCall(&slsDetector::getSelectedUDPInterface);
return sls::minusOneIfDifferent(r);
}
@ -2410,7 +2175,12 @@ std::string multiSlsDetector::printReceiverConfiguration(int detPos) {
// multi
auto r = parallelCall(&slsDetector::printReceiverConfiguration);
return sls::concatenateIfDifferent(r);
// concatenate without '+'
std::string ret;
for (const auto &s : r)
if (!s.empty())
ret += s;
return ret;
}
bool multiSlsDetector::getUseReceiverFlag(int detPos) {

View File

@ -338,21 +338,6 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
shm()->deadTime = 0;
sls::strcpy_safe(shm()->rxHostname, "none");
shm()->rxTCPPort = DEFAULT_PORTNO + 2;
shm()->rxUDPPort = DEFAULT_UDP_PORTNO;
shm()->rxUDPPort2 = DEFAULT_UDP_PORTNO + 1;
shm()->rxUDPIP = 0u;
shm()->rxUDPIP2 = 0u;
shm()->rxUDPMAC = 0ul;
shm()->rxUDPMAC2 = 0ul;
shm()->detectorMAC = DEFAULT_DET_MAC;
shm()->detectorMAC2 = DEFAULT_DET_MAC2;
shm()->detectorIP = DEFAULT_DET_MAC;
shm()->detectorIP2 = DEFAULT_DET_MAC2;
shm()->numUDPInterfaces = 1;
shm()->selectedUDPInterface = 0;
shm()->useReceiverFlag = false;
shm()->tenGigaEnable = 0;
shm()->flippedDataX = 0;
@ -645,8 +630,11 @@ int slsDetector::getReadNLines() {
void slsDetector::updateMultiSize(slsDetectorDefs::xy det) {
shm()->multiSize = det;
int args[2] = {shm()->multiSize.y, detId};
sendToDetector(F_SET_POSITION, args, nullptr);
}
int slsDetector::setControlPort(int port_number) {
int retval = -1;
FILE_LOG(logDEBUG1) << "Setting control port to " << port_number;
@ -1214,6 +1202,7 @@ void slsDetector::readAll() {
FILE_LOG(logDEBUG1) << "Detector successfully finished reading all frames";
}
/*
void slsDetector::configureMAC() {
int fnum = F_CONFIGURE_MAC;
const size_t array_size = 50;
@ -1321,6 +1310,7 @@ void slsDetector::configureMAC() {
updateCachedDetectorVariables();
}
}
*/
void slsDetector::setStartingFrameNumber(uint64_t value) {
FILE_LOG(logDEBUG1) << "Setting starting frame number to " << value;
@ -1615,75 +1605,6 @@ uint32_t slsDetector::clearBit(uint32_t addr, int n) {
}
}
std::string slsDetector::setDetectorMAC(const std::string &detectorMAC) {
auto addr = MacAddr(detectorMAC);
if (addr == 0) {
throw RuntimeError(
"server MAC Address should be in xx:xx:xx:xx:xx:xx format");
}
shm()->detectorMAC = addr;
if (strcmp(shm()->rxHostname, "none") == 0) {
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
} else {
setUDPConnection();
}
return getDetectorMAC().str();
}
MacAddr slsDetector::getDetectorMAC() { return shm()->detectorMAC; }
std::string slsDetector::setDetectorMAC2(const std::string &detectorMAC) {
auto addr = MacAddr(detectorMAC);
if (addr == 0) {
throw RuntimeError(
"server MAC Address 2 should be in xx:xx:xx:xx:xx:xx format");
}
shm()->detectorMAC2 = addr;
if (strcmp(shm()->rxHostname, "none") == 0) {
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
} else {
setUDPConnection();
}
return getDetectorMAC2().str();
}
MacAddr slsDetector::getDetectorMAC2() { return shm()->detectorMAC2; }
std::string slsDetector::setDetectorIP(const std::string &ip) {
auto addr = IpAddr(ip);
if (addr == 0) {
throw RuntimeError("setDetectorIP: IP Address should be VALID and "
"in xxx.xxx.xxx.xxx format");
}
shm()->detectorIP = ip;
if (strcmp(shm()->rxHostname, "none") == 0) {
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
} else {
setUDPConnection();
}
return getDetectorIP().str();
}
IpAddr slsDetector::getDetectorIP() const { return shm()->detectorIP; }
std::string slsDetector::setDetectorIP2(const std::string &ip) {
auto addr = IpAddr(ip);
if (addr == 0) {
throw RuntimeError("setDetectorIP: IP2 Address should be VALID and "
"in xxx.xxx.xxx.xxx format");
}
shm()->detectorIP2 = ip;
if (strcmp(shm()->rxHostname, "none") == 0) {
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
} else {
setUDPConnection();
}
return getDetectorIP().str();
}
IpAddr slsDetector::getDetectorIP2() const { return shm()->detectorIP2; }
std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
FILE_LOG(logDEBUG1) << "Setting up Receiver with " << receiverIP;
// recieverIP is none
@ -1750,7 +1671,19 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
sendMultiDetectorSize();
setDetectorId();
setDetectorHostname();
setUDPConnection();
// setup udp
updateRxDestinationUDPIP();
setDestinationUDPPort(getDestinationUDPPort());
if (shm()->myDetectorType == JUNGFRAU || shm()->myDetectorType == EIGER ) {
setDestinationUDPPort2(getDestinationUDPPort2());
}
if (shm()->myDetectorType == JUNGFRAU) {
updateRxDestinationUDPIP2();
setNumberofUDPInterfaces(getNumberofUDPInterfaces());
}
FILE_LOG(logDEBUG1) << printReceiverConfiguration();
setReceiverUDPSocketBufferSize(0);
setFilePath(shm()->rxFilePath);
setFileName(shm()->rxFileName);
@ -1825,119 +1758,237 @@ std::string slsDetector::getReceiverHostname() const {
return std::string(shm()->rxHostname);
}
std::string slsDetector::setReceiverUDPIP(const std::string &udpip) {
auto ip = IpAddr(udpip);
if (ip == 0) {
throw ReceiverError("setReceiverUDPIP: UDP IP Address should be "
"VALID and in xxx.xxx.xxx.xxx format");
}
shm()->rxUDPIP = ip;
if (strcmp(shm()->rxHostname, "none") == 0) {
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
} else {
setUDPConnection();
}
return getReceiverUDPIP().str();
}
sls::IpAddr slsDetector::getReceiverUDPIP() const { return shm()->rxUDPIP; }
std::string slsDetector::setReceiverUDPIP2(const std::string &udpip) {
auto ip = IpAddr(udpip);
if (ip == 0) {
throw ReceiverError("setReceiverUDPIP: UDP IP Address 2 should be "
"VALID and in xxx.xxx.xxx.xxx format");
}
shm()->rxUDPIP2 = ip;
if (strcmp(shm()->rxHostname, "none") == 0) {
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
} else {
setUDPConnection();
}
return getReceiverUDPIP2().str();
}
sls::IpAddr slsDetector::getReceiverUDPIP2() const { return shm()->rxUDPIP2; }
std::string slsDetector::setReceiverUDPMAC(const std::string &udpmac) {
auto mac = MacAddr(udpmac);
void slsDetector::setSourceUDPMAC(const sls::MacAddr mac) {
FILE_LOG(logDEBUG1) << "Setting source udp mac to " << mac;
if (mac == 0) {
throw ReceiverError("Could not decode UDPMAC from: " + udpmac);
throw RuntimeError("Invalid source udp mac address");
}
shm()->rxUDPMAC = mac;
return getReceiverUDPMAC().str();
sendToDetector(F_SET_SOURCE_UDP_MAC, mac, nullptr);
}
MacAddr slsDetector::getReceiverUDPMAC() const { return shm()->rxUDPMAC; }
sls::MacAddr slsDetector::getSourceUDPMAC() {
sls::MacAddr retval(0lu);
FILE_LOG(logDEBUG1) << "Getting source udp mac";
sendToDetector(F_GET_SOURCE_UDP_MAC, nullptr, retval);
FILE_LOG(logDEBUG1) << "Source udp mac: " << retval;
return retval;
}
std::string slsDetector::setReceiverUDPMAC2(const std::string &udpmac) {
auto mac = MacAddr(udpmac);
void slsDetector::setSourceUDPMAC2(const sls::MacAddr mac) {
FILE_LOG(logDEBUG1) << "Setting source udp mac2 to " << mac;
if (mac == 0) {
throw ReceiverError("Could not decode UDPMA2C from: " + udpmac);
throw RuntimeError("Invalid source udp mac address2");
}
shm()->rxUDPMAC2 = mac;
return getReceiverUDPMAC2().str();
sendToDetector(F_SET_SOURCE_UDP_MAC2, mac, nullptr);
}
MacAddr slsDetector::getReceiverUDPMAC2() const { return shm()->rxUDPMAC2; }
int slsDetector::setReceiverUDPPort(int udpport) {
shm()->rxUDPPort = udpport;
if (strcmp(shm()->rxHostname, "none") == 0) {
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
} else {
setUDPConnection();
}
return shm()->rxUDPPort;
sls::MacAddr slsDetector::getSourceUDPMAC2() {
sls::MacAddr retval(0lu);
FILE_LOG(logDEBUG1) << "Getting source udp mac2";
sendToDetector(F_GET_SOURCE_UDP_MAC2, nullptr, retval);
FILE_LOG(logDEBUG1) << "Source udp mac2: " << retval;
return retval;
}
int slsDetector::getReceiverUDPPort() const { return shm()->rxUDPPort; }
int slsDetector::setReceiverUDPPort2(int udpport) {
shm()->rxUDPPort2 = udpport;
if (strcmp(shm()->rxHostname, "none") == 0) {
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
} else {
setUDPConnection();
void slsDetector::setSourceUDPIP(const IpAddr ip) {
FILE_LOG(logDEBUG1) << "Setting source udp ip to " << ip;
if (ip == 0) {
throw RuntimeError("Invalid source udp ip address");
}
return shm()->rxUDPPort2;
sendToDetector(F_SET_SOURCE_UDP_IP, ip, nullptr);
}
int slsDetector::getReceiverUDPPort2() const { return shm()->rxUDPPort2; }
int slsDetector::setNumberofUDPInterfaces(int n) {
if (shm()->myDetectorType != JUNGFRAU) {
throw RuntimeError(
"Cannot choose number of interfaces for this detector");
}
shm()->numUDPInterfaces = (n > 1 ? 2 : 1);
if (strcmp(shm()->rxHostname, "none") == 0) {
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
} else {
setUDPConnection();
}
return shm()->numUDPInterfaces;
sls::IpAddr slsDetector::getSourceUDPIP() {
sls::IpAddr retval(0u);
FILE_LOG(logDEBUG1) << "Getting source udp ip";
sendToDetector(F_GET_SOURCE_UDP_IP, nullptr, retval);
FILE_LOG(logDEBUG1) << "Source udp ip: " << retval;
return retval;
}
int slsDetector::getNumberofUDPInterfaces() const {
return shm()->numUDPInterfaces;
void slsDetector::setSourceUDPIP2(const IpAddr ip) {
FILE_LOG(logDEBUG1) << "Setting source udp ip2 to " << ip;
if (ip == 0) {
throw RuntimeError("Invalid source udp ip address2");
}
sendToDetector(F_SET_SOURCE_UDP_IP2, ip, nullptr);
}
int slsDetector::selectUDPInterface(int n) {
if (shm()->myDetectorType != JUNGFRAU) {
throw RuntimeError("Cannot select an interface for this detector");
}
shm()->selectedUDPInterface = (n == 0 ? 0 : 1);
if (strcmp(shm()->rxHostname, "none") == 0) {
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
} else {
setUDPConnection();
}
return shm()->selectedUDPInterface;
sls::IpAddr slsDetector::getSourceUDPIP2() {
sls::IpAddr retval(0u);
FILE_LOG(logDEBUG1) << "Getting source udp ip2";
sendToDetector(F_GET_SOURCE_UDP_IP2, nullptr, retval);
FILE_LOG(logDEBUG1) << "Source udp ip2: " << retval;
return retval;
}
int slsDetector::getSelectedUDPInterface() const {
return shm()->selectedUDPInterface;
void slsDetector::setDestinationUDPIP(const IpAddr ip) {
FILE_LOG(logDEBUG1) << "Setting destination udp ip to " << ip;
if (ip == 0) {
throw RuntimeError("Invalid destination udp ip address");
}
sendToDetector(F_SET_DEST_UDP_IP, ip, nullptr);
if (shm()->useReceiverFlag) {
sls::MacAddr retval(0lu);
sendToReceiver(F_SET_RECEIVER_UDP_IP, ip, retval);
FILE_LOG(logINFO) << "Setting destination udp mac to " << retval;
sendToDetector(F_SET_DEST_UDP_MAC, retval, nullptr);
}
}
sls::IpAddr slsDetector::getDestinationUDPIP() {
sls::IpAddr retval(0u);
FILE_LOG(logDEBUG1) << "Getting destination udp ip";
sendToDetector(F_GET_DEST_UDP_IP, nullptr, retval);
FILE_LOG(logDEBUG1) << "Destination udp ip: " << retval;
return retval;
}
void slsDetector::updateRxDestinationUDPIP() {
auto ip = getDestinationUDPIP();
if (ip == 0) {
// Hostname could be ip try to decode otherwise look up the hostname
ip = shm()->rxHostname;
if (ip == 0) {
ip = HostnameToIp(shm()->rxHostname);
}
FILE_LOG(logINFO) << "Setting destination default udp ip to " << ip;
}
setDestinationUDPIP(ip);
}
void slsDetector::setDestinationUDPIP2(const IpAddr ip) {
FILE_LOG(logDEBUG1) << "Setting destination udp ip2 to " << ip;
if (ip == 0) {
throw RuntimeError("Invalid destination udp ip address2");
}
sendToDetector(F_SET_DEST_UDP_IP2, ip, nullptr);
if (shm()->useReceiverFlag) {
sls::MacAddr retval(0lu);
sendToReceiver(F_SET_RECEIVER_UDP_IP2, ip, retval);
FILE_LOG(logINFO) << "Setting destination udp mac2 to " << retval;
sendToDetector(F_SET_DEST_UDP_MAC2, retval, nullptr);
}
}
sls::IpAddr slsDetector::getDestinationUDPIP2() {
sls::IpAddr retval(0u);
FILE_LOG(logDEBUG1) << "Getting destination udp ip2";
sendToDetector(F_GET_DEST_UDP_IP2, nullptr, retval);
FILE_LOG(logDEBUG1) << "Destination udp ip2: " << retval;
return retval;
}
void slsDetector::updateRxDestinationUDPIP2() {
auto ip = getDestinationUDPIP2();
if (ip == 0) {
// Hostname could be ip try to decode otherwise look up the hostname
ip = shm()->rxHostname;
if (ip == 0) {
ip = HostnameToIp(shm()->rxHostname);
}
FILE_LOG(logINFO) << "Setting destination default udp ip2 to " << ip;
}
setDestinationUDPIP2(ip);
}
void slsDetector::setDestinationUDPMAC(const MacAddr mac) {
FILE_LOG(logDEBUG1) << "Setting destination udp mac to " << mac;
if (mac == 0) {
throw RuntimeError("Invalid destination udp mac address");
}
sendToDetector(F_SET_DEST_UDP_MAC, mac, nullptr);
}
sls::MacAddr slsDetector::getDestinationUDPMAC() {
sls::MacAddr retval(0lu);
FILE_LOG(logDEBUG1) << "Getting destination udp mac";
sendToDetector(F_GET_DEST_UDP_MAC, nullptr, retval);
FILE_LOG(logDEBUG1) << "Destination udp mac: " << retval;
return retval;
}
void slsDetector::setDestinationUDPMAC2(const MacAddr mac) {
FILE_LOG(logDEBUG1) << "Setting destination udp mac2 to " << mac;
if (mac == 0) {
throw RuntimeError("Invalid desinaion udp mac address2");
}
sendToDetector(F_SET_DEST_UDP_MAC2, mac, nullptr);
}
sls::MacAddr slsDetector::getDestinationUDPMAC2() {
sls::MacAddr retval(0lu);
FILE_LOG(logDEBUG1) << "Getting destination udp mac2";
sendToDetector(F_GET_DEST_UDP_MAC2, nullptr, retval);
FILE_LOG(logDEBUG1) << "Destination udp mac2: " << retval;
return retval;
}
void slsDetector::setDestinationUDPPort(const int port) {
FILE_LOG(logDEBUG1) << "Setting destination udp port to " << port;
sendToDetector(F_SET_DEST_UDP_PORT, port, nullptr);
if (shm()->useReceiverFlag) {
sendToReceiver(F_SET_RECEIVER_UDP_PORT, port, nullptr);
}
}
int slsDetector::getDestinationUDPPort() {
int retval = -1;
FILE_LOG(logDEBUG1) << "Getting destination udp port";
sendToDetector(F_GET_DEST_UDP_PORT, nullptr, retval);
FILE_LOG(logDEBUG1) << "Destination udp port: " << retval;
return retval;
}
void slsDetector::setDestinationUDPPort2(const int port) {
FILE_LOG(logDEBUG1) << "Setting destination udp port2 to " << port;
sendToDetector(F_SET_DEST_UDP_PORT2, port, nullptr);
if (shm()->useReceiverFlag) {
sendToReceiver(F_SET_RECEIVER_UDP_PORT2, port, nullptr);
}
}
int slsDetector::getDestinationUDPPort2() {
int retval = -1;
FILE_LOG(logDEBUG1) << "Getting destination udp port2";
sendToDetector(F_GET_DEST_UDP_PORT2, nullptr, retval);
FILE_LOG(logDEBUG1) << "Destination udp port2: " << retval;
return retval;
}
void slsDetector::setNumberofUDPInterfaces(int n) {
FILE_LOG(logDEBUG1) << "Setting number of udp interfaces to " << n;
sendToDetector(F_SET_NUM_INTERFACES, n, nullptr);
if (shm()->useReceiverFlag) {
sendToReceiver(F_SET_RECEIVER_NUM_INTERFACES, n, nullptr);
}
}
int slsDetector::getNumberofUDPInterfaces() {
int retval = -1;
FILE_LOG(logDEBUG1) << "Getting number of udp interfaces";
sendToDetector(F_GET_NUM_INTERFACES, nullptr, retval);
FILE_LOG(logDEBUG1) << "Number of udp interfaces: " << retval;
return retval;
}
void slsDetector::selectUDPInterface(int n) {
FILE_LOG(logDEBUG1) << "Setting selected udp interface to " << n;
sendToDetector(F_SET_INTERFACE_SEL, n, nullptr);
}
int slsDetector::getSelectedUDPInterface() {
int retval = -1;
FILE_LOG(logDEBUG1) << "Getting selected udp interface";
sendToDetector(F_GET_INTERFACE_SEL, nullptr, retval);
FILE_LOG(logDEBUG1) << "Selected udp interface: " << retval;
return retval;
}
void slsDetector::setClientStreamingPort(int port) { shm()->zmqport = port; }
@ -2159,62 +2210,6 @@ int64_t slsDetector::getReceiverRealUDPSocketBufferSize() const {
return retval;
}
void slsDetector::setUDPConnection() {
char args[5][MAX_STR_LENGTH]{};
char retvals[2][MAX_STR_LENGTH]{};
FILE_LOG(logDEBUG1) << "Setting UDP Connection";
// called before set up
if (strcmp(shm()->rxHostname, "none") == 0) {
throw RuntimeError(
"Cannot set udp connection. Receiver hostname not set yet.");
}
if (shm()->rxUDPIP == 0) {
// Hostname could be ip try to decode otherwise look up the hostname
shm()->rxUDPIP = shm()->rxHostname;
if (shm()->rxUDPIP == 0) {
shm()->rxUDPIP = HostnameToIp(shm()->rxHostname);
}
}
// jungfrau 2 interfaces, copy udpip if udpip2 empty
if (shm()->numUDPInterfaces == 2) {
if (shm()->rxUDPIP2 == 0) {
shm()->rxUDPIP2 = shm()->rxUDPIP;
}
}
// copy arguments to args[][]
snprintf(args[0], sizeof(args[0]), "%d", shm()->numUDPInterfaces);
sls::strcpy_safe(args[1], getReceiverUDPIP().str());
sls::strcpy_safe(args[2], getReceiverUDPIP2().str());
snprintf(args[3], sizeof(args[3]), "%d", shm()->rxUDPPort);
snprintf(args[4], sizeof(args[4]), "%d", shm()->rxUDPPort2);
FILE_LOG(logDEBUG1) << "Receiver Number of UDP Interfaces: "
<< shm()->numUDPInterfaces;
FILE_LOG(logDEBUG1) << "Receiver udp ip address: " << shm()->rxUDPIP;
FILE_LOG(logDEBUG1) << "Receiver udp ip address2: " << shm()->rxUDPIP2;
FILE_LOG(logDEBUG1) << "Receiver udp port: " << shm()->rxUDPPort;
FILE_LOG(logDEBUG1) << "Receiver udp port2: " << shm()->rxUDPPort2;
if (shm()->useReceiverFlag) {
sendToReceiver(F_SETUP_RECEIVER_UDP, args, retvals);
if (strlen(retvals[0]) != 0u) {
FILE_LOG(logDEBUG1) << "Receiver UDP MAC returned : " << retvals[0];
shm()->rxUDPMAC = retvals[0];
}
if (strlen(retvals[1]) != 0u) {
FILE_LOG(logDEBUG1)
<< "Receiver UDP MAC2 returned : " << retvals[1];
shm()->rxUDPMAC2 = retvals[1];
}
configureMAC();
} else {
throw ReceiverError("setUDPConnection: Receiver is OFFLINE");
}
FILE_LOG(logDEBUG1) << printReceiverConfiguration();
}
int slsDetector::digitalTest(digitalTestMode mode, int ival) {
int args[]{static_cast<int>(mode), ival};
int retval = -1;
@ -2268,11 +2263,6 @@ void slsDetector::setROI(slsDetectorDefs::ROI arg) {
}
}
// old firmware requires configuremac after setting roi
if (shm()->myDetectorType == GOTTHARD) {
configureMAC();
}
sendROItoReceiver();
}
@ -2805,17 +2795,30 @@ void slsDetector::updateRateCorrection() {
std::string slsDetector::printReceiverConfiguration() {
std::ostringstream os;
os << "#Detector " << detId << ":\n Receiver Hostname:\t"
<< getReceiverHostname() << "\nDetector UDP IP (Source):\t\t"
<< getDetectorIP() << "\nDetector UDP IP2 (Source):\t\t"
<< getDetectorIP2() << "\nDetector UDP MAC:\t\t" << getDetectorMAC()
<< "\nDetector UDP MAC2:\t\t" << getDetectorMAC2()
<< "\nReceiver UDP IP:\t" << getReceiverUDPIP()
<< "\nReceiver UDP IP2:\t" << getReceiverUDPIP2()
<< "\nReceiver UDP MAC:\t" << getReceiverUDPMAC()
<< "\nReceiver UDP MAC2:\t" << getReceiverUDPMAC2()
<< "\nReceiver UDP Port:\t" << getReceiverUDPPort()
<< "\nReceiver UDP Port2:\t" << getReceiverUDPPort2();
os << "\n\nDetector " << detId << "\nReceiver Hostname:\t"
<< getReceiverHostname();
if (shm()->myDetectorType == JUNGFRAU) {
os << "\nNumber of Interfaces:\t" << getNumberofUDPInterfaces()
<< "\nSelected Interface:\t" << getSelectedUDPInterface();
}
os << "\nDetector UDP IP:\t"
<< getSourceUDPIP() << "\nDetector UDP MAC:\t"
<< getSourceUDPMAC() << "\nReceiver UDP IP:\t"
<< getDestinationUDPIP() << "\nReceiver UDP MAC:\t" << getDestinationUDPMAC();
if (shm()->myDetectorType == JUNGFRAU) {
os << "\nDetector UDP IP2:\t" << getSourceUDPIP2()
<< "\nDetector UDP MAC2:\t" << getSourceUDPMAC2()
<< "\nReceiver UDP IP2:\t" << getDestinationUDPIP2()
<< "\nReceiver UDP MAC2:\t" << getDestinationUDPMAC2();
}
os << "\nReceiver UDP Port:\t" << getDestinationUDPPort();
if (shm()->myDetectorType == JUNGFRAU || shm()->myDetectorType == EIGER) {
os << "\nReceiver UDP Port2:\t" << getDestinationUDPPort2();
}
os << "\n";
return os.str();
}
@ -3259,9 +3262,6 @@ int slsDetector::enableTenGigabitEthernet(int value) {
sendToDetector(F_ENABLE_TEN_GIGA, value, retval);
FILE_LOG(logDEBUG1) << "10Gbe: " << retval;
shm()->tenGigaEnable = retval;
if (value >= 0) {
configureMAC();
}
if (shm()->useReceiverFlag) {
retval = -1;
value = shm()->tenGigaEnable;

View File

@ -1492,48 +1492,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>rx_udpip [ip]</b> sets/gets the ip address of the receiver UDP interface where the data from the detector will be streamed to. Normally used for single detectors (Can be multi-detector). Used if different from eth0. \c Returns \c (string)
*/
descrToFuncMap[i].m_pFuncName = "rx_udpip";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>rx_udpip2 [ip]</b> sets/gets the ip address of the second receiver UDP interface where the data from the top half module of the detector will be streamed to. Normally used for single detectors (Can be multi-detector). Used if different from eth0. JUNGFRAU only. \c Returns \c (string)
*/
descrToFuncMap[i].m_pFuncName = "rx_udpip2";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>rx_udpmac [mac]</b> sets/gets the mac address of the receiver UDP interface where the data from the detector will be streamed to. Normally used for single detectors (Can be multi-detector). \c Returns \c (string)
*/
descrToFuncMap[i].m_pFuncName = "rx_udpmac";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>rx_udpmac2 [mac]</b> sets/gets the mac address of the second receiver UDP interface where the data from the top half module of the detector will be streamed to. Normally used for single detectors (Can be multi-detector). JUNGFRAU only.\c Returns \c (string)
*/
descrToFuncMap[i].m_pFuncName = "rx_udpmac2";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>rx_udpport [port]</b> sets/gets the port of the receiver UDP interface where the data from the detector will be streamed to. Use single-detector command. \c Returns \c (int)
*/
descrToFuncMap[i].m_pFuncName = "rx_udpport";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>rx_udpport2 [port]</b> sets/gets the second port of the receiver UDP interface where the data from the second half of the detector will be streamed to. Use single-detector command. For Eiger, it is the right half and for Jungfrau, it is the top half module. \c Returns \c (int)
*/
descrToFuncMap[i].m_pFuncName = "rx_udpport2";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>rx_udpsocksize [size]</b> sets/gets the UDP socket buffer size. Already trying to set by default to 100mb, 2gb for Jungfrau. Does not remember in client shared memory, so must be initialized each time after setting receiver hostname in config file.\c Returns \c (int)
*/
@ -1548,48 +1506,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>detectormac [mac]</b> sets/gets the mac address of the detector UDP interface from where the detector will stream data. Use single-detector command. Normally unused. \c Returns \c (string)
*/
descrToFuncMap[i].m_pFuncName = "detectormac";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>detectormac2 [mac]</b> sets/gets the mac address of the second half of the detector UDP interface from where the top half module of the detector will stream data. Use single-detector command. Normally unused. JUNGFRAU only. \c Returns \c (string)
*/
descrToFuncMap[i].m_pFuncName = "detectormac2";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>detectorip [ip]</b> sets/gets the ip address of the detector UDP interface from where the detector will stream data. Use single-detector command. Keep in same subnet as rx_udpip (if rx_udpip specified). \c Returns \c (string)
*/
descrToFuncMap[i].m_pFuncName = "detectorip";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>detectorip2 [ip]</b> sets/gets the ip address of the top half of the detector UDP interface from where the top half of the detector will stream data. Use single-detector command. Keep in same subnet as rx_udpip2 (if rx_udpip2 specified). JUNGFRAU only. \c Returns \c (string)
*/
descrToFuncMap[i].m_pFuncName = "detectorip2";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>numinterfaces [n]</b> sets/gets the number of interfaces used to stream out from the detector. Options: 1(default), 2. JUNGFRAU only. \c Returns \c (int)
*/
descrToFuncMap[i].m_pFuncName = "numinterfaces";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>selinterface [n]</b> sets/gets interface to use to stream data out of the detector. Options: 0 (outer, default), 1(inner). Effective only when \c numinterfaces is 1. JUNGFRAU only. \c Returns \c (int)
*/
descrToFuncMap[i].m_pFuncName = "selinterface";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>txndelay_left [delay]</b> sets/gets the transmission delay of first packet in an image being streamed out from the detector's left UDP port. Use single-detector command. Used for EIGER only. \c Returns \c (int)
*/
@ -1653,13 +1569,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
i++;
/*! \page network
- <b>configuremac [i]</b> configures the MAC of the detector with these parameters: detectorip, detectormac, rx_udpip, rx_udpmac, rx_udpport, rx_udpport2 (if applicable). This command is already included in \c rx_hsotname. Only put!. \c Returns \c (int)
*/
descrToFuncMap[i].m_pFuncName = "configuremac";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdConfigureMac;
++i;
/*! \page network
- <b>rx_tcpport [port]</b> sets/gets the port of the client-receiver TCP interface. Use single-detector command. Is different for each detector if same \c rx_hostname used. Must be first command to communicate with receiver. \c Returns \c (int)
*/
@ -2574,88 +2483,12 @@ std::string slsDetectorCommand::cmdNetworkParameter(int narg, const char * const
if (action == HELP_ACTION)
return helpNetworkParameter(action);
if (cmd == "detectormac") {
if (action == PUT_ACTION) {
myDet->setDetectorMAC(args[1], detPos);
}
return myDet->getDetectorMAC(detPos);
} else if (cmd == "detectormac2") {
if (action == PUT_ACTION) {
myDet->setDetectorMAC2(args[1], detPos);
}
return myDet->getDetectorMAC2(detPos);
} else if (cmd == "detectorip") {
if (action == PUT_ACTION) {
myDet->setDetectorIP(args[1], detPos);
}
return myDet->getDetectorIP(detPos);
} else if (cmd == "detectorip2") {
if (action == PUT_ACTION) {
myDet->setDetectorIP2(args[1], detPos);
}
return myDet->getDetectorIP2(detPos);
} else if (cmd == "rx_hostname") {
if (cmd == "rx_hostname") {
if (action == PUT_ACTION) {
myDet->setReceiverHostname(args[1], detPos);
}
return myDet->getReceiverHostname(detPos);
} else if (cmd == "rx_udpip") {
if (action == PUT_ACTION) {
myDet->setReceiverUDPIP(args[1], detPos);
}
return myDet->getReceiverUDPIP(detPos);
} else if (cmd == "rx_udpip2") {
if (action == PUT_ACTION) {
myDet->setReceiverUDPIP2(args[1], detPos);
}
return myDet->getReceiverUDPIP2(detPos);
} else if (cmd == "rx_udpmac") {
if (action == PUT_ACTION) {
myDet->setReceiverUDPMAC(args[1], detPos);
}
return myDet->getReceiverUDPMAC(detPos);
} else if (cmd == "rx_udpmac2") {
if (action == PUT_ACTION) {
myDet->setReceiverUDPMAC2(args[1], detPos);
}
return myDet->getReceiverUDPMAC2(detPos);
} else if (cmd == "rx_udpport") {
if (action == PUT_ACTION) {
if (!(sscanf(args[1], "%d", &i))) {
return ("cannot parse argument") + std::string(args[1]);
}
myDet->setReceiverUDPPort(i, detPos);
}
sprintf(ans, "%d", myDet->getReceiverUDPPort(detPos));
return ans;
} else if (cmd == "rx_udpport2") {
if (action == PUT_ACTION) {
if (!(sscanf(args[1], "%d", &i))) {
return ("cannot parse argument") + std::string(args[1]);
}
myDet->setReceiverUDPPort2(i, detPos);
}
sprintf(ans, "%d", myDet->getReceiverUDPPort2(detPos));
return ans;
} else if (cmd == "numinterfaces") {
if (action == PUT_ACTION) {
if (!(sscanf(args[1], "%d", &i))) {
return ("cannot parse argument") + std::string(args[1]);
}
myDet->setNumberofUDPInterfaces(i, detPos);
}
sprintf(ans, "%d", myDet->getNumberofUDPInterfaces(detPos));
return ans;
} else if (cmd == "selinterface") {
if (action == PUT_ACTION) {
if (!(sscanf(args[1], "%d", &i))) {
return ("cannot parse argument") + std::string(args[1]);
}
myDet->selectUDPInterface(i, detPos);
}
sprintf(ans, "%d", myDet->getSelectedUDPInterface(detPos));
return ans;
} else if (cmd == "rx_udpsocksize") {
} else if (cmd == "rx_udpsocksize") {
if (action == PUT_ACTION) {
int64_t ival = -1;
if (!(sscanf(args[1], "%ld", &ival))) {
@ -2748,19 +2581,8 @@ std::string slsDetectorCommand::helpNetworkParameter(int action) {
std::ostringstream os;
if (action == PUT_ACTION || action == HELP_ACTION) {
os << "detectormac mac \n sets detector mac to mac" << std::endl;
os << "detectormac2 mac \n sets detector mac of 2nd udp interface to mac. Jungfrau only" << std::endl;
os << "detectorip ip \n sets detector ip to ip" << std::endl;
os << "detectorip2 ip \n sets detector ip of 2nd udp interface to ip. Jungfrau only" << std::endl;
os << "rx_hostname name \n sets receiver ip/hostname to name" << std::endl;
os << "rx_udpip ip \n sets receiver udp ip to ip" << std::endl;
os << "rx_udpip2 ip \n sets receiver udp ip of 2nd udp interface to ip. Jungfrau only" << std::endl;
os << "rx_udpmac mac \n sets receiver udp mac to mac" << std::endl;
os << "rx_udpmac2 mac \n sets receiver udp mac of 2nd udp interface to mac. Jungfrau only." << std::endl;
os << "rx_udpport port \n sets receiver udp port to port" << std::endl;
os << "rx_udpport2 port \n sets receiver udp port to port. For Eiger, it is the right half and for Jungfrau, it is the top half module and for other detectors, same as rx_udpport" << std::endl;
os << "numinterfaces n \n sets the number of interfaces to n used to stream out from the detector. Options: 1 (default), 2. JUNGFRAU only. " << std::endl;
os << "selinterface n \n sets interface to use to stream data out of the detector. Options: 0 (outer, default), 1(inner). Effective only when numinterfaces is 1. JUNGFRAU only. " << std::endl;
os << "txndelay_left port \n sets detector transmission delay of the left port" << std::endl;
os << "txndelay_right port \n sets detector transmission delay of the right port" << std::endl;
os << "txndelay_frame port \n sets detector transmission delay of the entire frame" << std::endl;
@ -2788,19 +2610,7 @@ std::string slsDetectorCommand::helpNetworkParameter(int action) {
<< std::endl;
}
if (action == GET_ACTION || action == HELP_ACTION) {
os << "detectormac \n gets detector mac " << std::endl;
os << "detectormac2 \n gets detector mac of 2nd udp interface. Jungfrau only" << std::endl;
os << "detectorip \n gets detector ip " << std::endl;
os << "detectorip2 \n gets detector ip of 2nd udp interface. Jungfrau only" << std::endl;
os << "rx_hostname \n gets receiver ip " << std::endl;
os << "rx_udpmac \n gets receiver udp mac " << std::endl;
os << "rx_udpmac2 \n gets receiver udp mac of 2nd udp interface. Jungfrau only" << std::endl;
os << "rx_udpip \n gets receiver udp mac " << std::endl;
os << "rx_udpip2 \n gets receiver udp mac of 2nd udp interface. Jungfrau only" << std::endl;
os << "rx_udpport \n gets receiver udp port " << std::endl;
os << "rx_udpport2 \n gets receiver udp port of 2nd udp interface. For Eiger, it is the right half and for Jungfrau, it is the top half module and for other detectors, same as rx_udpport" << std::endl;
os << "numinterfaces \n gets the number of interfaces to n used to stream out from the detector. Options: 1 (default), 2. JUNGFRAU only. " << std::endl;
os << "selinterface \n gets interface to use to stream data out of the detector. Options: 0 (outer, default), 1(inner). Effective only when numinterfaces is 1. JUNGFRAU only. " << std::endl;
os << "txndelay_left \n gets detector transmission delay of the left port" << std::endl;
os << "txndelay_right \n gets detector transmission delay of the right port" << std::endl;
os << "txndelay_frame \n gets detector transmission delay of the entire frame" << std::endl;
@ -2937,30 +2747,6 @@ std::string slsDetectorCommand::helpOnline(int action) {
return os.str();
}
std::string slsDetectorCommand::cmdConfigureMac(int narg, const char * const args[], int action, int detPos) {
if (action == HELP_ACTION) {
return helpConfigureMac(action);
}
if (action == PUT_ACTION) {
myDet->configureMAC(detPos);
} else
return std::string("Cannot get ") + cmd;
return std::string("successful");
}
std::string slsDetectorCommand::helpConfigureMac(int action) {
std::ostringstream os;
if (action == PUT_ACTION || action == HELP_ACTION)
os << "configuremac i \n configures the MAC of the detector." << std::endl;
if (action == GET_ACTION || action == HELP_ACTION)
os << "configuremac "
<< "Cannot get " << std::endl;
return os.str();
}
std::string slsDetectorCommand::cmdDetectorSize(int narg, const char * const args[], int action, int detPos) {
@ -4534,8 +4320,7 @@ std::string slsDetectorCommand::cmdConfiguration(int narg, const char * const ar
} else if (cmd == "rx_printconfig") {
if (action == PUT_ACTION)
return std::string("cannot put");
FILE_LOG(logINFO) << myDet->printReceiverConfiguration(detPos);
return std::string("");
return myDet->printReceiverConfiguration(detPos);
} else if (cmd == "parameters") {
if (action == PUT_ACTION) {
sval = std::string(args[1]);