advanced down

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

View File

@ -198,6 +198,15 @@ class qDefs : public QWidget {
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
*/
@ -205,37 +214,40 @@ class qDefs : public QWidget {
// only executing multiSlsDetector function
template <typename RT, typename... CT>
static void IgnoreNonCriticalExceptions(multiSlsDetector* det, const std::string loc, RT (multiSlsDetector::*somefunc)(CT...),
typename NonDeduced<CT>::type... Args) {
static void IgnoreNonCriticalExceptions(multiSlsDetector* det,
const std::string message, const std::string source,
RT (multiSlsDetector::*somefunc)(CT...),
typename NonDeduced<CT>::type... Args) {
try {
((det->*somefunc)(Args...));
}
// catch them here as they are not critical
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
template <class W, typename WRT, typename RT, typename... CT>
static void IgnoreNonCriticalExceptions(W* wid,
void (W::*someQfunc)(WRT),
multiSlsDetector* det, const std::string loc,
RT (multiSlsDetector::*somefunc)(CT...),
typename NonDeduced<CT>::type... Args) {
static void IgnoreNonCriticalExceptions(multiSlsDetector* det,
const std::string message, const std::string source,
W* wid, void (W::*someQfunc)(WRT),
RT (multiSlsDetector::*somefunc)(CT...),
typename NonDeduced<CT>::type... Args) {
try {
auto val = ((det->*somefunc)(Args...));
(wid->*someQfunc)(static_cast<RT>(val));
}
// catch them here as they are not critical
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)
template <typename RT, typename... CT>
/* can easily get out of hand
template <typename RT, typename... CT>
static RT IgnoreNonCriticalExceptionsandReturn(
multiSlsDetector* det, const std::string loc,
RT (multiSlsDetector::*somefunc)(CT...),
@ -248,5 +260,5 @@ class qDefs : public QWidget {
Message(qDefs::WARNING, e.what(), loc);
return static_cast<RT>(-1);
}
};
};*/
};

View File

@ -61,43 +61,39 @@ class qServer : public QWidget, public virtual slsDetectorDefs {
*/
void ServerThread(ServerSocket* sock);
/**
* Thread of stop server
*/
void StopServer();
/**
* Get Detector Status
* @returns success of operation
*/
int GetStatus();
int GetStatus(ServerSocket* sock);
/**
* Starts Acquisition
* @returns success of operation
*/
int StartAcquisition();
int StartAcquisition(ServerSocket* sock);
/**
* Stops Acquisition
* @returns success of operation
*/
int StopsAcquisition();
int StopsAcquisition(ServerSocket* sock);
/**
* Acquire - blocking
* @returns success of operation
*/
int Acquire();
int Acquire(ServerSocket* sock);
/**
* Exit Server
* @returns GOODBYE
*/
int ExitServer();
int ExitServer(ServerSocket* sock);
/** 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*/
bool threadRunning;

View File

@ -37,31 +37,14 @@ public slots:
*/
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:
/**
* Select Readout
* @param index position index of readout
*/
void SetDetector(int index);
/**
* Sets control port
* @param port control port
@ -74,6 +57,32 @@ private slots:
*/
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
* @param port receiver tcp port
@ -87,88 +96,54 @@ private slots:
void SetRxrUDPPort(int port);
/**
* Sets client zmq receiver port
* @param port client zmq receiver port
* Sets receiver ip
*/
void SetCltZmqPort(int port);
void SetRxrUDPIP();
/**
* Sets receiver zmq transmitting port
* @param port receiver zmq transmitting port
* Sets reciever mac
*/
void SetRxrZmqPort(int port);
void SetRxrUDPMAC();
/**
* Sets receiver online
* @param index 1 for online and 0 for offline
* Sets receiver zmq port
* @param port receiver zmq port
*/
void SetReceiverOnline(int index);
/**
* 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();
void SetRxrZMQPort(int port);
/**
* Sets receiver zmq ip to stream from
*/
void SetReceiverZMQIP();
void SetRxrZMQIP();
/**
* Sets the receiver. which also sets the receiver parameters
* Add ROI
*/
void SetReceiver();
/**
* Add ROI Input if the value changed in the last slot
*/
void AddROIInputSlot();
/**
* Clears all the ROI inputs
*/
void clearROI();
void AddROISlot();
/**
* Gets ROIs from detector and updates it
*/
void updateROIList();
/**
* Sets ROI in detector
*/
void setROI();
void GetROI();
/**
* Clears ROI in detector
*/
void clearROIinDetector();
void ClearROI();
/**
* Select Readout
* @param index position index of readout
* Sets ROI in detector
*/
void SetDetector(int index);
void SetROI();
/**
* Set all trimbits to a value
*/
void SetAllTrimbits();
/**
* Set storage cells
* Set number of additional storage cells
* @param value value to set to
*/
void SetNumStoragecells(int value);
@ -186,12 +161,125 @@ private slots:
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 */
multiSlsDetector *myDet;
/** detector type */
slsDetectorDefs::detectorType detType;
/** Tool Tip */
QString errOnlineTip;
QString detOnlineTip;
@ -199,16 +287,14 @@ private:
QPalette red;
/** ROI */
std::vector <QLabel*> lblFromX;
std::vector <QSpinBox*> spinFromX;
std::vector <QLabel*> lblFromY;
std::vector <QSpinBox*> spinFromY;
std::vector <QLabel*> lblToX;
std::vector <QSpinBox*> spinToX;
std::vector <QLabel*> lblToY;
std::vector <QSpinBox*> spinToY;
int numRois;
std::vector <QLabel*> lblFromX;
std::vector <QSpinBox*> spinFromX;
std::vector <QLabel*> lblFromY;
std::vector <QSpinBox*> spinFromY;
std::vector <QLabel*> lblToX;
std::vector <QSpinBox*> spinToX;
std::vector <QLabel*> lblToY;
std::vector <QSpinBox*> spinToY;
};

View File

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