mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 16:20:03 +02:00
big change half done
This commit is contained in:
parent
06b38e591c
commit
c392348def
File diff suppressed because it is too large
Load Diff
@ -32,369 +32,465 @@ class UDPInterface {
|
||||
*
|
||||
* UDPInterface *udp_interface = UDPInterface::create()
|
||||
*
|
||||
*
|
||||
* supported sequence of method-calls:
|
||||
*
|
||||
* initialize() : once and only once after create()
|
||||
* initialize() : once and only once after create() //FIXME: only once functionality implemented in the derived REST class, so not mention here?
|
||||
*
|
||||
* get*() : anytime after initialize(), multiples times
|
||||
*
|
||||
* set*() : anytime after initialize(), multiple times
|
||||
*
|
||||
* startReceiver(): anytime after initialize(). Will fail if state already is 'running'
|
||||
*
|
||||
* abort(),
|
||||
* stopReceiver() : anytime after initialize(). Will do nothing if state already is idle.
|
||||
*
|
||||
* getStatus() returns the actual state of the data receiver - running or idle. All other
|
||||
* get*() and set*() methods access the local cache of configuration values only and *do not* modify the data receiver settings.
|
||||
* startReceiver(): anytime after initialize(). Will fail if state already is 'running':
|
||||
*
|
||||
* Only startReceiver() does change the data receiver configuration, it does pass the whole configuration cache to the data receiver.
|
||||
*
|
||||
* get- and set-methods that return a char array (char *) allocate a new array at each call. The caller is responsible to free the allocated space:
|
||||
* abort(), //FIXME: needed?
|
||||
*
|
||||
* stopReceiver() : anytime after initialize(). Will do nothing if state already is idle.
|
||||
*
|
||||
* 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;
|
||||
*
|
||||
* always: 1:YES 0:NO for int as bool-like arguments
|
||||
* 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 REST object
|
||||
* @param [in] receiver_type type can be standard or REST
|
||||
* @return a UDPInterface reference to object depending on receiver type
|
||||
*/
|
||||
static UDPInterface *create(string receiver_type = "standard");
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~UDPInterface() {};
|
||||
|
||||
/**
|
||||
* Factory create method
|
||||
*/
|
||||
static UDPInterface *create(string receiver_type = "standard");
|
||||
|
||||
virtual void configure(map<string, string> config_map) = 0;
|
||||
|
||||
|
||||
public:
|
||||
/*************************************************************************
|
||||
* Getters ***************************************************************
|
||||
* They access local cache of configuration or detector parameters *******
|
||||
*************************************************************************/
|
||||
|
||||
/**
|
||||
* Initialize the Receiver
|
||||
@param detectorHostName detector hostname
|
||||
* you can call this function only once. You must call it before you call startReceiver() for the first time.
|
||||
*/
|
||||
virtual void initialize(const char *detectorHostName) = 0;
|
||||
|
||||
|
||||
/* Returns detector hostname
|
||||
/returns hostname
|
||||
* caller needs to deallocate the returned char array.
|
||||
* if uninitialized, it must return NULL
|
||||
//**initial parameters***
|
||||
/*
|
||||
* Get detector hostname
|
||||
* @return hostname or NULL if uninitialized, must be released by calling function (max of 1000 characters)
|
||||
*/
|
||||
virtual char *getDetectorHostname() const = 0;
|
||||
|
||||
/**
|
||||
* Returns status of receiver: idle, running or error
|
||||
*/
|
||||
virtual slsReceiverDefs::runStatus getStatus() const = 0;
|
||||
|
||||
//***file parameters***
|
||||
/**
|
||||
* Returns File Name
|
||||
* caller is responsible to deallocate the returned char array.
|
||||
* 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;
|
||||
|
||||
|
||||
/**
|
||||
* Returns File Path
|
||||
* caller is responsible to deallocate the returned char array
|
||||
* 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; //FIXME: Does the caller need to free() the returned pointer?
|
||||
|
||||
virtual char *getFilePath() const = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of bits per pixel
|
||||
* Get File Index
|
||||
* @return NULL or file index of acquisition
|
||||
*/
|
||||
virtual int getDynamicRange() const = 0;
|
||||
virtual uint64_t getFileIndex() const = 0;
|
||||
|
||||
/**
|
||||
* Returns scan tag
|
||||
* Get Scan Tag
|
||||
* @return scan tag //FIXME: needed? (unsigned integer?)
|
||||
*/
|
||||
virtual int getScanTag() const = 0;
|
||||
|
||||
/**
|
||||
* Get if Frame Index is enabled (acquisition of more than 1 frame adds '_f000000000000' to file name )
|
||||
* @return true if frame index needed, else false
|
||||
*/
|
||||
virtual bool getFrameIndexEnable() 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 Caught for an entire acquisition (including all scans)
|
||||
* @return 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 getUDPPortNo() const = 0;
|
||||
|
||||
/**
|
||||
* Get Second UDP Port Number (eiger specific)
|
||||
* @return second udp port number
|
||||
*/
|
||||
virtual uint32_t getUDPPortNo2() const = 0;
|
||||
|
||||
/**
|
||||
* Get Ehernet Interface
|
||||
* @return ethernet interface. eg. eth0 (max of 1000 characters)
|
||||
*/
|
||||
virtual char *getEthernetInterface() const = 0;
|
||||
|
||||
|
||||
//***acquisition parameters***
|
||||
/**
|
||||
* Get Short Frame Enabled, later will be moved to getROI (so far only for gotthard)
|
||||
* @return index of adc enabled, else -1 if all enabled
|
||||
*/
|
||||
virtual int getShortFrameEnable() 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;
|
||||
|
||||
/**
|
||||
* Get Acquisition Period
|
||||
* @return acquisition period
|
||||
*/
|
||||
virtual uint64_t getAcquisitionPeriod() const = 0;
|
||||
|
||||
/*
|
||||
* Returns number of frames to receive
|
||||
* This is the number of frames to expect to receiver from the detector.
|
||||
* The data receiver will change from running to idle when it got this number of frames
|
||||
* 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: (Not implemented)
|
||||
* @return number of frames expected
|
||||
*/
|
||||
virtual int getNumberOfFrames() const = 0;
|
||||
virtual uint64_t getNumberOfFrames() const = 0;
|
||||
|
||||
/**
|
||||
* Returns file write enable
|
||||
* 1: YES 0: NO
|
||||
* Get Dynamic Range or Number of Bits Per Pixel
|
||||
* @return dynamic range that is 4, 8, 16 or 32
|
||||
*/
|
||||
virtual int getEnableFileWrite() const = 0;
|
||||
virtual uint32_t getDynamicRange() const = 0;
|
||||
|
||||
/**
|
||||
* Returns file over write enable
|
||||
* 1: YES 0: NO
|
||||
* Get Ten Giga Enable
|
||||
* @return true if 10Giga enabled, else false (1G enabled)
|
||||
*/
|
||||
virtual int getEnableOverwrite() const = 0;
|
||||
virtual bool getTenGigaEnable() 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;
|
||||
|
||||
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* 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(map<string, string> config_map) = 0;
|
||||
|
||||
/**
|
||||
* Set File Name (without frame index, file index and extension)
|
||||
@param c file name
|
||||
/returns file name
|
||||
* returns NULL on failure (like bad file name)
|
||||
* does not check the existence of the file - we don't know which path we'll finally use, so no point to check.
|
||||
* caller is responsible to deallocate the returned char array.
|
||||
* Set Bottom Enable (eiger specific, should be moved to configure, and later from client via TCPIP)
|
||||
* @param b is true for bottom enabled or false for bottom disabled
|
||||
*/
|
||||
virtual char* setFileName(const char c[]) = 0;
|
||||
virtual void setBottomEnable(const bool b)= 0;
|
||||
|
||||
|
||||
//***file parameters***
|
||||
/**
|
||||
* 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
|
||||
@param c file path
|
||||
/returns file path
|
||||
* checks the existence of the directory. returns NULL if directory does not exist or is not readable.
|
||||
* caller is responsible to deallocate the returned char array.
|
||||
* Checks for file directory existence before setting file path
|
||||
* @param c file path (max of 1000 characters)
|
||||
*/
|
||||
virtual char* setFilePath(const char c[]) = 0;
|
||||
virtual void setFilePath(const char c[]) = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of bits per pixel
|
||||
@param dr sets dynamic range
|
||||
/returns dynamic range
|
||||
* returns -1 on failure
|
||||
* FIXME: what are the allowd values - should we use an enum as argument?
|
||||
* Set File Index of acquisition
|
||||
* @param i file index of acquisition
|
||||
*/
|
||||
virtual int setDynamicRange(const int dr) = 0;
|
||||
|
||||
virtual void setFileIndex(const uint64_t i) = 0;
|
||||
|
||||
/**
|
||||
* Set scan tag
|
||||
@param tag scan tag
|
||||
/returns scan tag (always non-negative)
|
||||
* FIXME: valid range - only positive? 16bit ore 32bit?
|
||||
* returns -1 on failure
|
||||
* Set Scan Tag
|
||||
* @param i scan tag //FIXME: needed? (unsigned integer?)
|
||||
*/
|
||||
virtual int setScanTag(const int tag) = 0;
|
||||
virtual void setScanTag(const int i) = 0;
|
||||
|
||||
/**
|
||||
* Sets number of frames
|
||||
@param fnum number of frames
|
||||
/returns number of frames
|
||||
* Set Frame Index Enable (acquisition of more than 1 frame adds '_f000000000000' to file name )
|
||||
* @param b true for frame index enable, else false
|
||||
*/
|
||||
virtual int setNumberOfFrames(const int fnum) = 0;
|
||||
virtual void setFrameIndexEnable(const bool b) = 0;
|
||||
|
||||
/**
|
||||
* Set enable file write
|
||||
* @param i file write enable
|
||||
/returns file write enable
|
||||
* Set File Write Enable
|
||||
* @param b true for file write enable, else false
|
||||
*/
|
||||
virtual int setEnableFileWrite(const int i) = 0;
|
||||
virtual void setFileWriteEnable(const bool b) = 0;
|
||||
|
||||
/**
|
||||
* Set enable file overwrite
|
||||
* @param i file overwrite enable
|
||||
/returns file overwrite enable
|
||||
* Set File Overwrite Enable
|
||||
* @param b true for file overwrite enable, else false
|
||||
*/
|
||||
virtual int setEnableOverwrite(const int i) = 0;
|
||||
virtual void setOverwriteEnable(const bool b) = 0;
|
||||
|
||||
/**
|
||||
* Starts Receiver - activate all configuration settings to the eiger receiver and start to listen for packets
|
||||
@param message is the error message if there is an error
|
||||
/returns 0 on success or -1 on failure
|
||||
* Set data compression, by saving only hits (so far implemented only for Moench and Gotthard)
|
||||
* @param b true for data compression enable, else false
|
||||
*/
|
||||
//FIXME: success == 0 or success == 1?
|
||||
virtual int startReceiver(char *message=NULL) = 0; //FIXME: who allocates message[]?
|
||||
|
||||
/**
|
||||
* Stops Receiver - stops listening for packets
|
||||
/returns success
|
||||
* same as abort(). Always returns 0.
|
||||
*/
|
||||
virtual int stopReceiver() = 0;
|
||||
|
||||
/**
|
||||
* abort acquisition with minimum damage: close open files, cleanup.
|
||||
* does nothing if state already is 'idle'
|
||||
*/
|
||||
virtual void abort() = 0;
|
||||
virtual void setDataCompressionEnable(const bool b) = 0;
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************************************************
|
||||
**************************************** Added by Dhanya *********************************************************
|
||||
*******************************************************************************************************************/
|
||||
|
||||
/**
|
||||
* Set bottom to bot
|
||||
* @param bot = 1 if bottom
|
||||
*/
|
||||
virtual void setBottom(int bot)= 0;
|
||||
|
||||
/**
|
||||
* Returns File Index
|
||||
*/
|
||||
virtual int getFileIndex() = 0;
|
||||
|
||||
/**
|
||||
* Returns Total Frames Caught for an entire acquisition (including all scans)
|
||||
*/
|
||||
virtual int getTotalFramesCaught() = 0;
|
||||
|
||||
/**
|
||||
* Returns Frames Caught for each real time acquisition (eg. for each scan)
|
||||
*/
|
||||
virtual int getFramesCaught() = 0;
|
||||
|
||||
/**
|
||||
* Returns the frame index at start of entire acquisition (including all scans)
|
||||
*/
|
||||
virtual uint32_t getStartAcquisitionIndex()=0;
|
||||
|
||||
/**
|
||||
* Returns current Frame Index Caught for an entire acquisition (including all scans)
|
||||
*/
|
||||
virtual uint32_t getAcquisitionIndex() = 0;
|
||||
|
||||
/**
|
||||
* Returns the frame index at start of each real time acquisition (eg. for each scan)
|
||||
*/
|
||||
virtual uint32_t getStartFrameIndex() = 0;
|
||||
|
||||
/** get data compression, by saving only hits
|
||||
*/
|
||||
virtual bool getDataCompression() = 0;
|
||||
|
||||
/**
|
||||
* Set receiver type
|
||||
* @param det detector type
|
||||
* Returns success or FAIL
|
||||
*/
|
||||
virtual int setDetectorType(slsReceiverDefs::detectorType det) = 0;
|
||||
|
||||
/**
|
||||
* Set File Index
|
||||
* @param i file index
|
||||
*/
|
||||
virtual int setFileIndex(int i) = 0;
|
||||
|
||||
/** set acquisition period if a positive number
|
||||
*/
|
||||
virtual int64_t setAcquisitionPeriod(int64_t index) = 0;
|
||||
|
||||
/**
|
||||
* Set Frame Index Needed
|
||||
* @param i frame index needed
|
||||
*/
|
||||
virtual int setFrameIndexNeeded(int i) = 0;
|
||||
|
||||
//***connection parameters***
|
||||
/**
|
||||
* Set UDP Port Number
|
||||
* @param i udp port number
|
||||
*/
|
||||
virtual void setUDPPortNo(int p) = 0;
|
||||
virtual void setUDPPortNo(const uint32_t i) = 0;
|
||||
|
||||
/**
|
||||
* Set UDP Port Number
|
||||
* Set Second UDP Port Number (eiger specific)
|
||||
* @return second udp port number
|
||||
*/
|
||||
virtual void setUDPPortNo2(int p) = 0;
|
||||
virtual void setUDPPortNo2(const uint32_t i) = 0;
|
||||
|
||||
/**
|
||||
* Set Ethernet Interface or IP to listen to
|
||||
* Set Ethernet Interface to listen to
|
||||
* @param c ethernet inerface eg. eth0 (max of 1000 characters)
|
||||
*/
|
||||
virtual void setEthernetInterface(char* c) = 0;
|
||||
virtual void setEthernetInterface(const char* c) = 0;
|
||||
|
||||
|
||||
//***connection parameters***
|
||||
/**
|
||||
* Set Short Frame Enabled, later will be moved to getROI (so far only for gotthard)
|
||||
* @param i index of adc enabled, else -1 if all enabled
|
||||
*/
|
||||
virtual void setShortFrameEnable(const int i) = 0;
|
||||
|
||||
/**
|
||||
* Set short frame
|
||||
* @param i if shortframe i=1
|
||||
* Set the Frequency of Frames Sent to GUI
|
||||
* @param i 0 for random frame requests, n for nth frame frequency
|
||||
*/
|
||||
virtual int setShortFrame(int i) = 0;
|
||||
virtual void setFrameToGuiFrequency(const uint32_t i) = 0;
|
||||
|
||||
/**
|
||||
* Set the variable to send every nth frame to gui
|
||||
* or if 0,send frame only upon gui request
|
||||
* Set Acquisition Period
|
||||
* @param i acquisition period
|
||||
*/
|
||||
virtual int setNFrameToGui(int i) = 0;
|
||||
virtual void setAcquisitionPeriod(const uint64_t i) = 0;
|
||||
|
||||
/**
|
||||
* Resets the Total Frames Caught
|
||||
* This is how the receiver differentiates between entire acquisitions
|
||||
* Returns 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: (Not implemented)
|
||||
* @param i number of frames expected
|
||||
*/
|
||||
virtual void resetTotalFramesCaught() = 0;
|
||||
|
||||
/** enabl data compression, by saving only hits
|
||||
/returns if failed
|
||||
*/
|
||||
virtual int enableDataCompression(bool enable) = 0;
|
||||
virtual void setNumberOfFrames(const uint64_t i) = 0;
|
||||
|
||||
/**
|
||||
* enable 10Gbe
|
||||
@param enable 1 for 10Gbe or 0 for 1 Gbe, -1 to read out
|
||||
\returns enable for 10Gbe
|
||||
* Set Dynamic Range or Number of Bits Per Pixel
|
||||
* @param i dynamic range that is 4, 8, 16 or 32
|
||||
*/
|
||||
virtual int enableTenGiga(int enable = -1) = 0;
|
||||
virtual void setDynamicRange(const uint32_t i) = 0;
|
||||
|
||||
/**
|
||||
* Returns the buffer-current frame read by receiver
|
||||
* @param c pointer to current file name
|
||||
* @param raw address of pointer, pointing to current frame to send to gui
|
||||
* @param startAcquisitionIndex is the start index of the acquisition
|
||||
* @param startFrameIndex is the start index of the scan
|
||||
* Set Ten Giga Enable
|
||||
* @param b true if 10Giga enabled, else false (1G enabled)
|
||||
*/
|
||||
virtual void readFrame(char* c,char** raw, uint32_t &startAcquisitionIndex, uint32_t &startFrameIndex)=0;
|
||||
virtual void setTenGigaEnable(const bool b) = 0;
|
||||
|
||||
/** set status to transmitting and
|
||||
* when fifo is empty later, sets status to run_finished
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Sets detector hostname (and corresponding detector variables in derived REST class)
|
||||
* It is second function called by the client when connecting to receiver.
|
||||
* you can call this function only once. //FIXME: is this still valid, this implemented in derived REST class?
|
||||
* @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)
|
||||
*/
|
||||
void resetAcquisitionCount();
|
||||
|
||||
/**
|
||||
* 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 the udp sockets
|
||||
* \returns if success or fail
|
||||
* \returns OK or FAIL
|
||||
*/
|
||||
virtual int shutDownUDPSockets() = 0;
|
||||
|
||||
/**
|
||||
* Closes all files
|
||||
* @param ithr thread index, -1 for all threads
|
||||
* Get the buffer-current frame read by receiver
|
||||
* @param c pointer to current file name
|
||||
* @param raw address of pointer, pointing to current frame to send to gui
|
||||
* @param startAcquisitionIndex start index of the acquisition
|
||||
* @param startFrameIndex start index of the scan
|
||||
*/
|
||||
virtual void closeFile(int ithr = -1) = 0;
|
||||
virtual void readFrame(char* c,char** raw, uint64_t &startAcquisitionIndex, uint64_t &startFrameIndex)=0;
|
||||
|
||||
/**
|
||||
* Call back for start acquisition
|
||||
callback arguments are
|
||||
filepath
|
||||
filename
|
||||
fileindex
|
||||
datasize
|
||||
|
||||
return value is
|
||||
0 callback takes care of open,close,wrie file
|
||||
1 callback writes file, we have to open, close it
|
||||
2 we open, close, write file, callback does not do anything
|
||||
* abort acquisition with minimum damage: close open files, cleanup.
|
||||
* does nothing if state already is 'idle'
|
||||
*/
|
||||
virtual void registerCallBackStartAcquisition(int (*func)(char*, char*,int, int, void*),void *arg) = 0;
|
||||
virtual void abort() = 0; //FIXME: needed, isnt stopReceiver enough?
|
||||
|
||||
/**
|
||||
* Closes all files
|
||||
* @param i thread index, -1 for all threads
|
||||
*/
|
||||
virtual void closeFile(int i = -1) = 0;
|
||||
|
||||
|
||||
//***callback functions***
|
||||
/**
|
||||
* Call back for start acquisition
|
||||
* callback arguments are
|
||||
* filepath
|
||||
* filename
|
||||
* fileindex
|
||||
* datasize
|
||||
*
|
||||
* return value is
|
||||
* 0 callback takes care of open,close,wrie file
|
||||
* 1 callback writes file, we have to open, close it
|
||||
* 2 we open, close, write file, callback does not do anything
|
||||
*/
|
||||
virtual void registerCallBackStartAcquisition(int (*func)(char*, char*,uint64_t, uint32_t, void*),void *arg) = 0;
|
||||
|
||||
/**
|
||||
* Call back for acquisition finished
|
||||
callback argument is
|
||||
total frames caught
|
||||
* callback argument is
|
||||
* total frames caught
|
||||
*/
|
||||
virtual void registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg) = 0;
|
||||
virtual void registerCallBackAcquisitionFinished(void (*func)(uint64_t, void*),void *arg) = 0;
|
||||
|
||||
/**
|
||||
* Call back for raw data
|
||||
args to raw data ready callback are
|
||||
framenum
|
||||
datapointer
|
||||
datasize in bytes
|
||||
file descriptor
|
||||
guidatapointer (NULL, no data required)
|
||||
* args to raw data ready callback are
|
||||
* framenum
|
||||
* datapointer
|
||||
* datasize in bytes
|
||||
* file descriptor
|
||||
* guidatapointer (NULL, no data required)
|
||||
*/
|
||||
virtual void registerCallBackRawDataReady(void (*func)(int, char*, int, FILE*, char*, void*),void *arg) = 0;
|
||||
virtual void registerCallBackRawDataReady(void (*func)(uint64_t, char*, uint32_t, FILE*, char*, void*),void *arg) = 0;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
@ -24,6 +24,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
@ -199,7 +200,7 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
|
||||
* Set detector hostname
|
||||
* @param c hostname
|
||||
*/
|
||||
void initialize(const char *detectorHostName);
|
||||
void setDetectorHostname(const char *detectorHostName);
|
||||
|
||||
/* Returns detector hostname
|
||||
/returns hostname
|
||||
@ -484,6 +485,224 @@ private:
|
||||
void handleDataCompression(int ithread, char* wbuffer[], char* data, int xmax, int ymax, int &nf);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** max number of writer threads */
|
||||
const static int MAX_NUM_WRITER_THREADS = 15;
|
||||
|
||||
/** missing packet identifier value */
|
||||
const static uint16_t missingPacketValue = 0xFFFF;
|
||||
|
||||
|
||||
/** UDP Socket between Receiver and Detector */
|
||||
genericSocket* udpSocket[MAX_NUM_LISTENING_THREADS];
|
||||
|
||||
/** max packets per file **/
|
||||
int maxPacketsPerFile;
|
||||
|
||||
/** Frame Index at start of an entire acquisition (including all scans) */
|
||||
uint64_t startAcquisitionIndex;
|
||||
/** Complete File name */
|
||||
char savefilename[MAX_STR_LENGTH];
|
||||
|
||||
/* Measurement started */
|
||||
bool measurementStarted;
|
||||
/* Acquisition started */
|
||||
bool acqStarted;
|
||||
/** Frame index at start of each real time acquisition (eg. for each scan) */
|
||||
uint32_t startFrameIndex;
|
||||
|
||||
/** Actual current frame index of each time acquisition (eg. for each scan) */
|
||||
uint32_t frameIndex;
|
||||
|
||||
/** Pckets currently in current file, starts new file when it reaches max */
|
||||
uint32_t packetsInFile;
|
||||
|
||||
/** Number of missing packets in acquisition*/
|
||||
uint32_t numTotMissingPackets;
|
||||
|
||||
/** Number of missing packets in file (sometimes packetsinFile is incorrect due to padded packets for eiger)*/
|
||||
uint32_t numTotMissingPacketsInFile;
|
||||
|
||||
/** Number of missing packets per buffer*/
|
||||
uint32_t numMissingPackets;
|
||||
|
||||
/** frame index mask */
|
||||
uint32_t frameIndexMask;
|
||||
|
||||
/** packet index mask */
|
||||
uint32_t packetIndexMask;
|
||||
|
||||
/** frame index offset */
|
||||
int frameIndexOffset;
|
||||
/** Current Frame Number */
|
||||
uint64_t currframenum;
|
||||
|
||||
/** Previous Frame number from buffer */
|
||||
int prevframenum;
|
||||
|
||||
/** size of one frame */
|
||||
int frameSize;
|
||||
|
||||
/** buffer size. different from framesize as we wait for one packet instead of frame for eiger */
|
||||
int bufferSize;
|
||||
|
||||
/** one buffer size */
|
||||
int onePacketSize;
|
||||
|
||||
/** one buffer size */
|
||||
int oneDataSize;
|
||||
|
||||
/** latest data */
|
||||
char* latestData;
|
||||
|
||||
/** gui data ready */
|
||||
int guiDataReady;
|
||||
|
||||
/** points to the data to send to gui */
|
||||
char* guiData;
|
||||
|
||||
/** points to the filename to send to gui */
|
||||
char* guiFileName;
|
||||
|
||||
/** fifo size */
|
||||
unsigned int fifosize;
|
||||
|
||||
/** number of jobs per thread for data compression */
|
||||
int numJobsPerThread;
|
||||
|
||||
/** memory allocated for the buffer */
|
||||
char *mem0[MAX_NUM_LISTENING_THREADS];
|
||||
|
||||
/** circular fifo to store addresses of data read */
|
||||
CircularFifo<char>* fifo[MAX_NUM_LISTENING_THREADS];
|
||||
|
||||
/** circular fifo to store addresses of data already written and ready to be resued*/
|
||||
CircularFifo<char>* fifoFree[MAX_NUM_LISTENING_THREADS];
|
||||
|
||||
/** Receiver buffer */
|
||||
char *buffer[MAX_NUM_LISTENING_THREADS];
|
||||
|
||||
/** number of writer threads */
|
||||
int numListeningThreads;
|
||||
|
||||
/** number of writer threads */
|
||||
int numWriterThreads;
|
||||
|
||||
/** to know if listening and writer threads created properly */
|
||||
int thread_started;
|
||||
|
||||
/** current listening thread index*/
|
||||
int currentListeningThreadIndex;
|
||||
|
||||
/** current writer thread index*/
|
||||
int currentWriterThreadIndex;
|
||||
|
||||
/** thread listening to packets */
|
||||
pthread_t listening_thread[MAX_NUM_LISTENING_THREADS];
|
||||
|
||||
/** thread writing packets */
|
||||
pthread_t writing_thread[MAX_NUM_WRITER_THREADS];
|
||||
|
||||
/** total frame count the listening thread has listened to */
|
||||
int totalListeningFrameCount[MAX_NUM_LISTENING_THREADS];
|
||||
|
||||
/** mask showing which listening threads are running */
|
||||
volatile uint32_t listeningthreads_mask;
|
||||
|
||||
/** mask showing which writer threads are running */
|
||||
volatile uint32_t writerthreads_mask;
|
||||
|
||||
/** mask showing which threads have created files*/
|
||||
volatile uint32_t createfile_mask;
|
||||
|
||||
/** OK if file created was successful */
|
||||
int ret_createfile;
|
||||
|
||||
/** variable used to self terminate threads waiting for semaphores */
|
||||
int killAllListeningThreads;
|
||||
|
||||
/** variable used to self terminate threads waiting for semaphores */
|
||||
int killAllWritingThreads;
|
||||
|
||||
|
||||
|
||||
/** footer offset is different for 1g and 10g*/
|
||||
int footer_offset;
|
||||
|
||||
// TODO: not properly sure where to put these...
|
||||
/** structure of an eiger image header*/
|
||||
|
||||
|
||||
|
||||
|
||||
//semaphores
|
||||
/** semaphore to synchronize writer and guireader threads */
|
||||
sem_t smp;
|
||||
/** semaphore to synchronize listener threads */
|
||||
sem_t listensmp[MAX_NUM_LISTENING_THREADS];
|
||||
/** semaphore to synchronize writer threads */
|
||||
sem_t writersmp[MAX_NUM_WRITER_THREADS];
|
||||
|
||||
|
||||
//mutex
|
||||
/** guiDataReady mutex */
|
||||
pthread_mutex_t dataReadyMutex;
|
||||
|
||||
/** mutex for status */
|
||||
pthread_mutex_t status_mutex;
|
||||
|
||||
/** mutex for progress variable currframenum */
|
||||
pthread_mutex_t progress_mutex;
|
||||
|
||||
/** mutex for writing data to file */
|
||||
pthread_mutex_t write_mutex;
|
||||
|
||||
/** File Descriptor */
|
||||
FILE *sfilefd;
|
||||
|
||||
//filter
|
||||
singlePhotonDetector<uint16_t> *singlePhotonDet[MAX_NUM_WRITER_THREADS];
|
||||
slsReceiverData<uint16_t> *receiverdata[MAX_NUM_WRITER_THREADS];
|
||||
moenchCommonMode *cmSub;
|
||||
bool commonModeSubtractionEnable;
|
||||
|
||||
#ifdef MYROOT1
|
||||
/** Tree where the hits are stored */
|
||||
TTree *myTree[MAX_NUM_WRITER_THREADS];
|
||||
|
||||
/** File where the tree is saved */
|
||||
TFile *myFile[MAX_NUM_WRITER_THREADS];
|
||||
#endif
|
||||
|
||||
|
||||
/** The action which decides what the user and default responsibilites to save data are
|
||||
* 0 raw data ready callback takes care of open,close,write file
|
||||
* 1 callback writes file, we have to open, close it
|
||||
* 2 we open, close, write file, callback does not do anything */
|
||||
int cbAction;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -20,7 +20,6 @@ using namespace std;
|
||||
|
||||
using namespace std;
|
||||
|
||||
// TODO: I do not really like passing a bottom-top boolean to the constructor...
|
||||
UDPInterface * UDPInterface::create(string receiver_type){
|
||||
|
||||
if (receiver_type == "standard"){
|
||||
|
@ -517,13 +517,15 @@ slsReceiverDefs::runStatus UDPStandardImplementation::getStatus() const{
|
||||
}
|
||||
|
||||
|
||||
void UDPStandardImplementation::initialize(const char *detectorHostName){
|
||||
void UDPStandardImplementation::setDetectorHostname(const char *detectorHostName){
|
||||
if(strlen(detectorHostName))
|
||||
strcpy(detHostname,detectorHostName);
|
||||
}
|
||||
|
||||
|
||||
char *UDPStandardImplementation::getDetectorHostname() const{
|
||||
if(!strlen(detHostname))
|
||||
return NULL;
|
||||
return (char*)detHostname;
|
||||
}
|
||||
|
||||
|
@ -320,7 +320,7 @@ int slsReceiverTCPIPInterface::decode_function(){
|
||||
//calling function
|
||||
(this->*flist[fnum])();
|
||||
if (ret==FAIL)
|
||||
cout << "Error executing the function = " << fnum << endl;
|
||||
cprintf(RED, "Error executing the function = %d\n",fnum);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -358,7 +358,7 @@ void slsReceiverTCPIPInterface::staticCloseFile(int p){
|
||||
|
||||
int slsReceiverTCPIPInterface::set_detector_type(){
|
||||
ret=OK;
|
||||
int retval=FAIL;
|
||||
detectorType retval=GENERIC;
|
||||
detectorType dr;
|
||||
strcpy(mess,"Could not set detector type range\n");
|
||||
|
||||
@ -377,20 +377,35 @@ int slsReceiverTCPIPInterface::set_detector_type(){
|
||||
ret=FAIL;
|
||||
}
|
||||
else{
|
||||
myDetectorType = dr;
|
||||
|
||||
switch(dr){
|
||||
case GOTTHARD:
|
||||
case PROPIX:
|
||||
case MOENCH:
|
||||
case EIGER:
|
||||
case JUNGFRAUCTB:
|
||||
case JUNGFRAU:
|
||||
break;
|
||||
default:
|
||||
sprintf(mess,"Unknown detector type: %d\n", dr);
|
||||
ret = FAIL;
|
||||
break;
|
||||
if(ret != FAIL){
|
||||
#ifndef REST
|
||||
receiverBase = UDPInterface::create("standard");
|
||||
receiverBase->setBottom(bottom);
|
||||
receiverBase->setBottomEnable(bottom);
|
||||
#endif
|
||||
ret=receiverBase->setDetectorType(dr);
|
||||
myDetectorType = dr;
|
||||
ret=receiverBase->setDetectorType(myDetectorType);
|
||||
retval = myDetectorType;
|
||||
}
|
||||
}
|
||||
}
|
||||
//#ifdef VERBOSE
|
||||
if(ret!=FAIL)
|
||||
cout << "detector type" << dr << endl;
|
||||
else
|
||||
cout << mess << endl;
|
||||
cprintf(RED, "%s\n", mess);
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
@ -417,7 +432,8 @@ int slsReceiverTCPIPInterface::set_detector_type(){
|
||||
|
||||
int slsReceiverTCPIPInterface::set_file_name() {
|
||||
ret=OK;
|
||||
char retval[MAX_STR_LENGTH]="";
|
||||
char* retval[MAX_STR_LENGTH] = NULL;
|
||||
char defaultVal[MAX_STR_LENGTH] = "";
|
||||
char fName[MAX_STR_LENGTH];
|
||||
strcpy(mess,"Could not set file name");
|
||||
|
||||
@ -439,8 +455,12 @@ int slsReceiverTCPIPInterface::set_file_name() {
|
||||
strcpy(mess,"Receiver not set up\n");
|
||||
ret=FAIL;
|
||||
}
|
||||
else
|
||||
strcpy(retval,receiverBase->setFileName(fName));
|
||||
else{
|
||||
receiverBase->setFileName(fName);
|
||||
retval = receiveBase->getFileName();
|
||||
if(retval == NULL)
|
||||
ret = FAIL;
|
||||
}
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
if(ret!=FAIL)
|
||||
@ -457,10 +477,16 @@ int slsReceiverTCPIPInterface::set_file_name() {
|
||||
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL)
|
||||
if(ret==FAIL){
|
||||
cprintf(RED, "%s\n", mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
socket->SendDataOnly(defaultVal,MAX_STR_LENGTH);
|
||||
}else
|
||||
socket->SendDataOnly(retval,MAX_STR_LENGTH);
|
||||
|
||||
//free
|
||||
if(retval != NULL) delete[] retval;
|
||||
|
||||
//return ok/fail
|
||||
return ret;
|
||||
}
|
||||
@ -472,7 +498,8 @@ int slsReceiverTCPIPInterface::set_file_name() {
|
||||
|
||||
int slsReceiverTCPIPInterface::set_file_dir() {
|
||||
ret=OK;
|
||||
char retval[MAX_STR_LENGTH]="";
|
||||
char* retval=NULL;
|
||||
char defaultVal[MAX_STR_LENGTH] = "";
|
||||
char fPath[MAX_STR_LENGTH];
|
||||
strcpy(mess,"Could not set file path\n");
|
||||
|
||||
@ -498,12 +525,11 @@ int slsReceiverTCPIPInterface::set_file_dir() {
|
||||
ret=FAIL;
|
||||
}
|
||||
else{
|
||||
strcpy(retval,receiverBase->setFilePath(fPath));
|
||||
// if file path doesnt exist
|
||||
if(strlen(fPath))
|
||||
if (strcmp(retval,fPath)){
|
||||
strcpy(mess,"receiver file path does not exist\n");
|
||||
receiverBase->setFilePath(fPath);
|
||||
retval = receiveBase->getFilePath();
|
||||
if(reval == NULL){
|
||||
ret = FAIL;
|
||||
strcpy(mess,"receiver file path does not exist\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -523,10 +549,16 @@ int slsReceiverTCPIPInterface::set_file_dir() {
|
||||
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL)
|
||||
if(ret==FAIL){
|
||||
cprintf(RED, "%s\n", mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
socket->SendDataOnly(defaultVal,MAX_STR_LENGTH);
|
||||
}else
|
||||
socket->SendDataOnly(retval,MAX_STR_LENGTH);
|
||||
|
||||
//free
|
||||
if(retval != NULL) delete[] retval;
|
||||
|
||||
//return ok/fail
|
||||
return ret;
|
||||
}
|
||||
@ -560,8 +592,13 @@ int slsReceiverTCPIPInterface::set_file_index() {
|
||||
strcpy(mess,"Receiver not set up\n");
|
||||
ret=FAIL;
|
||||
}
|
||||
else
|
||||
retval=receiverBase->setFileIndex(index);
|
||||
else{
|
||||
if(index >= 0)
|
||||
receiverBase->setFileIndex(index);
|
||||
retval=receiverBase->getFileIndex();
|
||||
if(index>=0 && retval!=index)
|
||||
ret = FAIL;
|
||||
}
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
if(ret!=FAIL)
|
||||
@ -578,8 +615,10 @@ int slsReceiverTCPIPInterface::set_file_index() {
|
||||
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL)
|
||||
if(ret==FAIL){
|
||||
cprintf(RED, "%s\n", mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
}
|
||||
socket->SendDataOnly(&retval,sizeof(retval));
|
||||
|
||||
//return ok/fail
|
||||
@ -617,8 +656,22 @@ int slsReceiverTCPIPInterface::set_frame_index() {
|
||||
strcpy(mess,"Receiver not set up\n");
|
||||
ret=FAIL;
|
||||
}
|
||||
else
|
||||
retval=receiverBase->setFrameIndexNeeded(index);
|
||||
else{
|
||||
//client sets to 0, but for receiver it is just an enable
|
||||
//client uses this value for other detectors not using receiver,
|
||||
//so implement the interface here
|
||||
|
||||
switch(index){
|
||||
case -1: index=0; break;
|
||||
default: index=1; break; //value is 0
|
||||
}
|
||||
receiverBase->setFrameIndexEnable(index);
|
||||
retval=receiverBase->getFrameIndexEnable();
|
||||
switch(retval){
|
||||
case 0: retval=-1; break;
|
||||
case 1: retval=0; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
if(ret!=FAIL)
|
||||
@ -635,8 +688,10 @@ int slsReceiverTCPIPInterface::set_frame_index() {
|
||||
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL)
|
||||
if(ret==FAIL){
|
||||
cprintf(RED, "%s\n", mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
}
|
||||
socket->SendDataOnly(&retval,sizeof(retval));
|
||||
|
||||
//return ok/fail
|
||||
@ -705,8 +760,8 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
||||
}
|
||||
FILE_LOG(logDEBUG) << __FILE__ << "::" << __func__ << " " << eth;
|
||||
receiverBase->setEthernetInterface(eth);
|
||||
|
||||
cout << eth << endl;
|
||||
|
||||
//get mac address from ethernet interface
|
||||
if (ret != FAIL)
|
||||
temp = genericSocket::nameToMac(eth);
|
||||
@ -715,7 +770,7 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
||||
if ((temp=="00:00:00:00:00:00") || (ret == FAIL)){
|
||||
ret = FAIL;
|
||||
strcpy(mess,"failed to get mac adddress to listen to\n");
|
||||
cout << "mess:" << mess << endl;
|
||||
cprintf(RED,"%s\n",mess);
|
||||
}
|
||||
else{
|
||||
strcpy(retval,temp.c_str());
|
||||
@ -733,8 +788,10 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
||||
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL)
|
||||
if(ret==FAIL){
|
||||
cprintf(RED, "%s\n", mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
}
|
||||
socket->SendDataOnly(retval,MAX_STR_LENGTH);
|
||||
|
||||
//return ok/fail
|
||||
@ -749,8 +806,7 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
||||
int slsReceiverTCPIPInterface::start_receiver(){
|
||||
ret=OK;
|
||||
ret=OK;
|
||||
enum runStatus s;
|
||||
char cstatus[15];
|
||||
enum runStatus s = ERROR;
|
||||
strcpy(mess,"Could not start receiver\n");
|
||||
|
||||
// execute action if the arguments correctly arrived
|
||||
@ -771,22 +827,13 @@ int slsReceiverTCPIPInterface::start_receiver(){
|
||||
}
|
||||
else {
|
||||
s = receiverBase->getStatus();
|
||||
switch (s) {
|
||||
case ERROR: strcpy(cstatus,"error"); break;
|
||||
case WAITING: strcpy(cstatus,"waiting"); break;
|
||||
case RUNNING: strcpy(cstatus,"running"); break;
|
||||
case TRANSMITTING: strcpy(cstatus,"data"); break;
|
||||
case RUN_FINISHED: strcpy(cstatus,"finished"); break;
|
||||
default: strcpy(cstatus,"idle"); break;
|
||||
}
|
||||
if(s == IDLE)
|
||||
ret=receiverBase->startReceiver(mess);
|
||||
else{
|
||||
sprintf(mess,"Cannot start Receiver as it is in %s state\n",cstatus);
|
||||
sprintf(mess,"Cannot start Receiver as it is in %s state\n",slsDetectorBase::runStatusType(s).c_str());
|
||||
ret=FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if(ret==OK && socket->differentClients){
|
||||
@ -797,6 +844,7 @@ int slsReceiverTCPIPInterface::start_receiver(){
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL){
|
||||
cprintf(RED, "%s\n", mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
}
|
||||
//return ok/fail
|
||||
@ -808,7 +856,7 @@ int slsReceiverTCPIPInterface::start_receiver(){
|
||||
|
||||
int slsReceiverTCPIPInterface::stop_receiver(){
|
||||
ret=OK;
|
||||
|
||||
enum runStatus s = ERROR;
|
||||
strcpy(mess,"Could not stop receiver\n");
|
||||
|
||||
// execute action if the arguments correctly arrived
|
||||
@ -821,8 +869,17 @@ int slsReceiverTCPIPInterface::stop_receiver(){
|
||||
strcpy(mess,"Receiver not set up\n");
|
||||
ret=FAIL;
|
||||
}
|
||||
else if(receiverBase->getStatus()!=IDLE)
|
||||
ret=receiverBase->stopReceiver();
|
||||
else{
|
||||
if(receiverBase->getStatus()!=IDLE)
|
||||
receiverBase->stopReceiver();
|
||||
s = receiverBase->getStatus();
|
||||
if(s==IDLE)
|
||||
ret = OK;
|
||||
else{
|
||||
sprintf(mess,"Could not stop receiver. It is in %s state\n",slsDetectorBase::runStatusType(s).c_str());
|
||||
ret = FAIL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if(ret==OK && socket->differentClients){
|
||||
@ -832,8 +889,10 @@ int slsReceiverTCPIPInterface::stop_receiver(){
|
||||
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL)
|
||||
if(ret==FAIL){
|
||||
cprintf(RED, "%s\n", mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
}
|
||||
//return ok/fail
|
||||
return ret;
|
||||
|
||||
@ -860,8 +919,10 @@ int slsReceiverTCPIPInterface::get_status(){
|
||||
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL)
|
||||
if(ret==FAIL){
|
||||
cprintf(RED, "%s\n", mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
}
|
||||
socket->SendDataOnly(&retval,sizeof(retval));
|
||||
//return ok/fail
|
||||
return ret;
|
||||
@ -888,8 +949,10 @@ int slsReceiverTCPIPInterface::get_frames_caught(){
|
||||
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL)
|
||||
if(ret==FAIL){
|
||||
cprintf(RED, "%s\n", mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
}
|
||||
socket->SendDataOnly(&retval,sizeof(retval));
|
||||
//return ok/fail
|
||||
return ret;
|
||||
@ -918,8 +981,10 @@ int slsReceiverTCPIPInterface::get_frame_index(){
|
||||
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL)
|
||||
if(ret==FAIL){
|
||||
cprintf(RED, "%s\n", mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
}
|
||||
socket->SendDataOnly(&retval,sizeof(retval));
|
||||
//return ok/fail
|
||||
return ret;
|
||||
@ -946,7 +1011,7 @@ int slsReceiverTCPIPInterface::reset_frames_caught(){
|
||||
ret=FAIL;
|
||||
}
|
||||
else
|
||||
receiverBase->resetTotalFramesCaught();
|
||||
receiverBase->resetAcquisitionCount();
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -957,9 +1022,10 @@ int slsReceiverTCPIPInterface::reset_frames_caught(){
|
||||
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL)
|
||||
if(ret==FAIL){
|
||||
cprintf(RED, "%s\n", mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
|
||||
}
|
||||
//return ok/fail
|
||||
return ret;
|
||||
|
||||
@ -1006,7 +1072,8 @@ int slsReceiverTCPIPInterface::set_short_frame() {
|
||||
ret=FAIL;
|
||||
}
|
||||
else{
|
||||
retval=receiverBase->setShortFrame(index);
|
||||
receiverBase->setShortFrameEnable(index);
|
||||
retval = receiverBase->getShortFrameEnable();
|
||||
shortFrame = retval;
|
||||
if(shortFrame==-1)
|
||||
packetsPerFrame=GOTTHARD_PACKETS_PER_FRAME;
|
||||
@ -1023,8 +1090,10 @@ int slsReceiverTCPIPInterface::set_short_frame() {
|
||||
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL)
|
||||
if(ret==FAIL){
|
||||
cprintf(RED, "%s\n", mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
}
|
||||
socket->SendDataOnly(&retval,sizeof(retval));
|
||||
|
||||
//return ok/fail
|
||||
@ -1088,7 +1157,6 @@ int slsReceiverTCPIPInterface::moench_read_frame(){
|
||||
|
||||
else{
|
||||
ret = OK;
|
||||
/*startIndex=receiverBase->getStartFrameIndex();*/
|
||||
receiverBase->readFrame(fName,&raw,startAcquisitionIndex,startFrameIndex);
|
||||
|
||||
/**send garbage with -1 index to try again*/
|
||||
@ -1203,7 +1271,7 @@ int slsReceiverTCPIPInterface::moench_read_frame(){
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL){
|
||||
cout << "mess:" << mess << endl;
|
||||
cprintf(RED,"%s\n",mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
}
|
||||
else{
|
||||
@ -1277,7 +1345,6 @@ int slsReceiverTCPIPInterface::gotthard_read_frame(){
|
||||
cout<<"haven't caught any frame yet"<<endl;
|
||||
}else{
|
||||
ret = OK;
|
||||
/*startIndex=receiverBase->getStartFrameIndex();*/
|
||||
receiverBase->readFrame(fName,&raw,startAcquisitionIndex,startFrameIndex);
|
||||
|
||||
/**send garbage with -1 index to try again*/
|
||||
@ -1385,7 +1452,7 @@ int slsReceiverTCPIPInterface::gotthard_read_frame(){
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL){
|
||||
cout << "mess:" << mess << endl;
|
||||
cprintf(RED,"%s\n",mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
}
|
||||
else{
|
||||
@ -1453,7 +1520,6 @@ int slsReceiverTCPIPInterface::propix_read_frame(){
|
||||
cout<<"haven't caught any frame yet"<<endl;
|
||||
}else{
|
||||
ret = OK;
|
||||
/*startIndex=receiverBase->getStartFrameIndex();*/
|
||||
receiverBase->readFrame(fName,&raw,startAcquisitionIndex,startFrameIndex);
|
||||
|
||||
/**send garbage with -1 index to try again*/
|
||||
@ -1540,7 +1606,7 @@ int slsReceiverTCPIPInterface::propix_read_frame(){
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL){
|
||||
cout << "mess:" << mess << endl;
|
||||
cprintf(RED,"%s\n",mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
}
|
||||
else{
|
||||
@ -1802,7 +1868,7 @@ int slsReceiverTCPIPInterface::eiger_read_frame(){
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL){
|
||||
cout << "mess:" << mess << endl;
|
||||
cprintf(RED,"%s\n",mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
}
|
||||
else{
|
||||
@ -1855,8 +1921,13 @@ int slsReceiverTCPIPInterface::set_read_frequency(){
|
||||
ret = FAIL;
|
||||
strcpy(mess,"cannot set up receiver mode when receiver is running\n");
|
||||
}*/
|
||||
else
|
||||
retval=receiverBase->setNFrameToGui(index);
|
||||
else{
|
||||
if(index >= 0)
|
||||
receiverBase->setFrameToGuiFrequency(index);
|
||||
retval=receiverBase->getFrameToGuiFrequency();
|
||||
if(index>=0 && retval!=index)
|
||||
ret = FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -1868,8 +1939,10 @@ int slsReceiverTCPIPInterface::set_read_frequency(){
|
||||
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL)
|
||||
if(ret==FAIL){
|
||||
cprintf(RED,"%s\n",mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
}
|
||||
socket->SendDataOnly(&retval,sizeof(retval));
|
||||
|
||||
//return ok/fail
|
||||
@ -1907,9 +1980,9 @@ int slsReceiverTCPIPInterface::enable_file_write(){
|
||||
}
|
||||
else{
|
||||
if(enable >= 0)
|
||||
receiverBase->setEnableFileWrite(enable);
|
||||
retval=receiverBase->getEnableFileWrite();
|
||||
if((enable!=-1)&&(enable!=retval))
|
||||
receiverBase->setFileWriteEnable(enable);
|
||||
retval=receiverBase->getFileWriteEnable();
|
||||
if(enable>=0 && enable!=retval)
|
||||
ret=FAIL;
|
||||
}
|
||||
}
|
||||
@ -1922,8 +1995,10 @@ int slsReceiverTCPIPInterface::enable_file_write(){
|
||||
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL)
|
||||
if(ret==FAIL){
|
||||
cprintf(RED,"%s\n",mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
}
|
||||
socket->SendDataOnly(&retval,sizeof(retval));
|
||||
|
||||
//return ok/fail
|
||||
@ -1991,8 +2066,10 @@ int slsReceiverTCPIPInterface::start_readout(){
|
||||
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL)
|
||||
if(ret==FAIL){
|
||||
cprintf(RED,"%s\n",mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
}
|
||||
socket->SendDataOnly(&retval,sizeof(retval));
|
||||
//return ok/fail
|
||||
return ret;
|
||||
@ -2029,10 +2106,17 @@ int slsReceiverTCPIPInterface::set_timer() {
|
||||
ret=FAIL;
|
||||
}
|
||||
else{
|
||||
if(index[0] == slsReceiverDefs::FRAME_PERIOD)
|
||||
retval=receiverBase->setAcquisitionPeriod(index[1]);
|
||||
else
|
||||
retval=receiverBase->setNumberOfFrames(index[1]);
|
||||
if(index[0] == slsReceiverDefs::FRAME_PERIOD){
|
||||
if(index[1]>=0)
|
||||
receiverBase->setAcquisitionPeriod(index[1]);
|
||||
retval=receiverBase->getAcquisitionPeriod();
|
||||
}else{
|
||||
if(index[1]>=0)
|
||||
receiverBase->setNumberOfFrames(index[1]);
|
||||
retval=receiverBase->getNumberOfFrames();
|
||||
}
|
||||
if(index[1]>=0 && retval!=index[1])
|
||||
ret = FAIL;
|
||||
}
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
@ -2053,8 +2137,10 @@ int slsReceiverTCPIPInterface::set_timer() {
|
||||
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL)
|
||||
if(ret==FAIL){
|
||||
cprintf(RED,"%s\n",mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
}
|
||||
socket->SendDataOnly(&retval,sizeof(retval));
|
||||
|
||||
//return ok/fail
|
||||
@ -2095,15 +2181,21 @@ int slsReceiverTCPIPInterface::enable_compression() {
|
||||
strcpy(mess,"Cannot enable/disable compression while status is running\n");
|
||||
ret=FAIL;
|
||||
}
|
||||
else
|
||||
ret = receiverBase->enableDataCompression(enable);
|
||||
else{
|
||||
if(enable >= 0)
|
||||
receiverBase->setDataCompressionEnable(enable);
|
||||
}
|
||||
}
|
||||
|
||||
if (receiverBase == NULL){
|
||||
strcpy(mess,"Receiver not set up\n");
|
||||
ret=FAIL;
|
||||
}else
|
||||
retval=receiverBase->getDataCompression();
|
||||
}else{
|
||||
retval = receiverBase->getDataCompressionEnable();
|
||||
if(enable >= 0 && retval != enable)
|
||||
ret = FAIL;
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -2114,8 +2206,10 @@ int slsReceiverTCPIPInterface::enable_compression() {
|
||||
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL)
|
||||
if(ret==FAIL){
|
||||
cprintf(RED,"%s\n",mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
}
|
||||
socket->SendDataOnly(&retval,sizeof(retval));
|
||||
|
||||
//return ok/fail
|
||||
@ -2127,7 +2221,8 @@ int slsReceiverTCPIPInterface::enable_compression() {
|
||||
|
||||
int slsReceiverTCPIPInterface::set_detector_hostname() {
|
||||
ret=OK;
|
||||
char retval[MAX_STR_LENGTH]="";
|
||||
char* retval = NULL;
|
||||
char defaultVal[MAX_STR_LENGTH] = "";
|
||||
char hostname[MAX_STR_LENGTH]="";
|
||||
strcpy(mess,"Could not set detector hostname");
|
||||
|
||||
@ -2151,7 +2246,10 @@ int slsReceiverTCPIPInterface::set_detector_hostname() {
|
||||
}
|
||||
else{
|
||||
receiverBase->initialize(hostname);
|
||||
strcpy(retval,receiverBase->getDetectorHostname());
|
||||
retval = receiverBase->getDetectorHostname();
|
||||
if(retval == NULL){
|
||||
ret = FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
@ -2169,9 +2267,14 @@ int slsReceiverTCPIPInterface::set_detector_hostname() {
|
||||
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL)
|
||||
if(ret==FAIL){
|
||||
cprintf(RED,"%s\n",mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
socket->SendDataOnly(retval,MAX_STR_LENGTH);
|
||||
socket->SendDataOnly(defaultVal,MAX_STR_LENGTH);
|
||||
}else socket->SendDataOnly(retval,MAX_STR_LENGTH);
|
||||
|
||||
//free
|
||||
if(retval!=NULL) delete[] retval;
|
||||
|
||||
//return ok/fail
|
||||
return ret;
|
||||
@ -2203,14 +2306,14 @@ int slsReceiverTCPIPInterface::set_dynamic_range() {
|
||||
sprintf(mess,"Receiver locked by %s\n", socket->lastClientIP);
|
||||
ret=FAIL;
|
||||
}
|
||||
else if ((dr>0) && (myDetectorType == EIGER)){
|
||||
else if (dr>0) {
|
||||
switch(dr){
|
||||
case 4:
|
||||
case 8:
|
||||
case 16:
|
||||
case 32:break;
|
||||
default:
|
||||
sprintf(mess,"This dynamic range does not exist for eiger: %d\n",dr);
|
||||
sprintf(mess,"This dynamic range does not exist: %d\n",dr);
|
||||
cprintf(RED,"%s", mess);
|
||||
ret=FAIL;
|
||||
break;
|
||||
@ -2221,8 +2324,12 @@ int slsReceiverTCPIPInterface::set_dynamic_range() {
|
||||
strcpy(mess,"Receiver not set up\n");
|
||||
ret=FAIL;
|
||||
}else{
|
||||
if(dr > 0) receiverBase->setDynamicRange(dr);
|
||||
if(dr > 0)
|
||||
receiverBase->setDynamicRange(dr);
|
||||
retval = receiverBase->getDynamicRange();
|
||||
if(dr > 0 && retval != dr)
|
||||
ret = FAIL;
|
||||
else{
|
||||
dynamicrange = retval;
|
||||
if(myDetectorType == EIGER){
|
||||
if(!tenGigaEnable)
|
||||
@ -2233,6 +2340,7 @@ int slsReceiverTCPIPInterface::set_dynamic_range() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
if(ret!=FAIL)
|
||||
cout << "dynamic range" << dr << endl;
|
||||
@ -2248,8 +2356,10 @@ int slsReceiverTCPIPInterface::set_dynamic_range() {
|
||||
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL)
|
||||
if(ret==FAIL){
|
||||
cprintf(RED,"%s\n",mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
}
|
||||
socket->SendDataOnly(&retval,sizeof(retval));
|
||||
|
||||
//return ok/fail
|
||||
@ -2288,8 +2398,10 @@ int slsReceiverTCPIPInterface::enable_overwrite() {
|
||||
}
|
||||
else{
|
||||
if(index >= 0)
|
||||
receiverBase->setEnableOverwrite(index);
|
||||
retval=receiverBase->getEnableOverwrite();
|
||||
receiverBase->setOverwriteEnable(index);
|
||||
retval=receiverBase->getOverwriteEnable();
|
||||
if(index >=0 && retval != index)
|
||||
ret = FAIL;
|
||||
}
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
@ -2307,8 +2419,10 @@ int slsReceiverTCPIPInterface::enable_overwrite() {
|
||||
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL)
|
||||
if(ret==FAIL){
|
||||
cprintf(RED,"%s\n",mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
}
|
||||
socket->SendDataOnly(&retval,sizeof(retval));
|
||||
|
||||
//return ok/fail
|
||||
@ -2346,8 +2460,10 @@ int slsReceiverTCPIPInterface::enable_tengiga() {
|
||||
ret=FAIL;
|
||||
}
|
||||
else{
|
||||
retval=receiverBase->enableTenGiga(val);
|
||||
if((val!=-1) && (val != retval))
|
||||
if(val >= 0)
|
||||
receiverBase->setDataCompressionEnable(val);
|
||||
retval=receiverBase->getDataCompressionEnable();
|
||||
if((val >= 0) && (val != retval))
|
||||
ret = FAIL;
|
||||
else
|
||||
tenGigaEnable = retval;
|
||||
@ -2368,8 +2484,10 @@ int slsReceiverTCPIPInterface::enable_tengiga() {
|
||||
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL)
|
||||
if(ret==FAIL){
|
||||
cprintf(RED,"%s\n",mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
}
|
||||
socket->SendDataOnly(&retval,sizeof(retval));
|
||||
|
||||
//return ok/fail
|
||||
@ -2436,8 +2554,10 @@ int slsReceiverTCPIPInterface::lock_receiver() {
|
||||
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if (ret==FAIL)
|
||||
if(ret==FAIL){
|
||||
cprintf(RED,"%s\n",mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
}
|
||||
else
|
||||
socket->SendDataOnly(&lockStatus,sizeof(lockStatus));
|
||||
|
||||
@ -2510,6 +2630,7 @@ int slsReceiverTCPIPInterface::set_port() {
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL){
|
||||
cprintf(RED,"%s\n",mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
}else {
|
||||
socket->SendDataOnly(&p_number,sizeof(p_number));
|
||||
@ -2550,7 +2671,8 @@ int slsReceiverTCPIPInterface::get_last_client_ip() {
|
||||
int slsReceiverTCPIPInterface::send_update() {
|
||||
ret=OK;
|
||||
int ind;
|
||||
char path[MAX_STR_LENGTH];
|
||||
char defaultVal[MAX_STR_LENGTH]="";
|
||||
char* path = NULL;
|
||||
|
||||
socket->SendDataOnly(socket->lastClientIP,sizeof(socket->lastClientIP));
|
||||
|
||||
@ -2564,17 +2686,26 @@ int slsReceiverTCPIPInterface::send_update() {
|
||||
|
||||
//filepath
|
||||
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||
strcpy(path,receiverBase->getFilePath());
|
||||
path = receiverBase->getFilePath();
|
||||
#endif
|
||||
if(path == NULL)
|
||||
socket->SendDataOnly(defaultVal,MAX_STR_LENGTH);
|
||||
else{
|
||||
socket->SendDataOnly(path,MAX_STR_LENGTH);
|
||||
delete[] path;
|
||||
}
|
||||
|
||||
|
||||
//filename
|
||||
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||
strcpy(path,receiverBase->getFileName());
|
||||
path = receiverBase->getFileName();
|
||||
#endif
|
||||
if(path == NULL)
|
||||
socket->SendDataOnly(defaultVal,MAX_STR_LENGTH);
|
||||
else{
|
||||
socket->SendDataOnly(path,MAX_STR_LENGTH);
|
||||
|
||||
delete[] path;
|
||||
}
|
||||
|
||||
if (lockStatus==0) {
|
||||
strcpy(socket->lastClientIP,socket->thisClientIP);
|
||||
@ -2598,6 +2729,7 @@ int slsReceiverTCPIPInterface::update_client() {
|
||||
}
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL){
|
||||
cprintf(RED,"%s\n",mess);
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
return ret;
|
||||
}
|
||||
@ -2616,7 +2748,7 @@ int slsReceiverTCPIPInterface::exit_server() {
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
strcpy(mess,"closing server");
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
cout << mess << endl;
|
||||
cprintf(RED,"%s\n",mess);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user