mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 23:30:03 +02:00
WIP
This commit is contained in:
parent
862dc824ba
commit
e4546c6121
@ -442,11 +442,6 @@ Disabled if receiver pc is not same as client pc.
|
||||
<string>Binary</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ASCII</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>HDF5</string>
|
||||
|
@ -244,6 +244,28 @@ class qDefs : public QWidget {
|
||||
}
|
||||
};
|
||||
|
||||
// executing multiSlsDetector funtion and using return value to set QWidget function
|
||||
// (handling -1 for comboboxes)
|
||||
template <class W, typename WRT, typename RT, typename... CT>
|
||||
static void IgnoreNonCriticalExceptionsandMinus1(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 {
|
||||
int val = static_cast<int>((det->*somefunc)(Args...));
|
||||
if (val == -1) {
|
||||
Message(qDefs::WARNING, message + std::string(" is inconsistent for all detectors\n"), source);
|
||||
} else {
|
||||
(wid->*someQfunc)(val);
|
||||
}
|
||||
}
|
||||
// catch them here as they are not critical
|
||||
catch (const sls::NonCriticalError &e) {
|
||||
ExceptionMessage(message, e.what(), source);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// executing multiSlsDetector funtion and returning its value (integers, where value cannot be -1)
|
||||
/* can easily get out of hand
|
||||
|
@ -159,7 +159,7 @@ void qTabAdvanced::GetControlPort() {
|
||||
|
||||
qDefs::IgnoreNonCriticalExceptions<QSpinBox>(
|
||||
myDet,
|
||||
"Could not get detector control port."
|
||||
"Could not get detector control port.",
|
||||
"qTabAdvanced::GetControlPort",
|
||||
spinControlPort,
|
||||
&QSpinBox::setValue,
|
||||
@ -174,7 +174,7 @@ void qTabAdvanced::GetStopPort() {
|
||||
|
||||
qDefs::IgnoreNonCriticalExceptions<QSpinBox>(
|
||||
myDet,
|
||||
"Could not get detector stop port."
|
||||
"Could not get detector stop port.",
|
||||
"qTabAdvanced::GetStopPort",
|
||||
spinStopPort,
|
||||
&QSpinBox::setValue,
|
||||
@ -189,7 +189,7 @@ void qTabAdvanced::GetDetectorUDPIP() {
|
||||
|
||||
qDefs::IgnoreNonCriticalExceptions<QLineEdit>(
|
||||
myDet,
|
||||
"Could not get detector UDP IP."
|
||||
"Could not get detector UDP IP.",
|
||||
"qTabAdvanced::GetDetectorUDPIP",
|
||||
dispDetectorUDPIP,
|
||||
&QLineEdit::setText,
|
||||
@ -204,7 +204,7 @@ void qTabAdvanced::GetDetectorUDPMAC() {
|
||||
|
||||
qDefs::IgnoreNonCriticalExceptions<QLineEdit>(
|
||||
myDet,
|
||||
"Could not get detector UDP MAC."
|
||||
"Could not get detector UDP MAC.",
|
||||
"qTabAdvanced::GetDetectorUDPMAC",
|
||||
dispDetectorUDPMAC,
|
||||
&QLineEdit::setText,
|
||||
@ -219,7 +219,7 @@ void qTabAdvanced::GetCltZMQPort() {
|
||||
|
||||
qDefs::IgnoreNonCriticalExceptions<QSpinBox>(
|
||||
myDet,
|
||||
"Could not get client zmq port."
|
||||
"Could not get client zmq port.",
|
||||
"qTabAdvanced::GetCltZMQPort",
|
||||
spinZMQPort,
|
||||
&QSpinBox::setValue,
|
||||
@ -234,7 +234,7 @@ void qTabAdvanced::GetCltZMQIP() {
|
||||
|
||||
qDefs::IgnoreNonCriticalExceptions<QLineEdit>(
|
||||
myDet,
|
||||
"Could not get client zmq ip."
|
||||
"Could not get client zmq ip.",
|
||||
"qTabAdvanced::GetCltZMQIP",
|
||||
dispZMQIP,
|
||||
&QLineEdit::setText,
|
||||
@ -249,7 +249,7 @@ void qTabAdvanced::GetRxrHostname() {
|
||||
|
||||
qDefs::IgnoreNonCriticalExceptions<QLineEdit>(
|
||||
myDet,
|
||||
"Could not get receiver hostname."
|
||||
"Could not get receiver hostname.",
|
||||
"qTabAdvanced::GetRxrHostname",
|
||||
dispRxrHostname,
|
||||
&QLineEdit::setText,
|
||||
@ -300,7 +300,7 @@ void qTabAdvanced::GetRxrTCPPort() {
|
||||
|
||||
qDefs::IgnoreNonCriticalExceptions<QSpinBox>(
|
||||
myDet,
|
||||
"Could not get receiver tcp port."
|
||||
"Could not get receiver tcp port.",
|
||||
"qTabAdvanced::GetRxrTCPPort",
|
||||
spinRxrTCPPort,
|
||||
&QSpinBox::setValue,
|
||||
@ -315,7 +315,7 @@ void qTabAdvanced::GetRxrUDPPort() {
|
||||
|
||||
qDefs::IgnoreNonCriticalExceptions<QSpinBox>(
|
||||
myDet,
|
||||
"Could not get receiver udp port."
|
||||
"Could not get receiver udp port.",
|
||||
"qTabAdvanced::GetRxrUDPPort",
|
||||
spinRxrUDPPort,
|
||||
&QSpinBox::setValue,
|
||||
@ -330,7 +330,7 @@ void qTabAdvanced::GetRxrUDPIP() {
|
||||
|
||||
qDefs::IgnoreNonCriticalExceptions<QLineEdit>(
|
||||
myDet,
|
||||
"Could not get receiver udp ip."
|
||||
"Could not get receiver udp ip.",
|
||||
"qTabAdvanced::GetRxrUDPIP",
|
||||
dispRxrUDPIP,
|
||||
&QLineEdit::setText,
|
||||
@ -345,7 +345,7 @@ void qTabAdvanced::GetRxrUDPMAC() {
|
||||
|
||||
qDefs::IgnoreNonCriticalExceptions<QLineEdit>(
|
||||
myDet,
|
||||
"Could not get receiver udp mac."
|
||||
"Could not get receiver udp mac.",
|
||||
"qTabAdvanced::GetRxrUDPMAC",
|
||||
dispRxrUDPMAC,
|
||||
&QLineEdit::setText,
|
||||
@ -360,7 +360,7 @@ void qTabAdvanced::GetRxrZMQPort() {
|
||||
|
||||
qDefs::IgnoreNonCriticalExceptions<QSpinBox>(
|
||||
myDet,
|
||||
"Could not get receiver zmq port."
|
||||
"Could not get receiver zmq port.",
|
||||
"qTabAdvanced::GetRxrZMQPort",
|
||||
spinRxrZMQPort,
|
||||
&QSpinBox::setValue,
|
||||
@ -375,7 +375,7 @@ void qTabAdvanced::GetRxrZMQIP() {
|
||||
|
||||
qDefs::IgnoreNonCriticalExceptions<QLineEdit>(
|
||||
myDet,
|
||||
"Could not get receiver zmq ip."
|
||||
"Could not get receiver zmq ip.",
|
||||
"qTabAdvanced::GetRxrZMQIP",
|
||||
dispRxrZMQIP,
|
||||
&QLineEdit::setText,
|
||||
@ -710,7 +710,7 @@ void qTabAdvanced::SetROI() {
|
||||
FILE_LOG(logINFO) << "Setting ROI:" << nroi;
|
||||
qDefs::IgnoreNonCriticalExceptions(
|
||||
myDet,
|
||||
"Could not set these ROIs."
|
||||
"Could not set these ROIs.",
|
||||
"qTabAdvanced::SetROI",
|
||||
&multiSlsDetector::setROI, nroi, roi, -1);
|
||||
|
||||
@ -724,7 +724,7 @@ void qTabAdvanced::GetAllTrimbits() {
|
||||
|
||||
qDefs::IgnoreNonCriticalExceptions<QSpinBox>(
|
||||
myDet,
|
||||
"Could not get all trimbits value."
|
||||
"Could not get all trimbits value.",
|
||||
"qTabAdvanced::GetAllTrimbits",
|
||||
spinSetAllTrimbits,
|
||||
&QSpinBox::setValue,
|
||||
@ -736,8 +736,9 @@ void qTabAdvanced::GetAllTrimbits() {
|
||||
void qTabAdvanced::SetAllTrimbits() {
|
||||
int value = spinSetAllTrimbits->value();
|
||||
FILE_LOG(logINFO) << "Setting all trimbits:" << value;
|
||||
|
||||
try {
|
||||
myDet->setAllTrimbits(value, -1);
|
||||
myDet->setAllTrimbits(value);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set all trimbits.", e.what(), "qTabAdvanced::SetAllTrimbits");
|
||||
GetAllTrimbits();
|
||||
@ -750,7 +751,7 @@ void qTabAdvanced::GetNumStoragecells() {
|
||||
|
||||
qDefs::IgnoreNonCriticalExceptions<QSpinBox>(
|
||||
myDet,
|
||||
"Could not get number of additional storage cells."
|
||||
"Could not get number of additional storage cells.",
|
||||
"qTabAdvanced::GetNumStoragecells",
|
||||
spinNumStoragecells,
|
||||
&QSpinBox::setValue,
|
||||
@ -775,11 +776,17 @@ void qTabAdvanced::GetSubExposureTime() {
|
||||
disconnect(comboSubExpTimeUnit,SIGNAL(currentIndexChanged(int)),this, SLOT(SetSubExposureTime()));
|
||||
|
||||
try {
|
||||
double value = (double)(myDet->setTimer(slsDetectorDefs::SUBFRAME_ACQUISITION_TIME,-1) * (1E-9));
|
||||
qDefs::timeUnit unit;
|
||||
double time = qDefs::getCorrectTime(unit, value);
|
||||
spinSubExpTime->setValue(time);
|
||||
comboSubExpTimeUnit->setCurrentIndex((int)unit);
|
||||
int64_t retval = myDet->setTimer(slsDetectorDefs::SUBFRAME_ACQUISITION_TIME);
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "Subexptime is inconsistent for all detectors.", "qTabAdvanced::GetSubExposureTime");
|
||||
spinSubExpTime->setValue(-1);
|
||||
} else {
|
||||
double value = (double)( retval * (1E-9));
|
||||
qDefs::timeUnit unit;
|
||||
double time = qDefs::getCorrectTime(unit, value);
|
||||
spinSubExpTime->setValue(time);
|
||||
comboSubExpTimeUnit->setCurrentIndex((int)unit);
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get sub exposure time.", e.what(), "qTabSettings::GetSubExposureTime");
|
||||
}
|
||||
@ -806,11 +813,17 @@ void qTabAdvanced::GetSubDeadTime() {
|
||||
disconnect(comboSubDeadTimeUnit,SIGNAL(currentIndexChanged(int)),this, SLOT(SetSubDeadTime()));
|
||||
|
||||
try {
|
||||
double value = (double)(myDet->setTimer(slsDetectorDefs::SUBFRAME_DEADTIME,-1) * (1E-9));
|
||||
qDefs::timeUnit unit;
|
||||
double time = qDefs::getCorrectTime(unit, value);
|
||||
spinSubDeadTime->setValue(time);
|
||||
comboSubDeadTimeUnit->setCurrentIndex((int)unit);
|
||||
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");
|
||||
spinSubDeadTime->setValue(-1);
|
||||
} else {
|
||||
double value = (double)(retval * (1E-9));
|
||||
qDefs::timeUnit unit;
|
||||
double time = qDefs::getCorrectTime(unit, value);
|
||||
spinSubDeadTime->setValue(time);
|
||||
comboSubDeadTimeUnit->setCurrentIndex((int)unit);
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get sub dead time.", e.what(), "qTabSettings::GetSubDeadTime");
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ void qTabDataOutput::EnableBrowse() {
|
||||
btnOutputBrowse->setEnabled(true);
|
||||
} else {
|
||||
std::string hostname;
|
||||
size_t len = 15;
|
||||
const size_t len = 15;
|
||||
char host[len]{};
|
||||
if (gethostname(host, len) == 0) {
|
||||
hostname.assign(host);
|
||||
@ -117,17 +117,16 @@ void qTabDataOutput::EnableBrowse() {
|
||||
|
||||
|
||||
void qTabDataOutput::GetOutputDir() {
|
||||
FILE_LOG(logDEBUG) << "Getting output directory";
|
||||
FILE_LOG(logDEBUG) << "Getting file path";
|
||||
|
||||
disconnect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir()));
|
||||
|
||||
qDefs::IgnoreNonCriticalExceptions<QLineEdit>(
|
||||
myDet,
|
||||
"Could not get output file path."
|
||||
"qTabDataOutput::GetOutputDir",
|
||||
dispOutputDir,
|
||||
&QLineEdit::setText,
|
||||
&multiSlsDetector::getFilePath, comboDetector->currentIndex() - 1);
|
||||
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");
|
||||
}
|
||||
|
||||
connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir()));
|
||||
}
|
||||
@ -140,9 +139,9 @@ void qTabDataOutput::BrowseOutputDir() {
|
||||
}
|
||||
|
||||
void qTabDataOutput::SetOutputDir() {
|
||||
FILE_LOG(logDEBUG) << "Setting output directory";
|
||||
|
||||
QString path = dispOutputDir->text();
|
||||
FILE_LOG(logDEBUG) << "Setting output directory to " << path.toAscii().constData();
|
||||
|
||||
// empty
|
||||
if (path.isEmpty()) {
|
||||
qDefs::Message(qDefs::WARNING, "Invalid Output Path. Must not be empty.", "qTabDataOutput::SetOutputDir");
|
||||
@ -169,10 +168,10 @@ void qTabDataOutput::GetFileFormat() {
|
||||
FILE_LOG(logDEBUG) << "Getting File Format";
|
||||
disconnect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int)));
|
||||
|
||||
qDefs::IgnoreNonCriticalExceptions<QComboBox>(
|
||||
qDefs::IgnoreNonCriticalExceptionsandMinus1<QComboBox>(
|
||||
myDet,
|
||||
"Could not get file format."
|
||||
"qTabAdvanced::GetFileFormat",
|
||||
"Could not get file format.",
|
||||
"qTabDataOutput::GetFileFormat",
|
||||
comboFileFormat,
|
||||
&QComboBox::setCurrentIndex,
|
||||
&multiSlsDetector::getFileFormat, -1);
|
||||
@ -181,7 +180,7 @@ void qTabDataOutput::GetFileFormat() {
|
||||
}
|
||||
|
||||
void qTabDataOutput::SetFileFormat(int format) {
|
||||
FILE_LOG(logINFO) << "Setting File Format";
|
||||
FILE_LOG(logINFO) << "Setting File Format to " << slsDetectorDefs::getFileFormatType((slsDetectorDefs::fileFormat)format);
|
||||
try {
|
||||
myDet->setFileFormat((slsDetectorDefs::fileFormat)comboFileFormat->currentIndex());
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
@ -190,6 +189,65 @@ void qTabDataOutput::SetFileFormat(int format) {
|
||||
}
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetFileOverwrite() {
|
||||
FILE_LOG(logDEBUG) << "Getting File Over Write Enable";
|
||||
disconnect(chkOverwriteEnable, SIGNAL(toggled(bool)), this, SLOT(SetOverwriteEnable(bool)));
|
||||
|
||||
try {
|
||||
int retval = myDet->getFileOverWrite();
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "File over write is inconsistent for all detectors.", "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");
|
||||
}
|
||||
|
||||
connect(chkOverwriteEnable, SIGNAL(toggled(bool)), this, SLOT(SetOverwriteEnable(bool)));
|
||||
}
|
||||
|
||||
void qTabDataOutput::SetOverwriteEnable(bool enable) {
|
||||
FILE_LOG(logINFO) << "Setting File Over Write Enable to " << enable;
|
||||
|
||||
try {
|
||||
myDet->setFileOverWrite(enable);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set file over write enable.", e.what(), "qTabDataOutput::SetOverwriteEnable");
|
||||
GetFileOverwrite();
|
||||
}
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetTenGigaEnable() {
|
||||
FILE_LOG(logDEBUG) << "Getting 10GbE enable";
|
||||
disconnect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(SetTenGigaEnable(bool)));
|
||||
|
||||
try {
|
||||
int retval = myDet->enableTenGigabitEthernet();
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "10GbE enable is inconsistent for all detectors.", "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");
|
||||
}
|
||||
|
||||
connect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(SetTenGigaEnable(bool)));
|
||||
}
|
||||
|
||||
void qTabDataOutput::SetTenGigaEnable(bool enable) {
|
||||
FILE_LOG(logINFO) << "Setting 10GbE to " << enable;
|
||||
|
||||
try {
|
||||
myDet->enableTenGigabitEthernet(enable);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set 10GbE enable.", e.what(), "qTabDataOutput::SetTenGigaEnable");
|
||||
GetTenGigaEnable();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -313,26 +371,7 @@ void qTabDataOutput::GetRateCorrection() {
|
||||
|
||||
|
||||
|
||||
void qTabDataOutput::GetTenGigaEnable(bool enable, int get) {
|
||||
if (get || enable == -1) {
|
||||
FILE_LOG(logDEBUG) << "Getting 10Gbe enable";
|
||||
} else {
|
||||
FILE_LOG(logINFO) << (enable == 0 ? "Disabling" : "Enabling") << "10GbE";
|
||||
}
|
||||
disconnect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(GetTenGigaEnable(bool)));
|
||||
int ret;
|
||||
if (get)
|
||||
ret = myDet->GetTenGigaEnable(-1);
|
||||
else
|
||||
ret = myDet->GetTenGigaEnable(enable);
|
||||
if (ret > 0)
|
||||
chkTenGiga->setChecked(true);
|
||||
else
|
||||
chkTenGiga->setChecked(false);
|
||||
connect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(GetTenGigaEnable(bool)));
|
||||
|
||||
qDefs::checkErrorMessage(myDet, "qTabDataOutput::GetTenGigaEnable");
|
||||
}
|
||||
|
||||
|
||||
void qTabDataOutput::GetSpeed() {
|
||||
@ -458,28 +497,6 @@ void qTabDataOutput::SetFlags() {
|
||||
|
||||
|
||||
|
||||
void qTabDataOutput::GetFileOverwrite() {
|
||||
FILE_LOG(logDEBUG) << "Getting File Over Write Enable";
|
||||
disconnect(chkOverwriteEnable, SIGNAL(toggled(bool)), this, SLOT(SetOverwriteEnable(bool)));
|
||||
|
||||
chkOverwriteEnable->setChecked(myDet->overwriteFile());
|
||||
|
||||
connect(chkOverwriteEnable, SIGNAL(toggled(bool)), this, SLOT(SetOverwriteEnable(bool)));
|
||||
}
|
||||
|
||||
|
||||
void qTabDataOutput::SetOverwriteEnable(bool enable) {
|
||||
FILE_LOG(logINFO) << "Setting File Over Write Enable";
|
||||
disconnect(chkOverwriteEnable, SIGNAL(toggled(bool)), this, SLOT(SetOverwriteEnable(bool)));
|
||||
|
||||
int valid = (enable ? 1 : 0);
|
||||
if (myDet->overwriteFile(enable) != valid)
|
||||
qDefs::Message(qDefs::WARNING, "Could not over write enable.", "qTabDataOutput::SetOverwriteEnable");
|
||||
|
||||
connect(chkOverwriteEnable, SIGNAL(toggled(bool)), this, SLOT(SetOverwriteEnable(bool)));
|
||||
|
||||
GetFileOverwrite();
|
||||
}
|
||||
|
||||
|
||||
void qTabDataOutput::Refresh() {
|
||||
|
@ -514,8 +514,6 @@ int slsReceiverImplementation::setReadOutFlags(const readOutFlags f) {
|
||||
flag.append("parallel ");
|
||||
if (f & NONPARALLEL)
|
||||
flag.append("nonparallel ");
|
||||
if (f & SAFE)
|
||||
flag.append("safe ");
|
||||
if (f & DIGITAL_ONLY)
|
||||
flag.append("digital ");
|
||||
if (f & ANALOG_AND_DIGITAL)
|
||||
|
@ -645,8 +645,8 @@ format
|
||||
};
|
||||
|
||||
/** returns string from file format index
|
||||
\param s can be BINARY, ASCII, HDF5
|
||||
\returns string binary, ascii, hdf5
|
||||
\param s can be BINARY, HDF5
|
||||
\returns string binary, hdf5
|
||||
*/
|
||||
static std::string getFileFormatType(fileFormat f) {
|
||||
switch (f) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user