implemented sending hostname to the receiver for eiger

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@764 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d
2014-03-11 10:49:35 +00:00
parent bba0f46b58
commit f854477aae
9 changed files with 136 additions and 12 deletions

View File

@ -35,6 +35,12 @@ public:
*/
runStatus getStatus();
/**
* Returns detector hostname
/returns hostname
*/
char* getDetectorHostname();
/**
* Returns File Name
*/
@ -65,6 +71,13 @@ public:
*/
int getEnableFileWrite();
/**
* Set detector hostname
@param c hostname
/returns hostname
*/
char* setDetectorHostname(char c[]);
/**
* Set File Name (without frame index, file index and extension)
@param c file name

View File

@ -239,9 +239,18 @@ int32_t slsReceiverFunctionList::setDynamicRange(int32_t dr){
return eigerRxr->getDynamicRange();
}
char* slsReceiverFunctionList::setDetectorHostname(char c[]){
if(strlen(c))
eigerRxr->setDetectorHostname(c);
return eigerRxr->getDetectorHostname();
}
#endif
char* slsReceiverFunctionList::setFileName(char c[]){
if(strlen(c)){
#ifdef EIGER_RECEIVER_H

View File

@ -128,6 +128,12 @@ public:
*/
bool getMeasurementStarted(){return measurementStarted;};
/**
* Set detector hostname
* @param c hostname
*/
char* setDetectorHostname(char c[]);
/**
* Set File Name (without frame index, file index and extension)
* @param c file name

View File

@ -318,6 +318,8 @@ int slsReceiverFuncs::function_table(){
flist[F_START_READOUT] = &slsReceiverFuncs::start_readout;
flist[F_SET_TIMER] = &slsReceiverFuncs::set_timer;
flist[F_ENABLE_COMPRESSION] = &slsReceiverFuncs::enable_compression;
flist[F_SET_DETECTOR_HOSTNAME] = &slsReceiverFuncs::set_detector_hostname;
//General Functions
flist[F_LOCK_SERVER] = &slsReceiverFuncs::lock_receiver;
@ -1541,6 +1543,64 @@ int slsReceiverFuncs::enable_compression() {
int slsReceiverFuncs::set_detector_hostname() {
ret=OK;
char retval[MAX_STR_LENGTH]="";
char hostname[MAX_STR_LENGTH]="";
strcpy(mess,"Could not set detector hostname");
// receive arguments
if(socket->ReceiveDataOnly(hostname,MAX_STR_LENGTH) < 0 ){
strcpy(mess,"Error reading from socket\n");
ret = FAIL;
}
// execute action if the arguments correctly arrived
#ifdef SLS_RECEIVER_FUNCTION_LIST
if (ret==OK) {
if (lockStatus==1 && socket->differentClients==1){
sprintf(mess,"Receiver locked by %s\n", socket->lastClientIP);
ret=FAIL;
}
#ifdef EIGER_RECEIVER_H
else
strcpy(retval,slsReceiverList->setDetectorHostname(hostname));
#endif
}
#ifdef VERBOSE
if(ret!=FAIL)
cout << "hostname:" << retval << endl;
else
cout << mess << endl;
#endif
#endif
if(ret==OK && socket->differentClients){
cout << "Force update" << endl;
ret=FORCE_UPDATE;
}
// send answer
socket->SendDataOnly(&ret,sizeof(ret));
if(ret==FAIL)
socket->SendDataOnly(mess,sizeof(mess));
socket->SendDataOnly(retval,MAX_STR_LENGTH);
//return ok/fail
return ret;
}

View File

@ -157,6 +157,11 @@ public:
/** enable compression */
int enable_compression();
/** set detector hostname for eiger */
int set_detector_hostname();
//General Functions
/** Locks Receiver */