mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 15:00:02 +02:00
changes for external gui
This commit is contained in:
parent
19d973f5d6
commit
0bea688a83
@ -3590,11 +3590,11 @@ string multiSlsDetector::getNetworkParameter(networkParameter p) {
|
||||
string multiSlsDetector::setNetworkParameter(networkParameter p, string s){
|
||||
|
||||
// disable data streaming before changing zmq port (but only if they were on)
|
||||
/*int prev_streaming = 0;*/
|
||||
// if (p == RECEIVER_STREAMING_PORT) {
|
||||
/*prev_streaming = getStreamingSocketsCreatedInClient();*/
|
||||
// enableDataStreamingFromReceiver(0);
|
||||
// }
|
||||
int prev_streaming = 0;
|
||||
if (p == RECEIVER_STREAMING_PORT) {
|
||||
prev_streaming = getStreamingSocketsCreatedInClient();
|
||||
enableDataStreamingFromReceiver(0);
|
||||
}
|
||||
|
||||
if (s.find('+')==string::npos) {
|
||||
|
||||
@ -3647,11 +3647,11 @@ string multiSlsDetector::setNetworkParameter(networkParameter p, string s){
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
|
||||
//enable data streaming if it was on
|
||||
if (p == RECEIVER_STREAMING_PORT && prev_streaming)
|
||||
enableDataStreamingFromReceiver(1);
|
||||
*/
|
||||
|
||||
return getNetworkParameter(p);
|
||||
|
||||
}
|
||||
@ -5874,8 +5874,10 @@ int multiSlsDetector::getStreamingSocketsCreatedInClient() {
|
||||
|
||||
int multiSlsDetector::enableDataStreamingFromReceiver(int enable){
|
||||
|
||||
/* if(enable >= 0){
|
||||
|
||||
//create client sockets only if no external gui
|
||||
if (!thisMultiDetector->externalgui) {
|
||||
if(enable >= 0){
|
||||
|
||||
//destroy data threads
|
||||
if(dataSocketsStarted)
|
||||
createReceivingDataSockets(true);
|
||||
@ -5890,10 +5892,8 @@ int multiSlsDetector::enableDataStreamingFromReceiver(int enable){
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int ret=-100;
|
||||
@ -5928,9 +5928,10 @@ int multiSlsDetector::enableDataStreamingFromReceiver(int enable){
|
||||
}
|
||||
}
|
||||
|
||||
/* if(ret != dataSocketsStarted)
|
||||
ret = -1;
|
||||
*/
|
||||
if (!thisMultiDetector->externalgui) {
|
||||
if (ret != dataSocketsStarted)
|
||||
ret = -1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1455,7 +1455,7 @@ class multiSlsDetector : public slsDetectorUtils {
|
||||
Get external gui flag from shared memory
|
||||
\returns external gui flag
|
||||
*/
|
||||
void getExternalGuiFlag();
|
||||
bool getExternalGuiFlag();
|
||||
|
||||
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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")){
|
||||
|
@ -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;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user