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

View File

@ -11,6 +11,9 @@
#include <stdint.h>
#include <string>
#define CATCH_DISPLAY(m, s) catch(...) { qDefs::DisplayExceptions(m, s); }
#define CATCH_HANDLE(...) catch(...) { qDefs::HandleExceptions(__VA_ARGS__); }
class qDefs : public QWidget {
public:
/**
@ -20,6 +23,35 @@ class qDefs : public QWidget {
#define GOODBYE -200
static void DisplayExceptions(std::string emsg, std::string src) {
try {
throw;
} catch (sls::SocketError) {
throw;
} catch (sls::SharedMemoryError) {
throw;
} catch (const std::exception &e) {
ExceptionMessage(emsg, e.what(), src);
}
}
template <class CT> struct NonDeduced { using type = CT; };
template <class S, typename RT, typename... CT>
static void HandleExceptions(const std::string emsg, const std::string src, S* s,
RT (S::*somefunc)(CT...),
typename NonDeduced<CT>::type... Args) {
try {
throw;
} catch (sls::SocketError) {
throw;
} catch (sls::SharedMemoryError) {
throw;
} catch (const std::exception &e) {
ExceptionMessage(emsg, e.what(), src);
(s->*somefunc)(Args...);
}
}
/** function enums */
enum qFuncNames {
QF_GET_DETECTOR_STATUS,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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