mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 23:30:03 +02:00
some more changes
This commit is contained in:
parent
92b73e0e88
commit
a3e88f96d6
@ -7,13 +7,12 @@
|
|||||||
***********************************************/
|
***********************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "sls_receiver_defs.h"
|
//#include "sls_receiver_defs.h"
|
||||||
#include "UDPInterface.h"
|
#include "UDPInterface.h"
|
||||||
#include <string.h>
|
//#include <stdio.h>
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @short does all the functions for a receiver, set/get parameters, start/stop etc.
|
* @short does all the base functions for a receiver, set/get parameters, start/stop etc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInterface {
|
class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInterface {
|
||||||
@ -123,13 +122,13 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
* Get UDP Port Number
|
* Get UDP Port Number
|
||||||
* @return udp port number
|
* @return udp port number
|
||||||
*/
|
*/
|
||||||
uint32_t getUDPPortNo() const;
|
uint32_t getUDPPortNumber() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Second UDP Port Number (eiger specific)
|
* Get Second UDP Port Number (eiger specific)
|
||||||
* @return second udp port number
|
* @return second udp port number
|
||||||
*/
|
*/
|
||||||
uint32_t getUDPPortNo2() const;
|
uint32_t getUDPPortNumber2() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Ehernet Interface
|
* Get Ehernet Interface
|
||||||
@ -254,9 +253,9 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
/**
|
/**
|
||||||
* Set data compression, by saving only hits (so far implemented only for Moench and Gotthard)
|
* Set data compression, by saving only hits (so far implemented only for Moench and Gotthard)
|
||||||
* @param b true for data compression enable, else false
|
* @param b true for data compression enable, else false
|
||||||
|
* @return OK or FAIL
|
||||||
*/
|
*/
|
||||||
void setDataCompressionEnable(const bool b);
|
int setDataCompressionEnable(const bool b);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//***connection parameters***
|
//***connection parameters***
|
||||||
@ -264,13 +263,13 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
* Set UDP Port Number
|
* Set UDP Port Number
|
||||||
* @param i udp port number
|
* @param i udp port number
|
||||||
*/
|
*/
|
||||||
void setUDPPortNo(const uint32_t i);
|
void setUDPPortNumber(const uint32_t i);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Second UDP Port Number (eiger specific)
|
* Set Second UDP Port Number (eiger specific)
|
||||||
* @return second udp port number
|
* @return second udp port number
|
||||||
*/
|
*/
|
||||||
void setUDPPortNo2(const uint32_t i);
|
void setUDPPortNumber2(const uint32_t i);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Ethernet Interface to listen to
|
* Set Ethernet Interface to listen to
|
||||||
@ -279,7 +278,7 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
void setEthernetInterface(const char* c);
|
void setEthernetInterface(const char* c);
|
||||||
|
|
||||||
|
|
||||||
//***connection parameters***
|
//***acquisition parameters***
|
||||||
/**
|
/**
|
||||||
* Set Short Frame Enabled, later will be moved to getROI (so far only for gotthard)
|
* 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
|
* @param i index of adc enabled, else -1 if all enabled
|
||||||
@ -289,14 +288,16 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
/**
|
/**
|
||||||
* Set the Frequency of Frames Sent to GUI
|
* Set the Frequency of Frames Sent to GUI
|
||||||
* @param i 0 for random frame requests, n for nth frame frequency
|
* @param i 0 for random frame requests, n for nth frame frequency
|
||||||
|
* @return OK or FAIL
|
||||||
*/
|
*/
|
||||||
void setFrameToGuiFrequency(const uint32_t i);
|
int setFrameToGuiFrequency(const uint32_t i);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Acquisition Period
|
* Set Acquisition Period
|
||||||
* @param i acquisition period
|
* @param i acquisition period
|
||||||
|
* @return OK or FAIL
|
||||||
*/
|
*/
|
||||||
void setAcquisitionPeriod(const uint64_t i);
|
int setAcquisitionPeriod(const uint64_t i);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Number of Frames expected by receiver from detector
|
* Set Number of Frames expected by receiver from detector
|
||||||
@ -308,15 +309,16 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
/**
|
/**
|
||||||
* Set Dynamic Range or Number of Bits Per Pixel
|
* Set Dynamic Range or Number of Bits Per Pixel
|
||||||
* @param i dynamic range that is 4, 8, 16 or 32
|
* @param i dynamic range that is 4, 8, 16 or 32
|
||||||
|
* @return OK or FAIL
|
||||||
*/
|
*/
|
||||||
void setDynamicRange(const uint32_t i);
|
int setDynamicRange(const uint32_t i);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Ten Giga Enable
|
* Set Ten Giga Enable
|
||||||
* @param b true if 10Giga enabled, else false (1G enabled)
|
* @param b true if 10Giga enabled, else false (1G enabled)
|
||||||
|
* @return OK or FAIL
|
||||||
*/
|
*/
|
||||||
void setTenGigaEnable(const bool b);
|
int setTenGigaEnable(const bool b);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
@ -324,6 +326,7 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
* They may modify the status of the receiver ****************************
|
* They may modify the status of the receiver ****************************
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
//***initial functions***
|
//***initial functions***
|
||||||
/**
|
/**
|
||||||
* Set receiver type (and corresponding detector variables in derived STANDARD class)
|
* Set receiver type (and corresponding detector variables in derived STANDARD class)
|
||||||
@ -387,7 +390,7 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
* abort acquisition with minimum damage: close open files, cleanup.
|
* abort acquisition with minimum damage: close open files, cleanup.
|
||||||
* does nothing if state already is 'idle'
|
* does nothing if state already is 'idle'
|
||||||
*/
|
*/
|
||||||
void abort(); //FIXME: needed, isnt stopReceiver enough?
|
void abort(); //FIXME: needed, isn't stopReceiver enough?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes all files
|
* Closes all files
|
||||||
@ -436,36 +439,12 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
//**detector parameters***
|
//**detector parameters***
|
||||||
/**
|
|
||||||
* structure of an eiger packet header
|
|
||||||
* subframenum subframe number for 32 bit mode (already written by firmware)
|
|
||||||
* missingpacket explicitly put to 0xFF to recognize it in file read (written by software)
|
|
||||||
* portnum 0 for the first port and 1 for the second port (written by software to file)
|
|
||||||
* dynamicrange dynamic range or bits per pixel (written by software to file)
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
unsigned char subframenum[4];
|
|
||||||
unsigned char missingpacket[2];
|
|
||||||
unsigned char portnum[1];
|
|
||||||
unsigned char dynamicrange[1];
|
|
||||||
} eiger_packet_header_t;
|
|
||||||
/**
|
|
||||||
* structure of an eiger packet footer
|
|
||||||
* framenum 48 bit frame number (already written by firmware)
|
|
||||||
* packetnum packet number (already written by firmware)
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
unsigned char framenum[6];
|
|
||||||
unsigned char packetnum[2];
|
|
||||||
} eiger_packet_footer_t;
|
|
||||||
|
|
||||||
|
|
||||||
/** detector type */
|
/** detector type */
|
||||||
detectorType myDetectorType;
|
detectorType myDetectorType;
|
||||||
/** detector hostname */
|
/** detector hostname */
|
||||||
char detHostname[MAX_STR_LENGTH];
|
char detHostname[MAX_STR_LENGTH];
|
||||||
/** Number of Packets per Frame*/
|
/** Number of Packets per Frame*/
|
||||||
uint64_t packetsPerFrame;
|
uint32_t packetsPerFrame;
|
||||||
/** Acquisition Period */
|
/** Acquisition Period */
|
||||||
int64_t acquisitionPeriod;
|
int64_t acquisitionPeriod;
|
||||||
/** Frame Number */
|
/** Frame Number */
|
||||||
@ -479,7 +458,7 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
|
|
||||||
//***receiver parameters***
|
//***receiver parameters***
|
||||||
/** Maximum Number of Listening Threads/ UDP Ports */
|
/** Maximum Number of Listening Threads/ UDP Ports */
|
||||||
const static int MAX_NUM_LISTENING_THREADS = 2;
|
const static int MAX_NUMBER_OF_LISTENING_THREADS = 2;
|
||||||
/** Receiver Status */
|
/** Receiver Status */
|
||||||
runStatus status;
|
runStatus status;
|
||||||
|
|
||||||
@ -487,7 +466,7 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
/** Ethernet Interface */
|
/** Ethernet Interface */
|
||||||
char eth[MAX_STR_LENGTH];
|
char eth[MAX_STR_LENGTH];
|
||||||
/** Server UDP Port Number*/
|
/** Server UDP Port Number*/
|
||||||
uint32_t udpPortNum[MAX_NUM_LISTENING_THREADS];
|
uint32_t udpPortNum[MAX_NUMBER_OF_LISTENING_THREADS];
|
||||||
|
|
||||||
//***file parameters***
|
//***file parameters***
|
||||||
/** 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)*/
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
|
|
||||||
#include "sls_receiver_defs.h"
|
#include "sls_receiver_defs.h"
|
||||||
#include "receiver_defs.h"
|
#include "receiver_defs.h"
|
||||||
#include "MySocketTCP.h"
|
|
||||||
|
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
|
|
||||||
@ -184,13 +182,13 @@ class UDPInterface {
|
|||||||
* Get UDP Port Number
|
* Get UDP Port Number
|
||||||
* @return udp port number
|
* @return udp port number
|
||||||
*/
|
*/
|
||||||
virtual uint32_t getUDPPortNo() const = 0;
|
virtual uint32_t getUDPPortNumber() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Second UDP Port Number (eiger specific)
|
* Get Second UDP Port Number (eiger specific)
|
||||||
* @return second udp port number
|
* @return second udp port number
|
||||||
*/
|
*/
|
||||||
virtual uint32_t getUDPPortNo2() const = 0;
|
virtual uint32_t getUDPPortNumber2() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Ehernet Interface
|
* Get Ehernet Interface
|
||||||
@ -314,22 +312,22 @@ class UDPInterface {
|
|||||||
/**
|
/**
|
||||||
* Set data compression, by saving only hits (so far implemented only for Moench and Gotthard)
|
* Set data compression, by saving only hits (so far implemented only for Moench and Gotthard)
|
||||||
* @param b true for data compression enable, else false
|
* @param b true for data compression enable, else false
|
||||||
|
* @return OK or FAIL
|
||||||
*/
|
*/
|
||||||
virtual void setDataCompressionEnable(const bool b) = 0;
|
virtual int setDataCompressionEnable(const bool b) = 0;
|
||||||
|
|
||||||
|
|
||||||
//***connection parameters***
|
//***connection parameters***
|
||||||
/**
|
/**
|
||||||
* Set UDP Port Number
|
* Set UDP Port Number
|
||||||
* @param i udp port number
|
* @param i udp port number
|
||||||
*/
|
*/
|
||||||
virtual void setUDPPortNo(const uint32_t i) = 0;
|
virtual void setUDPPortNumber(const uint32_t i) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Second UDP Port Number (eiger specific)
|
* Set Second UDP Port Number (eiger specific)
|
||||||
* @return second udp port number
|
* @return second udp port number
|
||||||
*/
|
*/
|
||||||
virtual void setUDPPortNo2(const uint32_t i) = 0;
|
virtual void setUDPPortNumber2(const uint32_t i) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Ethernet Interface to listen to
|
* Set Ethernet Interface to listen to
|
||||||
@ -338,7 +336,7 @@ class UDPInterface {
|
|||||||
virtual void setEthernetInterface(const char* c) = 0;
|
virtual void setEthernetInterface(const char* c) = 0;
|
||||||
|
|
||||||
|
|
||||||
//***connection parameters***
|
//***acquisition parameters***
|
||||||
/**
|
/**
|
||||||
* Set Short Frame Enabled, later will be moved to getROI (so far only for gotthard)
|
* 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
|
* @param i index of adc enabled, else -1 if all enabled
|
||||||
@ -348,14 +346,16 @@ class UDPInterface {
|
|||||||
/**
|
/**
|
||||||
* Set the Frequency of Frames Sent to GUI
|
* Set the Frequency of Frames Sent to GUI
|
||||||
* @param i 0 for random frame requests, n for nth frame frequency
|
* @param i 0 for random frame requests, n for nth frame frequency
|
||||||
|
* @return OK or FAIL
|
||||||
*/
|
*/
|
||||||
virtual void setFrameToGuiFrequency(const uint32_t i) = 0;
|
virtual int setFrameToGuiFrequency(const uint32_t i) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Acquisition Period
|
* Set Acquisition Period
|
||||||
* @param i acquisition period
|
* @param i acquisition period
|
||||||
|
* @return OK or FAIL
|
||||||
*/
|
*/
|
||||||
virtual void setAcquisitionPeriod(const uint64_t i) = 0;
|
virtual int setAcquisitionPeriod(const uint64_t i) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Number of Frames expected by receiver from detector
|
* Set Number of Frames expected by receiver from detector
|
||||||
@ -367,15 +367,16 @@ class UDPInterface {
|
|||||||
/**
|
/**
|
||||||
* Set Dynamic Range or Number of Bits Per Pixel
|
* Set Dynamic Range or Number of Bits Per Pixel
|
||||||
* @param i dynamic range that is 4, 8, 16 or 32
|
* @param i dynamic range that is 4, 8, 16 or 32
|
||||||
|
* @return OK or FAIL
|
||||||
*/
|
*/
|
||||||
virtual void setDynamicRange(const uint32_t i) = 0;
|
virtual int setDynamicRange(const uint32_t i) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Ten Giga Enable
|
* Set Ten Giga Enable
|
||||||
* @param b true if 10Giga enabled, else false (1G enabled)
|
* @param b true if 10Giga enabled, else false (1G enabled)
|
||||||
|
* @return OK or FAIL
|
||||||
*/
|
*/
|
||||||
virtual void setTenGigaEnable(const bool b) = 0;
|
virtual int setTenGigaEnable(const bool b) = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
@ -383,6 +384,7 @@ class UDPInterface {
|
|||||||
* They may modify the status of the receiver ****************************
|
* They may modify the status of the receiver ****************************
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
//***initial functions***
|
//***initial functions***
|
||||||
/**
|
/**
|
||||||
* Set receiver type (and corresponding detector variables in derived STANDARD class)
|
* Set receiver type (and corresponding detector variables in derived STANDARD class)
|
||||||
|
@ -6,25 +6,22 @@
|
|||||||
* @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"
|
||||||
|
|
||||||
#include "sls_receiver_defs.h"
|
//#include "sls_receiver_defs.h"
|
||||||
#include "receiver_defs.h"
|
//#include "receiver_defs.h"
|
||||||
#include "genericSocket.h"
|
#include "genericSocket.h"
|
||||||
#include "circularFifo.h"
|
#include "circularFifo.h"
|
||||||
#include "singlePhotonDetector.h"
|
#include "singlePhotonDetector.h"
|
||||||
#include "slsReceiverData.h"
|
#include "slsReceiverData.h"
|
||||||
#include "moenchCommonMode.h"
|
#include "moenchCommonMode.h"
|
||||||
|
|
||||||
//#include "UDPInterface.h"
|
|
||||||
#include "UDPBaseImplementation.h"
|
|
||||||
|
|
||||||
#ifdef MYROOT1
|
#ifdef MYROOT1
|
||||||
#include <TTree.h>
|
#include <TTree.h>
|
||||||
#include <TFile.h>
|
#include <TFile.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -38,7 +35,13 @@
|
|||||||
|
|
||||||
class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBaseImplementation {
|
class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBaseImplementation {
|
||||||
public:
|
public:
|
||||||
/**
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
* Constructor & Destructor **********************************************
|
||||||
|
* They access local cache of configuration or detector parameters *******
|
||||||
|
*************************************************************************/
|
||||||
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
UDPStandardImplementation();
|
UDPStandardImplementation();
|
||||||
@ -48,17 +51,382 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
|
|||||||
*/
|
*/
|
||||||
virtual ~UDPStandardImplementation();
|
virtual ~UDPStandardImplementation();
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
* Getters ***************************************************************
|
||||||
|
* They access local cache of configuration or detector parameters *******
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
//***acquisition count parameters***
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
* Setters ***************************************************************
|
||||||
|
* They modify the local cache of configuration or detector parameters ***
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
//**initial parameters***
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overridden method
|
||||||
|
* Configure command line parameters
|
||||||
|
* @param config_map mapping of config parameters passed from command line arguments
|
||||||
|
*/
|
||||||
void configure(map<string, string> config_map);
|
void configure(map<string, string> config_map);
|
||||||
|
|
||||||
|
//*** file parameters***
|
||||||
/**
|
/**
|
||||||
* delete and free member parameters
|
* Overridden method
|
||||||
|
* Set data compression, by saving only hits (so far implemented only for Moench and Gotthard)
|
||||||
|
* @param b true for data compression enable, else false
|
||||||
*/
|
*/
|
||||||
void deleteMembers();
|
void setDataCompressionEnable(const bool b);
|
||||||
|
|
||||||
|
//***acquisition parameters***
|
||||||
|
/**
|
||||||
|
* Overridden method
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
void setShortFrameEnable(const int i);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* initialize member parameters
|
* Overridden method
|
||||||
|
* Set the Frequency of Frames Sent to GUI
|
||||||
|
* @param i 0 for random frame requests, n for nth frame frequency
|
||||||
|
* @return OK or FAIL
|
||||||
|
*/
|
||||||
|
int setFrameToGuiFrequency(const uint32_t i);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overridden method
|
||||||
|
* Set Acquisition Period
|
||||||
|
* @param i acquisition period
|
||||||
|
* @return OK or FAIL
|
||||||
|
*/
|
||||||
|
int setAcquisitionPeriod(const uint64_t i);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overridden method
|
||||||
|
* 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);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overridden method
|
||||||
|
* Set Ten Giga Enable
|
||||||
|
* @param b true if 10Giga enabled, else false (1G enabled)
|
||||||
|
* @return OK or FAIL
|
||||||
|
*/
|
||||||
|
int setTenGigaEnable(const bool b);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
* Behavioral functions***************************************************
|
||||||
|
* They may modify the status of the receiver ****************************
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
//***initial functions***
|
||||||
|
/**
|
||||||
|
* Overridden method
|
||||||
|
* 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 slsReceiverDefs::detectorType d);
|
||||||
|
|
||||||
|
//***acquisition functions***
|
||||||
|
/**
|
||||||
|
* Overridden method
|
||||||
|
* Reset acquisition parameters such as total frames caught for an entire acquisition (including all scans)
|
||||||
|
*/
|
||||||
|
void resetAcquisitionCount();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overridden method
|
||||||
|
* 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);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
* Setters ***************************************************************
|
||||||
|
* They modify the local cache of configuration or detector parameters ***
|
||||||
|
*************************************************************************/
|
||||||
|
//**initial parameters***
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete and free base member parameters
|
||||||
|
*/
|
||||||
|
void deleteBaseMembers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete and free member parameters
|
||||||
|
*/
|
||||||
|
void deleteMembers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes all the filter objects for single photon data
|
||||||
|
* Deals with data compression
|
||||||
|
*/
|
||||||
|
void deleteFilter();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize base member parameters
|
||||||
|
*/
|
||||||
|
void initializeBaseMembers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize member parameters
|
||||||
*/
|
*/
|
||||||
void initializeMembers();
|
void initializeMembers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets up all the filter objects for single photon data
|
||||||
|
* Deals with data compression
|
||||||
|
*/
|
||||||
|
void initializeFilter();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create Listening Threads
|
||||||
|
* @param destroy is true to destroy all the threads
|
||||||
|
*/
|
||||||
|
int createListeningThreads(bool destroy = false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create Writer Threads
|
||||||
|
* @param destroy is true to destroy all the threads
|
||||||
|
* @return OK or FAIL
|
||||||
|
*/
|
||||||
|
int createWriterThreads(bool destroy = false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Thread Priorities
|
||||||
|
*/
|
||||||
|
void setThreadPriorities();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set up the Fifo Structure for processing buffers
|
||||||
|
* between listening and writer threads
|
||||||
|
* @return OK or FAIL
|
||||||
|
*/
|
||||||
|
int setupFifoStructure();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates UDP Sockets
|
||||||
|
* @return OK or FAIL
|
||||||
|
*/
|
||||||
|
int createUDPSockets();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//**detector parameters***
|
||||||
|
/**
|
||||||
|
* structure of an eiger packet header
|
||||||
|
* subframenum subframe number for 32 bit mode (already written by firmware)
|
||||||
|
* missingpacket explicitly put to 0xFF to recognize it in file read (written by software)
|
||||||
|
* portnum 0 for the first port and 1 for the second port (written by software to file)
|
||||||
|
* dynamicrange dynamic range or bits per pixel (written by software to file)
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
unsigned char subFameNumber[4];
|
||||||
|
unsigned char missingPacket[2];
|
||||||
|
unsigned char portIndex[1];
|
||||||
|
unsigned char dynamicRange[1];
|
||||||
|
} eiger_packet_header_t;
|
||||||
|
/**
|
||||||
|
* structure of an eiger packet footer
|
||||||
|
* framenum 48 bit frame number (already written by firmware)
|
||||||
|
* packetnum packet number (already written by firmware)
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
unsigned char frameNumber[6];
|
||||||
|
unsigned char packetNumber[2];
|
||||||
|
} eiger_packet_footer_t;
|
||||||
|
|
||||||
|
/** Size of 1 Frame including headers */
|
||||||
|
int frameSize;
|
||||||
|
|
||||||
|
/** Size of 1 buffer processed at a time */
|
||||||
|
int bufferSize;
|
||||||
|
|
||||||
|
/** One Packet Size including headers */
|
||||||
|
int onePacketSize;
|
||||||
|
|
||||||
|
/** One Packet Size without headers */
|
||||||
|
int oneDataSize;
|
||||||
|
|
||||||
|
/** Frame Index Mask */
|
||||||
|
uint64_t frameIndexMask;
|
||||||
|
|
||||||
|
/** Frame Index Offset */
|
||||||
|
int frameIndexOffset;
|
||||||
|
|
||||||
|
/** Packet Index Mask */
|
||||||
|
uint64_t packetIndexMask;
|
||||||
|
|
||||||
|
/** Footer offset from start of Packet*/
|
||||||
|
int footerOffset;
|
||||||
|
|
||||||
|
//***File parameters***
|
||||||
|
/** Maximum Packets Per File **/
|
||||||
|
int maxPacketsPerFile;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//***acquisition indices parameters***
|
||||||
|
/** Frame Number of First Frame of an Acquisition */
|
||||||
|
uint64_t startAcquisitionIndex;
|
||||||
|
|
||||||
|
/** Frame index at start of each real time acquisition (eg. for each scan) */
|
||||||
|
uint64_t startFrameIndex;
|
||||||
|
|
||||||
|
/** Current Frame Number */
|
||||||
|
uint64_t currentFrameNumber;
|
||||||
|
|
||||||
|
/* Acquisition started */
|
||||||
|
bool acqStarted;
|
||||||
|
|
||||||
|
/* Measurement started */
|
||||||
|
bool measurementStarted;
|
||||||
|
|
||||||
|
/** Total Frame Count listened to by listening threads */
|
||||||
|
int totalListeningFrameCount[MAX_NUMBER_OF_LISTENING_THREADS];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//***receiver parameters***
|
||||||
|
/** Receiver Buffer */
|
||||||
|
char *buffer[MAX_NUMBER_OF_LISTENING_THREADS];
|
||||||
|
|
||||||
|
/** Memory allocated */
|
||||||
|
char *mem0[MAX_NUMBER_OF_LISTENING_THREADS];
|
||||||
|
|
||||||
|
/** Circular fifo to point to addresses of data listened to */
|
||||||
|
CircularFifo<char>* fifo[MAX_NUMBER_OF_LISTENING_THREADS];
|
||||||
|
|
||||||
|
/** Circular fifo to point to address already written and freed, to be reused */
|
||||||
|
CircularFifo<char>* fifoFree[MAX_NUMBER_OF_LISTENING_THREADS];
|
||||||
|
|
||||||
|
/** Number of Jobs Per Buffer */
|
||||||
|
int numberofJobsPerBuffer;
|
||||||
|
|
||||||
|
/** Fifo Depth */
|
||||||
|
uint32_t fifoSize;
|
||||||
|
|
||||||
|
/** Current Frame copied for Gui */
|
||||||
|
char* latestData;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//***general and listening thread parameters***
|
||||||
|
/** Ensures if threads created successfully */
|
||||||
|
bool threadStarted;
|
||||||
|
|
||||||
|
/** Number of Listening Threads */
|
||||||
|
int numberofListeningThreads;
|
||||||
|
|
||||||
|
/** Listening Threads */
|
||||||
|
pthread_t listeningThreads[MAX_NUMBER_OF_LISTENING_THREADS];
|
||||||
|
|
||||||
|
/** Semaphores Synchronizing Listening Threads */
|
||||||
|
sem_t listenSemaphore[MAX_NUMBER_OF_LISTENING_THREADS];
|
||||||
|
|
||||||
|
/** Current Listening Thread Index*/
|
||||||
|
int currentListeningThreadIndex;
|
||||||
|
|
||||||
|
/** Mask with each bit indicating status of each listening thread */
|
||||||
|
volatile uint32_t listeningThreadsMask;
|
||||||
|
|
||||||
|
/** Set to self-terminate listening threads waiting for semaphores */
|
||||||
|
bool killAllListeningThreads;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//***writer thread parameters***
|
||||||
|
/** Maximum Number of Writer Threads */
|
||||||
|
const static int MAX_NUMBER_OF_WRITER_THREADS = 15;
|
||||||
|
|
||||||
|
/** Number of Writer Threads */
|
||||||
|
int numberofWriterThreads;
|
||||||
|
|
||||||
|
/** Writer Threads */
|
||||||
|
pthread_t writingThreads[MAX_NUMBER_OF_WRITER_THREADS];
|
||||||
|
|
||||||
|
/** Semaphores Synchronizing Writer Threads */
|
||||||
|
sem_t writerSemaphore[MAX_NUMBER_OF_WRITER_THREADS];
|
||||||
|
|
||||||
|
/** Current Writer Thread Index*/
|
||||||
|
int currentWriterThreadIndex;
|
||||||
|
|
||||||
|
/** Mask with each bit indicating status of each writer thread */
|
||||||
|
volatile uint32_t writerThreadsMask;
|
||||||
|
|
||||||
|
/** Mask with each bit indicating file created for each writer thread*/
|
||||||
|
volatile uint32_t createFileMask;
|
||||||
|
|
||||||
|
/** Set to self-terminate writer threads waiting for semaphores */
|
||||||
|
bool killAllWritingThreads;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//***filter parameters***
|
||||||
|
/** Common Mode Subtraction Enable FIXME: Always false, only moench uses, Ask Anna */
|
||||||
|
bool commonModeSubtractionEnable;
|
||||||
|
|
||||||
|
/** Moench Common Mode Subtraction */
|
||||||
|
moenchCommonMode *moenchCommonModeSubtraction;
|
||||||
|
|
||||||
|
/** Single Photon Detector Object for each writer thread */
|
||||||
|
singlePhotonDetector<uint16_t> *singlePhotonDetectorObject[MAX_NUMBER_OF_WRITER_THREADS];
|
||||||
|
|
||||||
|
/** Receiver Data Object for each writer thread */
|
||||||
|
slsReceiverData<uint16_t> *receiverData[MAX_NUMBER_OF_WRITER_THREADS];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//***mutex***
|
||||||
|
/** mutex for status */
|
||||||
|
pthread_mutex_t status_mutex;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set receiver type
|
* Set receiver type
|
||||||
@ -74,26 +442,11 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
|
|||||||
*/
|
*/
|
||||||
//uint32_t getStartAcquisitionIndex();
|
//uint32_t getStartAcquisitionIndex();
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns current Frame Index Caught for an entire acquisition (including all scans)
|
|
||||||
*/
|
|
||||||
//uint32_t getAcquisitionIndex();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if acquisition started
|
* Returns if acquisition started
|
||||||
*/
|
*/
|
||||||
//bool getAcquistionStarted();
|
//bool getAcquistionStarted();
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns Frames Caught for each real time acquisition (eg. for each scan)
|
|
||||||
*/
|
|
||||||
//int getFramesCaught();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns Total Frames Caught for an entire acquisition (including all scans)
|
|
||||||
*/
|
|
||||||
//int getTotalFramesCaught();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the frame index at start of each real time acquisition (eg. for each scan)
|
* Returns the frame index at start of each real time acquisition (eg. for each scan)
|
||||||
*/
|
*/
|
||||||
@ -117,71 +470,8 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
|
|||||||
//void resetTotalFramesCaught();
|
//void resetTotalFramesCaught();
|
||||||
|
|
||||||
|
|
||||||
//file parameters
|
|
||||||
/**
|
|
||||||
* Returns File Path
|
|
||||||
*/
|
|
||||||
//char* getFilePath() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set File Path
|
|
||||||
* @param c file path
|
|
||||||
*/
|
|
||||||
//char* setFilePath(const char c[]);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns File Name
|
|
||||||
*/
|
|
||||||
//char* getFileName() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set File Name (without frame index, file index and extension)
|
|
||||||
* @param c file name
|
|
||||||
*/
|
|
||||||
//char* setFileName(const char c[]);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns File Index
|
|
||||||
*/
|
|
||||||
//int getFileIndex();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set File Index
|
|
||||||
* @param i file index
|
|
||||||
*/
|
|
||||||
//int setFileIndex(int i);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Frame Index Needed
|
|
||||||
* @param i frame index needed
|
|
||||||
*/
|
|
||||||
//int setFrameIndexNeeded(int i);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set enable file write
|
|
||||||
* @param i file write enable
|
|
||||||
* Returns file write enable
|
|
||||||
*/
|
|
||||||
//int setEnableFileWrite(int i);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable/disable overwrite
|
|
||||||
* @param i enable
|
|
||||||
* Returns enable over write
|
|
||||||
*/
|
|
||||||
//int setEnableOverwrite(int i);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns file write enable
|
|
||||||
* 1: YES 0: NO
|
|
||||||
*/
|
|
||||||
//int getEnableFileWrite() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns file over write enable
|
|
||||||
* 1: YES 0: NO
|
|
||||||
*/
|
|
||||||
//int getEnableOverwrite() const;
|
|
||||||
|
|
||||||
//other parameters
|
//other parameters
|
||||||
|
|
||||||
@ -202,83 +492,7 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
|
|||||||
*/
|
*/
|
||||||
void setDetectorHostname(const char *detectorHostName);
|
void setDetectorHostname(const char *detectorHostName);
|
||||||
|
|
||||||
/* Returns detector hostname
|
|
||||||
/returns hostname
|
|
||||||
* caller needs to deallocate the returned char array.
|
|
||||||
* if uninitialized, it must return NULL
|
|
||||||
*/
|
|
||||||
char *getDetectorHostname() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Ethernet Interface or IP to listen to
|
|
||||||
*/
|
|
||||||
void setEthernetInterface(char* c);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set UDP Port Number
|
|
||||||
*/
|
|
||||||
void setUDPPortNo(int p);
|
|
||||||
/**
|
|
||||||
* Set UDP Port Number
|
|
||||||
*/
|
|
||||||
void setUDPPortNo2(int p);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Returns number of frames to receive
|
|
||||||
* This is the number of frames to expect to receiver from the detector.
|
|
||||||
* The data receiver will change from running to idle when it got this number of frames
|
|
||||||
*/
|
|
||||||
int getNumberOfFrames() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* set frame number if a positive number
|
|
||||||
*/
|
|
||||||
int32_t setNumberOfFrames(int32_t fnum);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns scan tag
|
|
||||||
*/
|
|
||||||
int getScanTag() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* set scan tag if its is a positive number
|
|
||||||
*/
|
|
||||||
int32_t setScanTag(int32_t stag);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the number of bits per pixel
|
|
||||||
*/
|
|
||||||
int getDynamicRange() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* set dynamic range if its is a positive number
|
|
||||||
*/
|
|
||||||
int32_t setDynamicRange(int32_t dr);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set short frame
|
|
||||||
* @param i if shortframe i=1
|
|
||||||
*/
|
|
||||||
int setShortFrame(int i);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the variable to send every nth frame to gui
|
|
||||||
* or if 0,send frame only upon gui request
|
|
||||||
*/
|
|
||||||
int setNFrameToGui(int i);
|
|
||||||
|
|
||||||
/** set acquisition period if a positive number
|
|
||||||
*/
|
|
||||||
int64_t setAcquisitionPeriod(int64_t index);
|
|
||||||
|
|
||||||
/** get data compression, by saving only hits
|
|
||||||
*/
|
|
||||||
bool getDataCompression();
|
|
||||||
|
|
||||||
/** enabl data compression, by saving only hits
|
|
||||||
/returns if failed
|
|
||||||
*/
|
|
||||||
int enableDataCompression(bool enable);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* enable 10Gbe
|
* enable 10Gbe
|
||||||
@ -337,20 +551,9 @@ private:
|
|||||||
std::cout << "[WARNING] Method " << method_name << " not implemented!" << std::endl;
|
std::cout << "[WARNING] Method " << method_name << " not implemented!" << std::endl;
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
/**
|
|
||||||
* Deletes all the filter objects for single photon data
|
|
||||||
*/
|
|
||||||
void deleteFilter();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs the filter for single photon data
|
|
||||||
*/
|
|
||||||
void setupFilter();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* set up fifo according to the new numjobsperthread
|
|
||||||
*/
|
|
||||||
void setupFifoStructure ();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy frames to gui
|
* Copy frames to gui
|
||||||
@ -358,28 +561,6 @@ private:
|
|||||||
*/
|
*/
|
||||||
void copyFrameToGui(char* startbuf[], char* buf=NULL);
|
void copyFrameToGui(char* startbuf[], char* buf=NULL);
|
||||||
|
|
||||||
/**
|
|
||||||
* creates udp sockets
|
|
||||||
* \returns if success or fail
|
|
||||||
*/
|
|
||||||
int createUDPSockets();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* create listening thread
|
|
||||||
* @param destroy is true to kill all threads and start again
|
|
||||||
*/
|
|
||||||
int createListeningThreads(bool destroy = false);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* create writer threads
|
|
||||||
* @param destroy is true to kill all threads and start again
|
|
||||||
*/
|
|
||||||
int createWriterThreads(bool destroy = false);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* set thread priorities
|
|
||||||
*/
|
|
||||||
void setThreadPriorities();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* initializes variables and creates the first file
|
* initializes variables and creates the first file
|
||||||
@ -507,8 +688,7 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** max number of writer threads */
|
|
||||||
const static int MAX_NUM_WRITER_THREADS = 15;
|
|
||||||
|
|
||||||
/** missing packet identifier value */
|
/** missing packet identifier value */
|
||||||
const static uint16_t missingPacketValue = 0xFFFF;
|
const static uint16_t missingPacketValue = 0xFFFF;
|
||||||
@ -517,21 +697,9 @@ private:
|
|||||||
/** UDP Socket between Receiver and Detector */
|
/** UDP Socket between Receiver and Detector */
|
||||||
genericSocket* udpSocket[MAX_NUM_LISTENING_THREADS];
|
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 */
|
/** Complete File name */
|
||||||
char savefilename[MAX_STR_LENGTH];
|
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) */
|
/** Actual current frame index of each time acquisition (eg. for each scan) */
|
||||||
uint32_t frameIndex;
|
uint32_t frameIndex;
|
||||||
|
|
||||||
@ -547,34 +715,9 @@ private:
|
|||||||
/** Number of missing packets per buffer*/
|
/** Number of missing packets per buffer*/
|
||||||
uint32_t numMissingPackets;
|
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 */
|
/** Previous Frame number from buffer */
|
||||||
int prevframenum;
|
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 */
|
/** gui data ready */
|
||||||
int guiDataReady;
|
int guiDataReady;
|
||||||
@ -585,71 +728,9 @@ private:
|
|||||||
/** points to the filename to send to gui */
|
/** points to the filename to send to gui */
|
||||||
char* guiFileName;
|
char* guiFileName;
|
||||||
|
|
||||||
/** fifo size */
|
/** OK if file created was successful */
|
||||||
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;
|
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...
|
// TODO: not properly sure where to put these...
|
||||||
/** structure of an eiger image header*/
|
/** structure of an eiger image header*/
|
||||||
|
|
||||||
@ -659,19 +740,11 @@ private:
|
|||||||
//semaphores
|
//semaphores
|
||||||
/** semaphore to synchronize writer and guireader threads */
|
/** semaphore to synchronize writer and guireader threads */
|
||||||
sem_t smp;
|
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
|
//mutex
|
||||||
/** guiDataReady mutex */
|
/** guiDataReady mutex */
|
||||||
pthread_mutex_t dataReadyMutex;
|
pthread_mutex_t dataReadyMutex;
|
||||||
|
|
||||||
/** mutex for status */
|
|
||||||
pthread_mutex_t status_mutex;
|
|
||||||
|
|
||||||
/** mutex for progress variable currframenum */
|
/** mutex for progress variable currframenum */
|
||||||
pthread_mutex_t progress_mutex;
|
pthread_mutex_t progress_mutex;
|
||||||
|
|
||||||
@ -682,10 +755,7 @@ private:
|
|||||||
FILE *sfilefd;
|
FILE *sfilefd;
|
||||||
|
|
||||||
//filter
|
//filter
|
||||||
singlePhotonDetector<uint16_t> *singlePhotonDet[MAX_NUM_WRITER_THREADS];
|
|
||||||
slsReceiverData<uint16_t> *receiverdata[MAX_NUM_WRITER_THREADS];
|
|
||||||
moenchCommonMode *cmSub;
|
|
||||||
bool commonModeSubtractionEnable;
|
|
||||||
|
|
||||||
#ifdef MYROOT1
|
#ifdef MYROOT1
|
||||||
/** Tree where the hits are stored */
|
/** Tree where the hits are stored */
|
||||||
|
@ -27,8 +27,9 @@
|
|||||||
/*#define GOTTHARD_ALIGNED_FRAME_SIZE 4096*/
|
/*#define GOTTHARD_ALIGNED_FRAME_SIZE 4096*/
|
||||||
#define GOTTHARD_PACKETS_PER_FRAME 2
|
#define GOTTHARD_PACKETS_PER_FRAME 2
|
||||||
#define GOTTHARD_ONE_PACKET_SIZE 1286
|
#define GOTTHARD_ONE_PACKET_SIZE 1286
|
||||||
|
#define GOTTHARD_ONE_DATA_SIZE 1280
|
||||||
#define GOTTHARD_BUFFER_SIZE (GOTTHARD_ONE_PACKET_SIZE*GOTTHARD_PACKETS_PER_FRAME) //1286*2
|
#define GOTTHARD_BUFFER_SIZE (GOTTHARD_ONE_PACKET_SIZE*GOTTHARD_PACKETS_PER_FRAME) //1286*2
|
||||||
#define GOTTHARD_DATA_BYTES (1280*GOTTHARD_PACKETS_PER_FRAME) //1280*2
|
#define GOTTHARD_DATA_BYTES (GOTTHARD_ONE_DATA_SIZE*GOTTHARD_PACKETS_PER_FRAME) //1280*2
|
||||||
|
|
||||||
#define GOTTHARD_FRAME_INDEX_MASK 0xFFFFFFFE
|
#define GOTTHARD_FRAME_INDEX_MASK 0xFFFFFFFE
|
||||||
#define GOTTHARD_FRAME_INDEX_OFFSET 1
|
#define GOTTHARD_FRAME_INDEX_OFFSET 1
|
||||||
@ -39,7 +40,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#define GOTTHARD_SHORT_PACKETS_PER_FRAME 1
|
#define GOTTHARD_SHORT_PACKETS_PER_FRAME 1
|
||||||
#define GOTTHARD_SHORT_ONE_PACKET_SIZE 518
|
#define GOTTHARD_SHORT_ONE_PACKET_SIZE 518
|
||||||
#define GOTTHARD_SHORT_BUFFER_SIZE 518
|
#define GOTTHARD_SHORT_BUFFER_SIZE 518
|
||||||
#define GOTTHARD_SHORT_DATABYTES 512
|
#define GOTTHARD_SHORT_DATABYTES 512
|
||||||
#define GOTTHARD_SHORT_FRAME_INDEX_MASK 0xFFFFFFFF
|
#define GOTTHARD_SHORT_FRAME_INDEX_MASK 0xFFFFFFFF
|
||||||
@ -75,8 +76,9 @@
|
|||||||
/*#define MOENCH_ALIGNED_FRAME_SIZE 65536*/
|
/*#define MOENCH_ALIGNED_FRAME_SIZE 65536*/
|
||||||
#define MOENCH_PACKETS_PER_FRAME 40
|
#define MOENCH_PACKETS_PER_FRAME 40
|
||||||
#define MOENCH_ONE_PACKET_SIZE 1286
|
#define MOENCH_ONE_PACKET_SIZE 1286
|
||||||
|
#define MOENCH_ONE_DATA_SIZE 1280
|
||||||
#define MOENCH_BUFFER_SIZE (MOENCH_ONE_PACKET_SIZE*MOENCH_PACKETS_PER_FRAME) //1286*40
|
#define MOENCH_BUFFER_SIZE (MOENCH_ONE_PACKET_SIZE*MOENCH_PACKETS_PER_FRAME) //1286*40
|
||||||
#define MOENCH_DATA_BYTES (1280*MOENCH_PACKETS_PER_FRAME) //1280*40
|
#define MOENCH_DATA_BYTES (MOENCH_ONE_DATA_SIZE*MOENCH_PACKETS_PER_FRAME) //1280*40
|
||||||
|
|
||||||
#define MOENCH_FRAME_INDEX_MASK 0xFFFFFF00
|
#define MOENCH_FRAME_INDEX_MASK 0xFFFFFF00
|
||||||
#define MOENCH_FRAME_INDEX_OFFSET 8
|
#define MOENCH_FRAME_INDEX_OFFSET 8
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
#include "slsReceiverTCPIPInterface.h"
|
#include "slsReceiverTCPIPInterface.h"
|
||||||
#include "UDPInterface.h"
|
#include "UDPInterface.h"
|
||||||
//#include "UDPBaseImplementation.h"
|
|
||||||
|
|
||||||
#include "receiver_defs.h"
|
#include "receiver_defs.h"
|
||||||
#include "MySocketTCP.h"
|
#include "MySocketTCP.h"
|
||||||
|
@ -111,6 +111,16 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/** returns string from enabled/disabled
|
||||||
|
\param b true or false
|
||||||
|
\returns string enabled, disabled
|
||||||
|
*/
|
||||||
|
static string stringEnable(bool b){\
|
||||||
|
if(b) return string("enabled"); \
|
||||||
|
else return string("disabled"); \
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
protected:
|
protected:
|
||||||
|
@ -4,25 +4,12 @@
|
|||||||
* @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"
|
#include "UDPBaseImplementation.h"
|
||||||
|
|
||||||
#include "moench02ModuleData.h"
|
|
||||||
#include "gotthardModuleData.h"
|
|
||||||
#include "gotthardShortModuleData.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <signal.h> // SIGINT
|
|
||||||
#include <sys/stat.h> // stat
|
#include <sys/stat.h> // stat
|
||||||
#include <sys/socket.h> // socket(), bind(), listen(), accept(), shut down
|
|
||||||
#include <arpa/inet.h> // sock_addr_in, htonl, INADDR_ANY
|
|
||||||
#include <stdlib.h> // exit()
|
|
||||||
#include <iomanip> //set precision
|
|
||||||
#include <sys/mman.h> //munmap
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <string.h>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
@ -32,7 +19,11 @@ using namespace std;
|
|||||||
* They access local cache of configuration or detector parameters *******
|
* They access local cache of configuration or detector parameters *******
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
UDPBaseImplementation::UDPBaseImplementation(){
|
UDPBaseImplementation::UDPBaseImplementation(){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
cout << "Info: Initializing base members" << endl;
|
||||||
//**detector parameters***
|
//**detector parameters***
|
||||||
|
myDetectorType = GENERIC;
|
||||||
strcpy(detHostname,"");
|
strcpy(detHostname,"");
|
||||||
packetsPerFrame = 0;
|
packetsPerFrame = 0;
|
||||||
acquisitionPeriod = 0;
|
acquisitionPeriod = 0;
|
||||||
@ -51,7 +42,7 @@ UDPBaseImplementation::UDPBaseImplementation(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
//***file parameters***
|
//***file parameters***
|
||||||
strcpy(fileName,"");
|
strcpy(fileName,"run");
|
||||||
strcpy(filePath,"");
|
strcpy(filePath,"");
|
||||||
fileIndex = 0;
|
fileIndex = 0;
|
||||||
scanTag = 0;
|
scanTag = 0;
|
||||||
@ -78,9 +69,17 @@ UDPBaseImplementation::UDPBaseImplementation(){
|
|||||||
pAcquisitionFinished = NULL;
|
pAcquisitionFinished = NULL;
|
||||||
rawDataReadyCallBack = NULL;
|
rawDataReadyCallBack = NULL;
|
||||||
pRawDataReady = NULL;
|
pRawDataReady = NULL;
|
||||||
};
|
}
|
||||||
|
|
||||||
UDPBaseImplementation::~UDPBaseImplementation(){};
|
UDPBaseImplementation::~UDPBaseImplementation(){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
cout << "Info: Deleting base member pointers" << endl;
|
||||||
|
if(detHostname) {delete [] detHostname; detHostname = NULL;}
|
||||||
|
if(eth) {delete [] eth; eth = NULL;}
|
||||||
|
if(fileName) {delete [] fileName; fileName = NULL;}
|
||||||
|
if(filePath) {delete [] filePath; filePath = NULL;}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
@ -157,9 +156,9 @@ int64_t UDPBaseImplementation::getAcquisitionIndex() const{
|
|||||||
|
|
||||||
|
|
||||||
/***connection parameters***/
|
/***connection parameters***/
|
||||||
uint32_t UDPBaseImplementation::getUDPPortNo() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return udpPortNum[0];}
|
uint32_t UDPBaseImplementation::getUDPPortNumber() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return udpPortNum[0];}
|
||||||
|
|
||||||
uint32_t UDPBaseImplementation::getUDPPortNo2() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return udpPortNum[1];}
|
uint32_t UDPBaseImplementation::getUDPPortNumber2() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return udpPortNum[1];}
|
||||||
|
|
||||||
char *UDPBaseImplementation::getEthernetInterface() const{
|
char *UDPBaseImplementation::getEthernetInterface() const{
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
@ -205,7 +204,7 @@ void UDPBaseImplementation::setBottomEnable(const bool b){
|
|||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
bottomEnable = b;
|
bottomEnable = b;
|
||||||
FILE_LOG(logINFO) << "Bottom Enable:" << bottomEnable;
|
FILE_LOG(logINFO) << "Bottom Enable: " << stringEnable(bottomEnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -255,41 +254,46 @@ void UDPBaseImplementation::setFrameIndexEnable(const bool b){
|
|||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
frameIndexEnable = b;
|
frameIndexEnable = b;
|
||||||
FILE_LOG(logINFO) << "Frame Index Enable:" << frameIndexEnable;
|
FILE_LOG(logINFO) << "Frame Index Enable: " << stringEnable(frameIndexEnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPBaseImplementation::setFileWriteEnable(const bool b){
|
void UDPBaseImplementation::setFileWriteEnable(const bool b){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
fileWriteEnable = b;
|
fileWriteEnable = b;
|
||||||
FILE_LOG(logINFO) << "File Write Enable:" << fileWriteEnable;
|
FILE_LOG(logINFO) << "File Write Enable: " << stringEnable(fileWriteEnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPBaseImplementation::setOverwriteEnable(const bool b){
|
void UDPBaseImplementation::setOverwriteEnable(const bool b){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
overwriteEnable = b;
|
overwriteEnable = b;
|
||||||
FILE_LOG(logINFO) << "Overwrite Enable:" << overwriteEnable;
|
FILE_LOG(logINFO) << "Overwrite Enable: " << stringEnable(overwriteEnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPBaseImplementation::setDataCompressionEnable(const bool b){
|
int UDPBaseImplementation::setDataCompressionEnable(const bool b){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
dataCompressionEnable = b;
|
dataCompressionEnable = b;
|
||||||
FILE_LOG(logINFO) << "Data Compression Enable:" << dataCompressionEnable;
|
FILE_LOG(logINFO) << "Data Compression Enable: " << stringEnable(dataCompressionEnable);
|
||||||
}
|
|
||||||
|
|
||||||
|
//overridden methods might return FAIL
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***connection parameters***/
|
/***connection parameters***/
|
||||||
void UDPBaseImplementation::setUDPPortNo(const uint32_t i){
|
void UDPBaseImplementation::setUDPPortNumber(const uint32_t i){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
udpPortNum[0] = i;
|
if(bottomEnable)
|
||||||
|
udpPortNum[1] = i;
|
||||||
|
else
|
||||||
|
udpPortNum[0] = i;
|
||||||
FILE_LOG(logINFO) << "udpPortNum[0]:" << udpPortNum[0];
|
FILE_LOG(logINFO) << "udpPortNum[0]:" << udpPortNum[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPBaseImplementation::setUDPPortNo2(const uint32_t i){
|
void UDPBaseImplementation::setUDPPortNumber2(const uint32_t i){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
udpPortNum[1] = i;
|
udpPortNum[1] = i;
|
||||||
@ -304,26 +308,32 @@ void UDPBaseImplementation::setEthernetInterface(const char* c){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***connection parameters***/
|
/***acquisition parameters***/
|
||||||
void UDPBaseImplementation::setShortFrameEnable(const int i){
|
void UDPBaseImplementation::setShortFrameEnable(const int i){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
shortFrameEnable = i;
|
shortFrameEnable = i;
|
||||||
FILE_LOG(logINFO) << "Short Frame Enable:" << shortFrameEnable;
|
FILE_LOG(logINFO) << "Short Frame Enable: " << stringEnable(shortFrameEnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPBaseImplementation::setFrameToGuiFrequency(const uint32_t i){
|
int UDPBaseImplementation::setFrameToGuiFrequency(const uint32_t i){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
FrameToGuiFrequency = i;
|
FrameToGuiFrequency = i;
|
||||||
FILE_LOG(logINFO) << "Frame To Gui Frequency:" << FrameToGuiFrequency;
|
FILE_LOG(logINFO) << "Frame To Gui Frequency:" << FrameToGuiFrequency;
|
||||||
|
|
||||||
|
//overrridden child classes might return FAIL
|
||||||
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPBaseImplementation::setAcquisitionPeriod(const uint64_t i){
|
int UDPBaseImplementation::setAcquisitionPeriod(const uint64_t i){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
acquisitionPeriod = i;
|
acquisitionPeriod = i;
|
||||||
FILE_LOG(logINFO) << "Acquisition Period:" << acquisitionPeriod;
|
FILE_LOG(logINFO) << "Acquisition Period:" << acquisitionPeriod;
|
||||||
|
|
||||||
|
//overrridden child classes might return FAIL
|
||||||
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPBaseImplementation::setNumberOfFrames(const uint64_t i){
|
void UDPBaseImplementation::setNumberOfFrames(const uint64_t i){
|
||||||
@ -333,20 +343,25 @@ void UDPBaseImplementation::setNumberOfFrames(const uint64_t i){
|
|||||||
FILE_LOG(logINFO) << "Number of Frames:" << numberOfFrames;
|
FILE_LOG(logINFO) << "Number of Frames:" << numberOfFrames;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPBaseImplementation::setDynamicRange(const uint32_t i){
|
int UDPBaseImplementation::setDynamicRange(const uint32_t i){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
dynamicRange = i;
|
dynamicRange = i;
|
||||||
FILE_LOG(logINFO) << "Dynamic Range:" << dynamicRange;
|
FILE_LOG(logINFO) << "Dynamic Range:" << dynamicRange;
|
||||||
|
|
||||||
|
//overrridden child classes might return FAIL
|
||||||
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPBaseImplementation::setTenGigaEnable(const bool b){
|
int UDPBaseImplementation::setTenGigaEnable(const bool b){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
tengigaEnable = b;
|
tengigaEnable = b;
|
||||||
FILE_LOG(logINFO) << "Ten Giga Enable:" << tengigaEnable;
|
FILE_LOG(logINFO) << "Ten Giga Enable: " << stringEnable(tengigaEnable);
|
||||||
}
|
|
||||||
|
|
||||||
|
//overridden functions might return FAIL
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
@ -354,11 +369,13 @@ void UDPBaseImplementation::setTenGigaEnable(const bool b){
|
|||||||
* They may modify the status of the receiver ****************************
|
* They may modify the status of the receiver ****************************
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/***initial functions***/
|
/***initial functions***/
|
||||||
int UDPBaseImplementation::setDetectorType(const slsReceiverDefs::detectorType d){
|
int UDPBaseImplementation::setDetectorType(const slsReceiverDefs::detectorType d){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
myDetectorType = d;
|
myDetectorType = d;
|
||||||
|
//if eiger, set numberofListeningThreads = 2;
|
||||||
FILE_LOG(logINFO) << "Detector Type:" << slsDetectorBase::getDetectorType(d);
|
FILE_LOG(logINFO) << "Detector Type:" << slsDetectorBase::getDetectorType(d);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
***********************************************/
|
***********************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <string.h>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
#include "UDPInterface.h"
|
#include "UDPInterface.h"
|
||||||
#include "UDPBaseImplementation.h"
|
#include "UDPBaseImplementation.h"
|
||||||
#include "UDPStandardImplementation.h"
|
#include "UDPStandardImplementation.h"
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1922,8 +1922,11 @@ int slsReceiverTCPIPInterface::set_read_frequency(){
|
|||||||
strcpy(mess,"cannot set up receiver mode when receiver is running\n");
|
strcpy(mess,"cannot set up receiver mode when receiver is running\n");
|
||||||
}*/
|
}*/
|
||||||
else{
|
else{
|
||||||
if(index >= 0)
|
if(index >= 0){
|
||||||
receiverBase->setFrameToGuiFrequency(index);
|
ret = receiverBase->setFrameToGuiFrequency(index);
|
||||||
|
if(ret == FAIL)
|
||||||
|
strcpy(mess, "Could not allocate memory for listening fifo\n");
|
||||||
|
}
|
||||||
retval=receiverBase->getFrameToGuiFrequency();
|
retval=receiverBase->getFrameToGuiFrequency();
|
||||||
if(index>=0 && retval!=index)
|
if(index>=0 && retval!=index)
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
@ -2107,8 +2110,11 @@ int slsReceiverTCPIPInterface::set_timer() {
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(index[0] == slsReceiverDefs::FRAME_PERIOD){
|
if(index[0] == slsReceiverDefs::FRAME_PERIOD){
|
||||||
if(index[1]>=0)
|
if(index[1]>=0){
|
||||||
receiverBase->setAcquisitionPeriod(index[1]);
|
ret = receiverBase->setAcquisitionPeriod(index[1]);
|
||||||
|
if(ret == FAIL)
|
||||||
|
strcpy(mess,"Could not allocate memory for listening fifo\n")
|
||||||
|
}
|
||||||
retval=receiverBase->getAcquisitionPeriod();
|
retval=receiverBase->getAcquisitionPeriod();
|
||||||
}else{
|
}else{
|
||||||
if(index[1]>=0)
|
if(index[1]>=0)
|
||||||
@ -2183,17 +2189,19 @@ int slsReceiverTCPIPInterface::enable_compression() {
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(enable >= 0)
|
if(enable >= 0)
|
||||||
receiverBase->setDataCompressionEnable(enable);
|
ret = receiverBase->setDataCompressionEnable(enable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (receiverBase == NULL){
|
if(ret != FAIL){
|
||||||
strcpy(mess,"Receiver not set up\n");
|
if (receiverBase == NULL){
|
||||||
ret=FAIL;
|
strcpy(mess,"Receiver not set up\n");
|
||||||
}else{
|
ret=FAIL;
|
||||||
retval = receiverBase->getDataCompressionEnable();
|
}else{
|
||||||
if(enable >= 0 && retval != enable)
|
retval = receiverBase->getDataCompressionEnable();
|
||||||
ret = FAIL;
|
if(enable >= 0 && retval != enable)
|
||||||
|
ret = FAIL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2324,8 +2332,11 @@ int slsReceiverTCPIPInterface::set_dynamic_range() {
|
|||||||
strcpy(mess,"Receiver not set up\n");
|
strcpy(mess,"Receiver not set up\n");
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}else{
|
}else{
|
||||||
if(dr > 0)
|
if(dr > 0){
|
||||||
receiverBase->setDynamicRange(dr);
|
ret = receiverBase->setDynamicRange(dr);
|
||||||
|
if(ret == FAIL)
|
||||||
|
strcpy(mess, "Could not allocate memory for fifo or could not start listening/writing threads\n");
|
||||||
|
}
|
||||||
retval = receiverBase->getDynamicRange();
|
retval = receiverBase->getDynamicRange();
|
||||||
if(dr > 0 && retval != dr)
|
if(dr > 0 && retval != dr)
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
@ -2461,8 +2472,8 @@ int slsReceiverTCPIPInterface::enable_tengiga() {
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(val >= 0)
|
if(val >= 0)
|
||||||
receiverBase->setDataCompressionEnable(val);
|
ret = receiverBase->setTenGigaEnable(val);
|
||||||
retval=receiverBase->getDataCompressionEnable();
|
retval=receiverBase->getTenGigaEnable();
|
||||||
if((val >= 0) && (val != retval))
|
if((val >= 0) && (val != retval))
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user