mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-20 02:40:03 +02:00
WIP. catching exceptions using macros to ignore socket and shm error
This commit is contained in:
parent
bd3e439d87
commit
61b937e2e0
@ -30,7 +30,7 @@ void qClient::executeLine(int narg, char *args[]) {
|
||||
|
||||
// validate command structure
|
||||
if (narg < 1) {
|
||||
throw sls::NonCriticalError("No command parsed. " + printCommands());
|
||||
throw sls::RuntimeError("No command parsed. " + printCommands());
|
||||
}
|
||||
|
||||
// help
|
||||
@ -49,7 +49,7 @@ void qClient::executeLine(int narg, char *args[]) {
|
||||
else if (argument == "stop")
|
||||
stopAcquisition();
|
||||
else {
|
||||
throw sls::NonCriticalError("Could not parse arguments. " + printCommands());
|
||||
throw sls::RuntimeError("Could not parse arguments. " + printCommands());
|
||||
}
|
||||
}
|
||||
retval = getStatus();
|
||||
@ -67,7 +67,7 @@ void qClient::executeLine(int narg, char *args[]) {
|
||||
|
||||
// unrecognized command
|
||||
else {
|
||||
throw sls::NonCriticalError("Unrecognized command. " + printCommands());
|
||||
throw sls::RuntimeError("Unrecognized command. " + printCommands());
|
||||
}
|
||||
|
||||
// print result
|
||||
|
@ -11,6 +11,9 @@
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
||||
#define CATCH_DISPLAY(m, s) catch(...) { qDefs::DisplayExceptions(m, s); }
|
||||
#define CATCH_HANDLE(...) catch(...) { qDefs::HandleExceptions(__VA_ARGS__); }
|
||||
|
||||
class qDefs : public QWidget {
|
||||
public:
|
||||
/**
|
||||
@ -18,7 +21,36 @@ class qDefs : public QWidget {
|
||||
*/
|
||||
qDefs(){};
|
||||
|
||||
#define GOODBYE -200
|
||||
#define GOODBYE -200
|
||||
|
||||
static void DisplayExceptions(std::string emsg, std::string src) {
|
||||
try {
|
||||
throw;
|
||||
} catch (sls::SocketError) {
|
||||
throw;
|
||||
} catch (sls::SharedMemoryError) {
|
||||
throw;
|
||||
} catch (const std::exception &e) {
|
||||
ExceptionMessage(emsg, e.what(), src);
|
||||
}
|
||||
}
|
||||
|
||||
template <class CT> struct NonDeduced { using type = CT; };
|
||||
template <class S, typename RT, typename... CT>
|
||||
static void HandleExceptions(const std::string emsg, const std::string src, S* s,
|
||||
RT (S::*somefunc)(CT...),
|
||||
typename NonDeduced<CT>::type... Args) {
|
||||
try {
|
||||
throw;
|
||||
} catch (sls::SocketError) {
|
||||
throw;
|
||||
} catch (sls::SharedMemoryError) {
|
||||
throw;
|
||||
} catch (const std::exception &e) {
|
||||
ExceptionMessage(emsg, e.what(), src);
|
||||
(s->*somefunc)(Args...);
|
||||
}
|
||||
}
|
||||
|
||||
/** function enums */
|
||||
enum qFuncNames {
|
||||
|
@ -349,9 +349,7 @@ void qDetectorMain::LoadConfigFile(const std::string fName) {
|
||||
} else {
|
||||
try {
|
||||
myDet->readConfigurationFile(fName);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not load config file.", e.what(), "qDetectorMain::LoadConfigFile");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not load config file.", "qDetectorMain::LoadConfigFile")
|
||||
}
|
||||
}
|
||||
|
||||
@ -562,9 +560,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not execute utilities.", e.what(), "qDetectorMain::ExecuteUtilities");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not execute utilities.", "qDetectorMain::ExecuteUtilities")
|
||||
|
||||
Refresh(tabs->currentIndex());
|
||||
if (refreshTabs) {
|
||||
@ -587,13 +583,10 @@ void qDetectorMain::ExecuteHelp(QAction *action) {
|
||||
"and Moench detectors";
|
||||
|
||||
std::string guiVersion = std::to_string(APIGUI);
|
||||
std::string clientVersion;
|
||||
std::string clientVersion = "unknown";
|
||||
try {
|
||||
clientVersion = std::to_string(myDet->getId(slsDetectorDefs::THIS_SOFTWARE_VERSION));
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get client version.", e.what(), "qDetectorMain::ExecuteHelp");
|
||||
clientVersion = "unknown";
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get client version.", "qDetectorMain::ExecuteHelp")
|
||||
|
||||
qDefs::Message(qDefs::INFORMATION,
|
||||
"<p style=\"font-family:verdana;\">"
|
||||
|
@ -90,7 +90,7 @@ void qServer::ServerThread(bool isControlServer) {
|
||||
auto socket = (isControlServer ? controlSocket->accept() : stopSocket->accept());
|
||||
try{
|
||||
DecodeFunction(socket);
|
||||
} catch(const sls::NonCriticalError &e) {
|
||||
} catch(const sls::RuntimeError &e) {
|
||||
|
||||
if (strstr(e.what(), "exit")) {
|
||||
FILE_LOG(logINFO) << "Exiting " << (isControlServer ? "Control" : "Stop") << "Server";
|
||||
@ -101,7 +101,7 @@ void qServer::ServerThread(bool isControlServer) {
|
||||
socket.Send(qDefs::FAIL);
|
||||
socket.Send(mess);
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
} catch (const sls::RuntimeError &e) {
|
||||
FILE_LOG(logERROR) << "Accept failed";
|
||||
}
|
||||
|
||||
@ -130,21 +130,21 @@ void qServer::GetStatus(sls::ServerInterface2 &socket) {
|
||||
|
||||
void qServer::StartAcquisition(sls::ServerInterface2 &socket) {
|
||||
if (mainTab->StartStopAcquisitionFromClient(true) == slsDetectorDefs::FAIL) {
|
||||
throw sls::NonCriticalError("Could not start acquistion in Gui");
|
||||
throw sls::RuntimeError("Could not start acquistion in Gui");
|
||||
}
|
||||
socket.Send(slsDetectorDefs::OK);
|
||||
}
|
||||
|
||||
void qServer::StopsAcquisition(sls::ServerInterface2 &socket) {
|
||||
if (mainTab->StartStopAcquisitionFromClient(false) == slsDetectorDefs::FAIL) {
|
||||
throw sls::NonCriticalError("Could not stop acquistion in Gui");
|
||||
throw sls::RuntimeError("Could not stop acquistion in Gui");
|
||||
}
|
||||
socket.Send(slsDetectorDefs::OK);
|
||||
}
|
||||
|
||||
void qServer::Acquire(sls::ServerInterface2 &socket) {
|
||||
if (mainTab->StartStopAcquisitionFromClient(true) == slsDetectorDefs::FAIL) {
|
||||
throw sls::NonCriticalError("Could not start blocking acquistion in Gui");
|
||||
throw sls::RuntimeError("Could not start blocking acquistion in Gui");
|
||||
}
|
||||
// blocking
|
||||
usleep(5000);
|
||||
@ -155,5 +155,5 @@ void qServer::Acquire(sls::ServerInterface2 &socket) {
|
||||
}
|
||||
|
||||
void qServer::ExitServer(sls::ServerInterface2 &socket) {
|
||||
throw sls::NonCriticalError("Server exited");
|
||||
throw sls::RuntimeError("Server exited");
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -89,6 +89,7 @@ void qTabDataOutput::PopulateDetectors() {
|
||||
void qTabDataOutput::EnableBrowse() {
|
||||
FILE_LOG(logDEBUG) << "Getting browse enable";
|
||||
try {
|
||||
btnOutputBrowse->setEnabled(false); // exception default
|
||||
std::string receiverHostname = myDet->getReceiverHostname(comboDetector->currentIndex() - 1);
|
||||
if (receiverHostname == "localhost") {
|
||||
btnOutputBrowse->setEnabled(true);
|
||||
@ -106,15 +107,13 @@ void qTabDataOutput::EnableBrowse() {
|
||||
btnOutputBrowse->setEnabled(false);
|
||||
}
|
||||
}
|
||||
} catch (const sls::RuntimeError &e) {
|
||||
qDefs::ExceptionMessage("Could not get receiver hostname.", e.what(), "qTabDataOutput::EnableBrowse");
|
||||
btnOutputBrowse->setEnabled(false);
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get receiver hostname.", "qTabDataOutput::EnableBrowse")
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetFileWrite() {
|
||||
FILE_LOG(logDEBUG) << "Getting file write enable";
|
||||
try {
|
||||
boxFileWriteEnabled->setEnabled(true); // exception default
|
||||
int retval = myDet->getFileWrite();
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "File write is inconsistent for all detectors.", "qTabDataOutput::GetFileWrite");
|
||||
@ -122,10 +121,7 @@ void qTabDataOutput::GetFileWrite() {
|
||||
} else {
|
||||
boxFileWriteEnabled->setEnabled(retval == 0 ? false : true);
|
||||
}
|
||||
} catch (const sls::RuntimeError &e) {
|
||||
qDefs::ExceptionMessage("Could not get file enable.", e.what(), "qTabDataOutput::GetFileWrite");
|
||||
boxFileWriteEnabled->setEnabled(true);
|
||||
}
|
||||
} CATCH_DISPLAY("Could not get file enable.", "qTabDataOutput::GetFileWrite")
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetFileName() {
|
||||
@ -133,10 +129,7 @@ void qTabDataOutput::GetFileName() {
|
||||
try {
|
||||
auto retval = myDet->getFileName();
|
||||
dispFileName->setText(QString(retval.c_str()));
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get file name prefix.", e.what(), "qTabDataOutput::GetFileName");
|
||||
}
|
||||
|
||||
} CATCH_DISPLAY ("Could not get file name prefix.", "qTabDataOutput::GetFileName")
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetOutputDir() {
|
||||
@ -147,9 +140,7 @@ void qTabDataOutput::GetOutputDir() {
|
||||
try {
|
||||
std::string path = myDet->getFilePath(comboDetector->currentIndex() - 1);
|
||||
dispOutputDir->setText(QString(path.c_str()));
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get file path.", e.what(), "qTabDataOutput::GetOutputDir");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get file path.", "qTabDataOutput::GetOutputDir")
|
||||
|
||||
connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir()));
|
||||
}
|
||||
@ -180,10 +171,7 @@ void qTabDataOutput::SetOutputDir() {
|
||||
std::string spath = std::string(path.toAscii().constData());
|
||||
try {
|
||||
myDet->setFilePath(spath, comboDetector->currentIndex() - 1);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set output file path.", e.what(), "qTabDataOutput::SetOutputDir");
|
||||
GetOutputDir();
|
||||
}
|
||||
} CATCH_HANDLE ("Could not set output file path.", "qTabDataOutput::SetOutputDir", this, &qTabDataOutput::GetOutputDir)
|
||||
}
|
||||
}
|
||||
|
||||
@ -205,9 +193,7 @@ void qTabDataOutput::GetFileFormat() {
|
||||
qDefs::Message(qDefs::WARNING, std::string("Unknown file format: ") + std::to_string(static_cast<int>(retval)), "qTabDataOutput::GetFileFormat");
|
||||
break;
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get file format.", e.what(), "qTabDataOutput::GetFileFormat");
|
||||
}
|
||||
} CATCH_DISPLAY("Could not get file format.", "qTabDataOutput::GetFileFormat")
|
||||
|
||||
connect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int)));
|
||||
}
|
||||
@ -216,10 +202,7 @@ void qTabDataOutput::SetFileFormat(int format) {
|
||||
FILE_LOG(logINFO) << "Setting File Format to " << comboFileFormat->currentText().toAscii().data();
|
||||
try {
|
||||
myDet->setFileFormat((slsDetectorDefs::fileFormat)comboFileFormat->currentIndex());
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set file format.", e.what(), "qTabDataOutput::SetFileFormat");
|
||||
GetFileFormat();
|
||||
}
|
||||
} CATCH_HANDLE ("Could not set file format.", "qTabDataOutput::SetFileFormat", this, &qTabDataOutput::GetFileFormat)
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetFileOverwrite() {
|
||||
@ -233,9 +216,7 @@ void qTabDataOutput::GetFileOverwrite() {
|
||||
} else {
|
||||
chkOverwriteEnable->setChecked(retval == 0 ? false : true);
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get file over write enable.", e.what(), "qTabDataOutput::GetFileOverwrite");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get file over write enable.", "qTabDataOutput::GetFileOverwrite")
|
||||
|
||||
connect(chkOverwriteEnable, SIGNAL(toggled(bool)), this, SLOT(SetOverwriteEnable(bool)));
|
||||
}
|
||||
@ -245,10 +226,7 @@ void qTabDataOutput::SetOverwriteEnable(bool enable) {
|
||||
|
||||
try {
|
||||
myDet->setFileOverWrite(enable);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set file over write enable.", e.what(), "qTabDataOutput::SetOverwriteEnable");
|
||||
GetFileOverwrite();
|
||||
}
|
||||
} CATCH_HANDLE ("Could not set file over write enable.", "qTabDataOutput::SetOverwriteEnable", this, &qTabDataOutput::GetFileOverwrite)
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetTenGigaEnable() {
|
||||
@ -262,9 +240,7 @@ void qTabDataOutput::GetTenGigaEnable() {
|
||||
} else {
|
||||
chkTenGiga->setChecked(retval == 0 ? false : true);
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get 10GbE enable.", e.what(), "qTabDataOutput::GetTenGigaEnable");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get 10GbE enable.", "qTabDataOutput::GetTenGigaEnable")
|
||||
|
||||
connect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(SetTenGigaEnable(bool)));
|
||||
}
|
||||
@ -274,10 +250,7 @@ void qTabDataOutput::SetTenGigaEnable(bool enable) {
|
||||
|
||||
try {
|
||||
myDet->enableTenGigabitEthernet(enable);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set 10GbE enable.", e.what(), "qTabDataOutput::SetTenGigaEnable");
|
||||
GetTenGigaEnable();
|
||||
}
|
||||
} CATCH_HANDLE ("Could not set 10GbE enable.", "qTabDataOutput::SetTenGigaEnable", this, &qTabDataOutput::GetTenGigaEnable)
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetRateCorrection() {
|
||||
@ -296,9 +269,7 @@ void qTabDataOutput::GetRateCorrection() {
|
||||
if (retval != 0)
|
||||
spinCustomDeadTime->setValue(retval);
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get rate correction.", e.what(), "qTabDataOutput::GetRateCorrection");
|
||||
}
|
||||
} CATCH_DISPLAY("Could not get rate correction.", "qTabDataOutput::GetRateCorrection")
|
||||
|
||||
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection()));
|
||||
connect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection()));
|
||||
@ -315,10 +286,7 @@ void qTabDataOutput::EnableRateCorrection() {
|
||||
// disable
|
||||
try {
|
||||
myDet->setRateCorrection(0);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not switch off rate correction.", e.what(), "qTabDataOutput::EnableRateCorrection");
|
||||
GetRateCorrection();
|
||||
}
|
||||
} CATCH_HANDLE ("Could not switch off rate correction.", "qTabDataOutput::EnableRateCorrection", this, &qTabDataOutput::GetRateCorrection)
|
||||
}
|
||||
|
||||
void qTabDataOutput::SetRateCorrection() {
|
||||
@ -335,10 +303,7 @@ void qTabDataOutput::SetRateCorrection() {
|
||||
|
||||
try {
|
||||
myDet->setRateCorrection(deadtime);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set rate correction.", e.what(), "qTabDataOutput::SetRateCorrection");
|
||||
GetRateCorrection();
|
||||
}
|
||||
} CATCH_HANDLE ("Could not set rate correction.", "qTabDataOutput::SetRateCorrection", this, &qTabDataOutput::GetRateCorrection)
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetSpeed() {
|
||||
@ -360,9 +325,7 @@ void qTabDataOutput::GetSpeed() {
|
||||
qDefs::Message(qDefs::WARNING, std::string("Unknown speed: ") + std::to_string(retval), "qTabDataOutput::GetFileFormat");
|
||||
break;
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get speed.", e.what(), "qTabDataOutput::GetSpeed");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get speed.", "qTabDataOutput::GetSpeed")
|
||||
|
||||
connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed()));
|
||||
}
|
||||
@ -371,10 +334,7 @@ void qTabDataOutput::SetSpeed(int speed) {
|
||||
FILE_LOG(logINFO) << "Setting Speed to " << comboEigerClkDivider->currentText().toAscii().data();;
|
||||
try {
|
||||
myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER, speed);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set speed.", e.what(), "qTabDataOutput::SetSpeed");
|
||||
GetSpeed();
|
||||
}
|
||||
} CATCH_HANDLE ("Could not set speed.", "qTabDataOutput::SetSpeed", this, &qTabDataOutput::GetSpeed)
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetFlags() {
|
||||
@ -405,9 +365,7 @@ void qTabDataOutput::GetFlags() {
|
||||
qDefs::Message(qDefs::WARNING, std::string("Unknown flag (Not Parallel or Non Parallel): ") + std::to_string(retval), "qTabDataOutput::GetFlags");
|
||||
}
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get speed.", e.what(), "qTabDataOutput::GetSpeed");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get speed.", "qTabDataOutput::GetSpeed")
|
||||
|
||||
connect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
connect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
@ -443,10 +401,7 @@ void qTabDataOutput::SetFlags() {
|
||||
myDet->setReadOutFlags(flag1);
|
||||
FILE_LOG(logINFO) << "Setting Readout Flags to " << comboEigerFlags2->currentText().toAscii().data();
|
||||
myDet->setReadOutFlags(flag2);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set readout flags.", e.what(), "qTabDataOutput::SetFlags");
|
||||
GetFlags();
|
||||
}
|
||||
} CATCH_HANDLE ("Could not set readout flags.", "qTabDataOutput::SetFlags", this, &qTabDataOutput::GetFlags)
|
||||
}
|
||||
|
||||
|
||||
|
@ -66,9 +66,7 @@ void qTabDebugging::GetDetectorStatus() {
|
||||
try {
|
||||
std::string status = slsDetectorDefs::runStatusType(myDet->getRunStatus(comboDetector->currentIndex()));
|
||||
lblStatus->setText(QString(status.c_str()).toUpper());
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get detector status.", e.what(), "qTabDebugging::GetDetectorStatus");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get detector status.", "qTabDebugging::GetDetectorStatus")
|
||||
}
|
||||
|
||||
|
||||
@ -167,9 +165,7 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item) {
|
||||
lblDetectorFirmware->setText(QString(retval.c_str()));
|
||||
retval = std::string("0x") + std::to_string((unsigned long)myDet->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION, comboDetector->currentIndex()));
|
||||
lblDetectorSoftware->setText(QString(retval.c_str()));
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get versions.", e.what(), "qTabDebugging::SetParameters");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get versions.", "qTabDebugging::SetParameters")
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,9 +206,7 @@ void qTabDebugging::TestDetector() {
|
||||
|
||||
//display message
|
||||
qDefs::Message(qDefs::INFORMATION, message.toAscii().constData(), "qTabDebugging::TestDetector");
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not execute digital test.", e.what(), "qTabDebugging::TestDetector");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not execute digital test.", "qTabDebugging::TestDetector")
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,12 +28,12 @@ qTabDeveloper::qTabDeveloper(QWidget *parent, multiSlsDetector *detector) :
|
||||
}
|
||||
|
||||
qTabDeveloper::~qTabDeveloper() {
|
||||
for (int i = 0; i < lblDacs.size(); ++i) {
|
||||
for (size_t i = 0; i < lblDacs.size(); ++i) {
|
||||
delete lblDacs[i];
|
||||
delete lblDacsmV[i];
|
||||
delete spinDacs[i];
|
||||
}
|
||||
for (int i = 0; i < lblAdcs.size(); ++i) {
|
||||
for (size_t i = 0; i < lblAdcs.size(); ++i) {
|
||||
delete lblAdcs[i];
|
||||
delete spinAdcs[i];
|
||||
}
|
||||
@ -288,9 +288,7 @@ void qTabDeveloper::GetDac(int id) {
|
||||
// mv
|
||||
retval = myDet->setDAC(-1, getSLSIndex(id), 1, comboDetector->currentIndex() - 1);
|
||||
lblDacsmV[id]->setText(QString("%1mV").arg(retval -10));
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get dac.", e.what(), "qTabDeveloper::GetDac");
|
||||
}
|
||||
} CATCH_DISPLAY("Could not get dac.", "qTabDeveloper::GetDac")
|
||||
|
||||
connect(spinDacs[id], SIGNAL(editingFinished(int)), this, SLOT(SetDac(int)));
|
||||
}
|
||||
@ -309,9 +307,8 @@ void qTabDeveloper::SetDac(int id) {
|
||||
|
||||
try {
|
||||
myDet->setDAC(val, getSLSIndex(id), 0, comboDetector->currentIndex() - 1);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set dac.", e.what(), "qTabDeveloper::SetDac");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not set dac.", "qTabDeveloper::SetDac")
|
||||
|
||||
// update mV anyway
|
||||
GetDac(id);
|
||||
}
|
||||
@ -331,9 +328,7 @@ void qTabDeveloper::GetAdcs() {
|
||||
}
|
||||
spinAdcs[i]->setText(QString::number(retval, 'f', 2) + 0x00b0 + QString("C"));
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get adcs.", e.what(), "qTabDeveloper::GetAdcs");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get adcs.", "qTabDeveloper::GetAdcs")
|
||||
}
|
||||
}
|
||||
|
||||
@ -390,10 +385,7 @@ void qTabDeveloper::GetHighVoltage() {
|
||||
}
|
||||
}
|
||||
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get high voltage.", e.what(), "qTabDeveloper::GetHighVoltage");
|
||||
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get high voltage.", "qTabDeveloper::GetHighVoltage")
|
||||
|
||||
if (comboHV == nullptr) {
|
||||
connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
|
||||
@ -408,10 +400,8 @@ void qTabDeveloper::SetHighVoltage() {
|
||||
|
||||
try {
|
||||
myDet->setDAC(val, slsDetectorDefs::HIGH_VOLTAGE, 0, comboDetector->currentIndex() - 1);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set high voltage.", e.what(), "qTabDeveloper::SetHighVoltage");
|
||||
GetHighVoltage();
|
||||
}
|
||||
} CATCH_HANDLE ("Could not set high voltage.", "qTabDeveloper::SetHighVoltage",
|
||||
this, &qTabDeveloper::GetHighVoltage)
|
||||
}
|
||||
|
||||
|
||||
@ -467,7 +457,7 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index) {
|
||||
case 22:
|
||||
return slsDetectorDefs::TEMPERATURE_FPGA;
|
||||
default:
|
||||
throw sls::NonCriticalError(std::string("Unknown dac/adc index") + std::to_string(index));
|
||||
throw sls::RuntimeError(std::string("Unknown dac/adc index") + std::to_string(index));
|
||||
}
|
||||
break;
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
@ -493,7 +483,7 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index) {
|
||||
case 9:
|
||||
return slsDetectorDefs::TEMPERATURE_FPGA;
|
||||
default:
|
||||
throw sls::NonCriticalError(std::string("Unknown dac/adc index") + std::to_string(index));
|
||||
throw sls::RuntimeError(std::string("Unknown dac/adc index") + std::to_string(index));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -504,7 +494,7 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index) {
|
||||
if (index == numDACWidgets) {
|
||||
return slsDetectorDefs::TEMPERATURE_ADC;
|
||||
} else {
|
||||
throw sls::NonCriticalError(std::string("Unknown dac/adc index") + std::to_string(index));
|
||||
throw sls::RuntimeError(std::string("Unknown dac/adc index") + std::to_string(index));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -512,7 +502,7 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index) {
|
||||
if (index >= 0 && index < numDACWidgets) {
|
||||
return (slsDetectorDefs::dacIndex)index;
|
||||
} else {
|
||||
throw sls::NonCriticalError(std::string("Unknown dac/adc index") + std::to_string(index));
|
||||
throw sls::RuntimeError(std::string("Unknown dac/adc index") + std::to_string(index));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -222,9 +222,7 @@ void qTabMeasurement::GetTimingMode() {
|
||||
qDefs::Message(qDefs::WARNING, std::string("Unknown timing mode: ")+ std::to_string(retval), "qTabMeasurement::GetTimingMode");
|
||||
break;
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get timing mode.", e.what(), "qTabMeasurement::GetTimingMode");
|
||||
}
|
||||
} CATCH_DISPLAY("Could not get timing mode.", "qTabMeasurement::GetTimingMode")
|
||||
|
||||
disconnect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));
|
||||
}
|
||||
@ -235,10 +233,7 @@ void qTabMeasurement::SetTimingMode(int val) {
|
||||
try {
|
||||
myDet->setExternalCommunicationMode(static_cast<slsDetectorDefs::externalCommunicationMode>(val));
|
||||
EnableWidgetsforTimingMode();
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set timing mode.", e.what(), "qTabMeasurement::SetTimingMode");
|
||||
GetTimingMode();
|
||||
}
|
||||
} CATCH_HANDLE("Could not set timing mode.", "qTabMeasurement::SetTimingMode", this, &qTabMeasurement::GetTimingMode)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetNumMeasurements() {
|
||||
@ -251,9 +246,7 @@ void qTabMeasurement::GetNumMeasurements() {
|
||||
qDefs::Message(qDefs::WARNING, "Number of measurements is inconsistent for all detectors.", "qTabMeasurement::GetNumMeasurements");
|
||||
}
|
||||
spinNumMeasurements->setValue(retval);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get number of measurements.", e.what(), "qTabMeasurement::GetNumMeasurements");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get number of measurements.", "qTabMeasurement::GetNumMeasurements")
|
||||
|
||||
connect(spinNumMeasurements, SIGNAL(valueChanged(int)), this, SLOT(SetNumMeasurements(int)));
|
||||
}
|
||||
@ -263,10 +256,7 @@ void qTabMeasurement::SetNumMeasurements(int val) {
|
||||
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER, val);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set number of measurements.", e.what(), "qTabMeasurement::SetNumMeasurements");
|
||||
GetNumMeasurements();
|
||||
}
|
||||
} CATCH_HANDLE("Could not set number of measurements.", "qTabMeasurement::SetNumMeasurements", this, &qTabMeasurement::GetNumMeasurements)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetNumFrames() {
|
||||
@ -279,9 +269,7 @@ void qTabMeasurement::GetNumFrames() {
|
||||
qDefs::Message(qDefs::WARNING, "Number of frames is inconsistent for all detectors.", "qTabMeasurement::GetNumFrames");
|
||||
}
|
||||
spinNumFrames->setValue(retval);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get number of frames.", e.what(), "qTabMeasurement::GetNumFrames");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get number of frames.", "qTabMeasurement::GetNumFrames")
|
||||
|
||||
connect(spinNumFrames, SIGNAL(valueChanged(int)), this, SLOT(SetNumFrames(int)));
|
||||
}
|
||||
@ -291,10 +279,7 @@ void qTabMeasurement::SetNumFrames(int val) {
|
||||
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::FRAME_NUMBER, val);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set number of frames.", e.what(), "qTabMeasurement::SetNumFrames");
|
||||
GetNumFrames();
|
||||
}
|
||||
} CATCH_HANDLE("Could not set number of frames.", "qTabMeasurement::SetNumFrames", this, &qTabMeasurement::GetNumFrames)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetNumTriggers() {
|
||||
@ -307,9 +292,7 @@ void qTabMeasurement::GetNumTriggers() {
|
||||
qDefs::Message(qDefs::WARNING, "Number of triggers is inconsistent for all detectors.", "qTabMeasurement::GetNumTriggers");
|
||||
}
|
||||
spinNumTriggers->setValue(retval);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get number of frames.", e.what(), "qTabMeasurement::GetNumTriggers");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get number of frames.", "qTabMeasurement::GetNumTriggers")
|
||||
|
||||
connect(spinNumTriggers, SIGNAL(valueChanged(int)), this, SLOT(SetNumTriggers(int)));
|
||||
}
|
||||
@ -319,10 +302,7 @@ void qTabMeasurement::SetNumTriggers(int val) {
|
||||
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER, val);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set number of triggers.", e.what(), "qTabMeasurement::SetNumTriggers");
|
||||
GetNumTriggers();
|
||||
}
|
||||
} CATCH_HANDLE("Could not set number of triggers.", "qTabMeasurement::SetNumTriggers", this, &qTabMeasurement::GetNumTriggers)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetNumSamples() {
|
||||
@ -339,9 +319,7 @@ void qTabMeasurement::GetNumSamples() {
|
||||
qDefs::Message(qDefs::WARNING, "Number of digital samples is inconsistent for all detectors.", "qTabMeasurement::GetNumSamples");
|
||||
}
|
||||
spinNumSamples->setValue(retval);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get number of samples.", e.what(), "qTabMeasurement::GetNumSamples");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get number of samples.", "qTabMeasurement::GetNumSamples")
|
||||
|
||||
connect(spinNumSamples, SIGNAL(valueChanged(int)), this, SLOT(SetNumSamples(int)));
|
||||
}
|
||||
@ -352,10 +330,7 @@ void qTabMeasurement::SetNumSamples(int val) {
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES, val);
|
||||
myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES, val);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set number of samples.", e.what(), "qTabMeasurement::SetNumSamples");
|
||||
GetNumSamples();
|
||||
}
|
||||
} CATCH_HANDLE("Could not set number of samples.", "qTabMeasurement::SetNumSamples", this, &qTabMeasurement::GetNumSamples)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetExposureTime() {
|
||||
@ -375,9 +350,7 @@ void qTabMeasurement::GetExposureTime() {
|
||||
|
||||
CheckAcqPeriodGreaterThanExp();
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get exposure time.", e.what(), "qTabMeasurement::GetExposureTime");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get exposure time.", "qTabMeasurement::GetExposureTime")
|
||||
|
||||
connect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime()));
|
||||
connect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime()));
|
||||
@ -392,10 +365,7 @@ void qTabMeasurement::SetExposureTime() {
|
||||
double timeNS = qDefs::getNSTime(unit, val);
|
||||
myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME, std::lround(timeNS));
|
||||
CheckAcqPeriodGreaterThanExp();
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set exposure time.", e.what(), "qTabMeasurement::SetExposureTime");
|
||||
GetExposureTime();
|
||||
}
|
||||
} CATCH_HANDLE("Could not set exposure time.", "qTabMeasurement::SetExposureTime", this, &qTabMeasurement::GetExposureTime)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetAcquisitionPeriod() {
|
||||
@ -415,9 +385,7 @@ void qTabMeasurement::GetAcquisitionPeriod() {
|
||||
|
||||
CheckAcqPeriodGreaterThanExp();
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get acquisition period.", e.what(), "qTabMeasurement::GetAcquisitionPeriod");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get acquisition period.", "qTabMeasurement::GetAcquisitionPeriod")
|
||||
|
||||
connect(spinPeriod, SIGNAL(valueChanged(double)), this, SLOT(SetAcquisitionPeriod()));
|
||||
connect(comboPeriodUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetAcquisitionPeriod()));
|
||||
@ -432,10 +400,7 @@ void qTabMeasurement::SetAcquisitionPeriod() {
|
||||
double timeNS = qDefs::getNSTime(unit, val);
|
||||
myDet->setTimer(slsDetectorDefs::FRAME_PERIOD, std::lround(timeNS));
|
||||
CheckAcqPeriodGreaterThanExp();
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set acquisition period.", e.what(), "qTabMeasurement::SetAcquisitionPeriod");
|
||||
GetAcquisitionPeriod();
|
||||
}
|
||||
} CATCH_HANDLE("Could not set acquisition period.", "qTabMeasurement::SetAcquisitionPeriod", this, &qTabMeasurement::GetAcquisitionPeriod)
|
||||
}
|
||||
|
||||
void qTabMeasurement::CheckAcqPeriodGreaterThanExp() {
|
||||
@ -478,9 +443,7 @@ void qTabMeasurement::GetDelay() {
|
||||
|
||||
CheckAcqPeriodGreaterThanExp();
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get delay.", e.what(), "qTabMeasurement::GetDelay");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get delay.", "qTabMeasurement::GetDelay")
|
||||
|
||||
connect(spinDelay, SIGNAL(valueChanged(double)), this, SLOT(SetDelay()));
|
||||
connect(comboDelayUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetDelay()));
|
||||
@ -495,10 +458,7 @@ void qTabMeasurement::SetDelay() {
|
||||
double timeNS = qDefs::getNSTime(unit, val);
|
||||
myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER, std::lround(timeNS));
|
||||
CheckAcqPeriodGreaterThanExp();
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set delay.", e.what(), "qTabMeasurement::SetDelay");
|
||||
GetDelay();
|
||||
}
|
||||
} CATCH_HANDLE("Could not set delay.", "qTabMeasurement::SetDelay", this, &qTabMeasurement::GetDelay)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetFileWrite() {
|
||||
@ -506,7 +466,8 @@ void qTabMeasurement::GetFileWrite() {
|
||||
disconnect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool)));
|
||||
|
||||
try {
|
||||
int retval = myDet->getFileWrite();
|
||||
dispFileName->setEnabled(true); // default, even when exception
|
||||
int retval = myDet->getFileWrite();
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "File write is inconsistent for all detectors.", "qTabMeasurement::GetFileWrite");
|
||||
dispFileName->setEnabled(true);
|
||||
@ -514,10 +475,7 @@ void qTabMeasurement::GetFileWrite() {
|
||||
chkFile->setChecked(retval == 0 ? false : true);
|
||||
dispFileName->setEnabled(chkFile->isChecked());
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get file over write enable.", e.what(), "qTabMeasurement::GetFileWrite");
|
||||
dispFileName->setEnabled(true);
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get file over write enable.", "qTabMeasurement::GetFileWrite")
|
||||
|
||||
connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool)));
|
||||
}
|
||||
@ -528,10 +486,7 @@ void qTabMeasurement::SetFileWrite(bool val) {
|
||||
try {
|
||||
myDet->setFileWrite(val);
|
||||
dispFileName->setEnabled(chkFile->isChecked());
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set file write enable.", e.what(), "qTabMeasurement::SetFileWrite");
|
||||
GetFileWrite();
|
||||
}
|
||||
} CATCH_HANDLE("Could not set file write enable.", "qTabMeasurement::SetFileWrite", this, &qTabMeasurement::GetFileWrite)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetFileName() {
|
||||
@ -541,9 +496,7 @@ void qTabMeasurement::GetFileName() {
|
||||
try {
|
||||
auto retval = myDet->getFileName();
|
||||
dispFileName->setText(QString(retval.c_str()));
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get file name prefix.", e.what(), "qTabMeasurement::GetFileName");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get file name prefix.", "qTabMeasurement::GetFileName")
|
||||
|
||||
connect(dispFileName, SIGNAL(editingFinished()), this, SLOT(SetFileName()));
|
||||
}
|
||||
@ -553,10 +506,7 @@ void qTabMeasurement::SetFileName() {
|
||||
FILE_LOG(logINFO) << "Setting File Name Prefix:" << val;
|
||||
try {
|
||||
myDet->setFileName(val);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set file name prefix.", e.what(), "qTabMeasurement::SetFileName");
|
||||
GetFileName();
|
||||
}
|
||||
} CATCH_HANDLE("Could not set file name prefix.", "qTabMeasurement::SetFileName", this, &qTabMeasurement::GetFileName)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetRunIndex() {
|
||||
@ -569,9 +519,7 @@ void qTabMeasurement::GetRunIndex() {
|
||||
qDefs::Message(qDefs::WARNING, "Acquisition File Index is inconsistent for all detectors.", "qTabMeasurement::GetRunIndex");
|
||||
}
|
||||
spinIndex->setValue(retval);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get acquisition file index.", e.what(), "qTabMeasurement::GetRunIndex");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get acquisition file index.", "qTabMeasurement::GetRunIndex")
|
||||
|
||||
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(SetRunIndex(int)));
|
||||
}
|
||||
@ -581,10 +529,7 @@ void qTabMeasurement::SetRunIndex(int val) {
|
||||
|
||||
try {
|
||||
myDet->setFileIndex(val);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set acquisition file index.", e.what(), "qTabMeasurement::SetRunIndex");
|
||||
GetRunIndex();
|
||||
}
|
||||
} CATCH_HANDLE("Could not set acquisition file index.", "qTabMeasurement::SetRunIndex", this, &qTabMeasurement::GetRunIndex)
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetCurrentMeasurement(int val) {
|
||||
@ -621,11 +566,10 @@ int qTabMeasurement::VerifyOutputDirectoryError() {
|
||||
myDet->setFilePath(paths[det], det);
|
||||
}
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set path.", e.what(), "qTabMeasurement::VerifyOutputDirectoryError");
|
||||
return slsDetectorDefs::FAIL;
|
||||
}
|
||||
return slsDetectorDefs::OK;
|
||||
return slsDetectorDefs::OK;
|
||||
} CATCH_DISPLAY ("Could not set path.", "qTabMeasurement::VerifyOutputDirectoryError")
|
||||
|
||||
return slsDetectorDefs::FAIL; // for exception
|
||||
}
|
||||
|
||||
void qTabMeasurement::StartAcquisition() {
|
||||
@ -660,9 +604,7 @@ void qTabMeasurement::StopAcquisition() {
|
||||
FILE_LOG(logINFORED) << "Stopping Acquisition";
|
||||
try{
|
||||
myDet->stopAcquisition();
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not stop acquisition.", e.what(), "qTabMeasurement::StopAcquisition");
|
||||
}
|
||||
} CATCH_DISPLAY("Could not stop acquisition.", "qTabMeasurement::StopAcquisition")
|
||||
}
|
||||
|
||||
void qTabMeasurement::UpdateFinished() {
|
||||
|
@ -331,9 +331,7 @@ void qTabPlot::GetGapPixels() {
|
||||
} else {
|
||||
chkGapPixels->setChecked(retval == 0 ? false : true);
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get gap pixels enable.", e.what(), "qTabPlot::GetGapPixels");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get gap pixels enable.", "qTabPlot::GetGapPixels")
|
||||
|
||||
connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
|
||||
}
|
||||
@ -343,10 +341,7 @@ void qTabPlot::SetGapPixels(bool enable) {
|
||||
|
||||
try {
|
||||
myDet->enableGapPixels(enable);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set gap pixels enable.", e.what(), "qTabPlot::SetGapPixels");
|
||||
GetGapPixels();
|
||||
}
|
||||
} CATCH_HANDLE("Could not set gap pixels enable.", "qTabPlot::SetGapPixels", this, &qTabPlot::GetGapPixels)
|
||||
}
|
||||
|
||||
void qTabPlot::SetTitles() {
|
||||
@ -643,9 +638,7 @@ void qTabPlot::GetStreamingFrequency() {
|
||||
spinTimeGap->setValue(time.first);
|
||||
comboTimeGapUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
}
|
||||
} catch(const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get streaming timer.", e.what(), "qTabPlot::GetStreamingFrequency");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get streaming timer.", "qTabPlot::GetStreamingFrequency")
|
||||
}
|
||||
// every nth frame
|
||||
else {
|
||||
@ -653,9 +646,7 @@ void qTabPlot::GetStreamingFrequency() {
|
||||
stackedLayout->setCurrentIndex(1);
|
||||
spinNthFrame->setValue(freq);
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get streaming frequency.", e.what(), "qTabPlot::GetStreamingFrequency");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get streaming frequency.", "qTabPlot::GetStreamingFrequency")
|
||||
|
||||
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
||||
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
||||
@ -679,10 +670,7 @@ void qTabPlot::SetStreamingFrequency() {
|
||||
double timeMS = qDefs::getMSTime(timeUnit, timeVal);
|
||||
myDet->setReceiverStreamingTimer(timeMS);
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set streaming frequency/ timer.", e.what(), "qTabPlot::SetStreamingFrequency");
|
||||
GetStreamingFrequency();
|
||||
}
|
||||
} CATCH_HANDLE("Could not set streaming frequency/ timer.", "qTabPlot::SetStreamingFrequency", this, &qTabPlot::GetStreamingFrequency)
|
||||
}
|
||||
|
||||
void qTabPlot::Refresh() {
|
||||
|
@ -127,9 +127,7 @@ void qTabSettings::GetSettings() {
|
||||
}
|
||||
break;
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get settings.", e.what(), "qTabSettings::GetSettings");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get settings.", "qTabSettings::GetSettings")
|
||||
|
||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSettings(int)));
|
||||
}
|
||||
@ -141,10 +139,7 @@ void qTabSettings::SetSettings(int index) {
|
||||
|
||||
try {
|
||||
myDet->setSettings(val);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set settings.", e.what(), "qTabSettings::SetSettings");
|
||||
GetSettings();
|
||||
}
|
||||
} CATCH_HANDLE ("Could not set settings.", "qTabSettings::SetSettings", this, &qTabSettings::GetSettings)
|
||||
|
||||
// threshold
|
||||
if (spinThreshold->isEnabled()) {
|
||||
@ -180,9 +175,7 @@ void qTabSettings::GetDynamicRange() {
|
||||
qDefs::Message(qDefs::WARNING, std::string("Unknown dynamic range: ") + std::to_string(retval), "qTabSettings::GetDynamicRange");
|
||||
break;
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get dynamic range.", e.what(), "qTabSettings::GetDynamicRange");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get dynamic range.", "qTabSettings::GetDynamicRange")
|
||||
|
||||
connect(comboDynamicRange, SIGNAL(activated(int)), this,SLOT(SetDynamicRange(int)));
|
||||
}
|
||||
@ -207,10 +200,7 @@ void qTabSettings::SetDynamicRange(int index) {
|
||||
qDefs::Message(qDefs::WARNING, std::string("Unknown dynamic range: ") + std::to_string(index), "qTabSettings::SetDynamicRange");
|
||||
break;
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set dynamic range.", e.what(), "qTabSettings::SetDynamicRange");
|
||||
GetDynamicRange();
|
||||
}
|
||||
} CATCH_HANDLE ("Could not set dynamic range.", "qTabSettings::SetDynamicRange", this, &qTabSettings::GetDynamicRange)
|
||||
}
|
||||
|
||||
void qTabSettings::GetThresholdEnergy() {
|
||||
@ -225,9 +215,7 @@ void qTabSettings::GetThresholdEnergy() {
|
||||
} else {
|
||||
spinThreshold->setValue(retval);
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get threshold energy.", e.what(), "qTabDataOutput::GetThresholdEnergy");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get threshold energy.", "qTabDataOutput::GetThresholdEnergy")
|
||||
|
||||
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetThresholdEnergy()));
|
||||
}
|
||||
@ -236,9 +224,8 @@ void qTabSettings::SetThresholdEnergy(int index) {
|
||||
FILE_LOG(logINFO) << "Setting Threshold Energy to " << index << " eV";
|
||||
try {
|
||||
myDet->setThresholdEnergy(index);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get threshold energy.", e.what(), "qTabSettings::SetThresholdEnergy");
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get threshold energy.", "qTabSettings::SetThresholdEnergy")
|
||||
|
||||
// set the right value anyway (due to tolerance)
|
||||
GetThresholdEnergy();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user