mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 03:40:04 +02:00
added receiver interface, have not separated from eigerDummyReceiver yet
This commit is contained in:
parent
4814fd56c1
commit
b957cae85f
1
slsReceiverSoftware/.gitignore
vendored
1
slsReceiverSoftware/.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
*.o
|
*.o
|
||||||
|
slsDetectorCalibration
|
||||||
|
@ -14,7 +14,7 @@ DFLAGS= -g -DDACS_INT -DSLS_RECEIVER_UDP_FUNCTIONS
|
|||||||
INCLUDES?= -I. -Iincludes -IMySocketTCP -IslsReceiver -IslsDetectorCalibration -IslsReceiver/eigerReceiver -I$(ASM)
|
INCLUDES?= -I. -Iincludes -IMySocketTCP -IslsReceiver -IslsDetectorCalibration -IslsReceiver/eigerReceiver -I$(ASM)
|
||||||
#-IslsReceiverInterface
|
#-IslsReceiverInterface
|
||||||
|
|
||||||
SRC_CLNT= MySocketTCP/MySocketTCP.cpp slsReceiver/slsReceiverUDPFunctions.cpp slsReceiver/slsReceiverTCPIPInterface.cpp slsReceiver/slsReceiverUsers.cpp
|
SRC_CLNT= MySocketTCP/MySocketTCP.cpp slsReceiver/slsReceiver.cpp slsReceiver/slsReceiverUDPFunctions.cpp slsReceiver/slsReceiverTCPIPInterface.cpp slsReceiver/slsReceiverUsers.cpp
|
||||||
#slsReceiverInterface/receiverInterface.cpp
|
#slsReceiverInterface/receiverInterface.cpp
|
||||||
|
|
||||||
OBJS = $(SRC_CLNT:.cpp=.o)
|
OBJS = $(SRC_CLNT:.cpp=.o)
|
||||||
@ -44,6 +44,7 @@ endif
|
|||||||
package: eigerReceiver $(OBJS) $(DESTDIR)/libSlsReceiver.so $(DESTDIR)/libSlsReceiver.a
|
package: eigerReceiver $(OBJS) $(DESTDIR)/libSlsReceiver.so $(DESTDIR)/libSlsReceiver.a
|
||||||
|
|
||||||
eigerReceiver:
|
eigerReceiver:
|
||||||
|
echo "src client:" $(SRC_CLNT)
|
||||||
cd slsReceiver && make eigerReceiver
|
cd slsReceiver && make eigerReceiver
|
||||||
|
|
||||||
$(DESTDIR)/libSlsReceiver.so: $(OBJS)
|
$(DESTDIR)/libSlsReceiver.so: $(OBJS)
|
||||||
|
@ -14,7 +14,7 @@ LDFLAGRXR += -lm -lstdc++
|
|||||||
|
|
||||||
|
|
||||||
INCLUDES ?= -I ../MySocketTCP -I ../slsDetectorCalibration -I ../includes -I eigerReceiver -I .
|
INCLUDES ?= -I ../MySocketTCP -I ../slsDetectorCalibration -I ../includes -I eigerReceiver -I .
|
||||||
SRC_CLNT = slsReceiver.cpp
|
SRC_CLNT = main.cpp
|
||||||
|
|
||||||
|
|
||||||
INSTMODE = 0777
|
INSTMODE = 0777
|
||||||
|
90
slsReceiverSoftware/slsReceiver/main.cpp
Normal file
90
slsReceiverSoftware/slsReceiver/main.cpp
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
/* A simple server in the internet domain using TCP
|
||||||
|
The port number is passed as an argument */
|
||||||
|
|
||||||
|
#include "sls_receiver_defs.h"
|
||||||
|
#include "slsReceiverUsers.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <string.h>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
int ret = slsReceiverDefs::OK;
|
||||||
|
|
||||||
|
slsReceiverUsers *user = new slsReceiverUsers(argc, argv, ret);
|
||||||
|
|
||||||
|
if(ret==slsReceiverDefs::FAIL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
|
||||||
|
//register callbacks
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
callback arguments are
|
||||||
|
filepath
|
||||||
|
filename
|
||||||
|
fileindex
|
||||||
|
datasize
|
||||||
|
|
||||||
|
return value is
|
||||||
|
0 raw data ready callback takes care of open,close,write file
|
||||||
|
1 callback writes file, we have to open, close it
|
||||||
|
2 we open, close, write file, callback does not do anything
|
||||||
|
|
||||||
|
|
||||||
|
registerCallBackStartAcquisition(int (*func)(char*, char*,int, int, void*),void *arg);
|
||||||
|
*/
|
||||||
|
|
||||||
|
//receiver->registerCallBackStartAcquisition(func,arg);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
callback argument is
|
||||||
|
total farmes caught
|
||||||
|
registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg);
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
//receiver->registerCallBackAcquisitionFinished(func,arg);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
args to raw data ready callback are
|
||||||
|
framenum
|
||||||
|
datapointer
|
||||||
|
file descriptor
|
||||||
|
guidatapointer (NULL, no data required)
|
||||||
|
|
||||||
|
NEVER DELETE THE DATA POINTER
|
||||||
|
REMEMBER THAT THE CALLBACK IS BLOCKING
|
||||||
|
|
||||||
|
registerCallBackRawDataReady(void (*func)(int, char*, FILE*, char*, void*),void *arg);
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
//receiver->registerCallBackRawDataReady(func,arg);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//start tcp server thread
|
||||||
|
if(user->start() == slsReceiverDefs::OK){
|
||||||
|
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
|
||||||
|
user->stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
cout << "Goodbye!" << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
@ -1,90 +1,60 @@
|
|||||||
/* A simple server in the internet domain using TCP
|
/********************************************//**
|
||||||
The port number is passed as an argument */
|
* @file slsReceiver.cpp
|
||||||
|
* @short creates the UDP and TCP class objects
|
||||||
|
***********************************************/
|
||||||
|
|
||||||
#include "sls_receiver_defs.h"
|
#include "slsReceiver.h"
|
||||||
#include "slsReceiverUsers.h"
|
#include "slsReceiverUDPFunctions.h"
|
||||||
|
#include "eigerReceiver.h"
|
||||||
#include <iostream>
|
|
||||||
#include <string.h>
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
|
||||||
|
slsReceiver::slsReceiver(int argc, char *argv[], int &success){
|
||||||
|
//creating base receiver
|
||||||
|
cout << "SLS Receiver" << endl;
|
||||||
|
receiverBase = new slsReceiverUDPFunctions();
|
||||||
|
|
||||||
|
//tcp ip interface
|
||||||
|
tcpipInterface = new slsReceiverTCPIPInterface(argc,argv,success,receiverBase);
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
|
||||||
int ret = slsReceiverDefs::OK;
|
|
||||||
|
|
||||||
slsReceiverUsers *user = new slsReceiverUsers(argc, argv, ret);
|
|
||||||
|
|
||||||
if(ret==slsReceiverDefs::FAIL)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
|
|
||||||
//register callbacks
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
callback arguments are
|
|
||||||
filepath
|
|
||||||
filename
|
|
||||||
fileindex
|
|
||||||
datasize
|
|
||||||
|
|
||||||
return value is
|
|
||||||
0 raw data ready callback takes care of open,close,write file
|
|
||||||
1 callback writes file, we have to open, close it
|
|
||||||
2 we open, close, write file, callback does not do anything
|
|
||||||
|
|
||||||
|
|
||||||
registerCallBackStartAcquisition(int (*func)(char*, char*,int, int, void*),void *arg);
|
|
||||||
*/
|
|
||||||
|
|
||||||
//receiver->registerCallBackStartAcquisition(func,arg);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
callback argument is
|
|
||||||
total farmes caught
|
|
||||||
registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg);
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
//receiver->registerCallBackAcquisitionFinished(func,arg);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
args to raw data ready callback are
|
|
||||||
framenum
|
|
||||||
datapointer
|
|
||||||
file descriptor
|
|
||||||
guidatapointer (NULL, no data required)
|
|
||||||
|
|
||||||
NEVER DELETE THE DATA POINTER
|
|
||||||
REMEMBER THAT THE CALLBACK IS BLOCKING
|
|
||||||
|
|
||||||
registerCallBackRawDataReady(void (*func)(int, char*, FILE*, char*, void*),void *arg);
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
//receiver->registerCallBackRawDataReady(func,arg);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//start tcp server thread
|
|
||||||
if(user->start() == slsReceiverDefs::OK){
|
|
||||||
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
|
|
||||||
user->stop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << "Goodbye!" << endl;
|
|
||||||
return 0;
|
slsReceiver::~slsReceiver() {if(receiverBase) delete receiverBase; if(tcpipInterface) delete tcpipInterface;}
|
||||||
|
|
||||||
|
|
||||||
|
int slsReceiver::start() {
|
||||||
|
return tcpipInterface->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsReceiver::stop() {
|
||||||
|
tcpipInterface->stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsReceiver::closeFile(int p) {
|
||||||
|
tcpipInterface->closeFile(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int64_t slsReceiver::getReceiverVersion(){
|
||||||
|
tcpipInterface->getReceiverVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsReceiver::registerCallBackStartAcquisition(int (*func)(char*, char*,int, int, void*),void *arg){
|
||||||
|
tcpipInterface->registerCallBackStartAcquisition(func,arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void slsReceiver::registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg){
|
||||||
|
tcpipInterface->registerCallBackAcquisitionFinished(func,arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsReceiver::registerCallBackRawDataReady(void (*func)(int, char*, int, FILE*, char*, void*),void *arg){
|
||||||
|
tcpipInterface->registerCallBackRawDataReady(func,arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
89
slsReceiverSoftware/slsReceiver/slsReceiver.h
Normal file
89
slsReceiverSoftware/slsReceiver/slsReceiver.h
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
/********************************************//**
|
||||||
|
* @file slsReceiver.h
|
||||||
|
* @short creates the UDP and TCP class objects
|
||||||
|
***********************************************/
|
||||||
|
#ifndef SLS_RECEIVER_H
|
||||||
|
#define SLS_RECEIVER_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "slsReceiverTCPIPInterface.h"
|
||||||
|
#include "slsReceiverBase.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*@short creates the UDP and TCP class objects
|
||||||
|
*/
|
||||||
|
|
||||||
|
class slsReceiver : private virtual slsReceiverDefs {
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* creates the tcp interface and the udp class
|
||||||
|
* @param argc from command line
|
||||||
|
* @param argv from command line
|
||||||
|
* @param succecc socket creation was successfull
|
||||||
|
*/
|
||||||
|
slsReceiver(int argc, char *argv[], int &success);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor
|
||||||
|
*/
|
||||||
|
~slsReceiver();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* starts listening on the TCP port for client comminication
|
||||||
|
\return 0 for success or 1 for FAIL in creating TCP server
|
||||||
|
*/
|
||||||
|
int start();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* stops listening to the TCP & UDP port and exit receiver program
|
||||||
|
*/
|
||||||
|
void stop();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close File and exits receiver server
|
||||||
|
*/
|
||||||
|
void closeFile(int p);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get get Receiver Version
|
||||||
|
\returns id
|
||||||
|
*/
|
||||||
|
int64_t getReceiverVersion();
|
||||||
|
|
||||||
|
/**
|
||||||
|
@sort register calbback for starting the acquisition
|
||||||
|
@param func callback to be called when starting the acquisition. Its arguments are filepath filename fileindex data size
|
||||||
|
\returns 0 callback takes care of open,close,write file; 1 callback writes file, we have to open, close it; 2 we open, close, write file, callback does not do anything
|
||||||
|
*/
|
||||||
|
void registerCallBackStartAcquisition(int (*func)(char*, char*,int, int, void*),void *arg);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
callback argument is
|
||||||
|
toatal farmes caught
|
||||||
|
*/
|
||||||
|
void registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
args to raw data ready callback are
|
||||||
|
framenum
|
||||||
|
datapointer
|
||||||
|
datasize in bytes
|
||||||
|
file descriptor
|
||||||
|
guidatapointer (NULL, no data required)
|
||||||
|
*/
|
||||||
|
void registerCallBackRawDataReady(void (*func)(int, char*, int, FILE*, char*, void*),void *arg);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
slsReceiverTCPIPInterface* tcpipInterface;
|
||||||
|
slsReceiverBase* receiverBase;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
335
slsReceiverSoftware/slsReceiver/slsReceiverBase.h
Normal file
335
slsReceiverSoftware/slsReceiver/slsReceiverBase.h
Normal file
@ -0,0 +1,335 @@
|
|||||||
|
#ifndef SLSRECEIVERBASE_H
|
||||||
|
#define SLSRECEIVERBASE_H
|
||||||
|
/***********************************************
|
||||||
|
* @file slsReceiverBase.h
|
||||||
|
* @short base class with all the functions for a receiver, set/get parameters, start/stop etc.
|
||||||
|
***********************************************/
|
||||||
|
/**
|
||||||
|
* \mainpage Base class with all the functions for a receiver, set/get parameters, start/stop etc.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @short base class with all the functions for a receiver, set/get parameters, start/stop etc.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class slsReceiverBase {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* constructor
|
||||||
|
*/
|
||||||
|
slsReceiverBase(){};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor
|
||||||
|
*/
|
||||||
|
virtual ~slsReceiverBase() {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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) = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/* Returns detector hostname
|
||||||
|
/returns hostname
|
||||||
|
* caller needs to deallocate the returned char array.
|
||||||
|
* if uninitialized, it must return NULL
|
||||||
|
*/
|
||||||
|
virtual char *getDetectorHostname() const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns status of receiver: idle, running or error
|
||||||
|
*/
|
||||||
|
virtual slsReceiverDefs::runStatus getStatus() const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns File Name
|
||||||
|
* caller is responsible to deallocate the returned char array.
|
||||||
|
*/
|
||||||
|
virtual char *getFileName() const = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns File Path
|
||||||
|
* caller is responsible to deallocate the returned char array
|
||||||
|
*/
|
||||||
|
virtual char *getFilePath() const = 0; //FIXME: Does the caller need to free() the returned pointer?
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of bits per pixel
|
||||||
|
*/
|
||||||
|
virtual int getDynamicRange() const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns scan tag
|
||||||
|
*/
|
||||||
|
virtual int getScanTag() const = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns file write enable
|
||||||
|
* 1: YES 0: NO
|
||||||
|
*/
|
||||||
|
virtual int getEnableFileWrite() const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns file over write enable
|
||||||
|
* 1: YES 0: NO
|
||||||
|
*/
|
||||||
|
virtual int getEnableOverwrite() const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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[]) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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[]) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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) = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets number of frames
|
||||||
|
@param fnum number of frames
|
||||||
|
/returns number of frames
|
||||||
|
*/
|
||||||
|
virtual int setNumberOfFrames(const int fnum) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set enable file write
|
||||||
|
* @param i file write enable
|
||||||
|
/returns file write enable
|
||||||
|
*/
|
||||||
|
virtual int setEnableFileWrite(const int i) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set enable file overwrite
|
||||||
|
* @param i file overwrite enable
|
||||||
|
/returns file overwrite enable
|
||||||
|
*/
|
||||||
|
virtual int setEnableOverwrite(const int i) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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) = 0; //FIXME: who allocates message[]?
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stops Receiver - stops listening for packets
|
||||||
|
/returns success
|
||||||
|
* same as abort(). Always returns 0.
|
||||||
|
*/
|
||||||
|
virtual int stopReceiver() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* abort acquisition with minimum damage: close open files, cleanup.
|
||||||
|
* does nothing if state already is 'idle'
|
||||||
|
*/
|
||||||
|
virtual void abort() = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************************************************
|
||||||
|
**************************************** Added by Dhanya *********************************************************
|
||||||
|
*******************************************************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns File Index
|
||||||
|
*/
|
||||||
|
virtual int getFileIndex() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns Total Frames Caught for an entire acquisition (including all scans)
|
||||||
|
*/
|
||||||
|
virtual int getTotalFramesCaught() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns Frames Caught for each real time acquisition (eg. for each scan)
|
||||||
|
*/
|
||||||
|
virtual int getFramesCaught() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns current Frame Index Caught for an entire acquisition (including all scans)
|
||||||
|
*/
|
||||||
|
virtual uint32_t getAcquisitionIndex() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the frame index at start of each real time acquisition (eg. for each scan)
|
||||||
|
*/
|
||||||
|
virtual uint32_t getStartFrameIndex() = 0;
|
||||||
|
|
||||||
|
/** get data compression, by saving only hits
|
||||||
|
*/
|
||||||
|
virtual bool getDataCompression() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set receiver type
|
||||||
|
* @param det detector type
|
||||||
|
* Returns success or FAIL
|
||||||
|
*/
|
||||||
|
virtual int setDetectorType(slsReceiverDefs::detectorType det) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set File Index
|
||||||
|
* @param i file index
|
||||||
|
*/
|
||||||
|
virtual int setFileIndex(int i) = 0;
|
||||||
|
|
||||||
|
/** set acquisition period if a positive number
|
||||||
|
*/
|
||||||
|
virtual int64_t setAcquisitionPeriod(int64_t index) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Frame Index Needed
|
||||||
|
* @param i frame index needed
|
||||||
|
*/
|
||||||
|
virtual int setFrameIndexNeeded(int i) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set UDP Port Number
|
||||||
|
*/
|
||||||
|
virtual void setUDPPortNo(int p) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Ethernet Interface or IP to listen to
|
||||||
|
*/
|
||||||
|
virtual void setEthernetInterface(char* c) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set short frame
|
||||||
|
* @param i if shortframe i=1
|
||||||
|
*/
|
||||||
|
virtual int setShortFrame(int i) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the variable to send every nth frame to gui
|
||||||
|
* or if 0,send frame only upon gui request
|
||||||
|
*/
|
||||||
|
virtual int setNFrameToGui(int i) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets the Total Frames Caught
|
||||||
|
* This is how the receiver differentiates between entire acquisitions
|
||||||
|
* Returns 0
|
||||||
|
*/
|
||||||
|
virtual void resetTotalFramesCaught() = 0;
|
||||||
|
|
||||||
|
/** enabl data compression, by saving only hits
|
||||||
|
/returns if failed
|
||||||
|
*/
|
||||||
|
virtual int enableDataCompression(bool enable) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
virtual void readFrame(char* c,char** raw, uint32_t &fnum) = 0;
|
||||||
|
|
||||||
|
/** set status to transmitting and
|
||||||
|
* when fifo is empty later, sets status to run_finished
|
||||||
|
*/
|
||||||
|
virtual void startReadout() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* shuts down the udp sockets
|
||||||
|
* \returns if success or fail
|
||||||
|
*/
|
||||||
|
virtual int shutDownUDPSockets() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes all files
|
||||||
|
* @param ithr thread index, -1 for all threads
|
||||||
|
*/
|
||||||
|
virtual void closeFile(int ithr = -1) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call back for acquisition finished
|
||||||
|
callback argument is
|
||||||
|
total frames caught
|
||||||
|
*/
|
||||||
|
virtual void registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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) = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* #ifndef SLSRECEIVERBASE_H */
|
@ -1,12 +1,13 @@
|
|||||||
/********************************************//**
|
/********************************************//**
|
||||||
* @file slsReceiverTCPIPInterface.h
|
* @file slsReceiverTCPIPInterface.cpp
|
||||||
* @short interface between receiver and client
|
* @short interface between receiver and client
|
||||||
***********************************************/
|
***********************************************/
|
||||||
|
|
||||||
#include "slsReceiverTCPIPInterface.h"
|
#include "slsReceiverTCPIPInterface.h"
|
||||||
#include "slsReceiverUDPFunctions.h"
|
#include "slsReceiverBase.h"
|
||||||
#include "gitInfoReceiver.h"
|
#include "gitInfoReceiver.h"
|
||||||
#include "slsReceiverUsers.h"
|
#include "slsReceiverUsers.h"
|
||||||
|
#include "slsReceiver.h"
|
||||||
|
|
||||||
#include <signal.h> //SIGINT
|
#include <signal.h> //SIGINT
|
||||||
#include <stdlib.h> //EXIT
|
#include <stdlib.h> //EXIT
|
||||||
@ -27,9 +28,9 @@ slsReceiverTCPIPInterface::~slsReceiverTCPIPInterface() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
slsReceiverTCPIPInterface::slsReceiverTCPIPInterface(int argc, char *argv[], int &success):
|
slsReceiverTCPIPInterface::slsReceiverTCPIPInterface(int argc, char *argv[], int &success, slsReceiverBase* rbase):
|
||||||
myDetectorType(GOTTHARD),
|
myDetectorType(GOTTHARD),
|
||||||
slsReceiverFunctions(NULL),
|
receiverBase(rbase),
|
||||||
ret(OK),
|
ret(OK),
|
||||||
lockStatus(0),
|
lockStatus(0),
|
||||||
shortFrame(-1),
|
shortFrame(-1),
|
||||||
@ -165,7 +166,6 @@ slsReceiverTCPIPInterface::slsReceiverTCPIPInterface(int argc, char *argv[], int
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Function table assigned." << endl;
|
cout << "Function table assigned." << endl;
|
||||||
#endif
|
#endif
|
||||||
slsReceiverFunctions = new slsReceiverUDPFunctions();
|
|
||||||
|
|
||||||
//Catch signal SIGINT to close files properly
|
//Catch signal SIGINT to close files properly
|
||||||
signal(SIGINT,staticCloseFile);
|
signal(SIGINT,staticCloseFile);
|
||||||
@ -193,11 +193,11 @@ int slsReceiverTCPIPInterface::start(){
|
|||||||
void slsReceiverTCPIPInterface::stop(){
|
void slsReceiverTCPIPInterface::stop(){
|
||||||
|
|
||||||
cout << "Shutting down UDP Socket" << endl;
|
cout << "Shutting down UDP Socket" << endl;
|
||||||
if(slsReceiverFunctions)
|
if(receiverBase)
|
||||||
slsReceiverFunctions->shutDownUDPSockets();
|
receiverBase->shutDownUDPSockets();
|
||||||
|
|
||||||
cout << "Closing Files... " << endl;
|
cout << "Closing Files... " << endl;
|
||||||
slsReceiverFunctions->closeFile();
|
receiverBase->closeFile();
|
||||||
|
|
||||||
|
|
||||||
cout<<"Shutting down TCP Socket and TCP thread"<<endl;
|
cout<<"Shutting down TCP Socket and TCP thread"<<endl;
|
||||||
@ -251,11 +251,11 @@ void slsReceiverTCPIPInterface::startTCPServer(){
|
|||||||
//if tcp command was to exit server
|
//if tcp command was to exit server
|
||||||
if(v==GOODBYE){
|
if(v==GOODBYE){
|
||||||
cout << "Shutting down UDP Socket" << endl;
|
cout << "Shutting down UDP Socket" << endl;
|
||||||
if(slsReceiverFunctions)
|
if(receiverBase)
|
||||||
slsReceiverFunctions->shutDownUDPSockets();
|
receiverBase->shutDownUDPSockets();
|
||||||
|
|
||||||
cout << "Closing Files... " << endl;
|
cout << "Closing Files... " << endl;
|
||||||
slsReceiverFunctions->closeFile();
|
receiverBase->closeFile();
|
||||||
|
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
}
|
}
|
||||||
@ -417,7 +417,7 @@ int slsReceiverTCPIPInterface::set_detector_type(){
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
myDetectorType = dr;
|
myDetectorType = dr;
|
||||||
ret=slsReceiverFunctions->setDetectorType(dr);
|
ret=receiverBase->setDetectorType(dr);
|
||||||
retval = myDetectorType;
|
retval = myDetectorType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -471,7 +471,7 @@ int slsReceiverTCPIPInterface::set_file_name() {
|
|||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
strcpy(retval,slsReceiverFunctions->setFileName(fName));
|
strcpy(retval,receiverBase->setFileName(fName));
|
||||||
}
|
}
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
if(ret!=FAIL)
|
if(ret!=FAIL)
|
||||||
@ -520,12 +520,12 @@ int slsReceiverTCPIPInterface::set_file_dir() {
|
|||||||
sprintf(mess,"Receiver locked by %s\n", socket->lastClientIP);
|
sprintf(mess,"Receiver locked by %s\n", socket->lastClientIP);
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}/*
|
}/*
|
||||||
else if((strlen(fPath))&&(slsReceiverFunctions->getStatus()==RUNNING)){
|
else if((strlen(fPath))&&(receiverBase->getStatus()==RUNNING)){
|
||||||
strcpy(mess,"Can not set file path while receiver running\n");
|
strcpy(mess,"Can not set file path while receiver running\n");
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
}*/
|
}*/
|
||||||
else{
|
else{
|
||||||
strcpy(retval,slsReceiverFunctions->setFilePath(fPath));
|
strcpy(retval,receiverBase->setFilePath(fPath));
|
||||||
// if file path doesnt exist
|
// if file path doesnt exist
|
||||||
if(strlen(fPath))
|
if(strlen(fPath))
|
||||||
if (strcmp(retval,fPath)){
|
if (strcmp(retval,fPath)){
|
||||||
@ -584,7 +584,7 @@ int slsReceiverTCPIPInterface::set_file_index() {
|
|||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
retval=slsReceiverFunctions->setFileIndex(index);
|
retval=receiverBase->setFileIndex(index);
|
||||||
}
|
}
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
if(ret!=FAIL)
|
if(ret!=FAIL)
|
||||||
@ -637,7 +637,7 @@ int slsReceiverTCPIPInterface::set_frame_index() {
|
|||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
retval=slsReceiverFunctions->setFrameIndexNeeded(index);
|
retval=receiverBase->setFrameIndexNeeded(index);
|
||||||
}
|
}
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
if(ret!=FAIL)
|
if(ret!=FAIL)
|
||||||
@ -693,14 +693,14 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
|||||||
sprintf(mess,"Receiver locked by %s\n", socket->lastClientIP);
|
sprintf(mess,"Receiver locked by %s\n", socket->lastClientIP);
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
else if(slsReceiverFunctions->getStatus()==RUNNING){
|
else if(receiverBase->getStatus()==RUNNING){
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
strcpy(mess,"cannot set up udp when receiver is running\n");
|
strcpy(mess,"cannot set up udp when receiver is running\n");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
//set up udp port
|
//set up udp port
|
||||||
sscanf(args[1],"%d",&udpport);
|
sscanf(args[1],"%d",&udpport);
|
||||||
slsReceiverFunctions->setUDPPortNo(udpport);
|
receiverBase->setUDPPortNo(udpport);
|
||||||
|
|
||||||
//setup udpip
|
//setup udpip
|
||||||
//get ethernet interface or IP to listen to
|
//get ethernet interface or IP to listen to
|
||||||
@ -716,7 +716,7 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
|||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
}
|
}
|
||||||
cout<<"eth:"<<eth<<endl;
|
cout<<"eth:"<<eth<<endl;
|
||||||
slsReceiverFunctions->setEthernetInterface(eth);
|
receiverBase->setEthernetInterface(eth);
|
||||||
|
|
||||||
//get mac address from ethernet interface
|
//get mac address from ethernet interface
|
||||||
if (ret != FAIL)
|
if (ret != FAIL)
|
||||||
@ -771,13 +771,13 @@ int slsReceiverTCPIPInterface::start_receiver(){
|
|||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
else if(!strlen(slsReceiverFunctions->getFilePath())){
|
else if(!strlen(receiverBase->getFilePath())){
|
||||||
strcpy(mess,"receiver not set up. set receiver ip again.\n");
|
strcpy(mess,"receiver not set up. set receiver ip again.\n");
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
else {
|
else {
|
||||||
s = slsReceiverFunctions->getStatus();
|
s = receiverBase->getStatus();
|
||||||
switch (s) {
|
switch (s) {
|
||||||
case ERROR: strcpy(cstatus,"error"); break;
|
case ERROR: strcpy(cstatus,"error"); break;
|
||||||
case WAITING: strcpy(cstatus,"waiting"); break;
|
case WAITING: strcpy(cstatus,"waiting"); break;
|
||||||
@ -787,7 +787,7 @@ int slsReceiverTCPIPInterface::start_receiver(){
|
|||||||
default: strcpy(cstatus,"idle"); break;
|
default: strcpy(cstatus,"idle"); break;
|
||||||
}
|
}
|
||||||
if(s == IDLE)
|
if(s == IDLE)
|
||||||
ret=slsReceiverFunctions->startReceiver(mess);
|
ret=receiverBase->startReceiver(mess);
|
||||||
else{
|
else{
|
||||||
sprintf(mess,"Cannot start Receiver as it is in %s state\n",cstatus);
|
sprintf(mess,"Cannot start Receiver as it is in %s state\n",cstatus);
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
@ -824,8 +824,8 @@ int slsReceiverTCPIPInterface::stop_receiver(){
|
|||||||
sprintf(mess,"Receiver locked by %s\n", socket->lastClientIP);
|
sprintf(mess,"Receiver locked by %s\n", socket->lastClientIP);
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
else if(slsReceiverFunctions->getStatus()!=IDLE)
|
else if(receiverBase->getStatus()!=IDLE)
|
||||||
ret=slsReceiverFunctions->stopReceiver();
|
ret=receiverBase->stopReceiver();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && socket->differentClients){
|
if(ret==OK && socket->differentClients){
|
||||||
@ -850,7 +850,7 @@ int slsReceiverTCPIPInterface::get_status(){
|
|||||||
|
|
||||||
// execute action if the arguments correctly arrived
|
// execute action if the arguments correctly arrived
|
||||||
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||||
retval=slsReceiverFunctions->getStatus();
|
retval=receiverBase->getStatus();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(socket->differentClients){
|
if(socket->differentClients){
|
||||||
@ -874,7 +874,7 @@ int slsReceiverTCPIPInterface::get_frames_caught(){
|
|||||||
|
|
||||||
// execute action if the arguments correctly arrived
|
// execute action if the arguments correctly arrived
|
||||||
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||||
retval=slsReceiverFunctions->getTotalFramesCaught();
|
retval=receiverBase->getTotalFramesCaught();
|
||||||
#endif
|
#endif
|
||||||
if(socket->differentClients){
|
if(socket->differentClients){
|
||||||
cout << "Force update" << endl;
|
cout << "Force update" << endl;
|
||||||
@ -897,7 +897,7 @@ int slsReceiverTCPIPInterface::get_frame_index(){
|
|||||||
|
|
||||||
// execute action if the arguments correctly arrived
|
// execute action if the arguments correctly arrived
|
||||||
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||||
retval=slsReceiverFunctions->getAcquisitionIndex();
|
retval=receiverBase->getAcquisitionIndex();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(socket->differentClients){
|
if(socket->differentClients){
|
||||||
@ -929,7 +929,7 @@ int slsReceiverTCPIPInterface::reset_frames_caught(){
|
|||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
slsReceiverFunctions->resetTotalFramesCaught();
|
receiverBase->resetTotalFramesCaught();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -980,12 +980,12 @@ int slsReceiverTCPIPInterface::set_short_frame() {
|
|||||||
sprintf(mess,"Receiver locked by %s\n", socket->lastClientIP);
|
sprintf(mess,"Receiver locked by %s\n", socket->lastClientIP);
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
else if(slsReceiverFunctions->getStatus()==RUNNING){
|
else if(receiverBase->getStatus()==RUNNING){
|
||||||
strcpy(mess,"Cannot set short frame while status is running\n");
|
strcpy(mess,"Cannot set short frame while status is running\n");
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
retval=slsReceiverFunctions->setShortFrame(index);
|
retval=receiverBase->setShortFrame(index);
|
||||||
shortFrame = retval;
|
shortFrame = retval;
|
||||||
if(shortFrame==-1)
|
if(shortFrame==-1)
|
||||||
packetsPerFrame=GOTTHARD_PACKETS_PER_FRAME;
|
packetsPerFrame=GOTTHARD_PACKETS_PER_FRAME;
|
||||||
@ -1052,15 +1052,15 @@ int slsReceiverTCPIPInterface::moench_read_frame(){
|
|||||||
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||||
|
|
||||||
/**send garbage with -1 index to try again*/
|
/**send garbage with -1 index to try again*/
|
||||||
if(!slsReceiverFunctions->getFramesCaught()){
|
if(!receiverBase->getFramesCaught()){
|
||||||
arg = -1;
|
arg = -1;
|
||||||
cout<<"haven't caught any frame yet"<<endl;
|
cout<<"haven't caught any frame yet"<<endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
else{
|
else{
|
||||||
ret = OK;
|
ret = OK;
|
||||||
startIndex=slsReceiverFunctions->getStartFrameIndex();
|
startIndex=receiverBase->getStartFrameIndex();
|
||||||
slsReceiverFunctions->readFrame(fName,&raw,index);
|
receiverBase->readFrame(fName,&raw,index);
|
||||||
|
|
||||||
/**send garbage with -1 index to try again*/
|
/**send garbage with -1 index to try again*/
|
||||||
if (raw == NULL){
|
if (raw == NULL){
|
||||||
@ -1224,13 +1224,13 @@ int slsReceiverTCPIPInterface::gotthard_read_frame(){
|
|||||||
|
|
||||||
|
|
||||||
/**send garbage with -1 index to try again*/
|
/**send garbage with -1 index to try again*/
|
||||||
if(!slsReceiverFunctions->getFramesCaught()){
|
if(!receiverBase->getFramesCaught()){
|
||||||
arg=-1;
|
arg=-1;
|
||||||
cout<<"haven't caught any frame yet"<<endl;
|
cout<<"haven't caught any frame yet"<<endl;
|
||||||
}else{
|
}else{
|
||||||
ret = OK;
|
ret = OK;
|
||||||
startIndex=slsReceiverFunctions->getStartFrameIndex();
|
startIndex=receiverBase->getStartFrameIndex();
|
||||||
slsReceiverFunctions->readFrame(fName,&raw,index);
|
receiverBase->readFrame(fName,&raw,index);
|
||||||
|
|
||||||
/**send garbage with -1 index to try again*/
|
/**send garbage with -1 index to try again*/
|
||||||
if (raw == NULL){
|
if (raw == NULL){
|
||||||
@ -1375,7 +1375,7 @@ int slsReceiverTCPIPInterface::eiger_read_frame(){
|
|||||||
|
|
||||||
|
|
||||||
/**send garbage with -1 index to try again*/
|
/**send garbage with -1 index to try again*/
|
||||||
if(!slsReceiverFunctions->getFramesCaught()){
|
if(!receiverBase->getFramesCaught()){
|
||||||
arg=-1;
|
arg=-1;
|
||||||
cout<<"haven't caught any frame yet"<<endl;
|
cout<<"haven't caught any frame yet"<<endl;
|
||||||
}
|
}
|
||||||
@ -1383,7 +1383,7 @@ int slsReceiverTCPIPInterface::eiger_read_frame(){
|
|||||||
else{
|
else{
|
||||||
ret = OK;
|
ret = OK;
|
||||||
/** read a frame */
|
/** read a frame */
|
||||||
slsReceiverFunctions->readFrame(fName,&raw, index);
|
receiverBase->readFrame(fName,&raw, index);
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "index:" << dec << index << endl;
|
cout << "index:" << dec << index << endl;
|
||||||
#endif
|
#endif
|
||||||
@ -1525,12 +1525,12 @@ int slsReceiverTCPIPInterface::set_read_frequency(){
|
|||||||
sprintf(mess,"Receiver locked by %s\n", socket->lastClientIP);
|
sprintf(mess,"Receiver locked by %s\n", socket->lastClientIP);
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}/*
|
}/*
|
||||||
else if((slsReceiverFunctions->getStatus()==RUNNING) && (index >= 0)){
|
else if((receiverBase->getStatus()==RUNNING) && (index >= 0)){
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
strcpy(mess,"cannot set up receiver mode when receiver is running\n");
|
strcpy(mess,"cannot set up receiver mode when receiver is running\n");
|
||||||
}*/
|
}*/
|
||||||
else
|
else
|
||||||
retval=slsReceiverFunctions->setNFrameToGui(index);
|
retval=receiverBase->setNFrameToGui(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -1576,7 +1576,9 @@ int slsReceiverTCPIPInterface::enable_file_write(){
|
|||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
retval=slsReceiverFunctions->setEnableFileWrite(enable);
|
if(enable >= 0)
|
||||||
|
receiverBase->setEnableFileWrite(enable);
|
||||||
|
retval=receiverBase->getEnableFileWrite();
|
||||||
if((enable!=-1)&&(enable!=retval))
|
if((enable!=-1)&&(enable!=retval))
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
@ -1606,7 +1608,7 @@ int slsReceiverTCPIPInterface::get_id(){
|
|||||||
|
|
||||||
// execute action if the arguments correctly arrived
|
// execute action if the arguments correctly arrived
|
||||||
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||||
retval = get_version();
|
retval = getReceiverVersion();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(socket->differentClients){
|
if(socket->differentClients){
|
||||||
@ -1624,7 +1626,7 @@ int slsReceiverTCPIPInterface::get_id(){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int64_t slsReceiverTCPIPInterface::get_version(){
|
int64_t slsReceiverTCPIPInterface::getReceiverVersion(){
|
||||||
int64_t retval = SVNREV;
|
int64_t retval = SVNREV;
|
||||||
retval= (retval <<32) | SVNDATE;
|
retval= (retval <<32) | SVNDATE;
|
||||||
return retval;
|
return retval;
|
||||||
@ -1639,8 +1641,8 @@ int slsReceiverTCPIPInterface::start_readout(){
|
|||||||
|
|
||||||
// execute action if the arguments correctly arrived
|
// execute action if the arguments correctly arrived
|
||||||
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||||
slsReceiverFunctions->startReadout();
|
receiverBase->startReadout();
|
||||||
retval = slsReceiverFunctions->getStatus();
|
retval = receiverBase->getStatus();
|
||||||
if((retval == TRANSMITTING) || (retval == RUN_FINISHED) || (retval == IDLE))
|
if((retval == TRANSMITTING) || (retval == RUN_FINISHED) || (retval == IDLE))
|
||||||
ret = OK;
|
ret = OK;
|
||||||
else
|
else
|
||||||
@ -1687,9 +1689,9 @@ int slsReceiverTCPIPInterface::set_timer() {
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(index[0] == slsReceiverDefs::FRAME_PERIOD)
|
if(index[0] == slsReceiverDefs::FRAME_PERIOD)
|
||||||
retval=slsReceiverFunctions->setAcquisitionPeriod(index[1]);
|
retval=receiverBase->setAcquisitionPeriod(index[1]);
|
||||||
else
|
else
|
||||||
retval=slsReceiverFunctions->setNumberOfFrames(index[1]);
|
retval=receiverBase->setNumberOfFrames(index[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -1744,15 +1746,15 @@ int slsReceiverTCPIPInterface::enable_compression() {
|
|||||||
sprintf(mess,"Receiver locked by %s\n", socket->lastClientIP);
|
sprintf(mess,"Receiver locked by %s\n", socket->lastClientIP);
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
else if(slsReceiverFunctions->getStatus()==RUNNING){
|
else if(receiverBase->getStatus()==RUNNING){
|
||||||
strcpy(mess,"Cannot enable/disable compression while status is running\n");
|
strcpy(mess,"Cannot enable/disable compression while status is running\n");
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ret = slsReceiverFunctions->enableDataCompression(enable);
|
ret = receiverBase->enableDataCompression(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
retval=slsReceiverFunctions->getDataCompression();
|
retval=receiverBase->getDataCompression();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1794,8 +1796,10 @@ int slsReceiverTCPIPInterface::set_detector_hostname() {
|
|||||||
sprintf(mess,"Receiver locked by %s\n", socket->lastClientIP);
|
sprintf(mess,"Receiver locked by %s\n", socket->lastClientIP);
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
else
|
else{
|
||||||
strcpy(retval,slsReceiverFunctions->setDetectorHostname(hostname));
|
receiverBase->initialize(hostname);
|
||||||
|
strcpy(retval,receiverBase->getDetectorHostname());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
if(ret!=FAIL)
|
if(ret!=FAIL)
|
||||||
@ -1859,7 +1863,7 @@ int slsReceiverTCPIPInterface::set_dynamic_range() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ret!=FAIL){
|
if(ret!=FAIL){
|
||||||
retval=slsReceiverFunctions->setDynamicRange(dr);
|
retval=receiverBase->setDynamicRange(dr);
|
||||||
dynamicrange = dr;
|
dynamicrange = dr;
|
||||||
if(myDetectorType == EIGER){
|
if(myDetectorType == EIGER){
|
||||||
if(!tenGigaEnable)
|
if(!tenGigaEnable)
|
||||||
@ -1918,8 +1922,11 @@ int slsReceiverTCPIPInterface::enable_overwrite() {
|
|||||||
sprintf(mess,"Receiver locked by %s\n", socket->lastClientIP);
|
sprintf(mess,"Receiver locked by %s\n", socket->lastClientIP);
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
else
|
else{
|
||||||
retval=slsReceiverFunctions->enableOverwrite(index);
|
if(index >= 0)
|
||||||
|
receiverBase->setEnableOverwrite(index);
|
||||||
|
retval=receiverBase->getEnableOverwrite();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
if(ret!=FAIL)
|
if(ret!=FAIL)
|
||||||
@ -1971,7 +1978,7 @@ int slsReceiverTCPIPInterface::enable_tengiga() {
|
|||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
retval=slsReceiverFunctions->enableTenGiga(val);
|
retval=receiverBase->enableTenGiga(val);
|
||||||
if((val!=-1) && (val != retval))
|
if((val!=-1) && (val != retval))
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
else
|
else
|
||||||
@ -2179,21 +2186,21 @@ int slsReceiverTCPIPInterface::send_update() {
|
|||||||
//index
|
//index
|
||||||
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||||
|
|
||||||
ind=slsReceiverFunctions->getFileIndex();
|
ind=receiverBase->getFileIndex();
|
||||||
|
|
||||||
socket->SendDataOnly(&ind,sizeof(ind));
|
socket->SendDataOnly(&ind,sizeof(ind));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//filepath
|
//filepath
|
||||||
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||||
strcpy(path,slsReceiverFunctions->getFilePath());
|
strcpy(path,receiverBase->getFilePath());
|
||||||
#endif
|
#endif
|
||||||
socket->SendDataOnly(path,MAX_STR_LENGTH);
|
socket->SendDataOnly(path,MAX_STR_LENGTH);
|
||||||
|
|
||||||
|
|
||||||
//filename
|
//filename
|
||||||
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||||
strcpy(path,slsReceiverFunctions->getFileName());
|
strcpy(path,receiverBase->getFileName());
|
||||||
#endif
|
#endif
|
||||||
socket->SendDataOnly(path,MAX_STR_LENGTH);
|
socket->SendDataOnly(path,MAX_STR_LENGTH);
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "sls_receiver_defs.h"
|
#include "sls_receiver_defs.h"
|
||||||
#include "receiver_defs.h"
|
#include "receiver_defs.h"
|
||||||
#include "MySocketTCP.h"
|
#include "MySocketTCP.h"
|
||||||
#include "slsReceiverUDPFunctions.h"
|
#include "slsReceiverBase.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -26,8 +26,9 @@ public:
|
|||||||
* @param argc from command line
|
* @param argc from command line
|
||||||
* @param argv from command line
|
* @param argv from command line
|
||||||
* @param succecc socket creation was successfull
|
* @param succecc socket creation was successfull
|
||||||
|
* rbase pointer to the receiver base
|
||||||
*/
|
*/
|
||||||
slsReceiverTCPIPInterface(int argc, char *argv[], int &success);
|
slsReceiverTCPIPInterface(int argc, char *argv[], int &success, slsReceiverBase* rbase);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts listening on the TCP port for client comminication
|
* Starts listening on the TCP port for client comminication
|
||||||
@ -48,7 +49,7 @@ public:
|
|||||||
static void staticCloseFile(int p);
|
static void staticCloseFile(int p);
|
||||||
|
|
||||||
/** gets version */
|
/** gets version */
|
||||||
int64_t get_version();
|
int64_t getReceiverVersion();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
callback arguments are
|
callback arguments are
|
||||||
@ -64,7 +65,7 @@ public:
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void registerCallBackStartAcquisition(int (*func)(char*, char*,int, int, void*),void *arg){slsReceiverFunctions->registerCallBackStartAcquisition(func,arg);};;
|
void registerCallBackStartAcquisition(int (*func)(char*, char*,int, int, void*),void *arg){receiverBase->registerCallBackStartAcquisition(func,arg);};;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,7 +75,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
void registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg){slsReceiverFunctions->registerCallBackAcquisitionFinished(func,arg);};
|
void registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg){receiverBase->registerCallBackAcquisitionFinished(func,arg);};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -87,7 +88,7 @@ public:
|
|||||||
guidatapointer (NULL, no data required)
|
guidatapointer (NULL, no data required)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void registerCallBackRawDataReady(void (*func)(int, char*, int, FILE*, char*, void*),void *arg){slsReceiverFunctions->registerCallBackRawDataReady(func,arg);};
|
void registerCallBackRawDataReady(void (*func)(int, char*, int, FILE*, char*, void*),void *arg){receiverBase->registerCallBackRawDataReady(func,arg);};
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -224,8 +225,8 @@ private:
|
|||||||
/** detector type */
|
/** detector type */
|
||||||
detectorType myDetectorType;
|
detectorType myDetectorType;
|
||||||
|
|
||||||
/** slsReceiverUDPFunctions object */
|
/** slsReceiverBase object */
|
||||||
slsReceiverUDPFunctions *slsReceiverFunctions;
|
slsReceiverBase *receiverBase;
|
||||||
|
|
||||||
/** Number of functions */
|
/** Number of functions */
|
||||||
static const int numberOfFunctions = 256;
|
static const int numberOfFunctions = 256;
|
||||||
|
@ -30,7 +30,6 @@ using namespace std;
|
|||||||
|
|
||||||
|
|
||||||
slsReceiverUDPFunctions::slsReceiverUDPFunctions():
|
slsReceiverUDPFunctions::slsReceiverUDPFunctions():
|
||||||
receiver(NULL),
|
|
||||||
thread_started(0),
|
thread_started(0),
|
||||||
eth(NULL),
|
eth(NULL),
|
||||||
latestData(NULL),
|
latestData(NULL),
|
||||||
@ -261,8 +260,6 @@ int slsReceiverUDPFunctions::setDetectorType(detectorType det){
|
|||||||
packetIndexMask = MOENCH_PACKET_INDEX_MASK;
|
packetIndexMask = MOENCH_PACKET_INDEX_MASK;
|
||||||
}
|
}
|
||||||
else if(myDetectorType == EIGER){
|
else if(myDetectorType == EIGER){
|
||||||
#ifndef EIGERSLS
|
|
||||||
cout << "SLS Eiger Receiver" << endl;
|
|
||||||
fifosize = EIGER_FIFO_SIZE;
|
fifosize = EIGER_FIFO_SIZE;
|
||||||
packetsPerFrame = EIGER_ONE_GIGA_CONSTANT * dynamicRange * EIGER_MAX_PORTS;
|
packetsPerFrame = EIGER_ONE_GIGA_CONSTANT * dynamicRange * EIGER_MAX_PORTS;
|
||||||
onePacketSize = EIGER_ONE_GIGA_ONE_PACKET_SIZE;
|
onePacketSize = EIGER_ONE_GIGA_ONE_PACKET_SIZE;
|
||||||
@ -280,14 +277,6 @@ int slsReceiverUDPFunctions::setDetectorType(detectorType det){
|
|||||||
createListeningThreads(true);
|
createListeningThreads(true);
|
||||||
|
|
||||||
numListeningThreads = MAX_NUM_LISTENING_THREADS;
|
numListeningThreads = MAX_NUM_LISTENING_THREADS;
|
||||||
|
|
||||||
#else
|
|
||||||
cout << "Heiner's Receiver" << endl;
|
|
||||||
if(receiver == NULL)
|
|
||||||
receiver = EigerReceiver::create();
|
|
||||||
receiver->setFileName(fileName);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
latestData = new char[frameSize];
|
latestData = new char[frameSize];
|
||||||
|
|
||||||
@ -360,23 +349,17 @@ void slsReceiverUDPFunctions::resetTotalFramesCaught(){
|
|||||||
|
|
||||||
/*file parameters*/
|
/*file parameters*/
|
||||||
|
|
||||||
char* slsReceiverUDPFunctions::getFilePath(){
|
char* slsReceiverUDPFunctions::getFilePath() const{
|
||||||
if(receiver != NULL)
|
return (char*)filePath;
|
||||||
return receiver->getFilePath();
|
|
||||||
else
|
|
||||||
return filePath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char* slsReceiverUDPFunctions::setFilePath(char c[]){
|
char* slsReceiverUDPFunctions::setFilePath(const char c[]){
|
||||||
if(strlen(c)){
|
if(strlen(c)){
|
||||||
//check if filepath exists
|
//check if filepath exists
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if(stat(c,&st) == 0){
|
if(stat(c,&st) == 0)
|
||||||
if(receiver != NULL)
|
|
||||||
receiver->setFilePath(c);
|
|
||||||
else
|
|
||||||
strcpy(filePath,c);
|
strcpy(filePath,c);
|
||||||
}else{
|
else{
|
||||||
strcpy(filePath,"");
|
strcpy(filePath,"");
|
||||||
cout << "FilePath does not exist:" << filePath << endl;
|
cout << "FilePath does not exist:" << filePath << endl;
|
||||||
}
|
}
|
||||||
@ -385,23 +368,14 @@ char* slsReceiverUDPFunctions::setFilePath(char c[]){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char* slsReceiverUDPFunctions::getFileName(){
|
char* slsReceiverUDPFunctions::getFileName() const{
|
||||||
if(receiver != NULL)
|
return (char*)fileName;
|
||||||
return receiver->getFileName();
|
|
||||||
else
|
|
||||||
return fileName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char* slsReceiverUDPFunctions::setFileName(char c[]){
|
char* slsReceiverUDPFunctions::setFileName(const char c[]){
|
||||||
if(strlen(c)){
|
if(strlen(c))
|
||||||
if(receiver != NULL)
|
|
||||||
receiver->setFileName(c);
|
|
||||||
else
|
|
||||||
strcpy(fileName,c);
|
strcpy(fileName,c);
|
||||||
|
|
||||||
}
|
|
||||||
return getFileName();
|
return getFileName();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -422,66 +396,44 @@ int slsReceiverUDPFunctions::setFrameIndexNeeded(int i){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int slsReceiverUDPFunctions::setEnableFileWrite(int i){
|
int slsReceiverUDPFunctions::getEnableFileWrite() const{
|
||||||
if(i!=-1){
|
|
||||||
if(receiver != NULL)
|
|
||||||
receiver->setEnableFileWrite(i);
|
|
||||||
else
|
|
||||||
enableFileWrite=i;
|
|
||||||
|
|
||||||
}
|
|
||||||
if(receiver != NULL)
|
|
||||||
return receiver->getEnableFileWrite();
|
|
||||||
else
|
|
||||||
return enableFileWrite;
|
return enableFileWrite;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int slsReceiverUDPFunctions::setEnableFileWrite(int i){
|
||||||
|
enableFileWrite=i;
|
||||||
int slsReceiverUDPFunctions::enableOverwrite(int i){
|
return getEnableFileWrite();
|
||||||
if(i!=-1){
|
|
||||||
if(receiver != NULL)
|
|
||||||
receiver->setEnableOverwrite(i);
|
|
||||||
else
|
|
||||||
overwrite=i;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if(receiver != NULL)
|
|
||||||
return receiver->getEnableOverwrite();
|
int slsReceiverUDPFunctions::getEnableOverwrite() const{
|
||||||
else
|
|
||||||
return overwrite;
|
return overwrite;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int slsReceiverUDPFunctions::setEnableOverwrite(int i){
|
||||||
|
overwrite=i;
|
||||||
|
return getEnableOverwrite();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*other parameters*/
|
/*other parameters*/
|
||||||
|
|
||||||
slsReceiverDefs::runStatus slsReceiverUDPFunctions::getStatus(){
|
slsReceiverDefs::runStatus slsReceiverUDPFunctions::getStatus() const{
|
||||||
if(receiver != NULL)
|
|
||||||
return receiver->getStatus();
|
|
||||||
else
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char* slsReceiverUDPFunctions::setDetectorHostname(char c[]){
|
void slsReceiverUDPFunctions::initialize(const char *detectorHostName){
|
||||||
if(strlen(c)){
|
if(strlen(detectorHostName))
|
||||||
if(receiver != NULL){
|
strcpy(detHostname,detectorHostName);
|
||||||
if(receiver->getDetectorHostname()== NULL)
|
|
||||||
receiver->initialize(c);
|
|
||||||
}else
|
|
||||||
strcpy(detHostname,c);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(receiver != NULL)
|
|
||||||
return receiver->getDetectorHostname();
|
|
||||||
else
|
|
||||||
return detHostname;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
char *slsReceiverUDPFunctions::getDetectorHostname() const{
|
||||||
|
return (char*)detHostname;
|
||||||
|
}
|
||||||
|
|
||||||
void slsReceiverUDPFunctions::setEthernetInterface(char* c){
|
void slsReceiverUDPFunctions::setEthernetInterface(char* c){
|
||||||
strcpy(eth,c);
|
strcpy(eth,c);
|
||||||
@ -495,42 +447,40 @@ void slsReceiverUDPFunctions::setUDPPortNo(int p){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t slsReceiverUDPFunctions::setNumberOfFrames(int32_t fnum){
|
int slsReceiverUDPFunctions::getNumberOfFrames() const {
|
||||||
if(fnum >= 0){
|
|
||||||
if(receiver != NULL)
|
|
||||||
receiver->setNumberOfFrames(fnum);
|
|
||||||
else
|
|
||||||
numberOfFrames = fnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(receiver != NULL)
|
|
||||||
return receiver->getNumberOfFrames();
|
|
||||||
else
|
|
||||||
return numberOfFrames;
|
return numberOfFrames;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t slsReceiverUDPFunctions::setScanTag(int32_t stag){
|
|
||||||
if(stag >= 0){
|
int32_t slsReceiverUDPFunctions::setNumberOfFrames(int32_t fnum){
|
||||||
if(receiver != NULL)
|
if(fnum >= 0)
|
||||||
receiver->setScanTag(stag);
|
numberOfFrames = fnum;
|
||||||
else
|
|
||||||
scanTag = stag;
|
return getNumberOfFrames();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(receiver != NULL)
|
int slsReceiverUDPFunctions::getScanTag() const{
|
||||||
return receiver->getScanTag();
|
|
||||||
else
|
|
||||||
return scanTag;
|
return scanTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32_t slsReceiverUDPFunctions::setScanTag(int32_t stag){
|
||||||
|
if(stag >= 0)
|
||||||
|
scanTag = stag;
|
||||||
|
|
||||||
|
return getScanTag();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int slsReceiverUDPFunctions::getDynamicRange() const{
|
||||||
|
return dynamicRange;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t slsReceiverUDPFunctions::setDynamicRange(int32_t dr){
|
int32_t slsReceiverUDPFunctions::setDynamicRange(int32_t dr){
|
||||||
cout << "Setting Dynamic Range" << endl;
|
cout << "Setting Dynamic Range" << endl;
|
||||||
|
|
||||||
int olddr = dynamicRange;
|
int olddr = dynamicRange;
|
||||||
if(dr >= 0){
|
if(dr >= 0){
|
||||||
if(receiver != NULL)
|
|
||||||
receiver->setDynamicRange(dr);
|
|
||||||
else{
|
|
||||||
dynamicRange = dr;
|
dynamicRange = dr;
|
||||||
|
|
||||||
if(myDetectorType == EIGER){
|
if(myDetectorType == EIGER){
|
||||||
@ -578,13 +528,10 @@ int32_t slsReceiverUDPFunctions::setDynamicRange(int32_t dr){
|
|||||||
setThreadPriorities();
|
setThreadPriorities();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(receiver != NULL)
|
return getDynamicRange();
|
||||||
return receiver->getDynamicRange();
|
|
||||||
else
|
|
||||||
return dynamicRange;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -634,7 +581,6 @@ int64_t slsReceiverUDPFunctions::setAcquisitionPeriod(int64_t index){
|
|||||||
if(index >= 0){
|
if(index >= 0){
|
||||||
if(index != acquisitionPeriod){
|
if(index != acquisitionPeriod){
|
||||||
acquisitionPeriod = index;
|
acquisitionPeriod = index;
|
||||||
if(receiver != NULL)
|
|
||||||
setupFifoStructure();
|
setupFifoStructure();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -752,9 +698,6 @@ void slsReceiverUDPFunctions::setupFilter(){
|
|||||||
|
|
||||||
void slsReceiverUDPFunctions::setupFifoStructure(){
|
void slsReceiverUDPFunctions::setupFifoStructure(){
|
||||||
|
|
||||||
if(receiver != NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int64_t i;
|
int64_t i;
|
||||||
int oldn = numJobsPerThread;
|
int oldn = numJobsPerThread;
|
||||||
|
|
||||||
@ -1368,9 +1311,6 @@ void slsReceiverUDPFunctions::closeFile(int ithr){
|
|||||||
int slsReceiverUDPFunctions::startReceiver(char message[]){
|
int slsReceiverUDPFunctions::startReceiver(char message[]){
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(receiver != NULL)
|
|
||||||
return receiver->startReceiver(message);
|
|
||||||
|
|
||||||
|
|
||||||
// #ifdef VERBOSE
|
// #ifdef VERBOSE
|
||||||
cout << "Starting Receiver" << endl;
|
cout << "Starting Receiver" << endl;
|
||||||
@ -1435,9 +1375,6 @@ int slsReceiverUDPFunctions::startReceiver(char message[]){
|
|||||||
|
|
||||||
int slsReceiverUDPFunctions::stopReceiver(){
|
int slsReceiverUDPFunctions::stopReceiver(){
|
||||||
|
|
||||||
if(receiver != NULL)
|
|
||||||
return receiver->stopReceiver();
|
|
||||||
|
|
||||||
|
|
||||||
//#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
cout << "Stopping Receiver" << endl;
|
cout << "Stopping Receiver" << endl;
|
||||||
@ -1468,10 +1405,6 @@ int slsReceiverUDPFunctions::stopReceiver(){
|
|||||||
|
|
||||||
void slsReceiverUDPFunctions::startReadout(){
|
void slsReceiverUDPFunctions::startReadout(){
|
||||||
|
|
||||||
if(receiver != NULL){
|
|
||||||
receiver->stopReceiver();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
cout << "Start Receiver Readout" << endl;
|
cout << "Start Receiver Readout" << endl;
|
||||||
//#endif
|
//#endif
|
||||||
@ -2283,9 +2216,7 @@ int slsReceiverUDPFunctions::enableTenGiga(int enable){
|
|||||||
|
|
||||||
int oldtengiga = tengigaEnable;
|
int oldtengiga = tengigaEnable;
|
||||||
if(enable >= 0){
|
if(enable >= 0){
|
||||||
if(receiver != NULL)
|
|
||||||
;/*receiver->setTenGigaBitEthernet(enable);*/
|
|
||||||
else{
|
|
||||||
tengigaEnable = enable;
|
tengigaEnable = enable;
|
||||||
|
|
||||||
if(myDetectorType == EIGER){
|
if(myDetectorType == EIGER){
|
||||||
@ -2343,14 +2274,10 @@ int slsReceiverUDPFunctions::enableTenGiga(int enable){
|
|||||||
setThreadPriorities();
|
setThreadPriorities();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(receiver != NULL)
|
|
||||||
;/*return receiver->getTenGigaBitEthernet();*/
|
|
||||||
else
|
|
||||||
return tengigaEnable;
|
return tengigaEnable;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,7 +14,9 @@
|
|||||||
#include "singlePhotonDetector.h"
|
#include "singlePhotonDetector.h"
|
||||||
#include "slsReceiverData.h"
|
#include "slsReceiverData.h"
|
||||||
#include "moenchCommonMode.h"
|
#include "moenchCommonMode.h"
|
||||||
#include "eigerReceiver.h"
|
|
||||||
|
#include "slsReceiverBase.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef MYROOT1
|
#ifdef MYROOT1
|
||||||
#include <TTree.h>
|
#include <TTree.h>
|
||||||
@ -32,7 +34,7 @@
|
|||||||
* @short does all the functions for a receiver, set/get parameters, start/stop etc.
|
* @short does all the functions for a receiver, set/get parameters, start/stop etc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class slsReceiverUDPFunctions : private virtual slsReceiverDefs {
|
class slsReceiverUDPFunctions : private virtual slsReceiverDefs, public slsReceiverBase {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@ -113,24 +115,24 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Returns File Path
|
* Returns File Path
|
||||||
*/
|
*/
|
||||||
char* getFilePath();
|
char* getFilePath() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set File Path
|
* Set File Path
|
||||||
* @param c file path
|
* @param c file path
|
||||||
*/
|
*/
|
||||||
char* setFilePath(char c[]);
|
char* setFilePath(const char c[]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns File Name
|
* Returns File Name
|
||||||
*/
|
*/
|
||||||
char* getFileName();
|
char* getFileName() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set File Name (without frame index, file index and extension)
|
* Set File Name (without frame index, file index and extension)
|
||||||
* @param c file name
|
* @param c file name
|
||||||
*/
|
*/
|
||||||
char* setFileName(char c[]);
|
char* setFileName(const char c[]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns File Index
|
* Returns File Index
|
||||||
@ -161,22 +163,45 @@ public:
|
|||||||
* @param i enable
|
* @param i enable
|
||||||
* Returns enable over write
|
* Returns enable over write
|
||||||
*/
|
*/
|
||||||
int enableOverwrite(int i);
|
int setEnableOverwrite(int i);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns file write enable
|
||||||
|
* 1: YES 0: NO
|
||||||
|
*/
|
||||||
|
int getEnableFileWrite() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns file over write enable
|
||||||
|
* 1: YES 0: NO
|
||||||
|
*/
|
||||||
|
int getEnableOverwrite() const;
|
||||||
|
|
||||||
//other parameters
|
//other parameters
|
||||||
|
|
||||||
|
/**
|
||||||
|
* abort acquisition with minimum damage: close open files, cleanup.
|
||||||
|
* does nothing if state already is 'idle'
|
||||||
|
*/
|
||||||
|
void abort() {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns status of receiver: idle, running or error
|
* Returns status of receiver: idle, running or error
|
||||||
*/
|
*/
|
||||||
runStatus getStatus();
|
runStatus getStatus() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set detector hostname
|
* Set detector hostname
|
||||||
* @param c hostname
|
* @param c hostname
|
||||||
*/
|
*/
|
||||||
char* setDetectorHostname(char c[]);
|
void initialize(const char *detectorHostName);
|
||||||
|
|
||||||
|
/* Returns detector hostname
|
||||||
|
/returns hostname
|
||||||
|
* caller needs to deallocate the returned char array.
|
||||||
|
* if uninitialized, it must return NULL
|
||||||
|
*/
|
||||||
|
char *getDetectorHostname() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Ethernet Interface or IP to listen to
|
* Set Ethernet Interface or IP to listen to
|
||||||
@ -188,16 +213,33 @@ public:
|
|||||||
*/
|
*/
|
||||||
void setUDPPortNo(int p);
|
void setUDPPortNo(int p);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
int getNumberOfFrames() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set frame number if a positive number
|
* set frame number if a positive number
|
||||||
*/
|
*/
|
||||||
int32_t setNumberOfFrames(int32_t fnum);
|
int32_t setNumberOfFrames(int32_t fnum);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns scan tag
|
||||||
|
*/
|
||||||
|
int getScanTag() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set scan tag if its is a positive number
|
* set scan tag if its is a positive number
|
||||||
*/
|
*/
|
||||||
int32_t setScanTag(int32_t stag);
|
int32_t setScanTag(int32_t stag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of bits per pixel
|
||||||
|
*/
|
||||||
|
int getDynamicRange() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set dynamic range if its is a positive number
|
* set dynamic range if its is a positive number
|
||||||
*/
|
*/
|
||||||
@ -440,9 +482,6 @@ private:
|
|||||||
/** max number of writer threads */
|
/** max number of writer threads */
|
||||||
const static int MAX_NUM_WRITER_THREADS = 15;
|
const static int MAX_NUM_WRITER_THREADS = 15;
|
||||||
|
|
||||||
/** Eiger Receiver */
|
|
||||||
EigerReceiver *receiver;
|
|
||||||
|
|
||||||
/** detector type */
|
/** detector type */
|
||||||
detectorType myDetectorType;
|
detectorType myDetectorType;
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#include "slsReceiverUsers.h"
|
#include "slsReceiverUsers.h"
|
||||||
#include "slsReceiverTCPIPInterface.h"
|
#include "slsReceiver.h"
|
||||||
|
|
||||||
slsReceiverTCPIPInterface* slsReceiverUsers::receiver(NULL);
|
slsReceiver* slsReceiverUsers::receiver(NULL);
|
||||||
|
|
||||||
slsReceiverUsers::slsReceiverUsers(int argc, char *argv[], int &success) {
|
slsReceiverUsers::slsReceiverUsers(int argc, char *argv[], int &success) {
|
||||||
slsReceiverUsers::receiver=new slsReceiverTCPIPInterface(argc, argv, success);
|
slsReceiverUsers::receiver=new slsReceiver(argc, argv, success);
|
||||||
}
|
}
|
||||||
|
|
||||||
slsReceiverUsers::~slsReceiverUsers() {
|
slsReceiverUsers::~slsReceiverUsers() {
|
||||||
@ -25,7 +25,7 @@ void slsReceiverUsers::closeFile(int p) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int64_t slsReceiverUsers::getReceiverVersion(){
|
int64_t slsReceiverUsers::getReceiverVersion(){
|
||||||
slsReceiverUsers::receiver->get_version();
|
slsReceiverUsers::receiver->getReceiverVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
class slsReceiverTCPIPInterface;
|
|
||||||
|
class slsReceiver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@short Class for implementing the SLS data receiver in the users application. Callbacks can be defined for processing and/or saving data
|
@short Class for implementing the SLS data receiver in the users application. Callbacks can be defined for processing and/or saving data
|
||||||
@ -84,7 +85,7 @@ public:
|
|||||||
void registerCallBackRawDataReady(void (*func)(int framenumber, char* datapointer, int datasize, FILE* filedescriptor, char* guidatapointer, void*),void *arg);
|
void registerCallBackRawDataReady(void (*func)(int framenumber, char* datapointer, int datasize, FILE* filedescriptor, char* guidatapointer, void*),void *arg);
|
||||||
|
|
||||||
// made static to close thread files with ctrl+c
|
// made static to close thread files with ctrl+c
|
||||||
static slsReceiverTCPIPInterface* receiver;
|
static slsReceiver* receiver;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
86
slsReceiverSoftware/slsReceiverUsers.doxy
Normal file
86
slsReceiverSoftware/slsReceiverUsers.doxy
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
|
||||||
|
# documentation are documented, even if no documentation was available.
|
||||||
|
# Private class members and static file members will be hidden unless
|
||||||
|
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
|
||||||
|
|
||||||
|
EXTRACT_ALL = YES
|
||||||
|
|
||||||
|
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
|
||||||
|
# will be included in the documentation.
|
||||||
|
|
||||||
|
EXTRACT_PRIVATE = NO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# If the EXTRACT_STATIC tag is set to YES all static members of a file
|
||||||
|
# will be included in the documentation.
|
||||||
|
|
||||||
|
EXTRACT_STATIC = YES
|
||||||
|
|
||||||
|
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
|
||||||
|
# defined locally in source files will be included in the documentation.
|
||||||
|
# If set to NO only classes defined in header files are included.
|
||||||
|
|
||||||
|
EXTRACT_LOCAL_CLASSES = YES
|
||||||
|
|
||||||
|
# This flag is only useful for Objective-C code. When set to YES local
|
||||||
|
# methods, which are defined in the implementation section but not in
|
||||||
|
# the interface are included in the documentation.
|
||||||
|
# If set to NO (the default) only methods in the interface are included.
|
||||||
|
|
||||||
|
EXTRACT_LOCAL_METHODS = YES
|
||||||
|
|
||||||
|
# If this flag is set to YES, the members of anonymous namespaces will be
|
||||||
|
# extracted and appear in the documentation as a namespace called
|
||||||
|
# 'anonymous_namespace{file}', where file will be replaced with the base
|
||||||
|
# name of the file that contains the anonymous namespace. By default
|
||||||
|
# anonymous namespace are hidden.
|
||||||
|
|
||||||
|
EXTRACT_ANON_NSPACES = NO
|
||||||
|
|
||||||
|
# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
|
||||||
|
# undocumented members of documented classes, files or namespaces.
|
||||||
|
# If set to NO (the default) these members will be included in the
|
||||||
|
# various overviews, but no documentation section is generated.
|
||||||
|
# This option has no effect if EXTRACT_ALL is enabled.
|
||||||
|
|
||||||
|
HIDE_UNDOC_MEMBERS = NO
|
||||||
|
|
||||||
|
# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
|
||||||
|
# undocumented classes that are normally visible in the class hierarchy.
|
||||||
|
# If set to NO (the default) these classes will be included in the various
|
||||||
|
# overviews. This option has no effect if EXTRACT_ALL is enabled.
|
||||||
|
|
||||||
|
HIDE_UNDOC_CLASSES = NO
|
||||||
|
|
||||||
|
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
|
||||||
|
# friend (class|struct|union) declarations.
|
||||||
|
# If set to NO (the default) these declarations will be included in the
|
||||||
|
# documentation.
|
||||||
|
|
||||||
|
HIDE_FRIEND_COMPOUNDS = NO
|
||||||
|
|
||||||
|
INTERNAL_DOCS = NO
|
||||||
|
|
||||||
|
SHOW_INCLUDE_FILES = NO
|
||||||
|
|
||||||
|
SHOW_FILES = NO
|
||||||
|
|
||||||
|
SHOW_NAMESPACES = NO
|
||||||
|
|
||||||
|
COMPACT_LATEX = YES
|
||||||
|
|
||||||
|
PAPER_TYPE = a4
|
||||||
|
|
||||||
|
PDF_HYPERLINKS = YES
|
||||||
|
|
||||||
|
USE_PDFLATEX = YES
|
||||||
|
|
||||||
|
LATEX_HIDE_INDICES = YES
|
||||||
|
|
||||||
|
|
||||||
|
PREDEFINED = __cplusplus
|
||||||
|
|
||||||
|
INPUT = slsReceiver/slsReceiverBase.h
|
||||||
|
|
||||||
|
OUTPUT_DIRECTORY = slsReceiverUsersDocs
|
Loading…
x
Reference in New Issue
Block a user