restream stop from receiver

This commit is contained in:
Dhanya Maliakal
2017-11-30 18:39:08 +01:00
parent b75985088d
commit 70bf6eb4cb
10 changed files with 105 additions and 0 deletions

View File

@ -283,6 +283,7 @@ const char* slsReceiverTCPIPInterface::getFunctionName(enum recFuncs func) {
case F_SEND_RECEIVER_MULTIDETSIZE: return "F_SEND_RECEIVER_MULTIDETSIZE";
case F_SET_RECEIVER_STREAMING_PORT: return "F_SET_RECEIVER_STREAMING_PORT";
case F_SET_RECEIVER_SILENT_MODE: return "F_SET_RECEIVER_SILENT_MODE";
case F_RESTREAM_STOP_FROM_RECEIVER: return "F_RESTREAM_STOP_FROM_RECEIVER";
default: return "Unknown Function";
}
}
@ -330,6 +331,7 @@ int slsReceiverTCPIPInterface::function_table(){
flist[F_SEND_RECEIVER_MULTIDETSIZE] = &slsReceiverTCPIPInterface::set_multi_detector_size;
flist[F_SET_RECEIVER_STREAMING_PORT] = &slsReceiverTCPIPInterface::set_streaming_port;
flist[F_SET_RECEIVER_SILENT_MODE] = &slsReceiverTCPIPInterface::set_silent_mode;
flist[F_RESTREAM_STOP_FROM_RECEIVER] = &slsReceiverTCPIPInterface::restream_stop;
#ifdef VERYVERBOSE
for (int i = 0; i < NUM_REC_FUNCTIONS ; i++) {
FILE_LOG(logINFO) << "function fnum: " << i << " (" << getFunctionName((enum recFuncs)i) << ") located at " << (unsigned int)flist[i];
@ -2425,3 +2427,46 @@ int slsReceiverTCPIPInterface::set_silent_mode() {
// 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;
// send answer
mySock->SendDataOnly(&ret,sizeof(ret));
if (ret == FAIL)
mySock->SendDataOnly(mess,sizeof(mess));
// return ok/fail
return ret;
}