mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-07 10:30:41 +02:00
removing networkPArameter function complete
This commit is contained in:
parent
f0b29cfecc
commit
c1c302f740
@ -12,7 +12,7 @@ option (USE_GUI "GUI" OFF)
|
||||
option (USE_TESTS "TESTS" ON)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -Wno-misleading-indentation")
|
||||
else ()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 ")
|
||||
endif ()
|
||||
|
@ -1543,45 +1543,6 @@ uint32_t multiSlsDetector::clearBit(uint32_t addr, int n, int detPos) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::setNetworkParameter(networkParameter parameter,
|
||||
const std::string& value,
|
||||
int detPos) {
|
||||
// single
|
||||
if (detPos >= 0)
|
||||
return detectors[detPos]->setNetworkParameter(parameter, value);
|
||||
|
||||
// multi
|
||||
if (parameter != RECEIVER_STREAMING_PORT &&
|
||||
parameter != CLIENT_STREAMING_PORT) {
|
||||
auto r =
|
||||
parallelCall(&slsDetector::setNetworkParameter, parameter, value);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
// calculate ports individually
|
||||
int firstPort = stoi(value);
|
||||
int numSockets = (getDetectorsType() == EIGER) ? 2 : 1;
|
||||
|
||||
std::vector<std::string> r;
|
||||
for (size_t idet = 0; idet < detectors.size(); ++idet) {
|
||||
auto port = std::to_string(firstPort + (idet * numSockets));
|
||||
r.push_back(detectors[idet]->setNetworkParameter(parameter, port));
|
||||
}
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::getNetworkParameter(networkParameter p,
|
||||
int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getNetworkParameter(p);
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = serialCall(&slsDetector::getNetworkParameter, p);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::setDetectorMAC(const std::string& detectorMAC, int detPos) {
|
||||
// single
|
||||
if (detPos >= 0)
|
||||
@ -1624,24 +1585,24 @@ std::string multiSlsDetector::getDetectorIP(int detPos) {
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::setReceiverHostname(const std::string& receiver, int detPos) {
|
||||
std::string multiSlsDetector::setReceiver(const std::string& receiver, int detPos) {
|
||||
// single
|
||||
if (detPos >= 0)
|
||||
return detectors[detPos]->setReceiverHostname(receiver);
|
||||
return detectors[detPos]->setReceiver(receiver);
|
||||
|
||||
// multi
|
||||
auto r = parallelCall(&slsDetector::setReceiverHostname, receiver);
|
||||
auto r = parallelCall(&slsDetector::setReceiver, receiver);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::getReceiverHostname(int detPos) {
|
||||
std::string multiSlsDetector::getReceiver(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getReceiverHostname();
|
||||
return detectors[detPos]->getReceiver();
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = serialCall(&slsDetector::getReceiverHostname);
|
||||
auto r = serialCall(&slsDetector::getReceiver);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
@ -1740,11 +1701,11 @@ void multiSlsDetector::setClientDataStreamingInPort(int i, int detPos) {
|
||||
// multi
|
||||
else {
|
||||
// calculate ports individually
|
||||
int firstPort = stoi(value);
|
||||
int firstPort = i;
|
||||
int numSockets = (getDetectorsType() == EIGER) ? 2 : 1;
|
||||
|
||||
for (size_t idet = 0; idet < detectors.size(); ++idet) {
|
||||
auto port = std::to_string(firstPort + (idet * numSockets));
|
||||
auto port = firstPort + (idet * numSockets);
|
||||
detectors[idet]->setClientStreamingPort(port);
|
||||
}
|
||||
}
|
||||
@ -1773,17 +1734,17 @@ void multiSlsDetector::setReceiverDataStreamingOutPort(int i, int detPos) {
|
||||
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
detectors[detPos]->setReceiverDataStreamingOutPort(i);
|
||||
detectors[detPos]->setReceiverStreamingPort(i);
|
||||
}
|
||||
// multi
|
||||
else {
|
||||
// calculate ports individually
|
||||
int firstPort = stoi(value);
|
||||
int firstPort = i;
|
||||
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);
|
||||
auto port = firstPort + (idet * numSockets);
|
||||
detectors[idet]->setReceiverStreamingPort(port);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1805,7 +1766,7 @@ int multiSlsDetector::getReceiverStreamingPort(int detPos) {
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
void multiSlsDetector::setClientDataStreamingInIP(const std::string& ip,
|
||||
void multiSlsDetector::setClientDataStreamingInIP(std::string ip,
|
||||
int detPos) {
|
||||
if (ip.length()) {
|
||||
int prev_streaming = enableDataStreamingToClient(-1);
|
||||
@ -1839,7 +1800,7 @@ std::string multiSlsDetector::getClientStreamingIP(int detPos) {
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::setReceiverDataStreamingOutIP(const std::string& ip,
|
||||
void multiSlsDetector::setReceiverDataStreamingOutIP(std::string ip,
|
||||
int detPos) {
|
||||
if (ip.length()) {
|
||||
int prev_streaming = enableDataStreamingFromReceiver(-1, detPos);
|
||||
@ -1860,7 +1821,6 @@ std::string multiSlsDetector::setReceiverDataStreamingOutIP(const std::string& i
|
||||
enableDataStreamingFromReceiver(1, detPos);
|
||||
}
|
||||
}
|
||||
return getNetworkParameter(RECEIVER_STREAMING_SRC_IP, detPos);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::getReceiverStreamingIP(int detPos) {
|
||||
@ -1874,14 +1834,14 @@ std::string multiSlsDetector::getReceiverStreamingIP(int detPos) {
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::setDetectorNetworkParameter(networkParameter index, int delay, int detPos) {
|
||||
int multiSlsDetector::setDetectorNetworkParameter(networkParameter index, int delay, int detPos) {
|
||||
// single
|
||||
if (detPos >= 0)
|
||||
return detectors[detPos]->setDetectorNetworkParameter(index, delay);
|
||||
|
||||
// multi
|
||||
auto r = parallelCall(&slsDetector::setDetectorNetworkParameter, index, delay);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::setAdditionalJsonHeader(const std::string& jsonheader, int detPos) {
|
||||
@ -1905,7 +1865,7 @@ std::string multiSlsDetector::getAdditionalJsonHeader(int detPos) {
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
int multiSlsDetector::setReceiverUDPSocketBufferSize(int udpsockbufsize=-1, int detPos) {
|
||||
int multiSlsDetector::setReceiverUDPSocketBufferSize(int udpsockbufsize, int detPos) {
|
||||
// single
|
||||
if (detPos >= 0)
|
||||
return detectors[detPos]->setReceiverUDPSocketBufferSize(udpsockbufsize);
|
||||
@ -1938,13 +1898,10 @@ int multiSlsDetector::getReceiverRealUDPSocketBufferSize(int detPos) {
|
||||
}
|
||||
|
||||
int multiSlsDetector::setFlowControl10G(int enable, int detPos) {
|
||||
std::string s;
|
||||
if (enable != -1) {
|
||||
s = std::to_string((enable >= 1) ? 1 : 0);
|
||||
s = setNetworkParameter(FLOW_CONTROL_10G, s);
|
||||
} else
|
||||
s = getNetworkParameter(FLOW_CONTROL_10G);
|
||||
return stoi(s);
|
||||
enable = ((enable >= 1) ? 1 : 0);
|
||||
}
|
||||
return setDetectorNetworkParameter(FLOW_CONTROL_10G, enable, detPos);
|
||||
}
|
||||
|
||||
int multiSlsDetector::digitalTest(digitalTestMode mode, int ival, int detPos) {
|
||||
@ -2933,7 +2890,7 @@ int multiSlsDetector::createReceivingDataSockets(const bool destroy) {
|
||||
numSockets *= numSocketsPerDetector;
|
||||
|
||||
for (size_t iSocket = 0; iSocket < numSockets; ++iSocket) {
|
||||
uint32_t portnum = stoi(detectors[iSocket / numSocketsPerDetector]
|
||||
uint32_t portnum = (detectors[iSocket / numSocketsPerDetector]
|
||||
->getClientStreamingPort());
|
||||
portnum += (iSocket % numSocketsPerDetector);
|
||||
try {
|
||||
|
@ -847,21 +847,6 @@ class multiSlsDetector : public virtual slsDetectorDefs,
|
||||
*/
|
||||
uint32_t clearBit(uint32_t addr, int n, int detPos = -1);
|
||||
|
||||
/**
|
||||
* Set up Receiver and update it from shm
|
||||
* @param s hostname
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns hostname
|
||||
*/
|
||||
std::string setReceiverHostname(std::string s, int detPos = -1);
|
||||
|
||||
/**
|
||||
* Get receiver hostname
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns hostname
|
||||
*/
|
||||
std::string getReceiverHostname(int detPos = -1);
|
||||
|
||||
/**
|
||||
* Validates the format of the detector MAC address and sets it
|
||||
* @param detectorMAC detector MAC address
|
||||
@ -1013,7 +998,7 @@ class multiSlsDetector : public virtual slsDetectorDefs,
|
||||
* 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 = "",
|
||||
void setClientDataStreamingInIP(std::string ip = "",
|
||||
int detPos = -1);
|
||||
|
||||
/**
|
||||
@ -1031,7 +1016,7 @@ class multiSlsDetector : public virtual slsDetectorDefs,
|
||||
* 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 = "",
|
||||
void setReceiverDataStreamingOutIP(std::string ip = "",
|
||||
int detPos = -1);
|
||||
|
||||
/**
|
||||
@ -1050,7 +1035,7 @@ class multiSlsDetector : public virtual slsDetectorDefs,
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns transmission delay
|
||||
*/
|
||||
std::string setDetectorNetworkParameter(networkParameter index, int delay, int detPos = -1);
|
||||
int setDetectorNetworkParameter(networkParameter index, int delay, int detPos = -1);
|
||||
|
||||
/**
|
||||
* Sets the additional json header
|
||||
|
@ -2662,95 +2662,6 @@ uint32_t slsDetector::clearBit(uint32_t addr, int n) {
|
||||
}
|
||||
|
||||
|
||||
std::string slsDetector::setNetworkParameter(networkParameter index, const std::string& value) {
|
||||
switch (index) {
|
||||
case DETECTOR_MAC:
|
||||
return setDetectorMAC(value);
|
||||
case DETECTOR_IP:
|
||||
return setDetectorIP(value);
|
||||
case RECEIVER_HOSTNAME:
|
||||
return setReceiver(value);
|
||||
case RECEIVER_UDP_IP:
|
||||
return setReceiverUDPIP(value);
|
||||
case RECEIVER_UDP_MAC:
|
||||
return setReceiverUDPMAC(value);
|
||||
case RECEIVER_UDP_PORT:
|
||||
setReceiverUDPPort(stoi(value));
|
||||
return getReceiverUDPPort();
|
||||
case RECEIVER_UDP_PORT2:
|
||||
if (thisDetector->myDetectorType == EIGER) {
|
||||
setReceiverUDPPort2(stoi(value));
|
||||
return getReceiverUDPPort2();
|
||||
} else {
|
||||
setReceiverUDPPort(stoi(value));
|
||||
return getReceiverUDPPort();
|
||||
}
|
||||
case DETECTOR_TXN_DELAY_LEFT:
|
||||
case DETECTOR_TXN_DELAY_RIGHT:
|
||||
case DETECTOR_TXN_DELAY_FRAME:
|
||||
case FLOW_CONTROL_10G:
|
||||
return setDetectorNetworkParameter(index, stoi(value));
|
||||
case CLIENT_STREAMING_PORT:
|
||||
return setClientStreamingPort(value);
|
||||
case RECEIVER_STREAMING_PORT:
|
||||
return setReceiverStreamingPort(value);
|
||||
case CLIENT_STREAMING_SRC_IP:
|
||||
return setClientStreamingIP(value);
|
||||
case RECEIVER_STREAMING_SRC_IP:
|
||||
return setReceiverStreamingIP(value);
|
||||
case ADDITIONAL_JSON_HEADER:
|
||||
return setAdditionalJsonHeader(value);
|
||||
case RECEIVER_UDP_SCKT_BUF_SIZE:
|
||||
setReceiverUDPSocketBufferSize(stoi(value));
|
||||
return getReceiverUDPSocketBufferSize();
|
||||
default:
|
||||
return (char*)("unknown network parameter");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string slsDetector::getNetworkParameter(networkParameter index) {
|
||||
switch (index) {
|
||||
case DETECTOR_MAC:
|
||||
return getDetectorMAC();
|
||||
case DETECTOR_IP:
|
||||
return getDetectorIP();
|
||||
case RECEIVER_HOSTNAME:
|
||||
return getReceiver();
|
||||
case RECEIVER_UDP_IP:
|
||||
return getReceiverUDPIP();
|
||||
case RECEIVER_UDP_MAC:
|
||||
return getReceiverUDPMAC();
|
||||
case RECEIVER_UDP_PORT:
|
||||
return getReceiverUDPPort();
|
||||
case RECEIVER_UDP_PORT2:
|
||||
return getReceiverUDPPort2();
|
||||
case DETECTOR_TXN_DELAY_LEFT:
|
||||
case DETECTOR_TXN_DELAY_RIGHT:
|
||||
case DETECTOR_TXN_DELAY_FRAME:
|
||||
case FLOW_CONTROL_10G:
|
||||
return setDetectorNetworkParameter(index, -1);
|
||||
case CLIENT_STREAMING_PORT:
|
||||
return getClientStreamingPort();
|
||||
case RECEIVER_STREAMING_PORT:
|
||||
return getReceiverStreamingPort();
|
||||
case CLIENT_STREAMING_SRC_IP:
|
||||
return getClientStreamingIP();
|
||||
case RECEIVER_STREAMING_SRC_IP:
|
||||
return getReceiverStreamingIP();
|
||||
case ADDITIONAL_JSON_HEADER:
|
||||
return getAdditionalJsonHeader();
|
||||
case RECEIVER_UDP_SCKT_BUF_SIZE:
|
||||
return getReceiverUDPSocketBufferSize();
|
||||
case RECEIVER_REAL_UDP_SCKT_BUF_SIZE:
|
||||
return getReceiverRealUDPSocketBufferSize();
|
||||
|
||||
default:
|
||||
return std::string("unknown network parameter");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
std::string slsDetector::setDetectorMAC(const std::string& detectorMAC) {
|
||||
|
||||
// invalid format
|
||||
@ -2975,6 +2886,9 @@ int slsDetector::getReceiverUDPPort() {
|
||||
}
|
||||
|
||||
int slsDetector::setReceiverUDPPort2(int udpport) {
|
||||
if (thisDetector->myDetectorType != EIGER) {
|
||||
return setReceiverUDPPort(udpport);
|
||||
}
|
||||
thisDetector->receiverUDPPort2 = udpport;
|
||||
if (!strcmp(thisDetector->receiver_hostname, "none")) {
|
||||
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
|
||||
@ -2989,18 +2903,17 @@ int slsDetector::getReceiverUDPPort2() {
|
||||
return thisDetector->receiverUDPPort2;
|
||||
}
|
||||
|
||||
int slsDetector::setClientStreamingPort(int port) {
|
||||
thisDetector->zmqport = stoi(port);
|
||||
return getClientStreamingPort();
|
||||
void slsDetector::setClientStreamingPort(int port) {
|
||||
thisDetector->zmqport = port;
|
||||
}
|
||||
|
||||
int slsDetector::getClientStreamingPort() {
|
||||
return thisDetector->zmqport;
|
||||
}
|
||||
|
||||
int slsDetector::setReceiverStreamingPort(int port) {
|
||||
void slsDetector::setReceiverStreamingPort(int port) {
|
||||
// copy now else it is lost if rx_hostname not set yet
|
||||
thisDetector->receiver_zmqport = stoi(port);
|
||||
thisDetector->receiver_zmqport = port;
|
||||
|
||||
int fnum = F_SET_RECEIVER_STREAMING_PORT;
|
||||
int ret = FAIL;
|
||||
@ -3022,32 +2935,30 @@ int slsDetector::setReceiverStreamingPort(int port) {
|
||||
ret = updateReceiver();
|
||||
}
|
||||
}
|
||||
return getReceiverStreamingPort();
|
||||
}
|
||||
|
||||
int slsDetector::getReceiverStreamingPort() {
|
||||
return thisDetector->receiver_zmqport;
|
||||
}
|
||||
|
||||
int slsDetector::setClientStreamingIP(int sourceIP) {
|
||||
void slsDetector::setClientStreamingIP(std::string sourceIP) {
|
||||
struct addrinfo *result;
|
||||
// on failure to convert to a valid ip
|
||||
if (dataSocket->ConvertHostnameToInternetAddress(sourceIP.c_str(), &result)) {
|
||||
FILE_LOG(logWARNING) << "Could not convert zmqip into a valid IP" << sourceIP;
|
||||
setErrorMask((getErrorMask())|(COULDNOT_SET_NETWORK_PARAMETER));
|
||||
return getClientStreamingIP();
|
||||
return;
|
||||
}
|
||||
// on success put IP as std::string into arg
|
||||
memset(thisDetector->zmqip, 0, MAX_STR_LENGTH);
|
||||
dataSocket->ConvertInternetAddresstoIpString(result, thisDetector->zmqip, MAX_STR_LENGTH);
|
||||
return getClientStreamingIP();
|
||||
}
|
||||
|
||||
int slsDetector::getClientStreamingIP() {
|
||||
std::string slsDetector::getClientStreamingIP() {
|
||||
return thisDetector->zmqip;
|
||||
}
|
||||
|
||||
std::string slsDetector::setReceiverStreamingIP(std::string sourceIP) {
|
||||
void slsDetector::setReceiverStreamingIP(std::string sourceIP) {
|
||||
int fnum = F_RECEIVER_STREAMING_SRC_IP;
|
||||
int ret = FAIL;
|
||||
char args[MAX_STR_LENGTH] = {0};
|
||||
@ -3059,7 +2970,7 @@ std::string slsDetector::setReceiverStreamingIP(std::string sourceIP) {
|
||||
if (!strcmp(thisDetector->receiver_hostname, "none")) {
|
||||
FILE_LOG(logWARNING) << "Receiver hostname not set yet. Cannot create rx_zmqip from none";
|
||||
setErrorMask((getErrorMask())|(COULDNOT_SET_NETWORK_PARAMETER));
|
||||
return getReceiverStreamingIP();
|
||||
return;
|
||||
}
|
||||
sourceIP.assign(thisDetector->receiver_hostname);
|
||||
}
|
||||
@ -3071,7 +2982,7 @@ std::string slsDetector::setReceiverStreamingIP(std::string sourceIP) {
|
||||
if (dataSocket->ConvertHostnameToInternetAddress(sourceIP.c_str(), &result)) {
|
||||
FILE_LOG(logWARNING) << "Could not convert rx_zmqip into a valid IP" << sourceIP;
|
||||
setErrorMask((getErrorMask())|(COULDNOT_SET_NETWORK_PARAMETER));
|
||||
return getReceiverStreamingIP();
|
||||
return;
|
||||
}
|
||||
// on success put IP as std::string into arg
|
||||
dataSocket->ConvertInternetAddresstoIpString(result, args, sizeof(args));
|
||||
@ -3101,7 +3012,6 @@ std::string slsDetector::setReceiverStreamingIP(std::string sourceIP) {
|
||||
ret = updateReceiver();
|
||||
}
|
||||
}
|
||||
return getReceiverStreamingIP();
|
||||
}
|
||||
|
||||
std::string slsDetector::getReceiverStreamingIP() {
|
||||
@ -3109,7 +3019,7 @@ std::string slsDetector::getReceiverStreamingIP() {
|
||||
}
|
||||
|
||||
|
||||
std::string slsDetector::setDetectorNetworkParameter(networkParameter index, int delay) {
|
||||
int slsDetector::setDetectorNetworkParameter(networkParameter index, int delay) {
|
||||
int fnum = F_SET_NETWORK_PARAMETER;
|
||||
int ret = FAIL;
|
||||
int args[2] = {(int)index, delay};
|
||||
@ -3129,7 +3039,7 @@ std::string slsDetector::setDetectorNetworkParameter(networkParameter index, int
|
||||
ret = updateDetector();
|
||||
}
|
||||
}
|
||||
return std::to_string(retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
std::string slsDetector::setAdditionalJsonHeader(const std::string& jsonheader) {
|
||||
@ -4435,13 +4345,13 @@ int64_t slsDetector::getRateCorrection() {
|
||||
|
||||
void slsDetector::printReceiverConfiguration(TLogLevel level) {
|
||||
FILE_LOG(level) << "#Detector " << detId << ":\n" <<
|
||||
"Receiver Hostname:\t" << getNetworkParameter(RECEIVER_HOSTNAME) <<
|
||||
"\nDetector UDP IP (Source):\t\t" << getNetworkParameter(DETECTOR_IP) <<
|
||||
"\nDetector UDP MAC:\t\t" << getNetworkParameter(DETECTOR_MAC) <<
|
||||
"\nReceiver UDP IP:\t" << getNetworkParameter(RECEIVER_UDP_IP) <<
|
||||
"\nReceiver UDP MAC:\t" << getNetworkParameter(RECEIVER_UDP_MAC) <<
|
||||
"\nReceiver UDP Port:\t" << getNetworkParameter(RECEIVER_UDP_PORT) <<
|
||||
"\nReceiver UDP Port2:\t" << getNetworkParameter(RECEIVER_UDP_PORT2);
|
||||
"Receiver Hostname:\t" << getReceiver() <<
|
||||
"\nDetector UDP IP (Source):\t\t" << getDetectorIP() <<
|
||||
"\nDetector UDP MAC:\t\t" << getDetectorMAC() <<
|
||||
"\nReceiver UDP IP:\t" << getReceiverUDPIP() <<
|
||||
"\nReceiver UDP MAC:\t" << getReceiverUDPMAC() <<
|
||||
"\nReceiver UDP Port:\t" << getReceiverUDPPort() <<
|
||||
"\nReceiver UDP Port2:\t" << getReceiverUDPPort2();
|
||||
}
|
||||
|
||||
|
||||
|
@ -979,7 +979,7 @@ public:
|
||||
* Sets the client zmq ip\sa sharedSlsDetector
|
||||
* @param sourceIP client zmq ip
|
||||
*/
|
||||
void setClientStreamingIP(const std::string& sourceIP);
|
||||
void setClientStreamingIP(std::string sourceIP);
|
||||
|
||||
/**
|
||||
* Returns the client zmq ip \sa sharedSlsDetector
|
||||
@ -1006,7 +1006,7 @@ public:
|
||||
* @param delay delay
|
||||
* @returns transmission delay
|
||||
*/
|
||||
std::string setDetectorNetworkParameter(networkParameter index, int delay);
|
||||
int setDetectorNetworkParameter(networkParameter index, int delay);
|
||||
|
||||
/**
|
||||
* Sets the additional json header\sa sharedSlsDetector
|
||||
|
@ -2702,9 +2702,8 @@ std::string slsDetectorCommand::helpCounter(int action) {
|
||||
|
||||
std::string slsDetectorCommand::cmdNetworkParameter(int narg, char *args[], int action, int detPos) {
|
||||
|
||||
networkParameter t;
|
||||
char ans[100] = {0};
|
||||
int i;
|
||||
int prev_streaming = 0;
|
||||
if (action == HELP_ACTION)
|
||||
return helpNetworkParameter(action);
|
||||
|
||||
@ -2712,99 +2711,139 @@ std::string slsDetectorCommand::cmdNetworkParameter(int narg, char *args[], int
|
||||
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
||||
|
||||
if (cmd == "detectormac") {
|
||||
t = DETECTOR_MAC;
|
||||
if (action == PUT_ACTION) {
|
||||
myDet->setDetectorMAC(args[1], detPos);
|
||||
}
|
||||
return myDet->getDetectorMAC(detPos);
|
||||
} else if (cmd == "detectorip") {
|
||||
t = DETECTOR_IP;
|
||||
if (action == PUT_ACTION) {
|
||||
myDet->setDetectorIP(args[1], detPos);
|
||||
}
|
||||
return myDet->getDetectorIP(detPos);
|
||||
} else if (cmd == "rx_hostname") {
|
||||
t = RECEIVER_HOSTNAME;
|
||||
if (action == PUT_ACTION) {
|
||||
myDet->setReceiver(args[1], detPos);
|
||||
}
|
||||
return myDet->getReceiver(detPos);
|
||||
} else if (cmd == "rx_udpip") {
|
||||
t = RECEIVER_UDP_IP;
|
||||
if (action == PUT_ACTION) {
|
||||
myDet->setReceiverUDPIP(args[1], detPos);
|
||||
}
|
||||
return myDet->getReceiverUDPIP(detPos);
|
||||
} else if (cmd == "rx_udpmac") {
|
||||
t = RECEIVER_UDP_MAC;
|
||||
if (action == PUT_ACTION) {
|
||||
myDet->setReceiverUDPMAC(args[1], detPos);
|
||||
}
|
||||
return myDet->getReceiverUDPMAC(detPos);
|
||||
} else if (cmd == "rx_udpport") {
|
||||
t = RECEIVER_UDP_PORT;
|
||||
if (action == PUT_ACTION) {
|
||||
if (!(sscanf(args[1], "%d", &i)))
|
||||
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") {
|
||||
t = RECEIVER_UDP_PORT2;
|
||||
if (action == PUT_ACTION) {
|
||||
if (!(sscanf(args[1], "%d", &i)))
|
||||
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_udpsocksize") {
|
||||
t = RECEIVER_UDP_SCKT_BUF_SIZE;
|
||||
if (action == PUT_ACTION) {
|
||||
if (!(sscanf(args[1], "%d", &i)))
|
||||
if (!(sscanf(args[1], "%d", &i))) {
|
||||
return ("cannot parse argument") + std::string(args[1]);
|
||||
}
|
||||
myDet->setReceiverUDPSocketBufferSize(i, detPos);
|
||||
}
|
||||
sprintf(ans, "%d", myDet->getReceiverUDPSocketBufferSize(detPos));
|
||||
return ans;
|
||||
} else if (cmd == "rx_realudpsocksize") {
|
||||
t = RECEIVER_REAL_UDP_SCKT_BUF_SIZE;
|
||||
if (action == PUT_ACTION) {
|
||||
return ("cannot put!");
|
||||
}
|
||||
sprintf(ans, "%d", myDet->getReceiverRealUDPSocketBufferSize(detPos));
|
||||
return ans;
|
||||
} else if (cmd == "txndelay_left") {
|
||||
t = DETECTOR_TXN_DELAY_LEFT;
|
||||
networkParameter t = DETECTOR_TXN_DELAY_LEFT;
|
||||
if (action == PUT_ACTION) {
|
||||
if (!(sscanf(args[1], "%d", &i)))
|
||||
if (!(sscanf(args[1], "%d", &i))) {
|
||||
return ("cannot parse argument") + std::string(args[1]);
|
||||
}
|
||||
myDet->setDetectorNetworkParameter(t, i, detPos);
|
||||
}
|
||||
sprintf(ans, "%d", myDet->setDetectorNetworkParameter(t, -1, detPos));
|
||||
return ans;
|
||||
} else if (cmd == "txndelay_right") {
|
||||
t = DETECTOR_TXN_DELAY_RIGHT;
|
||||
networkParameter t = DETECTOR_TXN_DELAY_RIGHT;
|
||||
if (action == PUT_ACTION) {
|
||||
if (!(sscanf(args[1], "%d", &i)))
|
||||
if (!(sscanf(args[1], "%d", &i))) {
|
||||
return ("cannot parse argument") + std::string(args[1]);
|
||||
}
|
||||
myDet->setDetectorNetworkParameter(t, i, detPos);
|
||||
}
|
||||
sprintf(ans, "%d", myDet->setDetectorNetworkParameter(t, -1, detPos));
|
||||
return ans;
|
||||
} else if (cmd == "txndelay_frame") {
|
||||
t = DETECTOR_TXN_DELAY_FRAME;
|
||||
networkParameter t = DETECTOR_TXN_DELAY_FRAME;
|
||||
if (action == PUT_ACTION) {
|
||||
if (!(sscanf(args[1], "%d", &i)))
|
||||
if (!(sscanf(args[1], "%d", &i))) {
|
||||
return ("cannot parse argument") + std::string(args[1]);
|
||||
}
|
||||
myDet->setDetectorNetworkParameter(t, i, detPos);
|
||||
}
|
||||
sprintf(ans, "%d", myDet->setDetectorNetworkParameter(t, -1, detPos));
|
||||
return ans;
|
||||
} else if (cmd == "flowcontrol_10g") {
|
||||
t = FLOW_CONTROL_10G;
|
||||
networkParameter t = FLOW_CONTROL_10G;
|
||||
if (action == PUT_ACTION) {
|
||||
if (!(sscanf(args[1], "%d", &i)))
|
||||
if (!(sscanf(args[1], "%d", &i))) {
|
||||
return ("cannot parse argument") + std::string(args[1]);
|
||||
}
|
||||
myDet->setDetectorNetworkParameter(t, i, detPos);
|
||||
}
|
||||
sprintf(ans, "%d", myDet->setDetectorNetworkParameter(t, -1, detPos));
|
||||
return ans;
|
||||
} else if (cmd == "zmqport") {
|
||||
t = CLIENT_STREAMING_PORT;
|
||||
if (action == PUT_ACTION) {
|
||||
if (!(sscanf(args[1], "%d", &i)))
|
||||
if (!(sscanf(args[1], "%d", &i))) {
|
||||
return ("cannot parse argument") + std::string(args[1]);
|
||||
}
|
||||
myDet->setClientDataStreamingInPort(i, detPos);
|
||||
}
|
||||
sprintf(ans, "%d", myDet->getClientStreamingPort(detPos));
|
||||
return ans;
|
||||
} else if (cmd == "rx_zmqport") {
|
||||
t = RECEIVER_STREAMING_PORT;
|
||||
if (action == PUT_ACTION) {
|
||||
if (!(sscanf(args[1], "%d", &i)))
|
||||
if (!(sscanf(args[1], "%d", &i))) {
|
||||
return ("cannot parse argument") + std::string(args[1]);
|
||||
// if streaming, switch it off
|
||||
prev_streaming = myDet->enableDataStreamingFromReceiver(-1, detPos);
|
||||
if (prev_streaming)
|
||||
myDet->enableDataStreamingFromReceiver(0, detPos);
|
||||
}
|
||||
myDet->setReceiverDataStreamingOutPort(i, detPos);
|
||||
}
|
||||
sprintf(ans, "%d", myDet->getReceiverStreamingPort(detPos));
|
||||
return ans;
|
||||
} else if (cmd == "zmqip") {
|
||||
t = CLIENT_STREAMING_SRC_IP;
|
||||
if (action == PUT_ACTION) {
|
||||
myDet->setClientDataStreamingInIP(args[1], detPos);
|
||||
}
|
||||
return myDet->getClientStreamingIP(detPos);
|
||||
} else if (cmd == "rx_zmqip") {
|
||||
t = RECEIVER_STREAMING_SRC_IP;
|
||||
// if streaming, switch it off
|
||||
prev_streaming = myDet->enableDataStreamingFromReceiver(-1, detPos);
|
||||
if (prev_streaming)
|
||||
myDet->enableDataStreamingFromReceiver(0, detPos);
|
||||
if (action == PUT_ACTION) {
|
||||
myDet->setReceiverDataStreamingOutIP(args[1], detPos);
|
||||
}
|
||||
return myDet->getReceiverStreamingIP(detPos);
|
||||
} else if (cmd == "rx_jsonaddheader") {
|
||||
t = ADDITIONAL_JSON_HEADER;
|
||||
} else
|
||||
return ("unknown network parameter") + cmd;
|
||||
|
||||
if (action == PUT_ACTION) {
|
||||
myDet->setNetworkParameter(t, args[1], detPos);
|
||||
// switch it back on, if it had been switched on
|
||||
if (prev_streaming && (t == RECEIVER_STREAMING_PORT || t == RECEIVER_STREAMING_SRC_IP))
|
||||
myDet->enableDataStreamingFromReceiver(1, detPos);
|
||||
if (action == PUT_ACTION) {
|
||||
myDet->setAdditionalJsonHeader(args[1], detPos);
|
||||
}
|
||||
return myDet->getAdditionalJsonHeader(detPos);
|
||||
}
|
||||
|
||||
return myDet->getNetworkParameter(t, detPos);
|
||||
return ("unknown network parameter") + cmd;
|
||||
}
|
||||
|
||||
std::string slsDetectorCommand::helpNetworkParameter(int action) {
|
||||
|
@ -330,19 +330,31 @@ int slsDetectorUsers::enableDataStreamingFromReceiver(int i, int detPos){
|
||||
}
|
||||
|
||||
int slsDetectorUsers::setReceiverDataStreamingOutPort(int i, int detPos){
|
||||
return myDetector->setReceiverDataStreamingOutPort(i, detPos);
|
||||
if (i >= 0) {
|
||||
myDetector->setReceiverDataStreamingOutPort(i, detPos);
|
||||
}
|
||||
return myDetector->getReceiverStreamingPort(detPos);
|
||||
}
|
||||
|
||||
int slsDetectorUsers::setClientDataStreamingInPort(int i, int detPos){
|
||||
return myDetector->setClientDataStreamingInPort(i, detPos);
|
||||
if (i >= 0) {
|
||||
myDetector->setClientDataStreamingInPort(i, detPos);
|
||||
}
|
||||
return myDetector->getClientStreamingPort(detPos);
|
||||
}
|
||||
|
||||
string slsDetectorUsers::setReceiverDataStreamingOutIP(string ip, int detPos){
|
||||
return myDetector->setReceiverDataStreamingOutIP(ip, detPos);
|
||||
if (ip.length()) {
|
||||
myDetector->setReceiverDataStreamingOutIP(ip, detPos);
|
||||
}
|
||||
return myDetector->getReceiverStreamingIP(detPos);
|
||||
}
|
||||
|
||||
string slsDetectorUsers::setClientDataStreamingInIP(string ip, int detPos){
|
||||
return myDetector->setClientDataStreamingInIP(ip, detPos);
|
||||
if (ip.length()) {
|
||||
myDetector->setClientDataStreamingInIP(ip, detPos);
|
||||
}
|
||||
return myDetector->getClientStreamingIP(detPos);
|
||||
}
|
||||
|
||||
int slsDetectorUsers::enableGapPixels(int enable, int detPos) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user