mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-21 21:12:56 +01:00
added logger
This commit is contained in:
@@ -11,16 +11,16 @@ CFLAGS= -g -DC_ONLY -fPIC
|
|||||||
|
|
||||||
DFLAGS= -g -DDACS_INT -DSLS_RECEIVER_UDP_FUNCTIONS
|
DFLAGS= -g -DDACS_INT -DSLS_RECEIVER_UDP_FUNCTIONS
|
||||||
|
|
||||||
INCLUDES?= -I. -Iincludes -IMySocketTCP -IslsReceiver -IslsDetectorCalibration -IslsReceiver/eigerReceiver -I$(ASM)
|
INCLUDES?= -I. -Iincludes -IMySocketTCP -IslsReceiver -IslsDetectorCalibration -I$(ASM)
|
||||||
#-IslsReceiverInterface
|
#-IslsReceiverInterface
|
||||||
|
|
||||||
SRC_CLNT= MySocketTCP/MySocketTCP.cpp slsReceiver/slsReceiver.cpp slsReceiver/UDPInterface.cpp slsReceiver/UDPBaseImplementation.cpp slsReceiver/slsReceiverTCPIPInterface.cpp slsReceiver/slsReceiverUsers.cpp
|
SRC_CLNT= MySocketTCP/MySocketTCP.cpp slsReceiver/UDPInterface.cpp slsReceiver/UDPBaseImplementation.cpp slsReceiver/UDPStandardImplementation.cpp slsReceiver/slsReceiverTCPIPInterface.cpp slsReceiver/slsReceiver.cpp slsReceiver/slsReceiverUsers.cpp includes/utilities.h
|
||||||
|
|
||||||
#slsReceiverInterface/receiverInterface.cpp
|
#slsReceiverInterface/receiverInterface.cpp
|
||||||
#slsReceiver/slsReceiverUDPFunctions.cpp
|
#slsReceiver/slsReceiverUDPFunctions.cpp
|
||||||
|
|
||||||
OBJS = $(SRC_CLNT:.cpp=.o)
|
OBJS = $(SRC_CLNT:.cpp=.o)
|
||||||
OBJS += slsReceiver/eigerReceiver.o
|
OBJS += includes/utilities.h
|
||||||
|
#OBJS += slsReceiver/eigerReceiver.o
|
||||||
|
|
||||||
|
|
||||||
.PHONY: all intdoc package eigerReceiver clean
|
.PHONY: all intdoc package eigerReceiver clean
|
||||||
@@ -31,10 +31,8 @@ intdoc: $(SRC_H) $(SRC_CLNT)
|
|||||||
doxygen doxy.config
|
doxygen doxy.config
|
||||||
|
|
||||||
|
|
||||||
%.o : %.cpp %.h Makefile
|
%.o : %.cpp Makefile
|
||||||
ifeq ($(EIGERSLS),yes)
|
ifeq ($(ROOTSLS),yes)
|
||||||
$(CXX) -DEIGERSLS -o $@ -c $< $(INCLUDES) $(DFLAGS) $(EIGERFLAGS) -fPIC $(EPICSFLAGS) -L/usr/lib64/ #$(FLAGS)
|
|
||||||
else ifeq ($(ROOTSLS),yes)
|
|
||||||
echo "with root"
|
echo "with root"
|
||||||
$(CXX) -DROOTSLS -o $@ -c $< $(INCLUDES) $(DFLAGS) $(ROOTFLAGS) -fPIC $(EPICSFLAGS) -L/usr/lib64/ #$(FLAGS)
|
$(CXX) -DROOTSLS -o $@ -c $< $(INCLUDES) $(DFLAGS) $(ROOTFLAGS) -fPIC $(EPICSFLAGS) -L/usr/lib64/ #$(FLAGS)
|
||||||
else
|
else
|
||||||
@@ -43,11 +41,11 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# LEO: not satisfied by eigerReceiver
|
# LEO: not satisfied by eigerReceiver
|
||||||
package: eigerReceiver $(OBJS) $(DESTDIR)/libSlsReceiver.so $(DESTDIR)/libSlsReceiver.a
|
package: $(OBJS) $(DESTDIR)/libSlsReceiver.so $(DESTDIR)/libSlsReceiver.a
|
||||||
|
|
||||||
eigerReceiver:
|
#eigerReceiver:
|
||||||
echo "src client:" $(SRC_CLNT)
|
# echo "src client:" $(SRC_CLNT)
|
||||||
cd slsReceiver && make eigerReceiver
|
# cd slsReceiver && make eigerReceiver
|
||||||
|
|
||||||
$(DESTDIR)/libSlsReceiver.so: $(OBJS)
|
$(DESTDIR)/libSlsReceiver.so: $(OBJS)
|
||||||
$(CXX) -shared -Wl,-soname,libSlsReceiver.so -o libSlsReceiver.so $(OBJS) -lc $(INCLUDES) $(DFLAGS) $(FLAGS) $(EPICSFLAGS) -L/usr/lib64 -lpthread
|
$(CXX) -shared -Wl,-soname,libSlsReceiver.so -o libSlsReceiver.so $(OBJS) -lc $(INCLUDES) $(DFLAGS) $(FLAGS) $(EPICSFLAGS) -L/usr/lib64 -lpthread
|
||||||
|
|||||||
@@ -39,26 +39,26 @@ $(DESTDIR)/sslsReceiver: lib
|
|||||||
$(CXX) -static -o $@ $(SRC_CLNT) $(FLAGS) $(INCLUDES) $(CLAGS) $(LIBS) $(LDFLAGRXR)
|
$(CXX) -static -o $@ $(SRC_CLNT) $(FLAGS) $(INCLUDES) $(CLAGS) $(LIBS) $(LDFLAGRXR)
|
||||||
|
|
||||||
|
|
||||||
$(DESTDIR)/slsReceiver: eigerReceiver lib
|
$(DESTDIR)/slsReceiver: lib
|
||||||
echo "AAAAAAAAAAAA" $(CXX) -o $@ $(SRC_CLNT) $(FLAGS) $(INCLUDES) $(CLAGS) $(LIBS) $(LDFLAGRXR) -fPIC
|
echo "AAAAAAAAAAAA" $(CXX) -o $@ $(SRC_CLNT) $(FLAGS) $(INCLUDES) $(CLAGS) $(LIBS) $(LDFLAGRXR) -fPIC
|
||||||
$(CXX) -o $@ $(SRC_CLNT) $(FLAGS) $(INCLUDES) $(CLAGS) $(LIBS) $(LDFLAGRXR) -fPIC
|
$(CXX) -o $@ $(SRC_CLNT) $(FLAGS) $(INCLUDES) $(CLAGS) $(LIBS) $(LDFLAGRXR) -fPIC
|
||||||
#$(EIGERFLAGS)
|
#$(EIGERFLAGS)
|
||||||
|
|
||||||
|
|
||||||
ifeq ($(EIGERSLS), yes)
|
#ifeq ($(EIGERSLS), yes)
|
||||||
eigerReceiver:
|
#eigerReceiver:
|
||||||
# $(CXX) $(FLAGS) $(CFLAGS) -fPIC -c -o eigerReceiverTest.o eigerReceiver/eigerReceiverTest.cpp $(EIGERFLAGS)
|
# $(CXX) $(FLAGS) $(CFLAGS) -fPIC -c -o eigerReceiverTest.o eigerReceiver/eigerReceiverTest.cpp #$(EIGERFLAGS)
|
||||||
# $(CXX) $(FLAGS) $(CFLAGS) -fPIC -c -o eigerReceiver.o eigerReceiver/eigerReceiver.cpp $(EIGERFLAGS)
|
# $(CXX) $(FLAGS) $(CFLAGS) -fPIC -c -o eigerReceiver.o eigerReceiver/eigerReceiver.cpp $(EIGERFLAGS)
|
||||||
# $(CXX) eigerReceiverTest.o eigerReceiver.o -o eigerReceiver/eigerReceiverTest $(EIGERFLAGS)
|
# $(CXX) eigerReceiverTest.o eigerReceiver.o -o eigerReceiver/eigerReceiverTest $(EIGERFLAGS)
|
||||||
$(CXX) $(FLAGS) $(CFLAGS) $(INCLUDES) -fPIC -c -o eigerReceiver.o eigerReceiverImplementation.cpp $(EIGERFLAGS)
|
# $(CXX) $(FLAGS) $(CFLAGS) $(INCLUDES) -fPIC -c -o eigerReceiver.o eigerReceiverImplementation.cpp $(EIGERFLAGS)
|
||||||
else ifeq ($(ROOTSLS), yes)
|
#else ifeq ($(ROOTSLS), yes)
|
||||||
eigerReceiver: eigerReceiver/eigerReceiverDummy.cpp
|
#eigerReceiver: eigerReceiver/eigerReceiverDummy.cpp
|
||||||
echo "Compiling with root"
|
# echo "Compiling with root"
|
||||||
$(CXX) $(FLAGS) $(CFLAGS) -fPIC -c -o eigerReceiver.o eigerReceiver/eigerReceiverDummy.cpp $(ROOTFLAGS)
|
# $(CXX) $(FLAGS) $(CFLAGS) -fPIC -c -o eigerReceiver.o eigerReceiver/eigerReceiverDummy.cpp $(ROOTFLAGS)
|
||||||
else
|
#else
|
||||||
eigerReceiver: eigerReceiver/eigerReceiverDummy.cpp
|
#eigerReceiver: eigerReceiver/eigerReceiverDummy.cpp
|
||||||
$(CXX) $(FLAGS) $(CFLAGS) $(INCLUDES) -fPIC -c -o eigerReceiver.o eigerReceiver/eigerReceiverDummy.cpp
|
# $(CXX) $(FLAGS) $(CFLAGS) $(INCLUDES) -fPIC -c -o eigerReceiver.o eigerReceiver/eigerReceiverDummy.cpp
|
||||||
endif
|
#endif
|
||||||
|
|
||||||
lib:
|
lib:
|
||||||
cd ../ && $(MAKE) DESTDIR=../bin LIBDIR=../bin
|
cd ../ && $(MAKE) DESTDIR=../bin LIBDIR=../bin
|
||||||
|
|||||||
@@ -20,12 +20,10 @@
|
|||||||
#include <iomanip> //set precision
|
#include <iomanip> //set precision
|
||||||
#include <sys/mman.h> //munmap
|
#include <sys/mman.h> //munmap
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
//#include "utilities.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@@ -216,90 +214,9 @@ void UDPBaseImplementation::initializeMembers(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int UDPBaseImplementation::setDetectorType(detectorType det){
|
int UDPBaseImplementation::setDetectorType(detectorType det){
|
||||||
cout << "Setting Receiver Type " << endl;
|
cout << "[WARNING] This is a base implementation, " << __func__ << " not correctly implemented" << endl;
|
||||||
|
|
||||||
deleteMembers();
|
|
||||||
initializeMembers();
|
|
||||||
|
|
||||||
myDetectorType = det;
|
|
||||||
|
|
||||||
switch(myDetectorType){
|
|
||||||
case GOTTHARD:
|
|
||||||
cout << endl << "***** This is a GOTTHARD Receiver *****" << endl << endl;
|
|
||||||
break;
|
|
||||||
case MOENCH:
|
|
||||||
cout << endl << "***** This is a MOENCH Receiver *****" << endl << endl;
|
|
||||||
break;
|
|
||||||
case EIGER:
|
|
||||||
cout << endl << "***** This is a EIGER Receiver *****" << endl << endl;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
cout << endl << "***** Unknown Receiver *****" << endl << endl;
|
|
||||||
return FAIL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//moench variables
|
|
||||||
if(myDetectorType == GOTTHARD){
|
|
||||||
fifosize = GOTTHARD_FIFO_SIZE;
|
|
||||||
packetsPerFrame = GOTTHARD_PACKETS_PER_FRAME;
|
|
||||||
onePacketSize = GOTTHARD_ONE_PACKET_SIZE;
|
|
||||||
frameSize = GOTTHARD_BUFFER_SIZE;
|
|
||||||
bufferSize = GOTTHARD_BUFFER_SIZE;
|
|
||||||
maxPacketsPerFile = MAX_FRAMES_PER_FILE * GOTTHARD_PACKETS_PER_FRAME;
|
|
||||||
frameIndexMask = GOTTHARD_FRAME_INDEX_MASK;
|
|
||||||
frameIndexOffset = GOTTHARD_FRAME_INDEX_OFFSET;
|
|
||||||
packetIndexMask = GOTTHARD_PACKET_INDEX_MASK;
|
|
||||||
}else if(myDetectorType == MOENCH){
|
|
||||||
fifosize = MOENCH_FIFO_SIZE;
|
|
||||||
packetsPerFrame = MOENCH_PACKETS_PER_FRAME;
|
|
||||||
onePacketSize = MOENCH_ONE_PACKET_SIZE;
|
|
||||||
frameSize = MOENCH_BUFFER_SIZE;
|
|
||||||
bufferSize = MOENCH_BUFFER_SIZE;
|
|
||||||
maxPacketsPerFile = MOENCH_MAX_FRAMES_PER_FILE * MOENCH_PACKETS_PER_FRAME;
|
|
||||||
frameIndexMask = MOENCH_FRAME_INDEX_MASK;
|
|
||||||
frameIndexOffset = MOENCH_FRAME_INDEX_OFFSET;
|
|
||||||
packetIndexMask = MOENCH_PACKET_INDEX_MASK;
|
|
||||||
}
|
|
||||||
else if(myDetectorType == EIGER){
|
|
||||||
fifosize = EIGER_FIFO_SIZE;
|
|
||||||
packetsPerFrame = EIGER_ONE_GIGA_CONSTANT * dynamicRange * EIGER_MAX_PORTS;
|
|
||||||
onePacketSize = EIGER_ONE_GIGA_ONE_PACKET_SIZE;
|
|
||||||
frameSize = onePacketSize * packetsPerFrame;
|
|
||||||
bufferSize = (frameSize/EIGER_MAX_PORTS) + EIGER_HEADER_LENGTH;//everything one port gets (img header plus packets)
|
|
||||||
maxPacketsPerFile = EIGER_MAX_FRAMES_PER_FILE * packetsPerFrame;
|
|
||||||
frameIndexMask = EIGER_FRAME_INDEX_MASK;
|
|
||||||
frameIndexOffset = EIGER_FRAME_INDEX_OFFSET;
|
|
||||||
packetIndexMask = EIGER_PACKET_INDEX_MASK;
|
|
||||||
|
|
||||||
pthread_mutex_lock(&status_mutex);
|
|
||||||
listeningthreads_mask = 0x0;
|
|
||||||
pthread_mutex_unlock(&(status_mutex));
|
|
||||||
if(thread_started)
|
|
||||||
createListeningThreads(true);
|
|
||||||
|
|
||||||
numListeningThreads = MAX_NUM_LISTENING_THREADS;
|
|
||||||
}
|
|
||||||
latestData = new char[frameSize];
|
|
||||||
|
|
||||||
|
|
||||||
setupFifoStructure();
|
|
||||||
|
|
||||||
if(createListeningThreads() == FAIL){
|
|
||||||
cout << "ERROR: Could not create listening thread" << endl;
|
|
||||||
exit (-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(createWriterThreads() == FAIL){
|
|
||||||
cout << "ERROR: Could not create writer threads" << endl;
|
|
||||||
exit (-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
setThreadPriorities();
|
|
||||||
|
|
||||||
cout << "Ready..." << endl;
|
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,6 +244,7 @@ uint32_t UDPBaseImplementation::getFrameIndex(){
|
|||||||
return frameIndex;
|
return frameIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t UDPBaseImplementation::getAcquisitionIndex(){
|
uint32_t UDPBaseImplementation::getAcquisitionIndex(){
|
||||||
if(!totalPacketsCaught)
|
if(!totalPacketsCaught)
|
||||||
acquisitionIndex=-1;
|
acquisitionIndex=-1;
|
||||||
@@ -343,20 +261,17 @@ void UDPBaseImplementation::resetTotalFramesCaught(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*file parameters*/
|
/*file parameters*/
|
||||||
|
|
||||||
char* UDPBaseImplementation::getFilePath() const{
|
char* UDPBaseImplementation::getFilePath() const{
|
||||||
|
FILE_LOG(logWARNING) << "[WARNING] This is a base implementation, " << __func__ << " could have no effects.x" << endl;
|
||||||
return (char*)filePath;
|
return (char*)filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* UDPBaseImplementation::setFilePath(const char c[]){
|
char* UDPBaseImplementation::setFilePath(const char c[]){
|
||||||
|
cout << "[WARNING] This is a base implementation, " << __func__ << " could have no effects." << endl;
|
||||||
|
|
||||||
|
/*
|
||||||
if(strlen(c)){
|
if(strlen(c)){
|
||||||
//check if filepath exists
|
//check if filepath exists
|
||||||
struct stat st;
|
struct stat st;
|
||||||
@@ -367,6 +282,7 @@ char* UDPBaseImplementation::setFilePath(const char c[]){
|
|||||||
cout << "FilePath does not exist:" << filePath << endl;
|
cout << "FilePath does not exist:" << filePath << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return getFilePath();
|
return getFilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,8 +292,11 @@ char* UDPBaseImplementation::getFileName() const{
|
|||||||
}
|
}
|
||||||
|
|
||||||
char* UDPBaseImplementation::setFileName(const char c[]){
|
char* UDPBaseImplementation::setFileName(const char c[]){
|
||||||
|
cout << "[WARNING] This is a base implementation, " << __func__ << " could have no effects." << endl;
|
||||||
|
/*
|
||||||
if(strlen(c))
|
if(strlen(c))
|
||||||
strcpy(fileName,c);
|
strcpy(fileName,c);
|
||||||
|
*/
|
||||||
return getFileName();
|
return getFileName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,13 +306,17 @@ int UDPBaseImplementation::getFileIndex(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
int UDPBaseImplementation::setFileIndex(int i){
|
int UDPBaseImplementation::setFileIndex(int i){
|
||||||
|
cout << "[WARNING] This is a base implementation, " << __func__ << " could have no effects." << endl;
|
||||||
|
/*
|
||||||
if(i>=0)
|
if(i>=0)
|
||||||
fileIndex = i;
|
fileIndex = i;
|
||||||
|
*/
|
||||||
return getFileIndex();
|
return getFileIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int UDPBaseImplementation::setFrameIndexNeeded(int i){
|
int UDPBaseImplementation::setFrameIndexNeeded(int i){
|
||||||
|
cout << "[WARNING] This is a base implementation, " << __func__ << " could have no effects." << endl;
|
||||||
frameIndexNeeded = i;
|
frameIndexNeeded = i;
|
||||||
return frameIndexNeeded;
|
return frameIndexNeeded;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @short does all the functions for a receiver, set/get parameters, start/stop etc.
|
* @short does all the functions for a receiver, set/get parameters, start/stop etc.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ using namespace std;
|
|||||||
|
|
||||||
#include "UDPInterface.h"
|
#include "UDPInterface.h"
|
||||||
#include "UDPBaseImplementation.h"
|
#include "UDPBaseImplementation.h"
|
||||||
|
#include "UDPStandardImplementation.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -30,7 +31,9 @@ using namespace std;
|
|||||||
UDPInterface * UDPInterface::create(string receiver_type){
|
UDPInterface * UDPInterface::create(string receiver_type){
|
||||||
|
|
||||||
if (receiver_type == "standard")
|
if (receiver_type == "standard")
|
||||||
return new UDPBaseImplementation();
|
return new UDPStandardImplementation();
|
||||||
|
//else if (receiver_type == "REST")
|
||||||
|
// return new UDPRESTImplementation();
|
||||||
else{
|
else{
|
||||||
cout << "[ERROR] UDP interface not supported, using standard implementation" << endl;
|
cout << "[ERROR] UDP interface not supported, using standard implementation" << endl;
|
||||||
return new UDPBaseImplementation();
|
return new UDPBaseImplementation();
|
||||||
|
|||||||
@@ -16,6 +16,9 @@
|
|||||||
#include "receiver_defs.h"
|
#include "receiver_defs.h"
|
||||||
#include "MySocketTCP.h"
|
#include "MySocketTCP.h"
|
||||||
|
|
||||||
|
#include "utilities.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void print_not_implemented(string method_name){
|
void print_not_implemented(string method_name){
|
||||||
std::cout << "[WARNING] Method " << method_name << " not implemented!" << std::endl;
|
std::cout << "[WARNING] Method " << method_name << " not implemented!" << std::endl;
|
||||||
|
|||||||
@@ -6,6 +6,9 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "utilities.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,7 @@
|
|||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
||||||
#include "slsReceiver.h"
|
#include "slsReceiver.h"
|
||||||
#include "UDPInterface.h"
|
//#include "UDPInterface.h"
|
||||||
|
|
||||||
#include "utilities.h"
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@@ -35,6 +33,7 @@ slsReceiver::slsReceiver(int argc, char *argv[], int &success){
|
|||||||
int tcpip_port_no = 1984;
|
int tcpip_port_no = 1984;
|
||||||
success=OK;
|
success=OK;
|
||||||
string fname = "";
|
string fname = "";
|
||||||
|
string udp_interface_type = "standard";
|
||||||
|
|
||||||
//parse command line for config
|
//parse command line for config
|
||||||
static struct option long_options[] = {
|
static struct option long_options[] = {
|
||||||
@@ -42,6 +41,7 @@ slsReceiver::slsReceiver(int argc, char *argv[], int &success){
|
|||||||
//{"verbose", no_argument, &verbose_flag, 1},
|
//{"verbose", no_argument, &verbose_flag, 1},
|
||||||
/* These options don’t set a flag.
|
/* These options don’t set a flag.
|
||||||
We distinguish them by their indices. */
|
We distinguish them by their indices. */
|
||||||
|
{"type", required_argument, 0, 't'},
|
||||||
{"config", required_argument, 0, 'f'},
|
{"config", required_argument, 0, 'f'},
|
||||||
{"rx_tcpport", required_argument, 0, 'b'},
|
{"rx_tcpport", required_argument, 0, 'b'},
|
||||||
{"help", no_argument, 0, 'h'},
|
{"help", no_argument, 0, 'h'},
|
||||||
@@ -52,7 +52,7 @@ slsReceiver::slsReceiver(int argc, char *argv[], int &success){
|
|||||||
int c;
|
int c;
|
||||||
|
|
||||||
while ( c != -1 ){
|
while ( c != -1 ){
|
||||||
c = getopt_long (argc, argv, "bfh", long_options, &option_index);
|
c = getopt_long (argc, argv, "bfht", long_options, &option_index);
|
||||||
|
|
||||||
/* Detect the end of the options. */
|
/* Detect the end of the options. */
|
||||||
if (c == -1)
|
if (c == -1)
|
||||||
@@ -61,12 +61,15 @@ slsReceiver::slsReceiver(int argc, char *argv[], int &success){
|
|||||||
switch(c){
|
switch(c){
|
||||||
case 'f':
|
case 'f':
|
||||||
fname = optarg;
|
fname = optarg;
|
||||||
cout << long_options[option_index].name << " " << optarg << endl;
|
//cout << long_options[option_index].name << " " << optarg << endl;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'b':
|
case 'b':
|
||||||
sscanf(optarg, "%d", &tcpip_port_no);
|
sscanf(optarg, "%d", &tcpip_port_no);
|
||||||
cout << long_options[option_index].name << " " << optarg << endl;
|
break;
|
||||||
|
|
||||||
|
case 't':
|
||||||
|
udp_interface_type = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
@@ -74,6 +77,7 @@ slsReceiver::slsReceiver(int argc, char *argv[], int &success){
|
|||||||
help_message += """usage: slsReceiver --config config_fname [--rx_tcpport port]\n\n""";
|
help_message += """usage: slsReceiver --config config_fname [--rx_tcpport port]\n\n""";
|
||||||
help_message += """\t--config:\t configuration filename for SLS Detector receiver\n""";
|
help_message += """\t--config:\t configuration filename for SLS Detector receiver\n""";
|
||||||
help_message += """\t--rx_tcpport:\t TCP Communication Port with the client. Default: 1954.\n\n""";
|
help_message += """\t--rx_tcpport:\t TCP Communication Port with the client. Default: 1954.\n\n""";
|
||||||
|
help_message += """\t--type:\t Type of the receiver. Possible arguments are: standard, REST. Default: standard.\n\n""";
|
||||||
cout << help_message << endl;
|
cout << help_message << endl;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -85,30 +89,35 @@ slsReceiver::slsReceiver(int argc, char *argv[], int &success){
|
|||||||
success = FAIL;
|
success = FAIL;
|
||||||
|
|
||||||
if((!fname.empty()) && (success == OK)){
|
if((!fname.empty()) && (success == OK)){
|
||||||
VERBOSE_PRINT("config file name " + fname );
|
FILE_LOG(logINFO) << "config file name " << fname;
|
||||||
success = read_config_file(fname, &tcpip_port_no);
|
success = read_config_file(fname, &tcpip_port_no);
|
||||||
VERBOSE_PRINT("Read configuration file of " + iline + " lines");
|
//VERBOSE_PRINT("Read configuration file of " + iline + " lines");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cout << "Error opening configuration file " << fname << endl;
|
FILE_LOG(logERROR) << "Error opening configuration file " << fname ;
|
||||||
success = FAIL;
|
success = FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(success != OK){
|
if(success != OK){
|
||||||
cout << "Failed: see output above for more information " << endl;
|
FILE_LOG(logERROR) << "Failed: see output above for more information " ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success==OK){
|
if (success==OK){
|
||||||
cout << "SLS Receiver starting" << endl;
|
cout << "SLS Receiver starting" << endl;
|
||||||
udp_interface = UDPInterface::create("standard");
|
udp_interface = UDPInterface::create(udp_interface_type);
|
||||||
tcpipInterface = new slsReceiverTCPIPInterface(success, udp_interface, tcpip_port_no);
|
tcpipInterface = new slsReceiverTCPIPInterface(success, udp_interface, tcpip_port_no);
|
||||||
//tcp ip interface
|
//tcp ip interface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
slsReceiver::~slsReceiver() {if(udp_interface) delete udp_interface; if(tcpipInterface) delete tcpipInterface;}
|
slsReceiver::~slsReceiver() {
|
||||||
|
if(udp_interface)
|
||||||
|
delete udp_interface;
|
||||||
|
if(tcpipInterface)
|
||||||
|
delete tcpipInterface;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int slsReceiver::start() {
|
int slsReceiver::start() {
|
||||||
|
|||||||
@@ -8,11 +8,11 @@
|
|||||||
|
|
||||||
#include "slsReceiverTCPIPInterface.h"
|
#include "slsReceiverTCPIPInterface.h"
|
||||||
#include "UDPInterface.h"
|
#include "UDPInterface.h"
|
||||||
#include "UDPBaseImplementation.h"
|
//#include "UDPBaseImplementation.h"
|
||||||
|
|
||||||
#include "receiver_defs.h"
|
#include "receiver_defs.h"
|
||||||
#include "MySocketTCP.h"
|
#include "MySocketTCP.h"
|
||||||
|
//#include "utilities.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user