advanced down

This commit is contained in:
maliakal_d 2019-05-08 16:44:08 +02:00
parent 2a1c89f712
commit c30485a65b
18 changed files with 1766 additions and 1648 deletions

View File

@ -107,7 +107,7 @@ TEST_CASE("single EIGER detector no receiver basic set and get",
d.setOnline(true); d.setOnline(true);
CHECK(d.getOnlineFlag() == true); CHECK(d.getOnlineFlag() == true);
CHECK(d.getReceiverOnline() == false); CHECK(d.getReceiverOnlineFlag() == false);
CHECK(d.checkDetectorVersionCompatibility() == slsDetectorDefs::OK); CHECK(d.checkDetectorVersionCompatibility() == slsDetectorDefs::OK);
// Setting and reading exposure time // Setting and reading exposure time

View File

@ -1,14 +1,14 @@
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(ENV{QMAKESPEC} "/afs/psi.ch/intranet/Controls/Software/Trolltech/RHEL7-x86_64/Qt-4.8.2/mkspecs/linux-g++") #set(ENV{QMAKESPEC} "/afs/psi.ch/intranet/Controls/Software/Trolltech/RHEL7-x86_64/Qt-4.8.2/mkspecs/linux-g++")
set(ENV{PATH} "/afs/psi.ch/intranet/Controls/Software/Trolltech/RHEL7-x86_64/Qt-4.8.2/bin:$PATH") #set(ENV{PATH} "/afs/psi.ch/intranet/Controls/Software/Trolltech/RHEL7-x86_64/Qt-4.8.2/bin:$PATH")
link_directories( #link_directories(
/afs/psi.ch/intranet/Controls/Software/Trolltech/RHEL7-x86_64/Qt-4.8.2/lib # /afs/psi.ch/intranet/Controls/Software/Trolltech/RHEL7-x86_64/Qt-4.8.2/lib
/afs/psi.ch/intranet/Controls/Software/Trolltech/RHEL7-x86_64/qwt-6.0.1/lib # /afs/psi.ch/intranet/Controls/Software/Trolltech/RHEL7-x86_64/qwt-6.0.1/lib
/afs/psi.ch/intranet/Controls/Software/Trolltech/RHEL7-x86_64/qwtplot3d/lib # /afs/psi.ch/intranet/Controls/Software/Trolltech/RHEL7-x86_64/qwtplot3d/lib
/afs/psi.ch/project/sls_det_software/dhanya_softwareDevelopment/mySoft/slsDetectorPackage/build/bin # /afs/psi.ch/project/sls_det_software/dhanya_softwareDevelopment/mySoft/slsDetectorPackage/build/bin
) #)
set(SOURCES set(SOURCES
slsDetectorPlotting/src/SlsQt1DPlot.cxx slsDetectorPlotting/src/SlsQt1DPlot.cxx
@ -67,6 +67,7 @@ set(HEADERS
include/qTabMessages.h include/qTabMessages.h
../slsSupportLib/include/versionAPI.h ../slsSupportLib/include/versionAPI.h
include/qServer.h include/qServer.h
../slsDetectorSoftware/include
) )
set(RESOURCES set(RESOURCES
include/icons.qrc include/icons.qrc

File diff suppressed because it is too large Load Diff

View File

@ -43,6 +43,9 @@
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="lblDynamicRange"> <widget class="QLabel" name="lblDynamicRange">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text"> <property name="text">
<string>Dynamic Range:</string> <string>Dynamic Range:</string>
</property> </property>
@ -50,6 +53,9 @@
</item> </item>
<item row="0" column="2" colspan="2"> <item row="0" column="2" colspan="2">
<widget class="QComboBox" name="comboSettings"> <widget class="QComboBox" name="comboSettings">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -144,6 +150,9 @@
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="lblThreshold"> <widget class="QLabel" name="lblThreshold">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text"> <property name="text">
<string>Threshold:</string> <string>Threshold:</string>
</property> </property>
@ -167,6 +176,9 @@
</item> </item>
<item row="2" column="2" colspan="2"> <item row="2" column="2" colspan="2">
<widget class="QComboBox" name="comboDynamicRange"> <widget class="QComboBox" name="comboDynamicRange">
<property name="enabled">
<bool>false</bool>
</property>
<item> <item>
<property name="text"> <property name="text">
<string>1.67772e+07</string> <string>1.67772e+07</string>
@ -191,6 +203,9 @@
</item> </item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="lblSettings"> <widget class="QLabel" name="lblSettings">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text"> <property name="text">
<string>Settings:</string> <string>Settings:</string>
</property> </property>
@ -198,6 +213,9 @@
</item> </item>
<item row="1" column="2" colspan="2"> <item row="1" column="2" colspan="2">
<widget class="QSpinBox" name="spinThreshold"> <widget class="QSpinBox" name="spinThreshold">
<property name="enabled">
<bool>false</bool>
</property>
<property name="keyboardTracking"> <property name="keyboardTracking">
<bool>false</bool> <bool>false</bool>
</property> </property>

View File

@ -198,6 +198,15 @@ class qDefs : public QWidget {
return FAIL; return FAIL;
} }
/**
* Wrap exception message
*/
static int ExceptionMessage(std::string message,
std::string exceptionMessage,
std::string source) {
return Message(qDefs::WARNING, message + std::string("\nCaught exception:\n") + exceptionMessage, source);
}
/** /**
* Wrap around to ignore non critical exceptions * Wrap around to ignore non critical exceptions
*/ */
@ -205,22 +214,24 @@ class qDefs : public QWidget {
// only executing multiSlsDetector function // only executing multiSlsDetector function
template <typename RT, typename... CT> template <typename RT, typename... CT>
static void IgnoreNonCriticalExceptions(multiSlsDetector* det, const std::string loc, RT (multiSlsDetector::*somefunc)(CT...), static void IgnoreNonCriticalExceptions(multiSlsDetector* det,
const std::string message, const std::string source,
RT (multiSlsDetector::*somefunc)(CT...),
typename NonDeduced<CT>::type... Args) { typename NonDeduced<CT>::type... Args) {
try { try {
((det->*somefunc)(Args...)); ((det->*somefunc)(Args...));
} }
// catch them here as they are not critical // catch them here as they are not critical
catch (const sls::NonCriticalError &e) { catch (const sls::NonCriticalError &e) {
Message(qDefs::WARNING, e.what(), loc); ExceptionMessage(message, e.what(), source);
} }
}; };
// executing multiSlsDetector funtion and using return value to set QWidget function // executing multiSlsDetector funtion and using return value to set QWidget function
template <class W, typename WRT, typename RT, typename... CT> template <class W, typename WRT, typename RT, typename... CT>
static void IgnoreNonCriticalExceptions(W* wid, static void IgnoreNonCriticalExceptions(multiSlsDetector* det,
void (W::*someQfunc)(WRT), const std::string message, const std::string source,
multiSlsDetector* det, const std::string loc, W* wid, void (W::*someQfunc)(WRT),
RT (multiSlsDetector::*somefunc)(CT...), RT (multiSlsDetector::*somefunc)(CT...),
typename NonDeduced<CT>::type... Args) { typename NonDeduced<CT>::type... Args) {
try { try {
@ -229,12 +240,13 @@ class qDefs : public QWidget {
} }
// catch them here as they are not critical // catch them here as they are not critical
catch (const sls::NonCriticalError &e) { catch (const sls::NonCriticalError &e) {
Message(qDefs::WARNING, e.what(), loc); ExceptionMessage(message, e.what(), source);
} }
}; };
// executing multiSlsDetector funtion and returning its value (integers, where value cannot be -1) // executing multiSlsDetector funtion and returning its value (integers, where value cannot be -1)
/* can easily get out of hand
template <typename RT, typename... CT> template <typename RT, typename... CT>
static RT IgnoreNonCriticalExceptionsandReturn( static RT IgnoreNonCriticalExceptionsandReturn(
multiSlsDetector* det, const std::string loc, multiSlsDetector* det, const std::string loc,
@ -248,5 +260,5 @@ class qDefs : public QWidget {
Message(qDefs::WARNING, e.what(), loc); Message(qDefs::WARNING, e.what(), loc);
return static_cast<RT>(-1); return static_cast<RT>(-1);
} }
}; };*/
}; };

View File

@ -61,43 +61,39 @@ class qServer : public QWidget, public virtual slsDetectorDefs {
*/ */
void ServerThread(ServerSocket* sock); void ServerThread(ServerSocket* sock);
/**
* Thread of stop server
*/
void StopServer();
/** /**
* Get Detector Status * Get Detector Status
* @returns success of operation * @returns success of operation
*/ */
int GetStatus(); int GetStatus(ServerSocket* sock);
/** /**
* Starts Acquisition * Starts Acquisition
* @returns success of operation * @returns success of operation
*/ */
int StartAcquisition(); int StartAcquisition(ServerSocket* sock);
/** /**
* Stops Acquisition * Stops Acquisition
* @returns success of operation * @returns success of operation
*/ */
int StopsAcquisition(); int StopsAcquisition(ServerSocket* sock);
/** /**
* Acquire - blocking * Acquire - blocking
* @returns success of operation * @returns success of operation
*/ */
int Acquire(); int Acquire(ServerSocket* sock);
/** /**
* Exit Server * Exit Server
* @returns GOODBYE * @returns GOODBYE
*/ */
int ExitServer(); int ExitServer(ServerSocket* sock);
/** function list */ /** function list */
std::vector<int (*)()> flist; typedef int (qServer::*some_func_t)(ServerSocket*);
typedef std::vector<some_func_t> sflist;
/** if the gui server thread is running*/ /** if the gui server thread is running*/
bool threadRunning; bool threadRunning;

View File

@ -37,31 +37,14 @@ public slots:
*/ */
void Refresh(); void Refresh();
private:
/**
* Sets up the widget
*/
void SetupWidgetWindow();
/**
* Sets up all the slots and signals
*/
void Initialization();
/**
* Add ROI Input
* @param num number of inputs to add
*/
void AddROIInput(int num);
/**
* Update the setalltrimbits value from server
*/
void updateAllTrimbitsFromServer();
private slots: private slots:
/**
* Select Readout
* @param index position index of readout
*/
void SetDetector(int index);
/** /**
* Sets control port * Sets control port
* @param port control port * @param port control port
@ -74,6 +57,32 @@ private slots:
*/ */
void SetStopPort(int port); void SetStopPort(int port);
/**
* Sets detector udp ip
*/
void SetDetectorUDPIP();
/**
* Sets detector udp mac
*/
void SetDetectorUDPMAC();
/**
* Sets client zmq port
* @param port client zmq port
*/
void SetCltZMQPort(int port);
/**
* Sets client zmq ip to listen to
*/
void SetCltZMQIP();
/**
* Sets the receiver hostname
*/
void SetRxrHostname();
/** /**
* Sets receiver tcp port * Sets receiver tcp port
* @param port receiver tcp port * @param port receiver tcp port
@ -87,88 +96,54 @@ private slots:
void SetRxrUDPPort(int port); void SetRxrUDPPort(int port);
/** /**
* Sets client zmq receiver port * Sets receiver ip
* @param port client zmq receiver port
*/ */
void SetCltZmqPort(int port); void SetRxrUDPIP();
/** /**
* Sets receiver zmq transmitting port * Sets reciever mac
* @param port receiver zmq transmitting port
*/ */
void SetRxrZmqPort(int port); void SetRxrUDPMAC();
/** /**
* Sets receiver online * Sets receiver zmq port
* @param index 1 for online and 0 for offline * @param port receiver zmq port
*/ */
void SetReceiverOnline(int index); void SetRxrZMQPort(int port);
/**
* Sets detector online
* @param index 1 for online and 0 for offline
*/
void SetOnline(int index);
/**
* Sets network parameters like receiver udp ip,
* receiver udp mac, detector ip and detector mac
*/
void SetNetworkParameters();
/**
* Sets client zmq ip to listen to
*/
void SetClientZMQIP();
/** /**
* Sets receiver zmq ip to stream from * Sets receiver zmq ip to stream from
*/ */
void SetReceiverZMQIP(); void SetRxrZMQIP();
/** /**
* Sets the receiver. which also sets the receiver parameters * Add ROI
*/ */
void SetReceiver(); void AddROISlot();
/**
* Add ROI Input if the value changed in the last slot
*/
void AddROIInputSlot();
/**
* Clears all the ROI inputs
*/
void clearROI();
/** /**
* Gets ROIs from detector and updates it * Gets ROIs from detector and updates it
*/ */
void updateROIList(); void GetROI();
/**
* Sets ROI in detector
*/
void setROI();
/** /**
* Clears ROI in detector * Clears ROI in detector
*/ */
void clearROIinDetector(); void ClearROI();
/** /**
* Select Readout * Sets ROI in detector
* @param index position index of readout
*/ */
void SetDetector(int index); void SetROI();
/** /**
* Set all trimbits to a value * Set all trimbits to a value
*/ */
void SetAllTrimbits(); void SetAllTrimbits();
/** /**
* Set storage cells * Set number of additional storage cells
* @param value value to set to * @param value value to set to
*/ */
void SetNumStoragecells(int value); void SetNumStoragecells(int value);
@ -186,12 +161,125 @@ private slots:
private: private:
/**
* Sets up the widget
*/
void SetupWidgetWindow();
/**
* Sets up all the slots and signals
*/
void Initialization();
/**
* Populate detectors
*/
void PopulateDetectors();
/**
* Gets detector online
*/
void GetOnline();
/**
* Gets control port
*/
void GetControlPort();
/**
* Gets stop port
*/
void GetStopPort();
/**
* Gets detector udp ip
*/
void GetDetectorUDPIP();
/**
* Gets detector udp mac
*/
void GetDetectorUDPMAC();
/**
* Gets client zmq receiver port
*/
void GetCltZMQPort();
/**
* Gets client zmq ip to listen to
*/
void GetCltZMQIP();
/**
* Gets receiver hostname
*/
void GetRxrHostname();
/**
* Sets receiver online
*/
void GetReceiverOnline();
/**
* Gets receiver tcp port
*/
void GetRxrTCPPort();
/**
* Gets receiver udp port
*/
void GetRxrUDPPort();
/**
* Gets receiver udp ip
*/
void GetRxrUDPIP();
/**
* Gets receiver udp mac
*/
void GetRxrUDPMAC();
/**
* Gets receiver zmq transmitting port
*/
void GetRxrZMQPort();
/**
* Gets receiver zmq transmitting ip
*/
void GetRxrZMQIP();
/**
* Clears all the ROI widgets
*/
void ClearROIWidgets();
/**
* Get all trimbits
*/
void GetAllTrimbits();
/**
* Get number of additional storage cells
*/
void GetNumStoragecells();
/**
* Get sub frame exposure time
*/
void GetSubExposureTime();
/**
* Get sub frame dead time
*/
void GetSubDeadTime();
/** The multi detector object */ /** The multi detector object */
multiSlsDetector *myDet; multiSlsDetector *myDet;
/** detector type */
slsDetectorDefs::detectorType detType;
/** Tool Tip */ /** Tool Tip */
QString errOnlineTip; QString errOnlineTip;
QString detOnlineTip; QString detOnlineTip;
@ -207,8 +295,6 @@ private:
std::vector <QSpinBox*> spinToX; std::vector <QSpinBox*> spinToX;
std::vector <QLabel*> lblToY; std::vector <QLabel*> lblToY;
std::vector <QSpinBox*> spinToY; std::vector <QSpinBox*> spinToY;
int numRois;
}; };

View File

@ -77,13 +77,17 @@ private:
*/ */
void GetDynamicRange(); void GetDynamicRange();
/**
* Gets the threshold energy and update widget
*/
void GetThresholdEnergy();
/** The sls detector object */ /** The sls detector object */
multiSlsDetector *myDet; multiSlsDetector *myDet;
/** detector type */
slsDetectorDefs::detectorType detType;
enum{STANDARD, FAST, HIGHGAIN, DYNAMICGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN, LOWNOISE, enum{STANDARD, FAST, HIGHGAIN, DYNAMICGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN, LOWNOISE,
DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2, VERLOWGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2, VERLOWGAIN,
UNDEFINED, UNINITIALIZED, NUMSETTINGS}; UNDEFINED, UNINITIALIZED, NUMSETTINGS};
static const int THRESHOLD_TOLERANCE = 200;
}; };

View File

@ -276,6 +276,25 @@ void qDetectorMain::SetUpDetector(const std::string fName, int multiID) {
std::string title = std::string title =
"SLS Detector GUI : " + myDet->getDetectorTypeAsString() + " - " + "SLS Detector GUI : " + myDet->getDetectorTypeAsString() + " - " +
myDet->getHostname(); myDet->getHostname();
FILE_LOG(logINFO) << title;
setWindowTitle(QString(title.c_str()));
//FIXME: not needed anymore due to client creating socket each time
//myDet->setOnline(slsDetectorDefs::ONLINE_FLAG);
//myDet->setReceiverOnline(slsDetectorDefs::ONLINE_FLAG);
}
void qDetectorMain::Initialization() {
// Dockable Plot
connect(dockWidgetPlot, SIGNAL(topLevelChanged(bool)), this,SLOT(ResizeMainWindow(bool)));
// tabs
connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*)));
// Measurement tab
connect(tabMeasurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs()));
connect(tabMeasurement, SIGNAL(StopSignal()), myPlot,SLOT(StopAcquisition()));
connect(tabMeasurement, SIGNAL(CheckPlotIntervalSignal()), tabPlot,SLOT(SetFrequency()));
// Plot tab
connect(tab_plot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool)));
// Plotting // Plotting
// When the acquisition is finished, must update the meas tab // When the acquisition is finished, must update the meas tab
connect(myPlot, SIGNAL(UpdatingPlotFinished()), this, SLOT(EnableTabs())); connect(myPlot, SIGNAL(UpdatingPlotFinished()), this, SLOT(EnableTabs()));
@ -328,7 +347,9 @@ void qDetectorMain::LoadConfigFile(const std::string fName) {
"qDetectorMain::LoadConfigFile"); "qDetectorMain::LoadConfigFile");
FILE_LOG(logWARNING) << "File not recognized"; FILE_LOG(logWARNING) << "File not recognized";
} else { } else {
qDefs::IgnoreNonCriticalExceptions(myDet, "qDetectorMain::LoadConfigFile", qDefs::IgnoreNonCriticalExceptions(myDet,
"Could not load config file.",
"qDetectorMain::LoadConfigFile",
&multiSlsDetector::readConfigurationFile, fName); &multiSlsDetector::readConfigurationFile, fName);
} }
} }
@ -361,11 +382,6 @@ void qDetectorMain::EnableModes(QAction *action) {
enable = actionExpert->isChecked(); enable = actionExpert->isChecked();
tabs->setTabEnabled(ADVANCED, enable); tabs->setTabEnabled(ADVANCED, enable);
// moench don't have settings
if (detType != slsDetectorDefs::MOENCH) {
actionLoadTrimbits->setVisible(enable);
actionSaveTrimbits->setVisible(enable);
}
FILE_LOG(logINFO) << "Expert Mode: " FILE_LOG(logINFO) << "Expert Mode: "
<< slsDetectorDefs::stringEnable(enable); << slsDetectorDefs::stringEnable(enable);
} }
@ -546,8 +562,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
} }
} }
} catch (const sls::NonCriticalError &e) { } catch (const sls::NonCriticalError &e) {
qDefs::Message(qDefs::WARNING, e.what(), qDefs::ExceptionMessage("Could not execute utilities.", e.what(), "qDetectorMain::ExecuteUtilities");
"qDetectorMain::ExecuteUtilities");
} }
Refresh(tabs->currentIndex()); Refresh(tabs->currentIndex());
@ -570,22 +585,22 @@ void qDetectorMain::ExecuteHelp(QAction *action) {
FILE_LOG(logINFO) << "About Common GUI for Eiger, Gotthard, Jungfrau " FILE_LOG(logINFO) << "About Common GUI for Eiger, Gotthard, Jungfrau "
"and Moench detectors"; "and Moench detectors";
char version[200]; std::string guiVersion = std::to_string(APIGUI);
long long unsigned int retval = APIGUI; std::string clientVersion;
sprintf(version, "%llx", retval); try {
std::string thisGUIVersion{version}; clientVersion = std::to_string(myDet->getId(slsDetectorDefs::THIS_SOFTWARE_VERSION));
} catch (const sls::NonCriticalError &e) {
sprintf(version, "%lx", qDefs::ExceptionMessage("Could not get client version.", e.what(), "qDetectorMain::ExecuteHelp");
myDet->getId(slsDetectorDefs::THIS_SOFTWARE_VERSION)); clientVersion = "unknown";
std::string thisClientVersion{version}; }
qDefs::Message(qDefs::INFORMATION, qDefs::Message(qDefs::INFORMATION,
"<p style=\"font-family:verdana;\">" "<p style=\"font-family:verdana;\">"
"SLS Detector GUI version:&nbsp;&nbsp;&nbsp;" + "SLS Detector GUI version:&nbsp;&nbsp;&nbsp;" +
thisGUIVersion + guiVersion +
"<br>" "<br>"
"SLS Detector Client version: " + "SLS Detector Client version: " +
thisClientVersion + clientVersion +
"<br><br>" "<br><br>"
"Common GUI to control the SLS Detectors: " "Common GUI to control the SLS Detectors: "
"Eiger, Gotthard, Jungfrau and Moench.<br><br>" "Eiger, Gotthard, Jungfrau and Moench.<br><br>"
@ -701,8 +716,8 @@ void qDetectorMain::EnableTabs() {
// expert // expert
bool expertTab = enable && (actionExpert->isChecked()); bool expertTab = enable && (actionExpert->isChecked());
tabs->setTabEnabled(ADVANCED, expertTab); tabs->setTabEnabled(ADVANCED, expertTab);
actionLoadTrimbits->setVisible(expertTab); actionLoadTrimbits->setVisible(expertTab && detType != slsDetectorDefs::MOENCH);
actionSaveTrimbits->setVisible(expertTab); actionSaveTrimbits->setVisible(expertTab && detType != slsDetectorDefs::MOENCH);
// moved to here, so that its all in order, instead of signals and different // moved to here, so that its all in order, instead of signals and different
// threads // threads

View File

@ -19,11 +19,11 @@ qServer::qServer(qDetectorMain *t)
qServer::~qServer() {} qServer::~qServer() {}
void qServer::FunctionTable() { void qServer::FunctionTable() {
flist.push_back(qServer::GetStatus); sflist.push_back(&qServer::GetStatus);
flist.push_back(qServer::StartAcquisition); sflist.push_back(&qServer::StartAcquisition);
flist.push_back(qServer::StopsAcquisition); sflist.push_back(&qServer::StopsAcquisition);
flist.push_back(qServer::Acquire); sflist.push_back(&qServer::Acquire);
flist.push_back(qServer::ExitServer); sflist.push_back(&qServer::ExitServer);
} }
int qServer::DecodeFunction(ServerSocket *sock) { int qServer::DecodeFunction(ServerSocket *sock) {
@ -46,7 +46,7 @@ int qServer::DecodeFunction(ServerSocket *sock) {
// calling function // calling function
FILE_LOG(logDEBUG1) << "calling function fnum: " << fnum; FILE_LOG(logDEBUG1) << "calling function fnum: " << fnum;
ret = (this->*flist[fnum])(); ret = (this->*sflist[fnum])(sock);
return ret; return ret;
} }
@ -119,7 +119,7 @@ void qServer::ServerThread(ServerSocket* sock) {
emit ServerStoppedSignal(); emit ServerStoppedSignal();
} }
int qServer::GetStatus(ServerSock* sock) { int qServer::GetStatus(ServerSocket* sock) {
slsDetectorDefs::runStatus status = slsDetectorDefs::ERROR; slsDetectorDefs::runStatus status = slsDetectorDefs::ERROR;
int progress = 0; int progress = 0;
if (myMainTab->isPlotRunning()) if (myMainTab->isPlotRunning())
@ -135,7 +135,7 @@ int qServer::GetStatus(ServerSock* sock) {
return ret; return ret;
} }
int qServer::StartAcquisition(ServerSock* sock) { int qServer::StartAcquisition(ServerSocket* sock) {
char mess[MAX_STR_LENGTH] = {}; char mess[MAX_STR_LENGTH] = {};
sls::strcpy_safe(mess, "Could not start acquistion in Gui"); sls::strcpy_safe(mess, "Could not start acquistion in Gui");
int ret = myMainTab->StartStopAcquisitionFromClient(true); int ret = myMainTab->StartStopAcquisitionFromClient(true);
@ -143,7 +143,7 @@ int qServer::StartAcquisition(ServerSock* sock) {
return ret; return ret;
} }
int qServer::StopsAcquisition(ServerSock* sock) { int qServer::StopsAcquisition(ServerSocket* sock) {
char mess[MAX_STR_LENGTH] = {}; char mess[MAX_STR_LENGTH] = {};
sls::strcpy_safe(mess, "Could not stop acquistion in Gui"); sls::strcpy_safe(mess, "Could not stop acquistion in Gui");
int ret = myMainTab->StartStopAcquisitionFromClient(false); int ret = myMainTab->StartStopAcquisitionFromClient(false);
@ -151,7 +151,7 @@ int qServer::StopsAcquisition(ServerSock* sock) {
return ret; return ret;
} }
int qServer::Acquire(ServerSock* sock) { int qServer::Acquire(ServerSocket* sock) {
char mess[MAX_STR_LENGTH] = {}; char mess[MAX_STR_LENGTH] = {};
sls::strcpy_safe(mess, "Could not start blocking acquistion in Gui"); sls::strcpy_safe(mess, "Could not start blocking acquistion in Gui");
int ret = myMainTab->StartStopAcquisitionFromClient(true); int ret = myMainTab->StartStopAcquisitionFromClient(true);
@ -163,7 +163,7 @@ int qServer::Acquire(ServerSock* sock) {
return ret; return ret;
} }
int qServer::ExitServer(ServerSock* sock) { int qServer::ExitServer(ServerSocket* sock) {
DestroyServers(); DestroyServers();
int ret = qDefs::OK; int ret = qDefs::OK;
sock->SendResult(ret, nullptr, 0, mess); sock->SendResult(ret, nullptr, 0, mess);

File diff suppressed because it is too large Load Diff

View File

@ -22,9 +22,7 @@ qTabDebugging::qTabDebugging(QWidget *parent, multiSlsDetector *detector) : QWid
FILE_LOG(logDEBUG) << "Debugging ready"; FILE_LOG(logDEBUG) << "Debugging ready";
} }
qTabDebugging::~qTabDebugging() { qTabDebugging::~qTabDebugging() {}
delete myDet;
}
void qTabDebugging::SetupWidgetWindow() { void qTabDebugging::SetupWidgetWindow() {

View File

@ -35,10 +35,7 @@ qTabDeveloper::qTabDeveloper(QWidget *parent, multiSlsDetector *detector) : QWid
} }
qTabDeveloper::~qTabDeveloper() { qTabDeveloper::~qTabDeveloper() {}
if (myDet)
delete myDet;
}
void qTabDeveloper::SetupWidgetWindow() { void qTabDeveloper::SetupWidgetWindow() {
//Detector Type //Detector Type
@ -130,10 +127,11 @@ void qTabDeveloper::SetupWidgetWindow() {
break; break;
default: default:
FILE_LOG(logERROR) << "Unknown detector type: " + myDet->getDetectorTypeAsString(); std::string errorMess =
qDefs::Message(qDefs::CRITICAL, std::string("Unknown detector type:") + myDet->getDetectorTypeAsString(), "qTabDeveloper::SetupWidgetWindow"); myDet->getHostname() + std::string(" has ") +
exit(-1); myDet->getDetectorTypeAsString() + std::string(" detector type (") +
break; std::to_string(detType) + std::string("). Exiting GUI. (Source: qTabDeveloper::SetupWidgetWindow)");
throw sls::RuntimeError(errorMess.c_str());
} }
//layout //layout
@ -174,8 +172,6 @@ void qTabDeveloper::SetupWidgetWindow() {
CreateADCWidgets(); CreateADCWidgets();
layout->addWidget(boxAdcs, 2, 0); layout->addWidget(boxAdcs, 2, 0);
} }
qDefs::checkErrorMessage(myDet, "qTabDeveloper::SetupWidgetWindow");
} }

View File

@ -8,50 +8,51 @@
#include <iostream> #include <iostream>
qTabSettings::qTabSettings(QWidget *parent, multiSlsDetector *detector) qTabSettings::qTabSettings(QWidget *parent, multiSlsDetector *detector)
: QWidget(parent), myDet(detector), detType(slsDetectorDefs::GENERIC) { : QWidget(parent), myDet(detector) {
setupUi(this); setupUi(this);
SetupWidgetWindow(); SetupWidgetWindow();
Initialization();
FILE_LOG(logDEBUG) << "Settings ready"; FILE_LOG(logDEBUG) << "Settings ready";
} }
qTabSettings::~qTabSettings() {} qTabSettings::~qTabSettings() {}
void qTabSettings::SetupWidgetWindow() { void qTabSettings::SetupWidgetWindow() {
// Detector Type
detType = myDet->getDetectorTypeAsEnum(); switch(myDet->getDetectorTypeAsEnum()) {
case MOENCH:
lblSettings->setEnabled(false);
comboSettings->setEnabled(false);
break;
case EIGER:
lblDynamicRange->setEnabled(true);
comboDynamicRange->setEnabled(true);
lblThreshold->setEnabled(true);
spinThreshold->setEnabled(true);
break;
default:
break;
}
Initialization();
// Settings // Settings
comboSettings->setCurrentIndex(UNINITIALIZED); comboSettings->setCurrentIndex(UNINITIALIZED);
if (detType == slsDetectorDefs::MOENCH) { if (comboSettings->isEnabled()) {
lblSettings->setEnabled(false);
comboSettings->setEnabled(false);
} else {
SetupDetectorSettings(); SetupDetectorSettings();
GetSettings(); GetSettings();
} }
// Dynamic Range // Dynamic Range (update it anyway)
GetDynamicRange(); GetDynamicRange();
// cannot change dr for other types
if (detType != slsDetectorDefs::EIGER) {
lblDynamicRange->setEnabled(false);
comboDynamicRange->setEnabled(false);
}
// threshold energy // get threshold
if (detType == slsDetectorDefs::EIGER) { spinThreshold->setValue(-1);
qDefs::IgnoreNonCriticalExceptions<QSpinBox>( if (spinThreshold->isEnabled())
spinThreshold, GetThresholdEnergy();
&QSpinBox::setValue,
myDet,
std::string("qTabSettings::SetupWidgetWindow"),
&multiSlsDetector::getThresholdEnergy, -1);
} else {
lblThreshold->setEnabled(false);
spinThreshold->setEnabled(false);
}
} }
void qTabSettings::SetupDetectorSettings() { void qTabSettings::SetupDetectorSettings() {
@ -139,46 +140,61 @@ void qTabSettings::SetupDetectorSettings() {
void qTabSettings::Initialization() { void qTabSettings::Initialization() {
// Settings // Settings
if (comboSettings->isEnabled()) if (comboSettings->isEnabled())
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSettings(int)));
SLOT(SetSettings(int)));
// Dynamic Range // Dynamic Range
if (comboDynamicRange->isEnabled()) if (comboDynamicRange->isEnabled())
connect(comboDynamicRange, SIGNAL(activated(int)), this, connect(comboDynamicRange, SIGNAL(activated(int)), this, SLOT(SetDynamicRange(int)));
SLOT(SetDynamicRange(int)));
// Threshold // Threshold
if (spinThreshold->isEnabled()) if (spinThreshold->isEnabled())
connect(spinThreshold, SIGNAL(valueChanged(int)), this, connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));
SLOT(SetEnergy()));
} }
void qTabSettings::GetSettings() { void qTabSettings::GetSettings() {
FILE_LOG(logDEBUG) << "Getting settings"; FILE_LOG(logDEBUG) << "Getting settings";
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSettings(int)));
int sett = qDefs::IgnoreNonCriticalExceptionsandReturn( try{
myDet, std::string("qTabSettings::SetupWidgetWindow"), int sett = myDet->getSettings(-1);
&multiSlsDetector::getSettings, -1);
FILE_LOG(logDEBUG) << "Settings from Detector:" << sett; FILE_LOG(logDEBUG) << "Settings from Detector:" << sett;
switch (sett) {
if (sett == -1) case -1:
sett = UNDEFINED; qDefs::Message(qDefs::WARNING, "Different values for settings.", "qTabSettings::GetSettings");
if (sett == slsDetectorDefs::UNDEFINED) comboSettings->setCurrentIndex(UNDEFINED);
sett = UNDEFINED; break;
else if (sett == slsDetectorDefs::UNINITIALIZED) case slsDetectorDefs::UNDEFINED:
sett = UNINITIALIZED; comboSettings->setCurrentIndex(UNDEFINED);
break;
case slsDetectorDefs::UNINITIALIZED:
comboSettings->setCurrentIndex(UNINITIALIZED);
break;
default:
if (sett >= NUMSETTINGS) {
qDefs::Message(qDefs::WARNING, "Unknown settings " + std::to_string(sett) + ".", "qTabSettings::GetSettings");
return;
}
comboSettings->setCurrentIndex(sett); comboSettings->setCurrentIndex(sett);
break;
}
} catch (const sls::NonCriticalError &e) {
qDefs::ExceptionMessage("Could not get settings.", e.what(), "qTabSettings::GetSettings");
}
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSettings(int)));
} }
void qTabSettings::GetDynamicRange() { void qTabSettings::GetDynamicRange() {
FILE_LOG(logDEBUG) << "Getting dynamic range"; FILE_LOG(logDEBUG) << "Getting dynamic range";
disconnect(comboDynamicRange, SIGNAL(activated(int)), this, SLOT(SetDynamicRange(int)));
int ret = qDefs::IgnoreNonCriticalExceptionsandReturn( try {
myDet, std::string("qTabSettings::GetDynamicRange"), int ret = myDet->setDynamicRange(-1);
&multiSlsDetector::setDynamicRange, -1, -1);
// set the final value on gui // set the final value on gui
switch (ret) { switch (ret) {
case -1:
qDefs::Message(qDefs::WARNING, "Different values for dynamic range.", "qTabSettings::GetDynamicRange");
break;
case 32: case 32:
comboDynamicRange->setCurrentIndex(0); comboDynamicRange->setCurrentIndex(0);
break; break;
@ -192,31 +208,46 @@ void qTabSettings::GetDynamicRange() {
comboDynamicRange->setCurrentIndex(3); comboDynamicRange->setCurrentIndex(3);
break; break;
default: default:
if (ret != -1) { qDefs::Message(qDefs::WARNING, "Unknown Dynamic Range " + std::to_string(ret) + ".", "qTabSettings::GetDynamicRange");
qDefs::Message(qDefs::WARNING,
"Unknown Dyanmic Range " + std::to_string(ret) + ".",
"qTabSettings::SetupDetectorSettings");
}
break; break;
} }
} catch (const sls::NonCriticalError &e) {
qDefs::ExceptionMessage("Could not get dynamic range.", e.what(), "qTabSettings::GetDynamicRange");
}
connect(comboDynamicRange, SIGNAL(activated(int)), this,SLOT(SetDynamicRange(int)));
}
void qTabSettings::GetThresholdEnergy() {
FILE_LOG(logDEBUG) << "Getting theshold energy";
disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));
qDefs::IgnoreNonCriticalExceptions<QSpinBox>(
myDet,
"Could not get threshold energy."
"qTabSettings::GetThresholdEnergy",
spinThreshold,
&QSpinBox::setValue,
&multiSlsDetector::getThresholdEnergy, -1);
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));
} }
void qTabSettings::SetSettings(int index) { void qTabSettings::SetSettings(int index) {
slsDetectorDefs::detectorSettings sett = // settings
try {
myDet->setSettings((slsDetectorDefs::detectorSettings)index); myDet->setSettings((slsDetectorDefs::detectorSettings)index);
FILE_LOG(logINFO) << "Settings set to " FILE_LOG(logINFO) << "Settings set to " << myDet->slsDetectorDefs::getDetectorSettings(sett);
<< myDet->slsDetectorDefs::getDetectorSettings(sett); } catch (const sls::NonCriticalError &e) {
qDefs::ExceptionMessage("Could not set settings.", e.what(), "qTabSettings::SetSettings");
GetSettings();
}
// threshold // threshold
if (spinThreshold->isEnabled()) { if (spinThreshold->isEnabled()) {
SetEnergy(); SetEnergy();
} }
qDefs::checkErrorMessage(myDet, "qTabSettings::SetSettings");
} }
void qTabSettings::SetDynamicRange(int index) { void qTabSettings::SetDynamicRange(int index) {
int dr; int dr = -1;
switch (index) { switch (index) {
case 0: case 0:
dr = 32; dr = 32;
@ -231,41 +262,36 @@ void qTabSettings::SetDynamicRange(int index) {
dr = 4; dr = 4;
break; break;
default: default:
break; qDefs::Message(qDefs::WARNING, "Unknown dynamic range " + std::to_string(index) + ".", "qTabSettings::SetDynamicRange");
return;
} }
int ret = myDet->setDynamicRange(dr);
FILE_LOG(logINFO) << "Setting dynamic range to " << dr;
qDefs::checkErrorMessage(myDet, "qTabSettings::SetDynamicRange");
// check try {
if (ret != dr) { myDet->setDynamicRange(dr);
qDefs::Message(qDefs::WARNING, "Could not set dynamic range.", FILE_LOG(logINFO) << "Setting dynamic range to " << dr;
"qTabSettings::SetDynamicRange"); } catch (const sls::NonCriticalError &e) {
disconnect(comboDynamicRange, SIGNAL(activated(int)), this, qDefs::ExceptionMessage("Could not set dynamic range.", e.what(), "qTabSettings::SetDynamicRange");
SLOT(SetDynamicRange(int)));
GetDynamicRange(); GetDynamicRange();
connect(comboDynamicRange, SIGNAL(activated(int)), this,
SLOT(SetDynamicRange(int)));
} }
} }
void qTabSettings::SetEnergy() { void qTabSettings::SetEnergy() {
try {
// set
int index = spinThreshold->value(); int index = spinThreshold->value();
FILE_LOG(logINFO) << "Settings threshold energy to " << index; int ret = myDet->setThresholdEnergy(index);
FILE_LOG(logINFO) << "Threshold energy set to " << index;
myDet->setThresholdEnergy(index); // validate
int ret = myDet->getThresholdEnergy(); if ((ret - index) > THRESHOLD_TOLERANCE) {
if ((ret - index) > 200) {
qDefs::Message(qDefs::WARNING, qDefs::Message(qDefs::WARNING,
"Threshold energy could not be set (tolerance 200).", "Threshold energy could not be set (tolerance 200 eV).",
"qTabSettings::SetEnergy"); "qTabSettings::SetEnergy");
} }
disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, } catch (const sls::NonCriticalError &e) {
SLOT(SetEnergy())); qDefs::ExceptionMessage("Could not get threshold energy."), e.what(), "qTabSettings::SetEnergy");
spinThreshold->setValue(ret); }
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy())); // set the right value anyway (exception or no)
GetThresholdEnergy();
qDefs::checkErrorMessage(myDet, "qTabSettings::SetEnergy");
} }
void qTabSettings::Refresh() { void qTabSettings::Refresh() {
@ -273,32 +299,18 @@ void qTabSettings::Refresh() {
// settings // settings
if (comboSettings->isEnabled()) { if (comboSettings->isEnabled()) {
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetSettings(int)));
GetSettings(); GetSettings();
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetSettings(int)));
} }
// threshold // threshold
if (spinThreshold->isEnabled()) { if (spinThreshold->isEnabled()) {
disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, GetThresholdEnergy();
SLOT(SetEnergy()));
spinThreshold->setValue(myDet->getThresholdEnergy());
connect(spinThreshold, SIGNAL(valueChanged(int)), this,
SLOT(SetEnergy()));
} }
// Dynamic Range // Dynamic Range
if (comboDynamicRange->isEnabled()) { if (comboDynamicRange->isEnabled()) {
disconnect(comboDynamicRange, SIGNAL(activated(int)), this,
SLOT(SetDynamicRange(int)));
GetDynamicRange(); GetDynamicRange();
connect(comboDynamicRange, SIGNAL(activated(int)), this,
SLOT(SetDynamicRange(int)));
} }
FILE_LOG(logDEBUG) << "**Updated Settings Tab"; FILE_LOG(logDEBUG) << "**Updated Settings Tab";
qDefs::checkErrorMessage(myDet, "qTabSettings::Refresh");
} }

View File

@ -410,6 +410,12 @@ class multiSlsDetector : public virtual slsDetectorDefs {
*/ */
int setOnline(int value = GET_ONLINE_FLAG, int detPos = -1); int setOnline(int value = GET_ONLINE_FLAG, int detPos = -1);
/**
* Get detector online status
* @param detPos -1 for all detectors in list or specific detector position
*/
int getOnlineFlag(int detPos = -1);
/** /**
* Checks if each of the detectors are online/offline * Checks if each of the detectors are online/offline
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
@ -444,9 +450,10 @@ class multiSlsDetector : public virtual slsDetectorDefs {
/** /**
* Get Receiver port * Get Receiver port
* @param detPos -1 for all detectors in list or specific detector position
* @returns vector of receiver port * @returns vector of receiver port
*/ */
std::vector<int> getReceiverPort() const; int getReceiverPort(int detPos = -1) const;
/** /**
* Lock server for this client IP * Lock server for this client IP
@ -1613,6 +1620,12 @@ class multiSlsDetector : public virtual slsDetectorDefs {
*/ */
int setReceiverOnline(int value = GET_ONLINE_FLAG, int detPos = -1); int setReceiverOnline(int value = GET_ONLINE_FLAG, int detPos = -1);
/**
* Get receiver online status
* @param detPos -1 for all detectors in list or specific detector position
*/
int getReceiverOnlineFlag(int detPos = -1);
/** /**
* Checks if the receiver is really online * Checks if the receiver is really online
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position

View File

@ -1519,7 +1519,7 @@ class slsDetector : public virtual slsDetectorDefs{
*/ */
int setReceiverOnline(int value = GET_ONLINE_FLAG); int setReceiverOnline(int value = GET_ONLINE_FLAG);
int getReceiverOnline() const; int getReceiverOnlineFlag() const;
/** /**
* Checks if the receiver is really online * Checks if the receiver is really online

View File

@ -674,6 +674,15 @@ int multiSlsDetector::setOnline(int value, int detPos) {
return multi_shm()->onlineFlag; return multi_shm()->onlineFlag;
} }
int multiSlsDetector::getOnlineFlag(int detPos) {
if (detPos >= 0) {
return detectors[detPos]->getOnlineFlag();
}
auto r = serialCall(&slsDetector::getOnlineFlag);
return sls::minusOneIfDifferent(r);
}
std::string multiSlsDetector::checkOnline(int detPos) { std::string multiSlsDetector::checkOnline(int detPos) {
if (detPos >= 0) { if (detPos >= 0) {
return detectors[detPos]->checkOnline(); return detectors[detPos]->checkOnline();
@ -710,8 +719,13 @@ int multiSlsDetector::setReceiverPort(int port_number, int detPos) {
return sls::minusOneIfDifferent(r); return sls::minusOneIfDifferent(r);
} }
std::vector<int> multiSlsDetector::getReceiverPort() const { int multiSlsDetector::getReceiverPort(int detPos) const {
return parallelCall(&slsDetector::getReceiverPort); if (detPos >= 0) {
return detectors[detPos]->getReceiverPort();
}
auto r = serialCall(&slsDetector::getReceiverPort);
return sls::minusOneIfDifferent(r);
} }
int multiSlsDetector::lockServer(int p, int detPos) { int multiSlsDetector::lockServer(int p, int detPos) {
@ -2887,6 +2901,17 @@ int multiSlsDetector::setReceiverOnline(int value, int detPos) {
return multi_shm()->receiverOnlineFlag; return multi_shm()->receiverOnlineFlag;
} }
int multiSlsDetector::getReceiverOnlineFlag(int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->getReceiverOnlineFlag();
}
// multi
auto r = parallelCall(&slsDetector::getReceiverOnlineFlag);
return sls::minusOneIfDifferent(r);
}
std::string multiSlsDetector::checkReceiverOnline(int detPos) { std::string multiSlsDetector::checkReceiverOnline(int detPos) {
// single // single
if (detPos >= 0) { if (detPos >= 0) {

View File

@ -3270,7 +3270,7 @@ int slsDetector::setReceiverOnline(int value) {
return shm()->rxOnlineFlag; return shm()->rxOnlineFlag;
} }
int slsDetector::getReceiverOnline() const { return shm()->rxOnlineFlag; } int slsDetector::getReceiverOnlineFlag() const { return shm()->rxOnlineFlag; }
std::string slsDetector::checkReceiverOnline() { std::string slsDetector::checkReceiverOnline() {
try { try {