mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-06 10:00:40 +02:00
changes which commented out virtual for child functions and some other changes for configuremac and setclientip and setclientmac
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@96 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
c50716f623
commit
19f7712e65
@ -2844,7 +2844,6 @@ int slsDetector::setThresholdEnergy(int e_eV, int imod, detectorSettings isetti
|
||||
|
||||
|
||||
detectorSettings slsDetector::setSettings( detectorSettings isettings, int imod){
|
||||
std::cout<<"dfgfdgdgdf"<<endl;
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "slsDetector setSettings "<< std::endl;
|
||||
#endif
|
||||
@ -2978,50 +2977,55 @@ int slsDetector::updateDetectorNoWait() {
|
||||
int64_t retval, tns=-1;
|
||||
char lastClientIP[INET_ADDRSTRLEN];
|
||||
|
||||
switch(thisDetector->myDetectorType){
|
||||
case GOTTHARD:
|
||||
n = controlSocket->ReceiveDataOnly(lastClientIP,sizeof(lastClientIP));
|
||||
cout << "Updating detector last modified by " << lastClientIP << endl;
|
||||
break;
|
||||
default:
|
||||
n = controlSocket->ReceiveDataOnly(lastClientIP,sizeof(lastClientIP));
|
||||
cout << "Updating detector last modified by " << lastClientIP << endl;
|
||||
|
||||
n = controlSocket->ReceiveDataOnly(lastClientIP,sizeof(lastClientIP));
|
||||
cout << "Updating detector last modified by " << lastClientIP << endl;
|
||||
n = controlSocket->ReceiveDataOnly(&nm,sizeof(nm));
|
||||
thisDetector->nMod[X]=nm;
|
||||
n = controlSocket->ReceiveDataOnly( &nm,sizeof(nm));
|
||||
thisDetector->nMod[Y]=nm;
|
||||
thisDetector->nMods=thisDetector->nMod[Y]*thisDetector->nMod[X];
|
||||
|
||||
n = controlSocket->ReceiveDataOnly(&nm,sizeof(nm));
|
||||
thisDetector->nMod[X]=nm;
|
||||
n = controlSocket->ReceiveDataOnly( &nm,sizeof(nm));
|
||||
thisDetector->nMod[Y]=nm;
|
||||
thisDetector->nMods=thisDetector->nMod[Y]*thisDetector->nMod[X];
|
||||
|
||||
n = controlSocket->ReceiveDataOnly( &nm,sizeof(nm));
|
||||
thisDetector->dynamicRange=nm;
|
||||
n = controlSocket->ReceiveDataOnly( &nm,sizeof(nm));
|
||||
thisDetector->dynamicRange=nm;
|
||||
|
||||
n = controlSocket->ReceiveDataOnly( &nm,sizeof(nm));
|
||||
thisDetector->dataBytes=nm;
|
||||
//t=setSettings(GET_SETTINGS);
|
||||
n = controlSocket->ReceiveDataOnly( &t,sizeof(t));
|
||||
thisDetector->currentSettings=t;
|
||||
//thr=getThresholdEnergy();
|
||||
n = controlSocket->ReceiveDataOnly( &thr,sizeof(thr));
|
||||
thisDetector->currentThresholdEV=thr;
|
||||
//retval=setFrames(tns);
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[FRAME_NUMBER]=retval;
|
||||
// retval=setExposureTime(tns);
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[ACQUISITION_TIME]=retval;
|
||||
|
||||
//retval=setPeriod(tns);
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[FRAME_PERIOD]=retval;
|
||||
//retval=setDelay(tns);
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[DELAY_AFTER_TRIGGER]=retval;
|
||||
// retval=setGates(tns);
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[GATES_NUMBER]=retval;
|
||||
//retval=setProbes(tns);
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[PROBES_NUMBER]=retval;
|
||||
//retval=setTrains(tns);
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[CYCLES_NUMBER]=retval;
|
||||
n = controlSocket->ReceiveDataOnly( &nm,sizeof(nm));
|
||||
thisDetector->dataBytes=nm;
|
||||
//t=setSettings(GET_SETTINGS);
|
||||
n = controlSocket->ReceiveDataOnly( &t,sizeof(t));
|
||||
thisDetector->currentSettings=t;
|
||||
//thr=getThresholdEnergy();
|
||||
n = controlSocket->ReceiveDataOnly( &thr,sizeof(thr));
|
||||
thisDetector->currentThresholdEV=thr;
|
||||
//retval=setFrames(tns);
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[FRAME_NUMBER]=retval;
|
||||
// retval=setExposureTime(tns);
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[ACQUISITION_TIME]=retval;
|
||||
|
||||
//retval=setPeriod(tns);
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[FRAME_PERIOD]=retval;
|
||||
//retval=setDelay(tns);
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[DELAY_AFTER_TRIGGER]=retval;
|
||||
// retval=setGates(tns);
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[GATES_NUMBER]=retval;
|
||||
//retval=setProbes(tns);
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[PROBES_NUMBER]=retval;
|
||||
//retval=setTrains(tns);
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[CYCLES_NUMBER]=retval;
|
||||
}
|
||||
return OK;
|
||||
|
||||
}
|
||||
@ -5068,9 +5072,10 @@ int slsDetector::getScanPrecision(int iscan){
|
||||
|
||||
char* slsDetector::setClientIP(string clientIP){
|
||||
int wrongFormat=1;
|
||||
|
||||
struct sockaddr_in sa;
|
||||
if(clientIP.length()==15){
|
||||
if((clientIP[3]==':')&&(clientIP[7]==':')&&(clientIP[11]==':')){
|
||||
if(clientIP.length()<16){
|
||||
if((clientIP[3]=='.')&&(clientIP[7]=='.')&&(clientIP[11]=='.')){
|
||||
int result = inet_pton(AF_INET, clientIP.c_str(), &(sa.sin_addr));
|
||||
if(result!=0){
|
||||
sprintf(thisDetector->clientIP,clientIP.c_str());
|
||||
@ -5103,14 +5108,72 @@ char* slsDetector::setClientMAC(string clientMAC){
|
||||
|
||||
|
||||
int slsDetector::configureMAC(){
|
||||
if(!strcmp(getClientIP(),"none"))
|
||||
return -1;
|
||||
else if(!strcmp(getClientMAC(),"none"))
|
||||
int retval;
|
||||
int ret=FAIL;
|
||||
int fnum=F_CONFIGURE_MAC;
|
||||
char mess[100];
|
||||
char arg[2][50];
|
||||
char cword[50]="", *pcword;
|
||||
string sword;
|
||||
strcpy(arg[0],getClientIP());
|
||||
strcpy(arg[1],getClientMAC());
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "slsDetector configureMAC "<< std::endl;
|
||||
#endif
|
||||
if(!strcmp(arg[0],"none"))
|
||||
return -1;
|
||||
else if(!strcmp(arg[1],"none"))
|
||||
return -1;
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "IP/MAC Addresses in valid format "<< std::endl;
|
||||
#endif
|
||||
|
||||
cout<<"\n\ndfgfdgklfdhgldf\n\n\n";
|
||||
//converting IPaddress to hex.
|
||||
pcword = strtok (arg[0],".");
|
||||
while (pcword != NULL) {
|
||||
sprintf(arg[0],"%02x",atoi(pcword));
|
||||
strcat(cword,arg[0]);
|
||||
pcword = strtok (NULL, ".");
|
||||
}
|
||||
strcpy(arg[0],cword);
|
||||
std::cout<<"arg0:"<<arg[0]<<"."<<std::endl;
|
||||
|
||||
return 0;
|
||||
//converting MACaddress to hex.
|
||||
sword.assign(arg[1]);
|
||||
strcpy(arg[1],"");
|
||||
stringstream sstr(sword);
|
||||
while(getline(sstr,sword,':'))
|
||||
strcat(arg[1],sword.c_str());
|
||||
std::cout<<"arg1:"<<arg[1]<<"."<<std::endl;
|
||||
|
||||
//send to server
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
if (controlSocket) {
|
||||
if (controlSocket->Connect()>=0) {
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->SendDataOnly(arg,sizeof(arg));
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret!=FAIL)
|
||||
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
else {
|
||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||
}
|
||||
controlSocket->Disconnect();
|
||||
if (ret==FORCE_UPDATE)
|
||||
updateDetector();
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Configuring MAC - returned "<< retval << std::endl;
|
||||
#endif
|
||||
if (ret==FAIL) {
|
||||
std::cout<< "Configuring MAC failed " << std::endl;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
@ -8155,7 +8218,7 @@ int slsDetector::retrieveDetectorSetup(string fname1, int level){
|
||||
#endif
|
||||
myfname=fname;
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "trim file name is "<< myfname << std::endl;
|
||||
std::cout<< "file name is "<< myfname << std::endl;
|
||||
#endif
|
||||
infile.open(myfname.c_str(), ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
@ -8288,7 +8351,7 @@ int slsDetector::retrieveDetectorSetup(string fname1, int level){
|
||||
strcpy(thisDetector->settingsFile,fname.c_str());
|
||||
return myMod;
|
||||
} else {
|
||||
std::cout<< "could not open trim file " << myfname << std::endl;
|
||||
std::cout<< "could not open settings file " << myfname << std::endl;
|
||||
|
||||
if (nflag)
|
||||
deleteModule(myMod);
|
||||
|
@ -341,8 +341,8 @@ typedef struct sharedSlsDetector {
|
||||
//slsDetector(string const fname);
|
||||
// ~slsDetector(){while(dataQueue.size()>0){}};
|
||||
/** destructor */
|
||||
virtual ~slsDetector();//{ disconnect_channels();};
|
||||
|
||||
~slsDetector();//{ disconnect_channels();};
|
||||
//virtual ~slsDetector();//{ disconnect_channels();};
|
||||
|
||||
/** sets the onlineFlag
|
||||
\param off can be: <BR> GET_ONLINE_FLAG, returns wether the detector is in online or offline state;<BR> OFFLINE_FLAG, detector in offline state (i.e. no communication to the detector - using only local structure - no data acquisition possible!);<BR> ONLINE_FLAG detector in online state (i.e. communication to the detector updating the local structure) */
|
||||
@ -370,15 +370,15 @@ typedef struct sharedSlsDetector {
|
||||
Should be implemented in the specific detector class
|
||||
/sa mythenDetector::readConfigurationFile
|
||||
*/
|
||||
|
||||
virtual int readConfigurationFile(string const fname);
|
||||
int readConfigurationFile(string const fname);
|
||||
// virtual int readConfigurationFile(string const fname);
|
||||
/**
|
||||
Purely virtual function
|
||||
Should be implemented in the specific detector class
|
||||
/sa mythenDetector::writeConfigurationFile
|
||||
*/
|
||||
virtual int writeConfigurationFile(string const fname);
|
||||
|
||||
int writeConfigurationFile(string const fname);
|
||||
//virtual int writeConfigurationFile(string const fname);
|
||||
/*
|
||||
It should be possible to dump all the settings of the detector (including trimbits, threshold energy, gating/triggering, acquisition time etc.
|
||||
in a file and retrieve it for repeating the measurement with identicals ettings, if necessary
|
||||
@ -389,14 +389,15 @@ typedef struct sharedSlsDetector {
|
||||
Should be implemented in the specific detector class
|
||||
/sa mythenDetector::dumpDetectorSetup
|
||||
*/
|
||||
virtual int dumpDetectorSetup(string const fname, int level=0);
|
||||
int dumpDetectorSetup(string const fname, int level=0);
|
||||
//virtual int dumpDetectorSetup(string const fname, int level=0);
|
||||
/**
|
||||
Purely virtual function
|
||||
Should be implemented in the specific detector class
|
||||
/sa mythenDetector::retrieveDetectorSetup
|
||||
*/
|
||||
virtual int retrieveDetectorSetup(string const fname, int level=0);
|
||||
|
||||
int retrieveDetectorSetup(string const fname, int level=0);
|
||||
//virtual int retrieveDetectorSetup(string const fname, int level=0);
|
||||
/**
|
||||
configure the socket communication and initializes the socket instances
|
||||
|
||||
@ -498,7 +499,8 @@ typedef struct sharedSlsDetector {
|
||||
\sa mythenDetector::readSettingsFile
|
||||
*/
|
||||
|
||||
virtual sls_detector_module* readSettingsFile(string fname, sls_detector_module* myMod=NULL);
|
||||
sls_detector_module* readSettingsFile(string fname, sls_detector_module* myMod=NULL);
|
||||
//virtual sls_detector_module* readSettingsFile(string fname, sls_detector_module* myMod=NULL);
|
||||
|
||||
/**
|
||||
Pure virtual function
|
||||
@ -509,7 +511,8 @@ typedef struct sharedSlsDetector {
|
||||
|
||||
\sa ::sls_detector_module mythenDetector::writeSettingsFile(string, sls_detector_module)
|
||||
*/
|
||||
virtual int writeSettingsFile(string fname, sls_detector_module mod);
|
||||
int writeSettingsFile(string fname, sls_detector_module mod);
|
||||
//virtual int writeSettingsFile(string fname, sls_detector_module mod);
|
||||
|
||||
/**
|
||||
Pure virtual function
|
||||
@ -519,7 +522,8 @@ typedef struct sharedSlsDetector {
|
||||
\returns OK or FAIL if the file could not be written
|
||||
\sa ::sls_detector_module sharedSlsDetector mythenDetector::writeSettingsFile(string, int)
|
||||
*/
|
||||
virtual int writeSettingsFile(string fname, int imod);
|
||||
int writeSettingsFile(string fname, int imod);
|
||||
//virtual int writeSettingsFile(string fname, int imod);
|
||||
|
||||
|
||||
/**
|
||||
@ -719,7 +723,9 @@ typedef struct sharedSlsDetector {
|
||||
\offset reference to the offset variable
|
||||
\sa sharedSlsDetector mythenDetector::readCalibrationFile
|
||||
*/
|
||||
virtual int readCalibrationFile(string fname, float &gain, float &offset);
|
||||
int readCalibrationFile(string fname, float &gain, float &offset);
|
||||
//virtual int readCalibrationFile(string fname, float &gain, float &offset);
|
||||
|
||||
/**
|
||||
|
||||
writes a calibration file
|
||||
@ -728,7 +734,8 @@ typedef struct sharedSlsDetector {
|
||||
\param offset
|
||||
\sa sharedSlsDetector mythenDetector::writeCalibrationFile
|
||||
*/
|
||||
virtual int writeCalibrationFile(string fname, float gain, float offset);
|
||||
int writeCalibrationFile(string fname, float gain, float offset);
|
||||
//virtual int writeCalibrationFile(string fname, float gain, float offset);
|
||||
|
||||
|
||||
/**
|
||||
@ -999,7 +1006,8 @@ typedef struct sharedSlsDetector {
|
||||
\returns current register value
|
||||
\sa ::sls_detector_module
|
||||
*/
|
||||
virtual int setModule(int reg, int imod=-1);
|
||||
int setModule(int reg, int imod=-1);
|
||||
//virtual int setModule(int reg, int imod=-1);
|
||||
|
||||
/**
|
||||
configure chip
|
||||
@ -1007,14 +1015,16 @@ typedef struct sharedSlsDetector {
|
||||
\returns current register value
|
||||
\sa ::sls_detector_module
|
||||
*/
|
||||
virtual int setModule(sls_detector_module module);
|
||||
int setModule(sls_detector_module module);
|
||||
//virtual int setModule(sls_detector_module module);
|
||||
|
||||
/**
|
||||
get module
|
||||
\param imod module number
|
||||
\returns pointer to module structure (which has bee created and must then be deleted)
|
||||
*/
|
||||
virtual sls_detector_module *getModule(int imod);
|
||||
sls_detector_module *getModule(int imod);
|
||||
//virtual sls_detector_module *getModule(int imod);
|
||||
|
||||
// calibration functions
|
||||
// int setCalibration(int imod, detectorSettings isettings, float gain, float offset);
|
||||
@ -1055,7 +1065,8 @@ typedef struct sharedSlsDetector {
|
||||
|
||||
in this function trimbits/settings and calibration files are searched in the settingsDir and calDir directories and the detector is initialized
|
||||
*/
|
||||
virtual detectorSettings setSettings(detectorSettings isettings, int imod=-1);
|
||||
detectorSettings setSettings(detectorSettings isettings, int imod=-1);
|
||||
//virtual detectorSettings setSettings(detectorSettings isettings, int imod=-1);
|
||||
|
||||
/**
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user