mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 06:50:02 +02:00
added streamsrcip command to be able to change the interface from which receiver streams data from
This commit is contained in:
parent
aef462da32
commit
49378e6d09
@ -80,7 +80,7 @@ using namespace std;
|
||||
#define RECEIVER_FLIPPED_DATA_NOT_SET 0x0000000020000000ULL
|
||||
#define THRESHOLD_NOT_SET 0x0000000040000000ULL
|
||||
#define RECEIVER_FILE_FORMAT 0x0000000080000000ULL
|
||||
#define RECEIVER_SUBF_TIME_NOT_SET 0x0000000100000000ULL
|
||||
#define RECEIVER_TIMER_NOT_SET 0x0000000100000000ULL
|
||||
// 0x0000000FFFFFFFFFULL
|
||||
|
||||
/** @short class returning all error messages for error mask */
|
||||
@ -259,9 +259,8 @@ public:
|
||||
if(slsErrorMask&RECEIVER_FILE_FORMAT)
|
||||
retval.append("Could not set receiver file format\n");
|
||||
|
||||
if(slsErrorMask&RECEIVER_SUBF_TIME_NOT_SET)
|
||||
retval.append("Could not set sub exposure time in receiver.\n");
|
||||
|
||||
if(slsErrorMask&RECEIVER_TIMER_NOT_SET)
|
||||
retval.append("Could not set timer in receiver.\n");
|
||||
|
||||
//------------------------------------------------------ length of message
|
||||
|
||||
|
@ -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 */
|
||||
RECEIVER_STREAMING_SRC_IP /**< receiever streaming TCP(ZMQ) ip */
|
||||
};
|
||||
|
||||
/**
|
||||
|
9
slsDetectorSoftware/jctbDetectorServer/gitInfo.txt
Normal file
9
slsDetectorSoftware/jctbDetectorServer/gitInfo.txt
Normal file
@ -0,0 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsDetectorSoftware/jctbDetectorServer
|
||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||
Repsitory UUID: a45cc31a576153e251cfe904b3b459c7a2a9abdb
|
||||
Revision: 9
|
||||
Branch: developer
|
||||
Last Changed Author: Dhanya_Maliakal
|
||||
Last Changed Rev: 1553
|
||||
Last Changed Date: 2017-09-07 11:20:19.000000002 +0200 ./server_funcs.c
|
@ -3591,7 +3591,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 == RECEIVER_STREAMING_SRC_IP) {
|
||||
prev_streaming = getStreamingSocketsCreatedInClient();
|
||||
enableDataStreamingFromReceiver(0);
|
||||
}
|
||||
@ -3649,7 +3649,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 == RECEIVER_STREAMING_SRC_IP) && prev_streaming)
|
||||
enableDataStreamingFromReceiver(1);
|
||||
|
||||
return getNetworkParameter(p);
|
||||
|
@ -559,6 +559,9 @@ int slsDetector::initializeDetectorSize(detectorType type) {
|
||||
/** set detector ip address */
|
||||
memset(thisDetector->detectorIP,0,MAX_STR_LENGTH);
|
||||
strcpy(thisDetector->detectorIP,DEFAULT_DET_IP);
|
||||
/** set zmq tcp src ip address */
|
||||
memset(thisDetector->zmqsrcip,0,MAX_STR_LENGTH);
|
||||
|
||||
|
||||
/** sets onlineFlag to OFFLINE_FLAG */
|
||||
thisDetector->onlineFlag=OFFLINE_FLAG;
|
||||
@ -4510,8 +4513,8 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
|
||||
|
||||
|
||||
|
||||
//send acquisiton period/frame number to receiver
|
||||
if((index==FRAME_NUMBER)||(index==FRAME_PERIOD)||(index==CYCLES_NUMBER)||(index==ACQUISITION_TIME) || (index==SUBFRAME_ACQUISITION_TIME)){
|
||||
//send acquisiton time/period/subexptime/frame/cycles/samples to receiver
|
||||
if((index==FRAME_NUMBER)||(index==FRAME_PERIOD)||(index==CYCLES_NUMBER)||(index==ACQUISITION_TIME) || (index==SUBFRAME_ACQUISITION_TIME) || (index==SAMPLES_JCTB)){
|
||||
string timername = getTimerType(index);
|
||||
if(ret != FAIL){
|
||||
int64_t args[2];
|
||||
@ -4555,7 +4558,10 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
|
||||
setErrorMask((getErrorMask())|(RECEIVER_ACQ_PERIOD_NOT_SET));
|
||||
break;
|
||||
case SUBFRAME_ACQUISITION_TIME:
|
||||
setErrorMask((getErrorMask())|(RECEIVER_SUBF_TIME_NOT_SET));
|
||||
setErrorMask((getErrorMask())|(RECEIVER_TIMER_NOT_SET));
|
||||
break;
|
||||
case SAMPLES_JCTB:
|
||||
setErrorMask((getErrorMask())|(RECEIVER_TIMER_NOT_SET));
|
||||
break;
|
||||
default:
|
||||
setErrorMask((getErrorMask())|(RECEIVER_FRAME_NUM_NOT_SET));
|
||||
@ -5934,6 +5940,8 @@ string slsDetector::setNetworkParameter(networkParameter index, string value) {
|
||||
case RECEIVER_STREAMING_PORT:
|
||||
setReceiverStreamingPort(value);
|
||||
return getReceiverStreamingPort();
|
||||
case RECEIVER_STREAMING_SRC_IP:
|
||||
return setReceiverStreamingSourceIP(value);
|
||||
default:
|
||||
return (char*)("unknown network parameter");
|
||||
}
|
||||
@ -5966,6 +5974,8 @@ string slsDetector::getNetworkParameter(networkParameter index) {
|
||||
return setDetectorNetworkParameter(index, -1);
|
||||
case RECEIVER_STREAMING_PORT:
|
||||
return getReceiverStreamingPort();
|
||||
case RECEIVER_STREAMING_SRC_IP:
|
||||
return getReceiverStreamingSourceIP();
|
||||
default:
|
||||
return (char*)("unknown network parameter");
|
||||
}
|
||||
@ -6058,7 +6068,7 @@ string slsDetector::setReceiver(string receiverIP){
|
||||
std::cout << "flippeddatax:" << thisDetector->flippedData[d] << endl;
|
||||
std::cout << "10GbE:" << thisDetector->tenGigaEnable << endl << endl;
|
||||
std::cout << "streaming port:" << thisDetector->zmqport << endl;
|
||||
|
||||
std::cout << "streaming source ip:" << thisDetector->zmqsrcip << endl;
|
||||
//std::cout << "dataStreaming:" << enableDataStreamingFromReceiver(-1) << endl << endl;
|
||||
/** enable compresison, */
|
||||
#endif
|
||||
@ -6092,6 +6102,8 @@ string slsDetector::setReceiver(string receiverIP){
|
||||
setTimer(ACQUISITION_TIME,thisDetector->timerValue[ACQUISITION_TIME]);
|
||||
if(thisDetector->myDetectorType == EIGER)
|
||||
setTimer(SUBFRAME_ACQUISITION_TIME,thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME]);
|
||||
if(thisDetector->myDetectorType == JUNGFRAUCTB)
|
||||
setTimer(SAMPLES_JCTB,thisDetector->timerValue[SAMPLES_JCTB]);
|
||||
setDynamicRange(thisDetector->dynamicRange);
|
||||
if(thisDetector->myDetectorType == EIGER){
|
||||
setFlippedData(X,-1);
|
||||
@ -6103,6 +6115,7 @@ string slsDetector::setReceiver(string receiverIP){
|
||||
|
||||
// data streaming
|
||||
setReceiverStreamingPort(getReceiverStreamingPort());
|
||||
setReceiverStreamingSourceIP(getReceiverStreamingSourceIP());
|
||||
int clientSockets = parentDet->getStreamingSocketsCreatedInClient();
|
||||
int recSockets = enableDataStreamingFromReceiver(-1);
|
||||
if(clientSockets != recSockets) {
|
||||
@ -6249,6 +6262,35 @@ int slsDetector::setReceiverStreamingPort(string port) {
|
||||
return thisDetector->zmqport;
|
||||
}
|
||||
|
||||
string slsDetector::setReceiverStreamingSourceIP(string sourceIP) {
|
||||
|
||||
int fnum=F_RECEIVER_STREAMING_SRC_IP;
|
||||
int ret = FAIL;
|
||||
char arg[MAX_STR_LENGTH];
|
||||
memset(arg,0, sizeof(arg));
|
||||
strcpy(arg,sourceIP.c_str());
|
||||
char retval[MAX_STR_LENGTH];
|
||||
memset(retval,0, sizeof(retval));
|
||||
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending receiver streaming source ip to receiver " << arg << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->sendString(fnum,retval,arg);
|
||||
disconnectData();
|
||||
}
|
||||
if(ret!=FAIL) {
|
||||
memset(thisDetector->zmqsrcip, 0, MAX_STR_LENGTH);
|
||||
strcpy(thisDetector->zmqsrcip, retval);
|
||||
}
|
||||
if(ret==FORCE_UPDATE)
|
||||
updateReceiver();
|
||||
}
|
||||
|
||||
return getReceiverStreamingSourceIP();
|
||||
}
|
||||
|
||||
string slsDetector::setDetectorNetworkParameter(networkParameter index, int delay){
|
||||
int fnum = F_SET_NETWORK_PARAMETER;
|
||||
int ret = FAIL;
|
||||
@ -6290,8 +6332,10 @@ int slsDetector::setUDPConnection(){
|
||||
|
||||
int ret = FAIL;
|
||||
int fnum = F_SETUP_RECEIVER_UDP;
|
||||
char args[3][MAX_STR_LENGTH]={"","",""};
|
||||
char retval[MAX_STR_LENGTH]="";
|
||||
char args[3][MAX_STR_LENGTH];
|
||||
memset(args,0,sizeof(args));
|
||||
char retval[MAX_STR_LENGTH];
|
||||
memset(retval,0,sizeof(retval));
|
||||
|
||||
//called before set up
|
||||
if(!strcmp(thisDetector->receiver_hostname,"none")){
|
||||
@ -8233,6 +8277,10 @@ int slsDetector::updateReceiverNoWait() {
|
||||
n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind));
|
||||
thisDetector->zmqport = ind;
|
||||
|
||||
// streaming source ip
|
||||
n += dataSocket->ReceiveDataOnly(path,MAX_STR_LENGTH);
|
||||
strcpy(thisDetector->zmqsrcip, path);
|
||||
|
||||
if (!n) printf("n: %d\n", n);
|
||||
|
||||
return OK;
|
||||
|
@ -271,6 +271,8 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
int flippedData[2];
|
||||
/** tcp port between receiver and gui (only data) */
|
||||
int zmqport;
|
||||
/** zmq tcp src ip address between receiver and gui (only data) **/
|
||||
char zmqsrcip[MAX_STR_LENGTH];
|
||||
|
||||
} sharedSlsDetector;
|
||||
|
||||
@ -1730,6 +1732,8 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
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;};
|
||||
/** gets the zmq source ip in client and receiver, returns "none" if default setting and no custom ip set*/
|
||||
string getReceiverStreamingSourceIP(){return string(thisDetector->zmqsrcip);};
|
||||
|
||||
/** validates the format of detector MAC address and sets it \sa sharedSlsDetector */
|
||||
string setDetectorMAC(string detectorMAC);
|
||||
@ -1747,6 +1751,8 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
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 */
|
||||
int setReceiverStreamingPort(string port);
|
||||
/** sets the zmq source ip in client and receiver */
|
||||
string setReceiverStreamingSourceIP(string sourceIP);
|
||||
/** sets the transmission delay for left or right port or for an entire frame*/
|
||||
string setDetectorNetworkParameter(networkParameter index, int delay);
|
||||
|
||||
|
@ -1900,6 +1900,14 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdNetworkParameter;
|
||||
i++;
|
||||
|
||||
/*! \page network
|
||||
- <b>zmqsrcip [ip]</b> sets/gets the 0MQ (TCP) ip of the receiver from where data is streamed to the client. Default is ip of rx_hostname. Use this only with external gui. \c Returns \c (string)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="zmqsrcip"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdNetworkParameter;
|
||||
i++;
|
||||
|
||||
|
||||
/*! \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)
|
||||
*/
|
||||
@ -3940,7 +3948,10 @@ string slsDetectorCommand::cmdNetworkParameter(int narg, char *args[], int actio
|
||||
if (!(sscanf(args[1],"%d",&i)))
|
||||
return ("cannot parse argument") + string(args[1]);
|
||||
}
|
||||
}else return ("unknown network parameter")+cmd;
|
||||
}else if (cmd=="zmqsrcip") {
|
||||
t=RECEIVER_STREAMING_SRC_IP;
|
||||
}
|
||||
else return ("unknown network parameter")+cmd;
|
||||
|
||||
if (action==PUT_ACTION)
|
||||
myDet->setNetworkParameter(t, args[1]);
|
||||
@ -3966,6 +3977,7 @@ string slsDetectorCommand::helpNetworkParameter(int narg, char *args[], int acti
|
||||
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 << "zmqsrcip ip \n sets/gets the 0MQ (TCP) ip of the receiver from where data is streamed to the client. Default is ip of rx_hostname. Use this only with external gui." << std::endl;
|
||||
}
|
||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||
os << "detectormac \n gets detector mac "<< std::endl;
|
||||
@ -3979,6 +3991,7 @@ string slsDetectorCommand::helpNetworkParameter(int narg, char *args[], int acti
|
||||
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 << "zmqsrcip \n gets zmq source ip (data from receiver to client), none if default setting and no custom ip" << std::endl;
|
||||
}
|
||||
return os.str();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user