client compiles, more changes required

This commit is contained in:
2018-10-08 09:34:08 +02:00
parent b5c35ddeac
commit 1c78400369
11 changed files with 501 additions and 675 deletions

File diff suppressed because it is too large Load Diff

View File

@ -353,7 +353,7 @@ public:
* @param pos insignificant
* @returns hostname
*/
std::string getHostname(int pos = -1);
std::string getHostname();
/**
* Connect to the control port
@ -388,7 +388,7 @@ public:
*/
void disconnectStop();
using slsDetectorUtils::getDetectorType;
using slsDetectorBase::getDetectorType;
/**
* Get detector type by connecting to the detector without creating an object
@ -594,36 +594,22 @@ public:
*/
int updateDetector();
/**
* Load configuration from a configuration File
* calls readConfigurationFile and gives it the stream
* @param fname configuration file name
* @return OK or FAIL
*/
int readConfigurationFile(std::string const fname);
/**
* Load configuration from a stream
* @param infile stream
* @return OK or FAIL
*/
int readConfigurationFile(std::ifstream &infile);
/**
* Write current configuration to a file
* calls writeConfigurationFile giving it a stream to write to
* @param fname configuration file name
* @param m multiSlsDetector reference to parse commands
* @returns OK or FAIL
*/
int writeConfigurationFile(std::string const fname);
int writeConfigurationFile(std::string const fname, multiSlsDetector* m);
/**
* Write current configuration to a stream
* @param outfile outstream
* @param id detector id
* @param m multiSlsDetector reference to parse commands
* @returns OK or FAIL
*/
int writeConfigurationFile(std::ofstream &outfile, int id=-1);
int writeConfigurationFile(std::ofstream &outfile, multiSlsDetector* m);
/**
* Returns the trimfile or settings file name (Useless??)
@ -772,10 +758,9 @@ public:
/**
* Configures in detector the destination for UDP packets
* @param ndety number of detectors in y dir
* @returns OK or FAIL
*/
int configureMAC(int ndety);
int configureMAC();
/**
* Set/get timer value (not all implemented for all detectors)
@ -829,7 +814,7 @@ public:
* @param mV 0 in dac units or 1 in mV
* @returns current DAC value
*/
int setDAC(int val, dacIndex index , int mV);
int setDAC(int val, dacIndex index, int mV);
/**
* Get adc value
@ -894,14 +879,14 @@ public:
/**
* Set network parameter
* @param p network parameter type
* @param s network parameter value
* @param value network parameter value
* @returns network parameter value set (from getNetworkParameter)
*/
std::string setNetworkParameter(networkParameter index, std::string value);
/**
* Get network parameter
* @param p network parameter type
* @param index network parameter type
* @returns network parameter value set (from getNetworkParameter)
*/
std::string getNetworkParameter(networkParameter index);
@ -1056,9 +1041,10 @@ public:
/**
* Execute a digital test (Gotthard, Mythen)
* @param mode testmode type
* @param value 1 to set or 0 to clear the digital test bit
* @returns result of test
*/
int digitalTest(digitalTestMode mode);
int digitalTest(digitalTestMode mode, int ival=-1);
/**
* Load dark or gain image to detector (Gotthard)
@ -1336,23 +1322,10 @@ public:
* for current settings
* @returns 0 if rate correction disabled, >0 otherwise
*/
int setRateCorrection(double t=0);
int setRateCorrection(int t=0);
/**
* Get rate correction (Mythen, Eiger)
* @param t reference for dead time
* @returns 0 if rate correction disabled, > 0 otherwise
*/
int getRateCorrection(double &t);
/**
* Get rate correction tau (Mythen, Eiger)
* @returns 0 if rate correction disabled, otherwise the tau used for the correction
*/
double getRateCorrectionTau();
/**
* Get rate correction (Mythen, Eiger)
* Get rate correction Eiger)
* @returns 0 if rate correction disabled, > 0 otherwise
*/
int getRateCorrection();

View File

@ -791,7 +791,7 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
*/
/*! \page data
- <b>ratecorr [ns]</b> Returns the dead time used for rate correections in ns (int). \c put sets the deadtime correction constant in ns, -1 will set it to default tau of settings (0 unset). \c Returns \c (double with 9 decimal digit precision). For Eiger only.
- <b>ratecorr [ns]</b> Returns the dead time used for rate correections in ns (int). \c put sets the deadtime correction constant in ns, -1 will set it to default tau of settings (0 unset). \c Returns \c (int). For Eiger only.
*/
descrToFuncMap[i].m_pFuncName="ratecorr"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdRateCorr;
@ -2046,7 +2046,7 @@ Make sure you have first read \ref intro "the introduction".
string slsDetectorCommand::cmdUnknown(int narg, char *args[], int action, int detPos) {
return string("Unknown command ")+string(args[0])+string("\n")+helpLine(0, action);
return string("Unknown command ")+string(args[0])+string("\n")+helpLine(0, args, action, detPos);
}
string slsDetectorCommand::cmdUnderDevelopment(int narg, char *args[], int action, int detPos) {
@ -2057,7 +2057,7 @@ string slsDetectorCommand::cmdUnderDevelopment(int narg, char *args[], int actio
string slsDetectorCommand::helpLine(int narg, int action) {
string slsDetectorCommand::helpLine(int narg, char *args[], int action, int detPos) {
ostringstream os;
@ -2074,7 +2074,7 @@ string slsDetectorCommand::helpLine(int narg, int action) {
os << endl;
return os.str();
}
return executeLine(narg,args,HELP_ACTION);
return executeLine(narg,args,HELP_ACTION, detPos);
@ -2392,9 +2392,9 @@ string slsDetectorCommand::cmdHelp(int narg, char *args[], int action, int detPo
cout << narg << endl;
if (narg>=1)
return helpLine(narg-1, action);
return helpLine(narg-1, args, action, detPos);
else
return helpLine(0, action);
return helpLine(0, args, action, detPos);
@ -2686,21 +2686,16 @@ string slsDetectorCommand::cmdRateCorr(int narg, char *args[], int action, int d
if (action==HELP_ACTION) {
return helpRateCorr(action);
}
double fval;
int fval;
char answer[1000];
myDet->setOnline(ONLINE_FLAG, detPos);
if (action==PUT_ACTION) {
sscanf(args[1],"%lf",&fval);
sscanf(args[1],"%d",&fval);
myDet->setRateCorrection(fval, detPos);
}
double t;
if (myDet->getRateCorrection(t, detPos)) {
sprintf(answer,"%0.9f",t);
} else {
sprintf(answer,"%0.9f",0.);
}
sprintf(answer,"%d",myDet->getRateCorrection(detPos));
return string(answer);
}
@ -3459,12 +3454,12 @@ string slsDetectorCommand::cmdSettings(int narg, char *args[], int action, int d
}
detectorType type = myDet->getDetectorsType(detPos);
if (type != EIGER || (type == EIGER && narg<=2)) {
myDet->setThresholdEnergy(val, -1, GET_SETTINGS, 1, detPos);
myDet->setThresholdEnergy(val, GET_SETTINGS, 1, detPos);
} else {
detectorSettings sett= myDet->getDetectorSettings(string(args[2]));
if(sett == -1)
return string("invalid settings value");
myDet->setThresholdEnergy(val, -1, sett, 1, detPos);
myDet->setThresholdEnergy(val, sett, 1, detPos);
}
}
sprintf(ans,"%d",myDet->getThresholdEnergy(detPos));
@ -3478,12 +3473,12 @@ string slsDetectorCommand::cmdSettings(int narg, char *args[], int action, int d
if (type != EIGER)
return string("not implemented for this detector");
if (narg<=2) {
myDet->setThresholdEnergy(val, -1, GET_SETTINGS, 0, detPos);
myDet->setThresholdEnergy(val, GET_SETTINGS, 0, detPos);
} else {
detectorSettings sett= myDet->getDetectorSettings(string(args[2]));
if(sett == -1)
return string("invalid settings value");
myDet->setThresholdEnergy(val, -1, sett, 0, detPos);
myDet->setThresholdEnergy(val, sett, 0, detPos);
}
}
sprintf(ans,"%d",myDet->getThresholdEnergy(detPos));
@ -3996,12 +3991,8 @@ string slsDetectorCommand::cmdDAC(int narg, char *args[], int action, int detPos
if(narg >= 3)
if(!strcasecmp(args[2],"mv"))
mode = 1;
#ifdef DACS_INT
if (sscanf(args[1],"%d", &val))
#else
if (sscanf(args[1],"%f", &val))
#endif
;
else
return string("cannot scan DAC value ")+string(args[1]);
@ -4013,11 +4004,7 @@ string slsDetectorCommand::cmdDAC(int narg, char *args[], int action, int detPos
if(!strcasecmp(args[1],"mv"))
mode = 1;
#ifdef DACS_INT
sprintf(answer,"%d",myDet->setDAC(-1,dac,mode, detPos));
#else
sprintf(answer,"%f",myDet->setDAC(-1,dac,mode, detPos));
#endif
if(mode)
strcat(answer," mV");
return string(answer);
@ -4202,7 +4189,6 @@ string slsDetectorCommand::cmdADC(int narg, char *args[], int action, int detPos
return string("cannot decode adc ")+cmd;
myDet->setOnline(ONLINE_FLAG, detPos);
#ifdef DACS_INT
if (myDet->getDetectorsType(detPos) == EIGER || myDet->getDetectorsType(detPos) == JUNGFRAU){
int val = myDet->getADC(adc, detPos);
if (val == -1)
@ -4211,9 +4197,7 @@ string slsDetectorCommand::cmdADC(int narg, char *args[], int action, int detPos
sprintf(answer,"%.2f", (double)val/1000.000);
}
else sprintf(answer,"%d",myDet->getADC(adc, detPos));
#else
sprintf(answer,"%f",myDet->getADC(adc, detPos));
#endif
//if ((adc == TEMPERATURE_ADC) || (adc == TEMPERATURE_FPGA))
if (adc<=100)
strcat(answer,"°C");
@ -4337,7 +4321,7 @@ string slsDetectorCommand::cmdTiming(int narg, char *args[], int action, int det
myDet->setOnline(ONLINE_FLAG, detPos);
if (action==PUT_ACTION) {
if (myDet->externalCommunicationType(string(args[1]))== GET_EXTERNAL_COMMUNICATION_MODE)
return helpTiming(narg,args, action);
return helpTiming(action);
myDet->setExternalCommunicationMode(myDet->externalCommunicationType(string(args[1])), detPos);
}
return myDet->externalCommunicationType(myDet->setExternalCommunicationMode(GET_EXTERNAL_COMMUNICATION_MODE, detPos));
@ -4903,20 +4887,20 @@ string slsDetectorCommand::cmdConfiguration(int narg, char *args[], int action,
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
if (action==PUT_ACTION) {
sval=string(args[1]);
myDet->retrieveDetectorSetup(sval, 0, detPos);
myDet->retrieveDetectorSetup(sval, 0);
} else if (action==GET_ACTION) {
sval=string(args[1]);
myDet->dumpDetectorSetup(sval, 0, detPos);
myDet->dumpDetectorSetup(sval, 0);
}
return sval;
} else if (cmd=="setup") {
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
if (action==PUT_ACTION) {
sval=string(args[1]);
myDet->retrieveDetectorSetup(sval,2, detPos);
myDet->retrieveDetectorSetup(sval,2);
} else if (action==GET_ACTION) {
sval=string(args[1]);
myDet->dumpDetectorSetup(sval,2, detPos);
myDet->dumpDetectorSetup(sval,2);
}
return sval;
}

View File

@ -36,7 +36,7 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
/* \param os output stream to return the help to */
/* \param action can be PUT_ACTION or GET_ACTION (from text client even READOUT_ACTION for acquisition) */
/* *\/ */
std::string helpLine(int narg, int action=HELP_ACTION);
std::string helpLine(int narg, char *args[], int action=HELP_ACTION, int detPos = -1);
static std::string helpAcquire(int action);
static std::string helpData(int action);
static std::string helpStatus(int action);
@ -146,7 +146,7 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
int numberOfCommands;
std::string cmd;
typedef std::string (slsDetectorCommand::*MemFuncGetter)(int narg, char *args[], int action, int detPos = -1);
typedef std::string (slsDetectorCommand::*MemFuncGetter)(int narg, char *args[], int action, int detPos);
struct FuncTable

View File

@ -93,12 +93,12 @@ int64_t slsDetectorUsers::getReceiverSoftwareVersion(int detPos){
return myDetector->getId(slsDetectorDefs::RECEIVER_VERSION, detPos);
}
bool isDetectorVersionCompatible(int detPos) {
return (myDetector->checkVersionCompatibility(slsDetectorDefs::CONTROL_PORT, detPos) == OK);
bool slsDetectorUsers::isDetectorVersionCompatible(int detPos) {
return (myDetector->checkVersionCompatibility(slsDetectorDefs::CONTROL_PORT, detPos) == slsReceiverDefs::OK);
}
bool isReceiverVersionCompatible(int detPos) {
return (myDetector->checkVersionCompatibility(slsDetectorDefs::DATA_PORT, detPos) == OK);
bool slsDetectorUsers::isReceiverVersionCompatible(int detPos) {
return (myDetector->checkVersionCompatibility(slsDetectorDefs::DATA_PORT, detPos) == slsReceiverDefs::OK);
}
int slsDetectorUsers::startMeasurement(){
@ -139,21 +139,17 @@ int slsDetectorUsers::setBitDepth(int i, int detPos){
}
int slsDetectorUsers::setSettings(int isettings, int detPos){
return myDetector->slsDetectorBase::setSettings(isettings, detPos);
return myDetector->setSettings((slsDetectorDefs::detectorSettings)isettings, detPos);
}
int slsDetectorUsers::getThresholdEnergy(int detPos){
return myDetector->getThresholdEnergy(detPos);
}
int slsDetectorUsers::setThresholdEnergy(int e_eV){
return myDetector->setThresholdEnergy(e_eV);
}
int slsDetectorUsers::setThresholdEnergy(int e_ev, int tb, int isettings, int detPos) {
return myDetector->setThresholdEnergy(e_ev, tb,
(isettings == -1) ? slsDetectorDefs::GET_SETTINGS : isettings,
detPos);
return myDetector->setThresholdEnergy(e_ev,
(isettings == -1) ? slsDetectorDefs::GET_SETTINGS : (slsDetectorDefs::detectorSettings)isettings,
tb, detPos);
}
double slsDetectorUsers::setExposureTime(double t, bool inseconds, int detPos){
@ -211,7 +207,7 @@ int slsDetectorUsers::setClockDivider(int value, int detPos) {
int slsDetectorUsers::setParallelMode(int value, int detPos) {
if(value >= 0)
myDetector->setReadOutFlags(slsDetectorDefs::readOutFlags(value), detPos);
return myDetector->setReadOutFlags(-1, detPos);
return myDetector->setReadOutFlags(slsDetectorDefs::GET_READOUT_FLAGS, detPos);
}
int slsDetectorUsers::setOverflowMode(int value, int detPos) {
@ -221,7 +217,7 @@ int slsDetectorUsers::setOverflowMode(int value, int detPos) {
else
myDetector->setReadOutFlags(slsDetectorDefs::NOOVERFLOW, detPos);
}
int ret = myDetector->setReadOutFlags(-1, detPos);
int ret = myDetector->setReadOutFlags(slsDetectorDefs::GET_READOUT_FLAGS, detPos);
if (ret == -1)
return -1;
return ((ret & slsDetectorDefs::SHOW_OVERFLOW) ? 1 : 0);
@ -232,19 +228,19 @@ int slsDetectorUsers::setAllTrimbits(int val, int detPos) {
}
int slsDetectorUsers::setDAC(int val, int index , int detPos) {
return myDetector->setDAC(val, dacsIndex(index), 0, detPos);
return myDetector->setDAC(val, slsDetectorDefs::dacIndex(index), 0, detPos);
}
int slsDetectorUsers::getADC(int index, int detPos) {
return myDetector->getADC(dacsIndex(index),detPos);
return myDetector->getADC(slsDetectorDefs::dacIndex(index),detPos);
}
int slsDetectorUsers::setTenGigabitEthernet(int i, int detPos) {
return myDetector->enableTenGigabitEthernet(i, detPos);
}
int slsDetectorUsers::setStoragecellStart(int pos) {
return myDetector->setStoragecellStart(pos);
int slsDetectorUsers::setStoragecellStart(int pos, int detPos) {
return myDetector->setStoragecellStart(pos, detPos);
}
int slsDetectorUsers::setHighVoltage(int i, int detPos) {

View File

@ -147,7 +147,7 @@ public:
* @param detPos -1 for all detectors in list or specific detector position
* @returns (1)online/(0)offline status
*/
int setReceiverOnline(int const online = GET_ONLINE_FLAG, int detPos = -1);
int setReceiverOnline(int const online = -1, int detPos = -1);
/**
* Load configuration from a configuration File (for one time detector setup)
@ -368,7 +368,7 @@ public:
* @param detPos -1 for all detectors in list or specific detector position
* @returns sub frame dead time in ns, or s if specified
*/
double setSubFrameDeadTime(double t = -1, bool inseconds = false, int detPos = -1);
double setSubFrameExposureDeadTime(double t = -1, bool inseconds = false, int detPos = -1);
/**
* Set/get number of frames
@ -483,7 +483,7 @@ public:
* @param detPos -1 for all detectors in list or specific detector position
* @returns current DAC value
*/
dacs_t setDAC(int val, int index , int detPos = -1);
int setDAC(int val, int index , int detPos = -1);
/**
* Get adc value
@ -495,7 +495,7 @@ public:
* @param detPos -1 for all detectors in list or specific detector position
* @returns current adc value (temperature for eiger and jungfrau in millidegrees)
*/
dacs_t getADC(int index, int detPos = -1);
int getADC(int index, int detPos = -1);
/**
* Enable/disable or 10Gbe (Eiger)