mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-14 05:47:14 +02:00
Merge branch 'refactor' of github.com:slsdetectorgroup/slsDetectorPackage into refactor
This commit is contained in:
@ -4,7 +4,7 @@ set(SOURCES
|
||||
slsDetector/slsDetectorUsers.cpp
|
||||
slsDetector/slsDetectorCommand.cpp
|
||||
slsDetector/slsDetector.cpp
|
||||
slsReceiverInterface/receiverInterface.cpp
|
||||
../slsSupportLib/include/ClientInterface.cpp
|
||||
../slsSupportLib/include/utilities.cpp
|
||||
)
|
||||
|
||||
@ -16,8 +16,6 @@ include_directories(
|
||||
multiSlsDetector
|
||||
sharedMemory
|
||||
slsDetector
|
||||
slsReceiverInterface
|
||||
../slsSupportLib/include
|
||||
)
|
||||
|
||||
add_library(slsDetectorStatic STATIC
|
||||
@ -52,7 +50,7 @@ set(PUBLICHEADERS
|
||||
slsDetector/slsDetectorUsers.h
|
||||
slsDetector/detectorData.h
|
||||
multiSlsDetector/multiSlsDetector.h
|
||||
slsReceiverInterface/receiverInterface.h
|
||||
../slsSupportLib/include/ClientInterface.h
|
||||
)
|
||||
set_target_properties(slsDetectorShared PROPERTIES
|
||||
LIBRARY_OUTPUT_NAME SlsDetector
|
||||
|
@ -9,14 +9,14 @@ CFLAGS= -g -DC_ONLY -fPIC
|
||||
|
||||
DFLAGS= -g -DDACS_INT
|
||||
|
||||
INCLUDES?= -I../slsSupportLib/include -IslsDetector -ImultiSlsDetector -IslsReceiverInterface -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
|
||||
|
||||
LIBZMQDIR = ../slsSupportLib/include
|
||||
LIBZMQ = -L$(LIBZMQDIR) -Wl,-rpath=$(LIBZMQDIR) -lzmq
|
||||
|
||||
SRC_CLNT= slsDetector/slsDetectorCommand.cpp slsDetector/slsDetector.cpp multiSlsDetector/multiSlsDetector.cpp slsReceiverInterface/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
|
||||
|
||||
|
||||
|
@ -2708,6 +2708,18 @@ int multiSlsDetector::exitReceiver(int detPos) {
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::execReceiverCommand(std::string cmd, int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->execReceiverCommand(cmd);
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = parallelCall(&slsDetector::execReceiverCommand, cmd);
|
||||
return sls::allEqualTo(r, static_cast<int>(OK)) ? OK : FAIL;
|
||||
}
|
||||
|
||||
|
||||
std::string multiSlsDetector::getFilePath(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
|
@ -1230,6 +1230,15 @@ public:
|
||||
*/
|
||||
int exitReceiver(int detPos = -1);
|
||||
|
||||
/**
|
||||
* Executes a system command on the receiver server
|
||||
* e.g. mount an nfs disk, reboot and returns answer etc.
|
||||
* @param cmd command to be executed
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int execReceiverCommand(std::string cmd, int detPos = -1);
|
||||
|
||||
/**
|
||||
* Returns output file directory
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "multiSlsDetector.h"
|
||||
#include "sls_receiver_exceptions.h"
|
||||
#include "SharedMemory.h"
|
||||
#include "receiverInterface.h"
|
||||
#include "ClientInterface.h"
|
||||
#include "gitInfoLib.h"
|
||||
#include "versionAPI.h"
|
||||
#include "slsDetectorCommand.h"
|
||||
@ -590,7 +590,7 @@ void slsDetector::initializeMembers() {
|
||||
delete thisReceiver;
|
||||
thisReceiver = 0;
|
||||
}
|
||||
thisReceiver = new receiverInterface(dataSocket);
|
||||
thisReceiver = new ClientInterface(dataSocket);
|
||||
}
|
||||
|
||||
|
||||
@ -3928,7 +3928,7 @@ std::string slsDetector::setReceiverStreamingIP(std::string sourceIP) {
|
||||
std::endl;
|
||||
#endif
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->sendString(fnum,retval,arg);
|
||||
ret=thisReceiver->SendString(fnum,retval,arg);
|
||||
disconnectData();
|
||||
}
|
||||
if(ret==FAIL) {
|
||||
@ -3960,7 +3960,7 @@ std::string slsDetector::setAdditionalJsonHeader(std::string jsonheader) {
|
||||
std::cout << "Sending additional json header " << arg << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->sendString(fnum,retval,arg);
|
||||
ret=thisReceiver->SendString(fnum,retval,arg);
|
||||
disconnectData();
|
||||
}
|
||||
if(ret==FAIL) {
|
||||
@ -5894,7 +5894,7 @@ int slsDetector::setReceiverTCPSocket(std::string const name, int const receiver
|
||||
//check if it connects
|
||||
if (retval!=FAIL) {
|
||||
checkReceiverOnline();
|
||||
thisReceiver->setSocket(dataSocket);
|
||||
thisReceiver->SetSocket(dataSocket);
|
||||
// check for version compatibility
|
||||
switch (thisDetector->myDetectorType) {
|
||||
case EIGER:
|
||||
@ -5990,6 +5990,30 @@ int slsDetector::exitReceiver() {
|
||||
|
||||
}
|
||||
|
||||
int slsDetector::execReceiverCommand(std::string cmd) {
|
||||
|
||||
int fnum=F_EXEC_RECEIVER_COMMAND;
|
||||
int ret=FAIL;
|
||||
char arg[MAX_STR_LENGTH];
|
||||
memset(arg,0,sizeof(arg));
|
||||
char retval[MAX_STR_LENGTH];
|
||||
memset(retval,0, sizeof(retval));
|
||||
|
||||
strcpy(arg,cmd.c_str());
|
||||
|
||||
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending to receiver the command: " << arg << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->SendString(fnum,retval,arg);
|
||||
disconnectData();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int slsDetector::updateReceiverNoWait() {
|
||||
|
||||
@ -6168,7 +6192,7 @@ void slsDetector::setDetectorHostname() {
|
||||
thisDetector->hostname << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->sendString(fnum,retval,thisDetector->hostname);
|
||||
ret=thisReceiver->SendString(fnum,retval,thisDetector->hostname);
|
||||
disconnectData();
|
||||
}
|
||||
if((ret==FAIL) || (strcmp(retval,thisDetector->hostname)))
|
||||
@ -6199,7 +6223,7 @@ std::string slsDetector::setFilePath(std::string s) {
|
||||
std::cout << "Sending file path to receiver " << arg << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->sendString(fnum,retval,arg);
|
||||
ret=thisReceiver->SendString(fnum,retval,arg);
|
||||
disconnectData();
|
||||
}
|
||||
if(ret!=FAIL){
|
||||
@ -6240,7 +6264,7 @@ std::string slsDetector::setFileName(std::string s) {
|
||||
std::cout << "Sending file name to receiver " << arg << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->sendString(fnum,retval,arg);
|
||||
ret=thisReceiver->SendString(fnum,retval,arg);
|
||||
disconnectData();
|
||||
}
|
||||
if (ret == FAIL)
|
||||
@ -7506,3 +7530,5 @@ int slsDetector::writeSettingsFile(std::string fname, sls_detector_module mod,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
class multiSlsDetector;
|
||||
class SharedMemory;
|
||||
class receiverInterface;
|
||||
class ClientInterface;
|
||||
|
||||
#define SLS_SHMVERSION 0x181005
|
||||
#define NCHIPSMAX 10
|
||||
@ -1377,6 +1377,14 @@ public:
|
||||
*/
|
||||
int exitReceiver();
|
||||
|
||||
/**
|
||||
* Executes a system command on the receiver server
|
||||
* e.g. mount an nfs disk, reboot and returns answer etc.
|
||||
* @param cmd command to be executed
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int execReceiverCommand(std::string cmd);
|
||||
|
||||
/**
|
||||
updates the shared memory receiving the data from the detector (without asking and closing the connection
|
||||
/returns OK
|
||||
@ -1884,7 +1892,7 @@ private:
|
||||
sharedSlsDetector *thisDetector;
|
||||
|
||||
/** receiver interface */
|
||||
receiverInterface *thisReceiver;
|
||||
ClientInterface *thisReceiver;
|
||||
|
||||
/** socket for control commands */
|
||||
MySocketTCP *controlSocket;
|
||||
|
@ -112,6 +112,13 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdExitServer;
|
||||
++i;
|
||||
|
||||
/*! \page test
|
||||
- <b>rx_execcommand</b> Executes a command on the receiver server. Don't use it!!!!
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="rx_execcommand";//OK
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdExitServer;
|
||||
++i;
|
||||
|
||||
/*! \page test
|
||||
- <b>flippeddatay [i]</b> enables/disables data being flipped across y axis. 1 enables, 0 disables. Not implemented.
|
||||
*/
|
||||
@ -2437,7 +2444,13 @@ string slsDetectorCommand::cmdExitServer(int narg, char *args[], int action, int
|
||||
if(myDet->execCommand(std::string(args[1]), detPos)==OK)
|
||||
return string("Command executed successfully\n");
|
||||
else
|
||||
|
||||
return string("Command failed\n");
|
||||
}
|
||||
else if (cmd=="rx_execcommand"){
|
||||
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
||||
if(myDet->execReceiverCommand(std::string(args[1]), detPos)==OK)
|
||||
return string("Command executed successfully\n");
|
||||
else
|
||||
return string("Command failed\n");
|
||||
}
|
||||
else return("cannot decode command\n");
|
||||
@ -2451,6 +2464,7 @@ string slsDetectorCommand::helpExitServer(int action){
|
||||
os << string("exitserver \t shuts down all the detector servers. Don't use it!!!!\n");
|
||||
os << string("exitreceiver \t shuts down all the receiver servers.\n");
|
||||
os << string("execcommand \t executes command in detector server. Don't use it if you do not know what you are doing.\n");
|
||||
os << string("rx_execcommand \t executes command in receiver server. Don't use it if you do not know what you are doing.\n");
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
@ -1,217 +0,0 @@
|
||||
#include "receiverInterface.h"
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/shm.h>
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <bitset>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
|
||||
receiverInterface::receiverInterface(MySocketTCP *socket):dataSocket(socket){}
|
||||
|
||||
|
||||
|
||||
receiverInterface::~receiverInterface(){}
|
||||
|
||||
|
||||
|
||||
int receiverInterface::sendString(int fnum, char retval[], char arg[]){
|
||||
int ret = slsDetectorDefs::FAIL;
|
||||
char mess[MAX_STR_LENGTH];
|
||||
memset(mess, 0, MAX_STR_LENGTH);
|
||||
|
||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
dataSocket->SendDataOnly(arg,MAX_STR_LENGTH);
|
||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==slsDetectorDefs::FAIL){
|
||||
dataSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
cprintf(RED, "Receiver returned error: %s", mess);
|
||||
}
|
||||
if(strstr(mess,"Unrecognized Function")==NULL)
|
||||
dataSocket->ReceiveDataOnly(retval,MAX_STR_LENGTH);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int receiverInterface::sendUDPDetails(int fnum, char retval[], char arg[3][MAX_STR_LENGTH]){
|
||||
char args[3][MAX_STR_LENGTH];
|
||||
int ret = slsDetectorDefs::FAIL;
|
||||
char mess[MAX_STR_LENGTH];
|
||||
memset(mess, 0, MAX_STR_LENGTH);
|
||||
|
||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
dataSocket->SendDataOnly(arg,sizeof(args));
|
||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==slsDetectorDefs::FAIL){
|
||||
dataSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
cprintf(RED, "Receiver returned error: %s", mess);
|
||||
}
|
||||
else
|
||||
dataSocket->ReceiveDataOnly(retval,MAX_STR_LENGTH);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int receiverInterface::sendInt(int fnum, int &retval, int arg){
|
||||
int ret = slsDetectorDefs::FAIL;
|
||||
char mess[MAX_STR_LENGTH];
|
||||
memset(mess, 0, MAX_STR_LENGTH);
|
||||
|
||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
dataSocket->SendDataOnly(&arg,sizeof(arg));
|
||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==slsDetectorDefs::FAIL){
|
||||
dataSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
cprintf(RED, "Receiver returned error: %s", mess);
|
||||
}
|
||||
if(strstr(mess,"Unrecognized Function")==NULL)
|
||||
dataSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int receiverInterface::getInt(int fnum, int &retval){
|
||||
int ret = slsDetectorDefs::FAIL;
|
||||
char mess[MAX_STR_LENGTH];
|
||||
memset(mess, 0, MAX_STR_LENGTH);
|
||||
|
||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==slsDetectorDefs::FAIL){
|
||||
dataSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
cprintf(RED, "Receiver returned error: %s", mess);
|
||||
}
|
||||
if(strstr(mess,"Unrecognized Function")==NULL)
|
||||
dataSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int receiverInterface::sendInt(int fnum, int64_t &retval, int64_t arg){
|
||||
int ret = slsDetectorDefs::FAIL;
|
||||
char mess[MAX_STR_LENGTH];
|
||||
memset(mess, 0, MAX_STR_LENGTH);
|
||||
|
||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
dataSocket->SendDataOnly(&arg,sizeof(arg));
|
||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==slsDetectorDefs::FAIL){
|
||||
dataSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
cprintf(RED, "Receiver returned error: %s", mess);
|
||||
}
|
||||
if(strstr(mess,"Unrecognized Function")==NULL)
|
||||
dataSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int receiverInterface::sendIntArray(int fnum, int64_t &retval, int64_t arg[2], char mess[]){
|
||||
int64_t args[2];
|
||||
int ret = slsDetectorDefs::FAIL;
|
||||
memset(mess, 0, MAX_STR_LENGTH);
|
||||
|
||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
dataSocket->SendDataOnly(arg,sizeof(args));
|
||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==slsDetectorDefs::FAIL){
|
||||
dataSocket->ReceiveDataOnly(mess,MAX_STR_LENGTH);
|
||||
cprintf(RED, "Receiver returned error: %s", mess);
|
||||
}
|
||||
if(strstr(mess,"Unrecognized Function")==NULL)
|
||||
dataSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int receiverInterface::sendIntArray(int fnum, int &retval, int arg[2]){
|
||||
int args[2];
|
||||
int ret = slsDetectorDefs::FAIL;
|
||||
char mess[MAX_STR_LENGTH];
|
||||
memset(mess, 0, MAX_STR_LENGTH);
|
||||
|
||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
dataSocket->SendDataOnly(arg,sizeof(args));
|
||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==slsDetectorDefs::FAIL){
|
||||
dataSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
cprintf(RED, "Receiver returned error: %s", mess);
|
||||
}
|
||||
if(strstr(mess,"Unrecognized Function")==NULL)
|
||||
dataSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int receiverInterface::getInt(int fnum, int64_t &retval){
|
||||
int ret = slsDetectorDefs::FAIL;
|
||||
|
||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
dataSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int receiverInterface::getLastClientIP(int fnum, char retval[]){
|
||||
int ret = slsDetectorDefs::FAIL;
|
||||
|
||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
dataSocket->ReceiveDataOnly(retval,INET_ADDRSTRLEN);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int receiverInterface::executeFunction(int fnum,char mess[]){
|
||||
int ret = slsDetectorDefs::FAIL;
|
||||
memset(mess, 0, MAX_STR_LENGTH);
|
||||
|
||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==slsDetectorDefs::FAIL){
|
||||
dataSocket->ReceiveDataOnly(mess,MAX_STR_LENGTH);
|
||||
cprintf(RED, "Receiver returned error: %s", mess);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int receiverInterface::sendROI(int fnum, int n, slsReceiverDefs::ROI roiLimits[]) {
|
||||
int ret = slsDetectorDefs::FAIL;
|
||||
char mess[MAX_STR_LENGTH];
|
||||
memset(mess, 0, MAX_STR_LENGTH);
|
||||
|
||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
dataSocket->SendDataOnly(&n,sizeof(n));
|
||||
dataSocket->SendDataOnly(roiLimits,n * sizeof(slsReceiverDefs::ROI));
|
||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==slsDetectorDefs::FAIL){
|
||||
dataSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
cprintf(RED, "Receiver returned error: %s", mess);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1,154 +0,0 @@
|
||||
|
||||
|
||||
|
||||
#ifndef SLS_RECEIVER_INTERFACE_H
|
||||
#define SLS_RECEIVER_INTERFACE_H
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
#include "MySocketTCP.h"
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @short the slsReceiverInterface class is the interface between the sls detector and the sls receiver
|
||||
* @author Dhanya Maliakal
|
||||
* @version 0.1alpha
|
||||
*/
|
||||
|
||||
|
||||
class receiverInterface{
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* (default) constructor
|
||||
* @param socket tcp socket between client and receiver
|
||||
*/
|
||||
receiverInterface(MySocketTCP *socket);
|
||||
|
||||
|
||||
/**
|
||||
* destructor
|
||||
*/
|
||||
virtual ~receiverInterface();
|
||||
|
||||
/**
|
||||
* Set the datasocket
|
||||
* @param socket the data socket
|
||||
*/
|
||||
void setSocket(MySocketTCP *socket){dataSocket=socket;};
|
||||
|
||||
|
||||
/**
|
||||
* Send a string to receiver
|
||||
* @param fnum function enum to determine what parameter
|
||||
* @param retval return value
|
||||
* @param arg value to send
|
||||
* \returns success of operation
|
||||
*/
|
||||
int sendString(int fnum, char retval[], char arg[]);
|
||||
|
||||
/**
|
||||
* Send a string to receiver
|
||||
* @param fnum function enum to send udp ip and udp port
|
||||
* @param retval return value receiver mac
|
||||
* @param arg value to send
|
||||
* \returns success of operation
|
||||
*/
|
||||
int sendUDPDetails(int fnum, char retval[], char arg[3][MAX_STR_LENGTH]);
|
||||
|
||||
|
||||
/**
|
||||
* Send an integer to receiver
|
||||
* @param fnum function enum to determine what parameter
|
||||
* @param retval return value
|
||||
* @param arg value to send
|
||||
* \returns success of operation
|
||||
*/
|
||||
int sendInt(int fnum, int &retval, int arg);
|
||||
|
||||
/**
|
||||
* Get an integer value from receiver
|
||||
* @param fnum function enum to determine what parameter
|
||||
* @param retval return value
|
||||
* \returns success of operation
|
||||
*/
|
||||
int getInt(int fnum, int &retval);
|
||||
|
||||
/**
|
||||
* Send an integer to receiver
|
||||
* @param fnum function enum to determine what parameter
|
||||
* @param retval return value
|
||||
* @param arg value to send
|
||||
* \returns success of operation
|
||||
*/
|
||||
int sendInt(int fnum, int64_t &retval, int64_t arg);
|
||||
|
||||
|
||||
/**
|
||||
* Send an integer to receiver
|
||||
* @param fnum function enum to determine what parameter
|
||||
* @param retval return value
|
||||
* @param arg values to send
|
||||
* @param mess message returned
|
||||
* \returns success of operation
|
||||
*/
|
||||
int sendIntArray(int fnum, int64_t &retval, int64_t arg[2],char mess[]);
|
||||
|
||||
|
||||
/**
|
||||
* Send an integer to receiver
|
||||
* @param fnum function enum to determine what parameter
|
||||
* @param retval return value
|
||||
* @param arg values to send
|
||||
* \returns success of operation
|
||||
*/
|
||||
int sendIntArray(int fnum, int &retval, int arg[2]);
|
||||
|
||||
/**
|
||||
* Get an integer value from receiver
|
||||
* @param fnum function enum to determine what parameter
|
||||
* @param retval return value
|
||||
* \returns success of operation
|
||||
*/
|
||||
int getInt(int fnum, int64_t &retval);
|
||||
|
||||
/**
|
||||
* Get last client ip connected to receiver
|
||||
* @param fnum function enum to get last client up
|
||||
* @param retval return value
|
||||
* \returns success of operation
|
||||
*/
|
||||
int getLastClientIP(int fnum, char retval[]);
|
||||
|
||||
|
||||
/**
|
||||
* Send a function number to execute function
|
||||
* @param fnum function enum to determine which function to execute
|
||||
* @param mess return error message
|
||||
* \returns success of operation
|
||||
*/
|
||||
int executeFunction(int fnum,char mess[]);
|
||||
|
||||
/**
|
||||
* Send an integer to receiver
|
||||
* @param fnum function enum to determine what parameter
|
||||
* @param n number of ROIs to send
|
||||
* @param roiLimits ROI structure
|
||||
* \returns success of operation
|
||||
*/
|
||||
int sendROI(int fnum, int n, slsReceiverDefs::ROI roiLimits[]);
|
||||
|
||||
//here one should implement the funcs listed in
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* socket for data acquisition
|
||||
*/
|
||||
MySocketTCP *dataSocket;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user