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

@ -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) {
// invalid format
@ -2861,6 +2772,9 @@ std::string slsDetector::setDetectorMAC(const std::string& detectorMAC) {
return std::string(thisDetector->detectorMAC);
}
std::string slsDetector::getDetectorMAC() {
return std::string(thisDetector->detectorMAC);
}
std::string slsDetector::setDetectorIP(const std::string& detectorIP) {
struct sockaddr_in sa;
@ -2885,6 +2799,9 @@ std::string slsDetector::setDetectorIP(const std::string& detectorIP) {
return std::string(thisDetector->detectorIP);
}
std::string slsDetector::getDetectorIP() {
return std::string(thisDetector->detectorIP);
}
std::string slsDetector::setReceiver(const std::string& 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) {
struct sockaddr_in sa;
if (udpip.length() && udpip.length() < 16) {
@ -3010,6 +2931,9 @@ std::string slsDetector::setReceiverUDPIP(const std::string& udpip) {
return std::string(thisDetector->receiverUDPIP);
}
std::string slsDetector::getReceiverUDPIP() {
return std::string(thisDetector->receiverUDPIP);
}
std::string slsDetector::setReceiverUDPMAC(const std::string& udpmac) {
// invalid format
@ -3031,6 +2955,9 @@ std::string slsDetector::setReceiverUDPMAC(const std::string& udpmac) {
return std::string(thisDetector->receiverUDPMAC);
}
std::string slsDetector::getReceiverUDPMAC() {
return std::string(thisDetector->receiverUDPMAC);
}
int slsDetector::setReceiverUDPPort(int udpport) {
thisDetector->receiverUDPPort = udpport;
@ -3043,6 +2970,9 @@ int slsDetector::setReceiverUDPPort(int udpport) {
return thisDetector->receiverUDPPort;
}
int slsDetector::getReceiverUDPPort() {
return thisDetector->receiverUDPPort;
}
int slsDetector::setReceiverUDPPort2(int udpport) {
thisDetector->receiverUDPPort2 = udpport;
@ -3055,14 +2985,20 @@ int slsDetector::setReceiverUDPPort2(int udpport) {
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);
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
thisDetector->receiver_zmqport = stoi(port);
@ -3089,8 +3025,11 @@ std::string slsDetector::setReceiverStreamingPort(const std::string& port) {
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;
// on failure to convert to a valid ip
if (dataSocket->ConvertHostnameToInternetAddress(sourceIP.c_str(), &result)) {
@ -3104,6 +3043,9 @@ std::string slsDetector::setClientStreamingIP(const std::string& sourceIP) {
return getClientStreamingIP();
}
int slsDetector::getClientStreamingIP() {
return thisDetector->zmqip;
}
std::string slsDetector::setReceiverStreamingIP(std::string sourceIP) {
int fnum = F_RECEIVER_STREAMING_SRC_IP;
@ -3162,6 +3104,33 @@ std::string slsDetector::setReceiverStreamingIP(std::string sourceIP) {
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) {
int fnum = F_ADDITIONAL_JSON_HEADER;
@ -3189,8 +3158,12 @@ std::string slsDetector::setAdditionalJsonHeader(const std::string& jsonheader)
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 ret = FAIL;
int arg = udpsockbufsize;
@ -3210,31 +3183,34 @@ std::string slsDetector::setReceiverUDPSocketBufferSize(int udpsockbufsize) {
ret = updateReceiver();
}
}
return std::to_string(retval);
return retval;
}
int slsDetector::getReceiverUDPSocketBufferSize() {
return setReceiverUDPSocketBufferSize();
}
std::string slsDetector::setDetectorNetworkParameter(networkParameter index, int delay) {
int fnum = F_SET_NETWORK_PARAMETER;
int slsDetector::getReceiverRealUDPSocketBufferSize() {
int fnum = F_RECEIVER_REAL_UDP_SOCK_BUF_SIZE;
int ret = FAIL;
int args[2] = {(int)index, delay};
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) {
ret = thisDetectorControl->Client_Send(fnum, args, sizeof(args), &retval, sizeof(retval));
disconnectControl();
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())|(DETECTOR_NETWORK_PARAMETER));
setErrorMask((getErrorMask())|(COULDNOT_SET_NETWORK_PARAMETER));
} else {
FILE_LOG(logDEBUG1) << "Network Parameter (" << index << "): " << retval;
FILE_LOG(logDEBUG1) << "Real Receiver UDP Socket Buffer size: " << retval;
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);
/**
* Set network parameter
* @param p network parameter type
* @param value network parameter value
* @returns network parameter value set (from getNetworkParameter)
* 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 setNetworkParameter(networkParameter index, const std::string& value);
/**
* Get network parameter
* @param index network parameter type
* @returns network parameter value set (from getNetworkParameter)
*/
std::string getNetworkParameter(networkParameter index);
std::string setDetectorMAC(const std::string& detectorMAC);
/**
* Returns the detector MAC address\sa sharedSlsDetector
@ -879,73 +871,6 @@ public:
*/
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
* @param detectorIP detector IP address
@ -953,6 +878,12 @@ public:
*/
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.
* 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);
/**
* 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
* @param udpip receiver UDP IP address
@ -969,6 +906,12 @@ public:
*/
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
* @param udpmac receiver UDP MAC address
@ -976,6 +919,12 @@ public:
*/
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
* @param udpport receiver UDP port
@ -983,6 +932,12 @@ public:
*/
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
* @param udpport receiver UDP port 2
@ -990,35 +945,100 @@ public:
*/
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
* @param port client zmq port (includes "multi" at the end if it should
* calculate individual ports)
* @param port client zmq port
*/
void setClientStreamingPort(int port);
/**
* Returns the client zmq port \sa sharedSlsDetector
* @returns the client zmq port
*/
std::string setClientStreamingPort(const std::string& port);
int getClientStreamingPort();
/**
* Sets the receiver zmq port\sa sharedSlsDetector
* @param port receiver zmq port (includes "multi" at the end if it should
* calculate individual ports)
* @param port receiver zmq port
*/
void setReceiverStreamingPort(int port);
/**
* Returns the receiver zmq port \sa sharedSlsDetector
* @returns the receiver zmq port
*/
std::string setReceiverStreamingPort(const std::string& port);
int getReceiverStreamingPort();
/**
* Sets the client zmq ip\sa sharedSlsDetector
* @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
*/
std::string setClientStreamingIP(const std::string& sourceIP);
std::string getClientStreamingIP();
/**
* Sets the receiver zmq ip\sa sharedSlsDetector
* @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
*/
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)
@ -1700,47 +1720,6 @@ private:
*/
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
* set up UDP connection in detector