moved client interface to common folder as receiver wills tart using it as well

This commit is contained in:
maliakal_d 2018-10-10 12:00:47 +02:00
parent 78bfc9d0a5
commit 5e7e7d3c33
6 changed files with 34 additions and 36 deletions

View File

@ -4,7 +4,7 @@ set(SOURCES
slsDetector/slsDetectorUsers.cpp slsDetector/slsDetectorUsers.cpp
slsDetector/slsDetectorCommand.cpp slsDetector/slsDetectorCommand.cpp
slsDetector/slsDetector.cpp slsDetector/slsDetector.cpp
ReceiverInterface/ReceiverInterface.cpp ../slsSupportLib/include/ClientInterface.cpp
../slsSupportLib/include/utilities.cpp ../slsSupportLib/include/utilities.cpp
) )
@ -16,8 +16,6 @@ include_directories(
multiSlsDetector multiSlsDetector
sharedMemory sharedMemory
slsDetector slsDetector
ReceiverInterface
../slsSupportLib/include
) )
add_library(slsDetectorStatic STATIC add_library(slsDetectorStatic STATIC
@ -52,7 +50,7 @@ set(PUBLICHEADERS
slsDetector/slsDetectorUsers.h slsDetector/slsDetectorUsers.h
slsDetector/detectorData.h slsDetector/detectorData.h
multiSlsDetector/multiSlsDetector.h multiSlsDetector/multiSlsDetector.h
ReceiverInterface/ReceiverInterface.h ../slsSupportLib/include/ClientInterface.h
) )
set_target_properties(slsDetectorShared PROPERTIES set_target_properties(slsDetectorShared PROPERTIES
LIBRARY_OUTPUT_NAME SlsDetector LIBRARY_OUTPUT_NAME SlsDetector

View File

@ -9,14 +9,14 @@ CFLAGS= -g -DC_ONLY -fPIC
DFLAGS= -g -DDACS_INT DFLAGS= -g -DDACS_INT
INCLUDES?= -I../slsSupportLib/include -IslsDetector -ImultiSlsDetector -IReceiverInterface -IsharedMemory I$(ASM) INCLUDES?= -I../slsSupportLib/include -IslsDetector -ImultiSlsDetector -I../slsSupportLib/include -IsharedMemory I$(ASM)
#EPICSFLAGS=-D EPICS -I/usr/local/epics/base/include/ -I /usr/local/epics/base/include/os/Linux/ -L /usr/local/epics/base/lib/$(EPICS_HOST_ARCH) -Wl,-R/usr/local/epics/base/lib/$(EPICS_HOST_ARCH) -lca -lCom #EPICSFLAGS=-D EPICS -I/usr/local/epics/base/include/ -I /usr/local/epics/base/include/os/Linux/ -L /usr/local/epics/base/lib/$(EPICS_HOST_ARCH) -Wl,-R/usr/local/epics/base/lib/$(EPICS_HOST_ARCH) -lca -lCom
LIBZMQDIR = ../slsSupportLib/include LIBZMQDIR = ../slsSupportLib/include
LIBZMQ = -L$(LIBZMQDIR) -Wl,-rpath=$(LIBZMQDIR) -lzmq LIBZMQ = -L$(LIBZMQDIR) -Wl,-rpath=$(LIBZMQDIR) -lzmq
SRC_CLNT= slsDetector/slsDetectorCommand.cpp slsDetector/slsDetector.cpp multiSlsDetector/multiSlsDetector.cpp ReceiverInterface/ReceiverInterface.cpp slsDetector/slsDetectorUsers.cpp sharedMemory/SharedMemory.cpp ../slsSupportLib/include/utilities.cpp SRC_CLNT= slsDetector/slsDetectorCommand.cpp slsDetector/slsDetector.cpp multiSlsDetector/multiSlsDetector.cpp ../slsSupportLib/include/ReceiverInterface.cpp slsDetector/slsDetectorUsers.cpp sharedMemory/SharedMemory.cpp ../slsSupportLib/include/utilities.cpp
DEPSINCLUDES = ../slsSupportLib/include/sls_receiver_defs.h ../slsSupportLib/include/sls_receiver_funcs.h ../slsSupportLib/include/ansi.h ../slsSupportLib/include/sls_detector_defs.h ../slsSupportLib/include/sls_detector_funcs.h ../slsSupportLib/include/error_defs.h slsDetector/slsDetectorBase.h slsDetector/detectorData.h sharedMemory/SharedMemory.h ../slsSupportLib/include/sls_receiver_exceptions.h ../slsSupportLib/include/versionAPI.h ../slsSupportLib/include/utilities.h ../slsSupportLib/include/container_utils.h DEPSINCLUDES = ../slsSupportLib/include/sls_receiver_defs.h ../slsSupportLib/include/sls_receiver_funcs.h ../slsSupportLib/include/ansi.h ../slsSupportLib/include/sls_detector_defs.h ../slsSupportLib/include/sls_detector_funcs.h ../slsSupportLib/include/error_defs.h slsDetector/slsDetectorBase.h slsDetector/detectorData.h sharedMemory/SharedMemory.h ../slsSupportLib/include/sls_receiver_exceptions.h ../slsSupportLib/include/versionAPI.h ../slsSupportLib/include/utilities.h ../slsSupportLib/include/container_utils.h

View File

@ -2,7 +2,7 @@
#include "multiSlsDetector.h" #include "multiSlsDetector.h"
#include "sls_receiver_exceptions.h" #include "sls_receiver_exceptions.h"
#include "SharedMemory.h" #include "SharedMemory.h"
#include "ReceiverInterface.h" #include "ClientInterface.h"
#include "gitInfoLib.h" #include "gitInfoLib.h"
#include "versionAPI.h" #include "versionAPI.h"
#include "slsDetectorCommand.h" #include "slsDetectorCommand.h"
@ -590,7 +590,7 @@ void slsDetector::initializeMembers() {
delete thisReceiver; delete thisReceiver;
thisReceiver = 0; thisReceiver = 0;
} }
thisReceiver = new ReceiverInterface(dataSocket); thisReceiver = new ClientInterface(dataSocket);
} }
@ -3928,7 +3928,7 @@ std::string slsDetector::setReceiverStreamingIP(std::string sourceIP) {
std::endl; std::endl;
#endif #endif
if (connectData() == OK){ if (connectData() == OK){
ret=thisReceiver->sendString(fnum,retval,arg); ret=thisReceiver->SendString(fnum,retval,arg);
disconnectData(); disconnectData();
} }
if(ret==FAIL) { if(ret==FAIL) {
@ -3960,7 +3960,7 @@ std::string slsDetector::setAdditionalJsonHeader(std::string jsonheader) {
std::cout << "Sending additional json header " << arg << std::endl; std::cout << "Sending additional json header " << arg << std::endl;
#endif #endif
if (connectData() == OK){ if (connectData() == OK){
ret=thisReceiver->sendString(fnum,retval,arg); ret=thisReceiver->SendString(fnum,retval,arg);
disconnectData(); disconnectData();
} }
if(ret==FAIL) { if(ret==FAIL) {
@ -5894,7 +5894,7 @@ int slsDetector::setReceiverTCPSocket(std::string const name, int const receiver
//check if it connects //check if it connects
if (retval!=FAIL) { if (retval!=FAIL) {
checkReceiverOnline(); checkReceiverOnline();
thisReceiver->setSocket(dataSocket); thisReceiver->SetSocket(dataSocket);
// check for version compatibility // check for version compatibility
switch (thisDetector->myDetectorType) { switch (thisDetector->myDetectorType) {
case EIGER: case EIGER:
@ -6168,7 +6168,7 @@ void slsDetector::setDetectorHostname() {
thisDetector->hostname << std::endl; thisDetector->hostname << std::endl;
#endif #endif
if (connectData() == OK){ if (connectData() == OK){
ret=thisReceiver->sendString(fnum,retval,thisDetector->hostname); ret=thisReceiver->SendString(fnum,retval,thisDetector->hostname);
disconnectData(); disconnectData();
} }
if((ret==FAIL) || (strcmp(retval,thisDetector->hostname))) if((ret==FAIL) || (strcmp(retval,thisDetector->hostname)))
@ -6199,7 +6199,7 @@ std::string slsDetector::setFilePath(std::string s) {
std::cout << "Sending file path to receiver " << arg << std::endl; std::cout << "Sending file path to receiver " << arg << std::endl;
#endif #endif
if (connectData() == OK){ if (connectData() == OK){
ret=thisReceiver->sendString(fnum,retval,arg); ret=thisReceiver->SendString(fnum,retval,arg);
disconnectData(); disconnectData();
} }
if(ret!=FAIL){ if(ret!=FAIL){
@ -6240,7 +6240,7 @@ std::string slsDetector::setFileName(std::string s) {
std::cout << "Sending file name to receiver " << arg << std::endl; std::cout << "Sending file name to receiver " << arg << std::endl;
#endif #endif
if (connectData() == OK){ if (connectData() == OK){
ret=thisReceiver->sendString(fnum,retval,arg); ret=thisReceiver->SendString(fnum,retval,arg);
disconnectData(); disconnectData();
} }
if (ret == FAIL) if (ret == FAIL)

View File

@ -14,7 +14,7 @@
class multiSlsDetector; class multiSlsDetector;
class SharedMemory; class SharedMemory;
class ReceiverInterface; class ClientInterface;
#define SLS_SHMVERSION 0x181005 #define SLS_SHMVERSION 0x181005
#define NCHIPSMAX 10 #define NCHIPSMAX 10
@ -1884,7 +1884,7 @@ private:
sharedSlsDetector *thisDetector; sharedSlsDetector *thisDetector;
/** receiver interface */ /** receiver interface */
ReceiverInterface *thisReceiver; ClientInterface *thisReceiver;
/** socket for control commands */ /** socket for control commands */
MySocketTCP *controlSocket; MySocketTCP *controlSocket;

View File

@ -1,4 +1,4 @@
#include "ReceiverInterface.h" #include "ClientInterface.h"
#include <sys/types.h> #include <sys/types.h>
@ -11,15 +11,15 @@
ReceiverInterface::ReceiverInterface(MySocketTCP *socket):dataSocket(socket){} ClientInterface::ClientInterface(MySocketTCP *socket):dataSocket(socket){}
ReceiverInterface::~ReceiverInterface(){} ClientInterface::~ClientInterface(){}
int ReceiverInterface::sendString(int fnum, char retval[], char arg[]){ int ClientInterface::SendString(int fnum, char retval[], char arg[]){
int ret = slsDetectorDefs::FAIL; int ret = slsDetectorDefs::FAIL;
char mess[MAX_STR_LENGTH]; char mess[MAX_STR_LENGTH];
memset(mess, 0, MAX_STR_LENGTH); memset(mess, 0, MAX_STR_LENGTH);
@ -39,7 +39,7 @@ int ReceiverInterface::sendString(int fnum, char retval[], char arg[]){
int ReceiverInterface::sendUDPDetails(int fnum, char retval[], char arg[3][MAX_STR_LENGTH]){ int ClientInterface::sendUDPDetails(int fnum, char retval[], char arg[3][MAX_STR_LENGTH]){
char args[3][MAX_STR_LENGTH]; char args[3][MAX_STR_LENGTH];
int ret = slsDetectorDefs::FAIL; int ret = slsDetectorDefs::FAIL;
char mess[MAX_STR_LENGTH]; char mess[MAX_STR_LENGTH];
@ -59,7 +59,7 @@ int ReceiverInterface::sendUDPDetails(int fnum, char retval[], char arg[3][MAX_S
} }
int ReceiverInterface::sendInt(int fnum, int &retval, int arg){ int ClientInterface::sendInt(int fnum, int &retval, int arg){
int ret = slsDetectorDefs::FAIL; int ret = slsDetectorDefs::FAIL;
char mess[MAX_STR_LENGTH]; char mess[MAX_STR_LENGTH];
memset(mess, 0, MAX_STR_LENGTH); memset(mess, 0, MAX_STR_LENGTH);
@ -79,7 +79,7 @@ int ReceiverInterface::sendInt(int fnum, int &retval, int arg){
int ReceiverInterface::getInt(int fnum, int &retval){ int ClientInterface::getInt(int fnum, int &retval){
int ret = slsDetectorDefs::FAIL; int ret = slsDetectorDefs::FAIL;
char mess[MAX_STR_LENGTH]; char mess[MAX_STR_LENGTH];
memset(mess, 0, MAX_STR_LENGTH); memset(mess, 0, MAX_STR_LENGTH);
@ -98,7 +98,7 @@ int ReceiverInterface::getInt(int fnum, int &retval){
int ReceiverInterface::sendInt(int fnum, int64_t &retval, int64_t arg){ int ClientInterface::sendInt(int fnum, int64_t &retval, int64_t arg){
int ret = slsDetectorDefs::FAIL; int ret = slsDetectorDefs::FAIL;
char mess[MAX_STR_LENGTH]; char mess[MAX_STR_LENGTH];
memset(mess, 0, MAX_STR_LENGTH); memset(mess, 0, MAX_STR_LENGTH);
@ -118,7 +118,7 @@ int ReceiverInterface::sendInt(int fnum, int64_t &retval, int64_t arg){
int ReceiverInterface::sendIntArray(int fnum, int64_t &retval, int64_t arg[2], char mess[]){ int ClientInterface::sendIntArray(int fnum, int64_t &retval, int64_t arg[2], char mess[]){
int64_t args[2]; int64_t args[2];
int ret = slsDetectorDefs::FAIL; int ret = slsDetectorDefs::FAIL;
memset(mess, 0, MAX_STR_LENGTH); memset(mess, 0, MAX_STR_LENGTH);
@ -138,7 +138,7 @@ int ReceiverInterface::sendIntArray(int fnum, int64_t &retval, int64_t arg[2], c
int ReceiverInterface::sendIntArray(int fnum, int &retval, int arg[2]){ int ClientInterface::sendIntArray(int fnum, int &retval, int arg[2]){
int args[2]; int args[2];
int ret = slsDetectorDefs::FAIL; int ret = slsDetectorDefs::FAIL;
char mess[MAX_STR_LENGTH]; char mess[MAX_STR_LENGTH];
@ -159,7 +159,7 @@ int ReceiverInterface::sendIntArray(int fnum, int &retval, int arg[2]){
int ReceiverInterface::getInt(int fnum, int64_t &retval){ int ClientInterface::getInt(int fnum, int64_t &retval){
int ret = slsDetectorDefs::FAIL; int ret = slsDetectorDefs::FAIL;
dataSocket->SendDataOnly(&fnum,sizeof(fnum)); dataSocket->SendDataOnly(&fnum,sizeof(fnum));
@ -170,7 +170,7 @@ int ReceiverInterface::getInt(int fnum, int64_t &retval){
} }
int ReceiverInterface::getLastClientIP(int fnum, char retval[]){ int ClientInterface::getLastClientIP(int fnum, char retval[]){
int ret = slsDetectorDefs::FAIL; int ret = slsDetectorDefs::FAIL;
dataSocket->SendDataOnly(&fnum,sizeof(fnum)); dataSocket->SendDataOnly(&fnum,sizeof(fnum));
@ -182,7 +182,7 @@ int ReceiverInterface::getLastClientIP(int fnum, char retval[]){
int ReceiverInterface::executeFunction(int fnum,char mess[]){ int ClientInterface::executeFunction(int fnum,char mess[]){
int ret = slsDetectorDefs::FAIL; int ret = slsDetectorDefs::FAIL;
memset(mess, 0, MAX_STR_LENGTH); memset(mess, 0, MAX_STR_LENGTH);
@ -198,7 +198,7 @@ int ReceiverInterface::executeFunction(int fnum,char mess[]){
int ReceiverInterface::sendROI(int fnum, int n, slsReceiverDefs::ROI roiLimits[]) { int ClientInterface::sendROI(int fnum, int n, slsReceiverDefs::ROI roiLimits[]) {
int ret = slsDetectorDefs::FAIL; int ret = slsDetectorDefs::FAIL;
char mess[MAX_STR_LENGTH]; char mess[MAX_STR_LENGTH];
memset(mess, 0, MAX_STR_LENGTH); memset(mess, 0, MAX_STR_LENGTH);

View File

@ -6,11 +6,11 @@
/** /**
* @short the ReceiverInterface class is the interface between the client and the receiver * @short the ClientInterface class is the interface between the client and the receiver/detector
*/ */
class ReceiverInterface{ class ClientInterface{
public: public:
@ -18,19 +18,19 @@ public:
* (default) constructor * (default) constructor
* @param socket tcp socket between client and receiver * @param socket tcp socket between client and receiver
*/ */
ReceiverInterface(MySocketTCP *socket); ClientInterface(MySocketTCP *socket);
/** /**
* destructor * destructor
*/ */
virtual ~ReceiverInterface(); virtual ~ClientInterface();
/** /**
* Set the datasocket * Set the datasocket
* @param socket the data socket * @param socket the data socket
*/ */
void setSocket(MySocketTCP *socket){dataSocket=socket;}; void SetSocket(MySocketTCP *socket){dataSocket=socket;};
/** /**
@ -40,7 +40,7 @@ public:
* @param arg value to send * @param arg value to send
* \returns success of operation * \returns success of operation
*/ */
int sendString(int fnum, char retval[], char arg[]); int SendString(int fnum, char retval[], char arg[]);
/** /**
* Send a string to receiver * Send a string to receiver