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

@ -70,7 +70,7 @@ DataProcessor::DataProcessor(Fifo*& f, fileFormat* ftype, bool fwenable, bool* d
} }
NumberofDataProcessors++; NumberofDataProcessors++;
FILE_LOG (logDEBUG) << "Number of DataProcessors: " << NumberofDataProcessors; FILE_LOG(logDEBUG) << "Number of DataProcessors: " << NumberofDataProcessors;
memset((void*)&timerBegin, 0, sizeof(timespec)); memset((void*)&timerBegin, 0, sizeof(timespec));
} }

View File

@ -47,7 +47,7 @@ DataStreamer::DataStreamer(Fifo*& f, uint32_t* dr, int* sEnable, uint64_t* fi) :
} }
NumberofDataStreamers++; NumberofDataStreamers++;
FILE_LOG (logDEBUG) << "Number of DataStreamers: " << NumberofDataStreamers; FILE_LOG(logDEBUG) << "Number of DataStreamers: " << NumberofDataStreamers;
strcpy(fileNametoStream, ""); strcpy(fileNametoStream, "");
} }

View File

@ -23,7 +23,7 @@ Fifo::Fifo(uint32_t fifoItemSize, uint32_t depth, bool &success):
fifoDepth(depth), fifoDepth(depth),
status_fifoBound(0), status_fifoBound(0),
status_fifoFree(depth){ status_fifoFree(depth){
FILE_LOG (logDEBUG) << __AT__ << " called"; FILE_LOG(logDEBUG) << __AT__ << " called";
NumberofFifoClassObjects++; NumberofFifoClassObjects++;
if(CreateFifos(fifoItemSize) == FAIL) if(CreateFifos(fifoItemSize) == FAIL)
success = false; success = false;
@ -31,7 +31,7 @@ Fifo::Fifo(uint32_t fifoItemSize, uint32_t depth, bool &success):
Fifo::~Fifo() { Fifo::~Fifo() {
FILE_LOG (logDEBUG) << __AT__ << " called"; FILE_LOG(logDEBUG) << __AT__ << " called";
//cprintf(BLUE,"Fifo Object %d: Goodbye\n", index); //cprintf(BLUE,"Fifo Object %d: Goodbye\n", index);
DestroyFifos(); DestroyFifos();
NumberofFifoClassObjects--; NumberofFifoClassObjects--;
@ -40,7 +40,7 @@ Fifo::~Fifo() {
int Fifo::CreateFifos(uint32_t fifoItemSize) { int Fifo::CreateFifos(uint32_t fifoItemSize) {
FILE_LOG (logDEBUG) << __AT__ << " called"; FILE_LOG(logDEBUG) << __AT__ << " called";
//destroy if not already //destroy if not already
DestroyFifos(); DestroyFifos();
@ -53,11 +53,11 @@ int Fifo::CreateFifos(uint32_t fifoItemSize) {
memory = (char*) calloc (fifoItemSize * fifoDepth, sizeof(char)); memory = (char*) calloc (fifoItemSize * fifoDepth, sizeof(char));
memset(memory,0,fifoItemSize * fifoDepth* sizeof(char)); memset(memory,0,fifoItemSize * fifoDepth* sizeof(char));
if (memory == NULL){ if (memory == NULL){
FILE_LOG (logERROR) << "Could not allocate memory for fifos"; FILE_LOG(logERROR) << "Could not allocate memory for fifos";
memory = 0; memory = 0;
return FAIL; return FAIL;
} }
FILE_LOG (logDEBUG) << "Memory Allocated " << index << ": " << (fifoItemSize * fifoDepth) << " bytes"; FILE_LOG(logDEBUG) << "Memory Allocated " << index << ": " << (fifoItemSize * fifoDepth) << " bytes";
{ //push free addresses into fifoFree fifo { //push free addresses into fifoFree fifo
char* buffer = memory; char* buffer = memory;
@ -71,13 +71,13 @@ int Fifo::CreateFifos(uint32_t fifoItemSize) {
} }
} }
FILE_LOG (logDEBUG) << "Fifo Reconstructed Depth " << index << ": " << fifoDepth; FILE_LOG(logDEBUG) << "Fifo Reconstructed Depth " << index << ": " << fifoDepth;
return OK; return OK;
} }
void Fifo::DestroyFifos(){ void Fifo::DestroyFifos(){
FILE_LOG (logDEBUG) << __AT__ << " called"; FILE_LOG(logDEBUG) << __AT__ << " called";
if(memory) { if(memory) {

View File

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

View File

@ -29,7 +29,7 @@ ThreadObject::~ThreadObject() {
void ThreadObject::PrintMembers() { void ThreadObject::PrintMembers() {
FILE_LOG (logDEBUG) << "Index : " << index FILE_LOG(logDEBUG) << "Index : " << index
<< "\nalive: " << alive << "\nalive: " << alive
<< "\nkillThread: " << killThread << "\nkillThread: " << killThread
<< "\npthread: " << thread; << "\npthread: " << thread;
@ -44,25 +44,25 @@ void ThreadObject::DestroyThread() {
sem_destroy(&semaphore); sem_destroy(&semaphore);
killThread = false; killThread = false;
alive = false; alive = false;
FILE_LOG (logDEBUG) << GetType() << " thread with index " << index << " destroyed successfully."; FILE_LOG(logDEBUG) << GetType() << " thread with index " << index << " destroyed successfully.";
} }
} }
int ThreadObject::CreateThread() { int ThreadObject::CreateThread() {
if(alive){ if(alive){
FILE_LOG (logERROR) << "Cannot create thread " << index << ". Already alive"; FILE_LOG(logERROR) << "Cannot create thread " << index << ". Already alive";
return FAIL; return FAIL;
} }
sem_init(&semaphore,1,0); sem_init(&semaphore,1,0);
killThread = false; killThread = false;
if(pthread_create(&thread, NULL,StartThread, (void*) this)){ if(pthread_create(&thread, NULL,StartThread, (void*) this)){
FILE_LOG (logERROR) << "Could not create " << GetType() << " thread with index " << index; FILE_LOG(logERROR) << "Could not create " << GetType() << " thread with index " << index;
return FAIL; return FAIL;
} }
alive = true; alive = true;
FILE_LOG (logDEBUG) << GetType() << " thread " << index << " created successfully."; FILE_LOG(logDEBUG) << GetType() << " thread " << index << " created successfully.";
return OK; return OK;
} }

View File

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

View File

@ -33,7 +33,7 @@ UDPInterface * UDPInterface::create(string receiver_type){
} }
#endif #endif
else{ 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(); return new UDPBaseImplementation();
} }
} }

View File

@ -191,7 +191,7 @@ int UDPStandardImplementation::setShortFrameEnable(const int i) {
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it) for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
(*it)->SetGeneralData(generalData); (*it)->SetGeneralData(generalData);
} }
FILE_LOG (logINFO) << "Short Frame Enable: " << shortFrameEnable; FILE_LOG(logINFO) << "Short Frame Enable: " << shortFrameEnable;
return OK; return OK;
} }
@ -200,7 +200,7 @@ int UDPStandardImplementation::setFrameToGuiFrequency(const uint32_t freq) {
if (frameToGuiFrequency != freq) { if (frameToGuiFrequency != freq) {
frameToGuiFrequency = freq; frameToGuiFrequency = freq;
} }
FILE_LOG (logINFO) << "Frame to Gui Frequency: " << frameToGuiFrequency; FILE_LOG(logINFO) << "Frame to Gui Frequency: " << frameToGuiFrequency;
return OK; return OK;
} }
@ -239,7 +239,7 @@ int UDPStandardImplementation::setDataStreamEnable(const bool enable) {
SetThreadPriorities(); SetThreadPriorities();
} }
} }
FILE_LOG (logINFO) << "Data Send to Gui: " << dataStreamEnable; FILE_LOG(logINFO) << "Data Send to Gui: " << dataStreamEnable;
return OK; return OK;
} }
@ -275,7 +275,7 @@ int UDPStandardImplementation::setDynamicRange(const uint32_t i) {
if (SetupFifoStructure() == FAIL) if (SetupFifoStructure() == FAIL)
return FAIL; return FAIL;
} }
FILE_LOG (logINFO) << "Dynamic Range: " << dynamicRange; FILE_LOG(logINFO) << "Dynamic Range: " << dynamicRange;
return OK; return OK;
} }
@ -290,7 +290,7 @@ int UDPStandardImplementation::setTenGigaEnable(const bool b) {
if (SetupFifoStructure() == FAIL) if (SetupFifoStructure() == FAIL)
return FAIL; return FAIL;
} }
FILE_LOG (logINFO) << "Ten Giga: " << stringEnable(tengigaEnable); FILE_LOG(logINFO) << "Ten Giga: " << stringEnable(tengigaEnable);
return OK; return OK;
} }
@ -303,7 +303,7 @@ int UDPStandardImplementation::setFifoDepth(const uint32_t i) {
if (SetupFifoStructure() == FAIL) if (SetupFifoStructure() == FAIL)
return FAIL; return FAIL;
} }
FILE_LOG (logINFO) << "Fifo Depth: " << i; FILE_LOG(logINFO) << "Fifo Depth: " << i;
return OK; return OK;
} }
@ -320,7 +320,7 @@ void UDPStandardImplementation::setSilentMode(const uint32_t i){
int UDPStandardImplementation::setDetectorType(const detectorType d) { int UDPStandardImplementation::setDetectorType(const detectorType d) {
FILE_LOG (logDEBUG) << "Setting receiver type"; FILE_LOG(logDEBUG) << "Setting receiver type";
DeleteMembers(); DeleteMembers();
InitializeMembers(); InitializeMembers();
myDetectorType = d; myDetectorType = d;
@ -331,10 +331,10 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) {
case EIGER: case EIGER:
case JUNGFRAUCTB: case JUNGFRAUCTB:
case JUNGFRAU: case JUNGFRAU:
FILE_LOG (logINFO) << " ***** " << getDetectorType(d) << " Receiver *****"; FILE_LOG(logINFO) << " ***** " << getDetectorType(d) << " Receiver *****";
break; break;
default: default:
FILE_LOG (logERROR) << "This is an unknown receiver type " << (int)d; FILE_LOG(logERROR) << "This is an unknown receiver type " << (int)d;
return FAIL; return FAIL;
} }
@ -358,7 +358,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) {
//create fifo structure //create fifo structure
numberofJobs = -1; numberofJobs = -1;
if (SetupFifoStructure() == FAIL) { 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; return FAIL;
} }
@ -369,7 +369,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) {
fileWriteEnable, &dataStreamEnable, &gapPixelsEnable, &dynamicRange, &frameToGuiFrequency, &frameToGuiTimerinMS, fileWriteEnable, &dataStreamEnable, &gapPixelsEnable, &dynamicRange, &frameToGuiFrequency, &frameToGuiTimerinMS,
rawDataReadyCallBack,pRawDataReady)); rawDataReadyCallBack,pRawDataReady));
if (Listener::GetErrorMask() || DataProcessor::GetErrorMask()) { 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) for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
delete(*it); delete(*it);
listener.clear(); listener.clear();
@ -388,7 +388,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) {
SetThreadPriorities(); SetThreadPriorities();
FILE_LOG (logDEBUG) << " Detector type set to " << getDetectorType(d); FILE_LOG(logDEBUG) << " Detector type set to " << getDetectorType(d);
return OK; return OK;
} }
@ -416,7 +416,7 @@ void UDPStandardImplementation::resetAcquisitionCount() {
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it) for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
(*it)->ResetParametersforNewAcquisition(); (*it)->ResetParametersforNewAcquisition();
FILE_LOG (logINFO) << "Acquisition Count has been reset"; FILE_LOG(logINFO) << "Acquisition Count has been reset";
} }
@ -626,19 +626,19 @@ void UDPStandardImplementation::SetLocalNetworkParameters() {
//to increase Socket Receiver Buffer size //to increase Socket Receiver Buffer size
sprintf(command,"echo $((%d)) > /proc/sys/net/core/rmem_max",RECEIVE_SOCKET_BUFFER_SIZE); sprintf(command,"echo $((%d)) > /proc/sys/net/core/rmem_max",RECEIVE_SOCKET_BUFFER_SIZE);
if (system(command)) { if (system(command)) {
FILE_LOG (logWARNING) << "No root privileges to change Socket Receiver Buffer size (net.core.rmem_max)"; FILE_LOG(logWARNING) << "No root privileges to change Socket Receiver Buffer size (net.core.rmem_max)";
return; return;
} }
FILE_LOG (logINFO) << "Socket Receiver Buffer size (/proc/sys/net/core/rmem_max) modified to " << RECEIVE_SOCKET_BUFFER_SIZE ; FILE_LOG(logINFO) << "Socket Receiver Buffer size (/proc/sys/net/core/rmem_max) modified to " << RECEIVE_SOCKET_BUFFER_SIZE ;
// to increase Max length of input packet queue // to increase Max length of input packet queue
sprintf(command,"echo %d > /proc/sys/net/core/netdev_max_backlog",MAX_SOCKET_INPUT_PACKET_QUEUE); sprintf(command,"echo %d > /proc/sys/net/core/netdev_max_backlog",MAX_SOCKET_INPUT_PACKET_QUEUE);
if (system(command)) { if (system(command)) {
FILE_LOG (logWARNING) << "No root privileges to change Max length of input packet queue (net.core.rmem_max)"; FILE_LOG(logWARNING) << "No root privileges to change Max length of input packet queue (net.core.rmem_max)";
return; return;
} }
FILE_LOG (logINFO) << "Max length of input packet queue (/proc/sys/net/core/netdev_max_backlog) modified to " << MAX_SOCKET_INPUT_PACKET_QUEUE ; FILE_LOG(logINFO) << "Max length of input packet queue (/proc/sys/net/core/netdev_max_backlog) modified to " << MAX_SOCKET_INPUT_PACKET_QUEUE ;
} }
@ -685,8 +685,8 @@ int UDPStandardImplementation::SetupFifoStructure() {
if(dataStreamer.size())dataStreamer[i]->SetFifo(fifo[i]); if(dataStreamer.size())dataStreamer[i]->SetFifo(fifo[i]);
} }
FILE_LOG (logINFO) << "Memory Allocated Per Fifo: " << ( ((generalData->imageSize) * numberofJobs + (generalData->fifoBufferHeaderSize)) * fifoDepth) << " bytes" ; FILE_LOG(logINFO) << "Memory Allocated Per Fifo: " << ( ((generalData->imageSize) * numberofJobs + (generalData->fifoBufferHeaderSize)) * fifoDepth) << " bytes" ;
FILE_LOG (logINFO) << " Fifo structure(s) reconstructed: " << numThreads; FILE_LOG(logINFO) << " Fifo structure(s) reconstructed: " << numThreads;
return OK; return OK;
} }

View File

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

View File

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