mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 03:10:02 +02:00
somewhere in separating zmq rxr and client
This commit is contained in:
parent
6693d08331
commit
dda86cfe9b
@ -193,7 +193,8 @@ enum networkParameter {
|
|||||||
FLOW_CONTROL_10G, /**< flow control for 10GbE */
|
FLOW_CONTROL_10G, /**< flow control for 10GbE */
|
||||||
FLOW_CONTROL_WR_PTR, /**< memory write pointer for flow control */
|
FLOW_CONTROL_WR_PTR, /**< memory write pointer for flow control */
|
||||||
FLOW_CONTROL_RD_PTR, /**< memory read 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 */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3690,7 +3690,7 @@ string multiSlsDetector::setNetworkParameter(networkParameter p, string s){
|
|||||||
|
|
||||||
// disable data streaming before changing zmq port (but only if they were on)
|
// disable data streaming before changing zmq port (but only if they were on)
|
||||||
int prev_streaming = 0;
|
int prev_streaming = 0;
|
||||||
if (p == RECEIVER_STREAMING_PORT) {
|
if (p == RECEIVER_STREAMING_PORT || p == CLIENT_STREAMING_PORT) {
|
||||||
prev_streaming = getStreamingSocketsCreatedInClient();
|
prev_streaming = getStreamingSocketsCreatedInClient();
|
||||||
enableDataStreamingFromReceiver(0);
|
enableDataStreamingFromReceiver(0);
|
||||||
}
|
}
|
||||||
@ -3704,7 +3704,7 @@ string multiSlsDetector::setNetworkParameter(networkParameter p, string s){
|
|||||||
string* sret[thisMultiDetector->numberOfDetectors];
|
string* sret[thisMultiDetector->numberOfDetectors];
|
||||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; ++idet){
|
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; ++idet){
|
||||||
if(detectors[idet]){
|
if(detectors[idet]){
|
||||||
if (p == RECEIVER_STREAMING_PORT)
|
if (p == RECEIVER_STREAMING_PORT || p == CLIENT_STREAMING_PORT)
|
||||||
s.append("multi\0");
|
s.append("multi\0");
|
||||||
sret[idet]=new string("error");
|
sret[idet]=new string("error");
|
||||||
Task* task = new Task(new func2_t<string,networkParameter,string>(&slsDetector::setNetworkParameter,
|
Task* task = new Task(new func2_t<string,networkParameter,string>(&slsDetector::setNetworkParameter,
|
||||||
@ -3748,7 +3748,7 @@ string multiSlsDetector::setNetworkParameter(networkParameter p, string s){
|
|||||||
}
|
}
|
||||||
|
|
||||||
//enable data streaming if it was on
|
//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);
|
enableDataStreamingFromReceiver(1);
|
||||||
|
|
||||||
return getNetworkParameter(p);
|
return getNetworkParameter(p);
|
||||||
|
@ -5930,6 +5930,9 @@ string slsDetector::setNetworkParameter(networkParameter index, string value) {
|
|||||||
case FLOW_CONTROL_10G:
|
case FLOW_CONTROL_10G:
|
||||||
sscanf(value.c_str(),"%d",&i);
|
sscanf(value.c_str(),"%d",&i);
|
||||||
return setDetectorNetworkParameter(index, i);
|
return setDetectorNetworkParameter(index, i);
|
||||||
|
case CLIENT_STREAMING_PORT:
|
||||||
|
setClientStreamingPort(value);
|
||||||
|
return getClientStreamingPort();
|
||||||
case RECEIVER_STREAMING_PORT:
|
case RECEIVER_STREAMING_PORT:
|
||||||
setReceiverStreamingPort(value);
|
setReceiverStreamingPort(value);
|
||||||
return getReceiverStreamingPort();
|
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 slsDetector::setReceiverStreamingPort(string port) {
|
||||||
int defaultport = 0;
|
int defaultport = 0;
|
||||||
int numsockets = (thisDetector->myDetectorType == EIGER) ? 2:1;
|
int numsockets = (thisDetector->myDetectorType == EIGER) ? 2:1;
|
||||||
@ -6249,12 +6274,12 @@ int slsDetector::setReceiverStreamingPort(string port) {
|
|||||||
disconnectData();
|
disconnectData();
|
||||||
}
|
}
|
||||||
if(ret!=FAIL)
|
if(ret!=FAIL)
|
||||||
thisDetector->zmqport = retval;
|
thisDetector->receiver_zmqport = retval;
|
||||||
if(ret==FORCE_UPDATE)
|
if(ret==FORCE_UPDATE)
|
||||||
updateReceiver();
|
updateReceiver();
|
||||||
}
|
}
|
||||||
|
|
||||||
return thisDetector->zmqport;
|
return thisDetector->receiver_zmqport;
|
||||||
}
|
}
|
||||||
|
|
||||||
string slsDetector::setDetectorNetworkParameter(networkParameter index, int delay){
|
string slsDetector::setDetectorNetworkParameter(networkParameter index, int delay){
|
||||||
|
@ -269,8 +269,11 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
bool acquiringFlag;
|
bool acquiringFlag;
|
||||||
/** flipped data across x or y axis */
|
/** flipped data across x or y axis */
|
||||||
int flippedData[2];
|
int flippedData[2];
|
||||||
/** tcp port between receiver and gui (only data) */
|
/** tcp port from gui/different process to receiver (only data) */
|
||||||
int zmqport;
|
int zmqport;
|
||||||
|
/** tcp port from receiver to gui/different process (only data) */
|
||||||
|
int receiver_zmqport;
|
||||||
|
|
||||||
|
|
||||||
} sharedSlsDetector;
|
} sharedSlsDetector;
|
||||||
|
|
||||||
@ -1733,8 +1736,10 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
string getReceiverUDPPort() {ostringstream ss; ss << thisDetector->receiverUDPPort; string s = ss.str(); return s;};
|
string getReceiverUDPPort() {ostringstream ss; ss << thisDetector->receiverUDPPort; string s = ss.str(); return s;};
|
||||||
/** returns the receiver UDP2 for Eiger IP address \sa sharedSlsDetector */
|
/** returns the receiver UDP2 for Eiger IP address \sa sharedSlsDetector */
|
||||||
string getReceiverUDPPort2() {ostringstream ss; ss << thisDetector->receiverUDPPort2; string s = ss.str(); return s;};
|
string getReceiverUDPPort2() {ostringstream ss; ss << thisDetector->receiverUDPPort2; string s = ss.str(); return s;};
|
||||||
/** returns the zmq port \sa sharedSlsDetector */
|
/** returns the client zmq port \sa sharedSlsDetector */
|
||||||
string getReceiverStreamingPort() {ostringstream ss; ss << thisDetector->zmqport; string s = ss.str(); return s;};
|
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 */
|
/** validates the format of detector MAC address and sets it \sa sharedSlsDetector */
|
||||||
string setDetectorMAC(string detectorMAC);
|
string setDetectorMAC(string detectorMAC);
|
||||||
@ -1750,7 +1755,9 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
int setReceiverUDPPort(int udpport);
|
int setReceiverUDPPort(int udpport);
|
||||||
/** sets the receiver udp port2 for Eiger \sa sharedSlsDetector */
|
/** sets the receiver udp port2 for Eiger \sa sharedSlsDetector */
|
||||||
int setReceiverUDPPort2(int udpport);
|
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);
|
int setReceiverStreamingPort(string port);
|
||||||
/** sets the transmission delay for left or right port or for an entire frame*/
|
/** sets the transmission delay for left or right port or for an entire frame*/
|
||||||
string setDetectorNetworkParameter(networkParameter index, int delay);
|
string setDetectorNetworkParameter(networkParameter index, int delay);
|
||||||
|
@ -1894,12 +1894,19 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
|||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page network
|
/*! \page network
|
||||||
- <b>zmqport [port]</b> 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)
|
- <b>zmqport [port]</b> 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_pFuncName="zmqport"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdNetworkParameter;
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdNetworkParameter;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
|
/*! \page network
|
||||||
|
- <b>rx_zmqport [port]</b> 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
|
/*! \page network
|
||||||
- <b>configuremac [i]</b> configures the MAC of the detector with these parameters: detectorip, detectormac, rx_udpip, rx_udpmac, rx_udpport, rx_udpport2 (if applicable). This command is already included in \c rx_hsotname. Only put!. \c Returns \c (int)
|
- <b>configuremac [i]</b> configures the MAC of the detector with these parameters: detectorip, detectormac, rx_udpip, rx_udpmac, rx_udpport, rx_udpport2 (if applicable). This command is already included in \c rx_hsotname. Only put!. \c Returns \c (int)
|
||||||
*/
|
*/
|
||||||
@ -3946,6 +3953,12 @@ string slsDetectorCommand::cmdNetworkParameter(int narg, char *args[], int actio
|
|||||||
return ("cannot parse argument") + string(args[1]);
|
return ("cannot parse argument") + string(args[1]);
|
||||||
}
|
}
|
||||||
}else if (cmd=="zmqport") {
|
}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;
|
t=RECEIVER_STREAMING_PORT;
|
||||||
if (action==PUT_ACTION){
|
if (action==PUT_ACTION){
|
||||||
if (!(sscanf(args[1],"%d",&i)))
|
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_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 << "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 << "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) {
|
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||||
os << "detectormac \n gets detector mac "<< std::endl;
|
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_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 << "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 << "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();
|
return os.str();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user