rx_zmqstartfnum, not tested

This commit is contained in:
2020-07-16 12:18:18 +02:00
parent ca298580f3
commit 67bb0dff1a
12 changed files with 94 additions and 6 deletions

View File

@ -199,6 +199,8 @@ int ClientInterface::functionTable(){
flist[F_SET_RECEIVER_NUM_GATES] = &ClientInterface::set_num_gates;
flist[F_SET_RECEIVER_GATE_DELAY] = &ClientInterface::set_gate_delay;
flist[F_GET_RECEIVER_THREAD_IDS] = &ClientInterface::get_thread_ids;
flist[F_GET_RECEIVER_STREAMING_START_FNUM] = &ClientInterface::get_streaming_start_fnum;
flist[F_SET_RECEIVER_STREAMING_START_FNUM] = &ClientInterface::set_streaming_start_fnum;
for (int i = NUM_DET_FUNCTIONS + 1; i < NUM_REC_FUNCTIONS ; i++) {
LOG(logDEBUG1) << "function fnum: " << i << " (" <<
@ -1707,4 +1709,25 @@ int ClientInterface::get_thread_ids(Interface &socket) {
auto retval = impl()->getThreadIds();
LOG(logDEBUG1) << "thread ids retval: " << sls::ToString(retval);
return socket.sendResult(retval);
}
}
int ClientInterface::get_streaming_start_fnum(Interface &socket) {
int retval = impl()->getStreamingStartingFrameNumber();
LOG(logDEBUG1) << "streaming start fnum:" << retval;
return socket.sendResult(retval);
}
int ClientInterface::set_streaming_start_fnum(Interface &socket) {
auto index = socket.Receive<int>();
if (index < 0) {
throw RuntimeError("Invalid streaming start frame number: " +
std::to_string(index));
}
verifyIdle(socket);
LOG(logDEBUG1) << "Setting streaming start fnum: " << index;
impl()->setStreamingStartingFrameNumber(index);
int retval = impl()->getStreamingStartingFrameNumber();
validate(index, retval, "set streaming start fnum", DEC);
return socket.Send(OK);
}

View File

@ -155,6 +155,8 @@ class ClientInterface : private virtual slsDetectorDefs {
int set_num_gates(sls::ServerInterface &socket);
int set_gate_delay(sls::ServerInterface &socket);
int get_thread_ids(sls::ServerInterface &socket);
int get_streaming_start_fnum(sls::ServerInterface &socket);
int set_streaming_start_fnum(sls::ServerInterface &socket);
Implementation *impl() {
if (receiver != nullptr) {

View File

@ -24,13 +24,14 @@ const std::string DataProcessor::TypeName = "DataProcessor";
DataProcessor::DataProcessor(int ind, detectorType dtype, Fifo *f,
fileFormat *ftype, bool fwenable, bool *mfwenable,
bool *dsEnable, uint32_t *dr, uint32_t *freq,
uint32_t *timer, bool *fp, bool *act,
uint32_t *timer, uint32_t *sfnum, bool *fp, bool *act,
bool *depaden, bool *sm, bool *qe,
std::vector<int> *cdl, int *cdo, int *cad)
: ThreadObject(ind, TypeName), fifo(f), myDetectorType(dtype),
dataStreamEnable(dsEnable), fileFormatType(ftype),
fileWriteEnable(fwenable), masterFileWriteEnable(mfwenable),
dynamicRange(dr), streamingFrequency(freq), streamingTimerInMs(timer),
streamingStartFnum(sfnum),
activated(act), deactivatedPaddingEnable(depaden), silentMode(sm),
quadEnable(qe), framePadding(fp), ctbDbitList(cdl), ctbDbitOffset(cdo),
ctbAnalogDataBytes(cad) {
@ -229,7 +230,7 @@ void DataProcessor::ProcessAnImage(char *buf) {
timerBegin.tv_nsec -= ((*streamingTimerInMs) % 1000) * 1000000;
// to send first image
currentFreqCount = *streamingFrequency;
currentFreqCount = *streamingFrequency - *streamingStartFnum;
}
}

View File

@ -37,6 +37,7 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
* @param dr pointer to dynamic range
* @param freq pointer to streaming frequency
* @param timer pointer to timer if streaming frequency is random
* @param sfnum pointer to streaming starting fnum
* @param fp pointer to frame padding enable
* @param act pointer to activated
* @param depaden pointer to deactivated padding enable
@ -48,7 +49,8 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
*/
DataProcessor(int ind, detectorType dtype, Fifo *f, fileFormat *ftype,
bool fwenable, bool *mfwenable, bool *dsEnable, uint32_t *dr,
uint32_t *freq, uint32_t *timer, bool *fp, bool *act,
uint32_t *freq, uint32_t *timer,
uint32_t *sfnum, bool *fp, bool *act,
bool *depaden, bool *sm, bool *qe, std::vector<int> *cdl,
int *cdo, int *cad);
@ -275,6 +277,9 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
/** Pointer to the timer if Streaming frequency is random */
uint32_t *streamingTimerInMs;
/** Pointer to streaming starting fnum */
uint32_t *streamingStartFnum;
/** Current frequency count */
uint32_t currentFreqCount{0};

View File

@ -91,6 +91,7 @@ void Implementation::InitializeMembers() {
dataStreamEnable = false;
streamingFrequency = 1;
streamingTimerInMs = DEFAULT_STREAMING_TIMER_IN_MS;
streamingStartFnum = 0;
streamingPort = 0;
streamingSrcIP = sls::IpAddr{};
@ -292,7 +293,7 @@ void Implementation::setDetectorType(const detectorType d) {
dataProcessor.push_back(sls::make_unique<DataProcessor>(
i, myDetectorType, fifo_ptr, &fileFormatType, fileWriteEnable,
&masterFileWriteEnable, &dataStreamEnable, &dynamicRange,
&streamingFrequency, &streamingTimerInMs, &framePadding,
&streamingFrequency, &streamingTimerInMs, &streamingStartFnum, &framePadding,
&activated, &deactivatedPaddingEnable, &silentMode, &quadEnable,
&ctbDbitList, &ctbDbitOffset, &ctbAnalogDataBytes));
} catch (...) {
@ -1017,7 +1018,7 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
dataProcessor.push_back(sls::make_unique<DataProcessor>(
i, myDetectorType, fifo_ptr, &fileFormatType,
fileWriteEnable, &masterFileWriteEnable, &dataStreamEnable,
&dynamicRange, &streamingFrequency, &streamingTimerInMs,
&dynamicRange, &streamingFrequency, &streamingTimerInMs, &streamingStartFnum,
&framePadding, &activated, &deactivatedPaddingEnable,
&silentMode, &quadEnable, &ctbDbitList, &ctbDbitOffset,
&ctbAnalogDataBytes));
@ -1232,6 +1233,18 @@ void Implementation::setStreamingTimer(const uint32_t time_in_ms) {
LOG(logINFO) << "Streamer Timer: " << streamingTimerInMs;
}
uint32_t Implementation::getStreamingStartingFrameNumber() const {
LOG(logDEBUG3) << __SHORT_AT__ << " called";
return streamingStartFnum;
}
void Implementation::setStreamingStartingFrameNumber(const uint32_t fnum) {
if (streamingStartFnum != fnum) {
streamingStartFnum = fnum;
}
LOG(logINFO) << "Streaming Start Frame num: " << streamingStartFnum;
}
uint32_t Implementation::getStreamingPort() const {
LOG(logDEBUG3) << __SHORT_AT__ << " called";
return streamingPort;

View File

@ -121,6 +121,8 @@ class Implementation : private virtual slsDetectorDefs {
void setStreamingFrequency(const uint32_t freq);
uint32_t getStreamingTimer() const;
void setStreamingTimer(const uint32_t time_in_ms);
uint32_t getStreamingStartingFrameNumber() const;
void setStreamingStartingFrameNumber(const uint32_t fnum);
uint32_t getStreamingPort() const;
void setStreamingPort(const uint32_t i);
sls::IpAddr getStreamingSourceIP() const;
@ -299,6 +301,7 @@ class Implementation : private virtual slsDetectorDefs {
bool dataStreamEnable;
uint32_t streamingFrequency;
uint32_t streamingTimerInMs;
uint32_t streamingStartFnum;
uint32_t streamingPort;
sls::IpAddr streamingSrcIP;
std::map<std::string, std::string> additionalJsonHeader;