mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 16:20:03 +02:00
receiver compiles
This commit is contained in:
parent
7d5b24fe33
commit
8151f1d5fe
@ -4,7 +4,7 @@ set(SOURCES
|
|||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
../../slsSupportLib/include
|
../../slsSupportLib/include
|
||||||
../../slsDetectorSoftware/slsDetectorAnalysis
|
../../slsReceiverSoftware/include
|
||||||
../../build/bin
|
../../build/bin
|
||||||
../../slsdetectorSoftware/slsDetector
|
../../slsdetectorSoftware/slsDetector
|
||||||
)
|
)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
PKGDIR = ../..
|
PKGDIR = ../..
|
||||||
LIBDIR = $(PKGDIR)/build/bin
|
LIBDIR = $(PKGDIR)/build/bin
|
||||||
INCLUDES = -I . -I$(PKGDIR)/slsSupportLib/include -I$(PKGDIR)/slsDetectorSoftware/slsDetectorAnalysis -I$(LIBDIR) -I$(PKGDIR)/slsDetectorSoftware/slsDetector
|
INCLUDES = -I . -I$(PKGDIR)/slsSupportLib/include -I$(LIBDIR) -I$(PKGDIR)/slsDetectorSoftware/slsDetector -I$(PKGDIR)/slsReceiversoftware/include
|
||||||
SRC_DET = mainClient.cpp
|
SRC_DET = mainClient.cpp
|
||||||
SRC_REC = mainReceiver.cpp
|
SRC_REC = mainReceiver.cpp
|
||||||
ZMQLIBDIR = $(PKGDIR)/slsSupportLib/include
|
ZMQLIBDIR = $(PKGDIR)/slsSupportLib/include
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
set(SOURCES
|
set(SOURCES
|
||||||
src/UDPInterface.cpp
|
src/slsReceiverImplementation.cpp
|
||||||
src/UDPBaseImplementation.cpp
|
|
||||||
src/UDPStandardImplementation.cpp
|
|
||||||
src/slsReceiverTCPIPInterface.cpp
|
src/slsReceiverTCPIPInterface.cpp
|
||||||
src/slsReceiver.cpp
|
src/slsReceiver.cpp
|
||||||
src/slsReceiverUsers.cpp
|
src/slsReceiverUsers.cpp
|
||||||
src/utilities.cpp
|
|
||||||
src/File.cpp
|
src/File.cpp
|
||||||
src/BinaryFile.cpp
|
src/BinaryFile.cpp
|
||||||
src/ThreadObject.cpp
|
src/ThreadObject.cpp
|
||||||
|
@ -26,8 +26,8 @@ LIBZMQ = -L$(LIBZMQDIR) -Wl,-rpath=$(LIBZMQDIR) -lzmq
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
SRC_CLNT = ThreadObject.cpp Listener.cpp DataProcessor.cpp DataStreamer.cpp Fifo.cpp File.cpp BinaryFile.cpp UDPInterface.cpp UDPBaseImplementation.cpp UDPStandardImplementation.cpp slsReceiverTCPIPInterface.cpp slsReceiver.cpp slsReceiverUsers.cpp $(COMMONDIR)/utilities.cpp
|
SRC_CLNT = ThreadObject.cpp Listener.cpp DataProcessor.cpp DataStreamer.cpp Fifo.cpp File.cpp BinaryFile.cpp slsReceiverImplementation.cpp slsReceiverTCPIPInterface.cpp slsReceiver.cpp slsReceiverUsers.cpp $(COMMONDIR)/utilities.cpp
|
||||||
DEPSINCLUDES = $(COMMONDIR)/ansi.h $(COMMONDIR)/sls_receiver_defs.h $(COMMONDIR)/sls_receiver_funcs.h $(COMMONDIR)/GeneralData.h $(INCDIR)/circularFifo.h $(COMMONDIR)/genericSocket.h $(COMMONDIR)/logger.h $(INCDIR)/receiver_defs.h $(INCDIR)/UDPInterface.h $(COMMONDIR)/utilities.h $(COMMONDIR)/ZmqSocket.h $(INCDIR)/BinaryFileStatic.h $(INCDIR)/HDF5FileStatic.h $(COMMONDIR)/sls_receiver_exceptions.h
|
DEPSINCLUDES = $(COMMONDIR)/ansi.h $(COMMONDIR)/sls_receiver_defs.h $(COMMONDIR)/sls_receiver_funcs.h $(COMMONDIR)/GeneralData.h $(INCDIR)/circularFifo.h $(COMMONDIR)/genericSocket.h $(COMMONDIR)/logger.h $(INCDIR)/receiver_defs.h $(COMMONDIR)/utilities.h $(COMMONDIR)/ZmqSocket.h $(INCDIR)/BinaryFileStatic.h $(INCDIR)/HDF5FileStatic.h $(COMMONDIR)/sls_receiver_exceptions.h
|
||||||
|
|
||||||
|
|
||||||
ifeq ($(HDF5),yes)
|
ifeq ($(HDF5),yes)
|
||||||
|
@ -1,801 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
/***********************************************
|
|
||||||
* @file UDPInterface.h
|
|
||||||
* @short Base class with all the functions for the UDP inteface of the receiver
|
|
||||||
***********************************************/
|
|
||||||
/**
|
|
||||||
* \mainpage Base class with all the functions for the UDP inteface of the receiver
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @short Base class with all the functions for the UDP inteface of the receiver
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "sls_receiver_defs.h"
|
|
||||||
#include "receiver_defs.h"
|
|
||||||
#include "utilities.h"
|
|
||||||
#include "logger.h"
|
|
||||||
|
|
||||||
#include <exception>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
class UDPInterface {
|
|
||||||
|
|
||||||
/* abstract class that defines the UDP interface of an sls detector data receiver.
|
|
||||||
*
|
|
||||||
* Use the factory method UDPInterface::create() to get an instance:
|
|
||||||
*
|
|
||||||
* UDPInterface *udp_interface = UDPInterface::create()
|
|
||||||
*
|
|
||||||
* Sequence of Calls from client (upon setting receiver)
|
|
||||||
* -setDetectorType
|
|
||||||
* -setMultiDetectorSize
|
|
||||||
* -setDetectorPositionId
|
|
||||||
* -initialize
|
|
||||||
* -setUDPPortNumber,setUDPPortNumber2,setEthernetInterface
|
|
||||||
* -setFilePath
|
|
||||||
* -setFileName
|
|
||||||
* -setFileIndex
|
|
||||||
* -setFileFormat
|
|
||||||
* -setFileWriteEnable
|
|
||||||
* -setOverwriteEnable
|
|
||||||
* -setAcquisitionPeriod
|
|
||||||
* -setNumberOfFrames
|
|
||||||
* -setAcquisitionTime
|
|
||||||
* -setSubExpTime (if eiger)
|
|
||||||
* -setNumberofSamples (if chip test board)
|
|
||||||
* -setDynamicRange
|
|
||||||
* -setFlippedData (if eiger)
|
|
||||||
* -setActivate (if eiger)
|
|
||||||
* -setDeactivatedPadding (if eiger)
|
|
||||||
* -setTenGigaEnable (if eiger)
|
|
||||||
* -setGapPixelsEnable
|
|
||||||
* -setStreamingPort
|
|
||||||
* -setStreamingSourceIP
|
|
||||||
* -setAdditionalJsonHeader
|
|
||||||
* -setDataStreamEnable
|
|
||||||
* -setROI
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* supported sequence of method-calls:
|
|
||||||
*
|
|
||||||
* initialize() : once and only once after create()
|
|
||||||
*
|
|
||||||
* get*() : anytime after initialize(), multiples times
|
|
||||||
*
|
|
||||||
* set*() : anytime after initialize(), multiple times
|
|
||||||
*
|
|
||||||
* startReceiver(): anytime after initialize(). Will fail in TCPIP itself if state already is 'running':
|
|
||||||
*
|
|
||||||
* Only startReceiver() does change the data receiver configuration, it does pass the whole configuration cache to the data receiver.
|
|
||||||
*
|
|
||||||
* abort(), //FIXME: needed?
|
|
||||||
*
|
|
||||||
* stopReceiver() : anytime after initialize(). Will do nothing if state already is idle.
|
|
||||||
* Otherwise, sets status to transmitting when shutting down sockets
|
|
||||||
* then to run_finished when all data obtained
|
|
||||||
* then to idle when returning from this function
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* getStatus() returns the actual state of the data receiver - idle, running or error, enum defined in include/sls_receiver_defs.h
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* get*() and set*() methods access the local cache of configuration values only and *do not* modify the data receiver settings.
|
|
||||||
*
|
|
||||||
* set methods return nothing, use get methods to validate a set method success
|
|
||||||
*
|
|
||||||
* get-methods that return a char array (char *) allocate a new array at each call. The caller is responsible to free the allocated space:
|
|
||||||
*
|
|
||||||
* char *c = receiver->getFileName();
|
|
||||||
* Or
|
|
||||||
* FIXME: so that the pointers are not shared external to the class, do the following way in the calling method?
|
|
||||||
* char *c = new char[MAX_STR_LENGTH];
|
|
||||||
* strcpy(c,receiver->getFileName());
|
|
||||||
* ....
|
|
||||||
*
|
|
||||||
* delete[] c;
|
|
||||||
*
|
|
||||||
* All pointers passed in externally will be allocated and freed by the calling function
|
|
||||||
*
|
|
||||||
* OK and FAIL are defined in include/sls_receiver_defs.h for functions implementing behavior
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
* Constructor & Destructor **********************************************
|
|
||||||
* They access local cache of configuration or detector parameters *******
|
|
||||||
*************************************************************************/
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
* Only non virtual function implemented in this class
|
|
||||||
* Factory create method to create a standard or custom object
|
|
||||||
* @param [in] receiver_type type can be standard or custom (must be derived from base class)
|
|
||||||
* @return a UDPInterface reference to object depending on receiver type
|
|
||||||
*/
|
|
||||||
static UDPInterface *create(std::string receiver_type = "standard");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destructor
|
|
||||||
*/
|
|
||||||
virtual ~UDPInterface() {};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
* Getters ***************************************************************
|
|
||||||
* They access local cache of configuration or detector parameters *******
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
//**initial/detector parameters***
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get multi detector size
|
|
||||||
* @return pointer to array of multi detector size in every dimension
|
|
||||||
*/
|
|
||||||
virtual int* getMultiDetectorSize() const = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get detector position id
|
|
||||||
* @return detector position id
|
|
||||||
*/
|
|
||||||
virtual int getDetectorPositionId() const = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get detector hostname
|
|
||||||
* @return hostname or NULL if uninitialized, must be released by calling function (max of 1000 characters)
|
|
||||||
*/
|
|
||||||
virtual char *getDetectorHostname() const = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get flipped data across 'axis'
|
|
||||||
* @return if data is flipped across 'axis'
|
|
||||||
*/
|
|
||||||
virtual int getFlippedData(int axis=0) const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Gap Pixels Enable (eiger specific)
|
|
||||||
* @return true if gap pixels enabled, else false
|
|
||||||
*/
|
|
||||||
virtual bool getGapPixelsEnable() const = 0;
|
|
||||||
|
|
||||||
|
|
||||||
//***file parameters***
|
|
||||||
/**
|
|
||||||
* Get File Format
|
|
||||||
* @return file format
|
|
||||||
*/
|
|
||||||
virtual slsReceiverDefs::fileFormat getFileFormat() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get File Name Prefix (without frame index, file index and extension (_d0_f000000000000_8.raw))
|
|
||||||
* @return NULL or pointer to file name prefix, must be released by calling function (max of 1000 characters)
|
|
||||||
*/
|
|
||||||
virtual char *getFileName() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get File Path
|
|
||||||
* @return NULL or pointer to file path, must be released by calling function (max of 1000 characters)
|
|
||||||
*/
|
|
||||||
virtual char *getFilePath() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get File Index
|
|
||||||
* @return file index of acquisition
|
|
||||||
*/
|
|
||||||
virtual uint64_t getFileIndex() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Frames per File (0 means infinite)
|
|
||||||
* @return Frames per File
|
|
||||||
*/
|
|
||||||
virtual uint32_t getFramesPerFile() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Frame Discard Policy
|
|
||||||
* @return Frame Discard Policy
|
|
||||||
*/
|
|
||||||
virtual slsReceiverDefs::frameDiscardPolicy getFrameDiscardPolicy() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Partial Frame Padding Enable
|
|
||||||
* @return Partial Frame Padding Enable
|
|
||||||
*/
|
|
||||||
virtual bool getFramePaddingEnable() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Scan Tag
|
|
||||||
* @return scan tag //FIXME: needed? (unsigned integer?)
|
|
||||||
*/
|
|
||||||
virtual int getScanTag() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get File Write Enable
|
|
||||||
* @return true if file write enabled, else false
|
|
||||||
*/
|
|
||||||
virtual bool getFileWriteEnable() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get File Over Write Enable
|
|
||||||
* @return true if file over write enabled, else false
|
|
||||||
*/
|
|
||||||
virtual bool getOverwriteEnable() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get data compression, by saving only hits (so far implemented only for Moench and Gotthard)
|
|
||||||
* @return true if data compression enabled, else false
|
|
||||||
*/
|
|
||||||
virtual bool getDataCompressionEnable() const = 0;
|
|
||||||
|
|
||||||
|
|
||||||
//***acquisition count parameters***
|
|
||||||
/**
|
|
||||||
* Get Total Frames Caught for an entire acquisition (including all scans)
|
|
||||||
* @return total number of frames caught for entire acquisition
|
|
||||||
*/
|
|
||||||
virtual uint64_t getTotalFramesCaught() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Frames Caught for each real time acquisition (eg. for each scan)
|
|
||||||
* @return number of frames caught for each scan
|
|
||||||
*/
|
|
||||||
virtual uint64_t getFramesCaught() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Current Frame Index for an entire acquisition (including all scans)
|
|
||||||
* @return -1 if no frames have been caught, else current frame index (represents all scans too) or -1 if no packets caught
|
|
||||||
*/
|
|
||||||
virtual int64_t getAcquisitionIndex() const = 0;
|
|
||||||
|
|
||||||
|
|
||||||
//***connection parameters***
|
|
||||||
/**
|
|
||||||
* Get UDP Port Number
|
|
||||||
* @return udp port number
|
|
||||||
*/
|
|
||||||
virtual uint32_t getUDPPortNumber() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Second UDP Port Number (eiger specific)
|
|
||||||
* @return second udp port number
|
|
||||||
*/
|
|
||||||
virtual uint32_t getUDPPortNumber2() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Ehernet Interface
|
|
||||||
* @return ethernet interface. eg. eth0 (max of 1000 characters)
|
|
||||||
*/
|
|
||||||
virtual char *getEthernetInterface() const = 0;
|
|
||||||
|
|
||||||
|
|
||||||
//***acquisition parameters***
|
|
||||||
/**
|
|
||||||
* Get ROI
|
|
||||||
* @return index of adc enabled, else -1 if all enabled
|
|
||||||
*/
|
|
||||||
virtual std::vector<slsReceiverDefs::ROI> getROI() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Frequency of Frames Sent to GUI
|
|
||||||
* @return 0 for random frame requests, n for nth frame frequency
|
|
||||||
*/
|
|
||||||
virtual uint32_t getFrameToGuiFrequency() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the timer between frames streamed when frequency is set to 0
|
|
||||||
* @return timer between frames streamed
|
|
||||||
*/
|
|
||||||
virtual uint32_t getFrameToGuiTimer() const = 0;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the data stream enable
|
|
||||||
* @return data stream enable
|
|
||||||
*/
|
|
||||||
virtual bool getDataStreamEnable() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Acquisition Period
|
|
||||||
* @return acquisition period
|
|
||||||
*/
|
|
||||||
virtual uint64_t getAcquisitionPeriod() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Acquisition Time
|
|
||||||
* @return acquisition time
|
|
||||||
*/
|
|
||||||
virtual uint64_t getAcquisitionTime() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Sub Exposure Time
|
|
||||||
* @return Sub Exposure Time
|
|
||||||
*/
|
|
||||||
virtual uint64_t getSubExpTime() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Sub Period
|
|
||||||
* @return Sub Period
|
|
||||||
*/
|
|
||||||
virtual uint64_t getSubPeriod() const = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get Number of Frames expected by receiver from detector
|
|
||||||
* The data receiver status will change from running to idle when it gets this number of frames FIXME: (for Leo? Not implemented)
|
|
||||||
* @return number of samples expected
|
|
||||||
*/
|
|
||||||
virtual uint64_t getNumberOfFrames() const = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get Number of Samples expected by receiver from detector (for chip test board only)
|
|
||||||
* @return number of samples expected
|
|
||||||
*/
|
|
||||||
virtual uint64_t getNumberofSamples() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Dynamic Range or Number of Bits Per Pixel
|
|
||||||
* @return dynamic range that is 4, 8, 16 or 32
|
|
||||||
*/
|
|
||||||
virtual uint32_t getDynamicRange() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Ten Giga Enable
|
|
||||||
* @return true if 10Giga enabled, else false (1G enabled)
|
|
||||||
*/
|
|
||||||
virtual bool getTenGigaEnable() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Fifo Depth
|
|
||||||
* @return fifo depth
|
|
||||||
*/
|
|
||||||
virtual uint32_t getFifoDepth() const = 0;
|
|
||||||
|
|
||||||
//***receiver status***
|
|
||||||
/**
|
|
||||||
* Get Listening Status of Receiver
|
|
||||||
* @return can be idle, listening or error depending on if the receiver is listening or not
|
|
||||||
*/
|
|
||||||
virtual slsReceiverDefs::runStatus getStatus() const = 0;
|
|
||||||
|
|
||||||
/** (not saved in client shared memory)
|
|
||||||
* Get Silent Mode
|
|
||||||
* @return silent mode
|
|
||||||
*/
|
|
||||||
virtual bool getSilentMode() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get activate
|
|
||||||
* If deactivated, receiver will create dummy data if deactivated padding is enabled
|
|
||||||
* (as it will receive nothing from detector)
|
|
||||||
* @return false for deactivated, true for activated
|
|
||||||
*/
|
|
||||||
virtual bool getActivate() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get deactivated padding enable
|
|
||||||
* If enabled, receiver will create dummy packets (0xFF), else it will create nothing
|
|
||||||
* (as it will receive nothing from detector)
|
|
||||||
* @return false for disabled, true for enabled
|
|
||||||
*/
|
|
||||||
virtual bool getDeactivatedPadding() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Streaming Port
|
|
||||||
* @return streaming port
|
|
||||||
*/
|
|
||||||
virtual uint32_t getStreamingPort() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get streaming source ip
|
|
||||||
* @return streaming source ip
|
|
||||||
*/
|
|
||||||
virtual char *getStreamingSourceIP() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get additional json header
|
|
||||||
* @return additional json header
|
|
||||||
*/
|
|
||||||
virtual char *getAdditionalJsonHeader() const = 0;
|
|
||||||
|
|
||||||
|
|
||||||
/** (not saved in client shared memory)
|
|
||||||
* Get UDP Socket Buffer Size
|
|
||||||
* @return UDP Socket Buffer Size
|
|
||||||
*/
|
|
||||||
virtual uint32_t getUDPSocketBufferSize() const = 0;
|
|
||||||
|
|
||||||
/** (not saved in client shared memory)
|
|
||||||
* Get actual UDP Socket Buffer Size
|
|
||||||
* @return actual UDP Socket Buffer Size
|
|
||||||
*/
|
|
||||||
virtual uint32_t getActualUDPSocketBufferSize() const = 0;
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
* Setters ***************************************************************
|
|
||||||
* They modify the local cache of configuration or detector parameters ***
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
//**initial parameters***
|
|
||||||
/**
|
|
||||||
* Configure command line parameters
|
|
||||||
* @param config_map mapping of config parameters passed from command line arguments
|
|
||||||
*/
|
|
||||||
virtual void configure(std::map<std::string, std::string> config_map) = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set multi detector size
|
|
||||||
* @param pointer to array of multi detector size in every dimension
|
|
||||||
*/
|
|
||||||
virtual void setMultiDetectorSize(const int* size) = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get flipped data across 'axis'
|
|
||||||
* @return if data is flipped across 'axis'
|
|
||||||
*/
|
|
||||||
virtual void setFlippedData(int axis=0, int enable=-1) = 0;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Gap Pixels Enable (eiger specific)
|
|
||||||
* @param b true for gap pixels enable, else false
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
virtual int setGapPixelsEnable(const bool b) = 0;
|
|
||||||
|
|
||||||
|
|
||||||
//***file parameters***
|
|
||||||
/**
|
|
||||||
* Set File Format
|
|
||||||
* @param f fileformat binary or hdf5
|
|
||||||
*/
|
|
||||||
virtual void setFileFormat(slsReceiverDefs::fileFormat f) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set File Name Prefix (without frame index, file index and extension (_d0_f000000000000_8.raw))
|
|
||||||
* Does not check for file existence since it is created only at startReceiver
|
|
||||||
* @param c file name (max of 1000 characters)
|
|
||||||
*/
|
|
||||||
virtual void setFileName(const char c[]) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set File Path
|
|
||||||
* Checks for file directory existence before setting file path
|
|
||||||
* @param c file path (max of 1000 characters)
|
|
||||||
*/
|
|
||||||
virtual void setFilePath(const char c[]) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set File Index of acquisition
|
|
||||||
* @param i file index of acquisition
|
|
||||||
*/
|
|
||||||
virtual void setFileIndex(const uint64_t i) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Frames per File (0 means infinite)
|
|
||||||
* @param i Frames per File
|
|
||||||
*/
|
|
||||||
virtual void setFramesPerFile(const uint32_t i) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Frame Discard Policy
|
|
||||||
* @param i Frame Discard Policy
|
|
||||||
*/
|
|
||||||
virtual void setFrameDiscardPolicy(const slsReceiverDefs::frameDiscardPolicy i) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Partial Frame Padding Enable
|
|
||||||
* @param i Partial Frame Padding Enable
|
|
||||||
*/
|
|
||||||
virtual void setFramePaddingEnable(const bool i) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Scan Tag
|
|
||||||
* @param i scan tag //FIXME: needed? (unsigned integer?)
|
|
||||||
*/
|
|
||||||
virtual void setScanTag(const int i) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set File Write Enable
|
|
||||||
* @param b true for file write enable, else false
|
|
||||||
*/
|
|
||||||
virtual void setFileWriteEnable(const bool b) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set File Overwrite Enable
|
|
||||||
* @param b true for file overwrite enable, else false
|
|
||||||
*/
|
|
||||||
virtual void setOverwriteEnable(const bool b) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set data compression, by saving only hits (so far implemented only for Moench and Gotthard)
|
|
||||||
* @param b true for data compression enable, else false
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
virtual int setDataCompressionEnable(const bool b) = 0;
|
|
||||||
|
|
||||||
//***connection parameters***
|
|
||||||
/**
|
|
||||||
* Set UDP Port Number
|
|
||||||
* @param i udp port number
|
|
||||||
*/
|
|
||||||
virtual void setUDPPortNumber(const uint32_t i) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Second UDP Port Number (eiger specific)
|
|
||||||
* @return second udp port number
|
|
||||||
*/
|
|
||||||
virtual void setUDPPortNumber2(const uint32_t i) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Ethernet Interface to listen to
|
|
||||||
* @param c ethernet inerface eg. eth0 (max of 1000 characters)
|
|
||||||
*/
|
|
||||||
virtual void setEthernetInterface(const char* c) = 0;
|
|
||||||
|
|
||||||
|
|
||||||
//***acquisition parameters***
|
|
||||||
/**
|
|
||||||
* Set ROI
|
|
||||||
* @param i ROI
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
virtual int setROI(const std::vector<slsReceiverDefs::ROI> i) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the Frequency of Frames Sent to GUI
|
|
||||||
* @param freq 0 for random frame requests, n for nth frame frequency
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
virtual int setFrameToGuiFrequency(const uint32_t freq) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the timer between frames streamed when frequency is set to 0
|
|
||||||
* @param time_in_ms timer between frames streamed
|
|
||||||
*/
|
|
||||||
virtual void setFrameToGuiTimer(const uint32_t time_in_ms) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the data stream enable
|
|
||||||
* @param enable data stream enable
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
virtual int setDataStreamEnable(const bool enable) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Acquisition Period
|
|
||||||
* @param i acquisition period
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
virtual int setAcquisitionPeriod(const uint64_t i) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Acquisition Time
|
|
||||||
* @param i acquisition time
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
virtual int setAcquisitionTime(const uint64_t i) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Sub Exposure Time
|
|
||||||
* @param i Sub Exposure Time
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
virtual void setSubExpTime(const uint64_t i) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Sub Period
|
|
||||||
* @param i Period
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
virtual void setSubPeriod(const uint64_t i) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Number of Frames expected by receiver from detector
|
|
||||||
* The data receiver status will change from running to idle when it gets this number of frames FIXME: (for Leo? Not implemented)
|
|
||||||
* @param i number of frames expected
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
virtual int setNumberOfFrames(const uint64_t i) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Number of Samples expected by receiver from detector
|
|
||||||
* @param i number of Samples expected
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
virtual int setNumberofSamples(const uint64_t i) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Dynamic Range or Number of Bits Per Pixel
|
|
||||||
* @param i dynamic range that is 4, 8, 16 or 32
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
virtual int setDynamicRange(const uint32_t i) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Ten Giga Enable
|
|
||||||
* @param b true if 10Giga enabled, else false (1G enabled)
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
virtual int setTenGigaEnable(const bool b) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Fifo Depth
|
|
||||||
* @param i fifo depth value
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
virtual int setFifoDepth(const uint32_t i) = 0;
|
|
||||||
|
|
||||||
|
|
||||||
//***receiver parameters***
|
|
||||||
/**
|
|
||||||
* Set Silent Mode
|
|
||||||
* @param i silent mode. true sets, false unsets
|
|
||||||
*/
|
|
||||||
virtual void setSilentMode(const bool i) = 0;
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
* Behavioral functions***************************************************
|
|
||||||
* They may modify the status of the receiver ****************************
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
//***initial functions***
|
|
||||||
/**
|
|
||||||
* Set receiver type (and corresponding detector variables in derived STANDARD class)
|
|
||||||
* It is the first function called by the client when connecting to receiver
|
|
||||||
* @param d detector type
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
virtual int setDetectorType(const slsReceiverDefs::detectorType d) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set detector position id
|
|
||||||
* @param i position id
|
|
||||||
*/
|
|
||||||
virtual void setDetectorPositionId(const int i) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets detector hostname
|
|
||||||
* It is second function called by the client when connecting to receiver.
|
|
||||||
* you can call this function only once.
|
|
||||||
* @param c detector hostname
|
|
||||||
*/
|
|
||||||
virtual void initialize(const char *c) = 0;
|
|
||||||
|
|
||||||
|
|
||||||
//***acquisition functions***
|
|
||||||
/**
|
|
||||||
* Reset acquisition parameters such as total frames caught for an entire acquisition (including all scans)
|
|
||||||
*/
|
|
||||||
virtual void resetAcquisitionCount() = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start Listening for Packets by activating all configuration settings to receiver
|
|
||||||
* @param c error message if FAIL
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
virtual int startReceiver(char *c=NULL) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stop Listening for Packets
|
|
||||||
* Calls startReadout(), which stops listening and sets status to Transmitting
|
|
||||||
* When it has read every frame in buffer,it returns with the status Run_Finished
|
|
||||||
*/
|
|
||||||
virtual void stopReceiver() = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stop Listening to Packets
|
|
||||||
* and sets status to Transmitting
|
|
||||||
*/
|
|
||||||
virtual void startReadout() = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shuts down and deletes UDP Sockets
|
|
||||||
*/
|
|
||||||
virtual void shutDownUDPSockets() = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* abort acquisition with minimum damage: close open files, cleanup.
|
|
||||||
* does nothing if state already is 'idle'
|
|
||||||
*/
|
|
||||||
virtual void abort() = 0; //FIXME: needed, isnt stopReceiver enough?
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Activate / Deactivate Receiver
|
|
||||||
* If deactivated, receiver will create dummy data if deactivated padding is enabled
|
|
||||||
* (as it will receive nothing from detector)
|
|
||||||
* @param enable enable
|
|
||||||
* @return false for disabled, true for enabled
|
|
||||||
*/
|
|
||||||
virtual bool setActivate(const bool enable) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set deactivated padding enable
|
|
||||||
* If enabled, receiver will create dummy packets (0xFF), else it will create nothing
|
|
||||||
* (as it will receive nothing from detector)
|
|
||||||
* @param enable enable
|
|
||||||
* @return false for disabled, true for enabled
|
|
||||||
*/
|
|
||||||
virtual bool setDeactivatedPadding(const bool enable) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set streaming port
|
|
||||||
* @param i streaming port
|
|
||||||
*/
|
|
||||||
virtual void setStreamingPort(const uint32_t i) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set streaming source ip
|
|
||||||
* @param c streaming source ip
|
|
||||||
*/
|
|
||||||
virtual void setStreamingSourceIP(const char* c) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set additional json header
|
|
||||||
*/
|
|
||||||
virtual void setAdditionalJsonHeader(const char* c) = 0;
|
|
||||||
|
|
||||||
/** (not saved in client shared memory)
|
|
||||||
* Set UDP Socket Buffer Size
|
|
||||||
* @param s UDP Socket Buffer Size
|
|
||||||
* @return OK or FAIL if dummy socket could be created
|
|
||||||
*/
|
|
||||||
virtual int setUDPSocketBufferSize(const uint32_t s) = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Restream stop dummy packet from receiver
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
virtual int restreamStop() = 0;
|
|
||||||
|
|
||||||
|
|
||||||
//***callback functions***
|
|
||||||
/**
|
|
||||||
* Call back for start acquisition
|
|
||||||
* callback arguments are
|
|
||||||
* filepath
|
|
||||||
* filename
|
|
||||||
* fileindex
|
|
||||||
* datasize
|
|
||||||
*
|
|
||||||
* return value is insignificant at the moment
|
|
||||||
* we write depending on file write enable
|
|
||||||
* users get data to write depending on call backs registered
|
|
||||||
*/
|
|
||||||
virtual void registerCallBackStartAcquisition(int (*func)(char*, char*, uint64_t, uint32_t, void*),void *arg) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Call back for acquisition finished
|
|
||||||
* callback argument is
|
|
||||||
* total frames caught
|
|
||||||
*/
|
|
||||||
virtual void registerCallBackAcquisitionFinished(void (*func)(uint64_t, void*),void *arg) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Call back for raw data
|
|
||||||
* args to raw data ready callback are
|
|
||||||
* sls_receiver_header frame metadata
|
|
||||||
* dataPointer is the pointer to the data
|
|
||||||
* dataSize in bytes is the size of the data in bytes.
|
|
||||||
*/
|
|
||||||
virtual void registerCallBackRawDataReady(void (*func)(char* ,
|
|
||||||
char*, uint32_t, void*),void *arg) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Call back for raw data (modified)
|
|
||||||
* args to raw data ready callback are
|
|
||||||
* sls_receiver_header frame metadata
|
|
||||||
* dataPointer is the pointer to the data
|
|
||||||
* revDatasize is the reference of data size in bytes. Can be modified to the new size to be written/streamed. (only smaller value).
|
|
||||||
*/
|
|
||||||
virtual void registerCallBackRawDataModifyReady(void (*func)(char* ,
|
|
||||||
char*, uint32_t &,void*),void *arg) = 0;
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
private:
|
|
||||||
|
|
||||||
};
|
|
@ -1,282 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
/********************************************//**
|
|
||||||
* @file UDPBaseImplementation.h
|
|
||||||
* @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.
|
|
||||||
*/
|
|
||||||
#include "UDPBaseImplementation.h"
|
|
||||||
|
|
||||||
class GeneralData;
|
|
||||||
class Listener;
|
|
||||||
class DataProcessor;
|
|
||||||
class DataStreamer;
|
|
||||||
class Fifo;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBaseImplementation {
|
|
||||||
public:
|
|
||||||
|
|
||||||
|
|
||||||
//*** cosntructor & destructor ***
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*/
|
|
||||||
UDPStandardImplementation();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destructor
|
|
||||||
*/
|
|
||||||
virtual ~UDPStandardImplementation();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//*** Overloaded Functions called by TCP Interface ***
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Total Frames Caught for an entire acquisition (including all scans)
|
|
||||||
* @return total number of frames caught for entire acquisition
|
|
||||||
*/
|
|
||||||
uint64_t getTotalFramesCaught() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Frames Caught for each real time acquisition (eg. for each scan)
|
|
||||||
* @return number of frames caught for each scan
|
|
||||||
*/
|
|
||||||
uint64_t getFramesCaught() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Current Frame Index for an entire acquisition (including all scans)
|
|
||||||
* @return -1 if no frames have been caught, else current frame index (represents all scans too)
|
|
||||||
*/
|
|
||||||
int64_t getAcquisitionIndex() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Gap Pixels Enable (eiger specific)
|
|
||||||
* @param b true for gap pixels enable, else false
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
int setGapPixelsEnable(const bool b);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set File Format
|
|
||||||
* @param f fileformat binary or hdf5
|
|
||||||
*/
|
|
||||||
void setFileFormat(slsReceiverDefs::fileFormat f);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set File Write Enable
|
|
||||||
* @param b true for file write enable, else false
|
|
||||||
*/
|
|
||||||
void setFileWriteEnable(const bool b);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set ROI
|
|
||||||
* @param i ROI
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
int setROI(const std::vector<ROI> i);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the Frequency of Frames Sent to GUI
|
|
||||||
* @param freq 0 for random frame requests, n for nth frame frequency
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
int setFrameToGuiFrequency(const uint32_t freq);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the data stream enable
|
|
||||||
* @param enable data stream enable
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
int setDataStreamEnable(const bool enable);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Number of Samples expected by receiver from detector
|
|
||||||
* @param i number of Samples expected
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
int setNumberofSamples(const uint64_t i);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Dynamic Range or Number of Bits Per Pixel
|
|
||||||
* @param i dynamic range that is 4, 8, 16 or 32
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
int setDynamicRange(const uint32_t i);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Ten Giga Enable
|
|
||||||
* @param b true if 10GbE enabled, else false (1G enabled)
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
int setTenGigaEnable(const bool b);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Fifo Depth
|
|
||||||
* @param i fifo depth value
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
int setFifoDepth(const uint32_t i);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set receiver type (and corresponding detector variables in derived STANDARD class)
|
|
||||||
* It is the first function called by the client when connecting to receiver
|
|
||||||
* @param d detector type
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
int setDetectorType(const detectorType d);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set detector position id and construct filewriter
|
|
||||||
* @param i position id
|
|
||||||
*/
|
|
||||||
void setDetectorPositionId(const int i);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset acquisition parameters such as total frames caught for an entire acquisition (including all scans)
|
|
||||||
*/
|
|
||||||
void resetAcquisitionCount();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start Listening for Packets by activating all configuration settings to receiver
|
|
||||||
* When this function returns, it has status RUNNING(upon SUCCESS) or IDLE (upon failure)
|
|
||||||
* @param c error message if FAIL
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
int startReceiver(char *c=NULL);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stop Listening for Packets
|
|
||||||
* Calls startReadout(), which stops listening and sets status to Transmitting
|
|
||||||
* When it has read every frame in buffer, the status changes to Run_Finished
|
|
||||||
* When this function returns, receiver has status IDLE
|
|
||||||
* Pre: status is running, semaphores have been instantiated,
|
|
||||||
* Post: udp sockets shut down, status is idle, semaphores destroyed
|
|
||||||
*/
|
|
||||||
void stopReceiver();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stop Listening to Packets
|
|
||||||
* and sets status to Transmitting
|
|
||||||
* Next step would be to get all data and stop receiver completely and return with idle state
|
|
||||||
* Pre: status is running, udp sockets have been initialized, stop receiver initiated
|
|
||||||
* Post:udp sockets closed, status is transmitting
|
|
||||||
*/
|
|
||||||
void startReadout();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shuts down and deletes UDP Sockets
|
|
||||||
* also called in case of illegal shutdown of receiver
|
|
||||||
*/
|
|
||||||
void shutDownUDPSockets();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Closes file / all files(data compression involves multiple files)
|
|
||||||
*/
|
|
||||||
void closeFiles();
|
|
||||||
|
|
||||||
/** (not saved in client shared memory)
|
|
||||||
* Set UDP Socket Buffer Size
|
|
||||||
* @param s UDP Socket Buffer Size
|
|
||||||
* @return OK or FAIL if dummy socket could be created
|
|
||||||
*/
|
|
||||||
int setUDPSocketBufferSize(const uint32_t s);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Restream stop dummy packet from receiver
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
int restreamStop();
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete and free member parameters
|
|
||||||
*/
|
|
||||||
void DeleteMembers();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize member parameters
|
|
||||||
*/
|
|
||||||
void InitializeMembers();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets local network parameters, but requires permissions
|
|
||||||
*/
|
|
||||||
void SetLocalNetworkParameters();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Thread Priorities
|
|
||||||
*/
|
|
||||||
void SetThreadPriorities();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set up the Fifo Structure for processing buffers
|
|
||||||
* between listening and dataprocessor threads
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
int SetupFifoStructure();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset parameters for new measurement (eg. for each scan)
|
|
||||||
*/
|
|
||||||
void ResetParametersforNewMeasurement();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates UDP Sockets
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
int CreateUDPSockets();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates the first file
|
|
||||||
* also does the startAcquisitionCallBack
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
int SetupWriter();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start Running
|
|
||||||
* Set running mask and post semaphore of the threads
|
|
||||||
* to start the inner loop in execution thread
|
|
||||||
*/
|
|
||||||
void StartRunning();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//*** Class Members ***
|
|
||||||
|
|
||||||
|
|
||||||
//*** receiver parameters ***
|
|
||||||
/** Number of Threads */
|
|
||||||
int numThreads;
|
|
||||||
|
|
||||||
/** Number of Jobs */
|
|
||||||
int numberofJobs;
|
|
||||||
|
|
||||||
/** Number of channels in roi for jungfrauctb */
|
|
||||||
uint32_t nroichannels;
|
|
||||||
|
|
||||||
//** class objects ***
|
|
||||||
/** General Data Properties */
|
|
||||||
GeneralData* generalData;
|
|
||||||
|
|
||||||
/** Listener Objects that listen to UDP and push into fifo */
|
|
||||||
std::vector <Listener*> listener;
|
|
||||||
|
|
||||||
/** DataProcessor Objects that pull from fifo and process data */
|
|
||||||
std::vector <DataProcessor*> dataProcessor;
|
|
||||||
|
|
||||||
/** DataStreamer Objects that stream data via ZMQ */
|
|
||||||
std::vector <DataStreamer*> dataStreamer;
|
|
||||||
|
|
||||||
/** Fifo Structure to store addresses of memory writes */
|
|
||||||
std::vector <Fifo*> fifo;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
@ -6,12 +6,9 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "slsReceiverTCPIPInterface.h"
|
class slsReceiverTCPIPInterface;
|
||||||
#include "UDPInterface.h"
|
|
||||||
|
|
||||||
#include "receiver_defs.h"
|
#include "sls_receiver_defs.h"
|
||||||
#include "MySocketTCP.h"
|
|
||||||
//#include "utilities.h"
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,39 +1,39 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
/********************************************//**
|
/********************************************//**
|
||||||
* @file UDPBaseImplementation.h
|
* @file slsReceiverImplementation.h
|
||||||
* @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.
|
||||||
***********************************************/
|
***********************************************/
|
||||||
|
|
||||||
//#include "sls_receiver_defs.h"
|
|
||||||
#include "UDPInterface.h"
|
|
||||||
//#include <stdio.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @short does all the base functions for a receiver, set/get parameters, start/stop etc.
|
* @short does all the functions for a receiver, set/get parameters, start/stop etc.
|
||||||
*/
|
*/
|
||||||
|
#include "sls_receiver_defs.h"
|
||||||
|
#include "receiver_defs.h"
|
||||||
|
#include "logger.h"
|
||||||
|
|
||||||
class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInterface {
|
class GeneralData;
|
||||||
|
class Listener;
|
||||||
|
class DataProcessor;
|
||||||
|
class DataStreamer;
|
||||||
|
class Fifo;
|
||||||
|
|
||||||
|
#include <exception>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class slsReceiverImplementation: private virtual slsReceiverDefs {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
* Constructor & Destructor **********************************************
|
//*** cosntructor & destructor ***
|
||||||
* They access local cache of configuration or detector parameters *******
|
|
||||||
*************************************************************************/
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
UDPBaseImplementation();
|
slsReceiverImplementation();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor
|
* Destructor
|
||||||
*/
|
*/
|
||||||
virtual ~UDPBaseImplementation();
|
virtual ~slsReceiverImplementation();
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialize class members
|
|
||||||
*/
|
|
||||||
void initializeMembers();
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* Getters ***************************************************************
|
* Getters ***************************************************************
|
||||||
@ -47,7 +47,6 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
*/
|
*/
|
||||||
int* getMultiDetectorSize() const;
|
int* getMultiDetectorSize() const;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get detector position id
|
* Get detector position id
|
||||||
* @return detector position id
|
* @return detector position id
|
||||||
@ -115,12 +114,6 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
*/
|
*/
|
||||||
bool getFramePaddingEnable() const;
|
bool getFramePaddingEnable() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Scan Tag
|
|
||||||
* @return scan tag //FIXME: needed? (unsigned integer?)
|
|
||||||
*/
|
|
||||||
int getScanTag() const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get File Write Enable
|
* Get File Write Enable
|
||||||
* @return true if file write enabled, else false
|
* @return true if file write enabled, else false
|
||||||
@ -133,12 +126,6 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
*/
|
*/
|
||||||
bool getOverwriteEnable() const;
|
bool getOverwriteEnable() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Get data compression, by saving only hits (so far implemented only for Moench and Gotthard)
|
|
||||||
* @return true if data compression enabled, else false
|
|
||||||
*/
|
|
||||||
bool getDataCompressionEnable() const;
|
|
||||||
|
|
||||||
|
|
||||||
//***acquisition count parameters***
|
//***acquisition count parameters***
|
||||||
/**
|
/**
|
||||||
@ -188,16 +175,16 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
std::vector<ROI> getROI() const;
|
std::vector<ROI> getROI() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Frequency of Frames Sent to GUI
|
* Get the streaming frequency
|
||||||
* @return 0 for random frame requests, n for nth frame frequency
|
* @return 0 for timer, n for nth frame frequency
|
||||||
*/
|
*/
|
||||||
uint32_t getFrameToGuiFrequency() const;
|
uint32_t getStreamingFrequency() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the timer between frames streamed when frequency is set to 0
|
* Gets the timer between frames streamed when frequency is set to 0
|
||||||
* @return timer between frames streamed
|
* @return timer between frames streamed
|
||||||
*/
|
*/
|
||||||
uint32_t getFrameToGuiTimer() const;
|
uint32_t getStreamingTimer() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the data stream enable
|
* Get the data stream enable
|
||||||
@ -329,10 +316,10 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
|
|
||||||
//**initial parameters***
|
//**initial parameters***
|
||||||
/**
|
/**
|
||||||
* Configure command line parameters
|
* Sets detector hostname
|
||||||
* @param config_map mapping of config parameters passed from command line arguments
|
* @param c detector hostname
|
||||||
*/
|
*/
|
||||||
void configure(std::map<std::string, std::string> config_map);
|
void setDetectorHostname(const char *c);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set multi detector size
|
* Set multi detector size
|
||||||
@ -400,12 +387,6 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
*/
|
*/
|
||||||
void setFramePaddingEnable(const bool i);
|
void setFramePaddingEnable(const bool i);
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Scan Tag
|
|
||||||
* @param i scan tag //FIXME: needed? (unsigned integer?)
|
|
||||||
*/
|
|
||||||
void setScanTag(const int i);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set File Write Enable
|
* Set File Write Enable
|
||||||
* @param b true for file write enable, else false
|
* @param b true for file write enable, else false
|
||||||
@ -418,14 +399,6 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
*/
|
*/
|
||||||
void setOverwriteEnable(const bool b);
|
void setOverwriteEnable(const bool b);
|
||||||
|
|
||||||
/**
|
|
||||||
* Set data compression, by saving only hits (so far implemented only for Moench and Gotthard)
|
|
||||||
* @param b true for data compression enable, else false
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
int setDataCompressionEnable(const bool b);
|
|
||||||
|
|
||||||
|
|
||||||
//***connection parameters***
|
//***connection parameters***
|
||||||
/**
|
/**
|
||||||
* Set UDP Port Number
|
* Set UDP Port Number
|
||||||
@ -445,6 +418,13 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
*/
|
*/
|
||||||
void setEthernetInterface(const char* c);
|
void setEthernetInterface(const char* c);
|
||||||
|
|
||||||
|
/** (not saved in client shared memory)
|
||||||
|
* Set UDP Socket Buffer Size
|
||||||
|
* @param s UDP Socket Buffer Size
|
||||||
|
* @return OK or FAIL if dummy socket could be created
|
||||||
|
*/
|
||||||
|
int setUDPSocketBufferSize(const uint32_t s);
|
||||||
|
|
||||||
|
|
||||||
//***acquisition parameters***
|
//***acquisition parameters***
|
||||||
/**
|
/**
|
||||||
@ -455,18 +435,17 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
int setROI(const std::vector<ROI> i);
|
int setROI(const std::vector<ROI> i);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Frequency of Frames Sent to GUI
|
* Set the streaming frequency
|
||||||
* @param freq 0 for random frame requests, n for nth frame frequency
|
* @param freq 0 for timer, n for nth frame frequency
|
||||||
* @return OK or FAIL
|
* @return OK or FAIL
|
||||||
*/
|
*/
|
||||||
int setFrameToGuiFrequency(const uint32_t freq);
|
int setStreamingFrequency(const uint32_t freq);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the timer between frames streamed when frequency is set to 0
|
* Sets the timer between frames streamed when frequency is set to 0
|
||||||
* @param time_in_ms timer between frames streamed
|
* @param time_in_ms timer between frames streamed
|
||||||
*/
|
*/
|
||||||
void setFrameToGuiTimer(const uint32_t time_in_ms);
|
void setStreamingTimer(const uint32_t time_in_ms);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the data stream enable
|
* Set the data stream enable
|
||||||
* @param enable data stream enable
|
* @param enable data stream enable
|
||||||
@ -474,6 +453,23 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
*/
|
*/
|
||||||
int setDataStreamEnable(const bool enable);
|
int setDataStreamEnable(const bool enable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set streaming port
|
||||||
|
* @param i streaming port
|
||||||
|
*/
|
||||||
|
void setStreamingPort(const uint32_t i);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set streaming source ip
|
||||||
|
* @param c streaming source ip
|
||||||
|
*/
|
||||||
|
void setStreamingSourceIP(const char* c);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set additional json header
|
||||||
|
*/
|
||||||
|
void setAdditionalJsonHeader(const char* c);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Acquisition Period
|
* Set Acquisition Period
|
||||||
* @param i acquisition period
|
* @param i acquisition period
|
||||||
@ -525,7 +521,7 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Ten Giga Enable
|
* Set Ten Giga Enable
|
||||||
* @param b true if 10Giga enabled, else false (1G enabled)
|
* @param b true if 10GbE enabled, else false (1G enabled)
|
||||||
* @return OK or FAIL
|
* @return OK or FAIL
|
||||||
*/
|
*/
|
||||||
int setTenGigaEnable(const bool b);
|
int setTenGigaEnable(const bool b);
|
||||||
@ -537,80 +533,8 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
*/
|
*/
|
||||||
int setFifoDepth(const uint32_t i);
|
int setFifoDepth(const uint32_t i);
|
||||||
|
|
||||||
|
|
||||||
//***receiver parameters***
|
//***receiver parameters***
|
||||||
/**
|
|
||||||
* Set Silent Mode
|
|
||||||
* @param i silent mode. true sets, false unsets
|
|
||||||
*/
|
|
||||||
void setSilentMode(const bool i);
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
* Behavioral functions***************************************************
|
|
||||||
* They may modify the status of the receiver ****************************
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
//***initial functions***
|
|
||||||
/**
|
|
||||||
* Set receiver type (and corresponding detector variables in derived STANDARD class)
|
|
||||||
* It is the first function called by the client when connecting to receiver
|
|
||||||
* @param d detector type
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
int setDetectorType(const detectorType d);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set detector position id
|
|
||||||
* @param i position id
|
|
||||||
*/
|
|
||||||
void setDetectorPositionId(const int i);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets detector hostname
|
|
||||||
* It is second function called by the client when connecting to receiver.
|
|
||||||
* you can call this function only once.
|
|
||||||
* @param c detector hostname
|
|
||||||
*/
|
|
||||||
void initialize(const char *c);
|
|
||||||
|
|
||||||
|
|
||||||
//***acquisition functions***
|
|
||||||
/**
|
|
||||||
* Reset acquisition parameters such as total frames caught for an entire acquisition (including all scans)
|
|
||||||
*/
|
|
||||||
void resetAcquisitionCount();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start Listening for Packets by activating all configuration settings to receiver
|
|
||||||
* @param c error message if FAIL
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
int startReceiver(char *c=NULL);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stop Listening for Packets
|
|
||||||
* Calls startReadout(), which stops listening and sets status to Transmitting
|
|
||||||
* When it has read every frame in buffer,it returns with the status Run_Finished
|
|
||||||
*/
|
|
||||||
void stopReceiver();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stop Listening to Packets
|
|
||||||
* and sets status to Transmitting
|
|
||||||
*/
|
|
||||||
void startReadout();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shuts down and deletes UDP Sockets
|
|
||||||
*/
|
|
||||||
void shutDownUDPSockets();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* abort acquisition with minimum damage: close open files, cleanup.
|
|
||||||
* does nothing if state already is 'idle'
|
|
||||||
*/
|
|
||||||
void abort(); //FIXME: needed, isn't stopReceiver enough?
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activate / Deactivate Receiver
|
* Activate / Deactivate Receiver
|
||||||
* If deactivated, receiver will create dummy data if deactivated padding is enabled
|
* If deactivated, receiver will create dummy data if deactivated padding is enabled
|
||||||
@ -630,30 +554,77 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
bool setDeactivatedPadding(const bool enable);
|
bool setDeactivatedPadding(const bool enable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set streaming port
|
* Set Silent Mode
|
||||||
* @param i streaming port
|
* @param i silent mode. true sets, false unsets
|
||||||
*/
|
*/
|
||||||
void setStreamingPort(const uint32_t i);
|
void setSilentMode(const bool i);
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
* Behavioral functions***************************************************
|
||||||
|
* They may modify the status of the receiver ****************************
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
//***initial functions***
|
||||||
|
/**
|
||||||
|
* Set receiver type (and corresponding detector variables in derived STANDARD class)
|
||||||
|
* It is the first function called by the client when connecting to receiver
|
||||||
|
* @param d detector type
|
||||||
|
* @return OK or FAIL
|
||||||
|
*/
|
||||||
|
int setDetectorType(const detectorType d);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set streaming source ip
|
* Set detector position id and construct filewriter
|
||||||
* @param c streaming source ip
|
* @param i position id
|
||||||
*/
|
*/
|
||||||
void setStreamingSourceIP(const char* c);
|
void setDetectorPositionId(const int i);
|
||||||
|
|
||||||
/**
|
//***acquisition functions***
|
||||||
* Set additional json header
|
/**
|
||||||
*/
|
* Reset acquisition parameters such as total frames caught for an entire acquisition (including all scans)
|
||||||
void setAdditionalJsonHeader(const char* c);
|
*/
|
||||||
|
void resetAcquisitionCount();
|
||||||
|
|
||||||
/** (not saved in client shared memory)
|
/**
|
||||||
* Set UDP Socket Buffer Size
|
* Start Listening for Packets by activating all configuration settings to receiver
|
||||||
* @param s UDP Socket Buffer Size
|
* When this function returns, it has status RUNNING(upon SUCCESS) or IDLE (upon failure)
|
||||||
* @return OK or FAIL if dummy socket could be created
|
* @param c error message if FAIL
|
||||||
*/
|
* @return OK or FAIL
|
||||||
int setUDPSocketBufferSize(const uint32_t s);
|
*/
|
||||||
|
int startReceiver(char *c=NULL);
|
||||||
|
|
||||||
/*
|
/**
|
||||||
|
* Stop Listening for Packets
|
||||||
|
* Calls startReadout(), which stops listening and sets status to Transmitting
|
||||||
|
* When it has read every frame in buffer, the status changes to Run_Finished
|
||||||
|
* When this function returns, receiver has status IDLE
|
||||||
|
* Pre: status is running, semaphores have been instantiated,
|
||||||
|
* Post: udp sockets shut down, status is idle, semaphores destroyed
|
||||||
|
*/
|
||||||
|
void stopReceiver();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop Listening to Packets
|
||||||
|
* and sets status to Transmitting
|
||||||
|
* Next step would be to get all data and stop receiver completely and return with idle state
|
||||||
|
* Pre: status is running, udp sockets have been initialized, stop receiver initiated
|
||||||
|
* Post:udp sockets closed, status is transmitting
|
||||||
|
*/
|
||||||
|
void startReadout();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shuts down and deletes UDP Sockets
|
||||||
|
* also called in case of illegal shutdown of receiver
|
||||||
|
*/
|
||||||
|
void shutDownUDPSockets();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes file / all files(data compression involves multiple files)
|
||||||
|
*/
|
||||||
|
void closeFiles();
|
||||||
|
|
||||||
|
/**
|
||||||
* Restream stop dummy packet from receiver
|
* Restream stop dummy packet from receiver
|
||||||
* @return OK or FAIL
|
* @return OK or FAIL
|
||||||
*/
|
*/
|
||||||
@ -702,8 +673,61 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
void registerCallBackRawDataModifyReady(void (*func)(char* ,
|
void registerCallBackRawDataModifyReady(void (*func)(char* ,
|
||||||
char*, uint32_t &,void*),void *arg);
|
char*, uint32_t &,void*),void *arg);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete and free member parameters
|
||||||
|
*/
|
||||||
|
void DeleteMembers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize member parameters
|
||||||
|
*/
|
||||||
|
void InitializeMembers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets local network parameters, but requires permissions
|
||||||
|
*/
|
||||||
|
void SetLocalNetworkParameters();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Thread Priorities
|
||||||
|
*/
|
||||||
|
void SetThreadPriorities();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set up the Fifo Structure for processing buffers
|
||||||
|
* between listening and dataprocessor threads
|
||||||
|
* @return OK or FAIL
|
||||||
|
*/
|
||||||
|
int SetupFifoStructure();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset parameters for new measurement (eg. for each scan)
|
||||||
|
*/
|
||||||
|
void ResetParametersforNewMeasurement();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates UDP Sockets
|
||||||
|
* @return OK or FAIL
|
||||||
|
*/
|
||||||
|
int CreateUDPSockets();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the first file
|
||||||
|
* also does the startAcquisitionCallBack
|
||||||
|
* @return OK or FAIL
|
||||||
|
*/
|
||||||
|
int SetupWriter();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start Running
|
||||||
|
* Set running mask and post semaphore of the threads
|
||||||
|
* to start the inner loop in execution thread
|
||||||
|
*/
|
||||||
|
void StartRunning();
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* Class Members *********************************************************
|
* Class Members *********************************************************
|
||||||
@ -740,7 +764,13 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
/** gap pixels enable */
|
/** gap pixels enable */
|
||||||
bool gapPixelsEnable;
|
bool gapPixelsEnable;
|
||||||
|
|
||||||
//***receiver parameters***
|
//*** receiver parameters ***
|
||||||
|
/** Number of Threads */
|
||||||
|
int numThreads;
|
||||||
|
/** Number of Jobs */
|
||||||
|
int numberofJobs;
|
||||||
|
/** Number of channels in roi for jungfrauctb */
|
||||||
|
uint32_t nroichannels;
|
||||||
/** Maximum Number of Listening Threads/ UDP Ports */
|
/** Maximum Number of Listening Threads/ UDP Ports */
|
||||||
const static int MAX_NUMBER_OF_LISTENING_THREADS = 2;
|
const static int MAX_NUMBER_OF_LISTENING_THREADS = 2;
|
||||||
/** Receiver Status */
|
/** Receiver Status */
|
||||||
@ -753,6 +783,8 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
frameDiscardPolicy frameDiscardMode;
|
frameDiscardPolicy frameDiscardMode;
|
||||||
/** frame padding */
|
/** frame padding */
|
||||||
bool framePadding;
|
bool framePadding;
|
||||||
|
/** silent mode */
|
||||||
|
bool silentMode;
|
||||||
|
|
||||||
//***connection parameters***
|
//***connection parameters***
|
||||||
/** Ethernet Interface */
|
/** Ethernet Interface */
|
||||||
@ -764,7 +796,7 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
/** actual UDP Socket Buffer Size (halved due to kernel bookkeeping) */
|
/** actual UDP Socket Buffer Size (halved due to kernel bookkeeping) */
|
||||||
uint32_t actualUDPSocketBufferSize;
|
uint32_t actualUDPSocketBufferSize;
|
||||||
|
|
||||||
//***file parameters***
|
//***file parameters***
|
||||||
/** File format */
|
/** File format */
|
||||||
fileFormat fileFormatType;
|
fileFormat fileFormatType;
|
||||||
/** File Name without frame index, file index and extension (_d0_f000000000000_8.raw)*/
|
/** File Name without frame index, file index and extension (_d0_f000000000000_8.raw)*/
|
||||||
@ -775,22 +807,18 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
uint64_t fileIndex;
|
uint64_t fileIndex;
|
||||||
/** Frames per file (0 means infinite) */
|
/** Frames per file (0 means infinite) */
|
||||||
uint32_t framesPerFile;
|
uint32_t framesPerFile;
|
||||||
/** Scan Tag */
|
|
||||||
int scanTag;
|
|
||||||
/** File Write enable */
|
/** File Write enable */
|
||||||
bool fileWriteEnable;
|
bool fileWriteEnable;
|
||||||
/** Overwrite enable */
|
/** Overwrite enable */
|
||||||
bool overwriteEnable;
|
bool overwriteEnable;
|
||||||
/** Data Compression Enable - save only hits */
|
|
||||||
bool dataCompressionEnable;
|
|
||||||
|
|
||||||
//***acquisition parameters***
|
//***acquisition parameters***
|
||||||
/* ROI */
|
/* ROI */
|
||||||
std::vector<ROI> roi;
|
std::vector<ROI> roi;
|
||||||
/** Frequency of Frames sent to GUI */
|
/** streaming frequency */
|
||||||
uint32_t frameToGuiFrequency;
|
uint32_t streamingFrequency;
|
||||||
/** Timer of Frames sent to GUI when frequency is 0 */
|
/** Streaming timer when frequency is 0 */
|
||||||
uint32_t frameToGuiTimerinMS;
|
uint32_t streamingTimerInMs;
|
||||||
/** Data Stream Enable from Receiver */
|
/** Data Stream Enable from Receiver */
|
||||||
bool dataStreamEnable;
|
bool dataStreamEnable;
|
||||||
/** streaming port */
|
/** streaming port */
|
||||||
@ -800,10 +828,17 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
/** additional json header */
|
/** additional json header */
|
||||||
char additionalJsonHeader[MAX_STR_LENGTH];
|
char additionalJsonHeader[MAX_STR_LENGTH];
|
||||||
|
|
||||||
//***receiver parameters***
|
//** class objects ***
|
||||||
bool silentMode;
|
/** General Data Properties */
|
||||||
|
GeneralData* generalData;
|
||||||
|
/** Listener Objects that listen to UDP and push into fifo */
|
||||||
|
std::vector <Listener*> listener;
|
||||||
|
/** DataProcessor Objects that pull from fifo and process data */
|
||||||
|
std::vector <DataProcessor*> dataProcessor;
|
||||||
|
/** DataStreamer Objects that stream data via ZMQ */
|
||||||
|
std::vector <DataStreamer*> dataStreamer;
|
||||||
|
/** Fifo Structure to store addresses of memory writes */
|
||||||
|
std::vector <Fifo*> fifo;
|
||||||
|
|
||||||
//***callback parameters***
|
//***callback parameters***
|
||||||
/**
|
/**
|
||||||
@ -820,7 +855,6 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
*/
|
*/
|
||||||
int (*startAcquisitionCallBack)(char*, char*, uint64_t, uint32_t, void*);
|
int (*startAcquisitionCallBack)(char*, char*, uint64_t, uint32_t, void*);
|
||||||
void *pStartAcquisition;
|
void *pStartAcquisition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call back for acquisition finished
|
* Call back for acquisition finished
|
||||||
* callback argument is
|
* callback argument is
|
||||||
@ -828,8 +862,6 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
*/
|
*/
|
||||||
void (*acquisitionFinishedCallBack)(uint64_t, void*);
|
void (*acquisitionFinishedCallBack)(uint64_t, void*);
|
||||||
void *pAcquisitionFinished;
|
void *pAcquisitionFinished;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call back for raw data
|
* Call back for raw data
|
||||||
* args to raw data ready callback are
|
* args to raw data ready callback are
|
||||||
@ -839,7 +871,6 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
*/
|
*/
|
||||||
void (*rawDataReadyCallBack)(char* ,
|
void (*rawDataReadyCallBack)(char* ,
|
||||||
char*, uint32_t, void*);
|
char*, uint32_t, void*);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call back for raw data (modified)
|
* Call back for raw data (modified)
|
||||||
* args to raw data ready callback are
|
* args to raw data ready callback are
|
||||||
@ -849,11 +880,8 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
*/
|
*/
|
||||||
void (*rawDataModifyReadyCallBack)(char* ,
|
void (*rawDataModifyReadyCallBack)(char* ,
|
||||||
char*, uint32_t &, void*);
|
char*, uint32_t &, void*);
|
||||||
|
|
||||||
void *pRawDataReady;
|
void *pRawDataReady;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
@ -7,8 +7,9 @@
|
|||||||
|
|
||||||
#include "sls_receiver_defs.h"
|
#include "sls_receiver_defs.h"
|
||||||
#include "receiver_defs.h"
|
#include "receiver_defs.h"
|
||||||
#include "MySocketTCP.h"
|
|
||||||
#include "UDPInterface.h"
|
class MySocketTCP;
|
||||||
|
class slsReceiverImplementation;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -175,8 +176,8 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
|
|||||||
/** set dynamic range */
|
/** set dynamic range */
|
||||||
int set_dynamic_range();
|
int set_dynamic_range();
|
||||||
|
|
||||||
/** Sets the receiver to send every nth frame to gui, or only upon gui request */
|
/** Sets the receiver streaming frequency */
|
||||||
int set_read_frequency();
|
int set_streaming_frequency();
|
||||||
|
|
||||||
/** Gets receiver status */
|
/** Gets receiver status */
|
||||||
int get_status();
|
int get_status();
|
||||||
@ -187,10 +188,6 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
|
|||||||
/** Stop Receiver - stops listening to udp packets from detector*/
|
/** Stop Receiver - stops listening to udp packets from detector*/
|
||||||
int stop_receiver();
|
int stop_receiver();
|
||||||
|
|
||||||
/** set status to transmitting and
|
|
||||||
* when fifo is empty later, sets status to run_finished */
|
|
||||||
int start_readout();
|
|
||||||
|
|
||||||
/** Set File path */
|
/** Set File path */
|
||||||
int set_file_dir();
|
int set_file_dir();
|
||||||
|
|
||||||
@ -230,8 +227,8 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
|
|||||||
/* Set the data stream enable */
|
/* Set the data stream enable */
|
||||||
int set_data_stream_enable();
|
int set_data_stream_enable();
|
||||||
|
|
||||||
/** Sets the timer between frames streamed by receiver when frequency is set to 0 */
|
/** Sets the steadming timer when frequency is set to 0 */
|
||||||
int set_read_receiver_timer();
|
int set_streaming_timer();
|
||||||
|
|
||||||
/** enable flipped data */
|
/** enable flipped data */
|
||||||
int set_flipped_data();
|
int set_flipped_data();
|
||||||
@ -289,7 +286,7 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
|
|||||||
detectorType myDetectorType;
|
detectorType myDetectorType;
|
||||||
|
|
||||||
/** slsReceiverBase object */
|
/** slsReceiverBase object */
|
||||||
UDPInterface *receiverBase;
|
slsReceiverImplementation *receiverBase;
|
||||||
|
|
||||||
/** Function List */
|
/** Function List */
|
||||||
int (slsReceiverTCPIPInterface::*flist[NUM_REC_FUNCTIONS])();
|
int (slsReceiverTCPIPInterface::*flist[NUM_REC_FUNCTIONS])();
|
||||||
|
@ -81,6 +81,6 @@ LATEX_HIDE_INDICES = YES
|
|||||||
|
|
||||||
PREDEFINED = __cplusplus
|
PREDEFINED = __cplusplus
|
||||||
|
|
||||||
INPUT = slsReceiver/slsReceiverBase.h
|
INPUT = include/slsReceiverUsers.h
|
||||||
|
|
||||||
OUTPUT_DIRECTORY = slsReceiverUsersDocs
|
OUTPUT_DIRECTORY = slsReceiverUsersDocs
|
||||||
|
@ -1,825 +0,0 @@
|
|||||||
//#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
|
||||||
/********************************************//**
|
|
||||||
* @file UDPBaseImplementation.cpp
|
|
||||||
* @short does all the functions for a receiver, set/get parameters, start/stop etc.
|
|
||||||
***********************************************/
|
|
||||||
|
|
||||||
#include "UDPBaseImplementation.h"
|
|
||||||
|
|
||||||
#include <sys/stat.h> // stat
|
|
||||||
#include <iostream>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
* Constructor & Destructor **********************************************
|
|
||||||
* They access local cache of configuration or detector parameters *******
|
|
||||||
*************************************************************************/
|
|
||||||
UDPBaseImplementation::UDPBaseImplementation(){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
initializeMembers();
|
|
||||||
|
|
||||||
//***callback parameters***
|
|
||||||
startAcquisitionCallBack = NULL;
|
|
||||||
pStartAcquisition = NULL;
|
|
||||||
acquisitionFinishedCallBack = NULL;
|
|
||||||
pAcquisitionFinished = NULL;
|
|
||||||
rawDataReadyCallBack = NULL;
|
|
||||||
rawDataModifyReadyCallBack = NULL;
|
|
||||||
pRawDataReady = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::initializeMembers(){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
FILE_LOG(logDEBUG) << "Info: Initializing base members";
|
|
||||||
//**detector parameters***
|
|
||||||
for (int i = 0; i < MAX_DIMENSIONS; ++i)
|
|
||||||
numDet[i] = 0;
|
|
||||||
detID = 0;
|
|
||||||
myDetectorType = GENERIC;
|
|
||||||
strcpy(detHostname,"");
|
|
||||||
acquisitionPeriod = 0;
|
|
||||||
acquisitionTime = 0;
|
|
||||||
subExpTime = 0;
|
|
||||||
subPeriod = 0;
|
|
||||||
numberOfFrames = 0;
|
|
||||||
numberOfSamples = 0;
|
|
||||||
dynamicRange = 16;
|
|
||||||
tengigaEnable = false;
|
|
||||||
fifoDepth = 0;
|
|
||||||
flippedData[0] = 0;
|
|
||||||
flippedData[1] = 0;
|
|
||||||
gapPixelsEnable = false;
|
|
||||||
|
|
||||||
//***receiver parameters***
|
|
||||||
status = IDLE;
|
|
||||||
activated = true;
|
|
||||||
deactivatedPaddingEnable = true;
|
|
||||||
frameDiscardMode = NO_DISCARD;
|
|
||||||
framePadding = false;
|
|
||||||
|
|
||||||
//***connection parameters***
|
|
||||||
strcpy(eth,"");
|
|
||||||
for(int i=0;i<MAX_NUMBER_OF_LISTENING_THREADS;i++){
|
|
||||||
udpPortNum[i] = DEFAULT_UDP_PORTNO + i;
|
|
||||||
}
|
|
||||||
udpSocketBufferSize = 0;
|
|
||||||
actualUDPSocketBufferSize = 0;
|
|
||||||
|
|
||||||
//***file parameters***
|
|
||||||
fileFormatType = BINARY;
|
|
||||||
strcpy(fileName,"run");
|
|
||||||
strcpy(filePath,"");
|
|
||||||
fileIndex = 0;
|
|
||||||
framesPerFile = 0;
|
|
||||||
scanTag = 0;
|
|
||||||
fileWriteEnable = true;
|
|
||||||
overwriteEnable = true;
|
|
||||||
dataCompressionEnable = false;
|
|
||||||
|
|
||||||
//***acquisition parameters***
|
|
||||||
roi.clear();
|
|
||||||
frameToGuiFrequency = 0;
|
|
||||||
frameToGuiTimerinMS = DEFAULT_STREAMING_TIMER_IN_MS;
|
|
||||||
dataStreamEnable = false;
|
|
||||||
streamingPort = 0;
|
|
||||||
memset(streamingSrcIP, 0, sizeof(streamingSrcIP));
|
|
||||||
memset(additionalJsonHeader, 0, sizeof(additionalJsonHeader));
|
|
||||||
|
|
||||||
//***receiver parameters***
|
|
||||||
silentMode = false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
UDPBaseImplementation::~UDPBaseImplementation(){}
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
* Getters ***************************************************************
|
|
||||||
* They access local cache of configuration or detector parameters *******
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
/**initial parameters***/
|
|
||||||
int* UDPBaseImplementation::getMultiDetectorSize() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return (int*) numDet;
|
|
||||||
}
|
|
||||||
|
|
||||||
int UDPBaseImplementation::getDetectorPositionId() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return detID;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *UDPBaseImplementation::getDetectorHostname() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
//not initialized
|
|
||||||
if(!strlen(detHostname))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
char* output = new char[MAX_STR_LENGTH]();
|
|
||||||
strcpy(output,detHostname);
|
|
||||||
//freed by calling function
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
int UDPBaseImplementation::getFlippedData(int axis) const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
if(axis<0 || axis > 1) return -1;
|
|
||||||
return flippedData[axis];
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UDPBaseImplementation::getGapPixelsEnable() const {
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return gapPixelsEnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***file parameters***/
|
|
||||||
slsReceiverDefs::fileFormat UDPBaseImplementation::getFileFormat() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return fileFormatType;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char *UDPBaseImplementation::getFileName() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
//not initialized
|
|
||||||
if(!strlen(fileName))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
char* output = new char[MAX_STR_LENGTH]();
|
|
||||||
strcpy(output,fileName);
|
|
||||||
//freed by calling function
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *UDPBaseImplementation::getFilePath() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
//not initialized
|
|
||||||
if(!strlen(filePath))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
char* output = new char[MAX_STR_LENGTH]();
|
|
||||||
strcpy(output,filePath);
|
|
||||||
//freed by calling function
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t UDPBaseImplementation::getFileIndex() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return fileIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t UDPBaseImplementation::getFramesPerFile() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return framesPerFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
slsReceiverDefs::frameDiscardPolicy UDPBaseImplementation::getFrameDiscardPolicy() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return frameDiscardMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UDPBaseImplementation::getFramePaddingEnable() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return framePadding;
|
|
||||||
}
|
|
||||||
|
|
||||||
int UDPBaseImplementation::getScanTag() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return scanTag;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UDPBaseImplementation::getFileWriteEnable() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return fileWriteEnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UDPBaseImplementation::getOverwriteEnable() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return overwriteEnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UDPBaseImplementation::getDataCompressionEnable() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return dataCompressionEnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***acquisition count parameters***/
|
|
||||||
uint64_t UDPBaseImplementation::getTotalFramesCaught() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t UDPBaseImplementation::getFramesCaught() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t UDPBaseImplementation::getAcquisitionIndex() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***connection parameters***/
|
|
||||||
uint32_t UDPBaseImplementation::getUDPPortNumber() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return udpPortNum[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t UDPBaseImplementation::getUDPPortNumber2() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return udpPortNum[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
char *UDPBaseImplementation::getEthernetInterface() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
char* output = new char[MAX_STR_LENGTH]();
|
|
||||||
strcpy(output,eth);
|
|
||||||
//freed by calling function
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***acquisition parameters***/
|
|
||||||
std::vector<slsReceiverDefs::ROI> UDPBaseImplementation::getROI() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return roi;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t UDPBaseImplementation::getFrameToGuiFrequency() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return frameToGuiFrequency;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t UDPBaseImplementation::getFrameToGuiTimer() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return frameToGuiTimerinMS;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UDPBaseImplementation::getDataStreamEnable() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return dataStreamEnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t UDPBaseImplementation::getAcquisitionPeriod() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return acquisitionPeriod;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t UDPBaseImplementation::getAcquisitionTime() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return acquisitionTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t UDPBaseImplementation::getSubExpTime() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return subExpTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t UDPBaseImplementation::getSubPeriod() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return subPeriod;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t UDPBaseImplementation::getNumberOfFrames() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return numberOfFrames;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t UDPBaseImplementation::getNumberofSamples() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return numberOfSamples;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t UDPBaseImplementation::getDynamicRange() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return dynamicRange;}
|
|
||||||
|
|
||||||
bool UDPBaseImplementation::getTenGigaEnable() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return tengigaEnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t UDPBaseImplementation::getFifoDepth() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return fifoDepth;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***receiver status***/
|
|
||||||
slsReceiverDefs::runStatus UDPBaseImplementation::getStatus() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return status;}
|
|
||||||
|
|
||||||
bool UDPBaseImplementation::getSilentMode() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return silentMode;}
|
|
||||||
|
|
||||||
bool UDPBaseImplementation::getActivate() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return activated;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UDPBaseImplementation::getDeactivatedPadding() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return deactivatedPaddingEnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t UDPBaseImplementation::getStreamingPort() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return streamingPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *UDPBaseImplementation::getStreamingSourceIP() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
char* output = new char[MAX_STR_LENGTH]();
|
|
||||||
strcpy(output,streamingSrcIP);
|
|
||||||
//freed by calling function
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *UDPBaseImplementation::getAdditionalJsonHeader() const{
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
char* output = new char[MAX_STR_LENGTH]();
|
|
||||||
memset(output, 0, MAX_STR_LENGTH);
|
|
||||||
strcpy(output,additionalJsonHeader);
|
|
||||||
//freed by calling function
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t UDPBaseImplementation::getUDPSocketBufferSize() const {
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return udpSocketBufferSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t UDPBaseImplementation::getActualUDPSocketBufferSize() const {
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
return actualUDPSocketBufferSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
* Setters ***************************************************************
|
|
||||||
* They modify the local cache of configuration or detector parameters ***
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
/**initial parameters***/
|
|
||||||
void UDPBaseImplementation::configure(std::map<std::string, std::string> config_map){
|
|
||||||
FILE_LOG(logERROR) << __AT__ << " doing nothing...";
|
|
||||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::setMultiDetectorSize(const int* size) {
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
char message[100];
|
|
||||||
strcpy(message, "Detector Size: (");
|
|
||||||
for (int i = 0; i < MAX_DIMENSIONS; ++i) {
|
|
||||||
if (myDetectorType == EIGER && (!i))
|
|
||||||
numDet[i] = size[i]*2;
|
|
||||||
else
|
|
||||||
numDet[i] = size[i];
|
|
||||||
sprintf(message,"%s%d",message,numDet[i]);
|
|
||||||
if (i < MAX_DIMENSIONS-1 )
|
|
||||||
strcat(message,",");
|
|
||||||
}
|
|
||||||
strcat(message,")");
|
|
||||||
FILE_LOG(logINFO) << message;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::setFlippedData(int axis, int enable){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
if(axis<0 || axis>1) return;
|
|
||||||
flippedData[axis] = enable==0?0:1;
|
|
||||||
FILE_LOG(logINFO) << "Flipped Data: " << flippedData[0] << " , " << flippedData[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
int UDPBaseImplementation::setGapPixelsEnable(const bool b) {
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
gapPixelsEnable = b;
|
|
||||||
FILE_LOG(logINFO) << "Gap Pixels Enable: " << gapPixelsEnable;
|
|
||||||
|
|
||||||
// overridden
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***file parameters***/
|
|
||||||
void UDPBaseImplementation::setFileFormat(const fileFormat f){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
switch(f){
|
|
||||||
#ifdef HDF5C
|
|
||||||
case HDF5:
|
|
||||||
fileFormatType = HDF5;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
|
||||||
fileFormatType = BINARY;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
FILE_LOG(logINFO) << "File Format: " << getFileFormatType(fileFormatType);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UDPBaseImplementation::setFileName(const char c[]){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
if(strlen(c))
|
|
||||||
strcpy(fileName, c);
|
|
||||||
FILE_LOG(logINFO) << "File name: " << fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::setFilePath(const char c[]){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
|
|
||||||
if(strlen(c)){
|
|
||||||
//check if filepath exists
|
|
||||||
struct stat st;
|
|
||||||
if(stat(c,&st) == 0)
|
|
||||||
strcpy(filePath,c);
|
|
||||||
else
|
|
||||||
FILE_LOG(logERROR) << "FilePath does not exist: " << filePath;
|
|
||||||
}
|
|
||||||
FILE_LOG(logINFO) << "File path: " << filePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::setFileIndex(const uint64_t i){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
fileIndex = i;
|
|
||||||
FILE_LOG(logINFO) << "File Index: " << fileIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::setFramesPerFile(const uint32_t i){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
framesPerFile = i;
|
|
||||||
FILE_LOG(logINFO) << "Frames per file: " << framesPerFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::setFrameDiscardPolicy(const frameDiscardPolicy i){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
if (i >= 0 && i < NUM_DISCARD_POLICIES)
|
|
||||||
frameDiscardMode = i;
|
|
||||||
|
|
||||||
FILE_LOG(logINFO) << "Frame Discard Policy: " << getFrameDiscardPolicyType(frameDiscardMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::setFramePaddingEnable(const bool i){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
framePadding = i;
|
|
||||||
FILE_LOG(logINFO) << "Frame Padding: " << framePadding;
|
|
||||||
}
|
|
||||||
|
|
||||||
//FIXME: needed?
|
|
||||||
void UDPBaseImplementation::setScanTag(const int i){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
scanTag = i;
|
|
||||||
FILE_LOG(logINFO) << "Scan Tag: " << scanTag;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::setFileWriteEnable(const bool b){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
fileWriteEnable = b;
|
|
||||||
FILE_LOG(logINFO) << "File Write Enable: " << stringEnable(fileWriteEnable);
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::setOverwriteEnable(const bool b){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
overwriteEnable = b;
|
|
||||||
FILE_LOG(logINFO) << "Overwrite Enable: " << stringEnable(overwriteEnable);
|
|
||||||
}
|
|
||||||
|
|
||||||
int UDPBaseImplementation::setDataCompressionEnable(const bool b){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
dataCompressionEnable = b;
|
|
||||||
FILE_LOG(logINFO) << "Data Compression : " << stringEnable(dataCompressionEnable);
|
|
||||||
|
|
||||||
//overridden methods might return FAIL
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***connection parameters***/
|
|
||||||
void UDPBaseImplementation::setUDPPortNumber(const uint32_t i){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
udpPortNum[0] = i;
|
|
||||||
FILE_LOG(logINFO) << "UDP Port Number[0]: " << udpPortNum[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::setUDPPortNumber2(const uint32_t i){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
udpPortNum[1] = i;
|
|
||||||
FILE_LOG(logINFO) << "UDP Port Number[1]: " << udpPortNum[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::setEthernetInterface(const char* c){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
strcpy(eth, c);
|
|
||||||
FILE_LOG(logINFO) << "Ethernet Interface: " << eth;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***acquisition parameters***/
|
|
||||||
int UDPBaseImplementation::setROI(const std::vector<slsReceiverDefs::ROI> i){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
roi = i;
|
|
||||||
|
|
||||||
std::stringstream sstm;
|
|
||||||
sstm << "ROI: ";
|
|
||||||
if (!roi.size())
|
|
||||||
sstm << "0";
|
|
||||||
else {
|
|
||||||
for (unsigned int i = 0; i < roi.size(); ++i) {
|
|
||||||
sstm << "( " <<
|
|
||||||
roi[i].xmin << ", " <<
|
|
||||||
roi[i].xmax << ", " <<
|
|
||||||
roi[i].ymin << ", " <<
|
|
||||||
roi[i].ymax << " )";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
std::string message = sstm.str();
|
|
||||||
FILE_LOG(logINFO) << message;
|
|
||||||
|
|
||||||
//overrridden child classes might return FAIL
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int UDPBaseImplementation::setFrameToGuiFrequency(const uint32_t freq){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
frameToGuiFrequency = freq;
|
|
||||||
FILE_LOG(logINFO) << "Frame To Gui Frequency: " << frameToGuiFrequency;
|
|
||||||
|
|
||||||
//overrridden child classes might return FAIL
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::setFrameToGuiTimer(const uint32_t time_in_ms){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
frameToGuiTimerinMS = time_in_ms;
|
|
||||||
FILE_LOG(logINFO) << "Frame To Gui Timer: " << frameToGuiTimerinMS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int UDPBaseImplementation::setDataStreamEnable(const bool enable){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
dataStreamEnable = enable;
|
|
||||||
FILE_LOG(logINFO) << "Streaming Data from Receiver: " << dataStreamEnable;
|
|
||||||
|
|
||||||
//overrridden child classes might return FAIL
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int UDPBaseImplementation::setAcquisitionPeriod(const uint64_t i){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
acquisitionPeriod = i;
|
|
||||||
FILE_LOG(logINFO) << "Acquisition Period: " << (double)acquisitionPeriod/(1E9) << "s";
|
|
||||||
|
|
||||||
//overrridden child classes might return FAIL
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int UDPBaseImplementation::setAcquisitionTime(const uint64_t i){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
acquisitionTime = i;
|
|
||||||
FILE_LOG(logINFO) << "Acquisition Time: " << (double)acquisitionTime/(1E9) << "s";
|
|
||||||
|
|
||||||
//overrridden child classes might return FAIL
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::setSubExpTime(const uint64_t i){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
subExpTime = i;
|
|
||||||
FILE_LOG(logINFO) << "Sub Exposure Time: " << (double)subExpTime/(1E9) << "s";
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::setSubPeriod(const uint64_t i){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
subPeriod = i;
|
|
||||||
FILE_LOG(logINFO) << "Sub Exposure Time: " << (double)subPeriod/(1E9) << "s";
|
|
||||||
}
|
|
||||||
|
|
||||||
int UDPBaseImplementation::setNumberOfFrames(const uint64_t i){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
numberOfFrames = i;
|
|
||||||
FILE_LOG(logINFO) << "Number of Frames: " << numberOfFrames;
|
|
||||||
|
|
||||||
//overrridden child classes might return FAIL
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int UDPBaseImplementation::setNumberofSamples(const uint64_t i){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
numberOfSamples = i;
|
|
||||||
FILE_LOG(logINFO) << "Number of Samples: " << numberOfSamples;
|
|
||||||
|
|
||||||
//overrridden child classes might return FAIL
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int UDPBaseImplementation::setDynamicRange(const uint32_t i){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
dynamicRange = i;
|
|
||||||
FILE_LOG(logINFO) << "Dynamic Range: " << dynamicRange;
|
|
||||||
|
|
||||||
//overrridden child classes might return FAIL
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int UDPBaseImplementation::setTenGigaEnable(const bool b){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
tengigaEnable = b;
|
|
||||||
FILE_LOG(logINFO) << "Ten Giga Enable: " << stringEnable(tengigaEnable);
|
|
||||||
|
|
||||||
//overridden functions might return FAIL
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int UDPBaseImplementation::setFifoDepth(const uint32_t i){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
fifoDepth = i;
|
|
||||||
FILE_LOG(logINFO) << "Fifo Depth: " << i;
|
|
||||||
|
|
||||||
//overridden functions might return FAIL
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***receiver parameters***/
|
|
||||||
void UDPBaseImplementation::setSilentMode(const bool i){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
silentMode = i;
|
|
||||||
FILE_LOG(logINFO) << "Silent Mode: " << i;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
* Behavioral functions***************************************************
|
|
||||||
* They may modify the status of the receiver ****************************
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
/***initial functions***/
|
|
||||||
int UDPBaseImplementation::setDetectorType(const detectorType d){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
myDetectorType = d;
|
|
||||||
//if eiger, set numberofListeningThreads = 2;
|
|
||||||
FILE_LOG(logINFO) << "Detector Type: " << getDetectorType(d);
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::setDetectorPositionId(const int i){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
detID = i;
|
|
||||||
FILE_LOG(logINFO) << "Detector Position Id: " << detID;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::initialize(const char *c){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
if(strlen(c))
|
|
||||||
strcpy(detHostname, c);
|
|
||||||
FILE_LOG(logINFO) << "Detector Hostname: " << detHostname;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***acquisition functions***/
|
|
||||||
void UDPBaseImplementation::resetAcquisitionCount(){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
//overriden by resetting of new acquisition parameters
|
|
||||||
}
|
|
||||||
|
|
||||||
int UDPBaseImplementation::startReceiver(char *c){
|
|
||||||
FILE_LOG(logERROR) << __AT__ << " doing nothing...";
|
|
||||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::stopReceiver(){
|
|
||||||
FILE_LOG(logERROR) << __AT__ << " doing nothing...";
|
|
||||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::startReadout(){
|
|
||||||
FILE_LOG(logERROR) << __AT__ << " doing nothing...";
|
|
||||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::shutDownUDPSockets(){
|
|
||||||
FILE_LOG(logERROR) << __AT__ << " doing nothing...";
|
|
||||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//FIXME: needed, isnt stopReceiver enough?
|
|
||||||
void UDPBaseImplementation::abort(){
|
|
||||||
FILE_LOG(logERROR) << __AT__ << " doing nothing...";
|
|
||||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool UDPBaseImplementation::setActivate(bool enable){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
activated = enable;
|
|
||||||
FILE_LOG(logINFO) << "Activation: " << stringEnable(activated);
|
|
||||||
return activated;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UDPBaseImplementation::setDeactivatedPadding(bool enable){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
deactivatedPaddingEnable = enable;
|
|
||||||
FILE_LOG(logINFO) << "Deactivated Padding Enable: " << stringEnable(deactivatedPaddingEnable);
|
|
||||||
return deactivatedPaddingEnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::setStreamingPort(const uint32_t i) {
|
|
||||||
streamingPort = i;
|
|
||||||
|
|
||||||
FILE_LOG(logINFO) << "Streaming Port: " << streamingPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::setStreamingSourceIP(const char c[]){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
strcpy(streamingSrcIP, c);
|
|
||||||
FILE_LOG(logINFO) << "Streaming Source IP: " << streamingSrcIP;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::setAdditionalJsonHeader(const char c[]){
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
strcpy(additionalJsonHeader, c);
|
|
||||||
FILE_LOG(logINFO) << "Additional JSON Header: " << additionalJsonHeader;
|
|
||||||
}
|
|
||||||
|
|
||||||
int UDPBaseImplementation::setUDPSocketBufferSize(const uint32_t s) {
|
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
udpSocketBufferSize = s;
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int UDPBaseImplementation::restreamStop() {
|
|
||||||
FILE_LOG(logERROR) << __AT__ << " doing nothing...";
|
|
||||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***callback functions***/
|
|
||||||
void UDPBaseImplementation::registerCallBackStartAcquisition(int (*func)(char*, char*, uint64_t, uint32_t, void*),void *arg){
|
|
||||||
startAcquisitionCallBack=func;
|
|
||||||
pStartAcquisition=arg;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::registerCallBackAcquisitionFinished(void (*func)(uint64_t, void*),void *arg){
|
|
||||||
acquisitionFinishedCallBack=func;
|
|
||||||
pAcquisitionFinished=arg;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::registerCallBackRawDataReady(void (*func)(char* ,
|
|
||||||
char*, uint32_t, void*),void *arg){
|
|
||||||
rawDataReadyCallBack=func;
|
|
||||||
pRawDataReady=arg;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDPBaseImplementation::registerCallBackRawDataModifyReady(void (*func)(char* ,
|
|
||||||
char*, uint32_t&, void*),void *arg){
|
|
||||||
rawDataModifyReadyCallBack=func;
|
|
||||||
pRawDataReady=arg;
|
|
||||||
}
|
|
||||||
//#endif
|
|
@ -1,30 +0,0 @@
|
|||||||
//#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
|
||||||
/********************************************//**
|
|
||||||
* @file slsReceiverUDPFunctions.cpp
|
|
||||||
* @short does all the functions for a receiver, set/get parameters, start/stop etc.
|
|
||||||
***********************************************/
|
|
||||||
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
|
|
||||||
#include "UDPInterface.h"
|
|
||||||
#include "UDPBaseImplementation.h"
|
|
||||||
#include "UDPStandardImplementation.h"
|
|
||||||
|
|
||||||
|
|
||||||
UDPInterface * UDPInterface::create(std::string receiver_type){
|
|
||||||
|
|
||||||
if (receiver_type == "standard"){
|
|
||||||
FILE_LOG(logINFO) << "Starting " << receiver_type;
|
|
||||||
return new UDPStandardImplementation();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
FILE_LOG(logERROR) << "UDP interface not supported, using base implementation";
|
|
||||||
return new UDPBaseImplementation();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//#endif
|
|
@ -11,11 +11,12 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
||||||
|
|
||||||
#include "slsReceiver.h"
|
#include "slsReceiver.h"
|
||||||
|
#include "slsReceiverTCPIPInterface.h"
|
||||||
#include "gitInfoReceiver.h"
|
#include "gitInfoReceiver.h"
|
||||||
|
#include "logger.h"
|
||||||
|
#include "utilities.h"
|
||||||
|
|
||||||
|
|
||||||
slsReceiver::slsReceiver(int argc, char *argv[]):
|
slsReceiver::slsReceiver(int argc, char *argv[]):
|
||||||
tcpipInterface (0) {
|
tcpipInterface (0) {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/********************************************//**
|
/********************************************//**
|
||||||
* @file UDPStandardImplementation.cpp
|
* @file slsReceiverImplementation.cpp
|
||||||
* @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.
|
||||||
***********************************************/
|
***********************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "UDPStandardImplementation.h"
|
#include "slsReceiverImplementation.h"
|
||||||
#include "GeneralData.h"
|
#include "GeneralData.h"
|
||||||
#include "Listener.h"
|
#include "Listener.h"
|
||||||
#include "DataProcessor.h"
|
#include "DataProcessor.h"
|
||||||
@ -12,6 +12,9 @@
|
|||||||
#include "Fifo.h"
|
#include "Fifo.h"
|
||||||
#include "ZmqSocket.h" //just for the zmq port define
|
#include "ZmqSocket.h" //just for the zmq port define
|
||||||
|
|
||||||
|
#include <sys/stat.h> // stat
|
||||||
|
#include <iostream>
|
||||||
|
#include <string.h>
|
||||||
#include <cstdlib> //system
|
#include <cstdlib> //system
|
||||||
#include <cstring> //strcpy
|
#include <cstring> //strcpy
|
||||||
#include <errno.h> //eperm
|
#include <errno.h> //eperm
|
||||||
@ -20,51 +23,218 @@
|
|||||||
|
|
||||||
/** cosntructor & destructor */
|
/** cosntructor & destructor */
|
||||||
|
|
||||||
UDPStandardImplementation::UDPStandardImplementation() {
|
slsReceiverImplementation::slsReceiverImplementation() {
|
||||||
InitializeMembers();
|
InitializeMembers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UDPStandardImplementation::~UDPStandardImplementation() {
|
slsReceiverImplementation::~slsReceiverImplementation() {
|
||||||
DeleteMembers();
|
DeleteMembers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UDPStandardImplementation::DeleteMembers() {
|
void slsReceiverImplementation::DeleteMembers() {
|
||||||
if (generalData) { delete generalData; generalData=0;}
|
if (generalData) {
|
||||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
delete generalData;
|
||||||
delete(*it);
|
generalData=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto* it : listener)
|
||||||
|
delete it;
|
||||||
listener.clear();
|
listener.clear();
|
||||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
|
||||||
delete(*it);
|
for (auto* it : dataProcessor)
|
||||||
|
delete it;
|
||||||
dataProcessor.clear();
|
dataProcessor.clear();
|
||||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
|
||||||
delete(*it);
|
for (auto* it : dataStreamer)
|
||||||
|
delete it;
|
||||||
dataStreamer.clear();
|
dataStreamer.clear();
|
||||||
for (std::vector<Fifo*>::const_iterator it = fifo.begin(); it != fifo.end(); ++it)
|
|
||||||
delete(*it);
|
for (auto* it : fifo)
|
||||||
|
delete it;
|
||||||
fifo.clear();
|
fifo.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UDPStandardImplementation::InitializeMembers() {
|
void slsReceiverImplementation::InitializeMembers() {
|
||||||
UDPBaseImplementation::initializeMembers();
|
|
||||||
|
//**detector parameters***
|
||||||
|
myDetectorType = GENERIC;
|
||||||
|
for (int i = 0; i < MAX_DIMENSIONS; ++i)
|
||||||
|
numDet[i] = 0;
|
||||||
|
detID = 0;
|
||||||
|
strcpy(detHostname,"");
|
||||||
acquisitionPeriod = SAMPLE_TIME_IN_NS;
|
acquisitionPeriod = SAMPLE_TIME_IN_NS;
|
||||||
|
acquisitionTime = 0;
|
||||||
|
subExpTime = 0;
|
||||||
|
subPeriod = 0;
|
||||||
|
numberOfFrames = 0;
|
||||||
|
numberOfSamples = 0;
|
||||||
|
dynamicRange = 16;
|
||||||
|
tengigaEnable = false;
|
||||||
|
fifoDepth = 0;
|
||||||
|
flippedData[0] = 0;
|
||||||
|
flippedData[1] = 0;
|
||||||
|
gapPixelsEnable = false;
|
||||||
|
|
||||||
//*** receiver parameters ***
|
//*** receiver parameters ***
|
||||||
numThreads = 1;
|
numThreads = 1;
|
||||||
numberofJobs = 1;
|
numberofJobs = 1;
|
||||||
nroichannels = 0;
|
nroichannels = 0;
|
||||||
|
status = IDLE;
|
||||||
|
activated = true;
|
||||||
|
deactivatedPaddingEnable = true;
|
||||||
|
frameDiscardMode = NO_DISCARD;
|
||||||
|
framePadding = false;
|
||||||
|
silentMode = false;
|
||||||
|
|
||||||
|
//***connection parameters***
|
||||||
|
strcpy(eth,"");
|
||||||
|
for(int i=0;i<MAX_NUMBER_OF_LISTENING_THREADS;i++){
|
||||||
|
udpPortNum[i] = DEFAULT_UDP_PORTNO + i;
|
||||||
|
}
|
||||||
|
udpSocketBufferSize = 0;
|
||||||
|
actualUDPSocketBufferSize = 0;
|
||||||
|
|
||||||
|
//***file parameters***
|
||||||
|
fileFormatType = BINARY;
|
||||||
|
strcpy(fileName,"run");
|
||||||
|
strcpy(filePath,"");
|
||||||
|
fileIndex = 0;
|
||||||
|
framesPerFile = 0;
|
||||||
|
fileWriteEnable = true;
|
||||||
|
overwriteEnable = true;
|
||||||
|
|
||||||
|
//***acquisition parameters***
|
||||||
|
roi.clear();
|
||||||
|
streamingFrequency = 0;
|
||||||
|
streamingTimerInMs = DEFAULT_STREAMING_TIMER_IN_MS;
|
||||||
|
dataStreamEnable = false;
|
||||||
|
streamingPort = 0;
|
||||||
|
memset(streamingSrcIP, 0, sizeof(streamingSrcIP));
|
||||||
|
memset(additionalJsonHeader, 0, sizeof(additionalJsonHeader));
|
||||||
|
|
||||||
//** class objects ***
|
//** class objects ***
|
||||||
generalData = 0;
|
generalData = 0;
|
||||||
|
|
||||||
|
//***callback parameters***
|
||||||
|
startAcquisitionCallBack = NULL;
|
||||||
|
pStartAcquisition = NULL;
|
||||||
|
acquisitionFinishedCallBack = NULL;
|
||||||
|
pAcquisitionFinished = NULL;
|
||||||
|
rawDataReadyCallBack = NULL;
|
||||||
|
rawDataModifyReadyCallBack = NULL;
|
||||||
|
pRawDataReady = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
* Getters ***************************************************************
|
||||||
|
* They access local cache of configuration or detector parameters *******
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
/**initial parameters***/
|
||||||
|
int* slsReceiverImplementation::getMultiDetectorSize() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return (int*) numDet;
|
||||||
|
}
|
||||||
|
|
||||||
|
int slsReceiverImplementation::getDetectorPositionId() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return detID;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *slsReceiverImplementation::getDetectorHostname() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
//not initialized
|
||||||
|
if(!strlen(detHostname))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
char* output = new char[MAX_STR_LENGTH]();
|
||||||
|
strcpy(output,detHostname);
|
||||||
|
//freed by calling function
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
int slsReceiverImplementation::getFlippedData(int axis) const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
if(axis<0 || axis > 1) return -1;
|
||||||
|
return flippedData[axis];
|
||||||
|
}
|
||||||
|
|
||||||
|
bool slsReceiverImplementation::getGapPixelsEnable() const {
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return gapPixelsEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***file parameters***/
|
||||||
|
slsReceiverDefs::fileFormat slsReceiverImplementation::getFileFormat() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return fileFormatType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char *slsReceiverImplementation::getFileName() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
/*** Overloaded Functions called by TCP Interface ***/
|
//not initialized
|
||||||
|
if(!strlen(fileName))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
uint64_t UDPStandardImplementation::getTotalFramesCaught() const {
|
char* output = new char[MAX_STR_LENGTH]();
|
||||||
|
strcpy(output,fileName);
|
||||||
|
//freed by calling function
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *slsReceiverImplementation::getFilePath() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
//not initialized
|
||||||
|
if(!strlen(filePath))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
char* output = new char[MAX_STR_LENGTH]();
|
||||||
|
strcpy(output,filePath);
|
||||||
|
//freed by calling function
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t slsReceiverImplementation::getFileIndex() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return fileIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t slsReceiverImplementation::getFramesPerFile() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return framesPerFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
slsReceiverDefs::frameDiscardPolicy slsReceiverImplementation::getFrameDiscardPolicy() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return frameDiscardMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool slsReceiverImplementation::getFramePaddingEnable() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return framePadding;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool slsReceiverImplementation::getFileWriteEnable() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return fileWriteEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool slsReceiverImplementation::getOverwriteEnable() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return overwriteEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***acquisition count parameters***/
|
||||||
|
uint64_t slsReceiverImplementation::getTotalFramesCaught() const {
|
||||||
uint64_t sum = 0;
|
uint64_t sum = 0;
|
||||||
uint32_t flagsum = 0;
|
uint32_t flagsum = 0;
|
||||||
|
|
||||||
@ -80,7 +250,7 @@ uint64_t UDPStandardImplementation::getTotalFramesCaught() const {
|
|||||||
return (sum/dataProcessor.size());
|
return (sum/dataProcessor.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t UDPStandardImplementation::getFramesCaught() const {
|
uint64_t slsReceiverImplementation::getFramesCaught() const {
|
||||||
uint64_t sum = 0;
|
uint64_t sum = 0;
|
||||||
uint32_t flagsum = 0;
|
uint32_t flagsum = 0;
|
||||||
|
|
||||||
@ -95,7 +265,7 @@ uint64_t UDPStandardImplementation::getFramesCaught() const {
|
|||||||
return (sum/dataProcessor.size());
|
return (sum/dataProcessor.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t UDPStandardImplementation::getAcquisitionIndex() const {
|
int64_t slsReceiverImplementation::getAcquisitionIndex() const {
|
||||||
uint64_t sum = 0;
|
uint64_t sum = 0;
|
||||||
uint32_t flagsum = 0;
|
uint32_t flagsum = 0;
|
||||||
|
|
||||||
@ -112,7 +282,190 @@ int64_t UDPStandardImplementation::getAcquisitionIndex() const {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int UDPStandardImplementation::setGapPixelsEnable(const bool b) {
|
|
||||||
|
/***connection parameters***/
|
||||||
|
uint32_t slsReceiverImplementation::getUDPPortNumber() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return udpPortNum[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t slsReceiverImplementation::getUDPPortNumber2() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return udpPortNum[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
char *slsReceiverImplementation::getEthernetInterface() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
char* output = new char[MAX_STR_LENGTH]();
|
||||||
|
strcpy(output,eth);
|
||||||
|
//freed by calling function
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***acquisition parameters***/
|
||||||
|
std::vector<slsReceiverDefs::ROI> slsReceiverImplementation::getROI() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return roi;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t slsReceiverImplementation::getStreamingFrequency() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return streamingFrequency;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t slsReceiverImplementation::getStreamingTimer() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return streamingTimerInMs;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool slsReceiverImplementation::getDataStreamEnable() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return dataStreamEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t slsReceiverImplementation::getAcquisitionPeriod() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return acquisitionPeriod;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t slsReceiverImplementation::getAcquisitionTime() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return acquisitionTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t slsReceiverImplementation::getSubExpTime() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return subExpTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t slsReceiverImplementation::getSubPeriod() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return subPeriod;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t slsReceiverImplementation::getNumberOfFrames() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return numberOfFrames;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t slsReceiverImplementation::getNumberofSamples() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return numberOfSamples;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t slsReceiverImplementation::getDynamicRange() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return dynamicRange;}
|
||||||
|
|
||||||
|
bool slsReceiverImplementation::getTenGigaEnable() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return tengigaEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t slsReceiverImplementation::getFifoDepth() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return fifoDepth;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***receiver status***/
|
||||||
|
slsReceiverDefs::runStatus slsReceiverImplementation::getStatus() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return status;}
|
||||||
|
|
||||||
|
bool slsReceiverImplementation::getSilentMode() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return silentMode;}
|
||||||
|
|
||||||
|
bool slsReceiverImplementation::getActivate() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return activated;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool slsReceiverImplementation::getDeactivatedPadding() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return deactivatedPaddingEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t slsReceiverImplementation::getStreamingPort() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return streamingPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *slsReceiverImplementation::getStreamingSourceIP() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
char* output = new char[MAX_STR_LENGTH]();
|
||||||
|
strcpy(output,streamingSrcIP);
|
||||||
|
//freed by calling function
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *slsReceiverImplementation::getAdditionalJsonHeader() const{
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
char* output = new char[MAX_STR_LENGTH]();
|
||||||
|
memset(output, 0, MAX_STR_LENGTH);
|
||||||
|
strcpy(output,additionalJsonHeader);
|
||||||
|
//freed by calling function
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t slsReceiverImplementation::getUDPSocketBufferSize() const {
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return udpSocketBufferSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t slsReceiverImplementation::getActualUDPSocketBufferSize() const {
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return actualUDPSocketBufferSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
* Setters ***************************************************************
|
||||||
|
* They modify the local cache of configuration or detector parameters ***
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
/**initial parameters***/
|
||||||
|
|
||||||
|
void slsReceiverImplementation::setDetectorHostname(const char *c){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
if(strlen(c))
|
||||||
|
strcpy(detHostname, c);
|
||||||
|
FILE_LOG(logINFO) << "Detector Hostname: " << detHostname;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsReceiverImplementation::setMultiDetectorSize(const int* size) {
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
char message[100];
|
||||||
|
strcpy(message, "Detector Size: (");
|
||||||
|
for (int i = 0; i < MAX_DIMENSIONS; ++i) {
|
||||||
|
if (myDetectorType == EIGER && (!i))
|
||||||
|
numDet[i] = size[i]*2;
|
||||||
|
else
|
||||||
|
numDet[i] = size[i];
|
||||||
|
sprintf(message,"%s%d",message,numDet[i]);
|
||||||
|
if (i < MAX_DIMENSIONS-1 )
|
||||||
|
strcat(message,",");
|
||||||
|
}
|
||||||
|
strcat(message,")");
|
||||||
|
FILE_LOG(logINFO) << message;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsReceiverImplementation::setFlippedData(int axis, int enable){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
if(axis<0 || axis>1) return;
|
||||||
|
flippedData[axis] = enable==0?0:1;
|
||||||
|
FILE_LOG(logINFO) << "Flipped Data: " << flippedData[0] << " , " << flippedData[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int slsReceiverImplementation::setGapPixelsEnable(const bool b) {
|
||||||
if (gapPixelsEnable != b) {
|
if (gapPixelsEnable != b) {
|
||||||
gapPixelsEnable = b;
|
gapPixelsEnable = b;
|
||||||
|
|
||||||
@ -131,7 +484,7 @@ int UDPStandardImplementation::setGapPixelsEnable(const bool b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UDPStandardImplementation::setFileFormat(const fileFormat f){
|
void slsReceiverImplementation::setFileFormat(const fileFormat f){
|
||||||
switch(f){
|
switch(f){
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
case HDF5:
|
case HDF5:
|
||||||
@ -150,7 +503,66 @@ void UDPStandardImplementation::setFileFormat(const fileFormat f){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UDPStandardImplementation::setFileWriteEnable(const bool b){
|
void slsReceiverImplementation::setFileName(const char c[]){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
if(strlen(c))
|
||||||
|
strcpy(fileName, c);
|
||||||
|
FILE_LOG(logINFO) << "File name: " << fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsReceiverImplementation::setFilePath(const char c[]){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
|
||||||
|
if(strlen(c)){
|
||||||
|
//check if filepath exists
|
||||||
|
struct stat st;
|
||||||
|
if(stat(c,&st) == 0)
|
||||||
|
strcpy(filePath,c);
|
||||||
|
else
|
||||||
|
FILE_LOG(logERROR) << "FilePath does not exist: " << filePath;
|
||||||
|
}
|
||||||
|
FILE_LOG(logINFO) << "File path: " << filePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsReceiverImplementation::setFileIndex(const uint64_t i){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
fileIndex = i;
|
||||||
|
FILE_LOG(logINFO) << "File Index: " << fileIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsReceiverImplementation::setFramesPerFile(const uint32_t i){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
framesPerFile = i;
|
||||||
|
FILE_LOG(logINFO) << "Frames per file: " << framesPerFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsReceiverImplementation::setFrameDiscardPolicy(const frameDiscardPolicy i){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
if (i >= 0 && i < NUM_DISCARD_POLICIES)
|
||||||
|
frameDiscardMode = i;
|
||||||
|
|
||||||
|
FILE_LOG(logINFO) << "Frame Discard Policy: " << getFrameDiscardPolicyType(frameDiscardMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsReceiverImplementation::setFramePaddingEnable(const bool i){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
framePadding = i;
|
||||||
|
FILE_LOG(logINFO) << "Frame Padding: " << framePadding;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsReceiverImplementation::setFileWriteEnable(const bool b){
|
||||||
if (fileWriteEnable != b){
|
if (fileWriteEnable != b){
|
||||||
fileWriteEnable = b;
|
fileWriteEnable = b;
|
||||||
for (unsigned int i = 0; i < dataProcessor.size(); ++i) {
|
for (unsigned int i = 0; i < dataProcessor.size(); ++i) {
|
||||||
@ -165,9 +577,45 @@ void UDPStandardImplementation::setFileWriteEnable(const bool b){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsReceiverImplementation::setOverwriteEnable(const bool b){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
overwriteEnable = b;
|
||||||
|
FILE_LOG(logINFO) << "Overwrite Enable: " << stringEnable(overwriteEnable);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int UDPStandardImplementation::setROI(const std::vector<slsReceiverDefs::ROI> i) {
|
/***connection parameters***/
|
||||||
|
void slsReceiverImplementation::setUDPPortNumber(const uint32_t i){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
udpPortNum[0] = i;
|
||||||
|
FILE_LOG(logINFO) << "UDP Port Number[0]: " << udpPortNum[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
void slsReceiverImplementation::setUDPPortNumber2(const uint32_t i){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
udpPortNum[1] = i;
|
||||||
|
FILE_LOG(logINFO) << "UDP Port Number[1]: " << udpPortNum[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
void slsReceiverImplementation::setEthernetInterface(const char* c){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
strcpy(eth, c);
|
||||||
|
FILE_LOG(logINFO) << "Ethernet Interface: " << eth;
|
||||||
|
}
|
||||||
|
|
||||||
|
int slsReceiverImplementation::setUDPSocketBufferSize(const uint32_t s) {
|
||||||
|
if (listener.size())
|
||||||
|
return listener[0]->CreateDummySocketForUDPSocketBufferSize(s);
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***acquisition parameters***/
|
||||||
|
int slsReceiverImplementation::setROI(const std::vector<slsReceiverDefs::ROI> i) {
|
||||||
if (myDetectorType != GOTTHARD) {
|
if (myDetectorType != GOTTHARD) {
|
||||||
cprintf(RED, "Error: Can not set ROI for this detector\n");
|
cprintf(RED, "Error: Can not set ROI for this detector\n");
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@ -229,16 +677,23 @@ int UDPStandardImplementation::setROI(const std::vector<slsReceiverDefs::ROI> i)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int UDPStandardImplementation::setFrameToGuiFrequency(const uint32_t freq) {
|
int slsReceiverImplementation::setStreamingFrequency(const uint32_t freq) {
|
||||||
if (frameToGuiFrequency != freq) {
|
if (streamingFrequency != freq) {
|
||||||
frameToGuiFrequency = freq;
|
streamingFrequency = freq;
|
||||||
}
|
}
|
||||||
FILE_LOG(logINFO) << "Frame to Gui Frequency: " << frameToGuiFrequency;
|
FILE_LOG(logINFO) << "Streaming Frequency: " << streamingFrequency;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void slsReceiverImplementation::setStreamingTimer(const uint32_t time_in_ms){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
int UDPStandardImplementation::setDataStreamEnable(const bool enable) {
|
streamingTimerInMs = time_in_ms;
|
||||||
|
FILE_LOG(logINFO) << "Streamer Timer: " << streamingTimerInMs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int slsReceiverImplementation::setDataStreamEnable(const bool enable) {
|
||||||
|
|
||||||
if (dataStreamEnable != enable) {
|
if (dataStreamEnable != enable) {
|
||||||
dataStreamEnable = enable;
|
dataStreamEnable = enable;
|
||||||
@ -273,8 +728,73 @@ int UDPStandardImplementation::setDataStreamEnable(const bool enable) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsReceiverImplementation::setStreamingPort(const uint32_t i) {
|
||||||
|
streamingPort = i;
|
||||||
|
|
||||||
int UDPStandardImplementation::setNumberofSamples(const uint64_t i) {
|
FILE_LOG(logINFO) << "Streaming Port: " << streamingPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsReceiverImplementation::setStreamingSourceIP(const char c[]){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
strcpy(streamingSrcIP, c);
|
||||||
|
FILE_LOG(logINFO) << "Streaming Source IP: " << streamingSrcIP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsReceiverImplementation::setAdditionalJsonHeader(const char c[]){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
strcpy(additionalJsonHeader, c);
|
||||||
|
FILE_LOG(logINFO) << "Additional JSON Header: " << additionalJsonHeader;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int slsReceiverImplementation::setAcquisitionPeriod(const uint64_t i){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
acquisitionPeriod = i;
|
||||||
|
FILE_LOG(logINFO) << "Acquisition Period: " << (double)acquisitionPeriod/(1E9) << "s";
|
||||||
|
|
||||||
|
//overrridden child classes might return FAIL
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int slsReceiverImplementation::setAcquisitionTime(const uint64_t i){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
acquisitionTime = i;
|
||||||
|
FILE_LOG(logINFO) << "Acquisition Time: " << (double)acquisitionTime/(1E9) << "s";
|
||||||
|
|
||||||
|
//overrridden child classes might return FAIL
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void slsReceiverImplementation::setSubExpTime(const uint64_t i){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
subExpTime = i;
|
||||||
|
FILE_LOG(logINFO) << "Sub Exposure Time: " << (double)subExpTime/(1E9) << "s";
|
||||||
|
}
|
||||||
|
|
||||||
|
void slsReceiverImplementation::setSubPeriod(const uint64_t i){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
subPeriod = i;
|
||||||
|
FILE_LOG(logINFO) << "Sub Exposure Time: " << (double)subPeriod/(1E9) << "s";
|
||||||
|
}
|
||||||
|
|
||||||
|
int slsReceiverImplementation::setNumberOfFrames(const uint64_t i){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
numberOfFrames = i;
|
||||||
|
FILE_LOG(logINFO) << "Number of Frames: " << numberOfFrames;
|
||||||
|
|
||||||
|
//overrridden child classes might return FAIL
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int slsReceiverImplementation::setNumberofSamples(const uint64_t i) {
|
||||||
if (numberOfSamples != i) {
|
if (numberOfSamples != i) {
|
||||||
numberOfSamples = i;
|
numberOfSamples = i;
|
||||||
|
|
||||||
@ -289,7 +809,7 @@ int UDPStandardImplementation::setNumberofSamples(const uint64_t i) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int UDPStandardImplementation::setDynamicRange(const uint32_t i) {
|
int slsReceiverImplementation::setDynamicRange(const uint32_t i) {
|
||||||
if (dynamicRange != i) {
|
if (dynamicRange != i) {
|
||||||
dynamicRange = i;
|
dynamicRange = i;
|
||||||
|
|
||||||
@ -309,7 +829,7 @@ int UDPStandardImplementation::setDynamicRange(const uint32_t i) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int UDPStandardImplementation::setTenGigaEnable(const bool b) {
|
int slsReceiverImplementation::setTenGigaEnable(const bool b) {
|
||||||
if (tengigaEnable != b) {
|
if (tengigaEnable != b) {
|
||||||
tengigaEnable = b;
|
tengigaEnable = b;
|
||||||
//side effects
|
//side effects
|
||||||
@ -324,7 +844,7 @@ int UDPStandardImplementation::setTenGigaEnable(const bool b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int UDPStandardImplementation::setFifoDepth(const uint32_t i) {
|
int slsReceiverImplementation::setFifoDepth(const uint32_t i) {
|
||||||
if (fifoDepth != i) {
|
if (fifoDepth != i) {
|
||||||
fifoDepth = i;
|
fifoDepth = i;
|
||||||
|
|
||||||
@ -337,8 +857,38 @@ int UDPStandardImplementation::setFifoDepth(const uint32_t i) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***receiver parameters***/
|
||||||
|
bool slsReceiverImplementation::setActivate(bool enable){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
activated = enable;
|
||||||
|
FILE_LOG(logINFO) << "Activation: " << stringEnable(activated);
|
||||||
|
return activated;
|
||||||
|
}
|
||||||
|
|
||||||
int UDPStandardImplementation::setDetectorType(const detectorType d) {
|
|
||||||
|
bool slsReceiverImplementation::setDeactivatedPadding(bool enable){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
deactivatedPaddingEnable = enable;
|
||||||
|
FILE_LOG(logINFO) << "Deactivated Padding Enable: " << stringEnable(deactivatedPaddingEnable);
|
||||||
|
return deactivatedPaddingEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
void slsReceiverImplementation::setSilentMode(const bool i){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
silentMode = i;
|
||||||
|
FILE_LOG(logINFO) << "Silent Mode: " << i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
* Behavioral functions***************************************************
|
||||||
|
* They may modify the status of the receiver ****************************
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/***initial functions***/
|
||||||
|
int slsReceiverImplementation::setDetectorType(const detectorType d) {
|
||||||
FILE_LOG(logDEBUG) << "Setting receiver type";
|
FILE_LOG(logDEBUG) << "Setting receiver type";
|
||||||
DeleteMembers();
|
DeleteMembers();
|
||||||
InitializeMembers();
|
InitializeMembers();
|
||||||
@ -395,7 +945,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) {
|
|||||||
|
|
||||||
DataProcessor* p = new DataProcessor(i, myDetectorType, fifo[i], &fileFormatType,
|
DataProcessor* p = new DataProcessor(i, myDetectorType, fifo[i], &fileFormatType,
|
||||||
fileWriteEnable, &dataStreamEnable, &gapPixelsEnable,
|
fileWriteEnable, &dataStreamEnable, &gapPixelsEnable,
|
||||||
&dynamicRange, &frameToGuiFrequency, &frameToGuiTimerinMS,
|
&dynamicRange, &streamingFrequency, &streamingTimerInMs,
|
||||||
&framePadding, &activated, &deactivatedPaddingEnable, &silentMode,
|
&framePadding, &activated, &deactivatedPaddingEnable, &silentMode,
|
||||||
rawDataReadyCallBack, rawDataModifyReadyCallBack, pRawDataReady);
|
rawDataReadyCallBack, rawDataModifyReadyCallBack, pRawDataReady);
|
||||||
dataProcessor.push_back(p);
|
dataProcessor.push_back(p);
|
||||||
@ -430,7 +980,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void UDPStandardImplementation::setDetectorPositionId(const int i){
|
void slsReceiverImplementation::setDetectorPositionId(const int i){
|
||||||
detID = i;
|
detID = i;
|
||||||
FILE_LOG(logINFO) << "Detector Position Id:" << detID;
|
FILE_LOG(logINFO) << "Detector Position Id:" << detID;
|
||||||
for (unsigned int i = 0; i < dataProcessor.size(); ++i) {
|
for (unsigned int i = 0; i < dataProcessor.size(); ++i) {
|
||||||
@ -449,7 +999,8 @@ void UDPStandardImplementation::setDetectorPositionId(const int i){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UDPStandardImplementation::resetAcquisitionCount() {
|
/***acquisition functions***/
|
||||||
|
void slsReceiverImplementation::resetAcquisitionCount() {
|
||||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||||
(*it)->ResetParametersforNewAcquisition();
|
(*it)->ResetParametersforNewAcquisition();
|
||||||
|
|
||||||
@ -464,7 +1015,7 @@ void UDPStandardImplementation::resetAcquisitionCount() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int UDPStandardImplementation::startReceiver(char *c) {
|
int slsReceiverImplementation::startReceiver(char *c) {
|
||||||
cprintf(RESET,"\n");
|
cprintf(RESET,"\n");
|
||||||
FILE_LOG(logINFO) << "Starting Receiver";
|
FILE_LOG(logINFO) << "Starting Receiver";
|
||||||
ResetParametersforNewMeasurement();
|
ResetParametersforNewMeasurement();
|
||||||
@ -510,7 +1061,7 @@ int UDPStandardImplementation::startReceiver(char *c) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void UDPStandardImplementation::stopReceiver(){
|
void slsReceiverImplementation::stopReceiver(){
|
||||||
FILE_LOG(logINFO) << "Stopping Receiver";
|
FILE_LOG(logINFO) << "Stopping Receiver";
|
||||||
|
|
||||||
//set status to transmitting
|
//set status to transmitting
|
||||||
@ -591,7 +1142,7 @@ void UDPStandardImplementation::stopReceiver(){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void UDPStandardImplementation::startReadout(){
|
void slsReceiverImplementation::startReadout(){
|
||||||
if(status == RUNNING){
|
if(status == RUNNING){
|
||||||
|
|
||||||
// wait for incoming delayed packets
|
// wait for incoming delayed packets
|
||||||
@ -634,14 +1185,14 @@ void UDPStandardImplementation::startReadout(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UDPStandardImplementation::shutDownUDPSockets() {
|
void slsReceiverImplementation::shutDownUDPSockets() {
|
||||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||||
(*it)->ShutDownUDPSocket();
|
(*it)->ShutDownUDPSocket();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void UDPStandardImplementation::closeFiles() {
|
void slsReceiverImplementation::closeFiles() {
|
||||||
uint64_t maxIndexCaught = 0;
|
uint64_t maxIndexCaught = 0;
|
||||||
bool anycaught = false;
|
bool anycaught = false;
|
||||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) {
|
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) {
|
||||||
@ -654,13 +1205,8 @@ void UDPStandardImplementation::closeFiles() {
|
|||||||
dataProcessor[0]->EndofAcquisition(anycaught, maxIndexCaught);
|
dataProcessor[0]->EndofAcquisition(anycaught, maxIndexCaught);
|
||||||
}
|
}
|
||||||
|
|
||||||
int UDPStandardImplementation::setUDPSocketBufferSize(const uint32_t s) {
|
|
||||||
if (listener.size())
|
|
||||||
return listener[0]->CreateDummySocketForUDPSocketBufferSize(s);
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
int UDPStandardImplementation::restreamStop() {
|
int slsReceiverImplementation::restreamStop() {
|
||||||
bool ret = OK;
|
bool ret = OK;
|
||||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it) {
|
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it) {
|
||||||
if ((*it)->RestreamStop() == FAIL)
|
if ((*it)->RestreamStop() == FAIL)
|
||||||
@ -676,7 +1222,32 @@ int UDPStandardImplementation::restreamStop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UDPStandardImplementation::SetLocalNetworkParameters() {
|
|
||||||
|
/***callback functions***/
|
||||||
|
void slsReceiverImplementation::registerCallBackStartAcquisition(int (*func)(char*, char*, uint64_t, uint32_t, void*),void *arg){
|
||||||
|
startAcquisitionCallBack=func;
|
||||||
|
pStartAcquisition=arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
void slsReceiverImplementation::registerCallBackAcquisitionFinished(void (*func)(uint64_t, void*),void *arg){
|
||||||
|
acquisitionFinishedCallBack=func;
|
||||||
|
pAcquisitionFinished=arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
void slsReceiverImplementation::registerCallBackRawDataReady(void (*func)(char* ,
|
||||||
|
char*, uint32_t, void*),void *arg){
|
||||||
|
rawDataReadyCallBack=func;
|
||||||
|
pRawDataReady=arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
void slsReceiverImplementation::registerCallBackRawDataModifyReady(void (*func)(char* ,
|
||||||
|
char*, uint32_t&, void*),void *arg){
|
||||||
|
rawDataModifyReadyCallBack=func;
|
||||||
|
pRawDataReady=arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsReceiverImplementation::SetLocalNetworkParameters() {
|
||||||
|
|
||||||
// to increase Max length of input packet queue
|
// to increase Max length of input packet queue
|
||||||
int max_back_log;
|
int max_back_log;
|
||||||
@ -703,7 +1274,7 @@ void UDPStandardImplementation::SetLocalNetworkParameters() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void UDPStandardImplementation::SetThreadPriorities() {
|
void slsReceiverImplementation::SetThreadPriorities() {
|
||||||
|
|
||||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it){
|
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it){
|
||||||
if ((*it)->SetThreadPriority(LISTENER_PRIORITY) == FAIL) {
|
if ((*it)->SetThreadPriority(LISTENER_PRIORITY) == FAIL) {
|
||||||
@ -719,7 +1290,7 @@ void UDPStandardImplementation::SetThreadPriorities() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int UDPStandardImplementation::SetupFifoStructure() {
|
int slsReceiverImplementation::SetupFifoStructure() {
|
||||||
numberofJobs = 1;
|
numberofJobs = 1;
|
||||||
|
|
||||||
|
|
||||||
@ -754,7 +1325,7 @@ int UDPStandardImplementation::SetupFifoStructure() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void UDPStandardImplementation::ResetParametersforNewMeasurement() {
|
void slsReceiverImplementation::ResetParametersforNewMeasurement() {
|
||||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||||
(*it)->ResetParametersforNewMeasurement();
|
(*it)->ResetParametersforNewMeasurement();
|
||||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||||
@ -770,7 +1341,7 @@ void UDPStandardImplementation::ResetParametersforNewMeasurement() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int UDPStandardImplementation::CreateUDPSockets() {
|
int slsReceiverImplementation::CreateUDPSockets() {
|
||||||
bool error = false;
|
bool error = false;
|
||||||
for (unsigned int i = 0; i < listener.size(); ++i)
|
for (unsigned int i = 0; i < listener.size(); ++i)
|
||||||
if (listener[i]->CreateUDPSockets() == FAIL) {
|
if (listener[i]->CreateUDPSockets() == FAIL) {
|
||||||
@ -787,7 +1358,7 @@ int UDPStandardImplementation::CreateUDPSockets() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int UDPStandardImplementation::SetupWriter() {
|
int slsReceiverImplementation::SetupWriter() {
|
||||||
bool error = false;
|
bool error = false;
|
||||||
for (unsigned int i = 0; i < dataProcessor.size(); ++i)
|
for (unsigned int i = 0; i < dataProcessor.size(); ++i)
|
||||||
if (dataProcessor[i]->CreateNewFile(tengigaEnable,
|
if (dataProcessor[i]->CreateNewFile(tengigaEnable,
|
||||||
@ -805,7 +1376,7 @@ int UDPStandardImplementation::SetupWriter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UDPStandardImplementation::StartRunning() {
|
void slsReceiverImplementation::StartRunning() {
|
||||||
//set running mask and post semaphore to start the inner loop in execution thread
|
//set running mask and post semaphore to start the inner loop in execution thread
|
||||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it) {
|
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it) {
|
||||||
(*it)->StartRunning();
|
(*it)->StartRunning();
|
@ -4,7 +4,8 @@
|
|||||||
***********************************************/
|
***********************************************/
|
||||||
|
|
||||||
#include "slsReceiverTCPIPInterface.h"
|
#include "slsReceiverTCPIPInterface.h"
|
||||||
#include "UDPInterface.h"
|
#include "slsReceiverImplementation.h"
|
||||||
|
#include "MySocketTCP.h"
|
||||||
#include "gitInfoReceiver.h"
|
#include "gitInfoReceiver.h"
|
||||||
#include "slsReceiverUsers.h"
|
#include "slsReceiverUsers.h"
|
||||||
#include "slsReceiver.h"
|
#include "slsReceiver.h"
|
||||||
@ -210,11 +211,10 @@ const char* slsReceiverTCPIPInterface::getFunctionName(enum recFuncs func) {
|
|||||||
case F_SETUP_RECEIVER_UDP: return "F_SETUP_RECEIVER_UDP";
|
case F_SETUP_RECEIVER_UDP: return "F_SETUP_RECEIVER_UDP";
|
||||||
case F_SET_RECEIVER_TIMER: return "F_SET_RECEIVER_TIMER";
|
case F_SET_RECEIVER_TIMER: return "F_SET_RECEIVER_TIMER";
|
||||||
case F_SET_RECEIVER_DYNAMIC_RANGE: return "F_SET_RECEIVER_DYNAMIC_RANGE";
|
case F_SET_RECEIVER_DYNAMIC_RANGE: return "F_SET_RECEIVER_DYNAMIC_RANGE";
|
||||||
case F_READ_RECEIVER_FREQUENCY: return "F_READ_RECEIVER_FREQUENCY";
|
case F_RECEIVER_STREAMING_FREQUENCY:return "F_RECEIVER_STREAMING_FREQUENCY";
|
||||||
case F_GET_RECEIVER_STATUS: return "F_GET_RECEIVER_STATUS";
|
case F_GET_RECEIVER_STATUS: return "F_GET_RECEIVER_STATUS";
|
||||||
case F_START_RECEIVER: return "F_START_RECEIVER";
|
case F_START_RECEIVER: return "F_START_RECEIVER";
|
||||||
case F_STOP_RECEIVER: return "F_STOP_RECEIVER";
|
case F_STOP_RECEIVER: return "F_STOP_RECEIVER";
|
||||||
case F_START_RECEIVER_READOUT: return "F_START_RECEIVER_READOUT";
|
|
||||||
case F_SET_RECEIVER_FILE_PATH: return "F_SET_RECEIVER_FILE_PATH";
|
case F_SET_RECEIVER_FILE_PATH: return "F_SET_RECEIVER_FILE_PATH";
|
||||||
case F_SET_RECEIVER_FILE_NAME: return "F_SET_RECEIVER_FILE_NAME";
|
case F_SET_RECEIVER_FILE_NAME: return "F_SET_RECEIVER_FILE_NAME";
|
||||||
case F_SET_RECEIVER_FILE_INDEX: return "F_SET_RECEIVER_FILE_INDEX";
|
case F_SET_RECEIVER_FILE_INDEX: return "F_SET_RECEIVER_FILE_INDEX";
|
||||||
@ -222,20 +222,19 @@ const char* slsReceiverTCPIPInterface::getFunctionName(enum recFuncs func) {
|
|||||||
case F_GET_RECEIVER_FRAMES_CAUGHT: return "F_GET_RECEIVER_FRAMES_CAUGHT";
|
case F_GET_RECEIVER_FRAMES_CAUGHT: return "F_GET_RECEIVER_FRAMES_CAUGHT";
|
||||||
case F_RESET_RECEIVER_FRAMES_CAUGHT:return "F_RESET_RECEIVER_FRAMES_CAUGHT";
|
case F_RESET_RECEIVER_FRAMES_CAUGHT:return "F_RESET_RECEIVER_FRAMES_CAUGHT";
|
||||||
case F_ENABLE_RECEIVER_FILE_WRITE: return "F_ENABLE_RECEIVER_FILE_WRITE";
|
case F_ENABLE_RECEIVER_FILE_WRITE: return "F_ENABLE_RECEIVER_FILE_WRITE";
|
||||||
case F_ENABLE_RECEIVER_COMPRESSION: return "F_ENABLE_RECEIVER_COMPRESSION";
|
|
||||||
case F_ENABLE_RECEIVER_OVERWRITE: return "F_ENABLE_RECEIVER_OVERWRITE";
|
case F_ENABLE_RECEIVER_OVERWRITE: return "F_ENABLE_RECEIVER_OVERWRITE";
|
||||||
case F_ENABLE_RECEIVER_TEN_GIGA: return "F_ENABLE_RECEIVER_TEN_GIGA";
|
case F_ENABLE_RECEIVER_TEN_GIGA: return "F_ENABLE_RECEIVER_TEN_GIGA";
|
||||||
case F_SET_RECEIVER_FIFO_DEPTH: return "F_SET_RECEIVER_FIFO_DEPTH";
|
case F_SET_RECEIVER_FIFO_DEPTH: return "F_SET_RECEIVER_FIFO_DEPTH";
|
||||||
case F_RECEIVER_ACTIVATE: return "F_RECEIVER_ACTIVATE";
|
case F_RECEIVER_ACTIVATE: return "F_RECEIVER_ACTIVATE";
|
||||||
case F_STREAM_DATA_FROM_RECEIVER: return "F_STREAM_DATA_FROM_RECEIVER";
|
case F_STREAM_DATA_FROM_RECEIVER: return "F_STREAM_DATA_FROM_RECEIVER";
|
||||||
case F_READ_RECEIVER_TIMER: return "F_READ_RECEIVER_TIMER";
|
case F_RECEIVER_STREAMING_TIMER: return "F_RECEIVER_STREAMING_TIMER";
|
||||||
case F_SET_FLIPPED_DATA_RECEIVER: return "F_SET_FLIPPED_DATA_RECEIVER";
|
case F_SET_FLIPPED_DATA_RECEIVER: return "F_SET_FLIPPED_DATA_RECEIVER";
|
||||||
case F_SET_RECEIVER_FILE_FORMAT: return "F_SET_RECEIVER_FILE_FORMAT";
|
case F_SET_RECEIVER_FILE_FORMAT: return "F_SET_RECEIVER_FILE_FORMAT";
|
||||||
case F_SEND_RECEIVER_DETPOSID: return "F_SEND_RECEIVER_DETPOSID";
|
case F_SEND_RECEIVER_DETPOSID: return "F_SEND_RECEIVER_DETPOSID";
|
||||||
case F_SEND_RECEIVER_MULTIDETSIZE: return "F_SEND_RECEIVER_MULTIDETSIZE";
|
case F_SEND_RECEIVER_MULTIDETSIZE: return "F_SEND_RECEIVER_MULTIDETSIZE";
|
||||||
case F_SET_RECEIVER_STREAMING_PORT: return "F_SET_RECEIVER_STREAMING_PORT";
|
case F_SET_RECEIVER_STREAMING_PORT: return "F_SET_RECEIVER_STREAMING_PORT";
|
||||||
case F_SET_RECEIVER_SILENT_MODE: return "F_SET_RECEIVER_SILENT_MODE";
|
|
||||||
case F_RECEIVER_STREAMING_SRC_IP: return "F_RECEIVER_STREAMING_SRC_IP";
|
case F_RECEIVER_STREAMING_SRC_IP: return "F_RECEIVER_STREAMING_SRC_IP";
|
||||||
|
case F_SET_RECEIVER_SILENT_MODE: return "F_SET_RECEIVER_SILENT_MODE";
|
||||||
case F_ENABLE_GAPPIXELS_IN_RECEIVER:return "F_ENABLE_GAPPIXELS_IN_RECEIVER";
|
case F_ENABLE_GAPPIXELS_IN_RECEIVER:return "F_ENABLE_GAPPIXELS_IN_RECEIVER";
|
||||||
case F_RESTREAM_STOP_FROM_RECEIVER: return "F_RESTREAM_STOP_FROM_RECEIVER";
|
case F_RESTREAM_STOP_FROM_RECEIVER: return "F_RESTREAM_STOP_FROM_RECEIVER";
|
||||||
case F_ADDITIONAL_JSON_HEADER: return "F_ADDITIONAL_JSON_HEADER";
|
case F_ADDITIONAL_JSON_HEADER: return "F_ADDITIONAL_JSON_HEADER";
|
||||||
@ -267,11 +266,10 @@ int slsReceiverTCPIPInterface::function_table(){
|
|||||||
flist[F_SETUP_RECEIVER_UDP] = &slsReceiverTCPIPInterface::setup_udp;
|
flist[F_SETUP_RECEIVER_UDP] = &slsReceiverTCPIPInterface::setup_udp;
|
||||||
flist[F_SET_RECEIVER_TIMER] = &slsReceiverTCPIPInterface::set_timer;
|
flist[F_SET_RECEIVER_TIMER] = &slsReceiverTCPIPInterface::set_timer;
|
||||||
flist[F_SET_RECEIVER_DYNAMIC_RANGE] = &slsReceiverTCPIPInterface::set_dynamic_range;
|
flist[F_SET_RECEIVER_DYNAMIC_RANGE] = &slsReceiverTCPIPInterface::set_dynamic_range;
|
||||||
flist[F_READ_RECEIVER_FREQUENCY] = &slsReceiverTCPIPInterface::set_read_frequency;
|
flist[F_RECEIVER_STREAMING_FREQUENCY] = &slsReceiverTCPIPInterface::set_streaming_frequency;
|
||||||
flist[F_GET_RECEIVER_STATUS] = &slsReceiverTCPIPInterface::get_status;
|
flist[F_GET_RECEIVER_STATUS] = &slsReceiverTCPIPInterface::get_status;
|
||||||
flist[F_START_RECEIVER] = &slsReceiverTCPIPInterface::start_receiver;
|
flist[F_START_RECEIVER] = &slsReceiverTCPIPInterface::start_receiver;
|
||||||
flist[F_STOP_RECEIVER] = &slsReceiverTCPIPInterface::stop_receiver;
|
flist[F_STOP_RECEIVER] = &slsReceiverTCPIPInterface::stop_receiver;
|
||||||
flist[F_START_RECEIVER_READOUT] = &slsReceiverTCPIPInterface::start_readout;
|
|
||||||
flist[F_SET_RECEIVER_FILE_PATH] = &slsReceiverTCPIPInterface::set_file_dir;
|
flist[F_SET_RECEIVER_FILE_PATH] = &slsReceiverTCPIPInterface::set_file_dir;
|
||||||
flist[F_SET_RECEIVER_FILE_NAME] = &slsReceiverTCPIPInterface::set_file_name;
|
flist[F_SET_RECEIVER_FILE_NAME] = &slsReceiverTCPIPInterface::set_file_name;
|
||||||
flist[F_SET_RECEIVER_FILE_INDEX] = &slsReceiverTCPIPInterface::set_file_index;
|
flist[F_SET_RECEIVER_FILE_INDEX] = &slsReceiverTCPIPInterface::set_file_index;
|
||||||
@ -279,20 +277,19 @@ int slsReceiverTCPIPInterface::function_table(){
|
|||||||
flist[F_GET_RECEIVER_FRAMES_CAUGHT] = &slsReceiverTCPIPInterface::get_frames_caught;
|
flist[F_GET_RECEIVER_FRAMES_CAUGHT] = &slsReceiverTCPIPInterface::get_frames_caught;
|
||||||
flist[F_RESET_RECEIVER_FRAMES_CAUGHT] = &slsReceiverTCPIPInterface::reset_frames_caught;
|
flist[F_RESET_RECEIVER_FRAMES_CAUGHT] = &slsReceiverTCPIPInterface::reset_frames_caught;
|
||||||
flist[F_ENABLE_RECEIVER_FILE_WRITE] = &slsReceiverTCPIPInterface::enable_file_write;
|
flist[F_ENABLE_RECEIVER_FILE_WRITE] = &slsReceiverTCPIPInterface::enable_file_write;
|
||||||
flist[F_ENABLE_RECEIVER_COMPRESSION] = &slsReceiverTCPIPInterface::enable_compression;
|
|
||||||
flist[F_ENABLE_RECEIVER_OVERWRITE] = &slsReceiverTCPIPInterface::enable_overwrite;
|
flist[F_ENABLE_RECEIVER_OVERWRITE] = &slsReceiverTCPIPInterface::enable_overwrite;
|
||||||
flist[F_ENABLE_RECEIVER_TEN_GIGA] = &slsReceiverTCPIPInterface::enable_tengiga;
|
flist[F_ENABLE_RECEIVER_TEN_GIGA] = &slsReceiverTCPIPInterface::enable_tengiga;
|
||||||
flist[F_SET_RECEIVER_FIFO_DEPTH] = &slsReceiverTCPIPInterface::set_fifo_depth;
|
flist[F_SET_RECEIVER_FIFO_DEPTH] = &slsReceiverTCPIPInterface::set_fifo_depth;
|
||||||
flist[F_RECEIVER_ACTIVATE] = &slsReceiverTCPIPInterface::set_activate;
|
flist[F_RECEIVER_ACTIVATE] = &slsReceiverTCPIPInterface::set_activate;
|
||||||
flist[F_STREAM_DATA_FROM_RECEIVER] = &slsReceiverTCPIPInterface::set_data_stream_enable;
|
flist[F_STREAM_DATA_FROM_RECEIVER] = &slsReceiverTCPIPInterface::set_data_stream_enable;
|
||||||
flist[F_READ_RECEIVER_TIMER] = &slsReceiverTCPIPInterface::set_read_receiver_timer;
|
flist[F_RECEIVER_STREAMING_TIMER] = &slsReceiverTCPIPInterface::set_streaming_timer;
|
||||||
flist[F_SET_FLIPPED_DATA_RECEIVER] = &slsReceiverTCPIPInterface::set_flipped_data;
|
flist[F_SET_FLIPPED_DATA_RECEIVER] = &slsReceiverTCPIPInterface::set_flipped_data;
|
||||||
flist[F_SET_RECEIVER_FILE_FORMAT] = &slsReceiverTCPIPInterface::set_file_format;
|
flist[F_SET_RECEIVER_FILE_FORMAT] = &slsReceiverTCPIPInterface::set_file_format;
|
||||||
flist[F_SEND_RECEIVER_DETPOSID] = &slsReceiverTCPIPInterface::set_detector_posid;
|
flist[F_SEND_RECEIVER_DETPOSID] = &slsReceiverTCPIPInterface::set_detector_posid;
|
||||||
flist[F_SEND_RECEIVER_MULTIDETSIZE] = &slsReceiverTCPIPInterface::set_multi_detector_size;
|
flist[F_SEND_RECEIVER_MULTIDETSIZE] = &slsReceiverTCPIPInterface::set_multi_detector_size;
|
||||||
flist[F_SET_RECEIVER_STREAMING_PORT] = &slsReceiverTCPIPInterface::set_streaming_port;
|
flist[F_SET_RECEIVER_STREAMING_PORT] = &slsReceiverTCPIPInterface::set_streaming_port;
|
||||||
flist[F_SET_RECEIVER_SILENT_MODE] = &slsReceiverTCPIPInterface::set_silent_mode;
|
|
||||||
flist[F_RECEIVER_STREAMING_SRC_IP] = &slsReceiverTCPIPInterface::set_streaming_source_ip;
|
flist[F_RECEIVER_STREAMING_SRC_IP] = &slsReceiverTCPIPInterface::set_streaming_source_ip;
|
||||||
|
flist[F_SET_RECEIVER_SILENT_MODE] = &slsReceiverTCPIPInterface::set_silent_mode;
|
||||||
flist[F_ENABLE_GAPPIXELS_IN_RECEIVER] = &slsReceiverTCPIPInterface::enable_gap_pixels;
|
flist[F_ENABLE_GAPPIXELS_IN_RECEIVER] = &slsReceiverTCPIPInterface::enable_gap_pixels;
|
||||||
flist[F_RESTREAM_STOP_FROM_RECEIVER] = &slsReceiverTCPIPInterface::restream_stop;
|
flist[F_RESTREAM_STOP_FROM_RECEIVER] = &slsReceiverTCPIPInterface::restream_stop;
|
||||||
flist[F_ADDITIONAL_JSON_HEADER] = &slsReceiverTCPIPInterface::set_additional_json_header;
|
flist[F_ADDITIONAL_JSON_HEADER] = &slsReceiverTCPIPInterface::set_additional_json_header;
|
||||||
@ -675,9 +672,9 @@ int slsReceiverTCPIPInterface::send_update() {
|
|||||||
#endif
|
#endif
|
||||||
n += mySock->SendDataOnly(&ind,sizeof(ind));
|
n += mySock->SendDataOnly(&ind,sizeof(ind));
|
||||||
|
|
||||||
// receiver read frequency
|
// streaming frequency
|
||||||
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||||
ind=(int)receiverBase->getFrameToGuiFrequency();
|
ind=(int)receiverBase->getStreamingFrequency();
|
||||||
#endif
|
#endif
|
||||||
n += mySock->SendDataOnly(&ind,sizeof(ind));
|
n += mySock->SendDataOnly(&ind,sizeof(ind));
|
||||||
|
|
||||||
@ -792,7 +789,7 @@ int slsReceiverTCPIPInterface::set_detector_type(){
|
|||||||
}
|
}
|
||||||
if(ret == OK) {
|
if(ret == OK) {
|
||||||
if(receiverBase == NULL){
|
if(receiverBase == NULL){
|
||||||
receiverBase = UDPInterface::create();
|
receiverBase = new slsReceiverImplementation();
|
||||||
if(startAcquisitionCallBack)
|
if(startAcquisitionCallBack)
|
||||||
receiverBase->registerCallBackStartAcquisition(startAcquisitionCallBack,pStartAcquisition);
|
receiverBase->registerCallBackStartAcquisition(startAcquisitionCallBack,pStartAcquisition);
|
||||||
if(acquisitionFinishedCallBack)
|
if(acquisitionFinishedCallBack)
|
||||||
@ -852,7 +849,7 @@ int slsReceiverTCPIPInterface::set_detector_hostname() {
|
|||||||
else if (receiverBase->getStatus() != IDLE)
|
else if (receiverBase->getStatus() != IDLE)
|
||||||
receiverNotIdle();
|
receiverNotIdle();
|
||||||
else {
|
else {
|
||||||
receiverBase->initialize(hostname);
|
receiverBase->setDetectorHostname(hostname);
|
||||||
retval = receiverBase->getDetectorHostname();
|
retval = receiverBase->getDetectorHostname();
|
||||||
if(retval == NULL)
|
if(retval == NULL)
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
@ -1213,7 +1210,7 @@ int slsReceiverTCPIPInterface::set_dynamic_range() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int slsReceiverTCPIPInterface::set_read_frequency(){
|
int slsReceiverTCPIPInterface::set_streaming_frequency(){
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int index = -1;
|
int index = -1;
|
||||||
@ -1235,7 +1232,7 @@ int slsReceiverTCPIPInterface::set_read_frequency(){
|
|||||||
else if (receiverBase->getStatus() != IDLE)
|
else if (receiverBase->getStatus() != IDLE)
|
||||||
receiverNotIdle();
|
receiverNotIdle();
|
||||||
else {
|
else {
|
||||||
ret = receiverBase->setFrameToGuiFrequency(index);
|
ret = receiverBase->setStreamingFrequency(index);
|
||||||
if(ret == FAIL) {
|
if(ret == FAIL) {
|
||||||
strcpy(mess, "Could not allocate memory for listening fifo\n");
|
strcpy(mess, "Could not allocate memory for listening fifo\n");
|
||||||
FILE_LOG(logERROR) << mess;
|
FILE_LOG(logERROR) << mess;
|
||||||
@ -1243,10 +1240,10 @@ int slsReceiverTCPIPInterface::set_read_frequency(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//get
|
//get
|
||||||
retval=receiverBase->getFrameToGuiFrequency();
|
retval=receiverBase->getStreamingFrequency();
|
||||||
if(index >= 0 && retval != index){
|
if(index >= 0 && retval != index){
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
strcpy(mess,"Could not set frame to gui frequency");
|
strcpy(mess,"Could not set streaming frequency");
|
||||||
FILE_LOG(logERROR) << mess;
|
FILE_LOG(logERROR) << mess;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1380,50 +1377,6 @@ int slsReceiverTCPIPInterface::stop_receiver(){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int slsReceiverTCPIPInterface::start_readout(){
|
|
||||||
ret = OK;
|
|
||||||
memset(mess, 0, sizeof(mess));
|
|
||||||
enum runStatus retval;
|
|
||||||
|
|
||||||
// execute action
|
|
||||||
// only a set, not a get
|
|
||||||
|
|
||||||
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
|
||||||
if (receiverBase == NULL)
|
|
||||||
invalidReceiverObject();
|
|
||||||
else if (mySock->differentClients && lockStatus)
|
|
||||||
receiverlocked();
|
|
||||||
/*else if(receiverBase->getStatus() != IDLE){
|
|
||||||
strcpy(mess,"Can not start receiver readout while receiver not idle\n");
|
|
||||||
ret = FAIL;
|
|
||||||
}*/
|
|
||||||
else {
|
|
||||||
receiverBase->startReadout();
|
|
||||||
retval = receiverBase->getStatus();
|
|
||||||
if ((retval == TRANSMITTING) || (retval == RUN_FINISHED) || (retval == IDLE))
|
|
||||||
ret = OK;
|
|
||||||
else {
|
|
||||||
ret = FAIL;
|
|
||||||
strcpy(mess,"Could not start readout");
|
|
||||||
FILE_LOG(logERROR) << mess;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (ret == OK && mySock->differentClients)
|
|
||||||
ret = FORCE_UPDATE;
|
|
||||||
|
|
||||||
// send answer
|
|
||||||
mySock->SendDataOnly(&ret,sizeof(ret));
|
|
||||||
if (ret == FAIL)
|
|
||||||
mySock->SendDataOnly(mess,sizeof(mess));
|
|
||||||
mySock->SendDataOnly(&retval,sizeof(retval));
|
|
||||||
|
|
||||||
// return ok/fail
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1741,29 +1694,6 @@ int slsReceiverTCPIPInterface::enable_file_write(){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int slsReceiverTCPIPInterface::enable_compression() {
|
|
||||||
ret = OK;
|
|
||||||
memset(mess, 0, sizeof(mess));
|
|
||||||
int enable = -1;
|
|
||||||
|
|
||||||
// receive arguments
|
|
||||||
if(mySock->ReceiveDataOnly(&enable,sizeof(enable)) < 0 )
|
|
||||||
return printSocketReadError();
|
|
||||||
|
|
||||||
ret = FAIL;
|
|
||||||
sprintf(mess, "This function (%s) is not implemented yet\n", getFunctionName((enum recFuncs)fnum));
|
|
||||||
FILE_LOG(logERROR) << mess;
|
|
||||||
|
|
||||||
// send answer
|
|
||||||
mySock->SendDataOnly(&ret,sizeof(ret));
|
|
||||||
mySock->SendDataOnly(mess,sizeof(mess));
|
|
||||||
|
|
||||||
// return ok/fail
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int slsReceiverTCPIPInterface::enable_overwrite() {
|
int slsReceiverTCPIPInterface::enable_overwrite() {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
@ -2046,7 +1976,7 @@ int slsReceiverTCPIPInterface::set_data_stream_enable(){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int slsReceiverTCPIPInterface::set_read_receiver_timer(){
|
int slsReceiverTCPIPInterface::set_streaming_timer(){
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int index = -1;
|
int index = -1;
|
||||||
@ -2068,11 +1998,11 @@ int slsReceiverTCPIPInterface::set_read_receiver_timer(){
|
|||||||
else if (receiverBase->getStatus() != IDLE)
|
else if (receiverBase->getStatus() != IDLE)
|
||||||
receiverNotIdle();
|
receiverNotIdle();
|
||||||
else {
|
else {
|
||||||
receiverBase->setFrameToGuiTimer(index);
|
receiverBase->setStreamingTimer(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//get
|
//get
|
||||||
retval=receiverBase->getFrameToGuiTimer();
|
retval=receiverBase->getStreamingTimer();
|
||||||
if(index >= 0 && retval != index){
|
if(index >= 0 && retval != index){
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
strcpy(mess,"Could not set datastream timer");
|
strcpy(mess,"Could not set datastream timer");
|
||||||
@ -2081,7 +2011,7 @@ int slsReceiverTCPIPInterface::set_read_receiver_timer(){
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
FILE_LOG(logDEBUG1) << "receiver read timer:" << retval;
|
FILE_LOG(logDEBUG1) << "Streaming timer:" << retval;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ret == OK && mySock->differentClients)
|
if (ret == OK && mySock->differentClients)
|
||||||
|
@ -43,7 +43,6 @@ enum recFuncs{
|
|||||||
F_GET_RECEIVER_FRAMES_CAUGHT, /**< gets the number of frames caught by receiver */
|
F_GET_RECEIVER_FRAMES_CAUGHT, /**< gets the number of frames caught by receiver */
|
||||||
F_RESET_RECEIVER_FRAMES_CAUGHT, /**< resets the frames caught by receiver */
|
F_RESET_RECEIVER_FRAMES_CAUGHT, /**< resets the frames caught by receiver */
|
||||||
F_ENABLE_RECEIVER_FILE_WRITE, /**< sets the receiver file write */
|
F_ENABLE_RECEIVER_FILE_WRITE, /**< sets the receiver file write */
|
||||||
F_ENABLE_RECEIVER_COMPRESSION, /**< enable compression in receiver */
|
|
||||||
F_ENABLE_RECEIVER_OVERWRITE, /**< set overwrite flag in receiver */
|
F_ENABLE_RECEIVER_OVERWRITE, /**< set overwrite flag in receiver */
|
||||||
|
|
||||||
F_ENABLE_RECEIVER_TEN_GIGA, /**< enable 10Gbe in receiver */
|
F_ENABLE_RECEIVER_TEN_GIGA, /**< enable 10Gbe in receiver */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user