mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 01:58:00 +02:00
rxr: renamed files, removed unnecessary comments
This commit is contained in:
@ -1,408 +1,148 @@
|
||||
#pragma once
|
||||
/********************************************/ /**
|
||||
* @file
|
||||
*slsReceiverTCPIPInterface.h
|
||||
* @short interface between
|
||||
*receiver and client
|
||||
***********************************************/
|
||||
|
||||
#include "receiver_defs.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#include "Implementation.h"
|
||||
#include "ServerSocket.h"
|
||||
class MySocketTCP;
|
||||
class ServerInterface;
|
||||
#include "ServerSocket.h"
|
||||
#include "slsReceiverImplementation.h"
|
||||
|
||||
/**
|
||||
*@short interface between receiver and client
|
||||
*/
|
||||
|
||||
class slsReceiverTCPIPInterface : private virtual slsDetectorDefs {
|
||||
|
||||
class ClientInterface : private virtual slsDetectorDefs {
|
||||
private:
|
||||
enum numberMode { DEC, HEX };
|
||||
|
||||
public:
|
||||
/** Destructor */
|
||||
virtual ~slsReceiverTCPIPInterface();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* reads config file, creates socket, assigns function table
|
||||
* throws an exception in case of failure to construct
|
||||
* @param pn port number (defaults to default port number)
|
||||
*/
|
||||
|
||||
slsReceiverTCPIPInterface(int pn = -1);
|
||||
|
||||
/**
|
||||
* Starts listening on the TCP port for client comminication
|
||||
*/
|
||||
void start();
|
||||
|
||||
/** stop listening on the TCP & UDP port for client comminication */
|
||||
void stop();
|
||||
|
||||
/** gets version */
|
||||
virtual ~ClientInterface();
|
||||
ClientInterface(int portNumber = -1);
|
||||
int64_t getReceiverVersion();
|
||||
|
||||
//***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
|
||||
*/
|
||||
/** params: filepath, filename, fileindex, datasize */
|
||||
void registerCallBackStartAcquisition(int (*func)(std::string, std::string, uint64_t,
|
||||
uint32_t, void *),
|
||||
void *arg);
|
||||
|
||||
/**
|
||||
* Call back for acquisition finished
|
||||
* callback argument is
|
||||
* total frames caught
|
||||
*/
|
||||
/** params: total frames caught */
|
||||
void registerCallBackAcquisitionFinished(void (*func)(uint64_t, void *),
|
||||
void *arg);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
/** params: sls_receiver_header frame metadata, dataPointer, dataSize */
|
||||
void registerCallBackRawDataReady(void (*func)(char *, char *, uint32_t,
|
||||
void *),
|
||||
void *arg);
|
||||
|
||||
/**
|
||||
* 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).
|
||||
*/
|
||||
/** params: sls_receiver_header frame metadata, dataPointer, modified size */
|
||||
void registerCallBackRawDataModifyReady(void (*func)(char *, char *,
|
||||
uint32_t &, void *),
|
||||
void *arg);
|
||||
|
||||
private:
|
||||
/**
|
||||
* Static function - Thread started which is a TCP server
|
||||
* Called by start()
|
||||
* @param this_pointer pointer to this object
|
||||
*/
|
||||
void startTCPSocket();
|
||||
void stopTCPSocket();
|
||||
static void *startTCPServerThread(void *this_pointer);
|
||||
|
||||
/**
|
||||
* Thread started which is a TCP server
|
||||
* Called by start()
|
||||
*/
|
||||
void startTCPServer();
|
||||
|
||||
/** assigns functions to the fnum enum */
|
||||
int function_table();
|
||||
|
||||
/** Decodes Function */
|
||||
int decode_function(sls::ServerInterface2 &socket);
|
||||
|
||||
/** function not implemented for specific detector */
|
||||
void functionNotImplemented();
|
||||
|
||||
/** mode not implemented for specific detector */
|
||||
void modeNotImplemented(const std::string& modename, int mode);
|
||||
|
||||
/** validate and set error */
|
||||
template <typename T>
|
||||
void validate(T arg, T retval, std::string modename, numberMode hex);
|
||||
|
||||
/** Execute command */
|
||||
int exec_command(sls::ServerInterface2 &socket);
|
||||
|
||||
/** Exit Receiver Server */
|
||||
int exit_server(sls::ServerInterface2 &socket);
|
||||
|
||||
/** Locks Receiver */
|
||||
int lock_receiver(sls::ServerInterface2 &socket);
|
||||
|
||||
/** Get Last Client IP*/
|
||||
int get_last_client_ip(sls::ServerInterface2 &socket);
|
||||
|
||||
/** Set port */
|
||||
int set_port(sls::ServerInterface2 &socket);
|
||||
|
||||
/** Updates Client if different clients connect */
|
||||
int update_client(sls::ServerInterface2 &socket);
|
||||
|
||||
/** Sends the updated parameters to client */
|
||||
int send_update(sls::ServerInterface2 &socket);
|
||||
|
||||
/** get version */
|
||||
int get_version(sls::ServerInterface2 &socket);
|
||||
|
||||
/** Set detector type */
|
||||
int set_detector_type(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set detector hostname */
|
||||
int set_detector_hostname(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set roi */
|
||||
int set_roi(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set num frames */
|
||||
int set_num_frames(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set num analog samples */
|
||||
int set_num_analog_samples(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set num digital samples */
|
||||
int set_num_digital_samples(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set exptime */
|
||||
int set_exptime(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set period */
|
||||
int set_period(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set subexptime */
|
||||
int set_subexptime(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set subdeadtime */
|
||||
int set_subdeadtime(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set dynamic range */
|
||||
int set_dynamic_range(sls::ServerInterface2 &socket);
|
||||
|
||||
/** Sets the receiver streaming frequency */
|
||||
int set_streaming_frequency(sls::ServerInterface2 &socket);
|
||||
|
||||
/** Gets receiver status */
|
||||
int get_status(sls::ServerInterface2 &socket);
|
||||
|
||||
/** Start Receiver - starts listening to udp packets from detector */
|
||||
int start_receiver(sls::ServerInterface2 &socket);
|
||||
|
||||
/** Stop Receiver - stops listening to udp packets from detector*/
|
||||
int stop_receiver(sls::ServerInterface2 &socket);
|
||||
|
||||
/** Set File path */
|
||||
int set_file_dir(sls::ServerInterface2 &socket);
|
||||
|
||||
/** Set File name prefix */
|
||||
int set_file_name(sls::ServerInterface2 &socket);
|
||||
|
||||
/** Set File index */
|
||||
int set_file_index(sls::ServerInterface2 &socket);
|
||||
|
||||
/** Gets current frame index */
|
||||
int get_frame_index(sls::ServerInterface2 &socket);
|
||||
|
||||
/** Gets Total Frames Caught */
|
||||
int get_frames_caught(sls::ServerInterface2 &socket);
|
||||
|
||||
/** Enable File Write*/
|
||||
int enable_file_write(sls::ServerInterface2 &socket);
|
||||
|
||||
/** Enable Master File Write */
|
||||
int enable_master_file_write(sls::ServerInterface2 &socket);
|
||||
|
||||
/** enable compression */
|
||||
int enable_compression(sls::ServerInterface2 &socket);
|
||||
|
||||
/** enable overwrite */
|
||||
int enable_overwrite(sls::ServerInterface2 &socket);
|
||||
|
||||
/** enable 10Gbe */
|
||||
int enable_tengiga(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set fifo depth */
|
||||
int set_fifo_depth(sls::ServerInterface2 &socket);
|
||||
|
||||
/** activate/ deactivate */
|
||||
int set_activate(sls::ServerInterface2 &socket);
|
||||
|
||||
/* Set the data stream enable */
|
||||
int set_data_stream_enable(sls::ServerInterface2 &socket);
|
||||
|
||||
/** Sets the steadming timer when frequency is set to 0 */
|
||||
int set_streaming_timer(sls::ServerInterface2 &socket);
|
||||
|
||||
/** enable flipped data */
|
||||
int set_flipped_data(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set file format */
|
||||
int set_file_format(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set position id */
|
||||
int set_detector_posid(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set multi detector size */
|
||||
int set_multi_detector_size(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set streaming port */
|
||||
int set_streaming_port(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set streaming source ip */
|
||||
int set_streaming_source_ip(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set silent mode */
|
||||
int set_silent_mode(sls::ServerInterface2 &socket);
|
||||
|
||||
/** enable gap pixels */
|
||||
int enable_gap_pixels(sls::ServerInterface2 &socket);
|
||||
|
||||
/** restream stop packet */
|
||||
int restream_stop(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set additional json header */
|
||||
int set_additional_json_header(sls::ServerInterface2 &socket);
|
||||
|
||||
/** get additional json header */
|
||||
int get_additional_json_header(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set udp socket buffer size */
|
||||
int set_udp_socket_buffer_size(sls::ServerInterface2 &socket);
|
||||
|
||||
/** get real udp socket buffer size */
|
||||
int get_real_udp_socket_buffer_size(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set frames per file */
|
||||
int set_frames_per_file(sls::ServerInterface2 &socket);
|
||||
|
||||
/** check version compatibility */
|
||||
int check_version_compatibility(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set frame discard policy */
|
||||
int set_discard_policy(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set partial frame padding enable*/
|
||||
int set_padding_enable(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set deactivated receiver padding enable */
|
||||
int set_deactivated_padding_enable(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set readout mode */
|
||||
int set_readout_mode(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set adc mask */
|
||||
int set_adc_mask(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set receiver dbit list */
|
||||
int set_dbit_list(sls::ServerInterface2 &socket);
|
||||
|
||||
/** get receiver dbit list */
|
||||
int get_dbit_list(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set dbit offset */
|
||||
int set_dbit_offset(sls::ServerInterface2 &socket);
|
||||
|
||||
/** quad type */
|
||||
int set_quad_type(sls::ServerInterface2 &socket);
|
||||
|
||||
/** read n lines */
|
||||
int set_read_n_lines(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set udp ip */
|
||||
int set_udp_ip(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set udp ip2 */
|
||||
int set_udp_ip2(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set udp port */
|
||||
int set_udp_port(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set udp port2 */
|
||||
int set_udp_port2(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set number of udp interfaces */
|
||||
int set_num_interfaces(sls::ServerInterface2 &socket);
|
||||
|
||||
|
||||
/** detector type */
|
||||
detectorType myDetectorType;
|
||||
|
||||
/** slsReceiverBase object */
|
||||
std::unique_ptr<slsReceiverImplementation> receiver{nullptr};
|
||||
|
||||
/** Function List */
|
||||
int (slsReceiverTCPIPInterface::*flist[NUM_REC_FUNCTIONS])(
|
||||
std::unique_ptr<Implementation> receiver{nullptr};
|
||||
int (ClientInterface::*flist[NUM_REC_FUNCTIONS])(
|
||||
sls::ServerInterface2 &socket);
|
||||
|
||||
/** success/failure */
|
||||
int ret{OK};
|
||||
|
||||
/** function index */
|
||||
int fnum{-1};
|
||||
|
||||
/** Lock Status if server locked to a client */
|
||||
int lockStatus{0};
|
||||
|
||||
/** kill tcp server thread */
|
||||
int killTCPServerThread{0};
|
||||
|
||||
/** thread for TCP server */
|
||||
pthread_t TCPServer_thread;
|
||||
|
||||
/** tcp thread created flag*/
|
||||
bool tcpThreadCreated{false};
|
||||
|
||||
/** port number */
|
||||
int portNumber;
|
||||
|
||||
//***callback parameters***
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
int (*startAcquisitionCallBack)(std::string, std::string, uint64_t, uint32_t,
|
||||
void *) = nullptr;
|
||||
void *pStartAcquisition{nullptr};
|
||||
|
||||
/**
|
||||
* Call back for acquisition finished
|
||||
* callback argument is
|
||||
* total frames caught
|
||||
*/
|
||||
void (*acquisitionFinishedCallBack)(uint64_t, void *) = nullptr;
|
||||
void *pAcquisitionFinished{nullptr};
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
void (*rawDataReadyCallBack)(char *, char *, uint32_t, void *) = nullptr;
|
||||
|
||||
/**
|
||||
* 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).
|
||||
*/
|
||||
void (*rawDataModifyReadyCallBack)(char *, char *, uint32_t &,
|
||||
void *) = nullptr;
|
||||
|
||||
void *pRawDataReady{nullptr};
|
||||
|
||||
protected:
|
||||
@ -412,7 +152,7 @@ class slsReceiverTCPIPInterface : private virtual slsDetectorDefs {
|
||||
void VerifyLock();
|
||||
void VerifyIdle(sls::ServerInterface2 &socket);
|
||||
|
||||
slsReceiverImplementation *impl() {
|
||||
Implementation *impl() {
|
||||
if (receiver != nullptr) {
|
||||
return receiver.get();
|
||||
} else {
|
310
slsReceiverSoftware/include/Implementation.h
Executable file
310
slsReceiverSoftware/include/Implementation.h
Executable file
@ -0,0 +1,310 @@
|
||||
#pragma once
|
||||
#include "container_utils.h"
|
||||
#include "logger.h"
|
||||
#include "receiver_defs.h"
|
||||
#include "network_utils.h"
|
||||
class GeneralData;
|
||||
class Listener;
|
||||
class DataProcessor;
|
||||
class DataStreamer;
|
||||
class Fifo;
|
||||
class slsDetectorDefs;
|
||||
|
||||
#include <atomic>
|
||||
#include <exception>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
class Implementation : private virtual slsDetectorDefs {
|
||||
public:
|
||||
//*** cosntructor & destructor ***
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Implementation();
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~Implementation();
|
||||
|
||||
/*************************************************************************
|
||||
* Getters ***************************************************************
|
||||
* They access local cache of configuration or detector parameters *******
|
||||
*************************************************************************/
|
||||
|
||||
//**initial parameters***
|
||||
int *getMultiDetectorSize() const;
|
||||
int getDetectorPositionId() const;
|
||||
std::string getDetectorHostname() const;
|
||||
int getFlippedDataX() const;
|
||||
bool getGapPixelsEnable() const;
|
||||
bool getQuad() const;
|
||||
int getReadNLines() const;
|
||||
readoutMode getReadoutMode() const;
|
||||
|
||||
//***file parameters***
|
||||
fileFormat getFileFormat() const;
|
||||
std::string getFileName() const;
|
||||
std::string getFilePath() const;
|
||||
uint64_t getFileIndex() const;
|
||||
uint32_t getFramesPerFile() const;
|
||||
frameDiscardPolicy getFrameDiscardPolicy() const;
|
||||
bool getFramePaddingEnable() const;
|
||||
bool getFileWriteEnable() const;
|
||||
bool getMasterFileWriteEnable() const;
|
||||
bool getOverwriteEnable() const;
|
||||
|
||||
//***acquisition count parameters***
|
||||
uint64_t getFramesCaught() const;
|
||||
uint64_t getAcquisitionIndex() const;
|
||||
|
||||
//***connection parameters***
|
||||
uint32_t getUDPPortNumber() const;
|
||||
uint32_t getUDPPortNumber2() const;
|
||||
std::string getEthernetInterface() const;
|
||||
std::string getEthernetInterface2() const;
|
||||
int getNumberofUDPInterfaces() const;
|
||||
|
||||
//***acquisition parameters***
|
||||
ROI getROI() const;
|
||||
uint32_t getADCEnableMask() const;
|
||||
uint32_t getStreamingFrequency() const;
|
||||
uint32_t getStreamingTimer() const;
|
||||
bool getDataStreamEnable() const;
|
||||
uint64_t getAcquisitionPeriod() const;
|
||||
uint64_t getAcquisitionTime() const;
|
||||
uint64_t getSubExpTime() const;
|
||||
uint64_t getSubPeriod() const;
|
||||
uint64_t getNumberOfFrames() const;
|
||||
uint32_t getNumberofAnalogSamples() const;
|
||||
uint32_t getNumberofDigitalSamples() const;
|
||||
uint32_t getDynamicRange() const;
|
||||
bool getTenGigaEnable() const;
|
||||
uint32_t getFifoDepth() const;
|
||||
|
||||
//***receiver status***
|
||||
runStatus getStatus() const;
|
||||
bool getSilentMode() const;
|
||||
std::vector<int> getDbitList() const;
|
||||
int getDbitOffset() const;
|
||||
bool getActivate() const;
|
||||
bool getDeactivatedPadding() const;
|
||||
uint32_t getStreamingPort() const;
|
||||
sls::IpAddr getStreamingSourceIP() const;
|
||||
std::string getAdditionalJsonHeader() const;
|
||||
int64_t getUDPSocketBufferSize() const;
|
||||
int64_t getActualUDPSocketBufferSize() const;
|
||||
|
||||
/*************************************************************************
|
||||
* Setters ***************************************************************
|
||||
* They modify the local cache of configuration or detector parameters ***
|
||||
*************************************************************************/
|
||||
|
||||
//**initial parameters***
|
||||
void setDetectorHostname(const std::string& c);
|
||||
void setMultiDetectorSize(const int *size);
|
||||
void setFlippedDataX(int enable = -1);
|
||||
/* [Eiger] */
|
||||
int setGapPixelsEnable(const bool b);
|
||||
/* [Eiger] */
|
||||
int setQuad(const bool b);
|
||||
/* [Eiger] */
|
||||
void setReadNLines(const int value);
|
||||
/* [Ctb] */
|
||||
int setReadoutMode(const readoutMode f);
|
||||
|
||||
//***file parameters***
|
||||
void setFileFormat(slsDetectorDefs::fileFormat f);
|
||||
void setFileName(const std::string& c);
|
||||
/* check for existence */
|
||||
void setFilePath(const std::string& c);
|
||||
void setFileIndex(const uint64_t i);
|
||||
/* 0 means infinite */
|
||||
void setFramesPerFile(const uint32_t i);
|
||||
void setFrameDiscardPolicy(const frameDiscardPolicy i);
|
||||
void setFramePaddingEnable(const bool i);
|
||||
void setFileWriteEnable(const bool b);
|
||||
void setMasterFileWriteEnable(const bool b);
|
||||
void setOverwriteEnable(const bool b);
|
||||
|
||||
//***connection parameters***
|
||||
void setUDPPortNumber(const uint32_t i);
|
||||
/* [Eiger][Jungfrau] */
|
||||
void setUDPPortNumber2(const uint32_t i);
|
||||
void setEthernetInterface(const std::string &c);
|
||||
/* [Jungfrau] */
|
||||
void setEthernetInterface2(const std::string &c);
|
||||
/* [Jungfrau] */
|
||||
int setNumberofUDPInterfaces(const int n);
|
||||
int setUDPSocketBufferSize(const int64_t s);
|
||||
|
||||
//***acquisition parameters***
|
||||
/* [Gotthard] */
|
||||
int setROI(ROI arg);
|
||||
/* [Ctb][Moench] */
|
||||
int setADCEnableMask(const uint32_t mask);
|
||||
/* 0 for timer */
|
||||
int setStreamingFrequency(const uint32_t freq);
|
||||
void setStreamingTimer(const uint32_t time_in_ms);
|
||||
int setDataStreamEnable(const bool enable);
|
||||
void setStreamingPort(const uint32_t i);
|
||||
void setStreamingSourceIP(const sls::IpAddr ip);
|
||||
void setAdditionalJsonHeader(const std::string& c);
|
||||
void setAcquisitionPeriod(const uint64_t i);
|
||||
void setAcquisitionTime(const uint64_t i);
|
||||
void setSubExpTime(const uint64_t i);
|
||||
void setSubPeriod(const uint64_t i);
|
||||
void setNumberOfFrames(const uint64_t i);
|
||||
int setNumberofAnalogSamples(const uint32_t i);
|
||||
int setNumberofDigitalSamples(const uint32_t i);
|
||||
int setDynamicRange(const uint32_t i);
|
||||
/* [Eiger][Ctb] */
|
||||
int setTenGigaEnable(const bool b);
|
||||
int setFifoDepth(const uint32_t i);
|
||||
|
||||
//***receiver parameters***
|
||||
/** [Eiger]
|
||||
* 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
|
||||
*/
|
||||
bool setActivate(const bool enable);
|
||||
/* [Eiger] */
|
||||
bool setDeactivatedPadding(const bool enable);
|
||||
void setSilentMode(const bool i);
|
||||
/* [Ctb] */
|
||||
void setDbitList(const std::vector<int> v);
|
||||
/* [Ctb] */
|
||||
void setDbitOffset(const int s);
|
||||
|
||||
/*************************************************************************
|
||||
* 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);
|
||||
void setDetectorPositionId(const int id);
|
||||
|
||||
//***acquisition functions***
|
||||
int startReceiver(std::string& err);
|
||||
void stopReceiver();
|
||||
void startReadout();
|
||||
void shutDownUDPSockets();
|
||||
void closeFiles();
|
||||
int restreamStop();
|
||||
|
||||
//***callback functions***
|
||||
void registerCallBackStartAcquisition(int (*func)(std::string, std::string, uint64_t,
|
||||
uint32_t, void *),
|
||||
void *arg);
|
||||
void registerCallBackAcquisitionFinished(void (*func)(uint64_t, void *),
|
||||
void *arg);
|
||||
void registerCallBackRawDataReady(void (*func)(char *, char *, uint32_t,
|
||||
void *),
|
||||
void *arg);
|
||||
void registerCallBackRawDataModifyReady(void (*func)(char *, char *,
|
||||
uint32_t &, void *),
|
||||
void *arg);
|
||||
|
||||
private:
|
||||
void DeleteMembers();
|
||||
void InitializeMembers();
|
||||
void SetLocalNetworkParameters();
|
||||
void SetThreadPriorities();
|
||||
int SetupFifoStructure();
|
||||
void ResetParametersforNewAcquisition();
|
||||
int CreateUDPSockets();
|
||||
int SetupWriter();
|
||||
void StartRunning();
|
||||
|
||||
/*************************************************************************
|
||||
* Class Members *********************************************************
|
||||
*************************************************************************/
|
||||
//**detector parameters***
|
||||
detectorType myDetectorType;
|
||||
int numDet[MAX_DIMENSIONS];
|
||||
int detID;
|
||||
std::string detHostname;
|
||||
uint64_t acquisitionPeriod;
|
||||
uint64_t acquisitionTime;
|
||||
uint64_t subExpTime;
|
||||
uint64_t subPeriod;
|
||||
uint64_t numberOfFrames;
|
||||
uint64_t numberOfAnalogSamples;
|
||||
uint64_t numberOfDigitalSamples;
|
||||
uint32_t dynamicRange;
|
||||
bool tengigaEnable;
|
||||
uint32_t fifoDepth;
|
||||
int flippedDataX;
|
||||
bool gapPixelsEnable;
|
||||
bool quadEnable;
|
||||
int numLinesReadout;
|
||||
readoutMode readoutType;
|
||||
|
||||
//*** receiver parameters ***
|
||||
int numThreads;
|
||||
const static int MAX_NUMBER_OF_LISTENING_THREADS = 2;
|
||||
std::atomic<runStatus> status;
|
||||
bool activated;
|
||||
bool deactivatedPaddingEnable;
|
||||
frameDiscardPolicy frameDiscardMode;
|
||||
bool framePadding;
|
||||
bool silentMode;
|
||||
std::vector<int> ctbDbitList;
|
||||
int ctbDbitOffset;
|
||||
int ctbAnalogDataBytes;
|
||||
|
||||
//***connection parameters***
|
||||
int numUDPInterfaces;
|
||||
std::vector <std::string> eth;
|
||||
uint32_t udpPortNum[MAX_NUMBER_OF_LISTENING_THREADS];
|
||||
int64_t udpSocketBufferSize;
|
||||
int64_t actualUDPSocketBufferSize;
|
||||
|
||||
//***file parameters***
|
||||
fileFormat fileFormatType;
|
||||
std::string fileName;
|
||||
std::string filePath;
|
||||
uint64_t fileIndex;
|
||||
uint32_t framesPerFile;
|
||||
bool fileWriteEnable;
|
||||
bool masterFileWriteEnable;
|
||||
bool overwriteEnable;
|
||||
|
||||
//***acquisition parameters***
|
||||
ROI roi;
|
||||
uint32_t adcEnableMask;
|
||||
uint32_t streamingFrequency;
|
||||
uint32_t streamingTimerInMs;
|
||||
bool dataStreamEnable;
|
||||
uint32_t streamingPort;
|
||||
sls::IpAddr streamingSrcIP;
|
||||
std::string additionalJsonHeader;
|
||||
|
||||
//** class objects ***
|
||||
GeneralData *generalData;
|
||||
std::vector<std::unique_ptr<Listener>> listener;
|
||||
std::vector<std::unique_ptr<DataProcessor>> dataProcessor;
|
||||
std::vector<std::unique_ptr<DataStreamer>> dataStreamer;
|
||||
std::vector<std::unique_ptr<Fifo>> fifo;
|
||||
|
||||
//***callback parameters***
|
||||
int (*startAcquisitionCallBack)(std::string, std::string, uint64_t, uint32_t, void *);
|
||||
void *pStartAcquisition;
|
||||
void (*acquisitionFinishedCallBack)(uint64_t, void *);
|
||||
void *pAcquisitionFinished;
|
||||
void (*rawDataReadyCallBack)(char *, char *, uint32_t, void *);
|
||||
void (*rawDataModifyReadyCallBack)(char *, char *, uint32_t &, void *);
|
||||
void *pRawDataReady;
|
||||
};
|
@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#include "slsReceiverTCPIPInterface.h"
|
||||
#include "ClientInterface.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#include <memory>
|
||||
@ -76,5 +76,5 @@ class Receiver : private virtual slsDetectorDefs {
|
||||
|
||||
|
||||
private:
|
||||
std::unique_ptr<slsReceiverTCPIPInterface> tcpipInterface;
|
||||
std::unique_ptr<ClientInterface> tcpipInterface;
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user