changes for external gui

This commit is contained in:
Dhanya Maliakal
2017-08-23 19:06:40 +02:00
parent 19d973f5d6
commit 0bea688a83
5 changed files with 54 additions and 29 deletions

View File

@ -1894,7 +1894,7 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
Get external gui flag from shared memory
\returns external gui flag
*/
void getExternalGuiFlag();
bool getExternalGuiFlag();
protected:

View File

@ -256,9 +256,9 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
*/
/*! \page config
- <b> datastream </b>enables/disables the 0MQ data stream (0MQ threads created) from receiver to client. \c Returns \c (int)
- <b> externalgui </b>sets/gets external gui flag. 1 sets and enables the 0MQ data stream (0MQ threads created) from receiver to client, while 0 unsets and disables. \c Returns \c (int)
*/
descrToFuncMap[i].m_pFuncName="datastream"; //
descrToFuncMap[i].m_pFuncName="externalgui"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDataStream;
i++;
@ -2296,8 +2296,9 @@ string slsDetectorCommand::cmdAcquire(int narg, char *args[], int action) {
myDet->setOnline(ONLINE_FLAG);
myDet->setReceiverOnline(ONLINE_FLAG);
/*if (myDet->setReceiverOnline(ONLINE_FLAG) == ONLINE_FLAG) {
if (myDet->getExternalGuiFlag())
myDet->setReceiverOnline(ONLINE_FLAG);
else if (myDet->setReceiverOnline(ONLINE_FLAG) == ONLINE_FLAG) {
// command line: must be off, if receiver on or there was -1, then
if (myDet->enableDataStreamingFromReceiver(-1) != 0){
//switch it off, if error
@ -2305,7 +2306,7 @@ string slsDetectorCommand::cmdAcquire(int narg, char *args[], int action) {
return string("could not disable data streaming in receiver\n");
}
}
}*/
}
if(myDet->acquire() == FAIL)
return string("acquire unsuccessful");
@ -2471,10 +2472,20 @@ string slsDetectorCommand::cmdDataStream(int narg, char *args[], int action) {
if (action==PUT_ACTION) {
if (!sscanf(args[1],"%d",&ival))
return string ("cannot scan datastream mode");
return string ("cannot scan externalgui mode");
bool bval=ival>0?true:false;
bool oldval = myDet->getExternalGuiFlag();
myDet->setExternalGuiFlag(bval);
myDet->enableDataStreamingFromReceiver(ival);
}
sprintf(ans,"%d",myDet->enableDataStreamingFromReceiver());
int retval = myDet->getExternalGuiFlag();
//if external gui on and datastreaming off
if (retval && !myDet->enableDataStreamingFromReceiver()) {
retval=-1;
printf("Error: data streaming in receiver is switched off while external gui flag in shared memory is off.\n");
}
sprintf(ans,"%d",myDet->getExternalGuiFlag());
return string(ans);
}
@ -2483,9 +2494,9 @@ string slsDetectorCommand::helpDataStream(int narg, char *args[], int action) {
ostringstream os;
if (action==GET_ACTION || action==HELP_ACTION)
os << string("datastream \t gets if zmq data stream from receiver is enabled. \n");
os << string("externalgui \t gets external gui flag. 1/0 means the 0MQ data stream (0MQ threads created) from receiver to client is enabled/disabled. -1 for inconsistency. \n");
if (action==PUT_ACTION || action==HELP_ACTION)
os << string("datastream i\t enables/disables the zmq data stream from receiver. \n");
os << string("externalgui i\t sets external gui flag. 1/0 means the 0MQ data stream (0MQ threads created) from receiver to client is enabled/disabled. \n");
return os.str();
}
@ -5870,7 +5881,7 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
if (action==PUT_ACTION) {
if(!strcasecmp(args[1],"start")) {
//to ensure data streaming enable is the same across client and receiver
/*if (receivers == ONLINE_FLAG) {
if ((!myDet->getExternalGuiFlag()) && (receivers == ONLINE_FLAG)) {
//if it was not off
if (myDet->enableDataStreamingFromReceiver(-1) != 0){
//switch it off, if error
@ -5878,7 +5889,7 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
return string("could not disable data streaming in receiver\n");
}
}
}*/
}
myDet->startReceiver();
}
else if(!strcasecmp(args[1],"stop")){

View File

@ -846,6 +846,19 @@ virtual int setReceiverFifoDepth(int i = -1)=0;
*/
virtual bool getAcquiringFlag() = 0;
/**
Set external gui flag in shared memory
\param b set external gui flag
*/
virtual void setExternalGuiFlag(bool b=false) = 0;
/**
Get external gui flag from shared memory
\returns external gui flag
*/
virtual bool getExternalGuiFlag() = 0;