diff --git a/slsDetectorGui/gitInfo.txt b/slsDetectorGui/gitInfo.txt index 1216c199d..1eeaeed15 100644 --- a/slsDetectorGui/gitInfo.txt +++ b/slsDetectorGui/gitInfo.txt @@ -1,9 +1,9 @@ Path: slsDetectorsPackage/slsDetectorGui URL: origin git@git.psi.ch:sls_detectors_software/slsDetectorPackage.git Repository Root: origin git@git.psi.ch:sls_detectors_software/slsDetectorPackage.git -Repsitory UUID: b498043ea612fa3148bf1d7ea2a39c46092addf8 -Revision: 437 +Repsitory UUID: c4a242e10a4aafd102cc9a2a7ddae4ac92b8ba99 +Revision: 439 Branch: 3.0.1 Last Changed Author: Dhanya_Maliakal -Last Changed Rev: 3185 -Last Changed Date: 2017-12-06 08:43:21.000000002 +0100 ./src/qTabSettings.cpp +Last Changed Rev: 3187 +Last Changed Date: 2017-12-06 08:45:14.000000002 +0100 ./src/qTabSettings.cpp diff --git a/slsDetectorGui/include/gitInfoGui.h b/slsDetectorGui/include/gitInfoGui.h index 606cab391..61d748cf1 100644 --- a/slsDetectorGui/include/gitInfoGui.h +++ b/slsDetectorGui/include/gitInfoGui.h @@ -1,6 +1,6 @@ #define GITURL "git@git.psi.ch:sls_detectors_software/slsDetectorPackage.git" -#define GITREPUUID "b498043ea612fa3148bf1d7ea2a39c46092addf8" +#define GITREPUUID "c4a242e10a4aafd102cc9a2a7ddae4ac92b8ba99" #define GITAUTH "Dhanya_Maliakal" -#define GITREV 0x3185 +#define GITREV 0x3187 #define GITDATE 0x20171206 -#define GITBRANCH "blabla" +#define GITBRANCH "3.0.1" diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index 7574380f5..0af189fc0 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -55,10 +55,11 @@ public: * This is mainly used to create detector object and all the tabs * @param argc number of command line arguments for server options * @param argv server options - * @param app the qapplication + * @param app the qapplication3 + * @param ret OK or FAIL of constructor (from command line arguments) * @param parent makes the parent window 0 by default * */ - qDetectorMain(int argc, char **argv, QApplication *app, QWidget *parent = 0); + qDetectorMain(int argc, char **argv, QApplication *app, int& ret, QWidget *parent = 0); /**Destructor * */ diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 2628b2f52..de0b09418 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -36,7 +36,10 @@ int main (int argc, char **argv) { // QApplication *theApp = new QApplication(argc, argv); theApp->setStyle(new QPlastiqueStyle);//not default when desktop is windows theApp->setWindowIcon(QIcon( ":/icons/images/mountain.png" )); - qDetectorMain *det=new qDetectorMain(argc, argv, theApp,0); + int ret = 1; + qDetectorMain *det=new qDetectorMain(argc, argv, theApp,ret,0); + if (ret == 1) + return EXIT_FAILURE; det->show(); //theApp->connect( theApp, SIGNAL(lastWindowClosed()), theApp, SLOT(quit())); return theApp->exec(); @@ -46,75 +49,82 @@ int main (int argc, char **argv) { //------------------------------------------------------------------------------------------------------------------------------------------------- -qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget *parent) : +qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, int& ret, QWidget *parent) : QMainWindow(parent), theApp(app),myDet(0),detID(0),myPlot(0),tabs(0),isDeveloper(0){ -// bool found; - int c; - string configFName = ""; - optind=1; - // Getting all the command line arguments - while(1) { - static struct option long_options[] = { + + // options + string fname = ""; + int64_t tempval = 0; + + //parse command line for config + static struct option long_options[] = { + // These options set a flag. + //{"verbose", no_argument, &verbose_flag, 1}, + // These options don’t set a flag. We distinguish them by their indices. { "developer", no_argument, 0, 'd' }, { "config", required_argument, 0, 'f' }, { "id", required_argument, 0, 'i' }, - { "f", required_argument, 0, 'f' }, + {"version", no_argument, 0, 'v'}, { "help", no_argument, 0, 'h' }, { 0, 0, 0, 0 } - }; - c = getopt_long (argc, argv, "hdf:i:", long_options, NULL); - if (c == -1) break; + }; + + + // getopt_long stores the option index here. + int option_index = 0; + int c = 0; + + while ( c != -1 ){ + c = getopt_long (argc, argv, "hvdf:i:", long_options, &option_index); + + // Detect the end of the options. + if (c == -1) + break; + + switch(c){ + + case 'f': + fname=string(optarg); +#ifdef VERYVERBOSE + cout << long_options[option_index].name << " " << optarg << endl; +#endif + break; + + case 'd' : + isDeveloper = 1; + break; + + case 'i' : + detID=atoi(optarg); + break; + + case 'v': + tempval = GITREV; + tempval = (tempval <<32) | GITDATE; + cout << "SLS Detector GUI " << GITBRANCH << " (0x" << hex << tempval << ")" << endl; + return; + + case 'h': + default: + string help_message = "\n" + + string(argv[0]) + "\n" + + "Usage: " + string(argv[0]) + " [arguments]\n" + + "Possible arguments are:\n" + + "\t-d, --developer : Enables the developer tab\n" + + "\t-f, --f, --config : Loads config from file\n" + + "\t-i, --id : Sets the multi detector id to i. Default: 0. Required \n" + + "\t only when more than one multi detector object is needed.\n\n"; + cout << help_message << endl; + return; - switch (c) { - case 'd' : - isDeveloper=1; - break; - case 'f' : - configFName=string(optarg); - break; - case 'i' : - detID=atoi(optarg); - break; - case 'h' : - default: - cout << endl; - cout << "\t" << argv[0] << " [ARGUMENT]..." << endl; - cout << endl; - cout << "Possible Arguments are:" << endl; - cout << "\t-d, --developer \t\t : \t Enables the developer tab" << endl; - cout << "\t-f, --f, --config fname\t\t : \t Loads config file fname" << endl; - cout << "\t-i, --id NUMBER \t\t : \t Sets the multi detector id to NUMBER (the default is 0). " - "Required only when more than one multi detector object is needed." << endl; - exit(-1); } } - if (optind < argc) { - cout << "invalid option, try --help" << endl; - exit(-1); - } -/* - for(int iarg=1; iarg gitInfo.txt cd .. ./genVersionHeader.sh $SPECDIR/gitInfo.txt $SPECDIR/$TMPFILE $SPECDIR/$INCLFILE cd $WD -fi +#fi diff --git a/slsDetectorSoftware/gitInfo.txt b/slsDetectorSoftware/gitInfo.txt index 2b9da45f6..82b2afd33 100644 --- a/slsDetectorSoftware/gitInfo.txt +++ b/slsDetectorSoftware/gitInfo.txt @@ -1,9 +1,9 @@ Path: slsDetectorsPackage/slsDetectorSoftware URL: origin git@git.psi.ch:sls_detectors_software/slsDetectorPackage.git Repository Root: origin git@git.psi.ch:sls_detectors_software/slsDetectorPackage.git -Repsitory UUID: b498043ea612fa3148bf1d7ea2a39c46092addf8 -Revision: 1627 +Repsitory UUID: c4a242e10a4aafd102cc9a2a7ddae4ac92b8ba99 +Revision: 1629 Branch: 3.0.1 Last Changed Author: Dhanya_Maliakal -Last Changed Rev: 3185 -Last Changed Date: 2017-12-06 08:43:21.000000002 +0100 ./slsDetector/slsDetectorUtils.h +Last Changed Rev: 3187 +Last Changed Date: 2017-12-06 19:00:50.000000002 +0100 ./threadFiles/ThreadPool.o diff --git a/slsDetectorSoftware/slsDetector/gitInfoLib.h b/slsDetectorSoftware/slsDetector/gitInfoLib.h index 606cab391..61d748cf1 100644 --- a/slsDetectorSoftware/slsDetector/gitInfoLib.h +++ b/slsDetectorSoftware/slsDetector/gitInfoLib.h @@ -1,6 +1,6 @@ #define GITURL "git@git.psi.ch:sls_detectors_software/slsDetectorPackage.git" -#define GITREPUUID "b498043ea612fa3148bf1d7ea2a39c46092addf8" +#define GITREPUUID "c4a242e10a4aafd102cc9a2a7ddae4ac92b8ba99" #define GITAUTH "Dhanya_Maliakal" -#define GITREV 0x3185 +#define GITREV 0x3187 #define GITDATE 0x20171206 -#define GITBRANCH "blabla" +#define GITBRANCH "3.0.1" diff --git a/slsDetectorSoftware/slsDetectorClient/sls_detector_client.cpp b/slsDetectorSoftware/slsDetectorClient/sls_detector_client.cpp index bed9b9848..e2fefcb21 100644 --- a/slsDetectorSoftware/slsDetectorClient/sls_detector_client.cpp +++ b/slsDetectorSoftware/slsDetectorClient/sls_detector_client.cpp @@ -1,4 +1,5 @@ #include "multiSlsDetectorClient.h" +#include "gitInfoLib.h" #include @@ -7,6 +8,15 @@ using namespace std; int main(int argc, char *argv[]) { + for (int i = 1; i < argc; ++i ) { + if (!(strcmp (argv[i],"--version")) || !(strcmp (argv[i],"-v"))) { + int64_t tempval = GITREV; + tempval = (tempval <<32) | GITDATE; + cout << argv[0] << " " << GITBRANCH << " (0x" << hex << tempval << ")" << endl; + return 0; + } + } + #ifdef PUT int action=slsDetectorDefs::PUT_ACTION; #endif diff --git a/slsDetectorSoftware/updateGitVersion.sh b/slsDetectorSoftware/updateGitVersion.sh index a1447f181..70fee75d4 100755 --- a/slsDetectorSoftware/updateGitVersion.sh +++ b/slsDetectorSoftware/updateGitVersion.sh @@ -20,9 +20,9 @@ OLDDATE=$(more $INCLFILE | grep '#define GITDATE' | awk '{print $3}') #update INCLFILE if changes -if [ "$OLDDATE" != "$NEWDATE" ]; then +#if [ "$OLDDATE" != "$NEWDATE" ]; then echo Path: ${MAINDIR}/${SPECDIR} $'\n'URL: ${GITREPO} $'\n'Repository Root: ${GITREPO} $'\n'Repsitory UUID: ${REPUID} $'\n'Revision: ${FOLDERREV} $'\n'Branch: ${BRANCH} $'\n'Last Changed Author: ${AUTH1}_${AUTH2} $'\n'Last Changed Rev: ${REV} $'\n'Last Changed Date: ${RDATE} > gitInfo.txt cd .. ./genVersionHeader.sh $SPECDIR/gitInfo.txt $SPECDIR/$TMPFILE $SPECDIR/$INCLFILE cd $WD -fi \ No newline at end of file +#fi \ No newline at end of file diff --git a/slsReceiverSoftware/src/slsReceiver.cpp b/slsReceiverSoftware/src/slsReceiver.cpp index 1276bf066..baae6b1c8 100644 --- a/slsReceiverSoftware/src/slsReceiver.cpp +++ b/slsReceiverSoftware/src/slsReceiver.cpp @@ -23,37 +23,37 @@ slsReceiver::slsReceiver(int argc, char *argv[], int &success): udp_interface (NULL) { success=OK; - + // options map configuration_map; int tcpip_port_no = 1954; string fname = ""; + int64_t tempval = 0; //parse command line for config static struct option long_options[] = { - // These options set a flag. - //{"verbose", no_argument, &verbose_flag, 1}, - // These options don’t set a flag. We distinguish them by their indices. - {"config", required_argument, 0, 'f'}, - {"rx_tcpport", required_argument, 0, 't'}, - {"version", no_argument, 0, 'v'}, - {"help", no_argument, 0, 'h'}, - {0, 0, 0, 0} - }; + // These options set a flag. + //{"verbose", no_argument, &verbose_flag, 1}, + // These options don’t set a flag. We distinguish them by their indices. + {"config", required_argument, 0, 'f'}, + {"rx_tcpport", required_argument, 0, 't'}, + {"version", no_argument, 0, 'v'}, + {"help", no_argument, 0, 'h'}, + {0, 0, 0, 0} + }; + + // getopt_long stores the option index here. int option_index = 0; - int c=0; - optind = 1; - - int64_t tempval = 0; + int c = 0; while ( c != -1 ){ c = getopt_long (argc, argv, "hvf:t:", long_options, &option_index); - + // Detect the end of the options. if (c == -1) break; - + switch(c){ case 'f': @@ -63,6 +63,10 @@ slsReceiver::slsReceiver(int argc, char *argv[], int &success): #endif break; + case 't': + sscanf(optarg, "%d", &tcpip_port_no); + break; + case 'v': tempval = GITREV; tempval = (tempval <<32) | GITDATE; @@ -70,20 +74,20 @@ slsReceiver::slsReceiver(int argc, char *argv[], int &success): success = FAIL; // to exit break; - case 't': - sscanf(optarg, "%d", &tcpip_port_no); - break; - case 'h': - string help_message = "\nSLS Receiver Server\n\n"; - help_message += "Usage: slsReceiver [arguments]\nPossible arguments are:\n"; - help_message += "\t-f, --config: Configuration filename\n"; - help_message += "\t-t, --rx_tcpport: TCP Port with the client. Default: 1954.\n" - "\t Required for multiple receivers\n\n"; + default: + string help_message = "\n" + + string(argv[0]) + "\n" + + "Usage: " + string(argv[0]) + " [arguments]\n" + + "Possible arguments are:\n" + + "\t-f, --config : Loads config from file\n" + + "\t-t, --rx_tcpport : TCP Communication Port with client. \n" + + "\t Default: 1954. Required for multiple \n" + + "\t receivers\n\n"; FILE_LOG(logINFO) << help_message << endl; break; - + } } @@ -95,7 +99,7 @@ slsReceiver::slsReceiver(int argc, char *argv[], int &success): } catch(...){ FILE_LOG(logERROR) << "Coult not open configuration file " << fname ; - success = FAIL; + success = FAIL; } }