bug fix: enabledatastreaming get should return shared memory variable and not from receiver, bug fix:zmq buffering when acquire form command line, stopping sockets when command line acquire or receiver start, restarting sockets at change of port numbers and a refresh button for the same

This commit is contained in:
Dhanya Maliakal 2017-11-21 13:39:12 +01:00
parent a0c014eb7d
commit 2cc11f1ff0
2 changed files with 40 additions and 19 deletions

View File

@ -8566,31 +8566,35 @@ int slsDetector::setReceiverReadTimer(int time_in_ms){
int slsDetector::enableDataStreamingFromReceiver(int enable){
int fnum=F_STREAM_DATA_FROM_RECEIVER;
int ret = FAIL;
int retval=-1;
int arg = enable;
if (enable >= 0) {
int fnum=F_STREAM_DATA_FROM_RECEIVER;
int ret = FAIL;
int retval=-1;
int arg = enable;
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
#ifdef VERBOSE
std::cout << "***************Sending Data Streaming in Receiver " << arg << std::endl;
std::cout << "***************Sending Data Streaming in Receiver " << arg << std::endl;
#endif
if (connectData() == OK){
ret=thisReceiver->sendInt(fnum,retval,arg);
disconnectData();
if (connectData() == OK){
ret=thisReceiver->sendInt(fnum,retval,arg);
disconnectData();
}
if(ret==FAIL) {
retval = -1;
cout << "could not set data streaming in receiver to " << enable <<" Returned:" << retval << endl;
setErrorMask((getErrorMask())|(DATA_STREAMING));
} else {
thisDetector->receiver_datastream = retval;
if(ret==FORCE_UPDATE)
updateReceiver();
}
}
if(ret==FAIL)
retval = -1;
if(ret==FORCE_UPDATE)
updateReceiver();
}
if ((enable > 0) && (retval != enable)){
cout << "could not set data streaming in receiver to " << enable <<" Returned:" << retval << endl;
setErrorMask((getErrorMask())|(DATA_STREAMING));
}
return retval;
return thisDetector->receiver_datastream;
}

View File

@ -2316,6 +2316,15 @@ string slsDetectorCommand::cmdAcquire(int narg, char *args[], int action) {
myDet->setOnline(ONLINE_FLAG);
int r_online = myDet->setReceiverOnline(ONLINE_FLAG);
// switch off data streaming to prevent extra images in zmq gui buffer
if (r_online == ONLINE_FLAG) {
if (myDet->enableDataStreamingFromReceiver() != 0) {
if (myDet->enableDataStreamingFromReceiver(0) != 0) {
std::cout << "Error: Unable to switch off data streaming in receiver. If GUI on, extra image(s) in zmq GUI buffer" << std::endl;
}
}
}
if(myDet->acquire() == FAIL)
return string("acquire unsuccessful");
if(r_online){
@ -5882,10 +5891,18 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
myDet->setOnline(ONLINE_FLAG);
myDet->setReceiverOnline(ONLINE_FLAG);
int r_online = myDet->setReceiverOnline(ONLINE_FLAG);
if(cmd=="receiver"){
if (action==PUT_ACTION) {
// switch off data streaming to prevent extra images in zmq gui buffer
if (r_online == ONLINE_FLAG) {
if (myDet->enableDataStreamingFromReceiver() != 0) {
if (myDet->enableDataStreamingFromReceiver(0) != 0) {
std::cout << "Error: Unable to switch off data streaming in receiver. If GUI on, extra image(s) in zmq GUI buffer" << std::endl;
}
}
}
if(!strcasecmp(args[1],"start"))
myDet->startReceiver();
else if(!strcasecmp(args[1],"stop"))