diff --git a/slsDetectorSoftware/include/Detector.h b/slsDetectorSoftware/include/Detector.h index 0fe02a235..0d9053c02 100644 --- a/slsDetectorSoftware/include/Detector.h +++ b/slsDetectorSoftware/include/Detector.h @@ -345,7 +345,7 @@ class Detector { * @param pos detector position * @returns lock */ - Result getLockServer(Positions pos = {}); + Result 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 getLastClientIP(Positions pos = {}); + Result 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 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 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 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 getFramesCaughtByReceiver(Positions pos = {}) const; diff --git a/slsDetectorSoftware/include/multiSlsDetector.h b/slsDetectorSoftware/include/multiSlsDetector.h index 08bbae01c..11eb78113 100755 --- a/slsDetectorSoftware/include/multiSlsDetector.h +++ b/slsDetectorSoftware/include/multiSlsDetector.h @@ -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 diff --git a/slsDetectorSoftware/include/slsDetectorUsers.h b/slsDetectorSoftware/include/slsDetectorUsers.h index d05c0f96c..f3f5762d5 100755 --- a/slsDetectorSoftware/include/slsDetectorUsers.h +++ b/slsDetectorSoftware/include/slsDetectorUsers.h @@ -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) diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index c3eeffe35..17652bedd 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -254,7 +254,7 @@ void Detector::setReceiverPort(int value, Positions pos) { pimpl->Parallel(&slsDetector::setReceiverPort, pos, value); } -Result Detector::getLockServer(Positions pos) { +Result 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(value)); } -Result Detector::getLastClientIP(Positions pos) { +Result 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 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 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 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 Detector::getFramesCaughtByReceiver(Positions pos) const { return pimpl->Parallel(&slsDetector::getFramesCaughtByReceiver, pos); diff --git a/slsDetectorSoftware/src/multiSlsDetector.cpp b/slsDetectorSoftware/src/multiSlsDetector.cpp index cf772606f..14e54848b 100755 --- a/slsDetectorSoftware/src/multiSlsDetector.cpp +++ b/slsDetectorSoftware/src/multiSlsDetector.cpp @@ -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 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) { diff --git a/slsDetectorSoftware/src/slsDetectorUsers.cpp b/slsDetectorSoftware/src/slsDetectorUsers.cpp index 5aa1aeabe..16499ad27 100755 --- a/slsDetectorSoftware/src/slsDetectorUsers.cpp +++ b/slsDetectorSoftware/src/slsDetectorUsers.cpp @@ -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){