mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 01:58:00 +02:00
zmq hwm are specified to 2 for gui and restreaming of receiver if all zmq not closed at end of acquiistion
This commit is contained in:
@ -206,6 +206,8 @@ int ClientInterface::functionTable(){
|
||||
flist[F_SET_RECEIVER_RATE_CORRECT] = &ClientInterface::set_rate_correct;
|
||||
flist[F_SET_RECEIVER_SCAN] = &ClientInterface::set_scan;
|
||||
flist[F_RECEIVER_SET_THRESHOLD] = &ClientInterface::set_threshold;
|
||||
flist[F_GET_RECEIVER_STREAMING_HWM] = &ClientInterface::get_streaming_hwm;
|
||||
flist[F_SET_RECEIVER_STREAMING_HWM] = &ClientInterface::set_streaming_hwm;
|
||||
|
||||
for (int i = NUM_DET_FUNCTIONS + 1; i < NUM_REC_FUNCTIONS ; i++) {
|
||||
LOG(logDEBUG1) << "function fnum: " << i << " (" <<
|
||||
@ -1657,4 +1659,21 @@ int ClientInterface::set_threshold(Interface &socket) {
|
||||
verifyIdle(socket);
|
||||
impl()->setThresholdEnergy(arg);
|
||||
return socket.Send(OK);
|
||||
}
|
||||
}
|
||||
|
||||
int ClientInterface::get_streaming_hwm(Interface &socket) {
|
||||
int retval = impl()->getStreamingHwm();
|
||||
LOG(logDEBUG1) << "zmq send hwm limit:" << retval;
|
||||
return socket.sendResult(retval);
|
||||
}
|
||||
|
||||
int ClientInterface::set_streaming_hwm(Interface &socket) {
|
||||
auto limit = socket.Receive<int>();
|
||||
if (limit < -1) {
|
||||
throw RuntimeError("Invalid zmq send hwm limit " +
|
||||
std::to_string(limit));
|
||||
}
|
||||
verifyIdle(socket);
|
||||
impl()->setStreamingHwm(limit);
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
@ -159,6 +159,8 @@ class ClientInterface : private virtual slsDetectorDefs {
|
||||
int set_rate_correct(sls::ServerInterface &socket);
|
||||
int set_scan(sls::ServerInterface &socket);
|
||||
int set_threshold(sls::ServerInterface &socket);
|
||||
int get_streaming_hwm(sls::ServerInterface &socket);
|
||||
int set_streaming_hwm(sls::ServerInterface &socket);
|
||||
|
||||
Implementation *impl() {
|
||||
if (receiver != nullptr) {
|
||||
|
@ -75,18 +75,28 @@ void DataStreamer::SetAdditionalJsonHeader(
|
||||
}
|
||||
|
||||
void DataStreamer::CreateZmqSockets(int *nunits, uint32_t port,
|
||||
const sls::IpAddr ip) {
|
||||
const sls::IpAddr ip, int hwm) {
|
||||
uint32_t portnum = port + index;
|
||||
std::string sip = ip.str();
|
||||
try {
|
||||
zmqSocket = new ZmqSocket(portnum, (ip != 0 ? sip.c_str() : nullptr));
|
||||
// set if custom
|
||||
if (hwm >= 0) {
|
||||
zmqSocket->SetSendHighWaterMark(hwm);
|
||||
if (zmqSocket->GetSendHighWaterMark() != hwm) {
|
||||
throw sls::RuntimeError(
|
||||
"Could not set zmq send high water mark to " +
|
||||
std::to_string(hwm));
|
||||
}
|
||||
}
|
||||
} catch (...) {
|
||||
LOG(logERROR) << "Could not create Zmq socket on port " << portnum
|
||||
<< " for Streamer " << index;
|
||||
throw;
|
||||
}
|
||||
LOG(logINFO) << index << " Streamer: Zmq Server started at "
|
||||
<< zmqSocket->GetZmqServerAddress();
|
||||
<< zmqSocket->GetZmqServerAddress()
|
||||
<< "[hwm: " << zmqSocket->GetSendHighWaterMark() << "]";
|
||||
}
|
||||
|
||||
void DataStreamer::CloseZmqSocket() {
|
||||
|
@ -86,8 +86,10 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
||||
* @param nunits pointer to number of theads/ units per detector
|
||||
* @param port streaming port start index
|
||||
* @param ip streaming source ip
|
||||
* @param hwm streaming high water mark
|
||||
*/
|
||||
void CreateZmqSockets(int *nunits, uint32_t port, const sls::IpAddr ip);
|
||||
void CreateZmqSockets(int *nunits, uint32_t port, const sls::IpAddr ip,
|
||||
int hwm);
|
||||
|
||||
/**
|
||||
* Shuts down and deletes Zmq Sockets
|
||||
|
@ -876,7 +876,8 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
||||
(int *)nd, &quadEnable, &numberOfTotalFrames));
|
||||
dataStreamer[i]->SetGeneralData(generalData);
|
||||
dataStreamer[i]->CreateZmqSockets(
|
||||
&numThreads, streamingPort, streamingSrcIP);
|
||||
&numThreads, streamingPort, streamingSrcIP,
|
||||
streamingHwm);
|
||||
dataStreamer[i]->SetAdditionalJsonHeader(
|
||||
additionalJsonHeader);
|
||||
|
||||
@ -1004,7 +1005,8 @@ void Implementation::setDataStreamEnable(const bool enable) {
|
||||
(int *)nd, &quadEnable, &numberOfTotalFrames));
|
||||
dataStreamer[i]->SetGeneralData(generalData);
|
||||
dataStreamer[i]->CreateZmqSockets(
|
||||
&numThreads, streamingPort, streamingSrcIP);
|
||||
&numThreads, streamingPort, streamingSrcIP,
|
||||
streamingHwm);
|
||||
dataStreamer[i]->SetAdditionalJsonHeader(
|
||||
additionalJsonHeader);
|
||||
} catch (...) {
|
||||
@ -1063,6 +1065,14 @@ void Implementation::setStreamingSourceIP(const sls::IpAddr ip) {
|
||||
LOG(logINFO) << "Streaming Source IP: " << streamingSrcIP;
|
||||
}
|
||||
|
||||
int Implementation::getStreamingHwm() const { return streamingHwm; }
|
||||
|
||||
void Implementation::setStreamingHwm(const int i) {
|
||||
streamingHwm = i;
|
||||
LOG(logINFO) << "Streaming Hwm: "
|
||||
<< (i == -1 ? "Default (-1)" : std::to_string(streamingHwm));
|
||||
}
|
||||
|
||||
std::map<std::string, std::string>
|
||||
Implementation::getAdditionalJsonHeader() const {
|
||||
return additionalJsonHeader;
|
||||
|
@ -130,6 +130,8 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
void setStreamingPort(const uint32_t i);
|
||||
sls::IpAddr getStreamingSourceIP() const;
|
||||
void setStreamingSourceIP(const sls::IpAddr ip);
|
||||
int getStreamingHwm() const;
|
||||
void setStreamingHwm(const int i);
|
||||
std::map<std::string, std::string> getAdditionalJsonHeader() const;
|
||||
void setAdditionalJsonHeader(const std::map<std::string, std::string> &c);
|
||||
std::string getAdditionalJsonParameter(const std::string &key) const;
|
||||
@ -312,6 +314,7 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
uint32_t streamingStartFnum{0};
|
||||
uint32_t streamingPort{0};
|
||||
sls::IpAddr streamingSrcIP = sls::IpAddr{};
|
||||
int streamingHwm{-1};
|
||||
std::map<std::string, std::string> additionalJsonHeader;
|
||||
|
||||
// detector parameters
|
||||
|
Reference in New Issue
Block a user