refactor receiver client interface, moved defs into one sls_detector_defs.h

This commit is contained in:
2018-10-11 12:25:18 +02:00
parent d0950ba001
commit 5a356534e6
56 changed files with 1155 additions and 2386 deletions

View File

@ -2,12 +2,10 @@ CC = g++
CLAGS += -DVERBOSE #VERYBOSE
LDLIBS += -lm -lstdc++ -pthread
LDIR = ../../slsDetectorSoftware
RDIR = ../../slsReceiverSoftware
DDIR = ../../bin
INCLUDES = -I ../../slsSupportLib/include -I $(LDIR)/slsDetector -I ../include -I $(RDIR)/include
INCLUDES = -I ../../slsSupportLib/include -I ../include
SRC_CLNT = qClient.cpp
DEPSINCLUDES= qClient.h $(RDIR)/include/MySocketTCP.h $(LDIR)/slsDetector/slsDetectorBase.h ../../slsSupportLib/include/sls_detector_defs.h
DEPSINCLUDES= qClient.h ../../slsSupportLib/include/MySocketTCP.h ../../slsSupportLib/include/sls_detector_defs.h
all: client

View File

@ -8,7 +8,6 @@
#include "qClient.h"
// Project Class Headers
#include "MySocketTCP.h"
#include "slsDetectorBase.h"
// C++ Include Headers
#include <iostream>
@ -166,7 +165,7 @@ string qClient::getStatus(){
sprintf(answer,"%d%% ",progress);
strcat(answer,slsDetectorBase::runStatusType((runStatus)retval).c_str());
strcat(answer,slsDetectorDefs::runStatusType((runStatus)retval).c_str());
return string(answer);
}

View File

@ -146,7 +146,6 @@ HEADERS = \
include/qTabMessages.h\
include/gitInfoGui.h\
../slsSupportLib/include/sls_detector_defs.h\
../slsReceiverSoftware/include/sls_receiver_defs.h\
include/qServer.h

View File

@ -291,7 +291,7 @@ void qDetectorMain::SetUpDetector(const string fName){
actionLoadTrimbits->setText("Load Settings"); actionSaveTrimbits->setText("Save Settings");
break;
default:
string detName = myDet->slsDetectorBase::getDetectorType(detType);
string detName = myDet->slsDetectorDefs::getDetectorType(detType);
qDefs::checkErrorMessage(myDet,"qDetectorMain::SetUpDetector");
cout << "ERROR: " + host + " has unknown detector type \"" + detName + "\". Exiting GUI." << endl;
string errorMess = host+string(" has unknown detector type \"")+
@ -300,9 +300,9 @@ void qDetectorMain::SetUpDetector(const string fName){
exit(-1);
}
setWindowTitle("SLS Detector GUI : "+
QString(slsDetectorBase::getDetectorType(detType).c_str())+ " - "+QString(host.c_str()));
QString(slsDetectorDefs::getDetectorType(detType).c_str())+ " - "+QString(host.c_str()));
//#ifdef VERBOSE
cout << endl << "Type : " << slsDetectorBase::getDetectorType(detType) << "\nDetector : " << host << endl;
cout << endl << "Type : " << slsDetectorDefs::getDetectorType(detType) << "\nDetector : " << host << endl;
//#endif
myDet->setOnline(slsDetectorDefs::ONLINE_FLAG);
if(detType != slsDetectorDefs::MYTHEN)

View File

@ -1300,7 +1300,7 @@ int qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus){
#ifdef VERBOSE
cout << "\nEntering Acquisition Finished with status " ;
#endif
QString status = QString(slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detectorStatus)).c_str());
QString status = QString(slsDetectorDefs::runStatusType(slsDetectorDefs::runStatus(detectorStatus)).c_str());
#ifdef VERBOSE
cout << status.toAscii().constData() << " and progress " << currentProgress << endl;
#endif

View File

@ -222,7 +222,7 @@ void qTabAdvanced::SetupWidgetWindow(){
#endif
// jungfrau
if (detType == slsReceiverDefs::JUNGFRAU) {
if (detType == slsDetectorDefs::JUNGFRAU) {
lblNumStoragecells->setEnabled(true);
spinNumStoragecells->setEnabled(true);
spinNumStoragecells->setValue((int)myDet->setTimer(slsDetectorDefs::STORAGE_CELL_NUMBER,-1));
@ -327,7 +327,7 @@ void qTabAdvanced::Initialization(){
connect(btnSetRoi, SIGNAL(clicked()), this, SLOT(setROI()));
}
if(detType == slsReceiverDefs::JUNGFRAU) {
if(detType == slsDetectorDefs::JUNGFRAU) {
connect(spinNumStoragecells, SIGNAL(valueChanged(int)), this, SLOT(SetNumStoragecells(int)));
} else if (detType == slsDetectorDefs::EIGER) {
//Exposure Time
@ -1581,14 +1581,14 @@ void qTabAdvanced::Refresh(){
updateAllTrimbitsFromServer();
// storage cells
if (detType == slsReceiverDefs::JUNGFRAU) {
if (detType == slsDetectorDefs::JUNGFRAU) {
disconnect(spinNumStoragecells,SIGNAL(valueChanged(int)),this, SLOT(SetNumStoragecells(int)));
spinNumStoragecells->setValue((int)myDet->setTimer(slsDetectorDefs::STORAGE_CELL_NUMBER,-1));
connect(spinNumStoragecells,SIGNAL(valueChanged(int)), this, SLOT(SetNumStoragecells(int)));
}
// sub exptime and sub period
else if (detType == slsReceiverDefs::EIGER) {
else if (detType == slsDetectorDefs::EIGER) {
disconnect(spinSubExpTime,SIGNAL(valueChanged(double)), this, SLOT(SetSubExposureTime()));
disconnect(comboSubExpTimeUnit,SIGNAL(currentIndexChanged(int)),this, SLOT(SetSubExposureTime()));
disconnect(spinSubPeriod,SIGNAL(valueChanged(double)), this, SLOT(SetSubPeriod()));

View File

@ -878,19 +878,19 @@ void qTabDataOutput::SetupFileFormat(){
//To be able to index items on a combo box
QStandardItemModel* model = qobject_cast<QStandardItemModel*>(comboFileFormat->model());
QModelIndex index[slsReceiverDefs::NUM_FILE_FORMATS];
QStandardItem* item[slsReceiverDefs::NUM_FILE_FORMATS];
QModelIndex index[slsDetectorDefs::NUM_FILE_FORMATS];
QStandardItem* item[slsDetectorDefs::NUM_FILE_FORMATS];
if (model) {
for(int i=0;i<slsReceiverDefs::NUM_FILE_FORMATS;i++){
for(int i=0;i<slsDetectorDefs::NUM_FILE_FORMATS;i++){
index[i] = model->index(i, comboFileFormat->modelColumn(), comboFileFormat->rootModelIndex());
item[i] = model->itemFromIndex(index[i]);
}
//Enabling/Disabling depending on the detector type
switch(detType){
case slsDetectorDefs::MYTHEN:
item[(int)slsReceiverDefs::BINARY]->setEnabled(false);
item[(int)slsReceiverDefs::ASCII]->setEnabled(true);
item[(int)slsReceiverDefs::HDF5]->setEnabled(false);
item[(int)slsDetectorDefs::BINARY]->setEnabled(false);
item[(int)slsDetectorDefs::ASCII]->setEnabled(true);
item[(int)slsDetectorDefs::HDF5]->setEnabled(false);
break;
case slsDetectorDefs::EIGER:
case slsDetectorDefs::MOENCH:
@ -898,9 +898,9 @@ void qTabDataOutput::SetupFileFormat(){
case slsDetectorDefs::GOTTHARD:
case slsDetectorDefs::JUNGFRAU:
case slsDetectorDefs::JUNGFRAUCTB:
item[(int)slsReceiverDefs::BINARY]->setEnabled(true);
item[(int)slsReceiverDefs::ASCII]->setEnabled(false);
item[(int)slsReceiverDefs::HDF5]->setEnabled(true);
item[(int)slsDetectorDefs::BINARY]->setEnabled(true);
item[(int)slsDetectorDefs::ASCII]->setEnabled(false);
item[(int)slsDetectorDefs::HDF5]->setEnabled(true);
break;
default:
cout << "Unknown detector type " << endl;
@ -938,7 +938,7 @@ void qTabDataOutput::SetFileFormat(int format){
#endif
disconnect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int)));
int ret = (int)myDet->setFileFormat((slsReceiverDefs::fileFormat)comboFileFormat->currentIndex());
int ret = (int)myDet->setFileFormat((slsDetectorDefs::fileFormat)comboFileFormat->currentIndex());
if (ret != comboFileFormat->currentIndex()) {
qDefs::Message(qDefs::WARNING,"Could not set file format.","qTabDataOutput::SetFileFormat");
comboFileFormat->setCurrentIndex((int)ret);

View File

@ -165,7 +165,7 @@ void qTabDebugging::UpdateStatus(){
det = myDet->getSlsDetector(comboDetector->currentIndex());
qDefs::checkErrorMessage(myDet,"qTabDebugging::UpdateStatus");
int detStatus = (int)det->getRunStatus();
string status = slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detStatus));
string status = slsDetectorDefs::runStatusType(slsDetectorDefs::runStatus(detStatus));
lblStatus->setText(QString(status.c_str()).toUpper());
qDefs::checkErrorMessage(det,"qTabDebugging::UpdateStatus");

View File

@ -165,8 +165,8 @@ void qTabDeveloper::SetupWidgetWindow() {
break;
default:
cout << "ERROR: Unknown detector type: " + myDet->slsDetectorBase::getDetectorType(detType) << endl;
qDefs::Message(qDefs::CRITICAL,string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"qTabDeveloper::SetupWidgetWindow");
cout << "ERROR: Unknown detector type: " + myDet->slsDetectorDefs::getDetectorType(detType) << endl;
qDefs::Message(qDefs::CRITICAL,string("Unknown detector type:")+myDet->slsDetectorDefs::getDetectorType(detType),"qTabDeveloper::SetupWidgetWindow");
exit(-1);
break;
}
@ -493,8 +493,8 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){
}
break;
default:
cout << "Unknown detector type:" + myDet->slsDetectorBase::getDetectorType(detType) << endl;
qDefs::Message(qDefs::CRITICAL,string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"qTabDeveloper::getSLSIndex");
cout << "Unknown detector type:" + myDet->slsDetectorDefs::getDetectorType(detType) << endl;
qDefs::Message(qDefs::CRITICAL,string("Unknown detector type:")+myDet->slsDetectorDefs::getDetectorType(detType),"qTabDeveloper::getSLSIndex");
qDefs::checkErrorMessage(myDet,"qTabDeveloper::getSLSIndex");
exit(-1);
break;

View File

@ -634,7 +634,7 @@ void qTabMeasurement::SetTimingMode(int mode){
spinNumTriggers->setValue(1);
spinNumFrames->setValue(1);
if (detType == slsDetectorDefs::JUNGFRAU)
myDet->setTimer(slsReceiverDefs::STORAGE_CELL_NUMBER, 0);
myDet->setTimer(slsDetectorDefs::STORAGE_CELL_NUMBER, 0);
if(myDet->setExternalCommunicationMode(slsDetectorDefs::AUTO_TIMING)==slsDetectorDefs::AUTO_TIMING)
success = true;
break;
@ -713,7 +713,7 @@ void qTabMeasurement::SetTimingMode(int mode){
"Number of Frames \t: 1\nNumber of Triggers \t: 1","qTabMeasurement::SetTimingMode");
spinNumFrames->setValue(1);
spinNumTriggers->setValue(1);
if (detType == slsReceiverDefs::JUNGFRAU)
if (detType == slsDetectorDefs::JUNGFRAU)
myDet->setTimer(slsDetectorDefs::STORAGE_CELL_NUMBER, 0);
comboTimingMode->setCurrentIndex((int)None);
return;

View File

@ -38,7 +38,7 @@ void qTabSettings::SetupWidgetWindow(){
detType=myDet->getDetectorsType();
// Settings
if (detType != slsReceiverDefs::JUNGFRAUCTB) {
if (detType != slsDetectorDefs::JUNGFRAUCTB) {
SetupDetectorSettings();
} else
comboSettings->setEnabled(false);
@ -210,7 +210,7 @@ void qTabSettings::SetupDetectorSettings(){
void qTabSettings::Initialization(){
// Settings
if (detType != slsReceiverDefs::JUNGFRAUCTB)
if (detType != slsDetectorDefs::JUNGFRAUCTB)
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
// Number of Modules
connect(spinNumModules, SIGNAL(valueChanged(int)), this, SLOT(SetNumberOfModules(int)));
@ -238,7 +238,7 @@ void qTabSettings::setSettings(int index){
else{
slsDetectorDefs::detectorSettings sett = myDet->setSettings((slsDetectorDefs::detectorSettings)index);
#ifdef VERBOSE
cout << endl << "Settings have been set to " << myDet->slsDetectorBase::getDetectorSettings(sett) << endl;
cout << endl << "Settings have been set to " << myDet->slsDetectorDefs::getDetectorSettings(sett) << endl;
#endif
//threshold
@ -322,7 +322,7 @@ void qTabSettings::Refresh(){
cout << endl << "**Updating Settings Tab" << endl;
#endif
if (detType != slsReceiverDefs::JUNGFRAUCTB)
if (detType != slsDetectorDefs::JUNGFRAUCTB)
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
disconnect(spinNumModules, SIGNAL(valueChanged(int)), this, SLOT(SetNumberOfModules(int)));
disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));
@ -342,7 +342,7 @@ void qTabSettings::Refresh(){
GetDynamicRange();
// Settings
if (detType != slsReceiverDefs::JUNGFRAUCTB) {
if (detType != slsDetectorDefs::JUNGFRAUCTB) {
#ifdef VERBOSE
cout << "Getting settings" << endl;
#endif
@ -369,7 +369,7 @@ void qTabSettings::Refresh(){
}
}
if (detType != slsReceiverDefs::JUNGFRAUCTB)
if (detType != slsDetectorDefs::JUNGFRAUCTB)
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
connect(spinNumModules, SIGNAL(valueChanged(int)), this, SLOT(SetNumberOfModules(int)));
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));