signatures fixed for setnetworkparameter

This commit is contained in:
2019-01-14 15:26:58 +01:00
parent 3c41ec4a7a
commit f0b29cfecc
4 changed files with 433 additions and 365 deletions

View File

@ -1582,58 +1582,6 @@ std::string multiSlsDetector::getNetworkParameter(networkParameter p,
return sls::concatenateIfDifferent(r); return sls::concatenateIfDifferent(r);
} }
int multiSlsDetector::setReceiverDataStreamingOutPort(int i, int detPos) {
if (i >= 0) {
std::string s = std::to_string(i);
int prev_streaming = enableDataStreamingFromReceiver(-1, detPos);
setNetworkParameter(RECEIVER_STREAMING_PORT, s, detPos);
if (prev_streaming) {
enableDataStreamingFromReceiver(0, detPos);
enableDataStreamingFromReceiver(1, detPos);
}
}
return stoi(getNetworkParameter(RECEIVER_STREAMING_PORT, detPos));
}
int multiSlsDetector::setClientDataStreamingInPort(int i, int detPos) {
if (i >= 0) {
std::string s = std::to_string(i);
int prev_streaming = enableDataStreamingToClient();
setNetworkParameter(CLIENT_STREAMING_PORT, s, detPos);
if (prev_streaming) {
enableDataStreamingToClient(0);
enableDataStreamingToClient(1);
}
}
return stoi(getNetworkParameter(CLIENT_STREAMING_PORT, detPos));
}
std::string multiSlsDetector::setReceiverDataStreamingOutIP(const std::string& ip,
int detPos) {
if (ip.length()) {
int prev_streaming = enableDataStreamingFromReceiver(-1, detPos);
setNetworkParameter(RECEIVER_STREAMING_SRC_IP, ip, detPos);
if (prev_streaming) {
enableDataStreamingFromReceiver(0, detPos);
enableDataStreamingFromReceiver(1, detPos);
}
}
return getNetworkParameter(RECEIVER_STREAMING_SRC_IP, detPos);
}
std::string multiSlsDetector::setClientDataStreamingInIP(const std::string& ip,
int detPos) {
if (ip.length()) {
int prev_streaming = enableDataStreamingToClient(-1);
setNetworkParameter(CLIENT_STREAMING_SRC_IP, ip, detPos);
if (prev_streaming) {
enableDataStreamingToClient(0);
enableDataStreamingToClient(1);
}
}
return getNetworkParameter(CLIENT_STREAMING_SRC_IP, detPos);
}
std::string multiSlsDetector::setDetectorMAC(const std::string& detectorMAC, int detPos) { std::string multiSlsDetector::setDetectorMAC(const std::string& detectorMAC, int detPos) {
// single // single
if (detPos >= 0) if (detPos >= 0)
@ -1740,10 +1688,16 @@ std::string multiSlsDetector::getReceiverUDPMAC(int detPos) {
} }
int multiSlsDetector::setReceiverUDPPort(int udpport, int detPos) { 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);
} }
std::string multiSlsDetector::getReceiverUDPPort(int detPos) { int multiSlsDetector::getReceiverUDPPort(int detPos) {
// single // single
if (detPos >= 0) { if (detPos >= 0) {
return detectors[detPos]->getReceiverUDPPort(); return detectors[detPos]->getReceiverUDPPort();
@ -1751,14 +1705,20 @@ std::string multiSlsDetector::getReceiverUDPPort(int detPos) {
// multi // multi
auto r = serialCall(&slsDetector::getReceiverUDPPort); auto r = serialCall(&slsDetector::getReceiverUDPPort);
return sls::concatenateIfDifferent(r); return sls::minusOneIfDifferent(r);
} }
int multiSlsDetector::setReceiverUDPPort2(int udpport, int detPos) { 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);
} }
std::string multiSlsDetector::getReceiverUDPPort2(int detPos) { int multiSlsDetector::getReceiverUDPPort2(int detPos) {
// single // single
if (detPos >= 0) { if (detPos >= 0) {
return detectors[detPos]->getReceiverUDPPort2(); return detectors[detPos]->getReceiverUDPPort2();
@ -1766,6 +1726,151 @@ std::string multiSlsDetector::getReceiverUDPPort2(int detPos) {
// multi // multi
auto r = serialCall(&slsDetector::getReceiverUDPPort2); auto r = serialCall(&slsDetector::getReceiverUDPPort2);
return sls::minusOneIfDifferent(r);
}
void multiSlsDetector::setClientDataStreamingInPort(int i, int detPos) {
if (i >= 0) {
int prev_streaming = enableDataStreamingToClient();
// single
if (detPos >= 0) {
detectors[detPos]->setClientStreamingPort(i);
}
// multi
else {
// calculate ports individually
int firstPort = stoi(value);
int numSockets = (getDetectorsType() == EIGER) ? 2 : 1;
for (size_t idet = 0; idet < detectors.size(); ++idet) {
auto port = std::to_string(firstPort + (idet * numSockets));
detectors[idet]->setClientStreamingPort(port);
}
}
if (prev_streaming) {
enableDataStreamingToClient(0);
enableDataStreamingToClient(1);
}
}
}
int multiSlsDetector::getClientStreamingPort(int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->getClientStreamingPort();
}
// multi
auto r = serialCall(&slsDetector::getClientStreamingPort);
return sls::minusOneIfDifferent(r);
}
void multiSlsDetector::setReceiverDataStreamingOutPort(int i, int detPos) {
if (i >= 0) {
int prev_streaming = enableDataStreamingFromReceiver(-1, detPos);
// single
if (detPos >= 0) {
detectors[detPos]->setReceiverDataStreamingOutPort(i);
}
// multi
else {
// calculate ports individually
int firstPort = stoi(value);
int numSockets = (getDetectorsType() == EIGER) ? 2 : 1;
for (size_t idet = 0; idet < detectors.size(); ++idet) {
auto port = std::to_string(firstPort + (idet * numSockets));
detectors[idet]->setReceiverDataStreamingOutPort(port);
}
}
if (prev_streaming) {
enableDataStreamingFromReceiver(0, detPos);
enableDataStreamingFromReceiver(1, detPos);
}
}
}
int multiSlsDetector::getReceiverStreamingPort(int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->getReceiverStreamingPort();
}
// multi
auto r = serialCall(&slsDetector::getReceiverStreamingPort);
return sls::minusOneIfDifferent(r);
}
void multiSlsDetector::setClientDataStreamingInIP(const std::string& ip,
int detPos) {
if (ip.length()) {
int prev_streaming = enableDataStreamingToClient(-1);
// single
if (detPos >= 0) {
detectors[detPos]->setClientStreamingIP(ip);
}
// multi
else {
for (auto &d : detectors) {
d->setClientStreamingIP(ip);
}
}
if (prev_streaming) {
enableDataStreamingToClient(0);
enableDataStreamingToClient(1);
}
}
}
std::string multiSlsDetector::getClientStreamingIP(int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->getClientStreamingIP();
}
// multi
auto r = serialCall(&slsDetector::getClientStreamingIP);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::setReceiverDataStreamingOutIP(const std::string& ip,
int detPos) {
if (ip.length()) {
int prev_streaming = enableDataStreamingFromReceiver(-1, detPos);
// single
if (detPos >= 0) {
detectors[detPos]->setReceiverStreamingIP(ip);
}
// multi
else {
for (auto &d : detectors) {
d->setReceiverStreamingIP(ip);
}
}
if (prev_streaming) {
enableDataStreamingFromReceiver(0, detPos);
enableDataStreamingFromReceiver(1, detPos);
}
}
return getNetworkParameter(RECEIVER_STREAMING_SRC_IP, detPos);
}
std::string multiSlsDetector::getReceiverStreamingIP(int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->getReceiverStreamingIP();
}
// multi
auto r = serialCall(&slsDetector::getReceiverStreamingIP);
return sls::concatenateIfDifferent(r); return sls::concatenateIfDifferent(r);
} }
@ -1800,17 +1905,17 @@ std::string multiSlsDetector::getAdditionalJsonHeader(int detPos) {
return sls::concatenateIfDifferent(r); return sls::concatenateIfDifferent(r);
} }
std::string multiSlsDetector::setReceiverUDPSocketBufferSize(int udpsockbufsize=-1, int detPos) { int multiSlsDetector::setReceiverUDPSocketBufferSize(int udpsockbufsize=-1, int detPos) {
// single // single
if (detPos >= 0) if (detPos >= 0)
return detectors[detPos]->setReceiverUDPSocketBufferSize(udpsockbufsize); return detectors[detPos]->setReceiverUDPSocketBufferSize(udpsockbufsize);
// multi // multi
auto r = parallelCall(&slsDetector::setReceiverUDPSocketBufferSize, udpsockbufsize); auto r = parallelCall(&slsDetector::setReceiverUDPSocketBufferSize, udpsockbufsize);
return sls::concatenateIfDifferent(r); return sls::minusOneIfDifferent(r);
} }
std::string multiSlsDetector::getReceiverUDPSocketBufferSize(int detPos) { int multiSlsDetector::getReceiverUDPSocketBufferSize(int detPos) {
// single // single
if (detPos >= 0) { if (detPos >= 0) {
return detectors[detPos]->getReceiverUDPSocketBufferSize(); return detectors[detPos]->getReceiverUDPSocketBufferSize();
@ -1818,10 +1923,10 @@ std::string multiSlsDetector::getReceiverUDPSocketBufferSize(int detPos) {
// multi // multi
auto r = serialCall(&slsDetector::getReceiverUDPSocketBufferSize); auto r = serialCall(&slsDetector::getReceiverUDPSocketBufferSize);
return sls::concatenateIfDifferent(r); return sls::minusOneIfDifferent(r);
} }
std::string multiSlsDetector::getReceiverRealUDPSocketBufferSize(int detPos) { int multiSlsDetector::getReceiverRealUDPSocketBufferSize(int detPos) {
// single // single
if (detPos >= 0) { if (detPos >= 0) {
return detectors[detPos]->getReceiverRealUDPSocketBufferSize(); return detectors[detPos]->getReceiverRealUDPSocketBufferSize();
@ -1829,7 +1934,7 @@ std::string multiSlsDetector::getReceiverRealUDPSocketBufferSize(int detPos) {
// multi // multi
auto r = serialCall(&slsDetector::getReceiverRealUDPSocketBufferSize); auto r = serialCall(&slsDetector::getReceiverRealUDPSocketBufferSize);
return sls::concatenateIfDifferent(r); return sls::minusOneIfDifferent(r);
} }
int multiSlsDetector::setFlowControl10G(int enable, int detPos) { int multiSlsDetector::setFlowControl10G(int enable, int detPos) {

View File

@ -862,70 +862,6 @@ class multiSlsDetector : public virtual slsDetectorDefs,
*/ */
std::string getReceiverHostname(int detPos = -1); std::string getReceiverHostname(int detPos = -1);
/**
* Set network parameter
* @param p network parameter type
* @param s network parameter value
* @param detPos -1 for all detectors in list or specific detector position
* @returns network parameter value set (from getNetworkParameter)
*/
std::string setNetworkParameter(networkParameter parameter,
const std::string& value, int detPos = -1);
/**
* Get network parameter
* @param p network parameter type
* @param detPos -1 for all detectors in list or specific detector position
* @returns network parameter value set (from getNetworkParameter)
*/
std::string getNetworkParameter(networkParameter p, int detPos = -1);
/**
* (advanced users)
* Set/Get receiver streaming out ZMQ port and restarts receiver sockets
* @param i sets, -1 gets
* If detPos is -1(multi module), port calculated (increments) for all the
* individual detectors using i
* @param detPos -1 for all detectors in list or specific detector position
* @returns receiver streaming out ZMQ port (if multiple, of first receiver
* socket)
*/
int setReceiverDataStreamingOutPort(int i = -1, int detPos = -1);
/**
* (advanced users)
* Set/Get client streaming in ZMQ port and restarts client sockets
* @param i sets, -1 gets
* If detPos is -1(multi module), port calculated (increments) for all the
* individual detectors using i
* @param detPos -1 for all detectors in list or specific detector position
* @returns receiver streaming out ZMQ port (if multiple, of first receiver
* socket)
*/
int setClientDataStreamingInPort(int i = -1, int detPos = -1);
/**
* (advanced users)
* Set/Get receiver streaming out ZMQ IP and restarts receiver sockets
* @param i sets, empty string gets
* By default, it is the IP of receiver hostname
* @param detPos -1 for all detectors in list or specific detector position
* @returns receiver streaming out ZMQ IP
*/
std::string setReceiverDataStreamingOutIP(const std::string& ip = "",
int detPos = -1);
/**
* (advanced users)
* Set/Get client streaming in ZMQ IP and restarts client sockets
* @param i sets, empty string gets
* By default, it is the IP of receiver hostname
* @param detPos -1 for all detectors in list or specific detector position
* @returns client streaming in ZMQ IP
*/
std::string setClientDataStreamingInIP(const std::string& ip = "",
int detPos = -1);
/** /**
* Validates the format of the detector MAC address and sets it * Validates the format of the detector MAC address and sets it
* @param detectorMAC detector MAC address * @param detectorMAC detector MAC address
@ -964,14 +900,14 @@ class multiSlsDetector : public virtual slsDetectorDefs,
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
* @returns the receiver IP address from shared memory * @returns the receiver IP address from shared memory
*/ */
std::string setReceiverHostname(const std::string& receiver, int detPos = -1); std::string setReceiver(const std::string& receiver, int detPos = -1);
/** /**
* Returns the receiver IP address * Returns the receiver IP address
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
* @returns the receiver IP address * @returns the receiver IP address
*/ */
std::string getReceiverHostname(int detPos = -1); std::string getReceiver(int detPos = -1);
/** /**
* Validates the format of the receiver UDP IP address and sets it * Validates the format of the receiver UDP IP address and sets it
@ -1017,7 +953,7 @@ class multiSlsDetector : public virtual slsDetectorDefs,
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
* @returns the receiver UDP port * @returns the receiver UDP port
*/ */
std::string getReceiverUDPPort(int detPos = -1); int getReceiverUDPPort(int detPos = -1);
/** /**
* Sets the receiver UDP port 2 * Sets the receiver UDP port 2
@ -1032,7 +968,79 @@ class multiSlsDetector : public virtual slsDetectorDefs,
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
* @returns the receiver UDP port 2 of same interface * @returns the receiver UDP port 2 of same interface
*/ */
std::string getReceiverUDPPort2(int detPos = -1); int getReceiverUDPPort2(int detPos = -1);
/**
* (advanced users)
* Set/Get client streaming in ZMQ port and restarts client sockets
* @param i sets, -1 gets
* If detPos is -1(multi module), port calculated (increments) for all the
* individual detectors using i
* @param detPos -1 for all detectors in list or specific detector position
*/
void setClientDataStreamingInPort(int i = -1, int detPos = -1);
/**
* Returns the client zmq port
* If detPos is -1(multi module), port returns client streaming port of first module
* @param detPos -1 for all detectors in list or specific detector position
* @returns the client zmq port
*/
int getClientStreamingPort(int detPos = -1);
/**
* (advanced users)
* Set/Get receiver streaming out ZMQ port and restarts receiver sockets
* @param i sets, -1 gets
* If detPos is -1(multi module), port calculated (increments) for all the
* individual detectors using i
* @param detPos -1 for all detectors in list or specific detector position
*/
void setReceiverDataStreamingOutPort(int i = -1, int detPos = -1);
/**
* Returns the receiver zmq port
* If detPos is -1(multi module), port returns receiver streaming port of first module
* @param detPos -1 for all detectors in list or specific detector position
* @returns the receiver zmq port
*/
int getReceiverStreamingPort(int detPos = -1);
/**
* (advanced users)
* Set/Get client streaming in ZMQ IP and restarts client sockets
* @param i sets, empty string gets
* By default, it is the IP of receiver hostname
* @param detPos -1 for all detectors in list or specific detector position
*/
void setClientDataStreamingInIP(const std::string& ip = "",
int detPos = -1);
/**
* Returns the client zmq ip
* If detPos is -1(multi module), ip returns concatenation of all client streaming ip
* @param detPos -1 for all detectors in list or specific detector position
* @returns the client zmq ip
*/
std::string getClientStreamingIP(int detPos = -1);
/**
* (advanced users)
* Set/Get receiver streaming out ZMQ IP and restarts receiver sockets
* @param i sets, empty string gets
* By default, it is the IP of receiver hostname
* @param detPos -1 for all detectors in list or specific detector position
*/
void setReceiverDataStreamingOutIP(const std::string& ip = "",
int detPos = -1);
/**
* Returns the receiver zmq ip
* If detPos is -1(multi module), ip returns concatenation of all receiver streaming ip
* @param detPos -1 for all detectors in list or specific detector position
* @returns the receiver zmq ip
*/
std::string getReceiverStreamingIP(int detPos = -1);
/** /**
* Sets the transmission delay for left, right or entire frame * Sets the transmission delay for left, right or entire frame
@ -1065,21 +1073,21 @@ class multiSlsDetector : public virtual slsDetectorDefs,
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
* @returns receiver udp socket buffer size * @returns receiver udp socket buffer size
*/ */
std::string setReceiverUDPSocketBufferSize(int udpsockbufsize=-1, int detPos = -1); int setReceiverUDPSocketBufferSize(int udpsockbufsize=-1, int detPos = -1);
/** /**
* Returns the receiver UDP socket buffer size * Returns the receiver UDP socket buffer size
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
* @returns the receiver UDP socket buffer size * @returns the receiver UDP socket buffer size
*/ */
std::string getReceiverUDPSocketBufferSize(int detPos = -1) ; int getReceiverUDPSocketBufferSize(int detPos = -1) ;
/** /**
* Returns the receiver real UDP socket buffer size * Returns the receiver real UDP socket buffer size
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
* @returns the receiver real UDP socket buffer size * @returns the receiver real UDP socket buffer size
*/ */
std::string getReceiverRealUDPSocketBufferSize(int detPos = -1); int getReceiverRealUDPSocketBufferSize(int detPos = -1);
/** (users only) /** (users only)
* Set 10GbE Flow Control (Eiger) * Set 10GbE Flow Control (Eiger)

View File

@ -2751,95 +2751,6 @@ std::string slsDetector::getNetworkParameter(networkParameter index) {
} }
std::string slsDetector::getDetectorMAC() {
return std::string(thisDetector->detectorMAC);
}
std::string slsDetector::getDetectorIP() {
return std::string(thisDetector->detectorIP);
}
std::string slsDetector::getReceiver() {
return std::string(thisDetector->receiver_hostname);
}
std::string slsDetector::getReceiverUDPIP() {
return std::string(thisDetector->receiverUDPIP);
}
std::string slsDetector::getReceiverUDPMAC() {
return std::string(thisDetector->receiverUDPMAC);
}
std::string slsDetector::getReceiverUDPPort() {
return std::to_string(thisDetector->receiverUDPPort);
}
std::string slsDetector::getReceiverUDPPort2() {
return std::to_string(thisDetector->receiverUDPPort2);
}
std::string slsDetector::getClientStreamingPort() {
return std::to_string(thisDetector->zmqport);
}
std::string slsDetector::getReceiverStreamingPort() {
return std::to_string(thisDetector->receiver_zmqport);
}
std::string slsDetector::getClientStreamingIP() {
return std::string(thisDetector->zmqip);
}
std::string slsDetector::getReceiverStreamingIP() {
return std::string(thisDetector->receiver_zmqip);
}
std::string slsDetector::getAdditionalJsonHeader() {
return std::string(thisDetector->receiver_additionalJsonHeader);
}
std::string slsDetector::getReceiverUDPSocketBufferSize() {
return setReceiverUDPSocketBufferSize();
}
std::string slsDetector::getReceiverRealUDPSocketBufferSize() {
int fnum = F_RECEIVER_REAL_UDP_SOCK_BUF_SIZE;
int ret = FAIL;
int retval = -1;
FILE_LOG(logDEBUG1) << "Getting real UDP Socket Buffer size to receiver";
if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) {
ret = thisReceiver->Client_Send(fnum, nullptr, 0, &retval, sizeof(retval));
disconnectData();
// handle ret
if (ret == FAIL) {
setErrorMask((getErrorMask())|(COULDNOT_SET_NETWORK_PARAMETER));
} else {
FILE_LOG(logDEBUG1) << "Real Receiver UDP Socket Buffer size: " << retval;
if (ret == FORCE_UPDATE)
ret = updateReceiver();
}
}
return std::to_string(retval);
}
std::string slsDetector::setDetectorMAC(const std::string& detectorMAC) { std::string slsDetector::setDetectorMAC(const std::string& detectorMAC) {
// invalid format // invalid format
@ -2861,6 +2772,9 @@ std::string slsDetector::setDetectorMAC(const std::string& detectorMAC) {
return std::string(thisDetector->detectorMAC); return std::string(thisDetector->detectorMAC);
} }
std::string slsDetector::getDetectorMAC() {
return std::string(thisDetector->detectorMAC);
}
std::string slsDetector::setDetectorIP(const std::string& detectorIP) { std::string slsDetector::setDetectorIP(const std::string& detectorIP) {
struct sockaddr_in sa; struct sockaddr_in sa;
@ -2885,6 +2799,9 @@ std::string slsDetector::setDetectorIP(const std::string& detectorIP) {
return std::string(thisDetector->detectorIP); return std::string(thisDetector->detectorIP);
} }
std::string slsDetector::getDetectorIP() {
return std::string(thisDetector->detectorIP);
}
std::string slsDetector::setReceiver(const std::string& receiverIP) { std::string slsDetector::setReceiver(const std::string& receiverIP) {
FILE_LOG(logDEBUG1) << "Setting up Receiver with " << receiverIP; FILE_LOG(logDEBUG1) << "Setting up Receiver with " << receiverIP;
@ -2987,6 +2904,10 @@ std::string slsDetector::setReceiver(const std::string& receiverIP) {
} }
std::string slsDetector::getReceiver() {
return std::string(thisDetector->receiver_hostname);
}
std::string slsDetector::setReceiverUDPIP(const std::string& udpip) { std::string slsDetector::setReceiverUDPIP(const std::string& udpip) {
struct sockaddr_in sa; struct sockaddr_in sa;
if (udpip.length() && udpip.length() < 16) { if (udpip.length() && udpip.length() < 16) {
@ -3010,6 +2931,9 @@ std::string slsDetector::setReceiverUDPIP(const std::string& udpip) {
return std::string(thisDetector->receiverUDPIP); return std::string(thisDetector->receiverUDPIP);
} }
std::string slsDetector::getReceiverUDPIP() {
return std::string(thisDetector->receiverUDPIP);
}
std::string slsDetector::setReceiverUDPMAC(const std::string& udpmac) { std::string slsDetector::setReceiverUDPMAC(const std::string& udpmac) {
// invalid format // invalid format
@ -3031,6 +2955,9 @@ std::string slsDetector::setReceiverUDPMAC(const std::string& udpmac) {
return std::string(thisDetector->receiverUDPMAC); return std::string(thisDetector->receiverUDPMAC);
} }
std::string slsDetector::getReceiverUDPMAC() {
return std::string(thisDetector->receiverUDPMAC);
}
int slsDetector::setReceiverUDPPort(int udpport) { int slsDetector::setReceiverUDPPort(int udpport) {
thisDetector->receiverUDPPort = udpport; thisDetector->receiverUDPPort = udpport;
@ -3043,6 +2970,9 @@ int slsDetector::setReceiverUDPPort(int udpport) {
return thisDetector->receiverUDPPort; return thisDetector->receiverUDPPort;
} }
int slsDetector::getReceiverUDPPort() {
return thisDetector->receiverUDPPort;
}
int slsDetector::setReceiverUDPPort2(int udpport) { int slsDetector::setReceiverUDPPort2(int udpport) {
thisDetector->receiverUDPPort2 = udpport; thisDetector->receiverUDPPort2 = udpport;
@ -3055,14 +2985,20 @@ int slsDetector::setReceiverUDPPort2(int udpport) {
return thisDetector->receiverUDPPort2; return thisDetector->receiverUDPPort2;
} }
int slsDetector::getReceiverUDPPort2() {
return thisDetector->receiverUDPPort2;
}
std::string slsDetector::setClientStreamingPort(const std::string& port) { int slsDetector::setClientStreamingPort(int port) {
thisDetector->zmqport = stoi(port); thisDetector->zmqport = stoi(port);
return getClientStreamingPort(); return getClientStreamingPort();
} }
int slsDetector::getClientStreamingPort() {
return thisDetector->zmqport;
}
std::string slsDetector::setReceiverStreamingPort(const std::string& port) { int slsDetector::setReceiverStreamingPort(int port) {
// copy now else it is lost if rx_hostname not set yet // copy now else it is lost if rx_hostname not set yet
thisDetector->receiver_zmqport = stoi(port); thisDetector->receiver_zmqport = stoi(port);
@ -3089,8 +3025,11 @@ std::string slsDetector::setReceiverStreamingPort(const std::string& port) {
return getReceiverStreamingPort(); return getReceiverStreamingPort();
} }
int slsDetector::getReceiverStreamingPort() {
return thisDetector->receiver_zmqport;
}
std::string slsDetector::setClientStreamingIP(const std::string& sourceIP) { int slsDetector::setClientStreamingIP(int sourceIP) {
struct addrinfo *result; struct addrinfo *result;
// on failure to convert to a valid ip // on failure to convert to a valid ip
if (dataSocket->ConvertHostnameToInternetAddress(sourceIP.c_str(), &result)) { if (dataSocket->ConvertHostnameToInternetAddress(sourceIP.c_str(), &result)) {
@ -3104,6 +3043,9 @@ std::string slsDetector::setClientStreamingIP(const std::string& sourceIP) {
return getClientStreamingIP(); return getClientStreamingIP();
} }
int slsDetector::getClientStreamingIP() {
return thisDetector->zmqip;
}
std::string slsDetector::setReceiverStreamingIP(std::string sourceIP) { std::string slsDetector::setReceiverStreamingIP(std::string sourceIP) {
int fnum = F_RECEIVER_STREAMING_SRC_IP; int fnum = F_RECEIVER_STREAMING_SRC_IP;
@ -3162,6 +3104,33 @@ std::string slsDetector::setReceiverStreamingIP(std::string sourceIP) {
return getReceiverStreamingIP(); return getReceiverStreamingIP();
} }
std::string slsDetector::getReceiverStreamingIP() {
return std::string(thisDetector->receiver_zmqip);
}
std::string slsDetector::setDetectorNetworkParameter(networkParameter index, int delay) {
int fnum = F_SET_NETWORK_PARAMETER;
int ret = FAIL;
int args[2] = {(int)index, delay};
int retval = -1;
FILE_LOG(logDEBUG1) << "Setting network parameter index " << index << " to " << delay;
if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) {
ret = thisDetectorControl->Client_Send(fnum, args, sizeof(args), &retval, sizeof(retval));
disconnectControl();
// handle ret
if (ret == FAIL) {
setErrorMask((getErrorMask())|(DETECTOR_NETWORK_PARAMETER));
} else {
FILE_LOG(logDEBUG1) << "Network Parameter (" << index << "): " << retval;
if (ret == FORCE_UPDATE)
ret = updateDetector();
}
}
return std::to_string(retval);
}
std::string slsDetector::setAdditionalJsonHeader(const std::string& jsonheader) { std::string slsDetector::setAdditionalJsonHeader(const std::string& jsonheader) {
int fnum = F_ADDITIONAL_JSON_HEADER; int fnum = F_ADDITIONAL_JSON_HEADER;
@ -3189,8 +3158,12 @@ std::string slsDetector::setAdditionalJsonHeader(const std::string& jsonheader)
return getAdditionalJsonHeader(); return getAdditionalJsonHeader();
} }
std::string slsDetector::getAdditionalJsonHeader() {
return std::string(thisDetector->receiver_additionalJsonHeader);
}
std::string slsDetector::setReceiverUDPSocketBufferSize(int udpsockbufsize) {
int slsDetector::setReceiverUDPSocketBufferSize(int udpsockbufsize) {
int fnum = F_RECEIVER_UDP_SOCK_BUF_SIZE; int fnum = F_RECEIVER_UDP_SOCK_BUF_SIZE;
int ret = FAIL; int ret = FAIL;
int arg = udpsockbufsize; int arg = udpsockbufsize;
@ -3210,31 +3183,34 @@ std::string slsDetector::setReceiverUDPSocketBufferSize(int udpsockbufsize) {
ret = updateReceiver(); ret = updateReceiver();
} }
} }
return std::to_string(retval); return retval;
}
int slsDetector::getReceiverUDPSocketBufferSize() {
return setReceiverUDPSocketBufferSize();
} }
std::string slsDetector::setDetectorNetworkParameter(networkParameter index, int delay) { int slsDetector::getReceiverRealUDPSocketBufferSize() {
int fnum = F_SET_NETWORK_PARAMETER; int fnum = F_RECEIVER_REAL_UDP_SOCK_BUF_SIZE;
int ret = FAIL; int ret = FAIL;
int args[2] = {(int)index, delay};
int retval = -1; int retval = -1;
FILE_LOG(logDEBUG1) << "Setting network parameter index " << index << " to " << delay; FILE_LOG(logDEBUG1) << "Getting real UDP Socket Buffer size to receiver";
if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) {
ret = thisDetectorControl->Client_Send(fnum, args, sizeof(args), &retval, sizeof(retval)); ret = thisReceiver->Client_Send(fnum, nullptr, 0, &retval, sizeof(retval));
disconnectControl(); disconnectData();
// handle ret // handle ret
if (ret == FAIL) { if (ret == FAIL) {
setErrorMask((getErrorMask())|(DETECTOR_NETWORK_PARAMETER)); setErrorMask((getErrorMask())|(COULDNOT_SET_NETWORK_PARAMETER));
} else { } else {
FILE_LOG(logDEBUG1) << "Network Parameter (" << index << "): " << retval; FILE_LOG(logDEBUG1) << "Real Receiver UDP Socket Buffer size: " << retval;
if (ret == FORCE_UPDATE) if (ret == FORCE_UPDATE)
ret = updateDetector(); ret = updateReceiver();
} }
} }
return std::to_string(retval); return retval;
} }

View File

@ -859,19 +859,11 @@ public:
uint32_t clearBit(uint32_t addr, int n); uint32_t clearBit(uint32_t addr, int n);
/** /**
* Set network parameter * Validates the format of the detector MAC address and sets it \sa sharedSlsDetector
* @param p network parameter type * @param detectorMAC detector MAC address
* @param value network parameter value * @returns the detector MAC address
* @returns network parameter value set (from getNetworkParameter)
*/ */
std::string setNetworkParameter(networkParameter index, const std::string& value); std::string setDetectorMAC(const std::string& detectorMAC);
/**
* Get network parameter
* @param index network parameter type
* @returns network parameter value set (from getNetworkParameter)
*/
std::string getNetworkParameter(networkParameter index);
/** /**
* Returns the detector MAC address\sa sharedSlsDetector * Returns the detector MAC address\sa sharedSlsDetector
@ -879,73 +871,6 @@ public:
*/ */
std::string getDetectorMAC(); std::string getDetectorMAC();
/**
* Returns the detector IP address\sa sharedSlsDetector
* @returns the detector IP address
*/
std::string getDetectorIP();
/**
* Returns the receiver IP address\sa sharedSlsDetector
* @returns the receiver IP address
*/
std::string getReceiver();
/**
* Returns the receiver UDP IP address\sa sharedSlsDetector
* @returns the receiver UDP IP address
*/
std::string getReceiverUDPIP();
/**
* Returns the receiver UDP MAC address\sa sharedSlsDetector
* @returns the receiver UDP MAC address
*/
std::string getReceiverUDPMAC();
/**
* Returns the receiver UDP port\sa sharedSlsDetector
* @returns the receiver UDP port
*/
std::string getReceiverUDPPort();
/**
* Returns the receiver UDP port 2 of same interface\sa sharedSlsDetector
* @returns the receiver UDP port 2 of same interface
*/
std::string getReceiverUDPPort2();
/**
* Returns the client zmq port \sa sharedSlsDetector
* @returns the client zmq port
*/
std::string getClientStreamingPort();
/**
* Returns the receiver zmq port \sa sharedSlsDetector
* @returns the receiver zmq port
*/
std::string getReceiverStreamingPort();
/**
* Returns the client zmq ip \sa sharedSlsDetector
* @returns the client zmq ip, returns "none" if default setting and no custom ip set
*/
std::string getClientStreamingIP();
/**
* Returns the receiver zmq ip \sa sharedSlsDetector
* @returns the receiver zmq ip, returns "none" if default setting and no custom ip set
*/
std::string getReceiverStreamingIP();
/**
* Validates the format of the detector MAC address and sets it \sa sharedSlsDetector
* @param detectorMAC detector MAC address
* @returns the detector MAC address
*/
std::string setDetectorMAC(const std::string& detectorMAC);
/** /**
* Validates the format of the detector IP address and sets it \sa sharedSlsDetector * Validates the format of the detector IP address and sets it \sa sharedSlsDetector
* @param detectorIP detector IP address * @param detectorIP detector IP address
@ -953,6 +878,12 @@ public:
*/ */
std::string setDetectorIP(const std::string& detectorIP); std::string setDetectorIP(const std::string& detectorIP);
/**
* Returns the detector IP address\sa sharedSlsDetector
* @returns the detector IP address
*/
std::string getDetectorIP();
/** /**
* Validates and sets the receiver. * Validates and sets the receiver.
* Also updates the receiver with all the shared memory parameters significant for the receiver * Also updates the receiver with all the shared memory parameters significant for the receiver
@ -962,6 +893,12 @@ public:
*/ */
std::string setReceiver(const std::string& receiver); std::string setReceiver(const std::string& receiver);
/**
* Returns the receiver IP address\sa sharedSlsDetector
* @returns the receiver IP address
*/
std::string getReceiver();
/** /**
* Validates the format of the receiver UDP IP address and sets it \sa sharedSlsDetector * Validates the format of the receiver UDP IP address and sets it \sa sharedSlsDetector
* @param udpip receiver UDP IP address * @param udpip receiver UDP IP address
@ -969,6 +906,12 @@ public:
*/ */
std::string setReceiverUDPIP(const std::string& udpip); std::string setReceiverUDPIP(const std::string& udpip);
/**
* Returns the receiver UDP IP address\sa sharedSlsDetector
* @returns the receiver UDP IP address
*/
std::string getReceiverUDPIP();
/** /**
* Validates the format of the receiver UDP MAC address and sets it \sa sharedSlsDetector * Validates the format of the receiver UDP MAC address and sets it \sa sharedSlsDetector
* @param udpmac receiver UDP MAC address * @param udpmac receiver UDP MAC address
@ -976,6 +919,12 @@ public:
*/ */
std::string setReceiverUDPMAC(const std::string& udpmac); std::string setReceiverUDPMAC(const std::string& udpmac);
/**
* Returns the receiver UDP MAC address\sa sharedSlsDetector
* @returns the receiver UDP MAC address
*/
std::string getReceiverUDPMAC();
/** /**
* Sets the receiver UDP port\sa sharedSlsDetector * Sets the receiver UDP port\sa sharedSlsDetector
* @param udpport receiver UDP port * @param udpport receiver UDP port
@ -983,6 +932,12 @@ public:
*/ */
int setReceiverUDPPort(int udpport); int setReceiverUDPPort(int udpport);
/**
* Returns the receiver UDP port\sa sharedSlsDetector
* @returns the receiver UDP port
*/
int getReceiverUDPPort();
/** /**
* Sets the receiver UDP port 2\sa sharedSlsDetector * Sets the receiver UDP port 2\sa sharedSlsDetector
* @param udpport receiver UDP port 2 * @param udpport receiver UDP port 2
@ -990,35 +945,100 @@ public:
*/ */
int setReceiverUDPPort2(int udpport); int setReceiverUDPPort2(int udpport);
/**
* Returns the receiver UDP port 2 of same interface\sa sharedSlsDetector
* @returns the receiver UDP port 2 of same interface
*/
int getReceiverUDPPort2();
/** /**
* Sets the client zmq port\sa sharedSlsDetector * Sets the client zmq port\sa sharedSlsDetector
* @param port client zmq port (includes "multi" at the end if it should * @param port client zmq port
* calculate individual ports) */
void setClientStreamingPort(int port);
/**
* Returns the client zmq port \sa sharedSlsDetector
* @returns the client zmq port * @returns the client zmq port
*/ */
std::string setClientStreamingPort(const std::string& port); int getClientStreamingPort();
/** /**
* Sets the receiver zmq port\sa sharedSlsDetector * Sets the receiver zmq port\sa sharedSlsDetector
* @param port receiver zmq port (includes "multi" at the end if it should * @param port receiver zmq port
* calculate individual ports) */
void setReceiverStreamingPort(int port);
/**
* Returns the receiver zmq port \sa sharedSlsDetector
* @returns the receiver zmq port * @returns the receiver zmq port
*/ */
std::string setReceiverStreamingPort(const std::string& port); int getReceiverStreamingPort();
/** /**
* Sets the client zmq ip\sa sharedSlsDetector * Sets the client zmq ip\sa sharedSlsDetector
* @param sourceIP client zmq ip * @param sourceIP client zmq ip
*/
void setClientStreamingIP(const std::string& sourceIP);
/**
* Returns the client zmq ip \sa sharedSlsDetector
* @returns the client zmq ip, returns "none" if default setting and no custom ip set * @returns the client zmq ip, returns "none" if default setting and no custom ip set
*/ */
std::string setClientStreamingIP(const std::string& sourceIP); std::string getClientStreamingIP();
/** /**
* Sets the receiver zmq ip\sa sharedSlsDetector * Sets the receiver zmq ip\sa sharedSlsDetector
* @param sourceIP receiver zmq ip. If empty, uses rx_hostname * @param sourceIP receiver zmq ip. If empty, uses rx_hostname
*/
void setReceiverStreamingIP(std::string sourceIP);
/**
* Returns the receiver zmq ip \sa sharedSlsDetector
* @returns the receiver zmq ip, returns "none" if default setting and no custom ip set * @returns the receiver zmq ip, returns "none" if default setting and no custom ip set
*/ */
std::string setReceiverStreamingIP(std::string sourceIP); std::string getReceiverStreamingIP();
/**
* Sets the transmission delay for left, right or entire frame
* (Eiger, Jungfrau(only entire frame))
* @param index type of delay
* @param delay delay
* @returns transmission delay
*/
std::string setDetectorNetworkParameter(networkParameter index, int delay);
/**
* Sets the additional json header\sa sharedSlsDetector
* @param jsonheader additional json header
* @returns additional json header, returns "none" if default setting and no custom ip set
*/
std::string setAdditionalJsonHeader(const std::string& jsonheader);
/**
* Returns the additional json header \sa sharedSlsDetector
* @returns the additional json header, returns "none" if default setting and no custom ip set
*/
std::string getAdditionalJsonHeader();
/**
* Sets the receiver UDP socket buffer size
* @param udpsockbufsize additional json header
* @returns receiver udp socket buffer size
*/
int setReceiverUDPSocketBufferSize(int udpsockbufsize=-1);
/**
* Returns the receiver UDP socket buffer size\sa sharedSlsDetector
* @returns the receiver UDP socket buffer size
*/
int getReceiverUDPSocketBufferSize() ;
/**
* Returns the receiver real UDP socket buffer size\sa sharedSlsDetector
* @returns the receiver real UDP socket buffer size
*/
int getReceiverRealUDPSocketBufferSize();
/** /**
* Execute a digital test (Gotthard, Mythen) * Execute a digital test (Gotthard, Mythen)
@ -1700,47 +1720,6 @@ private:
*/ */
int receiveModule(sls_detector_module* myMod); int receiveModule(sls_detector_module* myMod);
/**
* Returns the additional json header \sa sharedSlsDetector
* @returns the additional json header, returns "none" if default setting and no custom ip set
*/
std::string getAdditionalJsonHeader();
/**
* Returns the receiver UDP socket buffer size\sa sharedSlsDetector
* @returns the receiver UDP socket buffer size
*/
std::string getReceiverUDPSocketBufferSize() ;
/**
* Returns the receiver real UDP socket buffer size\sa sharedSlsDetector
* @returns the receiver real UDP socket buffer size
*/
std::string getReceiverRealUDPSocketBufferSize();
/**
* Sets the additional json header\sa sharedSlsDetector
* @param jsonheader additional json header
* @returns additional json header, returns "none" if default setting and no custom ip set
*/
std::string setAdditionalJsonHeader(const std::string& jsonheader);
/**
* Sets the receiver UDP socket buffer size
* @param udpsockbufsize additional json header
* @returns receiver udp socket buffer size
*/
std::string setReceiverUDPSocketBufferSize(int udpsockbufsize=-1);
/**
* Sets the transmission delay for left, right or entire frame
* (Eiger, Jungfrau(only entire frame))
* @param index type of delay
* @param delay delay
* @returns transmission delay
*/
std::string setDetectorNetworkParameter(networkParameter index, int delay);
/** /**
* Get MAC from the receiver using udpip and * Get MAC from the receiver using udpip and
* set up UDP connection in detector * set up UDP connection in detector