made advanced tab detector dependent. each set mac adress etc is done via slsdetector and not multi

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@147 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
l_maliakal_d 2013-02-26 08:34:47 +00:00
parent 642d7d8c74
commit 0682d23abd
9 changed files with 589 additions and 540 deletions

File diff suppressed because it is too large Load Diff

View File

@ -510,7 +510,7 @@
</property>
<property name="icon">
<iconset resource="../include/icons.qrc">
<normaloff>:/icons/images/remove.png</normaloff>:/icons/images/remove.png</iconset>
<normaloff>:/icons/images/erase.png</normaloff>:/icons/images/erase.png</iconset>
</property>
<property name="iconSize">
<size>
@ -585,7 +585,7 @@
</property>
<property name="icon">
<iconset resource="../include/icons.qrc">
<normaloff>:/icons/images/add.png</normaloff>:/icons/images/add.png</iconset>
<normaloff>:/icons/images/calculate.png</normaloff>:/icons/images/calculate.png</iconset>
</property>
<property name="iconSize">
<size>
@ -780,7 +780,7 @@
<rect>
<x>10</x>
<y>20</y>
<width>348</width>
<width>341</width>
<height>26</height>
</rect>
</property>

Binary file not shown.

After

Width:  |  Height:  |  Size: 833 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 605 B

View File

@ -16,5 +16,7 @@
<file>../images/leftArrow.png</file>
<file>../images/rightArrow.png</file>
<file>../images/upload.png</file>
<file>../images/setup.png</file>
<file>../images/calculate.png</file>
</qresource>
</RCC>

View File

@ -213,6 +213,44 @@ static const int64_t GUI_VERSION=0x20121213;
};
//-------------------------------------------------------------------------------------------------------------------------------------------------
/**gets error mask and displays the message if it exists
* @param myDet is the slsdetector object
/returns error message else an empty string
* */
static string checkErrorMessage(slsDetector*& myDet){
int errorLevel= (int)WARNING;
string retval="";
size_t pos;
retval = myDet->getErrorMessage(errorLevel);
if(!retval.empty()){
//replace all \n with <br>
pos = 0;
while((pos = retval.find("\n", pos)) != string::npos){
retval.replace(pos, 1, "<br>");
pos += 1;
}
retval.insert(0,"<font color=\"darkBlue\">");
retval.append("</font></nobr>");
//display message
qDefs::Message((MessageIndex)errorLevel,retval,"Main");
}
myDet->clearErrorMask();
return retval;
};
//-------------------------------------------------------------------------------------------------------------------------------------------------
};

View File

@ -58,6 +58,7 @@ private:
*/
void AddROIInput(int num);
private slots:
/** Enable/Disable Energy and Calibration Logs
@ -142,10 +143,6 @@ private slots:
*/
void SetReceiver();
/** Configures mac
*/
void Configuremac();
/** Add ROI Input if the value changed in the last slot
*/
void AddROIInputSlot(){AddROIInput(1);};
@ -166,10 +163,17 @@ private slots:
*/
void clearROIinDetector();
/** Clears ROI in detector
*/
void SetDetector(int index);
private:
/** The sls detector object */
/** The multi detector object */
multiSlsDetector *myDet;
/** The sls detector object */
slsDetector *det;
/** detector type */
slsDetectorDefs::detectorType detType;
@ -192,10 +196,6 @@ private:
bool isEnergy;
bool isAngular;
/**sls detector obejct*/
slsDetector *det;
/** ROI */
vector <QLabel*> lblFromX;
vector <QSpinBox*> spinFromX;

View File

@ -2,10 +2,10 @@
#define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui"
//#define SVNREPPATH ""
#define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061"
//#define SVNREV 0x137
//#define SVNREV 0x146
//#define SVNKIND ""
//#define SVNSCHED ""
#define SVNAUTH "l_maliakal_d"
#define SVNREV 0x137
#define SVNDATE 0x20130116
#define SVNREV 0x146
#define SVNDATE 0x20130222
//

View File

@ -47,10 +47,7 @@ void qTabAdvanced::SetupWidgetWindow(){
lblMAC->setEnabled(false);
dispIP->setEnabled(false);
dispMAC->setEnabled(false);
boxRxrPorts->setEnabled(false);
boxRxr->setEnabled(false);
btnRxr->setEnabled(false);
btnConfigure->setEnabled(false);
red = QPalette();
@ -76,10 +73,7 @@ void qTabAdvanced::SetupWidgetWindow(){
lblMAC->setEnabled(true);
dispIP->setEnabled(true);
dispMAC->setEnabled(true);
boxRxrPorts->setEnabled(true);
boxRxr->setEnabled(true);
btnRxr->setEnabled(true);
btnConfigure->setEnabled(true);
break;
default: break;
}
@ -105,24 +99,32 @@ void qTabAdvanced::SetupWidgetWindow(){
//network
spinControlPort->setValue(myDet->setPort(slsDetectorDefs::CONTROL_PORT,-1));
spinStopPort->setValue(myDet->setPort(slsDetectorDefs::STOP_PORT,-1));
spinTCPPort->setValue(myDet->setPort(slsDetectorDefs::DATA_PORT,-1));
spinUDPPort->setValue(atoi(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_PORT)));
dispHostname->setText(QString(myDet->getHostname().c_str()));
dispIP->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::DETECTOR_IP)));
dispMAC->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::DETECTOR_MAC)));
dispRxrHostname->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_HOSTNAME)));
dispUDPIP->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_IP)));
dispUDPMAC->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_MAC)));
//add detectors
for(int i=0;i<myDet->getNumberOfDetectors();i++)
comboDetector->addItem(QString(myDet->getHostname(i).c_str()));
comboDetector->setCurrentIndex(0);
det = myDet->getSlsDetector(comboDetector->currentIndex());
spinControlPort->setValue(det->getControlPort());
spinStopPort->setValue(det->getStopPort());
spinTCPPort->setValue(det->getReceiverPort());
spinUDPPort->setValue(atoi(det->getReceiverUDPPort()));
dispIP->setText(det->getDetectorIP());
dispMAC->setText(det->getDetectorMAC());
dispRxrHostname->setText(det->getReceiver());
dispUDPIP->setText(det->getReceiverUDPIP());
dispUDPMAC->setText(det->getReceiverUDPMAC());
//check if its online and set it to red if offline
myDet->checkOnline();
myDet->checkReceiverOnline();
comboOnline->setCurrentIndex(myDet->setOnline());
comboRxrOnline->setCurrentIndex(myDet->setReceiverOnline());
det->checkOnline();
det->checkReceiverOnline();
comboOnline->setCurrentIndex(det->setOnline());
comboRxrOnline->setCurrentIndex(det->setReceiverOnline());
if(!comboOnline->currentIndex()){
comboOnline->setToolTip(detOnlineTip + errOnlineTip);
lblOnline->setToolTip(detOnlineTip + errOnlineTip);
@ -137,6 +139,7 @@ void qTabAdvanced::SetupWidgetWindow(){
}
//updates roi
updateROIList();
@ -187,6 +190,7 @@ void qTabAdvanced::Initialization(){
}
//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(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int)));
@ -204,7 +208,6 @@ void qTabAdvanced::Initialization(){
connect(dispUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
connect(btnRxr, SIGNAL(clicked()), this, SLOT(SetReceiver()));
connect(btnConfigure, SIGNAL(clicked()), this, SLOT(Configuremac()));
}
@ -482,8 +485,8 @@ void qTabAdvanced::SetControlPort(int port){
cout << "Setting Control Port:" << port << endl;
#endif
disconnect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int)));
spinStopPort->setValue(myDet->setPort(slsDetectorDefs::CONTROL_PORT,port));
qDefs::checkErrorMessage(myDet);
spinStopPort->setValue(det->setPort(slsDetectorDefs::CONTROL_PORT,port));
qDefs::checkErrorMessage(det);
connect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int)));
}
@ -496,8 +499,8 @@ void qTabAdvanced::SetStopPort(int port){
cout << "Setting Stop Port:" << port << endl;
#endif
disconnect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int)));
spinControlPort->setValue(myDet->setPort(slsDetectorDefs::STOP_PORT,port));
qDefs::checkErrorMessage(myDet);
spinControlPort->setValue(det->setPort(slsDetectorDefs::STOP_PORT,port));
qDefs::checkErrorMessage(det);
connect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int)));
}
@ -511,8 +514,8 @@ void qTabAdvanced::SetRxrTCPPort(int port){
cout << "Setting Receiver TCP Port:" << port << endl;
#endif
disconnect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int)));
spinTCPPort->setValue(myDet->setPort(slsDetectorDefs::DATA_PORT,port));
qDefs::checkErrorMessage(myDet);
spinTCPPort->setValue(det->setPort(slsDetectorDefs::DATA_PORT,port));
qDefs::checkErrorMessage(det);
connect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int)));
}
@ -524,12 +527,10 @@ void qTabAdvanced::SetRxrUDPPort(int port){
#ifdef VERBOSE
cout << "Setting Receiver UDP Port:" << port << endl;
#endif
char sNumber[100];
sprintf(sNumber,"%d",port);
disconnect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int)));
spinUDPPort->setValue(atoi(myDet->setNetworkParameter(slsDetectorDefs::RECEIVER_UDP_PORT,sNumber)));
qDefs::checkErrorMessage(myDet);
spinUDPPort->setValue(det->setReceiverUDPPort(port));
qDefs::checkErrorMessage(det);
connect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int)));
}
@ -542,8 +543,8 @@ void qTabAdvanced::SetReceiverOnline(int index){
cout << "Setting Reciever Online to :" << index << endl;
#endif
disconnect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int)));
comboRxrOnline->setCurrentIndex(myDet->setReceiverOnline(index));
qDefs::checkErrorMessage(myDet);
comboRxrOnline->setCurrentIndex(det->setReceiverOnline(index));
qDefs::checkErrorMessage(det);
connect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int)));
//highlight in red if offline
if(!comboRxrOnline->currentIndex()){
@ -568,8 +569,8 @@ void qTabAdvanced::SetOnline(int index){
cout << "Setting Detector Online to " << index << endl;
#endif
disconnect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int)));
comboOnline->setCurrentIndex(myDet->setOnline(index));
qDefs::checkErrorMessage(myDet);
comboOnline->setCurrentIndex(det->setOnline(index));
qDefs::checkErrorMessage(det);
connect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int)));
//highlight in red if offline
if(!comboOnline->currentIndex()){
@ -599,11 +600,11 @@ void qTabAdvanced::SetNetworkParameters(){
disconnect(dispUDPIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
disconnect(dispUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
dispIP->setText(QString(myDet->setNetworkParameter(slsDetectorDefs::DETECTOR_IP,dispIP->text().toAscii().constData())));
dispMAC->setText(QString(myDet->setNetworkParameter(slsDetectorDefs::DETECTOR_MAC,dispMAC->text().toAscii().constData())));
dispUDPIP->setText(QString(myDet->setNetworkParameter(slsDetectorDefs::RECEIVER_UDP_IP,dispUDPIP->text().toAscii().constData())));
dispUDPMAC->setText(QString(myDet->setNetworkParameter(slsDetectorDefs::RECEIVER_UDP_MAC,dispUDPMAC->text().toAscii().constData())));
qDefs::checkErrorMessage(myDet);
dispIP->setText(QString(det->setDetectorIP(dispIP->text().toAscii().constData())));
dispMAC->setText(QString(det->setDetectorMAC(dispMAC->text().toAscii().constData())));
dispUDPIP->setText(QString(det->setReceiverUDPIP(dispUDPIP->text().toAscii().constData())));
dispUDPMAC->setText(QString(det->setReceiverUDPMAC(dispUDPMAC->text().toAscii().constData())));
qDefs::checkErrorMessage(det);
connect(dispIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
connect(dispMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
@ -619,23 +620,12 @@ void qTabAdvanced::SetReceiver(){
#ifdef VERBOSE
cout << "Setting Receiver" << endl;
#endif
dispRxrHostname->setText(QString(myDet->setNetworkParameter(slsDetectorDefs::RECEIVER_HOSTNAME,dispRxrHostname->text().toAscii().constData())));
qDefs::checkErrorMessage(myDet);
dispRxrHostname->setText(QString(det->setReceiver(dispRxrHostname->text().toAscii().constData())));
qDefs::checkErrorMessage(det);
Refresh();
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::Configuremac(){
#ifdef VERBOSE
cout << "Configuring Mac:" << endl;
#endif
myDet->configureMAC();
qDefs::checkErrorMessage(myDet);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
@ -865,6 +855,61 @@ void qTabAdvanced::clearROIinDetector(){
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::SetDetector(int index){
#ifdef VERYVERBOSE
cout<<"in SetDetector: " << index << endl;
#endif
det = myDet->getSlsDetector(comboDetector->currentIndex());
spinControlPort->setValue(det->getControlPort());
spinStopPort->setValue(det->getStopPort());
spinTCPPort->setValue(det->getReceiverPort());
spinUDPPort->setValue(atoi(det->getReceiverUDPPort()));
dispIP->setText(det->getDetectorIP());
dispMAC->setText(det->getDetectorMAC());
dispRxrHostname->setText(det->getReceiver());
dispUDPIP->setText(det->getReceiverUDPIP());
dispUDPMAC->setText(det->getReceiverUDPMAC());
//check if its online and set it to red if offline
det->checkOnline();
det->checkReceiverOnline();
comboOnline->setCurrentIndex(det->setOnline());
comboRxrOnline->setCurrentIndex(det->setReceiverOnline());
//highlight in red if detector or receiver is offline
if(!comboOnline->currentIndex()){
comboOnline->setToolTip(detOnlineTip + errOnlineTip);
lblOnline->setToolTip(detOnlineTip + errOnlineTip);
lblOnline->setPalette(red);
lblOnline->setText("Online:*");
}else{
comboOnline->setToolTip(detOnlineTip);
lblOnline->setToolTip(detOnlineTip);
lblOnline->setPalette(lblHostname->palette());
lblOnline->setText("Online:");
}
if(comboRxrOnline->isEnabled()){
if(!comboRxrOnline->currentIndex()){
comboRxrOnline->setToolTip(rxrOnlineTip + errOnlineTip);
lblRxrOnline->setToolTip(rxrOnlineTip + errOnlineTip);
lblRxrOnline->setPalette(red);
lblRxrOnline->setText("Online:*");
}else{
comboRxrOnline->setToolTip(rxrOnlineTip);
lblRxrOnline->setToolTip(rxrOnlineTip);
lblRxrOnline->setPalette(lblHostname->palette());
lblRxrOnline->setText("Online:");
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::Refresh(){
@ -935,17 +980,19 @@ void qTabAdvanced::Refresh(){
//network
//so that updated status
myDet->checkOnline();
dispHostname->setText(QString(myDet->getHostname().c_str()));
det = myDet->getSlsDetector(comboDetector->currentIndex());
//disconnect
disconnect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int)));
disconnect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int)));
disconnect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int)));
spinControlPort->setValue(myDet->setPort(slsDetectorDefs::CONTROL_PORT,-1));
spinStopPort->setValue(myDet->setPort(slsDetectorDefs::STOP_PORT,-1));
comboOnline->setCurrentIndex(myDet->setOnline());
//so that updated status
det->checkOnline();
comboOnline->setCurrentIndex(det->setOnline());
spinControlPort->setValue(det->getControlPort());
spinStopPort->setValue(det->getStopPort());
//connect
connect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int)));
connect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int)));
@ -963,21 +1010,20 @@ void qTabAdvanced::Refresh(){
disconnect(dispUDPIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
disconnect(dispUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
disconnect(btnRxr, SIGNAL(clicked()), this, SLOT(SetReceiver()));
disconnect(btnConfigure, SIGNAL(clicked()), this, SLOT(Configuremac()));
dispIP->setText(det->getDetectorIP());
dispMAC->setText(det->getDetectorMAC());
//so that updated status
myDet->checkReceiverOnline();
dispRxrHostname->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_HOSTNAME)));
det->checkReceiverOnline();
comboRxrOnline->setCurrentIndex(det->setReceiverOnline());
spinTCPPort->setValue(myDet->setPort(slsDetectorDefs::DATA_PORT,-1));
spinUDPPort->setValue(atoi(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_PORT)));
dispRxrHostname->setText(det->getReceiver());
spinTCPPort->setValue(det->getReceiverPort());
spinUDPPort->setValue(atoi(det->getReceiverUDPPort()));
dispIP->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::DETECTOR_IP)));
dispMAC->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::DETECTOR_MAC)));
comboRxrOnline->setCurrentIndex(myDet->setReceiverOnline());
dispUDPIP->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_IP)));
dispUDPMAC->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_MAC)));
dispUDPIP->setText(det->getReceiverUDPIP());
dispUDPMAC->setText(det->getReceiverUDPMAC());
//connect
connect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int)));
@ -988,7 +1034,6 @@ void qTabAdvanced::Refresh(){
connect(dispUDPIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
connect(dispUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
connect(btnRxr, SIGNAL(clicked()), this, SLOT(SetReceiver()));
connect(btnConfigure, SIGNAL(clicked()), this, SLOT(Configuremac()));
}