WIP. catching exceptions using macros to ignore socket and shm error

This commit is contained in:
maliakal_d 2019-06-25 17:27:30 +02:00
parent bd3e439d87
commit 61b937e2e0
11 changed files with 789 additions and 872 deletions

View File

@ -30,7 +30,7 @@ void qClient::executeLine(int narg, char *args[]) {
// validate command structure // validate command structure
if (narg < 1) { if (narg < 1) {
throw sls::NonCriticalError("No command parsed. " + printCommands()); throw sls::RuntimeError("No command parsed. " + printCommands());
} }
// help // help
@ -49,7 +49,7 @@ void qClient::executeLine(int narg, char *args[]) {
else if (argument == "stop") else if (argument == "stop")
stopAcquisition(); stopAcquisition();
else { else {
throw sls::NonCriticalError("Could not parse arguments. " + printCommands()); throw sls::RuntimeError("Could not parse arguments. " + printCommands());
} }
} }
retval = getStatus(); retval = getStatus();
@ -67,7 +67,7 @@ void qClient::executeLine(int narg, char *args[]) {
// unrecognized command // unrecognized command
else { else {
throw sls::NonCriticalError("Unrecognized command. " + printCommands()); throw sls::RuntimeError("Unrecognized command. " + printCommands());
} }
// print result // print result

View File

@ -11,6 +11,9 @@
#include <stdint.h> #include <stdint.h>
#include <string> #include <string>
#define CATCH_DISPLAY(m, s) catch(...) { qDefs::DisplayExceptions(m, s); }
#define CATCH_HANDLE(...) catch(...) { qDefs::HandleExceptions(__VA_ARGS__); }
class qDefs : public QWidget { class qDefs : public QWidget {
public: public:
/** /**
@ -20,6 +23,35 @@ class qDefs : public QWidget {
#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 */ /** function enums */
enum qFuncNames { enum qFuncNames {
QF_GET_DETECTOR_STATUS, QF_GET_DETECTOR_STATUS,

View File

@ -349,9 +349,7 @@ void qDetectorMain::LoadConfigFile(const std::string fName) {
} else { } else {
try { try {
myDet->readConfigurationFile(fName); myDet->readConfigurationFile(fName);
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not load config file.", "qDetectorMain::LoadConfigFile")
qDefs::ExceptionMessage("Could not load config file.", e.what(), "qDetectorMain::LoadConfigFile");
}
} }
} }
@ -562,9 +560,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
} }
} }
} }
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not execute utilities.", "qDetectorMain::ExecuteUtilities")
qDefs::ExceptionMessage("Could not execute utilities.", e.what(), "qDetectorMain::ExecuteUtilities");
}
Refresh(tabs->currentIndex()); Refresh(tabs->currentIndex());
if (refreshTabs) { if (refreshTabs) {
@ -587,13 +583,10 @@ void qDetectorMain::ExecuteHelp(QAction *action) {
"and Moench detectors"; "and Moench detectors";
std::string guiVersion = std::to_string(APIGUI); std::string guiVersion = std::to_string(APIGUI);
std::string clientVersion; std::string clientVersion = "unknown";
try { try {
clientVersion = std::to_string(myDet->getId(slsDetectorDefs::THIS_SOFTWARE_VERSION)); clientVersion = std::to_string(myDet->getId(slsDetectorDefs::THIS_SOFTWARE_VERSION));
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get client version.", "qDetectorMain::ExecuteHelp")
qDefs::ExceptionMessage("Could not get client version.", e.what(), "qDetectorMain::ExecuteHelp");
clientVersion = "unknown";
}
qDefs::Message(qDefs::INFORMATION, qDefs::Message(qDefs::INFORMATION,
"<p style=\"font-family:verdana;\">" "<p style=\"font-family:verdana;\">"

View File

@ -90,7 +90,7 @@ void qServer::ServerThread(bool isControlServer) {
auto socket = (isControlServer ? controlSocket->accept() : stopSocket->accept()); auto socket = (isControlServer ? controlSocket->accept() : stopSocket->accept());
try{ try{
DecodeFunction(socket); DecodeFunction(socket);
} catch(const sls::NonCriticalError &e) { } catch(const sls::RuntimeError &e) {
if (strstr(e.what(), "exit")) { if (strstr(e.what(), "exit")) {
FILE_LOG(logINFO) << "Exiting " << (isControlServer ? "Control" : "Stop") << "Server"; FILE_LOG(logINFO) << "Exiting " << (isControlServer ? "Control" : "Stop") << "Server";
@ -101,7 +101,7 @@ void qServer::ServerThread(bool isControlServer) {
socket.Send(qDefs::FAIL); socket.Send(qDefs::FAIL);
socket.Send(mess); socket.Send(mess);
} }
} catch (const sls::NonCriticalError &e) { } catch (const sls::RuntimeError &e) {
FILE_LOG(logERROR) << "Accept failed"; FILE_LOG(logERROR) << "Accept failed";
} }
@ -130,21 +130,21 @@ void qServer::GetStatus(sls::ServerInterface2 &socket) {
void qServer::StartAcquisition(sls::ServerInterface2 &socket) { void qServer::StartAcquisition(sls::ServerInterface2 &socket) {
if (mainTab->StartStopAcquisitionFromClient(true) == slsDetectorDefs::FAIL) { 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); socket.Send(slsDetectorDefs::OK);
} }
void qServer::StopsAcquisition(sls::ServerInterface2 &socket) { void qServer::StopsAcquisition(sls::ServerInterface2 &socket) {
if (mainTab->StartStopAcquisitionFromClient(false) == slsDetectorDefs::FAIL) { 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); socket.Send(slsDetectorDefs::OK);
} }
void qServer::Acquire(sls::ServerInterface2 &socket) { void qServer::Acquire(sls::ServerInterface2 &socket) {
if (mainTab->StartStopAcquisitionFromClient(true) == slsDetectorDefs::FAIL) { 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 // blocking
usleep(5000); usleep(5000);
@ -155,5 +155,5 @@ void qServer::Acquire(sls::ServerInterface2 &socket) {
} }
void qServer::ExitServer(sls::ServerInterface2 &socket) { void qServer::ExitServer(sls::ServerInterface2 &socket) {
throw sls::NonCriticalError("Server exited"); throw sls::RuntimeError("Server exited");
} }

View File

@ -3,16 +3,15 @@
#include <iostream> #include <iostream>
qTabAdvanced::qTabAdvanced(QWidget *parent, multiSlsDetector *detector)
qTabAdvanced::qTabAdvanced(QWidget *parent, multiSlsDetector* detector): : QWidget(parent), myDet(detector) {
QWidget(parent), myDet(detector) {
setupUi(this); setupUi(this);
SetupWidgetWindow(); SetupWidgetWindow();
FILE_LOG(logDEBUG) << "Advanced ready"; FILE_LOG(logDEBUG) << "Advanced ready";
} }
qTabAdvanced::~qTabAdvanced() { qTabAdvanced::~qTabAdvanced() {
for (int i = 0; i < lblFromX.size(); ++i) { for (size_t i = 0; i < lblFromX.size(); ++i) {
delete lblFromX[i]; delete lblFromX[i];
delete lblFromY[i]; delete lblFromY[i];
delete lblToX[i]; delete lblToX[i];
@ -30,7 +29,8 @@ void qTabAdvanced::SetupWidgetWindow(){
red.setColor(QPalette::Active, QPalette::WindowText, Qt::red); red.setColor(QPalette::Active, QPalette::WindowText, Qt::red);
detOnlineTip = dispOnline->toolTip(); detOnlineTip = dispOnline->toolTip();
rxrOnlineTip = dispRxrOnline->toolTip(); rxrOnlineTip = dispRxrOnline->toolTip();
errOnlineTip = QString("<nobr><br><br><font color=\"red\"><nobr>It is offline!</nobr></font>"); errOnlineTip = QString(
"<nobr><br><br><font color=\"red\"><nobr>It is offline!</nobr></font>");
// enabling according to det type // enabling according to det type
switch (myDet->getDetectorTypeAsEnum()) { switch (myDet->getDetectorTypeAsEnum()) {
@ -62,28 +62,41 @@ void qTabAdvanced::SetupWidgetWindow(){
void qTabAdvanced::Initialization() { void qTabAdvanced::Initialization() {
connect(tabAdvancedSettings, SIGNAL(currentChanged(int)), this, SLOT(Refresh())); connect(tabAdvancedSettings, SIGNAL(currentChanged(int)), this,
SLOT(Refresh()));
// trimming // trimming
if (tab_trimming->isEnabled()) { if (tab_trimming->isEnabled()) {
// editingFinished to not set trimbits for every character input // editingFinished to not set trimbits for every character input
connect(spinSetAllTrimbits, SIGNAL(editingFinished()), this, SLOT(SetAllTrimbits())); connect(spinSetAllTrimbits, SIGNAL(editingFinished()), this,
SLOT(SetAllTrimbits()));
} }
// network // network
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(SetDetector(int))); connect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
connect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int))); SLOT(SetDetector(int)));
connect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); connect(spinControlPort, SIGNAL(valueChanged(int)), this,
connect(dispDetectorUDPIP, SIGNAL(editingFinished()), this, SLOT(SetDetectorUDPIP())); SLOT(SetControlPort(int)));
connect(dispDetectorUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetDetectorUDPMAC())); connect(spinStopPort, SIGNAL(valueChanged(int)), this,
connect(spinZMQPort, SIGNAL(valueChanged(int)), this, SLOT(SetCltZMQPort(int))); SLOT(SetStopPort(int)));
connect(dispDetectorUDPIP, SIGNAL(editingFinished()), this,
SLOT(SetDetectorUDPIP()));
connect(dispDetectorUDPMAC, SIGNAL(editingFinished()), this,
SLOT(SetDetectorUDPMAC()));
connect(spinZMQPort, SIGNAL(valueChanged(int)), this,
SLOT(SetCltZMQPort(int)));
connect(dispZMQIP, SIGNAL(editingFinished()), this, SLOT(SetCltZMQIP())); connect(dispZMQIP, SIGNAL(editingFinished()), this, SLOT(SetCltZMQIP()));
connect(dispRxrHostname, SIGNAL(editingFinished()), this, SLOT(SetRxrHostname())); connect(dispRxrHostname, SIGNAL(editingFinished()), this,
connect(spinRxrTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); SLOT(SetRxrHostname()));
connect(spinRxrUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int))); connect(spinRxrTCPPort, SIGNAL(valueChanged(int)), this,
SLOT(SetRxrTCPPort(int)));
connect(spinRxrUDPPort, SIGNAL(valueChanged(int)), this,
SLOT(SetRxrUDPPort(int)));
connect(dispRxrUDPIP, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPIP())); connect(dispRxrUDPIP, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPIP()));
connect(dispRxrUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPMAC())); connect(dispRxrUDPMAC, SIGNAL(editingFinished()), this,
connect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrZMQPort(int))); SLOT(SetRxrUDPMAC()));
connect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this,
SLOT(SetRxrZMQPort(int)));
connect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP())); connect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP()));
// roi // roi
@ -96,28 +109,35 @@ void qTabAdvanced::Initialization(){
// storage cells // storage cells
if (lblNumStoragecells->isEnabled()) { if (lblNumStoragecells->isEnabled()) {
connect(spinNumStoragecells, SIGNAL(valueChanged(int)), this, SLOT(SetNumStoragecells(int))); connect(spinNumStoragecells, SIGNAL(valueChanged(int)), this,
SLOT(SetNumStoragecells(int)));
} }
// subexptime, subdeadtime // subexptime, subdeadtime
if (lblSubExpTime->isEnabled()) { if (lblSubExpTime->isEnabled()) {
connect(spinSubExpTime,SIGNAL(valueChanged(double)), this, SLOT(SetSubExposureTime())); connect(spinSubExpTime, SIGNAL(valueChanged(double)), this,
connect(comboSubExpTimeUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetSubExposureTime())); SLOT(SetSubExposureTime()));
connect(spinSubDeadTime,SIGNAL(valueChanged(double)), this, SLOT(SetSubDeadTime())); connect(comboSubExpTimeUnit, SIGNAL(currentIndexChanged(int)), this,
connect(comboSubDeadTimeUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetSubDeadTime())); SLOT(SetSubExposureTime()));
connect(spinSubDeadTime, SIGNAL(valueChanged(double)), this,
SLOT(SetSubDeadTime()));
connect(comboSubDeadTimeUnit, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetSubDeadTime()));
} }
} }
void qTabAdvanced::PopulateDetectors() { void qTabAdvanced::PopulateDetectors() {
FILE_LOG(logDEBUG) << "Populating detectors"; FILE_LOG(logDEBUG) << "Populating detectors";
disconnect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(SetDetector(int))); disconnect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetDetector(int)));
comboDetector->clear(); comboDetector->clear();
for (int i = 0; i < myDet->getNumberOfDetectors(); ++i) for (int i = 0; i < myDet->getNumberOfDetectors(); ++i)
comboDetector->addItem(QString(myDet->getHostname(i).c_str())); comboDetector->addItem(QString(myDet->getHostname(i).c_str()));
comboDetector->setCurrentIndex(0); comboDetector->setCurrentIndex(0);
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(SetDetector(int))); connect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetDetector(int)));
} }
void qTabAdvanced::GetOnline() { void qTabAdvanced::GetOnline() {
@ -152,78 +172,80 @@ void qTabAdvanced::GetOnline() {
} }
// display any other exception // display any other exception
catch (const std::exception &e) { catch (const std::exception &e) {
qDefs::ExceptionMessage("Could not get detector online status", e.what(), "qTabAdvanced::GetOnline"); qDefs::ExceptionMessage("Could not get detector online status",
e.what(), "qTabAdvanced::GetOnline");
} }
} }
void qTabAdvanced::GetControlPort() { void qTabAdvanced::GetControlPort() {
FILE_LOG(logDEBUG) << "Getting control port "; FILE_LOG(logDEBUG) << "Getting control port ";
disconnect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int))); disconnect(spinControlPort, SIGNAL(valueChanged(int)), this,
SLOT(SetControlPort(int)));
try { try {
int retval = myDet->setControlPort(-1, comboDetector->currentIndex()); int retval = myDet->setControlPort(-1, comboDetector->currentIndex());
spinControlPort->setValue(retval); spinControlPort->setValue(retval);
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get detector control port.", "qTabAdvanced::GetControlPort")
qDefs::ExceptionMessage("Could not get detector control port.", e.what(), "qTabAdvanced::GetControlPort");
}
connect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int))); connect(spinControlPort, SIGNAL(valueChanged(int)), this,
SLOT(SetControlPort(int)));
} }
void qTabAdvanced::GetStopPort() { void qTabAdvanced::GetStopPort() {
FILE_LOG(logDEBUG) << "Getting stop port"; FILE_LOG(logDEBUG) << "Getting stop port";
disconnect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); disconnect(spinStopPort, SIGNAL(valueChanged(int)), this,
SLOT(SetStopPort(int)));
try { try {
int retval = myDet->setStopPort(-1, comboDetector->currentIndex()); int retval = myDet->setStopPort(-1, comboDetector->currentIndex());
spinStopPort->setValue(retval); spinStopPort->setValue(retval);
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get detector stop port.", "qTabAdvanced::GetStopPort")
qDefs::ExceptionMessage("Could not get detector stop port.", e.what(), "qTabAdvanced::GetStopPort");
}
connect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); connect(spinStopPort, SIGNAL(valueChanged(int)), this,
SLOT(SetStopPort(int)));
} }
void qTabAdvanced::GetDetectorUDPIP() { void qTabAdvanced::GetDetectorUDPIP() {
FILE_LOG(logDEBUG) << "Getting Detector UDP IP"; FILE_LOG(logDEBUG) << "Getting Detector UDP IP";
disconnect(dispDetectorUDPIP, SIGNAL(editingFinished()), this, SLOT(SetDetectorUDPIP())); disconnect(dispDetectorUDPIP, SIGNAL(editingFinished()), this,
SLOT(SetDetectorUDPIP()));
try { try {
auto retval = myDet->getDetectorIP(comboDetector->currentIndex()); auto retval = myDet->getDetectorIP(comboDetector->currentIndex());
dispDetectorUDPIP->setText(QString(retval.c_str())); dispDetectorUDPIP->setText(QString(retval.c_str()));
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get detector UDP IP.", "qTabAdvanced::GetDetectorUDPIP")
qDefs::ExceptionMessage("Could not get detector UDP IP.", e.what(), "qTabAdvanced::GetDetectorUDPIP");
}
connect(dispDetectorUDPIP, SIGNAL(editingFinished()), this, SLOT(SetDetectorUDPIP())); connect(dispDetectorUDPIP, SIGNAL(editingFinished()), this,
SLOT(SetDetectorUDPIP()));
} }
void qTabAdvanced::GetDetectorUDPMAC() { void qTabAdvanced::GetDetectorUDPMAC() {
FILE_LOG(logDEBUG) << "Getting Detector UDP MAC"; FILE_LOG(logDEBUG) << "Getting Detector UDP MAC";
disconnect(dispDetectorUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetDetectorUDPMAC())); disconnect(dispDetectorUDPMAC, SIGNAL(editingFinished()), this,
SLOT(SetDetectorUDPMAC()));
try { try {
auto retval = myDet->getDetectorMAC(comboDetector->currentIndex()); auto retval = myDet->getDetectorMAC(comboDetector->currentIndex());
dispDetectorUDPMAC->setText(QString(retval.c_str())); dispDetectorUDPMAC->setText(QString(retval.c_str()));
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get detector UDP MAC.", "qTabAdvanced::GetDetectorUDPMAC")
qDefs::ExceptionMessage("Could not get detector UDP MAC.", e.what(), "qTabAdvanced::GetDetectorUDPMAC");
}
connect(dispDetectorUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetDetectorUDPMAC())); connect(dispDetectorUDPMAC, SIGNAL(editingFinished()), this,
SLOT(SetDetectorUDPMAC()));
} }
void qTabAdvanced::GetCltZMQPort() { void qTabAdvanced::GetCltZMQPort() {
FILE_LOG(logDEBUG) << "Getting Client ZMQ port"; FILE_LOG(logDEBUG) << "Getting Client ZMQ port";
disconnect(spinZMQPort, SIGNAL(valueChanged(int)), this, SLOT(SetCltZMQPort(int))); disconnect(spinZMQPort, SIGNAL(valueChanged(int)), this,
SLOT(SetCltZMQPort(int)));
try { try {
int retval = myDet->getClientStreamingPort(comboDetector->currentIndex()); int retval =
myDet->getClientStreamingPort(comboDetector->currentIndex());
spinZMQPort->setValue(retval); spinZMQPort->setValue(retval);
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get client zmq port.", "qTabAdvanced::GetCltZMQPort")
qDefs::ExceptionMessage("Could not get client zmq port.", e.what(), "qTabAdvanced::GetCltZMQPort");
}
connect(spinZMQPort, SIGNAL(valueChanged(int)), this, SLOT(SetCltZMQPort(int))); connect(spinZMQPort, SIGNAL(valueChanged(int)), this,
SLOT(SetCltZMQPort(int)));
} }
void qTabAdvanced::GetCltZMQIP() { void qTabAdvanced::GetCltZMQIP() {
@ -231,27 +253,26 @@ void qTabAdvanced::GetCltZMQIP() {
disconnect(dispZMQIP, SIGNAL(editingFinished()), this, SLOT(SetCltZMQIP())); disconnect(dispZMQIP, SIGNAL(editingFinished()), this, SLOT(SetCltZMQIP()));
try { try {
auto retval = myDet->getClientStreamingIP(comboDetector->currentIndex()); auto retval =
myDet->getClientStreamingIP(comboDetector->currentIndex());
dispZMQIP->setText(QString(retval.c_str())); dispZMQIP->setText(QString(retval.c_str()));
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get client zmq ip.", "qTabAdvanced::GetCltZMQIP")
qDefs::ExceptionMessage("Could not get client zmq ip.", e.what(), "qTabAdvanced::GetCltZMQIP");
}
connect(dispZMQIP, SIGNAL(editingFinished()), this, SLOT(SetCltZMQIP())); connect(dispZMQIP, SIGNAL(editingFinished()), this, SLOT(SetCltZMQIP()));
} }
void qTabAdvanced::GetRxrHostname() { void qTabAdvanced::GetRxrHostname() {
FILE_LOG(logDEBUG) << "Getting Receiver Hostname"; FILE_LOG(logDEBUG) << "Getting Receiver Hostname";
disconnect(dispRxrHostname, SIGNAL(editingFinished()), this, SLOT(SetRxrHostname())); disconnect(dispRxrHostname, SIGNAL(editingFinished()), this,
SLOT(SetRxrHostname()));
try { try {
auto retval = myDet->getReceiverHostname(comboDetector->currentIndex()); auto retval = myDet->getReceiverHostname(comboDetector->currentIndex());
dispRxrHostname->setText(QString(retval.c_str())); dispRxrHostname->setText(QString(retval.c_str()));
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get receiver hostname.", "qTabAdvanced::GetRxrHostname")
qDefs::ExceptionMessage("Could not get receiver hostname.", e.what(), "qTabAdvanced::GetRxrHostname");
}
connect(dispRxrHostname, SIGNAL(editingFinished()), this, SLOT(SetRxrHostname())); connect(dispRxrHostname, SIGNAL(editingFinished()), this,
SLOT(SetRxrHostname()));
} }
void qTabAdvanced::GetReceiverOnline() { void qTabAdvanced::GetReceiverOnline() {
@ -286,96 +307,98 @@ void qTabAdvanced::GetReceiverOnline() {
} }
// display any other exception // display any other exception
catch (const std::exception &e) { catch (const std::exception &e) {
qDefs::ExceptionMessage("Could not check receiver online status", e.what(), "qTabAdvanced::GetReceiverOnline"); qDefs::ExceptionMessage("Could not check receiver online status",
e.what(), "qTabAdvanced::GetReceiverOnline");
} }
} }
void qTabAdvanced::GetRxrTCPPort() { void qTabAdvanced::GetRxrTCPPort() {
FILE_LOG(logDEBUG) << "Getting Receiver TCP port"; FILE_LOG(logDEBUG) << "Getting Receiver TCP port";
disconnect(spinRxrTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); disconnect(spinRxrTCPPort, SIGNAL(valueChanged(int)), this,
SLOT(SetRxrTCPPort(int)));
try { try {
int retval = myDet->getReceiverPort(comboDetector->currentIndex()); int retval = myDet->getReceiverPort(comboDetector->currentIndex());
spinRxrTCPPort->setValue(retval); spinRxrTCPPort->setValue(retval);
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get receiver tcp port.", "qTabAdvanced::GetRxrTCPPort")
qDefs::ExceptionMessage("Could not get receiver tcp port.", e.what(), "qTabAdvanced::GetRxrTCPPort");
}
connect(spinRxrTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); connect(spinRxrTCPPort, SIGNAL(valueChanged(int)), this,
SLOT(SetRxrTCPPort(int)));
} }
void qTabAdvanced::GetRxrUDPPort() { void qTabAdvanced::GetRxrUDPPort() {
FILE_LOG(logDEBUG) << "Getting Receiver UDP port"; FILE_LOG(logDEBUG) << "Getting Receiver UDP port";
disconnect(spinRxrUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int))); disconnect(spinRxrUDPPort, SIGNAL(valueChanged(int)), this,
SLOT(SetRxrUDPPort(int)));
try { try {
int retval = myDet->getReceiverUDPPort(comboDetector->currentIndex()); int retval = myDet->getReceiverUDPPort(comboDetector->currentIndex());
spinRxrUDPPort->setValue(retval); spinRxrUDPPort->setValue(retval);
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get receiver udp port.", "qTabAdvanced::GetRxrUDPPort")
qDefs::ExceptionMessage("Could not get receiver udp port.", e.what(), "qTabAdvanced::GetRxrUDPPort");
}
connect(spinRxrUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int))); connect(spinRxrUDPPort, SIGNAL(valueChanged(int)), this,
SLOT(SetRxrUDPPort(int)));
} }
void qTabAdvanced::GetRxrUDPIP() { void qTabAdvanced::GetRxrUDPIP() {
FILE_LOG(logDEBUG) << "Getting Receiver UDP IP"; FILE_LOG(logDEBUG) << "Getting Receiver UDP IP";
disconnect(dispRxrUDPIP, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPIP())); disconnect(dispRxrUDPIP, SIGNAL(editingFinished()), this,
SLOT(SetRxrUDPIP()));
try { try {
auto retval = myDet->getReceiverUDPIP(comboDetector->currentIndex()); auto retval = myDet->getReceiverUDPIP(comboDetector->currentIndex());
dispRxrUDPIP->setText(QString(retval.c_str())); dispRxrUDPIP->setText(QString(retval.c_str()));
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get receiver udp ip.", "qTabAdvanced::GetRxrUDPIP")
qDefs::ExceptionMessage("Could not get receiver udp ip.", e.what(), "qTabAdvanced::GetRxrUDPIP");
}
connect(dispRxrUDPIP, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPIP())); connect(dispRxrUDPIP, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPIP()));
} }
void qTabAdvanced::GetRxrUDPMAC() { void qTabAdvanced::GetRxrUDPMAC() {
FILE_LOG(logDEBUG) << "Getting Receiver UDP MAC"; FILE_LOG(logDEBUG) << "Getting Receiver UDP MAC";
disconnect(dispRxrUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPMAC())); disconnect(dispRxrUDPMAC, SIGNAL(editingFinished()), this,
SLOT(SetRxrUDPMAC()));
try { try {
auto retval = myDet->getReceiverUDPMAC(comboDetector->currentIndex()); auto retval = myDet->getReceiverUDPMAC(comboDetector->currentIndex());
dispRxrUDPMAC->setText(QString(retval.c_str())); dispRxrUDPMAC->setText(QString(retval.c_str()));
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get receiver udp mac.", "qTabAdvanced::GetRxrUDPMAC")
qDefs::ExceptionMessage("Could not get receiver udp mac.", e.what(), "qTabAdvanced::GetRxrUDPMAC");
}
connect(dispRxrUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPMAC())); connect(dispRxrUDPMAC, SIGNAL(editingFinished()), this,
SLOT(SetRxrUDPMAC()));
} }
void qTabAdvanced::GetRxrZMQPort() { void qTabAdvanced::GetRxrZMQPort() {
FILE_LOG(logDEBUG) << "Getting Receiver ZMQ port"; FILE_LOG(logDEBUG) << "Getting Receiver ZMQ port";
disconnect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrZMQPort(int))); disconnect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this,
SLOT(SetRxrZMQPort(int)));
try { try {
int retval = myDet->getReceiverStreamingPort(comboDetector->currentIndex()); int retval =
myDet->getReceiverStreamingPort(comboDetector->currentIndex());
spinRxrZMQPort->setValue(retval); spinRxrZMQPort->setValue(retval);
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get receiver zmq port.", "qTabAdvanced::GetRxrZMQPort")
qDefs::ExceptionMessage("Could not get receiver zmq port.", e.what(), "qTabAdvanced::GetRxrZMQPort");
}
connect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrZMQPort(int))); connect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this,
SLOT(SetRxrZMQPort(int)));
} }
void qTabAdvanced::GetRxrZMQIP() { void qTabAdvanced::GetRxrZMQIP() {
FILE_LOG(logDEBUG) << "Getting Receiver ZMQ IP"; FILE_LOG(logDEBUG) << "Getting Receiver ZMQ IP";
disconnect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP())); disconnect(dispRxrZMQIP, SIGNAL(editingFinished()), this,
SLOT(SetRxrZMQIP()));
try { try {
auto retval = myDet->getReceiverStreamingIP(comboDetector->currentIndex()); auto retval =
myDet->getReceiverStreamingIP(comboDetector->currentIndex());
dispRxrZMQIP->setText(QString(retval.c_str())); dispRxrZMQIP->setText(QString(retval.c_str()));
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get receiver zmq ip.", "qTabAdvanced::GetRxrZMQIP")
qDefs::ExceptionMessage("Could not get receiver zmq ip.", e.what(), "qTabAdvanced::GetRxrZMQIP");
}
connect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP())); connect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP()));
} }
void qTabAdvanced::SetDetector(int index) { void qTabAdvanced::SetDetector(int index) {
FILE_LOG(logDEBUG) << "Set Detector: " << comboDetector->currentText().toAscii().data(); FILE_LOG(logDEBUG) << "Set Detector: "
<< comboDetector->currentText().toAscii().data();
GetOnline(); GetOnline();
GetControlPort(); GetControlPort();
@ -400,20 +423,16 @@ void qTabAdvanced::SetControlPort(int port) {
FILE_LOG(logINFO) << "Setting Control Port:" << port; FILE_LOG(logINFO) << "Setting Control Port:" << port;
try { try {
myDet->setControlPort(port, comboDetector->currentIndex()); myDet->setControlPort(port, comboDetector->currentIndex());
} catch (const sls::RuntimeError &e) { } CATCH_HANDLE("Could not set control port.", "qTabAdvanced::SetControlPort",
qDefs::ExceptionMessage("Could not set control port.", e.what(), "qTabAdvanced::SetControlPort"); this, &qTabAdvanced::GetControlPort)
GetControlPort();
}
} }
void qTabAdvanced::SetStopPort(int port) { void qTabAdvanced::SetStopPort(int port) {
FILE_LOG(logINFO) << "Setting Stop Port:" << port; FILE_LOG(logINFO) << "Setting Stop Port:" << port;
try { try {
myDet->setStopPort(port, comboDetector->currentIndex()); myDet->setStopPort(port, comboDetector->currentIndex());
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE ("Could not set stop port.", "qTabAdvanced::SetStopPort", this,
qDefs::ExceptionMessage("Could not set stop port.", e.what(), "qTabAdvanced::SetStopPort"); &qTabAdvanced::GetStopPort)
GetStopPort();
}
} }
void qTabAdvanced::SetDetectorUDPIP() { void qTabAdvanced::SetDetectorUDPIP() {
@ -421,32 +440,29 @@ void qTabAdvanced::SetDetectorUDPIP() {
FILE_LOG(logINFO) << "Setting Detector UDP IP:" << s; FILE_LOG(logINFO) << "Setting Detector UDP IP:" << s;
try { try {
myDet->setDetectorIP(s, comboDetector->currentIndex()); myDet->setDetectorIP(s, comboDetector->currentIndex());
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE ("Could not set Detector UDP IP.",
qDefs::ExceptionMessage("Could not set Detector UDP IP.", e.what(), "qTabAdvanced::SetDetectorUDPIP"); "qTabAdvanced::SetDetectorUDPIP", this,
GetDetectorUDPIP(); &qTabAdvanced::GetDetectorUDPIP)
} }
}
void qTabAdvanced::SetDetectorUDPMAC() { void qTabAdvanced::SetDetectorUDPMAC() {
std::string s = dispDetectorUDPMAC->text().toAscii().constData(); std::string s = dispDetectorUDPMAC->text().toAscii().constData();
FILE_LOG(logINFO) << "Setting Detector UDP MAC:" << s; FILE_LOG(logINFO) << "Setting Detector UDP MAC:" << s;
try { try {
myDet->setDetectorMAC(s, comboDetector->currentIndex()); myDet->setDetectorMAC(s, comboDetector->currentIndex());
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE ("Could not set Detector UDP MAC.",
qDefs::ExceptionMessage("Could not set Detector UDP MAC.", e.what(), "qTabAdvanced::SetDetectorUDPMAC"); "qTabAdvanced::SetDetectorUDPMAC", this,
GetDetectorUDPMAC(); &qTabAdvanced::GetDetectorUDPMAC)
}
} }
void qTabAdvanced::SetCltZMQPort(int port) { void qTabAdvanced::SetCltZMQPort(int port) {
FILE_LOG(logINFO) << "Setting Client ZMQ Port:" << port; FILE_LOG(logINFO) << "Setting Client ZMQ Port:" << port;
try { try {
myDet->setClientDataStreamingInPort(port, comboDetector->currentIndex()); myDet->setClientDataStreamingInPort(port,
} catch (const sls::NonCriticalError &e) { comboDetector->currentIndex());
qDefs::ExceptionMessage("Could not set Client ZMQ port.", e.what(), "qTabAdvanced::SetCltZMQPort"); } CATCH_HANDLE ("Could not set Client ZMQ port.",
GetCltZMQPort(); "qTabAdvanced::SetCltZMQPort", this,
} &qTabAdvanced::GetCltZMQPort)
} }
void qTabAdvanced::SetCltZMQIP() { void qTabAdvanced::SetCltZMQIP() {
@ -454,10 +470,9 @@ void qTabAdvanced::SetCltZMQIP() {
FILE_LOG(logINFO) << "Setting Client ZMQ IP:" << s; FILE_LOG(logINFO) << "Setting Client ZMQ IP:" << s;
try { try {
myDet->setClientDataStreamingInIP(s, comboDetector->currentIndex()); myDet->setClientDataStreamingInIP(s, comboDetector->currentIndex());
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE ("Could not set Client ZMQ IP.",
qDefs::ExceptionMessage("Could not set Client ZMQ IP.", e.what(), "qTabAdvanced::SetCltZMQIP"); "qTabAdvanced::SetCltZMQIP", this,
GetCltZMQIP(); &qTabAdvanced::GetCltZMQIP)
}
} }
void qTabAdvanced::SetRxrHostname() { void qTabAdvanced::SetRxrHostname() {
@ -465,10 +480,9 @@ void qTabAdvanced::SetRxrHostname() {
FILE_LOG(logINFO) << "Setting Receiver Hostname:" << s; FILE_LOG(logINFO) << "Setting Receiver Hostname:" << s;
try { try {
myDet->setReceiverHostname(s, comboDetector->currentIndex()); myDet->setReceiverHostname(s, comboDetector->currentIndex());
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE ("Could not set Client ZMQ IP.",
qDefs::ExceptionMessage("Could not set Client ZMQ IP.", e.what(), "qTabAdvanced::SetRxrHostname"); "qTabAdvanced::SetRxrHostname", this,
GetRxrHostname(); &qTabAdvanced::GetRxrHostname)
}
// update all network widgets (receiver mainly) // update all network widgets (receiver mainly)
SetDetector(comboDetector->currentIndex()); SetDetector(comboDetector->currentIndex());
@ -478,21 +492,18 @@ void qTabAdvanced::SetRxrTCPPort(int port) {
FILE_LOG(logINFO) << "Setting Receiver TCP Port:" << port; FILE_LOG(logINFO) << "Setting Receiver TCP Port:" << port;
try { try {
myDet->setReceiverPort(port, comboDetector->currentIndex()); myDet->setReceiverPort(port, comboDetector->currentIndex());
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE ("Could not set Receiver TCP port.",
qDefs::ExceptionMessage("Could not set Receiver TCP port.", e.what(), "qTabAdvanced::SetRxrTCPPort"); "qTabAdvanced::SetRxrTCPPort", this,
GetRxrTCPPort(); &qTabAdvanced::GetRxrTCPPort)
} }
}
void qTabAdvanced::SetRxrUDPPort(int port) { void qTabAdvanced::SetRxrUDPPort(int port) {
FILE_LOG(logINFO) << "Setting Receiver UDP Port:" << port; FILE_LOG(logINFO) << "Setting Receiver UDP Port:" << port;
try { try {
myDet->setReceiverUDPPort(port, comboDetector->currentIndex()); myDet->setReceiverUDPPort(port, comboDetector->currentIndex());
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE ("Could not set Receiver UDP port.",
qDefs::ExceptionMessage("Could not set Receiver UDP port.", e.what(), "qTabAdvanced::SetRxrUDPPort"); "qTabAdvanced::SetRxrUDPPort", this,
GetRxrUDPPort(); &qTabAdvanced::GetRxrUDPPort)
}
} }
void qTabAdvanced::SetRxrUDPIP() { void qTabAdvanced::SetRxrUDPIP() {
@ -500,32 +511,29 @@ void qTabAdvanced::SetRxrUDPIP() {
FILE_LOG(logINFO) << "Setting Receiver UDP IP:" << s; FILE_LOG(logINFO) << "Setting Receiver UDP IP:" << s;
try { try {
myDet->setReceiverUDPIP(s, comboDetector->currentIndex()); myDet->setReceiverUDPIP(s, comboDetector->currentIndex());
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE ("Could not set Receiver UDP IP.",
qDefs::ExceptionMessage("Could not set Receiver UDP IP.", e.what(), "qTabAdvanced::SetRxrUDPIP"); "qTabAdvanced::SetRxrUDPIP", this,
GetRxrUDPIP(); &qTabAdvanced::GetRxrUDPIP)
} }
}
void qTabAdvanced::SetRxrUDPMAC() { void qTabAdvanced::SetRxrUDPMAC() {
std::string s = dispRxrUDPMAC->text().toAscii().constData(); std::string s = dispRxrUDPMAC->text().toAscii().constData();
FILE_LOG(logINFO) << "Setting Receiver UDP MAC:" << s; FILE_LOG(logINFO) << "Setting Receiver UDP MAC:" << s;
try { try {
myDet->setReceiverUDPMAC(s, comboDetector->currentIndex()); myDet->setReceiverUDPMAC(s, comboDetector->currentIndex());
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE ("Could not set Receiver UDP MAC.",
qDefs::ExceptionMessage("Could not set Receiver UDP MAC.", e.what(), "qTabAdvanced::SetRxrUDPMAC"); "qTabAdvanced::SetRxrUDPMAC", this,
GetRxrUDPMAC(); &qTabAdvanced::GetRxrUDPMAC)
}
} }
void qTabAdvanced::SetRxrZMQPort(int port) { void qTabAdvanced::SetRxrZMQPort(int port) {
FILE_LOG(logINFO) << "Setting Receiver ZMQ Port:" << port; FILE_LOG(logINFO) << "Setting Receiver ZMQ Port:" << port;
try { try {
myDet->setReceiverDataStreamingOutPort(port, comboDetector->currentIndex()); myDet->setReceiverDataStreamingOutPort(port,
} catch (const sls::NonCriticalError &e) { comboDetector->currentIndex());
qDefs::ExceptionMessage("Could not set Receiver ZMQ port.", e.what(), "qTabAdvanced::SetRxrZMQPort"); } CATCH_HANDLE ("Could not set Receiver ZMQ port.",
GetRxrZMQPort(); "qTabAdvanced::SetRxrZMQPort", this,
} &qTabAdvanced::GetRxrZMQPort)
} }
void qTabAdvanced::SetRxrZMQIP() { void qTabAdvanced::SetRxrZMQIP() {
@ -533,10 +541,9 @@ void qTabAdvanced::SetRxrZMQIP(){
FILE_LOG(logINFO) << "Setting Receiver ZMQ IP:" << s; FILE_LOG(logINFO) << "Setting Receiver ZMQ IP:" << s;
try { try {
myDet->setReceiverDataStreamingOutIP(s, comboDetector->currentIndex()); myDet->setReceiverDataStreamingOutIP(s, comboDetector->currentIndex());
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE ("Could not set Receiver ZMQ IP.",
qDefs::ExceptionMessage("Could not set Receiver ZMQ IP.", e.what(), "qTabAdvanced::SetRxrZMQIP"); "qTabAdvanced::SetRxrZMQIP", this,
GetRxrZMQIP(); &qTabAdvanced::GetRxrZMQIP)
}
} }
void qTabAdvanced::AddROISlot() { void qTabAdvanced::AddROISlot() {
@ -595,13 +602,19 @@ void qTabAdvanced::AddROISlot() {
int nroi = (int)lblFromX.size(); int nroi = (int)lblFromX.size();
gridRoi->addWidget(lblFromX[nroi], nroi, 0, Qt::AlignTop); gridRoi->addWidget(lblFromX[nroi], nroi, 0, Qt::AlignTop);
gridRoi->addWidget(spinFromX[nroi], nroi, 1, Qt::AlignTop); gridRoi->addWidget(spinFromX[nroi], nroi, 1, Qt::AlignTop);
//FIXME: gridRoi->addItem(new QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed), nroi,2,Qt::AlignTop); // FIXME: gridRoi->addItem(new
// QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed),
// nroi,2,Qt::AlignTop);
gridRoi->addWidget(lblToX[nroi], nroi, 3, Qt::AlignTop); gridRoi->addWidget(lblToX[nroi], nroi, 3, Qt::AlignTop);
gridRoi->addWidget(spinToX[nroi], nroi, 4, Qt::AlignTop); gridRoi->addWidget(spinToX[nroi], nroi, 4, Qt::AlignTop);
//FIXME: gridRoi->addItem(new QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed), nroi,5,Qt::AlignTop); // FIXME: gridRoi->addItem(new
// QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed),
// nroi,5,Qt::AlignTop);
gridRoi->addWidget(lblFromY[nroi], nroi, 6, Qt::AlignTop); gridRoi->addWidget(lblFromY[nroi], nroi, 6, Qt::AlignTop);
gridRoi->addWidget(spinFromY[nroi], nroi, 7, Qt::AlignTop); gridRoi->addWidget(spinFromY[nroi], nroi, 7, Qt::AlignTop);
//FIXME: gridRoi->addItem(new QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed), nroi,8,Qt::AlignTop); // FIXME: gridRoi->addItem(new
// QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed),
// nroi,8,Qt::AlignTop);
gridRoi->addWidget(lblToY[nroi], nroi, 9, Qt::AlignTop); gridRoi->addWidget(lblToY[nroi], nroi, 9, Qt::AlignTop);
gridRoi->addWidget(spinToY[nroi], nroi, 10, Qt::AlignTop); gridRoi->addWidget(spinToY[nroi], nroi, 10, Qt::AlignTop);
@ -635,9 +648,7 @@ void qTabAdvanced::GetROI(){
FILE_LOG(logDEBUG) << "ROIs populated: " << nroi; FILE_LOG(logDEBUG) << "ROIs populated: " << nroi;
} }
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get ROI.", "qTabAdvanced::GetROI")
qDefs::ExceptionMessage("Could not get ROI.", e.what(), "qTabAdvanced::GetROI");
}
} }
void qTabAdvanced::ClearROIWidgets() { void qTabAdvanced::ClearROIWidgets() {
@ -675,9 +686,11 @@ void qTabAdvanced::ClearROIWidgets() {
void qTabAdvanced::ClearROI() { void qTabAdvanced::ClearROI() {
FILE_LOG(logINFO) << "Clearing ROI"; FILE_LOG(logINFO) << "Clearing ROI";
if (QMessageBox::warning(this, "Clear ROI", if (QMessageBox::warning(
this, "Clear ROI",
"Are you sure you want to clear all the ROI in detector?", "Are you sure you want to clear all the ROI in detector?",
QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes){ QMessageBox::Yes | QMessageBox::No,
QMessageBox::No) == QMessageBox::Yes) {
ClearROIWidgets(); ClearROIWidgets();
SetROI(); SetROI();
@ -700,9 +713,8 @@ void qTabAdvanced::SetROI() {
FILE_LOG(logINFO) << "Setting ROI:" << nroi; FILE_LOG(logINFO) << "Setting ROI:" << nroi;
try { try {
myDet->setROI(nroi, roi, -1); myDet->setROI(nroi, roi, -1);
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not set these ROIs.",
qDefs::ExceptionMessage("Could not set these ROIs.", e.what(), "qTabAdvanced::SetROI"); "qTabAdvanced::SetROI")
}
// update corrected list // update corrected list
GetROI(); GetROI();
@ -710,16 +722,16 @@ void qTabAdvanced::SetROI() {
void qTabAdvanced::GetAllTrimbits() { void qTabAdvanced::GetAllTrimbits() {
FILE_LOG(logDEBUG) << "Getting all trimbits value"; FILE_LOG(logDEBUG) << "Getting all trimbits value";
disconnect(spinSetAllTrimbits, SIGNAL(editingFinished()), this, SLOT(SetAllTrimbits())); disconnect(spinSetAllTrimbits, SIGNAL(editingFinished()), this,
SLOT(SetAllTrimbits()));
try { try {
int retval = myDet->setAllTrimbits(-1); int retval = myDet->setAllTrimbits(-1);
spinSetAllTrimbits->setValue(retval); spinSetAllTrimbits->setValue(retval);
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get all trimbits.", "qTabAdvanced::GetAllTrimbits")
qDefs::ExceptionMessage("Could not get all trimbits.", e.what(), "qTabAdvanced::GetAllTrimbits");
}
connect(spinSetAllTrimbits, SIGNAL(editingFinished()), this, SLOT(SetAllTrimbits())); connect(spinSetAllTrimbits, SIGNAL(editingFinished()), this,
SLOT(SetAllTrimbits()));
} }
void qTabAdvanced::SetAllTrimbits() { void qTabAdvanced::SetAllTrimbits() {
@ -728,45 +740,51 @@ void qTabAdvanced::SetAllTrimbits() {
try { try {
myDet->setAllTrimbits(value); myDet->setAllTrimbits(value);
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE("Could not set all trimbits.", "qTabAdvanced::SetAllTrimbits",
qDefs::ExceptionMessage("Could not set all trimbits.", e.what(), "qTabAdvanced::SetAllTrimbits"); this, &qTabAdvanced::GetAllTrimbits)
GetAllTrimbits();
}
} }
void qTabAdvanced::GetNumStoragecells() { void qTabAdvanced::GetNumStoragecells() {
FILE_LOG(logDEBUG) << "Getting number of additional storage cells"; FILE_LOG(logDEBUG) << "Getting number of additional storage cells";
disconnect(spinNumStoragecells, SIGNAL(valueChanged(int)), this, SLOT(SetNumStoragecells(int))); disconnect(spinNumStoragecells, SIGNAL(valueChanged(int)), this,
SLOT(SetNumStoragecells(int)));
try { try {
auto retval = myDet->setTimer(slsDetectorDefs::STORAGE_CELL_NUMBER); auto retval = myDet->setTimer(slsDetectorDefs::STORAGE_CELL_NUMBER);
spinNumStoragecells->setValue(retval); spinNumStoragecells->setValue(retval);
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY (
qDefs::ExceptionMessage("Could not get number of additional storage cells.", e.what(), "qTabAdvanced::GetNumStoragecells"); "Could not get number of additional storage cells.",
} "qTabAdvanced::GetNumStoragecells")
connect(spinNumStoragecells, SIGNAL(valueChanged(int)), this, SLOT(SetNumStoragecells(int))); connect(spinNumStoragecells, SIGNAL(valueChanged(int)), this,
SLOT(SetNumStoragecells(int)));
} }
void qTabAdvanced::SetNumStoragecells(int value) { void qTabAdvanced::SetNumStoragecells(int value) {
FILE_LOG(logINFO) << "Setting number of additional stoarge cells: " << value; FILE_LOG(logINFO) << "Setting number of additional stoarge cells: "
<< value;
try { try {
myDet->setTimer(slsDetectorDefs::STORAGE_CELL_NUMBER, value, -1); myDet->setTimer(slsDetectorDefs::STORAGE_CELL_NUMBER, value, -1);
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE (
qDefs::ExceptionMessage("Could not set number of additional storage cells.", e.what(), "qTabAdvanced::SetNumStoragecells"); "Could not set number of additional storage cells.",
GetNumStoragecells(); "qTabAdvanced::SetNumStoragecells", this,
} &qTabAdvanced::GetNumStoragecells)
} }
void qTabAdvanced::GetSubExposureTime() { void qTabAdvanced::GetSubExposureTime() {
FILE_LOG(logDEBUG) << "Getting sub exposure time"; FILE_LOG(logDEBUG) << "Getting sub exposure time";
disconnect(spinSubExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetSubExposureTime())); disconnect(spinSubExpTime, SIGNAL(valueChanged(double)), this,
disconnect(comboSubExpTimeUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSubExposureTime())); SLOT(SetSubExposureTime()));
disconnect(comboSubExpTimeUnit, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetSubExposureTime()));
try { try {
int64_t retval = myDet->setTimer(slsDetectorDefs::SUBFRAME_ACQUISITION_TIME); int64_t retval =
myDet->setTimer(slsDetectorDefs::SUBFRAME_ACQUISITION_TIME);
if (retval == -1) { if (retval == -1) {
qDefs::Message(qDefs::WARNING, "Subexptime is inconsistent for all detectors.", "qTabAdvanced::GetSubExposureTime"); qDefs::Message(qDefs::WARNING,
"Subexptime is inconsistent for all detectors.",
"qTabAdvanced::GetSubExposureTime");
spinSubExpTime->setValue(-1); spinSubExpTime->setValue(-1);
} else { } else {
double value = (double)(retval * (1E-9)); double value = (double)(retval * (1E-9));
@ -774,63 +792,81 @@ void qTabAdvanced::GetSubExposureTime() {
spinSubExpTime->setValue(time.first); spinSubExpTime->setValue(time.first);
comboSubExpTimeUnit->setCurrentIndex(static_cast<int>(time.second)); comboSubExpTimeUnit->setCurrentIndex(static_cast<int>(time.second));
} }
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get sub exposure time.",
qDefs::ExceptionMessage("Could not get sub exposure time.", e.what(), "qTabSettings::GetSubExposureTime"); "qTabSettings::GetSubExposureTime")
}
connect(spinSubExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetSubExposureTime())); connect(spinSubExpTime, SIGNAL(valueChanged(double)), this,
connect(comboSubExpTimeUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSubExposureTime())); SLOT(SetSubExposureTime()));
connect(comboSubExpTimeUnit, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetSubExposureTime()));
} }
void qTabAdvanced::SetSubExposureTime() { void qTabAdvanced::SetSubExposureTime() {
double timeNS = qDefs::getNSTime((qDefs::timeUnit)comboSubExpTimeUnit->currentIndex(), spinSubExpTime->value()); double timeNS =
FILE_LOG(logINFO) << "Setting sub frame acquisition time to " << timeNS << " ns" << qDefs::getNSTime((qDefs::timeUnit)comboSubExpTimeUnit->currentIndex(),
"/" << spinSubExpTime->value() << qDefs::getUnitString((qDefs::timeUnit)comboSubExpTimeUnit->currentIndex()); spinSubExpTime->value());
FILE_LOG(logINFO)
<< "Setting sub frame acquisition time to " << timeNS << " ns"
<< "/" << spinSubExpTime->value()
<< qDefs::getUnitString(
(qDefs::timeUnit)comboSubExpTimeUnit->currentIndex());
try { try {
myDet->setTimer(slsDetectorDefs::SUBFRAME_ACQUISITION_TIME, (int64_t)timeNS, -1); myDet->setTimer(slsDetectorDefs::SUBFRAME_ACQUISITION_TIME,
} catch (const sls::NonCriticalError &e) { (int64_t)timeNS, -1);
qDefs::ExceptionMessage("Could not set sub exposure time.", e.what(), "qTabAdvanced::SetSubExposureTime"); } CATCH_DISPLAY ("Could not set sub exposure time.",
} "qTabAdvanced::SetSubExposureTime")
GetSubExposureTime(); GetSubExposureTime();
} }
void qTabAdvanced::GetSubDeadTime() { void qTabAdvanced::GetSubDeadTime() {
FILE_LOG(logDEBUG) << "Getting sub dead time"; FILE_LOG(logDEBUG) << "Getting sub dead time";
disconnect(spinSubDeadTime, SIGNAL(valueChanged(double)), this, SLOT(SetSubDeadTime())); disconnect(spinSubDeadTime, SIGNAL(valueChanged(double)), this,
disconnect(comboSubDeadTimeUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSubDeadTime())); SLOT(SetSubDeadTime()));
disconnect(comboSubDeadTimeUnit, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetSubDeadTime()));
try { try {
int64_t retval = myDet->setTimer(slsDetectorDefs::SUBFRAME_DEADTIME); int64_t retval = myDet->setTimer(slsDetectorDefs::SUBFRAME_DEADTIME);
if (retval == -1) { if (retval == -1) {
qDefs::Message(qDefs::WARNING, "Sub dead time is inconsistent for all detectors.", "qTabAdvanced::GetSubDeadTime"); qDefs::Message(qDefs::WARNING,
"Sub dead time is inconsistent for all detectors.",
"qTabAdvanced::GetSubDeadTime");
spinSubDeadTime->setValue(-1); spinSubDeadTime->setValue(-1);
} else { } else {
double value = (double)(retval * (1E-9)); double value = (double)(retval * (1E-9));
auto time = qDefs::getCorrectTime(value); auto time = qDefs::getCorrectTime(value);
spinSubDeadTime->setValue(time.first); spinSubDeadTime->setValue(time.first);
comboSubDeadTimeUnit->setCurrentIndex(static_cast<int>(time.second)); comboSubDeadTimeUnit->setCurrentIndex(
} static_cast<int>(time.second));
} catch (const sls::NonCriticalError &e) {
qDefs::ExceptionMessage("Could not get sub dead time.", e.what(), "qTabSettings::GetSubDeadTime");
} }
} CATCH_DISPLAY ("Could not get sub dead time.",
"qTabSettings::GetSubDeadTime")
connect(spinSubDeadTime, SIGNAL(valueChanged(double)), this, SLOT(SetSubDeadTime())); connect(spinSubDeadTime, SIGNAL(valueChanged(double)), this,
connect(comboSubDeadTimeUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSubDeadTime())); SLOT(SetSubDeadTime()));
connect(comboSubDeadTimeUnit, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetSubDeadTime()));
} }
void qTabAdvanced::SetSubDeadTime() { void qTabAdvanced::SetSubDeadTime() {
double timeNS = qDefs::getNSTime((qDefs::timeUnit)comboSubDeadTimeUnit->currentIndex(), spinSubDeadTime->value()); double timeNS =
FILE_LOG(logINFO) << "Setting sub frame dead time to " << timeNS << " ns" << qDefs::getNSTime((qDefs::timeUnit)comboSubDeadTimeUnit->currentIndex(),
"/" << spinSubDeadTime->value() << qDefs::getUnitString((qDefs::timeUnit)comboSubDeadTimeUnit->currentIndex()); spinSubDeadTime->value());
FILE_LOG(logINFO)
<< "Setting sub frame dead time to " << timeNS << " ns"
<< "/" << spinSubDeadTime->value()
<< qDefs::getUnitString(
(qDefs::timeUnit)comboSubDeadTimeUnit->currentIndex());
try { try {
myDet->setTimer(slsDetectorDefs::SUBFRAME_DEADTIME, (int64_t)timeNS, -1); myDet->setTimer(slsDetectorDefs::SUBFRAME_DEADTIME, (int64_t)timeNS,
} catch (const sls::NonCriticalError &e) { -1);
qDefs::ExceptionMessage("Could not set sub dead time.", e.what(), "qTabAdvanced::SetSubDeadTime"); } CATCH_DISPLAY ("Could not set sub dead time.",
} "qTabAdvanced::SetSubDeadTime")
GetSubDeadTime(); GetSubDeadTime();
} }
void qTabAdvanced::Refresh() { void qTabAdvanced::Refresh() {
FILE_LOG(logDEBUG) << "**Updating Advanced Tab"; FILE_LOG(logDEBUG) << "**Updating Advanced Tab";

View File

@ -89,6 +89,7 @@ void qTabDataOutput::PopulateDetectors() {
void qTabDataOutput::EnableBrowse() { void qTabDataOutput::EnableBrowse() {
FILE_LOG(logDEBUG) << "Getting browse enable"; FILE_LOG(logDEBUG) << "Getting browse enable";
try { try {
btnOutputBrowse->setEnabled(false); // exception default
std::string receiverHostname = myDet->getReceiverHostname(comboDetector->currentIndex() - 1); std::string receiverHostname = myDet->getReceiverHostname(comboDetector->currentIndex() - 1);
if (receiverHostname == "localhost") { if (receiverHostname == "localhost") {
btnOutputBrowse->setEnabled(true); btnOutputBrowse->setEnabled(true);
@ -106,15 +107,13 @@ void qTabDataOutput::EnableBrowse() {
btnOutputBrowse->setEnabled(false); btnOutputBrowse->setEnabled(false);
} }
} }
} catch (const sls::RuntimeError &e) { } CATCH_DISPLAY ("Could not get receiver hostname.", "qTabDataOutput::EnableBrowse")
qDefs::ExceptionMessage("Could not get receiver hostname.", e.what(), "qTabDataOutput::EnableBrowse");
btnOutputBrowse->setEnabled(false);
}
} }
void qTabDataOutput::GetFileWrite() { void qTabDataOutput::GetFileWrite() {
FILE_LOG(logDEBUG) << "Getting file write enable"; FILE_LOG(logDEBUG) << "Getting file write enable";
try { try {
boxFileWriteEnabled->setEnabled(true); // exception default
int retval = myDet->getFileWrite(); int retval = myDet->getFileWrite();
if (retval == -1) { if (retval == -1) {
qDefs::Message(qDefs::WARNING, "File write is inconsistent for all detectors.", "qTabDataOutput::GetFileWrite"); qDefs::Message(qDefs::WARNING, "File write is inconsistent for all detectors.", "qTabDataOutput::GetFileWrite");
@ -122,10 +121,7 @@ void qTabDataOutput::GetFileWrite() {
} else { } else {
boxFileWriteEnabled->setEnabled(retval == 0 ? false : true); boxFileWriteEnabled->setEnabled(retval == 0 ? false : true);
} }
} catch (const sls::RuntimeError &e) { } CATCH_DISPLAY("Could not get file enable.", "qTabDataOutput::GetFileWrite")
qDefs::ExceptionMessage("Could not get file enable.", e.what(), "qTabDataOutput::GetFileWrite");
boxFileWriteEnabled->setEnabled(true);
}
} }
void qTabDataOutput::GetFileName() { void qTabDataOutput::GetFileName() {
@ -133,10 +129,7 @@ void qTabDataOutput::GetFileName() {
try { try {
auto retval = myDet->getFileName(); auto retval = myDet->getFileName();
dispFileName->setText(QString(retval.c_str())); dispFileName->setText(QString(retval.c_str()));
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get file name prefix.", "qTabDataOutput::GetFileName")
qDefs::ExceptionMessage("Could not get file name prefix.", e.what(), "qTabDataOutput::GetFileName");
}
} }
void qTabDataOutput::GetOutputDir() { void qTabDataOutput::GetOutputDir() {
@ -147,9 +140,7 @@ void qTabDataOutput::GetOutputDir() {
try { try {
std::string path = myDet->getFilePath(comboDetector->currentIndex() - 1); std::string path = myDet->getFilePath(comboDetector->currentIndex() - 1);
dispOutputDir->setText(QString(path.c_str())); dispOutputDir->setText(QString(path.c_str()));
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get file path.", "qTabDataOutput::GetOutputDir")
qDefs::ExceptionMessage("Could not get file path.", e.what(), "qTabDataOutput::GetOutputDir");
}
connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir())); connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir()));
} }
@ -180,10 +171,7 @@ void qTabDataOutput::SetOutputDir() {
std::string spath = std::string(path.toAscii().constData()); std::string spath = std::string(path.toAscii().constData());
try { try {
myDet->setFilePath(spath, comboDetector->currentIndex() - 1); myDet->setFilePath(spath, comboDetector->currentIndex() - 1);
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE ("Could not set output file path.", "qTabDataOutput::SetOutputDir", this, &qTabDataOutput::GetOutputDir)
qDefs::ExceptionMessage("Could not set output file path.", e.what(), "qTabDataOutput::SetOutputDir");
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"); qDefs::Message(qDefs::WARNING, std::string("Unknown file format: ") + std::to_string(static_cast<int>(retval)), "qTabDataOutput::GetFileFormat");
break; break;
} }
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY("Could not get file format.", "qTabDataOutput::GetFileFormat")
qDefs::ExceptionMessage("Could not get file format.", e.what(), "qTabDataOutput::GetFileFormat");
}
connect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int))); 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(); FILE_LOG(logINFO) << "Setting File Format to " << comboFileFormat->currentText().toAscii().data();
try { try {
myDet->setFileFormat((slsDetectorDefs::fileFormat)comboFileFormat->currentIndex()); myDet->setFileFormat((slsDetectorDefs::fileFormat)comboFileFormat->currentIndex());
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE ("Could not set file format.", "qTabDataOutput::SetFileFormat", this, &qTabDataOutput::GetFileFormat)
qDefs::ExceptionMessage("Could not set file format.", e.what(), "qTabDataOutput::SetFileFormat");
GetFileFormat();
}
} }
void qTabDataOutput::GetFileOverwrite() { void qTabDataOutput::GetFileOverwrite() {
@ -233,9 +216,7 @@ void qTabDataOutput::GetFileOverwrite() {
} else { } else {
chkOverwriteEnable->setChecked(retval == 0 ? false : true); chkOverwriteEnable->setChecked(retval == 0 ? false : true);
} }
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get file over write enable.", "qTabDataOutput::GetFileOverwrite")
qDefs::ExceptionMessage("Could not get file over write enable.", e.what(), "qTabDataOutput::GetFileOverwrite");
}
connect(chkOverwriteEnable, SIGNAL(toggled(bool)), this, SLOT(SetOverwriteEnable(bool))); connect(chkOverwriteEnable, SIGNAL(toggled(bool)), this, SLOT(SetOverwriteEnable(bool)));
} }
@ -245,10 +226,7 @@ void qTabDataOutput::SetOverwriteEnable(bool enable) {
try { try {
myDet->setFileOverWrite(enable); myDet->setFileOverWrite(enable);
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE ("Could not set file over write enable.", "qTabDataOutput::SetOverwriteEnable", this, &qTabDataOutput::GetFileOverwrite)
qDefs::ExceptionMessage("Could not set file over write enable.", e.what(), "qTabDataOutput::SetOverwriteEnable");
GetFileOverwrite();
}
} }
void qTabDataOutput::GetTenGigaEnable() { void qTabDataOutput::GetTenGigaEnable() {
@ -262,9 +240,7 @@ void qTabDataOutput::GetTenGigaEnable() {
} else { } else {
chkTenGiga->setChecked(retval == 0 ? false : true); chkTenGiga->setChecked(retval == 0 ? false : true);
} }
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get 10GbE enable.", "qTabDataOutput::GetTenGigaEnable")
qDefs::ExceptionMessage("Could not get 10GbE enable.", e.what(), "qTabDataOutput::GetTenGigaEnable");
}
connect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(SetTenGigaEnable(bool))); connect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(SetTenGigaEnable(bool)));
} }
@ -274,10 +250,7 @@ void qTabDataOutput::SetTenGigaEnable(bool enable) {
try { try {
myDet->enableTenGigabitEthernet(enable); myDet->enableTenGigabitEthernet(enable);
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE ("Could not set 10GbE enable.", "qTabDataOutput::SetTenGigaEnable", this, &qTabDataOutput::GetTenGigaEnable)
qDefs::ExceptionMessage("Could not set 10GbE enable.", e.what(), "qTabDataOutput::SetTenGigaEnable");
GetTenGigaEnable();
}
} }
void qTabDataOutput::GetRateCorrection() { void qTabDataOutput::GetRateCorrection() {
@ -296,9 +269,7 @@ void qTabDataOutput::GetRateCorrection() {
if (retval != 0) if (retval != 0)
spinCustomDeadTime->setValue(retval); spinCustomDeadTime->setValue(retval);
} }
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY("Could not get rate correction.", "qTabDataOutput::GetRateCorrection")
qDefs::ExceptionMessage("Could not get rate correction.", e.what(), "qTabDataOutput::GetRateCorrection");
}
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection())); connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection()));
connect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection())); connect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection()));
@ -315,10 +286,7 @@ void qTabDataOutput::EnableRateCorrection() {
// disable // disable
try { try {
myDet->setRateCorrection(0); myDet->setRateCorrection(0);
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE ("Could not switch off rate correction.", "qTabDataOutput::EnableRateCorrection", this, &qTabDataOutput::GetRateCorrection)
qDefs::ExceptionMessage("Could not switch off rate correction.", e.what(), "qTabDataOutput::EnableRateCorrection");
GetRateCorrection();
}
} }
void qTabDataOutput::SetRateCorrection() { void qTabDataOutput::SetRateCorrection() {
@ -335,10 +303,7 @@ void qTabDataOutput::SetRateCorrection() {
try { try {
myDet->setRateCorrection(deadtime); myDet->setRateCorrection(deadtime);
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE ("Could not set rate correction.", "qTabDataOutput::SetRateCorrection", this, &qTabDataOutput::GetRateCorrection)
qDefs::ExceptionMessage("Could not set rate correction.", e.what(), "qTabDataOutput::SetRateCorrection");
GetRateCorrection();
}
} }
void qTabDataOutput::GetSpeed() { void qTabDataOutput::GetSpeed() {
@ -360,9 +325,7 @@ void qTabDataOutput::GetSpeed() {
qDefs::Message(qDefs::WARNING, std::string("Unknown speed: ") + std::to_string(retval), "qTabDataOutput::GetFileFormat"); qDefs::Message(qDefs::WARNING, std::string("Unknown speed: ") + std::to_string(retval), "qTabDataOutput::GetFileFormat");
break; break;
} }
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get speed.", "qTabDataOutput::GetSpeed")
qDefs::ExceptionMessage("Could not get speed.", e.what(), "qTabDataOutput::GetSpeed");
}
connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed())); 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();; FILE_LOG(logINFO) << "Setting Speed to " << comboEigerClkDivider->currentText().toAscii().data();;
try { try {
myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER, speed); myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER, speed);
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE ("Could not set speed.", "qTabDataOutput::SetSpeed", this, &qTabDataOutput::GetSpeed)
qDefs::ExceptionMessage("Could not set speed.", e.what(), "qTabDataOutput::SetSpeed");
GetSpeed();
}
} }
void qTabDataOutput::GetFlags() { 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"); qDefs::Message(qDefs::WARNING, std::string("Unknown flag (Not Parallel or Non Parallel): ") + std::to_string(retval), "qTabDataOutput::GetFlags");
} }
} }
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get speed.", "qTabDataOutput::GetSpeed")
qDefs::ExceptionMessage("Could not get speed.", e.what(), "qTabDataOutput::GetSpeed");
}
connect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags())); connect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
connect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags())); connect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
@ -443,10 +401,7 @@ void qTabDataOutput::SetFlags() {
myDet->setReadOutFlags(flag1); myDet->setReadOutFlags(flag1);
FILE_LOG(logINFO) << "Setting Readout Flags to " << comboEigerFlags2->currentText().toAscii().data(); FILE_LOG(logINFO) << "Setting Readout Flags to " << comboEigerFlags2->currentText().toAscii().data();
myDet->setReadOutFlags(flag2); myDet->setReadOutFlags(flag2);
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE ("Could not set readout flags.", "qTabDataOutput::SetFlags", this, &qTabDataOutput::GetFlags)
qDefs::ExceptionMessage("Could not set readout flags.", e.what(), "qTabDataOutput::SetFlags");
GetFlags();
}
} }

View File

@ -66,9 +66,7 @@ void qTabDebugging::GetDetectorStatus() {
try { try {
std::string status = slsDetectorDefs::runStatusType(myDet->getRunStatus(comboDetector->currentIndex())); std::string status = slsDetectorDefs::runStatusType(myDet->getRunStatus(comboDetector->currentIndex()));
lblStatus->setText(QString(status.c_str()).toUpper()); lblStatus->setText(QString(status.c_str()).toUpper());
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get detector status.", "qTabDebugging::GetDetectorStatus")
qDefs::ExceptionMessage("Could not get detector status.", e.what(), "qTabDebugging::GetDetectorStatus");
}
} }
@ -167,9 +165,7 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item) {
lblDetectorFirmware->setText(QString(retval.c_str())); lblDetectorFirmware->setText(QString(retval.c_str()));
retval = std::string("0x") + std::to_string((unsigned long)myDet->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION, comboDetector->currentIndex())); retval = std::string("0x") + std::to_string((unsigned long)myDet->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION, comboDetector->currentIndex()));
lblDetectorSoftware->setText(QString(retval.c_str())); lblDetectorSoftware->setText(QString(retval.c_str()));
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get versions.", "qTabDebugging::SetParameters")
qDefs::ExceptionMessage("Could not get versions.", e.what(), "qTabDebugging::SetParameters");
}
} }
} }
@ -210,9 +206,7 @@ void qTabDebugging::TestDetector() {
//display message //display message
qDefs::Message(qDefs::INFORMATION, message.toAscii().constData(), "qTabDebugging::TestDetector"); qDefs::Message(qDefs::INFORMATION, message.toAscii().constData(), "qTabDebugging::TestDetector");
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not execute digital test.", "qTabDebugging::TestDetector")
qDefs::ExceptionMessage("Could not execute digital test.", e.what(), "qTabDebugging::TestDetector");
}
} }

View File

@ -28,12 +28,12 @@ qTabDeveloper::qTabDeveloper(QWidget *parent, multiSlsDetector *detector) :
} }
qTabDeveloper::~qTabDeveloper() { qTabDeveloper::~qTabDeveloper() {
for (int i = 0; i < lblDacs.size(); ++i) { for (size_t i = 0; i < lblDacs.size(); ++i) {
delete lblDacs[i]; delete lblDacs[i];
delete lblDacsmV[i]; delete lblDacsmV[i];
delete spinDacs[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 lblAdcs[i];
delete spinAdcs[i]; delete spinAdcs[i];
} }
@ -288,9 +288,7 @@ void qTabDeveloper::GetDac(int id) {
// mv // mv
retval = myDet->setDAC(-1, getSLSIndex(id), 1, comboDetector->currentIndex() - 1); retval = myDet->setDAC(-1, getSLSIndex(id), 1, comboDetector->currentIndex() - 1);
lblDacsmV[id]->setText(QString("%1mV").arg(retval -10)); lblDacsmV[id]->setText(QString("%1mV").arg(retval -10));
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY("Could not get dac.", "qTabDeveloper::GetDac")
qDefs::ExceptionMessage("Could not get dac.", e.what(), "qTabDeveloper::GetDac");
}
connect(spinDacs[id], SIGNAL(editingFinished(int)), this, SLOT(SetDac(int))); connect(spinDacs[id], SIGNAL(editingFinished(int)), this, SLOT(SetDac(int)));
} }
@ -309,9 +307,8 @@ void qTabDeveloper::SetDac(int id) {
try { try {
myDet->setDAC(val, getSLSIndex(id), 0, comboDetector->currentIndex() - 1); myDet->setDAC(val, getSLSIndex(id), 0, comboDetector->currentIndex() - 1);
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not set dac.", "qTabDeveloper::SetDac")
qDefs::ExceptionMessage("Could not set dac.", e.what(), "qTabDeveloper::SetDac");
}
// update mV anyway // update mV anyway
GetDac(id); GetDac(id);
} }
@ -331,9 +328,7 @@ void qTabDeveloper::GetAdcs() {
} }
spinAdcs[i]->setText(QString::number(retval, 'f', 2) + 0x00b0 + QString("C")); spinAdcs[i]->setText(QString::number(retval, 'f', 2) + 0x00b0 + QString("C"));
} }
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get adcs.", "qTabDeveloper::GetAdcs")
qDefs::ExceptionMessage("Could not get adcs.", e.what(), "qTabDeveloper::GetAdcs");
}
} }
} }
@ -390,10 +385,7 @@ void qTabDeveloper::GetHighVoltage() {
} }
} }
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get high voltage.", "qTabDeveloper::GetHighVoltage")
qDefs::ExceptionMessage("Could not get high voltage.", e.what(), "qTabDeveloper::GetHighVoltage");
}
if (comboHV == nullptr) { if (comboHV == nullptr) {
connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage())); connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
@ -408,10 +400,8 @@ void qTabDeveloper::SetHighVoltage() {
try { try {
myDet->setDAC(val, slsDetectorDefs::HIGH_VOLTAGE, 0, comboDetector->currentIndex() - 1); myDet->setDAC(val, slsDetectorDefs::HIGH_VOLTAGE, 0, comboDetector->currentIndex() - 1);
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE ("Could not set high voltage.", "qTabDeveloper::SetHighVoltage",
qDefs::ExceptionMessage("Could not set high voltage.", e.what(), "qTabDeveloper::SetHighVoltage"); this, &qTabDeveloper::GetHighVoltage)
GetHighVoltage();
}
} }
@ -467,7 +457,7 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index) {
case 22: case 22:
return slsDetectorDefs::TEMPERATURE_FPGA; return slsDetectorDefs::TEMPERATURE_FPGA;
default: 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; break;
case slsDetectorDefs::GOTTHARD: case slsDetectorDefs::GOTTHARD:
@ -493,7 +483,7 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index) {
case 9: case 9:
return slsDetectorDefs::TEMPERATURE_FPGA; return slsDetectorDefs::TEMPERATURE_FPGA;
default: 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; break;
@ -504,7 +494,7 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index) {
if (index == numDACWidgets) { if (index == numDACWidgets) {
return slsDetectorDefs::TEMPERATURE_ADC; return slsDetectorDefs::TEMPERATURE_ADC;
} else { } 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; break;
@ -512,7 +502,7 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index) {
if (index >= 0 && index < numDACWidgets) { if (index >= 0 && index < numDACWidgets) {
return (slsDetectorDefs::dacIndex)index; return (slsDetectorDefs::dacIndex)index;
} else { } 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; break;

View File

@ -222,9 +222,7 @@ void qTabMeasurement::GetTimingMode() {
qDefs::Message(qDefs::WARNING, std::string("Unknown timing mode: ")+ std::to_string(retval), "qTabMeasurement::GetTimingMode"); qDefs::Message(qDefs::WARNING, std::string("Unknown timing mode: ")+ std::to_string(retval), "qTabMeasurement::GetTimingMode");
break; break;
} }
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY("Could not get timing mode.", "qTabMeasurement::GetTimingMode")
qDefs::ExceptionMessage("Could not get timing mode.", e.what(), "qTabMeasurement::GetTimingMode");
}
disconnect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int))); disconnect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));
} }
@ -235,10 +233,7 @@ void qTabMeasurement::SetTimingMode(int val) {
try { try {
myDet->setExternalCommunicationMode(static_cast<slsDetectorDefs::externalCommunicationMode>(val)); myDet->setExternalCommunicationMode(static_cast<slsDetectorDefs::externalCommunicationMode>(val));
EnableWidgetsforTimingMode(); EnableWidgetsforTimingMode();
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE("Could not set timing mode.", "qTabMeasurement::SetTimingMode", this, &qTabMeasurement::GetTimingMode)
qDefs::ExceptionMessage("Could not set timing mode.", e.what(), "qTabMeasurement::SetTimingMode");
GetTimingMode();
}
} }
void qTabMeasurement::GetNumMeasurements() { void qTabMeasurement::GetNumMeasurements() {
@ -251,9 +246,7 @@ void qTabMeasurement::GetNumMeasurements() {
qDefs::Message(qDefs::WARNING, "Number of measurements is inconsistent for all detectors.", "qTabMeasurement::GetNumMeasurements"); qDefs::Message(qDefs::WARNING, "Number of measurements is inconsistent for all detectors.", "qTabMeasurement::GetNumMeasurements");
} }
spinNumMeasurements->setValue(retval); spinNumMeasurements->setValue(retval);
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get number of measurements.", "qTabMeasurement::GetNumMeasurements")
qDefs::ExceptionMessage("Could not get number of measurements.", e.what(), "qTabMeasurement::GetNumMeasurements");
}
connect(spinNumMeasurements, SIGNAL(valueChanged(int)), this, SLOT(SetNumMeasurements(int))); connect(spinNumMeasurements, SIGNAL(valueChanged(int)), this, SLOT(SetNumMeasurements(int)));
} }
@ -263,10 +256,7 @@ void qTabMeasurement::SetNumMeasurements(int val) {
try { try {
myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER, val); myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER, val);
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE("Could not set number of measurements.", "qTabMeasurement::SetNumMeasurements", this, &qTabMeasurement::GetNumMeasurements)
qDefs::ExceptionMessage("Could not set number of measurements.", e.what(), "qTabMeasurement::SetNumMeasurements");
GetNumMeasurements();
}
} }
void qTabMeasurement::GetNumFrames() { void qTabMeasurement::GetNumFrames() {
@ -279,9 +269,7 @@ void qTabMeasurement::GetNumFrames() {
qDefs::Message(qDefs::WARNING, "Number of frames is inconsistent for all detectors.", "qTabMeasurement::GetNumFrames"); qDefs::Message(qDefs::WARNING, "Number of frames is inconsistent for all detectors.", "qTabMeasurement::GetNumFrames");
} }
spinNumFrames->setValue(retval); spinNumFrames->setValue(retval);
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get number of frames.", "qTabMeasurement::GetNumFrames")
qDefs::ExceptionMessage("Could not get number of frames.", e.what(), "qTabMeasurement::GetNumFrames");
}
connect(spinNumFrames, SIGNAL(valueChanged(int)), this, SLOT(SetNumFrames(int))); connect(spinNumFrames, SIGNAL(valueChanged(int)), this, SLOT(SetNumFrames(int)));
} }
@ -291,10 +279,7 @@ void qTabMeasurement::SetNumFrames(int val) {
try { try {
myDet->setTimer(slsDetectorDefs::FRAME_NUMBER, val); myDet->setTimer(slsDetectorDefs::FRAME_NUMBER, val);
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE("Could not set number of frames.", "qTabMeasurement::SetNumFrames", this, &qTabMeasurement::GetNumFrames)
qDefs::ExceptionMessage("Could not set number of frames.", e.what(), "qTabMeasurement::SetNumFrames");
GetNumFrames();
}
} }
void qTabMeasurement::GetNumTriggers() { void qTabMeasurement::GetNumTriggers() {
@ -307,9 +292,7 @@ void qTabMeasurement::GetNumTriggers() {
qDefs::Message(qDefs::WARNING, "Number of triggers is inconsistent for all detectors.", "qTabMeasurement::GetNumTriggers"); qDefs::Message(qDefs::WARNING, "Number of triggers is inconsistent for all detectors.", "qTabMeasurement::GetNumTriggers");
} }
spinNumTriggers->setValue(retval); spinNumTriggers->setValue(retval);
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get number of frames.", "qTabMeasurement::GetNumTriggers")
qDefs::ExceptionMessage("Could not get number of frames.", e.what(), "qTabMeasurement::GetNumTriggers");
}
connect(spinNumTriggers, SIGNAL(valueChanged(int)), this, SLOT(SetNumTriggers(int))); connect(spinNumTriggers, SIGNAL(valueChanged(int)), this, SLOT(SetNumTriggers(int)));
} }
@ -319,10 +302,7 @@ void qTabMeasurement::SetNumTriggers(int val) {
try { try {
myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER, val); myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER, val);
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE("Could not set number of triggers.", "qTabMeasurement::SetNumTriggers", this, &qTabMeasurement::GetNumTriggers)
qDefs::ExceptionMessage("Could not set number of triggers.", e.what(), "qTabMeasurement::SetNumTriggers");
GetNumTriggers();
}
} }
void qTabMeasurement::GetNumSamples() { 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"); qDefs::Message(qDefs::WARNING, "Number of digital samples is inconsistent for all detectors.", "qTabMeasurement::GetNumSamples");
} }
spinNumSamples->setValue(retval); spinNumSamples->setValue(retval);
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get number of samples.", "qTabMeasurement::GetNumSamples")
qDefs::ExceptionMessage("Could not get number of samples.", e.what(), "qTabMeasurement::GetNumSamples");
}
connect(spinNumSamples, SIGNAL(valueChanged(int)), this, SLOT(SetNumSamples(int))); connect(spinNumSamples, SIGNAL(valueChanged(int)), this, SLOT(SetNumSamples(int)));
} }
@ -352,10 +330,7 @@ void qTabMeasurement::SetNumSamples(int val) {
try { try {
myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES, val); myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES, val);
myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES, val); myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES, val);
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE("Could not set number of samples.", "qTabMeasurement::SetNumSamples", this, &qTabMeasurement::GetNumSamples)
qDefs::ExceptionMessage("Could not set number of samples.", e.what(), "qTabMeasurement::SetNumSamples");
GetNumSamples();
}
} }
void qTabMeasurement::GetExposureTime() { void qTabMeasurement::GetExposureTime() {
@ -375,9 +350,7 @@ void qTabMeasurement::GetExposureTime() {
CheckAcqPeriodGreaterThanExp(); CheckAcqPeriodGreaterThanExp();
} }
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get exposure time.", "qTabMeasurement::GetExposureTime")
qDefs::ExceptionMessage("Could not get exposure time.", e.what(), "qTabMeasurement::GetExposureTime");
}
connect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime())); connect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime()));
connect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime())); connect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime()));
@ -392,10 +365,7 @@ void qTabMeasurement::SetExposureTime() {
double timeNS = qDefs::getNSTime(unit, val); double timeNS = qDefs::getNSTime(unit, val);
myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME, std::lround(timeNS)); myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME, std::lround(timeNS));
CheckAcqPeriodGreaterThanExp(); CheckAcqPeriodGreaterThanExp();
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE("Could not set exposure time.", "qTabMeasurement::SetExposureTime", this, &qTabMeasurement::GetExposureTime)
qDefs::ExceptionMessage("Could not set exposure time.", e.what(), "qTabMeasurement::SetExposureTime");
GetExposureTime();
}
} }
void qTabMeasurement::GetAcquisitionPeriod() { void qTabMeasurement::GetAcquisitionPeriod() {
@ -415,9 +385,7 @@ void qTabMeasurement::GetAcquisitionPeriod() {
CheckAcqPeriodGreaterThanExp(); CheckAcqPeriodGreaterThanExp();
} }
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get acquisition period.", "qTabMeasurement::GetAcquisitionPeriod")
qDefs::ExceptionMessage("Could not get acquisition period.", e.what(), "qTabMeasurement::GetAcquisitionPeriod");
}
connect(spinPeriod, SIGNAL(valueChanged(double)), this, SLOT(SetAcquisitionPeriod())); connect(spinPeriod, SIGNAL(valueChanged(double)), this, SLOT(SetAcquisitionPeriod()));
connect(comboPeriodUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetAcquisitionPeriod())); connect(comboPeriodUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetAcquisitionPeriod()));
@ -432,10 +400,7 @@ void qTabMeasurement::SetAcquisitionPeriod() {
double timeNS = qDefs::getNSTime(unit, val); double timeNS = qDefs::getNSTime(unit, val);
myDet->setTimer(slsDetectorDefs::FRAME_PERIOD, std::lround(timeNS)); myDet->setTimer(slsDetectorDefs::FRAME_PERIOD, std::lround(timeNS));
CheckAcqPeriodGreaterThanExp(); CheckAcqPeriodGreaterThanExp();
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE("Could not set acquisition period.", "qTabMeasurement::SetAcquisitionPeriod", this, &qTabMeasurement::GetAcquisitionPeriod)
qDefs::ExceptionMessage("Could not set acquisition period.", e.what(), "qTabMeasurement::SetAcquisitionPeriod");
GetAcquisitionPeriod();
}
} }
void qTabMeasurement::CheckAcqPeriodGreaterThanExp() { void qTabMeasurement::CheckAcqPeriodGreaterThanExp() {
@ -478,9 +443,7 @@ void qTabMeasurement::GetDelay() {
CheckAcqPeriodGreaterThanExp(); CheckAcqPeriodGreaterThanExp();
} }
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get delay.", "qTabMeasurement::GetDelay")
qDefs::ExceptionMessage("Could not get delay.", e.what(), "qTabMeasurement::GetDelay");
}
connect(spinDelay, SIGNAL(valueChanged(double)), this, SLOT(SetDelay())); connect(spinDelay, SIGNAL(valueChanged(double)), this, SLOT(SetDelay()));
connect(comboDelayUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetDelay())); connect(comboDelayUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetDelay()));
@ -495,10 +458,7 @@ void qTabMeasurement::SetDelay() {
double timeNS = qDefs::getNSTime(unit, val); double timeNS = qDefs::getNSTime(unit, val);
myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER, std::lround(timeNS)); myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER, std::lround(timeNS));
CheckAcqPeriodGreaterThanExp(); CheckAcqPeriodGreaterThanExp();
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE("Could not set delay.", "qTabMeasurement::SetDelay", this, &qTabMeasurement::GetDelay)
qDefs::ExceptionMessage("Could not set delay.", e.what(), "qTabMeasurement::SetDelay");
GetDelay();
}
} }
void qTabMeasurement::GetFileWrite() { void qTabMeasurement::GetFileWrite() {
@ -506,6 +466,7 @@ void qTabMeasurement::GetFileWrite() {
disconnect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool))); disconnect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool)));
try { try {
dispFileName->setEnabled(true); // default, even when exception
int retval = myDet->getFileWrite(); int retval = myDet->getFileWrite();
if (retval == -1) { if (retval == -1) {
qDefs::Message(qDefs::WARNING, "File write is inconsistent for all detectors.", "qTabMeasurement::GetFileWrite"); qDefs::Message(qDefs::WARNING, "File write is inconsistent for all detectors.", "qTabMeasurement::GetFileWrite");
@ -514,10 +475,7 @@ void qTabMeasurement::GetFileWrite() {
chkFile->setChecked(retval == 0 ? false : true); chkFile->setChecked(retval == 0 ? false : true);
dispFileName->setEnabled(chkFile->isChecked()); dispFileName->setEnabled(chkFile->isChecked());
} }
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get file over write enable.", "qTabMeasurement::GetFileWrite")
qDefs::ExceptionMessage("Could not get file over write enable.", e.what(), "qTabMeasurement::GetFileWrite");
dispFileName->setEnabled(true);
}
connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool))); connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool)));
} }
@ -528,10 +486,7 @@ void qTabMeasurement::SetFileWrite(bool val) {
try { try {
myDet->setFileWrite(val); myDet->setFileWrite(val);
dispFileName->setEnabled(chkFile->isChecked()); dispFileName->setEnabled(chkFile->isChecked());
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE("Could not set file write enable.", "qTabMeasurement::SetFileWrite", this, &qTabMeasurement::GetFileWrite)
qDefs::ExceptionMessage("Could not set file write enable.", e.what(), "qTabMeasurement::SetFileWrite");
GetFileWrite();
}
} }
void qTabMeasurement::GetFileName() { void qTabMeasurement::GetFileName() {
@ -541,9 +496,7 @@ void qTabMeasurement::GetFileName() {
try { try {
auto retval = myDet->getFileName(); auto retval = myDet->getFileName();
dispFileName->setText(QString(retval.c_str())); dispFileName->setText(QString(retval.c_str()));
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get file name prefix.", "qTabMeasurement::GetFileName")
qDefs::ExceptionMessage("Could not get file name prefix.", e.what(), "qTabMeasurement::GetFileName");
}
connect(dispFileName, SIGNAL(editingFinished()), this, SLOT(SetFileName())); connect(dispFileName, SIGNAL(editingFinished()), this, SLOT(SetFileName()));
} }
@ -553,10 +506,7 @@ void qTabMeasurement::SetFileName() {
FILE_LOG(logINFO) << "Setting File Name Prefix:" << val; FILE_LOG(logINFO) << "Setting File Name Prefix:" << val;
try { try {
myDet->setFileName(val); myDet->setFileName(val);
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE("Could not set file name prefix.", "qTabMeasurement::SetFileName", this, &qTabMeasurement::GetFileName)
qDefs::ExceptionMessage("Could not set file name prefix.", e.what(), "qTabMeasurement::SetFileName");
GetFileName();
}
} }
void qTabMeasurement::GetRunIndex() { void qTabMeasurement::GetRunIndex() {
@ -569,9 +519,7 @@ void qTabMeasurement::GetRunIndex() {
qDefs::Message(qDefs::WARNING, "Acquisition File Index is inconsistent for all detectors.", "qTabMeasurement::GetRunIndex"); qDefs::Message(qDefs::WARNING, "Acquisition File Index is inconsistent for all detectors.", "qTabMeasurement::GetRunIndex");
} }
spinIndex->setValue(retval); spinIndex->setValue(retval);
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get acquisition file index.", "qTabMeasurement::GetRunIndex")
qDefs::ExceptionMessage("Could not get acquisition file index.", e.what(), "qTabMeasurement::GetRunIndex");
}
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(SetRunIndex(int))); connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(SetRunIndex(int)));
} }
@ -581,10 +529,7 @@ void qTabMeasurement::SetRunIndex(int val) {
try { try {
myDet->setFileIndex(val); myDet->setFileIndex(val);
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE("Could not set acquisition file index.", "qTabMeasurement::SetRunIndex", this, &qTabMeasurement::GetRunIndex)
qDefs::ExceptionMessage("Could not set acquisition file index.", e.what(), "qTabMeasurement::SetRunIndex");
GetRunIndex();
}
} }
void qTabMeasurement::SetCurrentMeasurement(int val) { void qTabMeasurement::SetCurrentMeasurement(int val) {
@ -621,11 +566,10 @@ int qTabMeasurement::VerifyOutputDirectoryError() {
myDet->setFilePath(paths[det], det); 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() { void qTabMeasurement::StartAcquisition() {
@ -660,9 +604,7 @@ void qTabMeasurement::StopAcquisition() {
FILE_LOG(logINFORED) << "Stopping Acquisition"; FILE_LOG(logINFORED) << "Stopping Acquisition";
try{ try{
myDet->stopAcquisition(); myDet->stopAcquisition();
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY("Could not stop acquisition.", "qTabMeasurement::StopAcquisition")
qDefs::ExceptionMessage("Could not stop acquisition.", e.what(), "qTabMeasurement::StopAcquisition");
}
} }
void qTabMeasurement::UpdateFinished() { void qTabMeasurement::UpdateFinished() {

View File

@ -331,9 +331,7 @@ void qTabPlot::GetGapPixels() {
} else { } else {
chkGapPixels->setChecked(retval == 0 ? false : true); chkGapPixels->setChecked(retval == 0 ? false : true);
} }
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get gap pixels enable.", "qTabPlot::GetGapPixels")
qDefs::ExceptionMessage("Could not get gap pixels enable.", e.what(), "qTabPlot::GetGapPixels");
}
connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool))); connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
} }
@ -343,10 +341,7 @@ void qTabPlot::SetGapPixels(bool enable) {
try { try {
myDet->enableGapPixels(enable); myDet->enableGapPixels(enable);
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE("Could not set gap pixels enable.", "qTabPlot::SetGapPixels", this, &qTabPlot::GetGapPixels)
qDefs::ExceptionMessage("Could not set gap pixels enable.", e.what(), "qTabPlot::SetGapPixels");
GetGapPixels();
}
} }
void qTabPlot::SetTitles() { void qTabPlot::SetTitles() {
@ -643,9 +638,7 @@ void qTabPlot::GetStreamingFrequency() {
spinTimeGap->setValue(time.first); spinTimeGap->setValue(time.first);
comboTimeGapUnit->setCurrentIndex(static_cast<int>(time.second)); comboTimeGapUnit->setCurrentIndex(static_cast<int>(time.second));
} }
} catch(const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get streaming timer.", "qTabPlot::GetStreamingFrequency")
qDefs::ExceptionMessage("Could not get streaming timer.", e.what(), "qTabPlot::GetStreamingFrequency");
}
} }
// every nth frame // every nth frame
else { else {
@ -653,9 +646,7 @@ void qTabPlot::GetStreamingFrequency() {
stackedLayout->setCurrentIndex(1); stackedLayout->setCurrentIndex(1);
spinNthFrame->setValue(freq); spinNthFrame->setValue(freq);
} }
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get streaming frequency.", "qTabPlot::GetStreamingFrequency")
qDefs::ExceptionMessage("Could not get streaming frequency.", e.what(), "qTabPlot::GetStreamingFrequency");
}
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency())); connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
connect(comboTimeGapUnit, 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); double timeMS = qDefs::getMSTime(timeUnit, timeVal);
myDet->setReceiverStreamingTimer(timeMS); myDet->setReceiverStreamingTimer(timeMS);
} }
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE("Could not set streaming frequency/ timer.", "qTabPlot::SetStreamingFrequency", this, &qTabPlot::GetStreamingFrequency)
qDefs::ExceptionMessage("Could not set streaming frequency/ timer.", e.what(), "qTabPlot::SetStreamingFrequency");
GetStreamingFrequency();
}
} }
void qTabPlot::Refresh() { void qTabPlot::Refresh() {

View File

@ -127,9 +127,7 @@ void qTabSettings::GetSettings() {
} }
break; break;
} }
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get settings.", "qTabSettings::GetSettings")
qDefs::ExceptionMessage("Could not get settings.", e.what(), "qTabSettings::GetSettings");
}
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSettings(int))); connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSettings(int)));
} }
@ -141,10 +139,7 @@ void qTabSettings::SetSettings(int index) {
try { try {
myDet->setSettings(val); myDet->setSettings(val);
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE ("Could not set settings.", "qTabSettings::SetSettings", this, &qTabSettings::GetSettings)
qDefs::ExceptionMessage("Could not set settings.", e.what(), "qTabSettings::SetSettings");
GetSettings();
}
// threshold // threshold
if (spinThreshold->isEnabled()) { 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"); qDefs::Message(qDefs::WARNING, std::string("Unknown dynamic range: ") + std::to_string(retval), "qTabSettings::GetDynamicRange");
break; break;
} }
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get dynamic range.", "qTabSettings::GetDynamicRange")
qDefs::ExceptionMessage("Could not get dynamic range.", e.what(), "qTabSettings::GetDynamicRange");
}
connect(comboDynamicRange, SIGNAL(activated(int)), this,SLOT(SetDynamicRange(int))); 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"); qDefs::Message(qDefs::WARNING, std::string("Unknown dynamic range: ") + std::to_string(index), "qTabSettings::SetDynamicRange");
break; break;
} }
} catch (const sls::NonCriticalError &e) { } CATCH_HANDLE ("Could not set dynamic range.", "qTabSettings::SetDynamicRange", this, &qTabSettings::GetDynamicRange)
qDefs::ExceptionMessage("Could not set dynamic range.", e.what(), "qTabSettings::SetDynamicRange");
GetDynamicRange();
}
} }
void qTabSettings::GetThresholdEnergy() { void qTabSettings::GetThresholdEnergy() {
@ -225,9 +215,7 @@ void qTabSettings::GetThresholdEnergy() {
} else { } else {
spinThreshold->setValue(retval); spinThreshold->setValue(retval);
} }
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get threshold energy.", "qTabDataOutput::GetThresholdEnergy")
qDefs::ExceptionMessage("Could not get threshold energy.", e.what(), "qTabDataOutput::GetThresholdEnergy");
}
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetThresholdEnergy())); 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"; FILE_LOG(logINFO) << "Setting Threshold Energy to " << index << " eV";
try { try {
myDet->setThresholdEnergy(index); myDet->setThresholdEnergy(index);
} catch (const sls::NonCriticalError &e) { } CATCH_DISPLAY ("Could not get threshold energy.", "qTabSettings::SetThresholdEnergy")
qDefs::ExceptionMessage("Could not get threshold energy.", e.what(), "qTabSettings::SetThresholdEnergy");
}
// set the right value anyway (due to tolerance) // set the right value anyway (due to tolerance)
GetThresholdEnergy(); GetThresholdEnergy();
} }