mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 15:00:02 +02:00
Merge branch 'master' of gitorious.psi.ch:sls_det_software/sls_receiver_software
This commit is contained in:
commit
11f6d883be
@ -26,6 +26,8 @@ endif
|
||||
|
||||
MAIN_SRC = main.cpp
|
||||
|
||||
DUMMY_MAIN_SRC = dummyMain.cpp
|
||||
|
||||
OBJS=$(SRC_CLNT:%.cpp=$(BUILDDIR)/%.o)
|
||||
|
||||
|
||||
@ -40,6 +42,8 @@ $(info )
|
||||
|
||||
all: builddir lib receiver
|
||||
|
||||
dummy: $(DESTDIR)/dummyReceiver
|
||||
|
||||
intdoc: $(SRC_H) $(SRC_CLNT)
|
||||
doxygen doxy.config
|
||||
|
||||
@ -70,6 +74,11 @@ $(DESTDIR)/slsReceiver: lib
|
||||
#$(EIGERFLAGS)
|
||||
|
||||
|
||||
$(DESTDIR)/dummyReceiver: lib
|
||||
$(CXX) -o $@ $(SRCDIR)/$(DUMMY_MAIN_SRC) $(FLAGS) $(INCLUDES) $(CLAGS) $(LIBS) $(LDFLAGRXR) -fPIC
|
||||
#$(EIGERFLAGS)
|
||||
|
||||
|
||||
# Stand-alone Mysocket tests
|
||||
mysocket_test:
|
||||
g++ -o $(TESTDIR)/MySocketTCP.o -c $(SRCDIR)/MySocketTCP.cpp -I include
|
||||
|
419
slsReceiverSoftware/include/dummyUDPInterface.h
Normal file
419
slsReceiverSoftware/include/dummyUDPInterface.h
Normal file
@ -0,0 +1,419 @@
|
||||
#ifndef DUMMYUDPINTERFACE_H
|
||||
#define DUMMYUDPINTERFACE_H
|
||||
|
||||
/***********************************************
|
||||
* @file UDPInterface.h
|
||||
* @short Base class with all the functions for the UDP inteface of the receiver
|
||||
***********************************************/
|
||||
/**
|
||||
* \mainpage Base class with all the functions for the UDP inteface of the receiver
|
||||
*/
|
||||
|
||||
/**
|
||||
* @short Base class with all the functions for the UDP inteface of the receiver
|
||||
*/
|
||||
|
||||
#include "UDPInterface.h"
|
||||
#include "sls_receiver_defs.h"
|
||||
|
||||
|
||||
class dummyUDPInterface : public UDPInterface {
|
||||
|
||||
|
||||
/* abstract class that defines the UDP interface of an sls detector data receiver.
|
||||
*
|
||||
* Use the factory method UDPInterface::create() to get an instance:
|
||||
*
|
||||
* UDPInterface *udp_interface = UDPInterface::create()
|
||||
*
|
||||
* supported sequence of method-calls:
|
||||
*
|
||||
* initialize() : once and only once after create()
|
||||
*
|
||||
* get*() : anytime after initialize(), multiples times
|
||||
* set*() : anytime after initialize(), multiple times
|
||||
*
|
||||
* startReceiver(): anytime after initialize(). Will fail if state already is 'running'
|
||||
*
|
||||
* abort(),
|
||||
* stopReceiver() : anytime after initialize(). Will do nothing if state already is idle.
|
||||
*
|
||||
* getStatus() returns the actual state of the data receiver - running or idle. All other
|
||||
* get*() and set*() methods access the local cache of configuration values only and *do not* modify the data receiver settings.
|
||||
*
|
||||
* Only startReceiver() does change the data receiver configuration, it does pass the whole configuration cache to the data receiver.
|
||||
*
|
||||
* get- and set-methods that return a char array (char *) allocate a new array at each call. The caller is responsible to free the allocated space:
|
||||
*
|
||||
* char *c = receiver->getFileName();
|
||||
* ....
|
||||
* delete[] c;
|
||||
*
|
||||
* always: 1:YES 0:NO for int as bool-like arguments
|
||||
*
|
||||
*/
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
dummyUDPInterface() : UDPInterface(), dynamicRange(16), scanTag(1000), nFrames(100), fWrite(1), fOverwrite(1), fIndex(0), fCaught(0), totfCaught(0), startAcqIndex(0), startFrameIndex(0), acqIndex(0), dataCompression(false), period(0), type(slsReceiverDefs::GENERIC), framesNeeded(100), udpPort1(1900), udpPort2(1901), shortFrame(0), nFramesToGui(0), e10G(0) {strcpy(detHostname,"none"); strcpy(fName,"run"); strcpy(fPath,"/scratch/"); strcpy(eth,"eth0"); cout << "New dummy UDP Interface" << endl;};
|
||||
|
||||
~dummyUDPInterface() {cout << "Destroying dummy UDP Interface" << endl;};
|
||||
|
||||
|
||||
void del(){cout << "Destroying dummy UDP Interface" << endl;};
|
||||
|
||||
virtual void configure(map<string, string> config_map) {};
|
||||
/**
|
||||
* Initialize the Receiver
|
||||
@param detectorHostName detector hostname
|
||||
* you can call this function only once. You must call it before you call startReceiver() for the first time.
|
||||
*/
|
||||
virtual void initialize(const char *detectorHostName){ cout << "set detector hostname to" << detHostname << endl; strcpy(detHostname,detectorHostName);};
|
||||
|
||||
|
||||
/* Returns detector hostname
|
||||
/returns hostname
|
||||
* caller needs to deallocate the returned char array.
|
||||
* if uninitialized, it must return NULL
|
||||
*/
|
||||
virtual char *getDetectorHostname() const { cout << "get detector hostname " << detHostname << endl; return (char*) detHostname;};
|
||||
|
||||
/**
|
||||
* Returns status of receiver: idle, running or error
|
||||
*/
|
||||
virtual slsReceiverDefs::runStatus getStatus() const { cout << "get dsummy status IDLE " << endl; return slsReceiverDefs::IDLE;};;
|
||||
|
||||
/**
|
||||
* Returns File Name
|
||||
* caller is responsible to deallocate the returned char array.
|
||||
*/
|
||||
virtual char *getFileName() const { cout << "get file name " << fName << endl; return (char*) fName;};
|
||||
|
||||
|
||||
/**
|
||||
* Returns File Path
|
||||
* caller is responsible to deallocate the returned char array
|
||||
*/
|
||||
virtual char *getFilePath() const { cout << "get file path " << fPath << endl; return (char*) fPath;};;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of bits per pixel
|
||||
*/
|
||||
virtual int getDynamicRange() const { cout << "get dynamic range " << dynamicRange << endl; return dynamicRange;};;
|
||||
|
||||
/**
|
||||
* Returns scan tag
|
||||
*/
|
||||
virtual int getScanTag() const { cout << "get scan tag " << scanTag << endl; return scanTag;};
|
||||
|
||||
/*
|
||||
* Returns number of frames to receive
|
||||
* This is the number of frames to expect to receiver from the detector.
|
||||
* The data receiver will change from running to idle when it got this number of frames
|
||||
*/
|
||||
virtual int getNumberOfFrames() const { cout << "get number of frames " << nFrames << endl; return nFrames;};
|
||||
|
||||
/**
|
||||
* Returns file write enable
|
||||
* 1: YES 0: NO
|
||||
*/
|
||||
virtual int getEnableFileWrite() const { cout << "get enable file write " << fWrite << endl; return fWrite;};
|
||||
|
||||
/**
|
||||
* Returns file over write enable
|
||||
* 1: YES 0: NO
|
||||
*/
|
||||
virtual int getEnableOverwrite() const { cout << "get enable file overwrite " << fOverwrite << endl; return fOverwrite;};
|
||||
|
||||
/**
|
||||
* Set File Name (without frame index, file index and extension)
|
||||
@param c file name
|
||||
/returns file name
|
||||
* returns NULL on failure (like bad file name)
|
||||
* does not check the existence of the file - we don't know which path we'll finally use, so no point to check.
|
||||
* caller is responsible to deallocate the returned char array.
|
||||
*/
|
||||
virtual char* setFileName(const char c[]) { strcpy(fName,c); cout << "set file name " << fName << endl; return fName; };
|
||||
|
||||
/**
|
||||
* Set File Path
|
||||
@param c file path
|
||||
/returns file path
|
||||
* checks the existence of the directory. returns NULL if directory does not exist or is not readable.
|
||||
* caller is responsible to deallocate the returned char array.
|
||||
*/
|
||||
virtual char* setFilePath(const char c[]) { strcpy(fPath,c); cout << "set file path " << fPath << endl; return fPath; };
|
||||
|
||||
/**
|
||||
* Returns the number of bits per pixel
|
||||
@param dr sets dynamic range
|
||||
/returns dynamic range
|
||||
* returns -1 on failure
|
||||
* FIXME: what are the allowd values - should we use an enum as argument?
|
||||
*/
|
||||
virtual int setDynamicRange(const int dr) {dynamicRange=dr; cout << "set dynamic range " << dynamicRange << endl; return dynamicRange; };
|
||||
|
||||
|
||||
/**
|
||||
* Set scan tag
|
||||
@param tag scan tag
|
||||
/returns scan tag (always non-negative)
|
||||
* FIXME: valid range - only positive? 16bit ore 32bit?
|
||||
* returns -1 on failure
|
||||
*/
|
||||
virtual int setScanTag(const int tag) {scanTag=tag; cout << "set scan tag " << scanTag << endl; return scanTag; };
|
||||
|
||||
|
||||
/**
|
||||
* Sets number of frames
|
||||
@param fnum number of frames
|
||||
/returns number of frames
|
||||
*/
|
||||
virtual int setNumberOfFrames(const int fnum) {nFrames=fnum; cout << "set number of frames " << nFrames << endl; return nFrames; };
|
||||
|
||||
|
||||
/**
|
||||
* Set enable file write
|
||||
* @param i file write enable
|
||||
/returns file write enable
|
||||
*/
|
||||
virtual int setEnableFileWrite(const int i) {fWrite=i; cout << "set enable file write " << fWrite << endl; return fWrite; };
|
||||
|
||||
|
||||
/**
|
||||
* Set enable file overwrite
|
||||
* @param i file overwrite enable
|
||||
/returns file overwrite enable
|
||||
*/
|
||||
virtual int setEnableOverwrite(const int i) {fOverwrite=i; cout << "set enable file overwrite " << fOverwrite << endl; return fOverwrite; };
|
||||
|
||||
|
||||
/**
|
||||
* Starts Receiver - activate all configuration settings to the eiger receiver and start to listen for packets
|
||||
@param message is the error message if there is an error
|
||||
/returns 0 on success or -1 on failure
|
||||
*/
|
||||
//FIXME: success == 0 or success == 1?
|
||||
virtual int startReceiver(char *message=NULL) {cout << "dummy start receiver" << endl; return 0;};
|
||||
|
||||
/**
|
||||
* Stops Receiver - stops listening for packets
|
||||
/returns success
|
||||
* same as abort(). Always returns 0.
|
||||
*/
|
||||
virtual int stopReceiver() {cout << "dummy stop receiver" << endl; return 0;};
|
||||
|
||||
/**
|
||||
* abort acquisition with minimum damage: close open files, cleanup.
|
||||
* does nothing if state already is 'idle'
|
||||
*/
|
||||
virtual void abort() {cout << "Aborting receiver" << endl; };
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************************************************
|
||||
**************************************** Added by Dhanya *********************************************************
|
||||
*******************************************************************************************************************/
|
||||
|
||||
/**
|
||||
* Returns File Index
|
||||
*/
|
||||
virtual int getFileIndex() {cout << "get file index " << fIndex << endl; return fIndex;};
|
||||
|
||||
/**
|
||||
* Returns Total Frames Caught for an entire acquisition (including all scans)
|
||||
*/
|
||||
virtual int getTotalFramesCaught() {cout << "get total frames caught " << totfCaught << endl ; return totfCaught;};
|
||||
|
||||
/**
|
||||
* Returns Frames Caught for each real time acquisition (eg. for each scan)
|
||||
*/
|
||||
virtual int getFramesCaught() {cout << "get frames caught " << fCaught << endl; return fCaught;};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the frame index at start of entire acquisition (including all scans)
|
||||
*/
|
||||
virtual uint32_t getStartAcquisitionIndex(){ cout << "get start acquisition index " << startAcqIndex << endl; return startAcqIndex; };
|
||||
|
||||
/**
|
||||
* Returns current Frame Index Caught for an entire acquisition (including all scans)
|
||||
*/
|
||||
virtual uint32_t getAcquisitionIndex(){ cout << "get acquisition index " << acqIndex << endl; return acqIndex; };
|
||||
|
||||
|
||||
/**
|
||||
* Returns the frame index at start of each real time acquisition (eg. for each scan)
|
||||
*/
|
||||
virtual uint32_t getStartFrameIndex() { cout << "get start frame index " << startFrameIndex << endl; return startFrameIndex; };
|
||||
|
||||
|
||||
/** get data compression, by saving only hits
|
||||
*/
|
||||
virtual bool getDataCompression() { cout << "get data compression " << dataCompression << endl; return dataCompression;};
|
||||
|
||||
/**
|
||||
* Set receiver type
|
||||
* @param det detector type
|
||||
* Returns success or FAIL
|
||||
*/
|
||||
virtual int setDetectorType(slsReceiverDefs::detectorType det) {type=det; cout << "set detector type " << det << endl; return slsReceiverDefs::OK;};
|
||||
|
||||
/**
|
||||
* Set File Index
|
||||
* @param i file index
|
||||
*/
|
||||
virtual int setFileIndex(int i) {fIndex=i; cout << "get file index " << fIndex << endl; return fIndex;};
|
||||
|
||||
/** set acquisition period if a positive number
|
||||
*/
|
||||
virtual int64_t setAcquisitionPeriod(int64_t index) {if (index>=0) {period=index; cout << "set period " << period << endl;} else { cout << "get period " << period << endl;} return period;};
|
||||
|
||||
/**
|
||||
* Set Frame Index Needed
|
||||
* @param i frame index needed
|
||||
*/
|
||||
virtual int setFrameIndexNeeded(int i) {framesNeeded=i; cout << "set frame index needed " << period << endl; return framesNeeded;};
|
||||
|
||||
/**
|
||||
* Set UDP Port Number
|
||||
*/
|
||||
virtual void setUDPPortNo(int p){udpPort1=p; cout << "set UDP port 1 " << udpPort1 << endl; };
|
||||
|
||||
|
||||
/**
|
||||
* Set UDP Port Number
|
||||
*/
|
||||
virtual void setUDPPortNo2(int p) {udpPort2=p; cout << "set UDP port 2 " << udpPort2 << endl; };
|
||||
|
||||
/**
|
||||
* Set Ethernet Interface or IP to listen to
|
||||
*/
|
||||
virtual void setEthernetInterface(char* c){strcpy(eth,c); cout << "set eth " << c;};
|
||||
|
||||
/**
|
||||
* Set short frame
|
||||
* @param i if shortframe i=1
|
||||
*/
|
||||
virtual int setShortFrame(int i){shortFrame=i; cout << " set short frame" << shortFrame << endl; return shortFrame;};
|
||||
|
||||
/**
|
||||
* Set the variable to send every nth frame to gui
|
||||
* or if 0,send frame only upon gui request
|
||||
*/
|
||||
virtual int setNFrameToGui(int i) {nFramesToGui=i; cout << "set nframes to gui " << nFramesToGui << endl; return nFramesToGui;};
|
||||
|
||||
/**
|
||||
* Resets the Total Frames Caught
|
||||
* This is how the receiver differentiates between entire acquisitions
|
||||
* Returns 0
|
||||
*/
|
||||
virtual void resetTotalFramesCaught() {totfCaught=0; cout << "total frames caugh reset " << totfCaught << endl;};
|
||||
|
||||
/** enabl data compression, by saving only hits
|
||||
/returns if failed
|
||||
*/
|
||||
virtual int enableDataCompression(bool enable) {dataCompression=enable; cout << "set data compression " << dataCompression<< endl; return dataCompression;};
|
||||
|
||||
/**
|
||||
* enable 10Gbe
|
||||
@param enable 1 for 10Gbe or 0 for 1 Gbe, -1 to read out
|
||||
\returns enable for 10Gbe
|
||||
*/
|
||||
virtual int enableTenGiga(int enable = -1) {if (enable>=0) {e10G=enable; cout << "set 10Gb "<< e10G << endl;} else cout << "get 10Gb "<< e10G << endl; return e10G;};
|
||||
|
||||
/**
|
||||
* Returns the buffer-current frame read by receiver
|
||||
* @param c pointer to current file name
|
||||
* @param raw address of pointer, pointing to current frame to send to gui
|
||||
* @param fnum frame number for eiger as it is not in the packet
|
||||
* @param startAcquisitionIndex is the start index of the acquisition
|
||||
* @param startFrameIndex is the start index of the scan
|
||||
*/
|
||||
virtual void readFrame(char* c,char** raw, uint32_t &fnum, uint32_t &startAcquisitionIndex, uint32_t &startFrameIndex){cout << "dummy read frame" << endl; };
|
||||
|
||||
/** set status to transmitting and
|
||||
* when fifo is empty later, sets status to run_finished
|
||||
*/
|
||||
virtual void startReadout(){cout << "dummy start readout" << endl; };
|
||||
|
||||
/**
|
||||
* shuts down the udp sockets
|
||||
* \returns if success or fail
|
||||
*/
|
||||
virtual int shutDownUDPSockets(){cout << "dummy shut down udp sockets" << endl; return slsReceiverDefs::OK;};
|
||||
|
||||
/**
|
||||
* Closes all files
|
||||
* @param ithr thread index, -1 for all threads
|
||||
*/
|
||||
virtual void closeFile(int ithr = -1){cout << "dummy close file" << ithr << endl; };
|
||||
|
||||
/**
|
||||
* Call back for start acquisition
|
||||
callback arguments are
|
||||
filepath
|
||||
filename
|
||||
fileindex
|
||||
datasize
|
||||
|
||||
return value is
|
||||
0 callback takes care of open,close,wrie file
|
||||
1 callback writes file, we have to open, close it
|
||||
2 we open, close, write file, callback does not do anything
|
||||
*/
|
||||
virtual void registerCallBackStartAcquisition(int (*func)(char*, char*,int, int, void*),void *arg){cout << "dummy register callback start acquisition" << endl; };
|
||||
|
||||
/**
|
||||
* Call back for acquisition finished
|
||||
callback argument is
|
||||
total frames caught
|
||||
*/
|
||||
virtual void registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg){cout << "dummy register callback acquisition finished" << endl; };
|
||||
|
||||
/**
|
||||
* Call back for raw data
|
||||
args to raw data ready callback are
|
||||
framenum
|
||||
datapointer
|
||||
datasize in bytes
|
||||
file descriptor
|
||||
guidatapointer (NULL, no data required)
|
||||
*/
|
||||
virtual void registerCallBackRawDataReady(void (*func)(int, char*, int, FILE*, char*, void*),void *arg){cout << "dummy register callback get raw data" << endl; };
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
char detHostname[1000];
|
||||
char fName[10000];
|
||||
char fPath[10000];
|
||||
int dynamicRange;
|
||||
int scanTag;
|
||||
int nFrames;
|
||||
int fWrite;
|
||||
int fOverwrite;
|
||||
|
||||
int fIndex;
|
||||
int fCaught;
|
||||
int totfCaught;
|
||||
int startAcqIndex;
|
||||
int startFrameIndex;
|
||||
int acqIndex;
|
||||
bool dataCompression;
|
||||
int64_t period;
|
||||
slsReceiverDefs::detectorType type;
|
||||
int framesNeeded;
|
||||
int udpPort1;
|
||||
int udpPort2;
|
||||
char eth[1000];
|
||||
int shortFrame;
|
||||
int nFramesToGui;
|
||||
int e10G;
|
||||
};
|
||||
|
||||
#endif /* #ifndef DUMMYUDPINTERFACE_H */
|
@ -68,6 +68,23 @@
|
||||
|
||||
|
||||
|
||||
#define JCTB_FIFO_SIZE 2500 //cannot be less than max jobs per thread = 1000
|
||||
/*#define MOENCH_ALIGNED_FRAME_SIZE 65536*/
|
||||
#define JCTB_PACKETS_PER_FRAME 50
|
||||
#define JCTB_ONE_PACKET_SIZE 8214
|
||||
#define JCTB_BUFFER_SIZE (MOENCH_ONE_PACKET_SIZE*MOENCH_PACKETS_PER_FRAME)
|
||||
#define JCTB_DATA_BYTES (JCTB_BUFFER_PER_FRAME)
|
||||
|
||||
#define JCTB_FRAME_INDEX_MASK 0xFFFFFF00
|
||||
#define JCTB_FRAME_INDEX_OFFSET 8
|
||||
#define JCTB_PACKET_INDEX_MASK 0xFF
|
||||
|
||||
#define JCTB_BYTES_PER_ADC (2)
|
||||
#define JCTB_PIXELS_IN_ONE_ROW 32
|
||||
#define JCTB_BYTES_IN_ONE_ROW (JCTB_PIXELS_IN_ONE_ROW*2)
|
||||
|
||||
|
||||
|
||||
|
||||
#define EIGER_MAX_PORTS 2
|
||||
#define EIGER_HEADER_LENGTH 48
|
||||
|
@ -90,7 +90,8 @@ public:
|
||||
PROGRESS, /**< fraction of measurement elapsed - only get! */
|
||||
MEASUREMENTS_NUMBER,
|
||||
FRAMES_FROM_START,
|
||||
FRAMES_FROM_START_PG
|
||||
FRAMES_FROM_START_PG,
|
||||
SAMPLES_JCTB
|
||||
};
|
||||
|
||||
|
||||
|
@ -269,6 +269,12 @@ int UDPStandardImplementation::setDetectorType(detectorType det){ FILE_LOG(logD
|
||||
case EIGER:
|
||||
cout << endl << "***** This is a EIGER Receiver *****" << endl << endl;
|
||||
break;
|
||||
case JUNGFRAUCTB:
|
||||
cout << endl << "***** This is a JUNGFRAUCTB Receiver *****" << endl << endl;
|
||||
break;
|
||||
case JUNGFRAU:
|
||||
cout << endl << "***** This is a JUNGFRAU Receiver *****" << endl << endl;
|
||||
break;
|
||||
default:
|
||||
cout << endl << "***** Unknown Receiver *****" << endl << endl;
|
||||
return FAIL;
|
||||
@ -315,6 +321,16 @@ int UDPStandardImplementation::setDetectorType(detectorType det){ FILE_LOG(logD
|
||||
createListeningThreads(true);
|
||||
|
||||
numListeningThreads = MAX_NUM_LISTENING_THREADS;
|
||||
} else if(myDetectorType == JUNGFRAUCTB || myDetectorType == JUNGFRAU ){
|
||||
fifosize = JCTB_FIFO_SIZE;
|
||||
packetsPerFrame = JCTB_PACKETS_PER_FRAME;
|
||||
onePacketSize = JCTB_ONE_PACKET_SIZE;
|
||||
frameSize = JCTB_BUFFER_SIZE;
|
||||
bufferSize = JCTB_BUFFER_SIZE;
|
||||
maxPacketsPerFile = JFCTB_MAX_FRAMES_PER_FILE * JCTB_PACKETS_PER_FRAME;
|
||||
frameIndexMask = JCTB_FRAME_INDEX_MASK;
|
||||
frameIndexOffset = JCTB_FRAME_INDEX_OFFSET;
|
||||
packetIndexMask = JCTB_PACKET_INDEX_MASK;
|
||||
}
|
||||
latestData = new char[frameSize];
|
||||
|
||||
|
46
slsReceiverSoftware/src/dummyMain.cpp
Normal file
46
slsReceiverSoftware/src/dummyMain.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
/* A simple server in the internet domain using TCP
|
||||
The port number is passed as an argument */
|
||||
|
||||
#include "sls_receiver_defs.h"
|
||||
#include "dummyUDPInterface.h"
|
||||
#include "slsReceiverTCPIPInterface.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int success;
|
||||
int tcpip_port_no;
|
||||
bool bottom = false;
|
||||
cout << "CCCCCC" << endl;
|
||||
dummyUDPInterface *udp=new dummyUDPInterface();
|
||||
slsReceiverTCPIPInterface *tcpipInterface = new slsReceiverTCPIPInterface(success, udp, tcpip_port_no, bottom);
|
||||
|
||||
|
||||
|
||||
|
||||
if(tcpipInterface->start() == slsReceiverDefs::OK){
|
||||
cout << "DONE!" << endl;
|
||||
string str;
|
||||
cin>>str;
|
||||
//wait and look for an exit keyword
|
||||
while(str.find("exit") == string::npos)
|
||||
cin>>str;
|
||||
//stop tcp server thread, stop udp socket
|
||||
tcpipInterface->stop();
|
||||
}
|
||||
|
||||
if (tcpipInterface)
|
||||
delete tcpipInterface;
|
||||
if(udp)
|
||||
delete udp;
|
||||
return 0;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -26,9 +26,9 @@ using namespace std;
|
||||
|
||||
|
||||
slsReceiverTCPIPInterface::~slsReceiverTCPIPInterface() {
|
||||
closeFile(0);
|
||||
if(socket) {delete socket; socket=NULL;}
|
||||
if(receiverBase) {delete receiverBase; receiverBase=NULL;}
|
||||
closeFile(0);
|
||||
}
|
||||
|
||||
slsReceiverTCPIPInterface::slsReceiverTCPIPInterface(int &success, UDPInterface* rbase, int pn, bool bot):
|
||||
@ -652,7 +652,9 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
||||
receiverBase->setUDPPortNo2(udpport2);
|
||||
//setup udpip
|
||||
//get ethernet interface or IP to listen to
|
||||
cout << "Ethernet interface is " << args[0] << endl;
|
||||
temp = genericSocket::ipToName(args[0]);
|
||||
cout << temp << endl;
|
||||
if(temp=="none"){
|
||||
ret = FAIL;
|
||||
strcpy(mess, "failed to get ethernet interface or IP to listen to\n");
|
||||
@ -666,10 +668,11 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
||||
FILE_LOG(logDEBUG) << __FILE__ << "::" << __func__ << " " << eth;
|
||||
receiverBase->setEthernetInterface(eth);
|
||||
|
||||
cout << eth << endl;
|
||||
//get mac address from ethernet interface
|
||||
if (ret != FAIL)
|
||||
temp = genericSocket::nameToMac(eth);
|
||||
|
||||
|
||||
|
||||
if ((temp=="00:00:00:00:00:00") || (ret == FAIL)){
|
||||
ret = FAIL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user