From 0682d23abd194391d681c68e7dc8659de72e96db Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 26 Feb 2013 08:34:47 +0000 Subject: [PATCH] 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 --- slsDetectorGui/forms/form_tab_advanced.ui | 872 +++++++++++----------- slsDetectorGui/forms/form_tab_plot.ui | 6 +- slsDetectorGui/images/calculate.png | Bin 0 -> 833 bytes slsDetectorGui/images/setup.png | Bin 0 -> 605 bytes slsDetectorGui/include/icons.qrc | 2 + slsDetectorGui/include/qDefs.h | 38 + slsDetectorGui/include/qTabAdvanced.h | 18 +- slsDetectorGui/include/svnInfoGui.h | 6 +- slsDetectorGui/src/qTabAdvanced.cpp | 187 +++-- 9 files changed, 589 insertions(+), 540 deletions(-) create mode 100644 slsDetectorGui/images/calculate.png create mode 100644 slsDetectorGui/images/setup.png diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index 6f4fbd717..3e9b1164c 100644 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -32,7 +32,7 @@ Form - + :/icons/images/refresh.png:/icons/images/refresh.png @@ -51,7 +51,7 @@ QTabWidget::North - 0 + 3 Qt::ElideLeft @@ -164,7 +164,7 @@ Updates plot with Trimbits from Shared Memory, not from Detector. Refresh - + :/icons/images/refresh.png:/icons/images/refresh.png @@ -186,7 +186,7 @@ Plots Trimbits from Detector. This will take time. Get Trimbits - + :/icons/images/download.png:/icons/images/download.png @@ -495,7 +495,7 @@ An extension given by the modules serial number will be attached. Browse - + :/icons/images/browse.png:/icons/images/browse.png @@ -519,7 +519,7 @@ An extension given by the modules serial number will be attached. Start Trimming - + :/icons/images/start.png:/icons/images/start.png @@ -792,16 +792,22 @@ An extension given by the modules serial number will be attached. - + 0 0 + + + 150 + 0 + + Get ROI - + :/icons/images/download.png:/icons/images/download.png @@ -822,16 +828,22 @@ An extension given by the modules serial number will be attached. - + 0 0 + + + 150 + 0 + + Set ROI - + :/icons/images/upload.png:/icons/images/upload.png @@ -852,17 +864,23 @@ An extension given by the modules serial number will be attached. - + 0 0 + + + 150 + 0 + + Clear ROI - - :/icons/images/close.png:/icons/images/close.png + + :/icons/images/erase.png:/icons/images/erase.png @@ -873,193 +891,49 @@ An extension given by the modules serial number will be attached. Network - + 10 - 10 - 336 - 96 + 135 + 736 + 171 - Detector Ports + Receiver Parameters - + - 20 - 25 - 296 - 56 + 25 + 135 + 291 + 25 - - - -1 - - - - - - 0 - 0 - - - - - 180 - 0 - - - - - 127 - 16777215 - - - - Sets Control Port -#port# - - - - - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - false - - - - - - 0 - - - 2000000000 - - - 0 - - - - - - - - 0 - 0 - - - - Control Port: - - - - - - - - 0 - 0 - - - - Stop Port: - - - - - - - - 0 - 0 - - - - - 180 - 0 - - - - Sets Stop Port -#stopport# - - - - - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - false - - - - - - 0 - - - 2000000000 - - - 0 - - - - + + Setup Receiver + + + + :/icons/images/setup.png:/icons/images/setup.png + - - - - - 410 - 10 - 336 - 96 - - - - Receiver Ports - - + - 20 + 25 25 - 296 - 56 + 686 + 96 - + -1 - - - - 0 - 0 - - - - UDP Port: - - - - @@ -1072,8 +946,8 @@ An extension given by the modules serial number will be attached. - - + + 0 @@ -1082,41 +956,33 @@ An extension given by the modules serial number will be attached. - 127 + 180 0 - Sets Receiver TCP Port -#rx_tcpport# + Sets the Receiver UDP IP +#rx_udpip# - - - - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - false - - - - - - 0 - - - 2000000000 - - - 0 + + none - + + + + Qt::Horizontal + + + + 40 + 20 + + + + + @@ -1160,94 +1026,7 @@ An extension given by the modules serial number will be attached. - - - - - - - 410 - 120 - 336 - 156 - - - - Receiver Parameters - - - - - 20 - 25 - 296 - 116 - - - - - -1 - - - - - - 0 - 0 - - - - - 180 - 0 - - - - Sets the Receiver Hostname, connects to it and gets the receiver mac address and eth. Sets some receiver parameters like file name, file dir, file index in receiver. -#rx_hostname# - - - none - - - - - - - - 0 - 0 - - - - UDP MAC: - - - - - - - - 0 - 0 - - - - - 180 - 0 - - - - Sets the Receiver UDP MAC -#rx_udpmac# - - - none - - - - + @@ -1260,19 +1039,6 @@ An extension given by the modules serial number will be attached. - - - - - 0 - 0 - - - - Online: - - - @@ -1286,30 +1052,7 @@ An extension given by the modules serial number will be attached. - - - - - 0 - 0 - - - - - 180 - 0 - - - - Sets the Receiver UDP IP -#rx_udpip# - - - none - - - - + @@ -1332,49 +1075,8 @@ An extension given by the modules serial number will be attached. - - - - - - - 10 - 120 - 336 - 156 - - - - Detector Parameters - - - - - 20 - 25 - 296 - 116 - - - - - -1 - - - - - - 0 - 0 - - - - Hostname / IP: - - - - - + + 0 @@ -1388,29 +1090,16 @@ An extension given by the modules serial number will be attached. - Sets the detector MAC to send packets to receiver -#detectormac# + Sets the Receiver UDP MAC +#rx_udpmac# - + none - - - - - 0 - 0 - - - - MAC: - - - - - + + 0 @@ -1419,29 +1108,42 @@ An extension given by the modules serial number will be attached. - 180 + 127 0 - Detector Hostname #hostname# + Sets Receiver TCP Port +#rx_tcpport# - + - + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false - + + + + 0 - - true + + 2000000000 + + + 0 - - + + 0 @@ -1454,7 +1156,7 @@ An extension given by the modules serial number will be attached. - + 0 @@ -1462,12 +1164,12 @@ An extension given by the modules serial number will be attached. - IP: + UDP Port: - - + + 0 @@ -1481,74 +1183,336 @@ An extension given by the modules serial number will be attached. - Sets the detector IP to send packets to receiver -#detectorip# + Sets the Receiver Hostname, connects to it and gets the receiver mac address and eth. Sets some receiver parameters like file name, file dir, file index in receiver. +#rx_hostname# - + none - - + + - + 0 0 - - <nobr>If the detector is online<br>#online#</nobr>< + + UDP MAC: - - - Offline - - - - - Online - - - + - 410 - 285 - 336 - 25 + 35 + 15 + 686 + 101 - - Set Receiver - - - - :/icons/images/start.png:/icons/images/start.png - - - - - - 10 - 285 - 336 - 25 - - - - Configure MAC - - - - :/icons/images/start.png:/icons/images/start.png - + + + -1 + + + + + + 0 + 0 + + + + + 180 + 0 + + + + <nobr>If the detector is online<br>#online#</nobr>< + + + + Offline + + + + + Online + + + + + + + + + 0 + 0 + + + + Stop Port: + + + + + + + + 0 + 0 + + + + Control Port: + + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + Sets the detector IP to send packets to receiver +#detectorip# + + + + + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + Sets the detector MAC to send packets to receiver +#detectormac# + + + + + + + + + + + 0 + 0 + + + + MAC: + + + + + + + + 0 + 0 + + + + + 108 + 0 + + + + Online: + + + + + + + + 0 + 0 + + + + + 108 + 0 + + + + Detector: + + + + + + + + 0 + 0 + + + + IP: + + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + + 16777215 + 16777215 + + + + Sets Control Port +#port# + + + + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + + 0 + + + 2000000000 + + + 0 + + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + Sets Stop Port +#stopport# + + + + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + + 0 + + + 2000000000 + + + 0 + + + + + boxRxr + gridLayoutWidget_7 + label_9 diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 72063f919..44b5ad4fb 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -510,7 +510,7 @@ - :/icons/images/remove.png:/icons/images/remove.png + :/icons/images/erase.png:/icons/images/erase.png @@ -585,7 +585,7 @@ - :/icons/images/add.png:/icons/images/add.png + :/icons/images/calculate.png:/icons/images/calculate.png @@ -780,7 +780,7 @@ 10 20 - 348 + 341 26 diff --git a/slsDetectorGui/images/calculate.png b/slsDetectorGui/images/calculate.png new file mode 100644 index 0000000000000000000000000000000000000000..49ac1f4b1edde0c731dc60fac54531ac07a1c358 GIT binary patch literal 833 zcmV-H1HSx;P)6XjpoM=gFqLihS!lFNL2J0duWH*_OLE;~Ycec{X&8caVx)2O9@FGOl zg3vC?l%$kFqGXt9n~GE0oC=l`%(>}0=c|pp2zue=`@Zv?_j#Y^dCy@oGBVUEl`0!R zkYN}ENo;OzLL?Hg-*kOvXNP^~a5zEyj$mtR>!Y=`wH2ngxVYM6GSxUdvxwU(g=9}O z+-^7Iayh$`7W#ZXT8xN@2!tX%J^jf1{JfnhDJe13*47$*+kOl?$8a_&6LWKONJ&Xy zi)n6bY=Fn(K`0dB4=bdmrXD2#lN7*MS664~n(T)%F%A2pWNOC*vos6wGgBLH8R{QP`V zSy|a#T1d>o_VzZ&4@waNfq*Tf9uQL@l}ZsA8ObJLkWTiEQwg;V4GniDTvOol_(+bE zV`yjyYPA|~J`dvJ2^BmZ4=W)yHa2V`G5I(F7^497jg5^}?)4QoR-8~JDKRiGfSjBh zyq)?0_2Dycxm+xOOePBhXtmmt9UUFROlfK9J;I=J%;P|`NDRfk1L*7PgGQr)bJYcf zG!Y963#^=H@4C_QybWB2gOr0wwvPJND@(%%gf6coEm}k z<7@O*x3lXN&4w3W*XNU{g!?4)bR*5Jtu0usRumKzg!MX|PE0ILqts%+%)|HKb9uOI zzW!d3jXl`n1x)B1PBkSz!L{U-EE&xG<09C!s7+;)1q9h*Pb+2pH=M7K>O=h#X z;%@+p#R77`b^%Z?5)u;d?Z*-VI{`fIe)@7cxFlhSyNAdbj|ttfe?65-B{%I{=IMB0 zjN2ax#S>3YWlO%HhQWV^&1MsHt=QVEqdga*1frkiS=x48=B4^yOP5X0&{!;d00000 LNkvXXu0mjfiE@6Y literal 0 HcmV?d00001 diff --git a/slsDetectorGui/images/setup.png b/slsDetectorGui/images/setup.png new file mode 100644 index 0000000000000000000000000000000000000000..f0323e56dde91bc0207e192f218fe708c8079213 GIT binary patch literal 605 zcmV-j0;2tiP)Y`goF)^44yMGF&=&L`0-p;Wy`OI1P5uodG(6n$H z7cO0z_2R|zth&0ozXT1)NY9YY&dI*X&c?{QLKBxp)l- z3JhXQPfgp-#m(uoY4euY?w;gwuDii(OmR8&-5wY9Y(@fxsh&AMzu1N|v`_U`FT zO;0a@iCbD)^7HcYhV0t4Yc5U$PRx_c6)|1b{^-S@drOxuH=R3g-cM}muo|$Toi)M1 zTw>n4_um<}U)G7pZaAvU$dFINS7i;$aSDU+);WJSNr1&rh zWCrn^QB@RFe(>ly!^XpZ5^Lu$EWj5|ClX zL>aKShB3k2MtnZQzuydJuD<)VYtfe;Js7@=Q>5|DgCU5Q7Z<38nvly)dne-&vIR^PE|m{_Wm< rnqf6i=nD{oqV5|Me@D{v7uf{>CyUmhTzF(#00000NkvXXu0mjfGm$YO literal 0 HcmV?d00001 diff --git a/slsDetectorGui/include/icons.qrc b/slsDetectorGui/include/icons.qrc index 3b912dce3..26f0b5da7 100644 --- a/slsDetectorGui/include/icons.qrc +++ b/slsDetectorGui/include/icons.qrc @@ -16,5 +16,7 @@ ../images/leftArrow.png ../images/rightArrow.png ../images/upload.png + ../images/setup.png + ../images/calculate.png diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index f8836e63a..919ca26f7 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -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
+ pos = 0; + while((pos = retval.find("\n", pos)) != string::npos){ + retval.replace(pos, 1, "
"); + pos += 1; + } + + retval.insert(0,""); + retval.append(""); + + //display message + qDefs::Message((MessageIndex)errorLevel,retval,"Main"); + } + + myDet->clearErrorMask(); + + return retval; + }; + + //------------------------------------------------------------------------------------------------------------------------------------------------- }; diff --git a/slsDetectorGui/include/qTabAdvanced.h b/slsDetectorGui/include/qTabAdvanced.h index 896f9f53f..05e5f6f3a 100644 --- a/slsDetectorGui/include/qTabAdvanced.h +++ b/slsDetectorGui/include/qTabAdvanced.h @@ -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 lblFromX; vector spinFromX; diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index 13a7dc1f5..a30ebce42 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -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 // diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 8a8e658dd..6a4428edd 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -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;igetNumberOfDetectors();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())); }