fixed time interval in receiveR

This commit is contained in:
Dhanya Maliakal 2016-11-10 14:37:26 +01:00
parent 70326f8b10
commit acb900961a
5 changed files with 41 additions and 3 deletions

View File

@ -154,6 +154,12 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
*/ */
uint32_t getFrameToGuiFrequency() const; uint32_t getFrameToGuiFrequency() const;
/**
* Gets the timer between frames streamed when frequency is set to 0
* @return timer between frames streamed
*/
uint32_t getFrameToGuiTimer() const;
/** /**
* Get the data stream enable * Get the data stream enable
* @return 1 to send via zmq, else 0 * @return 1 to send via zmq, else 0
@ -317,6 +323,12 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
*/ */
int setFrameToGuiFrequency(const uint32_t freq); int setFrameToGuiFrequency(const uint32_t freq);
/**
* Sets the timer between frames streamed when frequency is set to 0
* @param time_in_ms timer between frames streamed
*/
void setFrameToGuiTimer(const uint32_t time_in_ms);
/** /**
* Set the data stream enable * Set the data stream enable
* @param enable 0 to disable, 1 to enable * @param enable 0 to disable, 1 to enable
@ -555,8 +567,11 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
int shortFrameEnable; int shortFrameEnable;
/** Frequency of Frames sent to GUI */ /** Frequency of Frames sent to GUI */
uint32_t frameToGuiFrequency; uint32_t frameToGuiFrequency;
/** Timer of Frames sent to GUI when frequency is 0 */
uint32_t frameToGuiTimerinMS;
/** Data Stream Enable from Receiver */ /** Data Stream Enable from Receiver */
int32_t dataStreamEnable; int32_t dataStreamEnable;
static const int DEFAULT_STREAMING_TIMER = 500;

View File

@ -214,6 +214,13 @@ class UDPInterface {
*/ */
virtual uint32_t getFrameToGuiFrequency() const = 0; virtual uint32_t getFrameToGuiFrequency() const = 0;
/**
* Gets the timer between frames streamed when frequency is set to 0
* @return timer between frames streamed
*/
virtual uint32_t getFrameToGuiTimer() const = 0;
/** /**
* Get the data stream enable * Get the data stream enable
* @return 1 to send via zmq, else 0 * @return 1 to send via zmq, else 0
@ -372,6 +379,12 @@ class UDPInterface {
*/ */
virtual int setFrameToGuiFrequency(const uint32_t freq) = 0; virtual int setFrameToGuiFrequency(const uint32_t freq) = 0;
/**
* Sets the timer between frames streamed when frequency is set to 0
* @param time_in_ms timer between frames streamed
*/
virtual void setFrameToGuiTimer(const uint32_t time_in_ms) = 0;
/** /**
* Set the data stream enable * Set the data stream enable
* @param enable 0 to disable, 1 to enable * @param enable 0 to disable, 1 to enable

View File

@ -77,6 +77,7 @@ void UDPBaseImplementation::initializeMembers(){
//***acquisition parameters*** //***acquisition parameters***
shortFrameEnable = -1; shortFrameEnable = -1;
frameToGuiFrequency = 0; frameToGuiFrequency = 0;
frameToGuiTimerinMS = DEFAULT_STREAMING_TIMER;
dataStreamEnable = false; dataStreamEnable = false;
} }
@ -176,6 +177,8 @@ int UDPBaseImplementation::getShortFrameEnable() const{ FILE_LOG(logDEBUG) << __
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::getFrameToGuiTimer() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return frameToGuiTimerinMS;}
uint32_t UDPBaseImplementation::getDataStreamEnable() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return dataStreamEnable;} 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;}
@ -328,6 +331,13 @@ int UDPBaseImplementation::setFrameToGuiFrequency(const uint32_t freq){
return OK; return OK;
} }
void UDPBaseImplementation::setFrameToGuiTimer(const uint32_t time_in_ms){
FILE_LOG(logDEBUG) << __AT__ << " starting";
frameToGuiTimerinMS = time_in_ms;
FILE_LOG(logINFO) << "Frame To Gui Timer:" << frameToGuiTimerinMS;
}
uint32_t UDPBaseImplementation::setDataStreamEnable(const uint32_t enable){ uint32_t UDPBaseImplementation::setDataStreamEnable(const uint32_t enable){
FILE_LOG(logDEBUG) << __AT__ << " starting"; FILE_LOG(logDEBUG) << __AT__ << " starting";

View File

@ -1814,7 +1814,7 @@ void UDPStandardImplementation::startDataCallback(){
cprintf(BLUE,"%d Elapsed time:%f seconds\n",ithread,( end.tv_sec - begin.tv_sec ) + ( end.tv_nsec - begin.tv_nsec ) / 1000000000.0); cprintf(BLUE,"%d Elapsed time:%f seconds\n",ithread,( end.tv_sec - begin.tv_sec ) + ( end.tv_nsec - begin.tv_nsec ) / 1000000000.0);
#endif #endif
//still less than 250 ms, keep waiting //still less than 250 ms, keep waiting
if((( end.tv_sec - begin.tv_sec ) + ( end.tv_nsec - begin.tv_nsec ) / 1000000000.0) < 0.5)/**fixed 250 ms*/ if((( end.tv_sec - begin.tv_sec ) + ( end.tv_nsec - begin.tv_nsec ) / 1000000000.0) < (frameToGuiTimerinMS/1000))
continue; continue;
//done with timer, look into data //done with timer, look into data
randomSendNow = true; randomSendNow = true;

View File

@ -2177,9 +2177,9 @@ int slsReceiverTCPIPInterface::set_read_receiver_timer(){
} }
else{ else{
if(index >= 0 ){ if(index >= 0 ){
receiverBase->setDataStreamTimer(index); receiverBase->setFrameToGuiTimer(index);
} }
retval=receiverBase->getDataStreamTimer(); retval=receiverBase->getFrameToGuiTimer();
if(index>=0 && retval!=index){ if(index>=0 && retval!=index){
strcpy(mess,"Could not set datastream timer"); strcpy(mess,"Could not set datastream timer");
cprintf(RED,"%s\n",mess); cprintf(RED,"%s\n",mess);