diff --git a/cmk.sh b/cmk.sh index 7f4c7fda1..b2d790908 100755 --- a/cmk.sh +++ b/cmk.sh @@ -60,6 +60,7 @@ while getopts ":bchd:j:trge" opt ; do b) echo "Building of CMake files Required" REBUILD=1 + CLEAN=1 ;; c) echo "Clean Required" @@ -69,6 +70,7 @@ while getopts ":bchd:j:trge" opt ; do echo "Building of CMake files with HDF5 option Required" HDF5=1 REBUILD=1 + CLEAN=1 ;; d) echo "New HDF5 directory: $OPTARG" @@ -82,16 +84,19 @@ while getopts ":bchd:j:trge" opt ; do echo "Compiling Options: Text Client" TEXTCLIENT=1 REBUILD=1 + CLEAN=1 ;; r) echo "Compiling Options: Receiver" RECEIVER=1 REBUILD=1 + CLEAN=1 ;; g) echo "Compiling Options: GUI" GUI=1 REBUILD=1 + CLEAN=1 ;; e) echo "Compiling Options: Debug" diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp index ecc9c213c..4f3d37deb 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp @@ -4952,6 +4952,9 @@ int multiSlsDetector::createReceivingDataSockets(const bool destroy) { cout << "Destroyed Receiving Data Socket(s)" << endl; return OK; } + if (client_downstream) { + return OK; + } cprintf(MAGENTA, "Going to create data sockets\n"); diff --git a/slsDetectorSoftware/slsDetector/slsDetector.cpp b/slsDetectorSoftware/slsDetector/slsDetector.cpp index f21813895..bab1001ee 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetector.cpp @@ -3242,13 +3242,13 @@ string slsDetector::getSettingsDir() { return std::string(thisDetector->settingsDir); } string slsDetector::setSettingsDir(string s) { - sprintf(thisDetector->settingsDir, s.c_str()); return thisDetector->settingsDir; + sprintf(thisDetector->settingsDir, "%s", s.c_str()); return thisDetector->settingsDir; } string slsDetector::getCalDir() { return thisDetector->calDir; } string slsDetector::setCalDir(string s) { - sprintf(thisDetector->calDir, s.c_str()); return thisDetector->calDir; + sprintf(thisDetector->calDir, "%s", s.c_str()); return thisDetector->calDir; } @@ -4432,7 +4432,7 @@ int64_t slsDetector::getTimeLeft(timerIndex index, int imod) { int fnum=F_GET_TIME_LEFT; - int64_t retval; + int64_t retval = FAIL; char mess[MAX_STR_LENGTH]=""; int ret=OK; @@ -6057,8 +6057,10 @@ int slsDetector::setUDPConnection() { std::cout << "could not configure mac" << endl; } } - }else + }else{ ret=FAIL; + setErrorMask((getErrorMask())|(COULD_NOT_CONFIGURE_MAC)); + } #ifdef VERBOSE printReceiverConfiguration(); #endif diff --git a/slsDetectorSoftware/slsDetector/slsDetectorBase.h b/slsDetectorSoftware/slsDetector/slsDetectorBase.h index e4a25d621..b6c22a93d 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorBase.h +++ b/slsDetectorSoftware/slsDetector/slsDetectorBase.h @@ -846,6 +846,7 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0; case RUNNING: return std::string("running");\ case TRANSMITTING: return std::string("data"); \ case RUN_FINISHED: return std::string("finished"); \ + case STOPPED: return std::string("stopped"); \ default: return std::string("idle"); \ }}; diff --git a/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp b/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp index e81ee57f5..a781915ad 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp @@ -64,9 +64,12 @@ int slsDetectorUtils::acquire(int delflag){ if(!receiver){ setDetectorIndex(-1); } - + + pthread_mutex_lock(&mg); int nc=setTimer(CYCLES_NUMBER,-1); int nf=setTimer(FRAME_NUMBER,-1); + pthread_mutex_unlock(&mg); + if (nc==0) nc=1; if (nf==0) nf=1; int multiframe = nc*nf; diff --git a/slsDetectorSoftware/slsDetectorAnalysis/fileIO.h b/slsDetectorSoftware/slsDetectorAnalysis/fileIO.h index 2bc416991..cd20223f2 100644 --- a/slsDetectorSoftware/slsDetectorAnalysis/fileIO.h +++ b/slsDetectorSoftware/slsDetectorAnalysis/fileIO.h @@ -93,7 +93,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase { */ virtual std::string setFilePath(std::string s) { pthread_mutex_lock(&mf); - sprintf(filePath, s.c_str()); + sprintf(filePath, "%s", s.c_str()); pthread_mutex_unlock(&mf); return std::string(filePath); }; diff --git a/slsReceiverSoftware/CMakeLists.txt b/slsReceiverSoftware/CMakeLists.txt index adc1b2465..f501f148e 100644 --- a/slsReceiverSoftware/CMakeLists.txt +++ b/slsReceiverSoftware/CMakeLists.txt @@ -105,7 +105,5 @@ install(TARGETS slsReceiverShared slsReceiverStatic slsReceiver PUBLIC_HEADER DESTINATION include) -#install(FILES ${ZMQ_STATIC_ARCHIVE} -#DESTINATION lib) -install(FILES -DESTINATION lib) \ No newline at end of file +install(FILES ${ZMQ_STATIC_ARCHIVE} +DESTINATION lib) diff --git a/slsReceiverSoftware/include/receiver_defs.h b/slsReceiverSoftware/include/receiver_defs.h index 7d34bef05..ee03fcbc4 100755 --- a/slsReceiverSoftware/include/receiver_defs.h +++ b/slsReceiverSoftware/include/receiver_defs.h @@ -21,7 +21,7 @@ #define FILE_BUFFER_SIZE (16*1024*1024) //16mb //fifo -#define FIFO_HEADER_NUMBYTES 4 +#define FIFO_HEADER_NUMBYTES 8 //hdf5 diff --git a/slsReceiverSoftware/src/main.cpp b/slsReceiverSoftware/src/main.cpp index 2b2166d83..b8cb624d8 100644 --- a/slsReceiverSoftware/src/main.cpp +++ b/slsReceiverSoftware/src/main.cpp @@ -16,12 +16,13 @@ #include //wait #include //usleep #include +#include +sem_t semaphore; -bool keeprunning; void sigInterruptHandler(int p){ - keeprunning = false; + sem_post(&semaphore); } /* @@ -65,7 +66,7 @@ void GetData(char* metadata, char* datapointer, uint32_t datasize, void* p){ int main(int argc, char *argv[]) { - keeprunning = true; + sem_init(&semaphore,1,0); cprintf(BLUE,"Created [ Tid: %ld ]\n", (long)syscall(SYS_gettid)); // Catch signal SIGINT to close files and call destructors properly @@ -148,8 +149,8 @@ int main(int argc, char *argv[]) { FILE_LOG(logINFO) << "Ready ... "; cprintf(RESET, "\n[ Press \'Ctrl+c\' to exit ]\n"); - while(keeprunning) - pause(); + sem_wait(&semaphore); + sem_destroy(&semaphore); delete receiver; cprintf(BLUE,"Exiting [ Tid: %ld ]\n", (long)syscall(SYS_gettid));