made updatereceiver to actually update client in parameters that it can

This commit is contained in:
Dhanya Maliakal 2017-07-03 17:37:24 +02:00
parent 99dad79572
commit f944d7cae4
7 changed files with 65 additions and 25 deletions

View File

@ -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

View File

@ -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){

View File

@ -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

View File

@ -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
//

View File

@ -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();
}
}

View File

@ -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) {

View File

@ -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