Skip to content

Commit

Permalink
Merge remote branch 'slsReceiverSoftware/2.0.5' into 2.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
thattil committed Dec 4, 2017
2 parents aaa0270 + e452bcc commit a2217e2
Show file tree
Hide file tree
Showing 39 changed files with 12,844 additions and 0 deletions.
7 changes: 7 additions & 0 deletions slsReceiverSoftware/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*~
*.o
build/*
GPATH
GRTAGS
GSYMS
GTAGS
115 changes: 115 additions & 0 deletions slsReceiverSoftware/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
include ../Makefile.include

DESTDIR ?= ../bin
LIBDIR ?= $(DESTDIR)
DOCDIR ?= docs
SRCDIR = src
TESTDIR = test
BUILDDIR = build
PROGS = $(DESTDIR)/slsReceiver


CFLAGS= -g -DC_ONLY -fPIC
#FLAGS+= #-DVERBOSE -DVERYVERBOSE

DFLAGS= -g -DDACS_INT -DSLS_RECEIVER_UDP_FUNCTIONS

INCLUDES?= $(INCLUDESRXR) -I include/ -I ../slsDetectorCalibration

#-Iinclude -I../slsDetectorCalibration -I$(ASM)

SRC_CLNT = MySocketTCP.cpp UDPInterface.cpp UDPBaseImplementation.cpp UDPStandardImplementation.cpp slsReceiverTCPIPInterface.cpp slsReceiver.cpp slsReceiverUsers.cpp utilities.cpp

ifeq ($(REST), yes)
SRC_CLNT += UDPRESTImplementation.cpp
endif

MAIN_SRC = main.cpp

DUMMY_MAIN_SRC = dummyMain.cpp

OBJS=$(SRC_CLNT:%.cpp=$(BUILDDIR)/%.o)


$(info )
$(info #######################################)
$(info # Compiling slsReceiverSoftware #)
$(info #######################################)
$(info )


.PHONY: all intdoc package eigerReceiver clean

all: builddir lib receiver

dummy: $(DESTDIR)/dummyReceiver

intdoc: $(SRC_H) $(SRC_CLNT)
doxygen doxy.config

$(BUILDDIR)/%.o : $(SRCDIR)/%.cpp Makefile
ifeq ($(ROOTSLS),yes)
$(CXX) -DROOTSLS -o $@ -c $< $(INCLUDES) $(DFLAGS) $(ROOTFLAGS) -fPIC $(EPICSFLAGS) $(LDFLAGRXR) -L/usr/lib64/ $(FLAGS)
else
$(CXX) -o $@ -c $< $(INCLUDES) $(DFLAGS) -fPIC $(EPICSFLAGS) $(LDFLAGRXR) -lpthread $(FLAGS)
endif

lib: $(OBJS) $(DESTDIR)/libSlsReceiver.so $(DESTDIR)/libSlsReceiver.a

receiver: $(DESTDIR)/slsReceiver


$(DESTDIR)/libSlsReceiver.so: $(OBJS)
$(CXX) -shared -Wl,-soname,libSlsReceiver.so -o libSlsReceiver.so $(OBJS) -lc $(INCLUDES) $(DFLAGS) $(FLAGS) $(EPICSFLAGS) -L/usr/lib64 -lpthread
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
mv libSlsReceiver.so $(DESTDIR)

$(DESTDIR)/libSlsReceiver.a: $(OBJS)
ar rcs libSlsReceiver.a $(OBJS)
mv libSlsReceiver.a $(DESTDIR)


$(DESTDIR)/slsReceiver: lib
$(CXX) -o $@ $(SRCDIR)/$(MAIN_SRC) $(FLAGS) $(INCLUDES) $(CLAGS) $(LIBS) $(LDFLAGRXR) -fPIC
#$(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
g++ -o $(TESTDIR)/rec $(TESTDIR)/MySocketTCP.o $(TESTDIR)/rec.cxx -I include
g++ -o $(TESTDIR)/send $(TESTDIR)/MySocketTCP.o $(TESTDIR)/send.cxx -I include


clean: buildclean
make testclean
if test -e $(DESTDIR)/libSlsReceiver.a; then rm $(DESTDIR)/libSlsReceiver.a;fi
if test -e $(DESTDIR)/libSlsReceiver.so; then rm $(DESTDIR)/libSlsReceiver.so;fi
if test -e $(PROGS); then rm $(PROGS);fi

builddir:
if [ ! -d $(BUILDDIR) ]; then mkdir $(BUILDDIR); fi

buildclean:
rm -rf $(OBJS)

testclean:
if [ -f $(TESTDIR)/rec ]; then \
cd $(TESTDIR) && rm *.o rec send; \
fi


#-------------------------------------------------------------------------------

install: package

install_inc:
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
cp -P slsReceiver/slsReceiverUsers.h $(DESTDIR)


9 changes: 9 additions & 0 deletions slsReceiverSoftware/gitInfo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Path: slsDetectorsPackage/slsReceiverSoftware
URL: origin [email protected]:sls_detectors_software/sls_receiver_software.git
Repository Root: origin [email protected]:sls_detectors_software/sls_receiver_software.git
Repsitory UUID: a10bf5ae88d113a482dca646085abcb7a45dc52e
Revision: 249
Branch: master
Last Changed Author: Dhanya_Maliakal
Last Changed Rev: 249
Last Changed Date: 2016-08-04 17:19:31 +0200
79 changes: 79 additions & 0 deletions slsReceiverSoftware/include/MySocketTCP.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@

#ifndef MY_SOCKET_TCP_H
#define MY_SOCKET_TCP_H




/**
*
* @libdoc The MySocketTCP class provides a simple interface for creating and sending/receiving data over a TCP socket.
*
* @short This class provides a simple interface for creating and sending/receiving data over a TCP socket.
* @author Ian Johnson
* @version 1.0
*/



//version 1.0, base development, Ian 19/01/09

/* Modified by anna on 19.01.2009 */
/*
canceled SetupParameters() and varaibles intialized in the constructors' headers;
defined SEND_REC_MAX_SIZE (for compatibilty with mythen (and possibly other) pure C servers (i would move it to the common header file)
added #ifndef C_ONLY... to cutout class definition when including in pure C servers (can be removed if SEND_REC_MAX_SIZE is moved to the common header file)
defined private variables char hostname[1000] and int portno to store connection informations;
defined public functions int getHostname(char *name) and int getPortNumber() to retrieve connection informations
added public function int getErrorStatus() returning 1 if socketDescriptor<0
remove exits in the constructors and replace them with socketDescriptor=-1
replaced the argument of send/receive data with void (to avoid too much casting or compiler errors/warnings)
added a function which really does not close the socket between send/receive (senddataonly, receivedataonly)
*/


/* Modified by Anna on 31.10.2012
developed and
*/


#include "genericSocket.h"
#define TCP_PACKET_SIZE 4096

class MySocketTCP: public genericSocket {

public:
MySocketTCP(const char* const host_ip_or_name, unsigned short int const port_number): genericSocket(host_ip_or_name, port_number,TCP), last_keep_connection_open_action_was_a_send(0){setPacketSize(TCP_PACKET_SIZE);}; // sender (client): where to? ip
MySocketTCP(unsigned short int const port_number):genericSocket(port_number,TCP), last_keep_connection_open_action_was_a_send(0) {setPacketSize(TCP_PACKET_SIZE);}; // receiver (server) local no need for ip


//The following two functions will connectioned->send/receive->disconnect
int SendData(void* buf,int length);//length in characters
int ReceiveData(void* buf,int length);


//The following two functions stay connected, blocking other connections, and must be manually disconnected,
// when the last call is a SendData() or ReceiveData() the disconnection will be done automatically
//These function will also automatically disconnect->reconnect if
// two reads (or two writes) are called in a row to preserve the data send/receive structure
int SendDataAndKeepConnection(void* buf,int length);
int ReceiveDataAndKeepConnection(void* buf,int length);

private:


bool last_keep_connection_open_action_was_a_send;


};
#endif
Loading

0 comments on commit a2217e2

Please sign in to comment.