merge conflict resolved

This commit is contained in:
Dhanya Maliakal 2017-12-01 12:44:34 +01:00
commit 9f152ce1f3
10 changed files with 98 additions and 93 deletions

View File

@ -60,6 +60,16 @@ Listener::Listener(detectorType dtype, Fifo*& f, runStatus* s, uint32_t* portno,
}
NumberofListeners++;
FILE_LOG(logDEBUG) << "Number of Listeners: " << NumberofListeners;
switch(myDetectorType){
case JUNGFRAU:
case EIGER:
standardheader = true;
break;
default:
standardheader = false;
break;
}
}

View File

@ -238,7 +238,7 @@ char *UDPBaseImplementation::getStreamingSourceIP() const{
/**initial parameters***/
void UDPBaseImplementation::configure(map<string, string> config_map){
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
FILE_LOG(logERROR) << __AT__ << " doing nothing...";
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
}
@ -312,7 +312,7 @@ void UDPBaseImplementation::setFilePath(const char c[]){
if(stat(c,&st) == 0)
strcpy(filePath,c);
else
FILE_LOG(logWARNING) << "FilePath does not exist: " << filePath;
FILE_LOG(logERROR) << "FilePath does not exist: " << filePath;
}
FILE_LOG(logINFO) << "Info: File path: " << filePath;
}
@ -545,30 +545,30 @@ void UDPBaseImplementation::resetAcquisitionCount(){
}
int UDPBaseImplementation::startReceiver(char *c){
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
FILE_LOG(logERROR) << __AT__ << " doing nothing...";
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
return OK;
}
void UDPBaseImplementation::stopReceiver(){
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
FILE_LOG(logERROR) << __AT__ << " doing nothing...";
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
}
void UDPBaseImplementation::startReadout(){
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
FILE_LOG(logERROR) << __AT__ << " doing nothing...";
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
}
void UDPBaseImplementation::shutDownUDPSockets(){
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
FILE_LOG(logERROR) << __AT__ << " doing nothing...";
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
}
//FIXME: needed, isnt stopReceiver enough?
void UDPBaseImplementation::abort(){
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
FILE_LOG(logERROR) << __AT__ << " doing nothing...";
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
}
@ -598,7 +598,7 @@ void UDPBaseImplementation::setStreamingSourceIP(const char c[]){
int UDPBaseImplementation::restreamStop() {
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
FILE_LOG(logERROR) << __AT__ << " doing nothing...";
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
return OK;
}

View File

@ -33,7 +33,7 @@ UDPInterface * UDPInterface::create(string receiver_type){
}
#endif
else{
FILE_LOG(logWARNING) << "[ERROR] UDP interface not supported, using standard implementation";
FILE_LOG(logERROR) << "UDP interface not supported, using base implementation";
return new UDPBaseImplementation();
}
}

View File

@ -358,7 +358,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) {
//create fifo structure
numberofJobs = -1;
if (SetupFifoStructure() == FAIL) {
FILE_LOG (logERROR) << "Error: Could not allocate memory for fifo structure";
FILE_LOG(logERROR) << "Could not allocate memory for fifo structure";
return FAIL;
}
@ -369,7 +369,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) {
fileWriteEnable, &dataStreamEnable, &gapPixelsEnable, &dynamicRange, &frameToGuiFrequency, &frameToGuiTimerinMS,
rawDataReadyCallBack,pRawDataReady));
if (Listener::GetErrorMask() || DataProcessor::GetErrorMask()) {
FILE_LOG (logERROR) << "Error: Could not creates listener/dataprocessor threads (index:" << i << ")";
FILE_LOG(logERROR) << "Could not create listener/dataprocessor threads (index:" << i << ")";
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
delete(*it);
listener.clear();

View File

@ -113,16 +113,11 @@ slsReceiver::slsReceiver(int argc, char *argv[], int &success) {
//VERBOSE_PRINT("Read configuration file of " + iline + " lines");
}
catch(...){
FILE_LOG(logERROR) << "Error opening configuration file " << fname ;
FILE_LOG(logERROR) << "Coult not open configuration file " << fname ;
success = FAIL;
}
}
if(success != OK){
FILE_LOG(logERROR) << "Failed: see output above for more information " ;
}
if (success==OK){
FILE_LOG(logINFO) << "SLS Receiver starting " << udp_interface_type << " on port " << tcpip_port_no << endl;
#ifdef REST

View File

@ -371,7 +371,7 @@ int slsReceiverTCPIPInterface::decode_function(){
ret=(this->*flist[fnum])();
}
if (ret == FAIL) {
FILE_LOG(logERROR) << "Error executing the function = " << fnum << " (" << getFunctionName((enum recFuncs)fnum) << ")";
FILE_LOG(logERROR) << "Failed to execute function = " << fnum << " (" << getFunctionName((enum recFuncs)fnum) << ")";
}
return ret;
}
@ -379,7 +379,7 @@ int slsReceiverTCPIPInterface::decode_function(){
int slsReceiverTCPIPInterface::printSocketReadError() {
FILE_LOG(logERROR) << "Error reading from socket. Possible socket crash";
FILE_LOG(logERROR) << "Reading from socket failed. Possible socket crash";
return FAIL;
}
@ -387,27 +387,27 @@ int slsReceiverTCPIPInterface::printSocketReadError() {
void slsReceiverTCPIPInterface::invalidReceiverObject() {
ret=FAIL;
strcpy(mess,"Receiver not set up. Please use rx_hostname first.\n");
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
void slsReceiverTCPIPInterface::receiverlocked() {
ret = FAIL;
sprintf(mess,"Receiver locked by %s\n",mySock->lastClientIP);
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
void slsReceiverTCPIPInterface::receiverNotIdle() {
ret = FAIL;
sprintf(mess,"Can not execute %s when receiver is not idle\n", getFunctionName((enum recFuncs)fnum));
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
void slsReceiverTCPIPInterface::functionNotImplemented() {
ret = FAIL;
sprintf(mess, "Function (%s) is not implemented for this detector\n",getFunctionName((enum recFuncs)fnum));
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
@ -459,7 +459,7 @@ int slsReceiverTCPIPInterface::exec_command() {
} else {
ret = FAIL;
sprintf(mess,"Executing Command failed\n");
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
@ -554,13 +554,13 @@ int slsReceiverTCPIPInterface::set_port() {
if (mySock->differentClients && lockStatus) {
ret=FAIL;
sprintf(mess,"Detector locked by %s\n",mySock->lastClientIP);
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
else {
if (p_number<1024) {
ret = FAIL;
sprintf(mess,"Port Number (%d) too low\n", p_number);
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
FILE_LOG(logINFO) << "set port to " << p_number <<endl;
strcpy(oldLastClientIP, mySock->lastClientIP);
@ -571,11 +571,11 @@ int slsReceiverTCPIPInterface::set_port() {
if (sd < 0) {
ret = FAIL;
sprintf(mess,"Could not bind port %d\n", p_number);
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
if (sd == -10) {
ret = FAIL;
sprintf(mess,"Port %d already set\n", p_number);
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
else
@ -772,7 +772,7 @@ int slsReceiverTCPIPInterface::set_detector_type(){
default:
ret = FAIL;
sprintf(mess,"Unknown detector type: %d\n", dr);
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
break;
}
if(ret == OK) {
@ -946,7 +946,7 @@ int slsReceiverTCPIPInterface::setup_udp(){
if (temp == "none"){
ret = FAIL;
strcpy(mess, "Failed to get ethernet interface or IP\n");
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
else {
char eth[MAX_STR_LENGTH];
@ -956,7 +956,7 @@ int slsReceiverTCPIPInterface::setup_udp(){
strcpy(eth,"");
ret = FAIL;
strcpy(mess, "Failed to get ethernet interface\n");
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
receiverBase->setEthernetInterface(eth);
@ -967,7 +967,7 @@ int slsReceiverTCPIPInterface::setup_udp(){
if ((temp=="00:00:00:00:00:00") || (ret == FAIL)){
ret = FAIL;
strcpy(mess,"failed to get mac adddress to listen to\n");
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
else {
strcpy(retval,temp.c_str());
@ -1040,7 +1040,7 @@ int slsReceiverTCPIPInterface::set_timer() {
default:
ret = FAIL;
sprintf(mess,"This timer mode (%lld) does not exist for receiver\n", (long long int)index[0]);
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
}
@ -1071,14 +1071,14 @@ int slsReceiverTCPIPInterface::set_timer() {
default:
ret = FAIL;
sprintf(mess,"This timer mode (%lld) does not exist for receiver\n", (long long int)index[0]);
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
// check
if (ret == OK && index[1] >= 0 && retval != index[1]) {
ret = FAIL;
strcpy(mess,"Could not set timer\n");
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
#endif
@ -1130,7 +1130,7 @@ int slsReceiverTCPIPInterface::set_dynamic_range() {
if (!exists) {
ret = FAIL;
sprintf(mess,"This dynamic range %d does not exist for this detector\n",dr);
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
@ -1148,7 +1148,7 @@ int slsReceiverTCPIPInterface::set_dynamic_range() {
ret = receiverBase->setDynamicRange(dr);
if(ret == FAIL) {
strcpy(mess, "Could not allocate memory for fifo or could not start listening/writing threads\n");
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
}
@ -1157,7 +1157,7 @@ int slsReceiverTCPIPInterface::set_dynamic_range() {
if(dr > 0 && retval != dr) {
ret = FAIL;
strcpy(mess, "Could not set dynamic range\n");
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
}
@ -1206,7 +1206,7 @@ int slsReceiverTCPIPInterface::set_read_frequency(){
ret = receiverBase->setFrameToGuiFrequency(index);
if(ret == FAIL) {
strcpy(mess, "Could not allocate memory for listening fifo\n");
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
}
@ -1215,7 +1215,7 @@ int slsReceiverTCPIPInterface::set_read_frequency(){
if(index >= 0 && retval != index){
ret = FAIL;
strcpy(mess,"Could not set frame to gui frequency");
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
#endif
@ -1281,12 +1281,12 @@ int slsReceiverTCPIPInterface::start_receiver(){
if (s != IDLE) {
ret=FAIL;
sprintf(mess,"Cannot start Receiver as it is in %s state\n",runStatusType(s).c_str());
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
else {
ret=receiverBase->startReceiver(mess);
if (ret == FAIL) {
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
}
@ -1329,7 +1329,7 @@ int slsReceiverTCPIPInterface::stop_receiver(){
else {
ret = FAIL;
sprintf(mess,"Could not stop receiver. It is in %s state\n",runStatusType(s).c_str());
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
#endif
@ -1373,7 +1373,7 @@ int slsReceiverTCPIPInterface::start_readout(){
else {
ret = FAIL;
strcpy(mess,"Could not start readout");
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
#endif
@ -1428,7 +1428,7 @@ int slsReceiverTCPIPInterface::set_file_dir() {
if (retval == NULL || (strlen(fPath) && strcasecmp(fPath, retval))) {
ret = FAIL;
strcpy(mess,"receiver file path does not exist\n");
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
#endif
@ -1490,7 +1490,7 @@ int slsReceiverTCPIPInterface::set_file_name() {
if(retval == NULL) {
ret = FAIL;
strcpy(mess, "file name is empty\n");
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
#endif
@ -1548,7 +1548,7 @@ int slsReceiverTCPIPInterface::set_file_index() {
if(index >= 0 && retval != index) {
ret = FAIL;
strcpy(mess, "Could not set file index\n");
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
#endif
@ -1684,7 +1684,7 @@ int slsReceiverTCPIPInterface::enable_file_write(){
if(enable >= 0 && enable != retval) {
ret=FAIL;
strcpy(mess,"Could not set file write enable");
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
#endif
@ -1720,7 +1720,7 @@ int slsReceiverTCPIPInterface::enable_compression() {
ret = FAIL;
sprintf(mess, "This function (%s) is not implemented yet\n", getFunctionName((enum recFuncs)fnum));
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
// send answer
mySock->SendDataOnly(&ret,sizeof(ret));
@ -1762,7 +1762,7 @@ int slsReceiverTCPIPInterface::enable_overwrite() {
if(index >=0 && retval != index) {
ret = FAIL;
strcpy(mess,"Could not set file over write enable\n");
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
#endif
@ -1821,7 +1821,7 @@ int slsReceiverTCPIPInterface::enable_tengiga() {
if((val >= 0) && (val != retval)) {
ret = FAIL;
strcpy(mess,"Could not set ten giga enable");
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
}
@ -1871,7 +1871,7 @@ int slsReceiverTCPIPInterface::set_fifo_depth() {
ret = receiverBase->setFifoDepth(value);
if (ret == FAIL) {
strcpy(mess,"Could not set fifo depth");
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
}
@ -1880,7 +1880,7 @@ int slsReceiverTCPIPInterface::set_fifo_depth() {
if(value >= 0 && retval != value) {
ret = FAIL;
strcpy(mess, "Could not set fifo depth\n");
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
#endif
@ -1937,7 +1937,7 @@ int slsReceiverTCPIPInterface::set_activate() {
if(enable >= 0 && retval != enable){
ret = FAIL;
sprintf(mess,"Could not set activate to %d, returned %d\n",enable,retval);
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
}
@ -1991,7 +1991,7 @@ int slsReceiverTCPIPInterface::set_data_stream_enable(){
if(index >= 0 && retval != index){
ret = FAIL;
strcpy(mess,"Could not set data stream enable");
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
#endif
@ -2044,7 +2044,7 @@ int slsReceiverTCPIPInterface::set_read_receiver_timer(){
if(index >= 0 && retval != index){
ret = FAIL;
strcpy(mess,"Could not set datastream timer");
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
#endif
@ -2101,7 +2101,7 @@ int slsReceiverTCPIPInterface::set_flipped_data(){
if (args[1] > -1 && retval != args[1]) {
ret = FAIL;
strcpy(mess, "Could not set flipped data\n");
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
}
@ -2156,7 +2156,7 @@ int slsReceiverTCPIPInterface::set_file_format() {
if(f >= 0 && retval != f){
ret = FAIL;
sprintf(mess,"Could not set file format to %s, returned %s\n",getFileFormatType(f).c_str(),getFileFormatType(retval).c_str());
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
#endif
@ -2209,7 +2209,7 @@ int slsReceiverTCPIPInterface::set_detector_posid() {
if (arg >= 0 && retval != arg) {
ret = FAIL;
strcpy(mess,"Could not set detector position id");
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
#endif
@ -2518,12 +2518,12 @@ int slsReceiverTCPIPInterface::restream_stop(){
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;
FILE_LOG(logERROR) << mess;
} else {
ret = receiverBase->restreamStop();
if (ret == FAIL) {
sprintf(mess,"Could not restream stop packet.\n");
FILE_LOG(logERROR) << "Warning: " << mess;
FILE_LOG(logERROR) << mess;
}
}
#endif