can set zmqport from receiver, ensured proper destructors, and ctrl c should kill it

This commit is contained in:
Dhanya Maliakal
2017-07-13 12:17:49 +02:00
parent 672c42a20e
commit 39560969f4
22 changed files with 217 additions and 119 deletions

View File

@ -24,6 +24,7 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
/**
* Constructor
* Calls Base Class CreateThread(), sets ErrorMask if error and increments NumberofDataProcessors
* @param ind self index
* @param f address of Fifo pointer
* @param ftype pointer to file format type
* @param fwenable pointer to file writer enable
@ -31,7 +32,7 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
* @param dataReadycb pointer to data ready call back function
* @param pDataReadycb pointer to arguments of data ready call back function
*/
DataProcessor(Fifo*& f, fileFormat* ftype, bool* fwenable, bool* dsEnable,
DataProcessor(int ind, Fifo*& f, fileFormat* ftype, bool* fwenable, bool* dsEnable,
void (*dataReadycb)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t,
char*, uint32_t, void*),
void *pDataReadycb);

View File

@ -20,13 +20,14 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
/**
* Constructor
* Calls Base Class CreateThread(), sets ErrorMask if error and increments NumberofDataStreamers
* @param ind self index
* @param f address of Fifo pointer
* @param dr pointer to dynamic range
* @param freq pointer to streaming frequency
* @param timer pointer to timer if streaming frequency is random
* @param sEnable pointer to short frame enable
*/
DataStreamer(Fifo*& f, uint32_t* dr, uint32_t* freq, uint32_t* timer, int* sEnable);
DataStreamer(int ind, Fifo*& f, uint32_t* dr, uint32_t* freq, uint32_t* timer, int* sEnable);
/**
* Destructor
@ -100,11 +101,11 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
/**
* Creates Zmq Sockets
* @param dindex pointer to detector index
* @param nunits pointer to number of theads/ units per detector
* @param port streaming port start index
* @return OK or FAIL
*/
int CreateZmqSockets(int* dindex, int* nunits);
int CreateZmqSockets(int* nunits, uint32_t port);
/**
* Shuts down and deletes Zmq Sockets

View File

@ -20,11 +20,12 @@ class Fifo : private virtual slsReceiverDefs {
/**
* Constructor
* Calls CreateFifos that creates fifos and allocates memory
* @param ind self index
* @param fifoItemSize size of each fifo item
* @param fifoDepth fifo depth
* @param success true if successful, else false
*/
Fifo(uint32_t fifoItemSize, uint32_t fifoDepth, bool &success);
Fifo(int ind, uint32_t fifoItemSize, uint32_t fifoDepth, bool &success);
/**
* Destructor

View File

@ -21,6 +21,7 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject {
/**
* Constructor
* Calls Base Class CreateThread(), sets ErrorMask if error and increments NumberofListerners
* @param ind self index
* @param dtype detector type
* @param f address of Fifo pointer
* @param s pointer to receiver status
@ -30,7 +31,7 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject {
* @param nf pointer to number of images to catch
* @param dr pointer to dynamic range
*/
Listener(detectorType dtype, Fifo*& f, runStatus* s, uint32_t* portno, char* e, int* act, uint64_t* nf, uint32_t* dr);
Listener(int ind, detectorType dtype, Fifo*& f, runStatus* s, uint32_t* portno, char* e, int* act, uint64_t* nf, uint32_t* dr);
/**
* Destructor

View File

@ -19,9 +19,8 @@ class ThreadObject : private virtual slsReceiverDefs {
public:
/**
* Constructor
* @param ind self index
*/
ThreadObject(int ind);
ThreadObject();
/**
* Destructor

View File

@ -241,6 +241,12 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
*/
int getActivate() const;
/**
* Get Streaming Port
* @return streaming port
*/
uint32_t getStreamingPort() const;
/*************************************************************************
@ -497,11 +503,6 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
*/
void abort(); //FIXME: needed, isn't stopReceiver enough?
/**
* Closes all files
*/
void closeFiles();
/**
* Activate / Deactivate Receiver
* If deactivated, receiver will write dummy packets 0xFF
@ -509,6 +510,12 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
*/
int setActivate(int enable = -1);
/**
* Set streaming port
* @param i streaming port
*/
void setStreamingPort(const uint32_t i);
//***callback functions***
/**
* Call back for start acquisition
@ -629,6 +636,8 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
/** Data Stream Enable from Receiver */
bool dataStreamEnable;
static const int DEFAULT_STREAMING_TIMER = 500;
/** streaming port */
uint32_t streamingPort;
//***callback parameters***

View File

@ -20,7 +20,6 @@
class UDPInterface {
/* abstract class that defines the UDP interface of an sls detector data receiver.
*
@ -302,6 +301,12 @@ class UDPInterface {
*/
virtual int getActivate() const = 0;
/**
* Get Streaming Port
* @return streaming port
*/
virtual uint32_t getStreamingPort() const = 0;
/*************************************************************************
* Setters ***************************************************************
@ -555,11 +560,6 @@ class UDPInterface {
*/
virtual void abort() = 0; //FIXME: needed, isnt stopReceiver enough?
/**
* Closes all files
*/
virtual void closeFiles() = 0;
/**
* Activate / Deactivate Receiver
* If deactivated, receiver will write dummy packets 0xFF
@ -567,6 +567,12 @@ class UDPInterface {
*/
virtual int setActivate(int enable = -1) = 0;
/**
* Set streaming port
* @param i streaming port
*/
virtual void setStreamingPort(const uint32_t i) = 0;
//***callback functions***
/**

View File

@ -46,11 +46,6 @@ class slsReceiver : private virtual slsReceiverDefs {
*/
void stop();
/**
* Close File and exits receiver server
*/
void closeFile(int p);
/**
* get get Receiver Version
\returns id

View File

@ -51,10 +51,6 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
void stop();
/** Close all threaded Files and exit */
void closeFile(int p);
/** gets version */
int64_t getReceiverVersion();
@ -265,6 +261,9 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
/** set multi detector size */
int set_multi_detector_size();
/** set streaming port */
int set_streaming_port();
/** detector type */

View File

@ -29,9 +29,6 @@ public:
/** Destructor */
~slsReceiverUsers();
/** Close File and exits receiver server */
void closeFile(int p);
/**
* starts listening on the TCP port for client comminication
\return 0 for success or 1 for FAIL in creating TCP server

View File

@ -60,6 +60,7 @@ enum recFuncs{
F_SEND_RECEIVER_DETPOSID, /** < sets the detector position id in the reveiver */
F_SEND_RECEIVER_MULTIDETSIZE, /** < sets the multi detector size to the receiver */
F_SET_RECEIVER_STREAMING_PORT, /** < sets the receiver streaming port */
/* Always append functions hereafter!!! */