mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 00:00:02 +02:00
merge conflict from 3.0.1 to restream stop from recieveR
This commit is contained in:
commit
6f3898441e
@ -117,6 +117,12 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
|
||||
*/
|
||||
void CloseZmqSocket();
|
||||
|
||||
/**
|
||||
* Restream stop dummy packet
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int restreamStop();
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
|
@ -555,6 +555,12 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
*/
|
||||
void setStreamingSourceIP(const char* c);
|
||||
|
||||
/*
|
||||
* Restream stop dummy packet from receiver
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int restreamStop();
|
||||
|
||||
//***callback functions***
|
||||
/**
|
||||
* Call back for start acquisition
|
||||
|
@ -643,6 +643,12 @@ class UDPInterface {
|
||||
*/
|
||||
virtual void setStreamingSourceIP(const char* c) = 0;
|
||||
|
||||
/*
|
||||
* Restream stop dummy packet from receiver
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
virtual int restreamStop() = 0;
|
||||
|
||||
|
||||
//***callback functions***
|
||||
/**
|
||||
|
@ -184,6 +184,13 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
|
||||
*/
|
||||
void closeFiles();
|
||||
|
||||
/**
|
||||
* Restream stop dummy packet from receiver
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int restreamStop();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
|
@ -267,6 +267,9 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
|
||||
/** enable gap pixels */
|
||||
int enable_gap_pixels();
|
||||
|
||||
/** restream stop packet */
|
||||
int restream_stop();
|
||||
|
||||
|
||||
|
||||
/** detector type */
|
||||
|
@ -62,6 +62,8 @@ enum recFuncs{
|
||||
F_RECEIVER_STREAMING_SRC_IP, /** < sets the receiver streaming source IP */
|
||||
F_SET_RECEIVER_SILENT_MODE, /** < sets the receiver silent mode */
|
||||
F_ENABLE_GAPPIXELS_IN_RECEIVER, /** < sets gap pixels in the receiver */
|
||||
F_RESTREAM_STOP_FROM_RECEIVER, /** < restream stop from receiver */
|
||||
|
||||
/* Always append functions hereafter!!! */
|
||||
|
||||
|
||||
|
@ -288,3 +288,15 @@ int DataStreamer::SendHeader(sls_detector_header* header, uint32_t nx, uint32_t
|
||||
header->detType, header->version
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int DataStreamer::restreamStop() {
|
||||
//send dummy header
|
||||
int ret = zmqSocket->SendHeaderData(index, true, SLS_DETECTOR_JSON_HEADER_VERSION);
|
||||
if (!ret) {
|
||||
FILE_LOG(logERROR) << "Could not Restream Dummy Header via ZMQ for port " << zmqSocket->GetPortNumber();
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
@ -597,6 +597,11 @@ void UDPBaseImplementation::setStreamingSourceIP(const char c[]){
|
||||
}
|
||||
|
||||
|
||||
int UDPBaseImplementation::restreamStop() {
|
||||
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
|
||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
||||
}
|
||||
|
||||
/***callback functions***/
|
||||
void UDPBaseImplementation::registerCallBackStartAcquisition(int (*func)(char*, char*, uint64_t, uint32_t, void*),void *arg){
|
||||
startAcquisitionCallBack=func;
|
||||
|
@ -600,6 +600,22 @@ void UDPStandardImplementation::closeFiles() {
|
||||
}
|
||||
|
||||
|
||||
int UDPStandardImplementation::restreamStop() {
|
||||
bool ret = OK;
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it) {
|
||||
if ((*it)->restreamStop() == FAIL)
|
||||
ret = FAIL;
|
||||
}
|
||||
|
||||
// if fail, prints in datastreamer
|
||||
if (ret == OK) {
|
||||
FILE_LOG(logINFO) << "Restreaming Dummy Header via ZMQ successful";
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void UDPStandardImplementation::SetLocalNetworkParameters() {
|
||||
//to increase socket receiver buffer size and max length of input queue by changing kernel settings
|
||||
if (myDetectorType == EIGER)
|
||||
|
@ -283,7 +283,7 @@ const char* slsReceiverTCPIPInterface::getFunctionName(enum recFuncs func) {
|
||||
case F_SET_RECEIVER_SILENT_MODE: return "F_SET_RECEIVER_SILENT_MODE";
|
||||
case F_RECEIVER_STREAMING_SRC_IP: return "F_RECEIVER_STREAMING_SRC_IP";
|
||||
case F_ENABLE_GAPPIXELS_IN_RECEIVER:return "F_ENABLE_GAPPIXELS_IN_RECEIVER";
|
||||
|
||||
case F_RESTREAM_STOP_FROM_RECEIVER: return "F_RESTREAM_STOP_FROM_RECEIVER";
|
||||
default: return "Unknown Function";
|
||||
}
|
||||
}
|
||||
@ -331,6 +331,7 @@ int slsReceiverTCPIPInterface::function_table(){
|
||||
flist[F_SET_RECEIVER_SILENT_MODE] = &slsReceiverTCPIPInterface::set_silent_mode;
|
||||
flist[F_RECEIVER_STREAMING_SRC_IP] = &slsReceiverTCPIPInterface::set_streaming_source_ip;
|
||||
flist[F_ENABLE_GAPPIXELS_IN_RECEIVER] = &slsReceiverTCPIPInterface::enable_gap_pixels;
|
||||
flist[F_RESTREAM_STOP_FROM_RECEIVER] = &slsReceiverTCPIPInterface::restream_stop;
|
||||
|
||||
#ifdef VERYVERBOSE
|
||||
for (int i = 0; i < NUM_REC_FUNCTIONS ; i++) {
|
||||
@ -2442,6 +2443,7 @@ int slsReceiverTCPIPInterface::set_silent_mode() {
|
||||
|
||||
|
||||
|
||||
|
||||
int slsReceiverTCPIPInterface::enable_gap_pixels() {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
@ -2453,7 +2455,6 @@ int slsReceiverTCPIPInterface::enable_gap_pixels() {
|
||||
return printSocketReadError();
|
||||
|
||||
|
||||
|
||||
// execute action
|
||||
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||
if (receiverBase == NULL)
|
||||
@ -2485,6 +2486,42 @@ int slsReceiverTCPIPInterface::enable_gap_pixels() {
|
||||
FILE_LOG(logDEBUG1) << "Activate: " << retval;
|
||||
#endif
|
||||
|
||||
if (ret == OK && mySock->differentClients)
|
||||
ret = FORCE_UPDATE;
|
||||
|
||||
// return ok/fail
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int slsReceiverTCPIPInterface::restream_stop(){
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
|
||||
// execute action
|
||||
// only a set, not a get
|
||||
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||
if (receiverBase == NULL)
|
||||
invalidReceiverObject();
|
||||
else if (mySock->differentClients && lockStatus)
|
||||
receiverlocked();
|
||||
else if (receiverBase->getStatus() != IDLE)
|
||||
receiverNotIdle();
|
||||
else if (receiverBase->getDataStreamEnable() == false) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Could not restream stop packet as data Streaming is disabled.\n");
|
||||
FILE_LOG(logERROR) << "Warning: " << mess;
|
||||
} else {
|
||||
ret = receiverBase->restreamStop();
|
||||
if (ret == FAIL) {
|
||||
sprintf(mess,"Could not restream stop packet.\n");
|
||||
FILE_LOG(logERROR) << "Warning: " << mess;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ret == OK && mySock->differentClients)
|
||||
ret = FORCE_UPDATE;
|
||||
|
||||
@ -2492,7 +2529,6 @@ int slsReceiverTCPIPInterface::enable_gap_pixels() {
|
||||
mySock->SendDataOnly(&ret,sizeof(ret));
|
||||
if (ret == FAIL)
|
||||
mySock->SendDataOnly(mess,sizeof(mess));
|
||||
mySock->SendDataOnly(&retval,sizeof(retval));
|
||||
|
||||
// return ok/fail
|
||||
return ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user