mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
included exitReceiver, using different threads to listen and write packets in receiver, edited circularfifo to use pointer references, and acquire returns frames caught
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@362 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
@ -8,7 +8,9 @@
|
||||
#include "sls_detector_defs.h"
|
||||
#include "receiver_defs.h"
|
||||
#include "genericSocket.h"
|
||||
#include "circularFifo.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@ -28,7 +30,7 @@ public:
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~slsReceiverFunctionList(){};
|
||||
virtual ~slsReceiverFunctionList(){ if(latestData) delete latestData;};
|
||||
|
||||
/**
|
||||
* Returns status of receiver: idle, running or error
|
||||
@ -132,6 +134,20 @@ public:
|
||||
*/
|
||||
int startListening();
|
||||
|
||||
/**
|
||||
* Static function - Thread started which writes packets to file.
|
||||
* Called by startReceiver()
|
||||
* @param this_pointer pointer to this object
|
||||
*/
|
||||
static void* startWritingThread(void *this_pointer);
|
||||
|
||||
/**
|
||||
* Thread started which writes packets to file.
|
||||
* Called by startReceiver()
|
||||
*
|
||||
*/
|
||||
int startWriting();
|
||||
|
||||
/**
|
||||
* Returns the buffer-current frame read by receiver
|
||||
*/
|
||||
@ -185,20 +201,23 @@ private:
|
||||
/** Frames currently in current file, starts new file when it reaches max */
|
||||
int framesInFile;
|
||||
|
||||
/** if the listening thread is running*/
|
||||
//static int listening_thread_running;
|
||||
/** Previous Frame number from buffer */
|
||||
int prevframenum;
|
||||
|
||||
/** thread listening to packets */
|
||||
pthread_t listening_thread;
|
||||
|
||||
/** thread writing packets */
|
||||
pthread_t writing_thread;
|
||||
|
||||
/** status of receiver */
|
||||
runStatus status;
|
||||
|
||||
/** File Descriptor */
|
||||
//static FILE *sfilefd;
|
||||
|
||||
/** Receiver buffer */
|
||||
char buffer[BUFFER_SIZE];
|
||||
char* buffer;
|
||||
|
||||
/** latest data */
|
||||
char* latestData;
|
||||
|
||||
/** UDP Socket between Receiver and Detector */
|
||||
genericSocket* udpSocket;
|
||||
@ -206,6 +225,17 @@ private:
|
||||
/** Server UDP Port*/
|
||||
int server_port;
|
||||
|
||||
/** Element structure to put inside a fifo */
|
||||
struct dataStruct {
|
||||
char* buffer;
|
||||
int rc;
|
||||
};
|
||||
|
||||
|
||||
//dataStruct* dataReadFrame;
|
||||
/** circular fifo to read and write data*/
|
||||
CircularFifo<dataStruct,FIFO_SIZE>* fifo;
|
||||
|
||||
public:
|
||||
/** File Descriptor */
|
||||
static FILE *sfilefd;
|
||||
|
Reference in New Issue
Block a user