fixed merge2

This commit is contained in:
Erik Frojdh 2019-08-08 17:16:02 +02:00
commit dc24cfb9c3
6 changed files with 123 additions and 20 deletions

View File

@ -345,7 +345,7 @@ class Detector {
* @param pos detector position
* @returns lock
*/
Result<bool> getLockServer(Positions pos = {});
Result<bool> getLockServer(Positions pos = {}) const;
/**
* Sets Lock for detector control server to this client IP
@ -359,7 +359,7 @@ class Detector {
* @param pos detector position
* @returns last client IP saved on detector server
*/
Result<std::string> getLastClientIP(Positions pos = {});
Result<std::string> getLastClientIP(Positions pos = {}) const;
/**
* Exit detector server
@ -374,6 +374,76 @@ class Detector {
*/
void execCommand(const std::string &value, Positions pos = {});
/**
* Write current configuration to a file
* @param value configuration file name
*/
void writeConfigurationFile(const std::string &value);
/**
* Get detector settings
* @param pos detector position
* @returns current settings
*/
Result<defs::detectorSettings> getSettings(Positions pos = {}) const;
/**
* Load detector settings from the settings file picked from the
* trimdir/settingsdir
* Eiger only stores in shared memory ( a get will
* overwrite this) For Eiger, one must use threshold
* @param value settings
* @param pos detector position
*/
void setSettings(defs::detectorSettings value, Positions pos = {});
/**
* Get threshold energy (Eiger)
* @param pos detector position
* @returns current threshold value for imod in ev (-1 failed)
*/
Result<int> getThresholdEnergy(Positions pos = {}) const;
/**
* Set threshold energy (Eiger)
* @param value threshold in eV
* @param sett ev. change settings
* @param tb 1 to include trimbits, 0 to exclude
* @param pos detector position
*/
void setThresholdEnergy(int value, defs::detectorSettings sett = defs::GET_SETTINGS,
int tb = 1, Positions pos = {});
/**
* Returns the detector trimbit/settings directory
* @param pos detector position
* @returns the trimbit/settings directory
*/
Result<std::string> getSettingsDir(Positions pos = {}) const;
/**
* Sets the detector trimbit/settings directory
* @param value trimbits/settings directory
* @param pos detector position
*/
void setSettingsDir(const std::string &value, Positions pos = {});
/**
* Loads the modules settings/trimbits reading from a specific file
* file name extension is automatically generated.
* @param value specific settings/trimbits file
* @param pos detector position
*/
void loadSettingsFile(const std::string &value, Positions pos = {});
/**
* Saves the modules settings/trimbits to a specific file
* file name extension is automatically generated.
* @param value specific settings/trimbits file
* @param pos detector position
*/
void saveSettingsFile(const std::string &value, Positions pos = {});
// Erik
Result<int> getFramesCaughtByReceiver(Positions pos = {}) const;

View File

@ -588,16 +588,15 @@ class multiSlsDetector : public virtual slsDetectorDefs {
/**
* Write current configuration to a file
* @param fname configuration file name
* @returns OK or FAIL
*/
int writeConfigurationFile(const std::string &fname);
void writeConfigurationFile(const std::string &fname);//
/**
* Get detector settings
* @param detPos -1 for all detectors in list or specific detector position
* @returns current settings
*/
detectorSettings getSettings(int detPos = -1);
detectorSettings getSettings(int detPos = -1);//
/**
* Load detector settings from the settings file picked from the
@ -607,14 +606,14 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* @param detPos -1 for all detectors in list or specific detector position
* @returns current settings
*/
detectorSettings setSettings(detectorSettings isettings, int detPos = -1);
detectorSettings setSettings(detectorSettings isettings, int detPos = -1);//
/**
* Get threshold energy (Eiger)
* @param detPos -1 for all detectors in list or specific detector position
* @returns current threshold value for imod in ev (-1 failed)
*/
int getThresholdEnergy(int detPos = -1);
int getThresholdEnergy(int detPos = -1);//
/**
* Set threshold energy (Eiger)
@ -625,14 +624,14 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* @returns current threshold value for imod in ev (-1 failed)
*/
int setThresholdEnergy(int e_eV, detectorSettings isettings = GET_SETTINGS,
int tb = 1, int detPos = -1);
int tb = 1, int detPos = -1);//
/**
* Returns the detector trimbit/settings directory
* @param detPos -1 for all detectors in list or specific detector position
* @returns the trimbit/settings directory
*/
std::string getSettingsDir(int detPos = -1);
std::string getSettingsDir(int detPos = -1);//
/**
* Sets the detector trimbit/settings directory
@ -640,7 +639,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* @param detPos -1 for all detectors in list or specific detector position
* @returns the trimbit/settings directory
*/
std::string setSettingsDir(const std::string &directory, int detPos = -1);
std::string setSettingsDir(const std::string &directory, int detPos = -1);//
/**
* Loads the modules settings/trimbits reading from a specific file
@ -648,7 +647,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* @param fname specific settings/trimbits file
* @param detPos -1 for all detectors in list or specific detector position
*/
void loadSettingsFile(const std::string &fname, int detPos = -1);
void loadSettingsFile(const std::string &fname, int detPos = -1);//
/**
* Saves the modules settings/trimbits to a specific file
@ -656,7 +655,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* @param fname specific settings/trimbits file
* @param detPos -1 for all detectors in list or specific detector position
*/
void saveSettingsFile(const std::string &fname, int detPos = -1);
void saveSettingsFile(const std::string &fname, int detPos = -1);//
/**
* Get Detector run status

View File

@ -139,9 +139,8 @@ public:
/**
* Write current configuration to a file (for one time detector setup)
* @param fname configuration file name
* @returns OK or FAIL
*/
int writeConfigurationFile(const std::string& fname);
void writeConfigurationFile(const std::string& fname);
/**
* Loads the detector setup from file (current measurement setup)

View File

@ -254,7 +254,7 @@ void Detector::setReceiverPort(int value, Positions pos) {
pimpl->Parallel(&slsDetector::setReceiverPort, pos, value);
}
Result<bool> Detector::getLockServer(Positions pos) {
Result<bool> Detector::getLockServer(Positions pos) const {
return pimpl->Parallel(&slsDetector::lockServer, pos, -1);
}
@ -262,7 +262,7 @@ void Detector::setLockServer(bool value, Positions pos) {
pimpl->Parallel(&slsDetector::lockServer, pos, static_cast<int>(value));
}
Result<std::string> Detector::getLastClientIP(Positions pos) {
Result<std::string> Detector::getLastClientIP(Positions pos) const {
return pimpl->Parallel(&slsDetector::getLastClientIP, pos);
}
@ -274,6 +274,42 @@ void Detector::execCommand(const std::string &value, Positions pos) {
pimpl->Parallel(&slsDetector::execCommand, pos, value);
}
void Detector::writeConfigurationFile(const std::string &value) {
pimpl->writeConfigurationFile(value);
}
Result<defs::detectorSettings> Detector::getSettings(Positions pos) const {
return pimpl->Parallel(&slsDetector::getSettings, pos);
}
void Detector::setSettings(defs::detectorSettings value, Positions pos) {
pimpl->Parallel(&slsDetector::setSettings, pos, value);
}
Result<int> Detector::getThresholdEnergy(Positions pos) const {
return pimpl->Parallel(&slsDetector::getThresholdEnergy, pos);
}
void Detector::setThresholdEnergy(int value, defs::detectorSettings sett, int tb, Positions pos) {
pimpl->Parallel(&slsDetector::setThresholdEnergy, pos, value, sett, tb);
}
Result<std::string> Detector::getSettingsDir(Positions pos) const {
return pimpl->Parallel(&slsDetector::getSettingsDir, pos);
}
void Detector::setSettingsDir(const std::string &value, Positions pos) {
pimpl->Parallel(&slsDetector::setSettingsDir, pos, value);
}
void Detector::loadSettingsFile(const std::string &value, Positions pos) {
pimpl->Parallel(&slsDetector::loadSettingsFile, pos, value);
}
void Detector::saveSettingsFile(const std::string &value, Positions pos) {
pimpl->Parallel(&slsDetector::saveSettingsFile, pos, value);
}
// Erik
Result<int> Detector::getFramesCaughtByReceiver(Positions pos) const {
return pimpl->Parallel(&slsDetector::getFramesCaughtByReceiver, pos);

View File

@ -880,7 +880,7 @@ void multiSlsDetector::readConfigurationFile(const std::string &fname) {
input_file.close();
}
int multiSlsDetector::writeConfigurationFile(const std::string &fname) {
void multiSlsDetector::writeConfigurationFile(const std::string &fname) {
// TODO! make exception safe!
const std::vector<std::string> header{"detsizechan", "hostname"};
std::ofstream outfile;
@ -901,7 +901,6 @@ int multiSlsDetector::writeConfigurationFile(const std::string &fname) {
throw RuntimeError("Could not open configuration file " + fname +
" for writing");
}
return OK;
}
slsDetectorDefs::detectorSettings multiSlsDetector::getSettings(int detPos) {

View File

@ -40,8 +40,8 @@ int slsDetectorUsers::readConfigurationFile(const std::string& fname){
}
}
int slsDetectorUsers::writeConfigurationFile(const std::string& fname){
return detector.writeConfigurationFile(fname);
void slsDetectorUsers::writeConfigurationFile(const std::string& fname){
detector.writeConfigurationFile(fname);
}
int slsDetectorUsers::retrieveDetectorSetup(const std::string& fname){