restream stop from receiver

This commit is contained in:
Dhanya Maliakal
2017-11-30 18:37:11 +01:00
parent 2227265357
commit ca855e6d39
7 changed files with 98 additions and 9 deletions

View File

@ -82,6 +82,7 @@ using namespace std;
#define RECEIVER_FILE_FORMAT 0x0000000080000000ULL
#define RECEIVER_SUBF_TIME_NOT_SET 0x0000000100000000ULL
#define RECEIVER_SILENT_MODE_NOT_SET 0x0000000200000000ULL
#define RESTREAM_STOP_FROM_RECEIVER 0x0000000400000000ULL
// 0x0000000FFFFFFFFFULL
/** @short class returning all error messages for error mask */
@ -266,6 +267,13 @@ public:
if(slsErrorMask&RECEIVER_SILENT_MODE_NOT_SET)
retval.append("Could not set silent mode in receiver.\n");
if(slsErrorMask&RESTREAM_STOP_FROM_RECEIVER)
retval.append("Could not restream stop from receiver.\n");
//------------------------------------------------------ length of message

View File

@ -6535,3 +6535,20 @@ bool multiSlsDetector::isAcquireReady() {
thisMultiDetector->acquiringFlag = true;
return OK;
}
int multiSlsDetector::restreamStopFromReceiver() {
int ret=OK, ret1;
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; ++idet){
if (detectors[idet]) {
ret1=detectors[idet]->restreamStopFromReceiver();
if(detectors[idet]->getErrorMask())
setErrorMask(getErrorMask()|(1<<idet));
if (ret1!=OK)
ret=FAIL;
}
}
return ret;
}

View File

@ -1474,6 +1474,15 @@ class multiSlsDetector : public slsDetectorUtils {
*/
bool isAcquireReady();
/**
If data streaming in receiver is enabled,
restream the stop dummy packet from receiver
Used usually for Moench,
in case it is lost in network due to high data rate
\returns OK if success else FAIL
*/
int restreamStopFromReceiver();
private:
/**

View File

@ -9165,3 +9165,26 @@ bool slsDetector::isAcquireReady() {
return parentDet->isAcquireReady();
}
int slsDetector::restreamStopFromReceiver(){
int fnum=F_RESTREAM_STOP_FROM_RECEIVER;
int ret = FAIL;
char mess[MAX_STR_LENGTH] = "";
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG) {
#ifdef VERBOSE
std::cout << "To Restream stop dummy from Receiver via zmq" << std::endl;
#endif
if (connectData() == OK){
ret=thisReceiver->executeFunction(fnum,mess);
disconnectData();
}
if(ret==FORCE_UPDATE)
ret=updateReceiver();
else if (ret == FAIL)
setErrorMask((getErrorMask())|(RESTREAM_STOP_FROM_RECEIVER));
}
return ret;
}

View File

@ -1918,6 +1918,15 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
*/
bool isAcquireReady();
/**
If data streaming in receiver is enabled,
restream the stop dummy packet from receiver
Used usually for Moench,
in case it is lost in network due to high data rate
\returns OK if success else FAIL
*/
int restreamStopFromReceiver();
protected:

View File

@ -2047,6 +2047,12 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
++i;
/*! \page receiver
- <b>r_restreamstop [i]</b> If data streaming in receiver is enabled, restreams the stop dummy packet via zmq. i can be any value. Only put! \cReturns 1 for success 0 for fail \c (int)
*/
descrToFuncMap[i].m_pFuncName="r_restreamstop"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
++i;
@ -6006,6 +6012,20 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
}
else if(cmd=="r_restreamstop"){
if (action==GET_ACTION)
return string("cannot get");
else {
if ((myDet->getRunStatus() != IDLE) || (myDet->getReceiverStatus() != IDLE)) {
std::cout << "Could not restream stop from receiver. Acquisition still in progress" << std::endl;
sprintf(answer,"%d",0);
}
sprintf(answer,"%d",(myDet->restreamStopFromReceiver() == OK) ? 1 : 0);
}
return string(answer);
}
return string("could not decode command");
}
@ -6016,12 +6036,13 @@ string slsDetectorCommand::helpReceiver(int narg, char *args[], int action) {
ostringstream os;
if (action==PUT_ACTION || action==HELP_ACTION) {
os << "receiver [status] \t starts/stops the receiver to listen to detector packets. - can be start or stop" << std::endl;
os << "receiver [status] \t starts/stops the receiver to listen to detector packets. - can be start, stop." << std::endl;
os << "resetframescaught [any value] \t resets frames caught by receiver" << std::endl;
os << "r_readfreq \t sets the gui read frequency of the receiver, 0 if gui requests frame, >0 if receiver sends every nth frame to gui" << std::endl;
os << "tengiga \t sets system to be configure for 10Gbe if set to 1, else 1Gbe if set to 0" << std::endl;
os << "rx_fifodepth [val]\t sets receiver fifo depth to val" << std::endl;
os << "r_silent [i]\t sets receiver in silent mode, ie. it will not print anything during real time acquisition. 1 sets, 0 unsets." << std::endl;
os << "r_restreamstop [i]\t If data streaming in receiver is enabled and receiver is idle, restreams the stop dummy packet via zmq. i can be any value." << std::endl;
}
if (action==GET_ACTION || action==HELP_ACTION){
os << "receiver \t returns the status of receiver - can be running or idle" << std::endl;
@ -6031,16 +6052,9 @@ string slsDetectorCommand::helpReceiver(int narg, char *args[], int action) {
os << "tengiga \t returns 1 if the system is configured for 10Gbe else 0 for 1Gbe" << std::endl;
os << "rx_fifodepth \t returns receiver fifo depth" << std::endl;
os << "r_silent \t returns receiver silent mode enable. 1 is silent, 0 not silent." << std::endl;
os << "r_restreamstop \t returns if restreaming the stop dummy packet from receiver via zmq was success(1) or fail(0)" << std:: endl;
}
return os.str();
}
string slsDetectorCommand::helpPattern(int narg, char *args[], int action) {

View File

@ -906,6 +906,15 @@ virtual int setReceiverSilentMode(int i = -1)=0;
*/
virtual bool isAcquireReady() = 0;
/**
If data streaming in receiver is enabled,
restream the stop dummy packet from receiver
Used usually for Moench,
in case it is lost in network due to high data rate
\returns OK if success else FAIL
*/
virtual int restreamStopFromReceiver() = 0;
protected: