mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 15:00:02 +02:00
done
This commit is contained in:
parent
58713a90aa
commit
9c8f663b8e
@ -154,6 +154,13 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
*/
|
*/
|
||||||
uint32_t getFrameToGuiFrequency() const;
|
uint32_t getFrameToGuiFrequency() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the data stream enable
|
||||||
|
* @return 1 to send via zmq, else 0
|
||||||
|
*/
|
||||||
|
uint32_t getDataStreamEnable() const;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Acquisition Period
|
* Get Acquisition Period
|
||||||
* @return acquisition period
|
* @return acquisition period
|
||||||
@ -298,10 +305,17 @@ 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 freq 0 for random frame requests, n for nth frame frequency
|
||||||
* @return OK or FAIL
|
* @return OK or FAIL
|
||||||
*/
|
*/
|
||||||
int setFrameToGuiFrequency(const uint32_t i);
|
int setFrameToGuiFrequency(const uint32_t freq);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the data stream enable
|
||||||
|
* @param enable 0 to disable, 1 to enable
|
||||||
|
* @return OK or FAIL
|
||||||
|
*/
|
||||||
|
uint32_t setDataStreamEnable(const uint32_t enable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Acquisition Period
|
* Set Acquisition Period
|
||||||
@ -525,7 +539,9 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
/* Short Frame Enable or index of adc enabled, else -1 if all enabled (gotthard specific) TODO: move to setROI */
|
/* Short Frame Enable or index of adc enabled, else -1 if all enabled (gotthard specific) TODO: move to setROI */
|
||||||
int shortFrameEnable;
|
int shortFrameEnable;
|
||||||
/** Frequency of Frames sent to GUI */
|
/** Frequency of Frames sent to GUI */
|
||||||
uint32_t FrameToGuiFrequency;
|
uint32_t frameToGuiFrequency;
|
||||||
|
/** Data Stream Enable from Receiver */
|
||||||
|
int32_t dataStreamEnable;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -214,6 +214,12 @@ class UDPInterface {
|
|||||||
*/
|
*/
|
||||||
virtual uint32_t getFrameToGuiFrequency() const = 0;
|
virtual uint32_t getFrameToGuiFrequency() const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the data stream enable
|
||||||
|
* @return 1 to send via zmq, else 0
|
||||||
|
*/
|
||||||
|
virtual uint32_t getDataStreamEnable() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Acquisition Period
|
* Get Acquisition Period
|
||||||
* @return acquisition period
|
* @return acquisition period
|
||||||
@ -355,10 +361,17 @@ 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 freq 0 for random frame requests, n for nth frame frequency
|
||||||
* @return OK or FAIL
|
* @return OK or FAIL
|
||||||
*/
|
*/
|
||||||
virtual int setFrameToGuiFrequency(const uint32_t i) = 0;
|
virtual int setFrameToGuiFrequency(const uint32_t freq) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the data stream enable
|
||||||
|
* @param enable 0 to disable, 1 to enable
|
||||||
|
* @return OK or FAIL
|
||||||
|
*/
|
||||||
|
virtual uint32_t setDataStreamEnable(const uint32_t enable) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Acquisition Period
|
* Set Acquisition Period
|
||||||
|
@ -107,12 +107,18 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
|
|||||||
void setShortFrameEnable(const int i);
|
void setShortFrameEnable(const int i);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden method
|
|
||||||
* 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 freq 0 for random frame requests, n for nth frame frequency
|
||||||
* @return OK or FAIL
|
* @return OK or FAIL
|
||||||
*/
|
*/
|
||||||
int setFrameToGuiFrequency(const uint32_t i);
|
int setFrameToGuiFrequency(const uint32_t freq);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the data stream enable
|
||||||
|
* @param enable 0 to disable, 1 to enable
|
||||||
|
* @return OK or FAIL
|
||||||
|
*/
|
||||||
|
uint32_t setDataStreamEnable(const uint32_t enable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden method
|
* Overridden method
|
||||||
@ -702,7 +708,6 @@ private:
|
|||||||
/** Set to self-terminate data callback threads waiting for semaphores */
|
/** Set to self-terminate data callback threads waiting for semaphores */
|
||||||
bool killAllDataCallbackThreads;
|
bool killAllDataCallbackThreads;
|
||||||
|
|
||||||
bool dataCallbackEnabled;
|
|
||||||
|
|
||||||
|
|
||||||
//***general and listening thread parameters***
|
//***general and listening thread parameters***
|
||||||
|
@ -176,6 +176,9 @@ private:
|
|||||||
/** Sets the receiver to send every nth frame to gui, or only upon gui request */
|
/** Sets the receiver to send every nth frame to gui, or only upon gui request */
|
||||||
int set_read_frequency();
|
int set_read_frequency();
|
||||||
|
|
||||||
|
/* Set the data stream enable */
|
||||||
|
int set_data_stream_enable();
|
||||||
|
|
||||||
/** Enable File Write*/
|
/** Enable File Write*/
|
||||||
int enable_file_write();
|
int enable_file_write();
|
||||||
|
|
||||||
|
@ -49,7 +49,9 @@ enum {
|
|||||||
F_ENABLE_RECEIVER_OVERWRITE, /**< set overwrite flag in receiver */
|
F_ENABLE_RECEIVER_OVERWRITE, /**< set overwrite flag in receiver */
|
||||||
|
|
||||||
F_ENABLE_RECEIVER_TEN_GIGA, /**< enable 10Gbe in receiver */
|
F_ENABLE_RECEIVER_TEN_GIGA, /**< enable 10Gbe in receiver */
|
||||||
F_SET_RECEIVER_FIFO_DEPTH /**< set receiver fifo depth */
|
F_SET_RECEIVER_FIFO_DEPTH, /**< set receiver fifo depth */
|
||||||
|
|
||||||
|
F_STREAM_DATA_FROM_RECEIVER /**< stream data from receiver to client */
|
||||||
|
|
||||||
/* Always append functions hereafter!!! */
|
/* Always append functions hereafter!!! */
|
||||||
};
|
};
|
||||||
|
@ -75,7 +75,8 @@ void UDPBaseImplementation::initializeMembers(){
|
|||||||
|
|
||||||
//***acquisition parameters***
|
//***acquisition parameters***
|
||||||
shortFrameEnable = -1;
|
shortFrameEnable = -1;
|
||||||
FrameToGuiFrequency = 0;
|
frameToGuiFrequency = 0;
|
||||||
|
dataStreamEnable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
UDPBaseImplementation::~UDPBaseImplementation(){}
|
UDPBaseImplementation::~UDPBaseImplementation(){}
|
||||||
@ -172,7 +173,9 @@ char *UDPBaseImplementation::getEthernetInterface() const{
|
|||||||
/***acquisition parameters***/
|
/***acquisition parameters***/
|
||||||
int UDPBaseImplementation::getShortFrameEnable() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return shortFrameEnable;}
|
int UDPBaseImplementation::getShortFrameEnable() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return shortFrameEnable;}
|
||||||
|
|
||||||
uint32_t UDPBaseImplementation::getFrameToGuiFrequency() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return FrameToGuiFrequency;}
|
uint32_t UDPBaseImplementation::getFrameToGuiFrequency() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return frameToGuiFrequency;}
|
||||||
|
|
||||||
|
uint32_t UDPBaseImplementation::getDataStreamEnable() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return dataStreamEnable;}
|
||||||
|
|
||||||
uint64_t UDPBaseImplementation::getAcquisitionPeriod() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return acquisitionPeriod;}
|
uint64_t UDPBaseImplementation::getAcquisitionPeriod() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return acquisitionPeriod;}
|
||||||
|
|
||||||
@ -314,16 +317,28 @@ void UDPBaseImplementation::setShortFrameEnable(const int i){
|
|||||||
FILE_LOG(logINFO) << "Short Frame Enable: " << stringEnable(shortFrameEnable);
|
FILE_LOG(logINFO) << "Short Frame Enable: " << stringEnable(shortFrameEnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
int UDPBaseImplementation::setFrameToGuiFrequency(const uint32_t i){
|
int UDPBaseImplementation::setFrameToGuiFrequency(const uint32_t freq){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
FrameToGuiFrequency = i;
|
frameToGuiFrequency = freq;
|
||||||
FILE_LOG(logINFO) << "Frame To Gui Frequency:" << FrameToGuiFrequency;
|
FILE_LOG(logINFO) << "Frame To Gui Frequency:" << frameToGuiFrequency;
|
||||||
|
|
||||||
//overrridden child classes might return FAIL
|
//overrridden child classes might return FAIL
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint32_t UDPBaseImplementation::setDataStreamEnable(const uint32_t enable){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
dataStreamEnable = enable;
|
||||||
|
FILE_LOG(logINFO) << "Streaming Data from Receiver:" << dataStreamEnable;
|
||||||
|
|
||||||
|
//overrridden child classes might return FAIL
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int UDPBaseImplementation::setAcquisitionPeriod(const uint64_t i){
|
int UDPBaseImplementation::setAcquisitionPeriod(const uint64_t i){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
@ -195,7 +195,8 @@ void UDPStandardImplementation::initializeMembers(){
|
|||||||
numberofDataCallbackThreads = 1;
|
numberofDataCallbackThreads = 1;
|
||||||
dataCallbackThreadsMask = 0x0;
|
dataCallbackThreadsMask = 0x0;
|
||||||
killAllDataCallbackThreads = false;
|
killAllDataCallbackThreads = false;
|
||||||
dataCallbackEnabled = true; /**false*/
|
dataStreamEnable = false;
|
||||||
|
|
||||||
|
|
||||||
//***general and listening thread parameters***
|
//***general and listening thread parameters***
|
||||||
threadStarted = false;
|
threadStarted = false;
|
||||||
@ -282,8 +283,8 @@ int UDPStandardImplementation::setupFifoStructure(){
|
|||||||
//else calculate best possible number of frames to listen to at a time (for fast readouts like gotthard)
|
//else calculate best possible number of frames to listen to at a time (for fast readouts like gotthard)
|
||||||
else{
|
else{
|
||||||
//if frequency to gui is not random (every nth frame), then listen to only n frames per buffer
|
//if frequency to gui is not random (every nth frame), then listen to only n frames per buffer
|
||||||
if(FrameToGuiFrequency)
|
if(frameToGuiFrequency)
|
||||||
numberofJobsPerBuffer = FrameToGuiFrequency;
|
numberofJobsPerBuffer = frameToGuiFrequency;
|
||||||
//random frame sent to gui, then frames per buffer depends on acquisition period
|
//random frame sent to gui, then frames per buffer depends on acquisition period
|
||||||
else{
|
else{
|
||||||
//calculate 100ms/period to get frames to listen to at a time
|
//calculate 100ms/period to get frames to listen to at a time
|
||||||
@ -445,17 +446,13 @@ void UDPStandardImplementation::setFileName(const char c[]){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(dataCallbackEnabled && (strcmp(oldfilename,fileName))){cout<<"***Going to destroy data callback threads and create!!!"<<endl;
|
if(dataStreamEnable && (strcmp(oldfilename,fileName))){
|
||||||
if(zmqThreadStarted){
|
if(zmqThreadStarted)
|
||||||
createDataCallbackThreads(true);
|
createDataCallbackThreads(true);
|
||||||
zmqThreadStarted = false;
|
|
||||||
}
|
|
||||||
cout<<"***datacallback threads destroyed"<<endl;
|
|
||||||
numberofDataCallbackThreads = MAX_NUMBER_OF_LISTENING_THREADS;
|
numberofDataCallbackThreads = MAX_NUMBER_OF_LISTENING_THREADS;
|
||||||
if(createDataCallbackThreads() == FAIL){
|
if(createDataCallbackThreads() == FAIL){
|
||||||
cprintf(BG_RED,"Error: Could not create data callback threads\n");
|
cprintf(BG_RED,"Error: Could not create data callback threads\n");
|
||||||
}
|
}
|
||||||
cout<<"data call back threads created"<<endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -552,19 +549,52 @@ void UDPStandardImplementation::setShortFrameEnable(const int i){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int UDPStandardImplementation::setFrameToGuiFrequency(const uint32_t i){
|
int UDPStandardImplementation::setFrameToGuiFrequency(const uint32_t freq){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " called";
|
FILE_LOG(logDEBUG) << __AT__ << " called";
|
||||||
|
|
||||||
FrameToGuiFrequency = i;
|
frameToGuiFrequency = freq;
|
||||||
if(setupFifoStructure() == FAIL)
|
if(setupFifoStructure() == FAIL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
|
||||||
FILE_LOG(logINFO) << "Frame to Gui Frequency: " << FrameToGuiFrequency;
|
FILE_LOG(logINFO) << "Frame to Gui Frequency: " << frameToGuiFrequency;
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
uint32_t UDPStandardImplementation::setDataStreamEnable(const uint32_t enable){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " called";
|
||||||
|
|
||||||
|
|
||||||
|
cout<<"************datasend:"<<enable<<endl;
|
||||||
|
|
||||||
|
int olddatasend = dataStreamEnable;
|
||||||
|
dataStreamEnable = enable;
|
||||||
|
//if there is a change
|
||||||
|
if(olddatasend != dataStreamEnable){
|
||||||
|
cout<<"***Going to destroy data callback threads and create!!!"<<endl;
|
||||||
|
if(zmqThreadStarted)
|
||||||
|
createDataCallbackThreads(true);
|
||||||
|
cout<<"***datacallback threads destroyed"<<endl;
|
||||||
|
|
||||||
|
if(dataStreamEnable){
|
||||||
|
numberofDataCallbackThreads = MAX_NUMBER_OF_LISTENING_THREADS;
|
||||||
|
if(createDataCallbackThreads() == FAIL){
|
||||||
|
cprintf(BG_RED,"Error: Could not create data callback threads\n");
|
||||||
|
}
|
||||||
|
cout<<"data call back threads created"<<endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FILE_LOG(logINFO) << "Data Send to Gui: " << dataStreamEnable;
|
||||||
|
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int UDPStandardImplementation::setAcquisitionPeriod(const uint64_t i){
|
int UDPStandardImplementation::setAcquisitionPeriod(const uint64_t i){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " called";
|
FILE_LOG(logDEBUG) << __AT__ << " called";
|
||||||
|
|
||||||
@ -839,7 +869,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d){
|
|||||||
setupFifoStructure();
|
setupFifoStructure();
|
||||||
|
|
||||||
numberofDataCallbackThreads = MAX_NUMBER_OF_LISTENING_THREADS;
|
numberofDataCallbackThreads = MAX_NUMBER_OF_LISTENING_THREADS;
|
||||||
if(dataCallbackEnabled)
|
if(dataStreamEnable)
|
||||||
createDataCallbackThreads();
|
createDataCallbackThreads();
|
||||||
|
|
||||||
//allocate for latest data (frame copy for gui), free variables
|
//allocate for latest data (frame copy for gui), free variables
|
||||||
@ -939,8 +969,8 @@ int UDPStandardImplementation::startReceiver(char *c){
|
|||||||
}
|
}
|
||||||
FILE_LOG(logINFO) << "Number of Jobs Per Buffer: " << numberofJobsPerBuffer;
|
FILE_LOG(logINFO) << "Number of Jobs Per Buffer: " << numberofJobsPerBuffer;
|
||||||
FILE_LOG(logINFO) << "Max Frames Per File:" << maxFramesPerFile;
|
FILE_LOG(logINFO) << "Max Frames Per File:" << maxFramesPerFile;
|
||||||
if(FrameToGuiFrequency)
|
if(frameToGuiFrequency)
|
||||||
FILE_LOG(logINFO) << "Frequency of frames sent to gui: " << FrameToGuiFrequency;
|
FILE_LOG(logINFO) << "Frequency of frames sent to gui: " << frameToGuiFrequency;
|
||||||
else
|
else
|
||||||
FILE_LOG(logINFO) << "Frequency of frames sent to gui: Random";
|
FILE_LOG(logINFO) << "Frequency of frames sent to gui: Random";
|
||||||
|
|
||||||
@ -980,7 +1010,7 @@ int UDPStandardImplementation::startReceiver(char *c){
|
|||||||
listeningThreadsMask|=(1<<i);
|
listeningThreadsMask|=(1<<i);
|
||||||
for(int i=0;i<numberofWriterThreads;i++)
|
for(int i=0;i<numberofWriterThreads;i++)
|
||||||
writerThreadsMask|=(1<<i);
|
writerThreadsMask|=(1<<i);
|
||||||
if(dataCallbackEnabled){
|
if(dataStreamEnable){
|
||||||
for(int i=0;i<numberofDataCallbackThreads;i++)
|
for(int i=0;i<numberofDataCallbackThreads;i++)
|
||||||
dataCallbackThreadsMask|=(1<<i);
|
dataCallbackThreadsMask|=(1<<i);
|
||||||
}
|
}
|
||||||
@ -992,7 +1022,7 @@ int UDPStandardImplementation::startReceiver(char *c){
|
|||||||
sem_post(&listenSemaphore[i]);
|
sem_post(&listenSemaphore[i]);
|
||||||
for(int i=0; i < numberofWriterThreads; i++)
|
for(int i=0; i < numberofWriterThreads; i++)
|
||||||
sem_post(&writerSemaphore[i]);
|
sem_post(&writerSemaphore[i]);
|
||||||
if(dataCallbackEnabled){
|
if(dataStreamEnable){
|
||||||
for(int i=0;i<numberofDataCallbackThreads;i++)
|
for(int i=0;i<numberofDataCallbackThreads;i++)
|
||||||
sem_post(&dataCallbackSemaphore[i]);
|
sem_post(&dataCallbackSemaphore[i]);
|
||||||
}
|
}
|
||||||
@ -1639,8 +1669,7 @@ void UDPStandardImplementation::startDataCallback(){cprintf(MAGENTA,"start data
|
|||||||
|
|
||||||
//set current thread value index
|
//set current thread value index
|
||||||
int ithread = currentThreadIndex;
|
int ithread = currentThreadIndex;
|
||||||
//let calling function know thread started and obtained current
|
|
||||||
zmqThreadStarted = 1;
|
|
||||||
|
|
||||||
// server address to bind
|
// server address to bind
|
||||||
char hostName[100] = "tcp://127.0.0.1:";
|
char hostName[100] = "tcp://127.0.0.1:";
|
||||||
@ -1668,6 +1697,9 @@ void UDPStandardImplementation::startDataCallback(){cprintf(MAGENTA,"start data
|
|||||||
// bind
|
// bind
|
||||||
zmq_bind(zmqsocket,hostName);
|
zmq_bind(zmqsocket,hostName);
|
||||||
|
|
||||||
|
//let calling function know thread started and obtained current (after sockets created)
|
||||||
|
if(!zmqThreadStarted)
|
||||||
|
zmqThreadStarted = true;
|
||||||
|
|
||||||
currentfnum = -1;
|
currentfnum = -1;
|
||||||
/* inner loop - loop for each buffer */
|
/* inner loop - loop for each buffer */
|
||||||
@ -2404,7 +2436,7 @@ void UDPStandardImplementation::stopWriting(int ithread, char* wbuffer){
|
|||||||
cprintf(YELLOW,"Writing_Thread %d: Freeing dummy-end buffer. Pushed into fifofree %p for listener %d\n", ithread,(void*)(wbuffer),ithread);
|
cprintf(YELLOW,"Writing_Thread %d: Freeing dummy-end buffer. Pushed into fifofree %p for listener %d\n", ithread,(void*)(wbuffer),ithread);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(dataCallbackEnabled){
|
if(dataStreamEnable){
|
||||||
//ensure previous frame was processed
|
//ensure previous frame was processed
|
||||||
sem_wait(&writerGuiSemaphore[ithread]);
|
sem_wait(&writerGuiSemaphore[ithread]);
|
||||||
guiNumPackets[ithread] = dummyPacketValue;
|
guiNumPackets[ithread] = dummyPacketValue;
|
||||||
@ -2518,7 +2550,7 @@ void UDPStandardImplementation::handleWithoutDataCompression(int ithread, char*
|
|||||||
|
|
||||||
//copy frame for gui
|
//copy frame for gui
|
||||||
//if(npackets >= (packetsPerFrame/numberofListeningThreads))
|
//if(npackets >= (packetsPerFrame/numberofListeningThreads))
|
||||||
if(dataCallbackEnabled && npackets)
|
if(dataStreamEnable && npackets)
|
||||||
copyFrameToGui(ithread, wbuffer,npackets);
|
copyFrameToGui(ithread, wbuffer,npackets);
|
||||||
#ifdef DEBUG4
|
#ifdef DEBUG4
|
||||||
cprintf(GREEN,"Writing_Thread: Copied frame\n");
|
cprintf(GREEN,"Writing_Thread: Copied frame\n");
|
||||||
@ -2700,7 +2732,7 @@ void UDPStandardImplementation::copyFrameToGui(int ithread, char* buffer, uint32
|
|||||||
FILE_LOG(logDEBUG) << __AT__ << " called";
|
FILE_LOG(logDEBUG) << __AT__ << " called";
|
||||||
|
|
||||||
//if nthe frame, wait for your turn (1st frame always shown as its zero)
|
//if nthe frame, wait for your turn (1st frame always shown as its zero)
|
||||||
if(FrameToGuiFrequency && ((frametoGuiCounter[ithread])%FrameToGuiFrequency));
|
if(frameToGuiFrequency && ((frametoGuiCounter[ithread])%frameToGuiFrequency));
|
||||||
|
|
||||||
//random read (gui ready) or nth frame read: gui needs data now or it is the first frame
|
//random read (gui ready) or nth frame read: gui needs data now or it is the first frame
|
||||||
else{
|
else{
|
||||||
@ -2725,7 +2757,7 @@ void UDPStandardImplementation::copyFrameToGui(int ithread, char* buffer, uint32
|
|||||||
}
|
}
|
||||||
|
|
||||||
//update the counter for nth frame
|
//update the counter for nth frame
|
||||||
if(FrameToGuiFrequency)
|
if(frameToGuiFrequency)
|
||||||
frametoGuiCounter[ithread]++;
|
frametoGuiCounter[ithread]++;
|
||||||
|
|
||||||
|
|
||||||
@ -2852,7 +2884,7 @@ void UDPStandardImplementation::handleDataCompression(int ithread, char* wbuffer
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
if(!once){
|
if(!once){
|
||||||
if(dataCallbackEnabled)
|
if(dataStreamEnable)
|
||||||
copyFrameToGui(ithread, buff[0],(uint32_t)packetsPerFrame);
|
copyFrameToGui(ithread, buff[0],(uint32_t)packetsPerFrame);
|
||||||
once = 1;
|
once = 1;
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ int slsReceiverTCPIPInterface::function_table(){
|
|||||||
|
|
||||||
flist[F_ENABLE_RECEIVER_TEN_GIGA] = &slsReceiverTCPIPInterface::enable_tengiga;
|
flist[F_ENABLE_RECEIVER_TEN_GIGA] = &slsReceiverTCPIPInterface::enable_tengiga;
|
||||||
flist[F_SET_RECEIVER_FIFO_DEPTH] = &slsReceiverTCPIPInterface::set_fifo_depth;
|
flist[F_SET_RECEIVER_FIFO_DEPTH] = &slsReceiverTCPIPInterface::set_fifo_depth;
|
||||||
|
flist[F_STREAM_DATA_FROM_RECEIVER] = &slsReceiverTCPIPInterface::set_data_stream_enable;
|
||||||
|
|
||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
for (int i=0;i<numberOfFunctions;i++)
|
for (int i=0;i<numberOfFunctions;i++)
|
||||||
@ -2096,22 +2096,23 @@ int slsReceiverTCPIPInterface::set_read_frequency(){
|
|||||||
}
|
}
|
||||||
else if(receiverBase->getStatus()==RUNNING || receiverBase->getStatus()==TRANSMITTING){
|
else if(receiverBase->getStatus()==RUNNING || receiverBase->getStatus()==TRANSMITTING){
|
||||||
strcpy(mess,"Can not set receiver frequency mode while receiver not idle\n");
|
strcpy(mess,"Can not set receiver frequency mode while receiver not idle\n");
|
||||||
|
cprintf(RED,"%s\n",mess);
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
else if((receiverBase->getStatus()==RUNNING) && (index >= 0)){
|
|
||||||
ret = FAIL;
|
|
||||||
strcpy(mess,"cannot set up receiver mode when receiver is running\n");
|
|
||||||
}*/
|
|
||||||
else{
|
else{
|
||||||
if(index >= 0){
|
if(index >= 0 ){
|
||||||
ret = receiverBase->setFrameToGuiFrequency(index);
|
ret = receiverBase->setFrameToGuiFrequency(index);
|
||||||
if(ret == FAIL)
|
if(ret == FAIL){
|
||||||
strcpy(mess, "Could not allocate memory for listening fifo\n");
|
strcpy(mess, "Could not allocate memory for listening fifo\n");
|
||||||
|
cprintf(RED,"%s\n",mess);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
retval=receiverBase->getFrameToGuiFrequency();
|
retval=receiverBase->getFrameToGuiFrequency();
|
||||||
if(index>=0 && retval!=index)
|
if(index>=0 && retval!=index){
|
||||||
|
strcpy(mess,"Could not set frame to gui frequency");
|
||||||
|
cprintf(RED,"%s\n",mess);
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2138,6 +2139,69 @@ int slsReceiverTCPIPInterface::set_read_frequency(){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int slsReceiverTCPIPInterface::set_data_stream_enable(){
|
||||||
|
ret=OK;
|
||||||
|
int retval=-1;
|
||||||
|
int index;
|
||||||
|
strcpy(mess,"Could not set data stream enable\n");
|
||||||
|
|
||||||
|
|
||||||
|
// receive arguments
|
||||||
|
if(socket->ReceiveDataOnly(&index,sizeof(index)) < 0 ){
|
||||||
|
strcpy(mess,"Error reading from socket\n");
|
||||||
|
ret = FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// execute action if the arguments correctly arrived
|
||||||
|
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||||
|
if (ret==OK) {
|
||||||
|
if (lockStatus==1 && socket->differentClients==1){
|
||||||
|
sprintf(mess,"Receiver locked by %s\n", socket->lastClientIP);
|
||||||
|
ret=FAIL;
|
||||||
|
}
|
||||||
|
else if (receiverBase == NULL){
|
||||||
|
strcpy(mess,SET_RECEIVER_ERR_MESSAGE);
|
||||||
|
ret=FAIL;
|
||||||
|
}
|
||||||
|
else if(receiverBase->getStatus()==RUNNING || receiverBase->getStatus()==TRANSMITTING){
|
||||||
|
strcpy(mess,"Can not set data stream enable while receiver not idle\n");
|
||||||
|
cprintf(RED,"%s\n",mess);
|
||||||
|
ret = FAIL;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(index >= 0 )
|
||||||
|
ret = receiverBase->setDataStreamEnable(index);
|
||||||
|
retval=receiverBase->getDataStreamEnable();
|
||||||
|
if(index>=0 && retval!=index){
|
||||||
|
strcpy(mess,"Could not set data stream enable");
|
||||||
|
cprintf(RED,"%s\n",mess);
|
||||||
|
ret = FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if(ret==OK && socket->differentClients){
|
||||||
|
FILE_LOG(logDEBUG) << "Force update";
|
||||||
|
ret=FORCE_UPDATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// send answer
|
||||||
|
socket->SendDataOnly(&ret,sizeof(ret));
|
||||||
|
if(ret==FAIL){
|
||||||
|
cprintf(RED,"%s\n",mess);
|
||||||
|
socket->SendDataOnly(mess,sizeof(mess));
|
||||||
|
}
|
||||||
|
socket->SendDataOnly(&retval,sizeof(retval));
|
||||||
|
|
||||||
|
//return ok/fail
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int slsReceiverTCPIPInterface::enable_file_write(){
|
int slsReceiverTCPIPInterface::enable_file_write(){
|
||||||
ret=OK;
|
ret=OK;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user