diff --git a/slsDetectorSoftware/gitInfo.txt b/slsDetectorSoftware/gitInfo.txt index b7206f074..03311906e 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/sls_detector_software.git Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git -Repsitory UUID: 5d22df1c472895035fdb21ec1104e749aaa41167 -Revision: 1431 -Branch: developer +Repsitory UUID: f296ac9eb68e7681675cad9943f5054eb7f8bdce +Revision: 1433 +Branch: updaterec Last Changed Author: Dhanya_Maliakal -Last Changed Rev: 1436 -Last Changed Date: 2017-06-29 17:10:10 +0200 +Last Changed Rev: 1438 +Last Changed Date: 2017-07-03 13:46:06 +0200 diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp index 4a472c281..24f8df951 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp @@ -5667,8 +5667,10 @@ int multiSlsDetector::setReceiverReadTimer(int time_in_ms){ return ret; } +int multiSlsDetector::getStreamingSocketsCreatedInClient() { + return dataSocketsStarted; +} -// only called from gui or that wants zmq data packets int multiSlsDetector::enableDataStreamingFromReceiver(int enable){ if(enable >= 0){ diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h index da7589cbe..cc7a14b52 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h @@ -1319,6 +1319,7 @@ class multiSlsDetector : public slsDetectorUtils { */ int setReceiverReadTimer(int time_in_ms=500); + /** * Get Streaming sockets created in client from reciever /returns 1 if sockets created, else 0 diff --git a/slsDetectorSoftware/slsDetector/gitInfoLib.h b/slsDetectorSoftware/slsDetector/gitInfoLib.h index 1afda5824..9fd4cffdd 100644 --- a/slsDetectorSoftware/slsDetector/gitInfoLib.h +++ b/slsDetectorSoftware/slsDetector/gitInfoLib.h @@ -1,11 +1,11 @@ //#define SVNPATH "" #define SVNURLLIB "git@git.psi.ch:sls_detectors_software/sls_detector_software.git" //#define SVNREPPATH "" -#define SVNREPUUIDLIB "5d22df1c472895035fdb21ec1104e749aaa41167" -//#define SVNREV 0x1436 +#define SVNREPUUIDLIB "f296ac9eb68e7681675cad9943f5054eb7f8bdce" +//#define SVNREV 0x1438 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTHLIB "Dhanya_Maliakal" -#define SVNREVLIB 0x1436 -#define SVNDATELIB 0x20170629 +#define SVNREVLIB 0x1438 +#define SVNDATELIB 0x20170703 // diff --git a/slsDetectorSoftware/slsDetector/slsDetector.cpp b/slsDetectorSoftware/slsDetector/slsDetector.cpp index d512c53f3..060c1bcfc 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetector.cpp @@ -6001,6 +6001,8 @@ string slsDetector::setReceiver(string receiverIP){ sendMultiDetectorSize(); setDetectorId(); setDetectorHostname(); + setUDPConnection(); + setFilePath(fileIO::getFilePath()); setFileName(fileIO::getFileName()); setFileIndex(fileIO::getFileIndex()); @@ -6013,6 +6015,7 @@ string slsDetector::setReceiver(string receiverIP){ imask = parentDet->enableOverwriteMask(); pthread_mutex_unlock(&ms); overwriteFile(imask); + if ((thisDetector->timerValue[FRAME_NUMBER]*thisDetector->timerValue[CYCLES_NUMBER])>1) setFrameIndex(0); else @@ -6026,13 +6029,23 @@ string slsDetector::setReceiver(string receiverIP){ setFlippedData(X,-1); activate(-1); } - //if (parentDet->getStreamingSocketsCreatedInClient()) - //std::cout << "***********************************dataStreaming:" << parentDet->enableDataStreamingFromReceiver(-1) << endl << endl; - //parentDet->enableDataStreamingFromReceiver(parentDet->enableDataStreamingFromReceiver(-1)); - //set scan tag - setUDPConnection(); + if(thisDetector->myDetectorType == EIGER) enableTenGigabitEthernet(thisDetector->tenGigaEnable); + + // data streaming + int clientSockets = parentDet->getStreamingSocketsCreatedInClient(); + int recSockets = enableDataStreamingFromReceiver(-1); + if(clientSockets != recSockets) { + pthread_mutex_lock(&ms); + if(clientSockets) + printf("Enabling Data Streaming\n"); + else + printf("Disabling Data Streaming\n"); + // push client state to receiver + parentDet->enableDataStreamingFromReceiver(clientSockets); + pthread_mutex_unlock(&ms); + } } } @@ -8107,21 +8120,43 @@ int slsDetector::updateReceiverNoWait() { cout << "Updating receiver last modified by " << lastClientIP << std::endl; #endif - n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind)); - pthread_mutex_lock(&ms); - fileIO::setFileIndex(ind); - pthread_mutex_unlock(&ms); - + // filepath n += dataSocket->ReceiveDataOnly(path,MAX_STR_LENGTH); pthread_mutex_lock(&ms); fileIO::setFilePath(path); pthread_mutex_unlock(&ms); + // filename n += dataSocket->ReceiveDataOnly(path,MAX_STR_LENGTH); pthread_mutex_lock(&ms); fileIO::setFileName(path); pthread_mutex_unlock(&ms); + // index + n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind)); + pthread_mutex_lock(&ms); + fileIO::setFileIndex(ind); + pthread_mutex_unlock(&ms); + + //file format + n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind)); + pthread_mutex_lock(&ms); + fileIO::setFileFormat(ind); + pthread_mutex_unlock(&ms); + + // file write enable + n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind)); + pthread_mutex_lock(&ms); + parentDet->enableWriteToFileMask(ind); + pthread_mutex_unlock(&ms); + + // file overwrite enable + n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind)); + pthread_mutex_lock(&ms); + parentDet->enableOverwriteMask(ind); + pthread_mutex_unlock(&ms); + + if (!n) printf("n: %d\n", n); return OK; @@ -8141,12 +8176,14 @@ int slsDetector::updateReceiver() { if (connectData() == OK){ dataSocket->SendDataOnly(&fnum,sizeof(fnum)); dataSocket->ReceiveDataOnly(&ret,sizeof(ret)); - if (ret!=FAIL) - updateReceiverNoWait(); - else{ + if (ret == FAIL) { dataSocket->ReceiveDataOnly(mess,sizeof(mess)); std::cout<< "Receiver returned error: " << mess << std::endl; } + else + updateReceiverNoWait(); + + //if ret is force update, do not update now as client is updating receiver currently disconnectData(); } } diff --git a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp index 43e080e76..a58d1e861 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp @@ -1324,7 +1324,7 @@ string slsDetectorCommand::cmdAcquire(int narg, char *args[], int action) { myDet->setOnline(ONLINE_FLAG); if (myDet->setReceiverOnline(ONLINE_FLAG) == ONLINE_FLAG) { - //if it was not off + // command line: must be off, if receiver on or there was -1, then if (myDet->enableDataStreamingFromReceiver(-1) != 0){ //switch it off, if error if (myDet->enableDataStreamingFromReceiver(0) != 0) { diff --git a/slsDetectorSoftware/slsDetectorClient/Makefile b/slsDetectorSoftware/slsDetectorClient/Makefile index d55b1ac5a..44ccbf7e4 100644 --- a/slsDetectorSoftware/slsDetectorClient/Makefile +++ b/slsDetectorSoftware/slsDetectorClient/Makefile @@ -4,7 +4,7 @@ CFLAGS= -DC_ONLY #FLAGS=-DVERBOSE #ASM=$(shell echo "/lib/modules/`uname -r`/build/include") -INCLUDES?= -I../commonFiles -I../slsDetector -I ../MySocketTCP -I../usersFunctions -I../multiSlsDetector -I../slsDetectorAnalysis -I../slsReceiverInterface -I$(shell echo "/lib/modules/`uname -r`/build/include") +INCLUDES?= -I../commonFiles -I../slsDetector -I ../MySocketTCP -I../usersFunctions -I../multiSlsDetector -I../slsDetectorAnalysis -I../slsReceiverInterface -I ../../slsReceiverSoftware/include -I$(shell echo "/lib/modules/`uname -r`/build/include") DESTDIR ?= ../../bin BIN=$(DESTDIR) LIBS?= -L$(DESTDIR) -lSlsDetector