diff --git a/slsDetectorSoftware/commonFiles/sls_detector_defs.h b/slsDetectorSoftware/commonFiles/sls_detector_defs.h index 386255bae..66fc70a2a 100755 --- a/slsDetectorSoftware/commonFiles/sls_detector_defs.h +++ b/slsDetectorSoftware/commonFiles/sls_detector_defs.h @@ -193,7 +193,8 @@ enum networkParameter { FLOW_CONTROL_10G, /**< flow control for 10GbE */ FLOW_CONTROL_WR_PTR, /**< memory write pointer for flow control */ FLOW_CONTROL_RD_PTR, /**< memory read pointer for flow control */ - RECEIVER_STREAMING_PORT /**< receiever streaming TCP(ZMQ) port */ + RECEIVER_STREAMING_PORT, /**< receiever streaming TCP(ZMQ) port */ + CLIENT_STREAMING_PORT /**< client streaming TCP(ZMQ) port */ }; /** diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp index 67973eda8..4d698604f 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp @@ -3690,7 +3690,7 @@ string multiSlsDetector::setNetworkParameter(networkParameter p, string s){ // disable data streaming before changing zmq port (but only if they were on) int prev_streaming = 0; - if (p == RECEIVER_STREAMING_PORT) { + if (p == RECEIVER_STREAMING_PORT || p == CLIENT_STREAMING_PORT) { prev_streaming = getStreamingSocketsCreatedInClient(); enableDataStreamingFromReceiver(0); } @@ -3704,7 +3704,7 @@ string multiSlsDetector::setNetworkParameter(networkParameter p, string s){ string* sret[thisMultiDetector->numberOfDetectors]; for(int idet=0; idetnumberOfDetectors; ++idet){ if(detectors[idet]){ - if (p == RECEIVER_STREAMING_PORT) + if (p == RECEIVER_STREAMING_PORT || p == CLIENT_STREAMING_PORT) s.append("multi\0"); sret[idet]=new string("error"); Task* task = new Task(new func2_t(&slsDetector::setNetworkParameter, @@ -3748,7 +3748,7 @@ string multiSlsDetector::setNetworkParameter(networkParameter p, string s){ } //enable data streaming if it was on - if (p == RECEIVER_STREAMING_PORT && prev_streaming) + if ((p == RECEIVER_STREAMING_PORT || p == CLIENT_STREAMING_PORT) && prev_streaming) enableDataStreamingFromReceiver(1); return getNetworkParameter(p); diff --git a/slsDetectorSoftware/slsDetector/slsDetector.cpp b/slsDetectorSoftware/slsDetector/slsDetector.cpp index 380223a02..ced0c34e5 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetector.cpp @@ -5930,6 +5930,9 @@ string slsDetector::setNetworkParameter(networkParameter index, string value) { case FLOW_CONTROL_10G: sscanf(value.c_str(),"%d",&i); return setDetectorNetworkParameter(index, i); + case CLIENT_STREAMING_PORT: + setClientStreamingPort(value); + return getClientStreamingPort(); case RECEIVER_STREAMING_PORT: setReceiverStreamingPort(value); return getReceiverStreamingPort(); @@ -6221,6 +6224,28 @@ int slsDetector::setReceiverUDPPort2(int udpport){ } +int slsDetector::setReceiverStreamingPort(string port) { + int defaultport = 0; + int numsockets = (thisDetector->myDetectorType == EIGER) ? 2:1; + int arg = 0; + + //multi command, calculate individual ports + size_t found = port.find("multi"); + if(found != string::npos) { + port.erase(found,5); + sscanf(port.c_str(),"%d",&defaultport); + arg = defaultport + (posId * numsockets); + } + else + sscanf(port.c_str(),"%d",&arg); + thisDetector->zmqport = arg; + + return thisDetector->zmqport; +} + + + + int slsDetector::setReceiverStreamingPort(string port) { int defaultport = 0; int numsockets = (thisDetector->myDetectorType == EIGER) ? 2:1; @@ -6249,12 +6274,12 @@ int slsDetector::setReceiverStreamingPort(string port) { disconnectData(); } if(ret!=FAIL) - thisDetector->zmqport = retval; + thisDetector->receiver_zmqport = retval; if(ret==FORCE_UPDATE) updateReceiver(); } - return thisDetector->zmqport; + return thisDetector->receiver_zmqport; } string slsDetector::setDetectorNetworkParameter(networkParameter index, int delay){ diff --git a/slsDetectorSoftware/slsDetector/slsDetector.h b/slsDetectorSoftware/slsDetector/slsDetector.h index 97a40e9f2..728041162 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.h +++ b/slsDetectorSoftware/slsDetector/slsDetector.h @@ -269,8 +269,11 @@ class slsDetector : public slsDetectorUtils, public energyConversion { bool acquiringFlag; /** flipped data across x or y axis */ int flippedData[2]; - /** tcp port between receiver and gui (only data) */ + /** tcp port from gui/different process to receiver (only data) */ int zmqport; + /** tcp port from receiver to gui/different process (only data) */ + int receiver_zmqport; + } sharedSlsDetector; @@ -1733,8 +1736,10 @@ class slsDetector : public slsDetectorUtils, public energyConversion { string getReceiverUDPPort() {ostringstream ss; ss << thisDetector->receiverUDPPort; string s = ss.str(); return s;}; /** returns the receiver UDP2 for Eiger IP address \sa sharedSlsDetector */ string getReceiverUDPPort2() {ostringstream ss; ss << thisDetector->receiverUDPPort2; string s = ss.str(); return s;}; - /** returns the zmq port \sa sharedSlsDetector */ - string getReceiverStreamingPort() {ostringstream ss; ss << thisDetector->zmqport; string s = ss.str(); return s;}; + /** returns the client zmq port \sa sharedSlsDetector */ + string getClientStreamingPort() {ostringstream ss; ss << thisDetector->zmqport; string s = ss.str(); return s;}; + /** returns the receiver zmq port \sa sharedSlsDetector */ + string getReceiverStreamingPort() {ostringstream ss; ss << thisDetector->receiver_zmqport; string s = ss.str(); return s;}; /** validates the format of detector MAC address and sets it \sa sharedSlsDetector */ string setDetectorMAC(string detectorMAC); @@ -1750,7 +1755,9 @@ class slsDetector : public slsDetectorUtils, public energyConversion { int setReceiverUDPPort(int udpport); /** sets the receiver udp port2 for Eiger \sa sharedSlsDetector */ int setReceiverUDPPort2(int udpport); - /** sets the zmq port in client and receiver (includes "multi" at the end if it should calculate individual ports \sa sharedSlsDetector */ + /** sets the zmq port in client (includes "multi" at the end if it should calculate individual ports \sa sharedSlsDetector */ + int setClientStreamingPort(string port); + /** sets the zmq port in receiver (includes "multi" at the end if it should calculate individual ports \sa sharedSlsDetector */ int setReceiverStreamingPort(string port); /** sets the transmission delay for left or right port or for an entire frame*/ string setDetectorNetworkParameter(networkParameter index, int delay); diff --git a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp index 2888450c7..1d91e41d8 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp @@ -1894,12 +1894,19 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) { ++i; /*! \page network - - zmqport [port] sets/gets the 0MQ (TCP) port of the receiver from where data is streamed to the client. Use single-detector command to set individually or multi-detector command to calculate based on \c port for the rest. \c Returns \c (int) + - zmqport [port] sets/gets the 0MQ (TCP) port of the client to where final data is streamed to (eg. for GUI). Use single-detector command to set individually or multi-detector command to calculate based on \c port for the rest. \c Returns \c (int) */ descrToFuncMap[i].m_pFuncName="zmqport"; // descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdNetworkParameter; ++i; + /*! \page network + - rx_zmqport [port] sets/gets the 0MQ (TCP) port of the receiver from where data is streamed from (eg. to GUI or another process for further processing). Use single-detector command to set individually or multi-detector command to calculate based on \c port for the rest. \c Returns \c (int) + */ + descrToFuncMap[i].m_pFuncName="rx_zmqport"; // + descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdNetworkParameter; + ++i; + /*! \page network - configuremac [i] 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) */ @@ -3946,6 +3953,12 @@ string slsDetectorCommand::cmdNetworkParameter(int narg, char *args[], int actio return ("cannot parse argument") + string(args[1]); } }else if (cmd=="zmqport") { + t=CLIENT_STREAMING_PORT; + if (action==PUT_ACTION){ + if (!(sscanf(args[1],"%d",&i))) + return ("cannot parse argument") + string(args[1]); + } + }else if (cmd=="rx_zmqport") { t=RECEIVER_STREAMING_PORT; if (action==PUT_ACTION){ if (!(sscanf(args[1],"%d",&i))) @@ -3976,7 +3989,8 @@ string slsDetectorCommand::helpNetworkParameter(int narg, char *args[], int acti 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; os << "flowcontrol_10g port \n sets flow control for 10g for eiger"<< std::endl; - os << "zmqport port \n sets zmq port (data from receiver to client); setting via multidetector command calculates port for individual detectors"<< std::endl; + os << "zmqport port \n sets zmq port (data to client from receiver/different process); setting via multidetector command calculates port for individual detectors"<< std::endl; + os << "rx_zmqport port \n sets zmq port (data from receiver to client/different process); setting via multidetector command calculates port for individual detectors"<< std::endl; } if (action==GET_ACTION || action==HELP_ACTION) { os << "detectormac \n gets detector mac "<< std::endl; @@ -3989,7 +4003,8 @@ string slsDetectorCommand::helpNetworkParameter(int narg, char *args[], int acti 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; os << "flowcontrol_10g \n gets flow control for 10g for eiger"<< std::endl; - os << "zmqport \n gets zmq port (data from receiver to client)"<< std::endl; + os << "zmqport \n gets zmq port (data to client from receiver/different process)"<< std::endl; + os << "rx_zmqport \n gets zmq port (data from receiver to client/different process)"<< std::endl; } return os.str();