mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 15:00:02 +02:00
slsreceiver: removed option to start receiver with config file, redundant as the only option is receiver tcp port
This commit is contained in:
parent
b07492be6f
commit
13f9b9929a
@ -10,7 +10,6 @@ set(SOURCES
|
||||
src/DataProcessor.cpp
|
||||
src/DataStreamer.cpp
|
||||
src/Fifo.cpp
|
||||
../slsSupportLib/src/utilities.cpp
|
||||
../slsSupportLib/src/ClientInterface.cpp
|
||||
)
|
||||
|
||||
@ -54,7 +53,6 @@ set(PUBLICHEADERS
|
||||
../slsSupportLib/include/genericSocket.h
|
||||
../slsSupportLib/include/logger.h
|
||||
../slsSupportLib/include/sls_detector_exceptions.h
|
||||
../slsSupportLib/include/utilities.h
|
||||
)
|
||||
|
||||
|
||||
|
@ -26,8 +26,8 @@ LIBZMQ = -L$(LIBZMQDIR) -Wl,-rpath=$(LIBZMQDIR) -lzmq
|
||||
|
||||
|
||||
|
||||
SRC_CLNT = ThreadObject.cpp Listener.cpp DataProcessor.cpp DataStreamer.cpp Fifo.cpp File.cpp BinaryFile.cpp slsReceiverImplementation.cpp slsReceiverTCPIPInterface.cpp slsReceiver.cpp slsReceiverUsers.cpp $(COMMONDIR)/utilities.cpp
|
||||
DEPSINCLUDES = $(COMMONDIR)/ansi.h $(COMMONDIR)/sls_detector_defs.h $(COMMONDIR)/sls_detector_funcs.h $(COMMONDIR)/GeneralData.h $(INCDIR)/circularFifo.h $(COMMONDIR)/genericSocket.h $(COMMONDIR)/logger.h $(INCDIR)/receiver_defs.h $(COMMONDIR)/utilities.h $(COMMONDIR)/ZmqSocket.h $(INCDIR)/BinaryFileStatic.h $(INCDIR)/HDF5FileStatic.h $(COMMONDIR)/sls_detector_exceptions.h
|
||||
SRC_CLNT = ThreadObject.cpp Listener.cpp DataProcessor.cpp DataStreamer.cpp Fifo.cpp File.cpp BinaryFile.cpp slsReceiverImplementation.cpp slsReceiverTCPIPInterface.cpp slsReceiver.cpp slsReceiverUsers.cpp
|
||||
DEPSINCLUDES = $(COMMONDIR)/ansi.h $(COMMONDIR)/sls_detector_defs.h $(COMMONDIR)/sls_detector_funcs.h $(COMMONDIR)/GeneralData.h $(INCDIR)/circularFifo.h $(COMMONDIR)/genericSocket.h $(COMMONDIR)/logger.h $(INCDIR)/receiver_defs.h $(COMMONDIR)/ZmqSocket.h $(INCDIR)/BinaryFileStatic.h $(INCDIR)/HDF5FileStatic.h $(COMMONDIR)/sls_detector_exceptions.h
|
||||
|
||||
|
||||
ifeq ($(HDF5),yes)
|
||||
|
@ -3,15 +3,12 @@
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
#include "slsReceiverUsers.h"
|
||||
#include "logger.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
#include <signal.h> //SIGINT
|
||||
#include <cstdlib> //system
|
||||
|
||||
#include "utilities.h"
|
||||
#include "logger.h"
|
||||
|
||||
#include <sys/types.h> //wait
|
||||
#include <sys/wait.h> //wait
|
||||
#include <unistd.h> //usleep
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "slsReceiverTCPIPInterface.h"
|
||||
#include "gitInfoReceiver.h"
|
||||
#include "logger.h"
|
||||
#include "utilities.h"
|
||||
|
||||
slsReceiver::slsReceiver(int argc, char *argv[]):
|
||||
tcpipInterface (nullptr) {
|
||||
@ -24,7 +23,6 @@ slsReceiver::slsReceiver(int argc, char *argv[]):
|
||||
// options
|
||||
std::map<std::string, std::string> configuration_map;
|
||||
int tcpip_port_no = 1954;
|
||||
std::string fname = "";
|
||||
int64_t tempval = 0;
|
||||
|
||||
//parse command line for config
|
||||
@ -32,7 +30,6 @@ slsReceiver::slsReceiver(int argc, char *argv[]):
|
||||
// These options set a flag.
|
||||
//{"verbose", no_argument, &verbose_flag, 1},
|
||||
// These options don’t set a flag. We distinguish them by their indices.
|
||||
{"config", required_argument, nullptr, 'f'},
|
||||
{"rx_tcpport", required_argument, nullptr, 't'},
|
||||
{"version", no_argument, nullptr, 'v'},
|
||||
{"help", no_argument, nullptr, 'h'},
|
||||
@ -54,13 +51,6 @@ slsReceiver::slsReceiver(int argc, char *argv[]):
|
||||
|
||||
switch(c){
|
||||
|
||||
case 'f':
|
||||
fname = optarg;
|
||||
#ifdef VERYVERBOSE
|
||||
FILE_LOG(logDEBUG) << long_options[option_index].name << " " << optarg << endl;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 't':
|
||||
sscanf(optarg, "%d", &tcpip_port_no);
|
||||
break;
|
||||
@ -77,7 +67,6 @@ slsReceiver::slsReceiver(int argc, char *argv[]):
|
||||
+ std::string(argv[0]) + "\n"
|
||||
+ "Usage: " + std::string(argv[0]) + " [arguments]\n"
|
||||
+ "Possible arguments are:\n"
|
||||
+ "\t-f, --config <fname> : Loads config from file\n"
|
||||
+ "\t-t, --rx_tcpport <port> : TCP Communication Port with client. \n"
|
||||
+ "\t Default: 1954. Required for multiple \n"
|
||||
+ "\t receivers\n\n";
|
||||
@ -88,10 +77,6 @@ slsReceiver::slsReceiver(int argc, char *argv[]):
|
||||
}
|
||||
}
|
||||
|
||||
if( !fname.empty() && read_config_file(fname, &tcpip_port_no, &configuration_map) == FAIL) {
|
||||
throw std::exception();
|
||||
}
|
||||
|
||||
// might throw an exception
|
||||
tcpipInterface = new slsReceiverTCPIPInterface(tcpip_port_no);
|
||||
|
||||
|
@ -4,22 +4,10 @@
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <fstream>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
/**
|
||||
* Read config file for receiver
|
||||
* @param fname config file name
|
||||
* @param tcpip_port_no pointer to tcp port number
|
||||
* @param map map
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int read_config_file(std::string fname, int *tcpip_port_no,
|
||||
std::map<std::string, std::string> * configuration_map);
|
||||
|
||||
|
||||
/** (used by multi and sls)
|
||||
* reads a short int raw data file
|
||||
* @param infile input file stream
|
||||
|
@ -5,73 +5,6 @@
|
||||
#include <sstream>
|
||||
|
||||
|
||||
|
||||
|
||||
int read_config_file(std::string fname, int *tcpip_port_no,
|
||||
std::map<std::string, std::string> * configuration_map) {
|
||||
|
||||
std::ifstream infile;
|
||||
std::string sLine,sargname, sargvalue;
|
||||
int iline = 0;
|
||||
int success = slsDetectorDefs::OK;
|
||||
|
||||
|
||||
FILE_LOG(logINFO) << "config file name " << fname;
|
||||
try {
|
||||
infile.open(fname.c_str(), std::ios_base::in);
|
||||
} catch(...) {
|
||||
FILE_LOG(logERROR) << "Could not open configuration file " << fname ;
|
||||
success = slsDetectorDefs::FAIL;
|
||||
}
|
||||
|
||||
if (success == slsDetectorDefs::OK && infile.is_open()) {
|
||||
while(infile.good()){
|
||||
getline(infile,sLine);
|
||||
iline++;
|
||||
|
||||
//VERBOSE_PRINT(sLine);
|
||||
|
||||
if(sLine.find('#') != std::string::npos)
|
||||
continue;
|
||||
|
||||
else if(sLine.length()<2)
|
||||
continue;
|
||||
|
||||
else{
|
||||
std::istringstream sstr(sLine);
|
||||
|
||||
//parameter name
|
||||
if(sstr.good()){
|
||||
sstr >> sargname;
|
||||
|
||||
if (! sstr.good())
|
||||
continue;
|
||||
|
||||
sstr >> sargvalue;
|
||||
(*configuration_map)[sargname] = sargvalue;
|
||||
}
|
||||
//tcp port
|
||||
if(sargname=="rx_tcpport"){
|
||||
if(sstr.good()) {
|
||||
sstr >> sargname;
|
||||
if(sscanf(sargname.c_str(),"%d",tcpip_port_no))
|
||||
cprintf(RESET, "dataport: %d\n" , *tcpip_port_no);
|
||||
else{
|
||||
cprintf(RED, "could not decode port in config file. Exiting.\n");
|
||||
success = slsDetectorDefs::FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
infile.close();
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int readDataFile(std::ifstream &infile, short int *data, int nch, int offset) {
|
||||
int ichan, iline=0;
|
||||
short int idata;
|
||||
|
Loading…
x
Reference in New Issue
Block a user