mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-05 17:40:40 +02:00
Dev/zmq stream all ipv6 adn remove rx_zmqip (#958)
* enable ipv6 in zmq socket * removed rx_zmqip API and field in gui, changed client updaterxrzip to updateclientzmqip to have the rx_hostname ip if 0. * updated command line for rx_zmqip to give a warning. * Replaced 'depreciated' to 'deprecated' everywhere * switching from * to 0.0.0.0 works for rebinding zmq sockets * fixed help in command line for rx_zmqip * to 0.0.0.0 and removed cmd in python * remove publisher zmq socket ip also for moench post processing * fixed tests * publisher zmq ip macros to be reused
This commit is contained in:
parent
15e8c0d9f1
commit
e848293916
@ -32,14 +32,14 @@ Commands
|
|||||||
.. include:: ../commands.rst
|
.. include:: ../commands.rst
|
||||||
|
|
||||||
|
|
||||||
Depreciated commands
|
Deprecated commands
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
.. note ::
|
.. note ::
|
||||||
All the dac commands are preceded with the **dac** command. Use command **daclist** to get correct list of dac command arguments for current detector.
|
All the dac commands are preceded with the **dac** command. Use command **daclist** to get correct list of dac command arguments for current detector.
|
||||||
|
|
||||||
.. csv-table:: Depreciated commands
|
.. csv-table:: Deprecated commands
|
||||||
:file: ../depreciated.csv
|
:file: ../deprecated.csv
|
||||||
:widths: 35, 35
|
:widths: 35, 35
|
||||||
:header-rows: 1
|
:header-rows: 1
|
||||||
|
|
||||||
|
@ -55,9 +55,9 @@ int main() {
|
|||||||
fs << '\t' << cmd << usage << help << "\n";
|
fs << '\t' << cmd << usage << help << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ofstream fs2("depreciated.csv");
|
std::ofstream fs2("deprecated.csv");
|
||||||
fs2 << "Old, New\n";
|
fs2 << "Old, New\n";
|
||||||
auto cmds = proxy.GetDepreciatedCommands();
|
auto cmds = proxy.GetDeprecatedCommands();
|
||||||
for (auto it : cmds) {
|
for (auto it : cmds) {
|
||||||
fs2 << it.first << ", " << it.second << '\n';
|
fs2 << it.first << ", " << it.second << '\n';
|
||||||
}
|
}
|
||||||
|
@ -1210,31 +1210,6 @@ class Detector(CppDetectorApi):
|
|||||||
else:
|
else:
|
||||||
raise ValueError("Unknown argument type")
|
raise ValueError("Unknown argument type")
|
||||||
|
|
||||||
@property
|
|
||||||
@element
|
|
||||||
def rx_zmqip(self):
|
|
||||||
"""
|
|
||||||
Zmq Ip Address from which data is to be streamed out of the receiver.
|
|
||||||
|
|
||||||
Note
|
|
||||||
-----
|
|
||||||
Also restarts receiver zmq streaming if enabled. \n
|
|
||||||
Default is from rx_hostname. \n
|
|
||||||
Modified only when using an intermediate process after receiver.
|
|
||||||
|
|
||||||
Example
|
|
||||||
-------
|
|
||||||
>>> d.rx_zmqip
|
|
||||||
192.168.0.101
|
|
||||||
>>> d.rx_zmqip = '192.168.0.101'
|
|
||||||
"""
|
|
||||||
return self.getRxZmqIP()
|
|
||||||
|
|
||||||
@rx_zmqip.setter
|
|
||||||
def rx_zmqip(self, ip):
|
|
||||||
ip = ut.make_ip(ip) #Convert from int or string to IpAddr
|
|
||||||
ut.set_using_dict(self.setRxZmqIP, ip)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def zmqip(self):
|
def zmqip(self):
|
||||||
|
@ -296,12 +296,11 @@ int main(int argc, char *argv[]) {
|
|||||||
if (send) {
|
if (send) {
|
||||||
// receive socket
|
// receive socket
|
||||||
try {
|
try {
|
||||||
zmqsocket2 = new sls::ZmqSocket(portnum2, socketip2.c_str());
|
zmqsocket2 = new sls::ZmqSocket(portnum2);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
cprintf(RED,
|
cprintf(RED,
|
||||||
"Error: Could not create Zmq sending socket on port %d and "
|
"Error: Could not create Zmq sending socket on port %d\n",
|
||||||
"ip %s\n",
|
portnum2);
|
||||||
portnum2, socketip2.c_str());
|
|
||||||
// delete zmqsocket2;
|
// delete zmqsocket2;
|
||||||
// zmqsocket2=NULL;
|
// zmqsocket2=NULL;
|
||||||
// delete zmqsocket;
|
// delete zmqsocket;
|
||||||
|
@ -852,7 +852,7 @@
|
|||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Sets Listening ZMQ IP of client interface (packets streamed from receiver for gui)</p><p>#zmqip#</p><p><br/></p><p>Has to be same as rx_zmqip for gui</p></body></html></string>
|
<string><html><head/><body><p>Sets Listening ZMQ IP of client interface (packets streamed from receiver for gui)</p><p>#zmqip#</p><p><br/></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Client ZMQ IP:</string>
|
<string>Client ZMQ IP:</string>
|
||||||
@ -886,7 +886,7 @@
|
|||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Sets Listening ZMQ IP of client interface (packets streamed from receiver for gui)</p><p>#zmqip#</p><p><br/></p><p>Has to be same as rx_zmqip for gui</p></body></html></string>
|
<string><html><head/><body><p>Sets Listening ZMQ IP of client interface (packets streamed from receiver for gui)</p><p>#zmqip#</p><p><br/></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>0</string>
|
<string>0</string>
|
||||||
@ -948,28 +948,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="3">
|
|
||||||
<widget class="QLabel" name="label_16">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Cantarell</family>
|
|
||||||
<pointsize>10</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>Sets Publishing ZMQ IP of reciever (packets streamed from receiver for gui)</p><p>#rx_zmqip#</p><p>Has to be same as zmqip for gui</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Receiver ZMQ IP:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="3">
|
<item row="1" column="3">
|
||||||
<widget class="QLabel" name="label_8">
|
<widget class="QLabel" name="label_8">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -1121,40 +1099,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="4">
|
|
||||||
<widget class="QLineEdit" name="dispRxrZMQIP">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>180</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Cantarell</family>
|
|
||||||
<pointsize>10</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>Sets Publishing ZMQ IP of reciever (packets streamed from receiver for gui)</p><p>#rx_zmqip#</p><p>Has to be same as zmqip for gui</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>0</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QLabel" name="label_11">
|
<widget class="QLabel" name="label_11">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -2312,7 +2256,6 @@ Exposure Time of a sub frame. Only for Eiger in 32 bit mode
|
|||||||
<tabstop>dispRxrUDPIP</tabstop>
|
<tabstop>dispRxrUDPIP</tabstop>
|
||||||
<tabstop>dispRxrUDPMAC</tabstop>
|
<tabstop>dispRxrUDPMAC</tabstop>
|
||||||
<tabstop>spinRxrZMQPort</tabstop>
|
<tabstop>spinRxrZMQPort</tabstop>
|
||||||
<tabstop>dispRxrZMQIP</tabstop>
|
|
||||||
<tabstop>spinNumStoragecells</tabstop>
|
<tabstop>spinNumStoragecells</tabstop>
|
||||||
<tabstop>spinSubExpTime</tabstop>
|
<tabstop>spinSubExpTime</tabstop>
|
||||||
<tabstop>comboSubExpTimeUnit</tabstop>
|
<tabstop>comboSubExpTimeUnit</tabstop>
|
||||||
|
@ -38,8 +38,6 @@ class qTabAdvanced : public QWidget, private Ui::TabAdvancedObject {
|
|||||||
void SetRxrUDPMAC(bool force = false);
|
void SetRxrUDPMAC(bool force = false);
|
||||||
void ForceSetRxrUDPMAC();
|
void ForceSetRxrUDPMAC();
|
||||||
void SetRxrZMQPort(int port);
|
void SetRxrZMQPort(int port);
|
||||||
void SetRxrZMQIP(bool force = false);
|
|
||||||
void ForceSetRxrZMQIP();
|
|
||||||
void GetROI();
|
void GetROI();
|
||||||
void ClearROI();
|
void ClearROI();
|
||||||
void SetROI();
|
void SetROI();
|
||||||
@ -68,7 +66,6 @@ class qTabAdvanced : public QWidget, private Ui::TabAdvancedObject {
|
|||||||
void GetRxrUDPIP();
|
void GetRxrUDPIP();
|
||||||
void GetRxrUDPMAC();
|
void GetRxrUDPMAC();
|
||||||
void GetRxrZMQPort();
|
void GetRxrZMQPort();
|
||||||
void GetRxrZMQIP();
|
|
||||||
void GetAllTrimbits();
|
void GetAllTrimbits();
|
||||||
void GetNumStoragecells();
|
void GetNumStoragecells();
|
||||||
void GetSubExposureTime();
|
void GetSubExposureTime();
|
||||||
|
@ -113,9 +113,6 @@ void qTabAdvanced::Initialization() {
|
|||||||
SLOT(ForceSetRxrUDPMAC()));
|
SLOT(ForceSetRxrUDPMAC()));
|
||||||
connect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this,
|
connect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this,
|
||||||
SLOT(SetRxrZMQPort(int)));
|
SLOT(SetRxrZMQPort(int)));
|
||||||
connect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP()));
|
|
||||||
connect(dispRxrZMQIP, SIGNAL(returnPressed()), this,
|
|
||||||
SLOT(ForceSetRxrZMQIP()));
|
|
||||||
|
|
||||||
// roi
|
// roi
|
||||||
if (tab_roi->isEnabled()) {
|
if (tab_roi->isEnabled()) {
|
||||||
@ -388,20 +385,6 @@ void qTabAdvanced::GetRxrZMQPort() {
|
|||||||
SLOT(SetRxrZMQPort(int)));
|
SLOT(SetRxrZMQPort(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::GetRxrZMQIP() {
|
|
||||||
LOG(logDEBUG) << "Getting Receiver ZMQ IP";
|
|
||||||
disconnect(dispRxrZMQIP, SIGNAL(editingFinished()), this,
|
|
||||||
SLOT(SetRxrZMQIP()));
|
|
||||||
|
|
||||||
try {
|
|
||||||
auto retval = det->getRxZmqIP({comboDetector->currentIndex()})[0].str();
|
|
||||||
dispRxrZMQIP->setText(QString(retval.c_str()));
|
|
||||||
}
|
|
||||||
CATCH_DISPLAY("Could not get receiver zmq ip.", "qTabAdvanced::GetRxrZMQIP")
|
|
||||||
|
|
||||||
connect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void qTabAdvanced::SetDetector() {
|
void qTabAdvanced::SetDetector() {
|
||||||
LOG(logDEBUG) << "Set Detector: "
|
LOG(logDEBUG) << "Set Detector: "
|
||||||
<< comboDetector->currentText().toLatin1().data();
|
<< comboDetector->currentText().toLatin1().data();
|
||||||
@ -418,7 +401,6 @@ void qTabAdvanced::SetDetector() {
|
|||||||
GetRxrUDPIP();
|
GetRxrUDPIP();
|
||||||
GetRxrUDPMAC();
|
GetRxrUDPMAC();
|
||||||
GetRxrZMQPort();
|
GetRxrZMQPort();
|
||||||
GetRxrZMQIP();
|
|
||||||
|
|
||||||
LOG(logDEBUG) << det->printRxConfiguration();
|
LOG(logDEBUG) << det->printRxConfiguration();
|
||||||
}
|
}
|
||||||
@ -588,23 +570,6 @@ void qTabAdvanced::SetRxrZMQPort(int port) {
|
|||||||
&qTabAdvanced::GetRxrZMQPort)
|
&qTabAdvanced::GetRxrZMQPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::SetRxrZMQIP(bool force) {
|
|
||||||
// return forces modification (inconsistency from command line)
|
|
||||||
if (dispRxrZMQIP->isModified() || force) {
|
|
||||||
dispRxrZMQIP->setModified(false);
|
|
||||||
std::string s = dispRxrZMQIP->text().toLatin1().constData();
|
|
||||||
LOG(logINFO) << "Setting Receiver ZMQ IP:" << s;
|
|
||||||
try {
|
|
||||||
det->setRxZmqIP(IpAddr{s}, {comboDetector->currentIndex()});
|
|
||||||
}
|
|
||||||
CATCH_HANDLE("Could not set Receiver ZMQ IP.",
|
|
||||||
"qTabAdvanced::SetRxrZMQIP", this,
|
|
||||||
&qTabAdvanced::GetRxrZMQIP)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void qTabAdvanced::ForceSetRxrZMQIP() { SetRxrZMQIP(true); }
|
|
||||||
|
|
||||||
void qTabAdvanced::GetROI() {
|
void qTabAdvanced::GetROI() {
|
||||||
LOG(logDEBUG) << "Getting ROI";
|
LOG(logDEBUG) << "Getting ROI";
|
||||||
try {
|
try {
|
||||||
|
@ -66,7 +66,7 @@ class Caller {
|
|||||||
int rx_id{-1};
|
int rx_id{-1};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool ReplaceIfDepreciated(std::string &command);
|
bool ReplaceIfDeprecated(std::string &command);
|
||||||
using FunctionMap = std::map<std::string, std::string (Caller::*)(int)>;
|
using FunctionMap = std::map<std::string, std::string (Caller::*)(int)>;
|
||||||
using StringMap = std::map<std::string, std::string>;
|
using StringMap = std::map<std::string, std::string>;
|
||||||
Detector *ptr; // pointer to the detector that executes the command
|
Detector *ptr; // pointer to the detector that executes the command
|
||||||
@ -81,7 +81,7 @@ class Caller {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
StringMap depreciated_functions{
|
StringMap deprecated_functions{
|
||||||
|
|
||||||
// THIS COMMENT TO BE REPLACED BY THE ACTUAL CODE (3)
|
// THIS COMMENT TO BE REPLACED BY THE ACTUAL CODE (3)
|
||||||
|
|
||||||
|
@ -2111,11 +2111,6 @@ return 0
|
|||||||
}
|
}
|
||||||
__rx_zmqip() {
|
__rx_zmqip() {
|
||||||
FCN_RETURN=""
|
FCN_RETURN=""
|
||||||
if [[ ${IS_GET} -eq 0 ]]; then
|
|
||||||
if [[ "${cword}" == "2" ]]; then
|
|
||||||
FCN_RETURN=""
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
__rx_zmqport() {
|
__rx_zmqport() {
|
||||||
|
@ -2035,11 +2035,6 @@ return 0
|
|||||||
}
|
}
|
||||||
__rx_zmqip() {
|
__rx_zmqip() {
|
||||||
FCN_RETURN=""
|
FCN_RETURN=""
|
||||||
if [[ ${IS_GET} -eq 0 ]]; then
|
|
||||||
if [[ "${cword}" == "2" ]]; then
|
|
||||||
FCN_RETURN=""
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
__rx_zmqport() {
|
__rx_zmqport() {
|
||||||
|
@ -1041,18 +1041,6 @@ rx_zmqstartfnum:
|
|||||||
PUT:
|
PUT:
|
||||||
function: setRxZmqStartingFrame
|
function: setRxZmqStartingFrame
|
||||||
|
|
||||||
rx_zmqip:
|
|
||||||
help: "[x.x.x.x]\n\tZmq Ip Address from which data is to be streamed out of the receiver. Also restarts receiver zmq streaming if enabled. Default is from rx_hostname. Modified only when using an intermediate process between receiver."
|
|
||||||
inherit_actions: INTEGER_COMMAND_VEC_ID
|
|
||||||
actions:
|
|
||||||
GET:
|
|
||||||
function: getRxZmqIP
|
|
||||||
PUT:
|
|
||||||
function: setRxZmqIP
|
|
||||||
input_types: [ IpAddr ]
|
|
||||||
input: [ 'IpAddr(args[0])' ]
|
|
||||||
cast_input: [ false ]
|
|
||||||
|
|
||||||
zmqip:
|
zmqip:
|
||||||
help: "[x.x.x.x]\n\tIp Address to listen to zmq data streamed out from receiver or intermediate process. Default connects to receiver zmq Ip Address (from rx_hostname). Modified only when using an intermediate process between receiver and client(gui). Also restarts client zmq streaming if enabled."
|
help: "[x.x.x.x]\n\tIp Address to listen to zmq data streamed out from receiver or intermediate process. Default connects to receiver zmq Ip Address (from rx_hostname). Modified only when using an intermediate process between receiver and client(gui). Also restarts client zmq streaming if enabled."
|
||||||
inherit_actions: INTEGER_COMMAND_VEC_ID
|
inherit_actions: INTEGER_COMMAND_VEC_ID
|
||||||
@ -2578,6 +2566,14 @@ rx_hostname:
|
|||||||
PUT:
|
PUT:
|
||||||
argc: -1
|
argc: -1
|
||||||
|
|
||||||
|
rx_zmqip:
|
||||||
|
is_description: true
|
||||||
|
actions:
|
||||||
|
GET:
|
||||||
|
argc: 0
|
||||||
|
PUT:
|
||||||
|
argc: -1
|
||||||
|
|
||||||
rx_roi:
|
rx_roi:
|
||||||
is_description: true
|
is_description: true
|
||||||
actions:
|
actions:
|
||||||
@ -3936,7 +3932,7 @@ patloop:
|
|||||||
output: [level,"' '" , "'['" , "ToStringHex(start, 4)" , '", "' , "ToStringHex(stop, 4)", "']'" ]
|
output: [level,"' '" , "'['" , "ToStringHex(start, 4)" , '", "' , "ToStringHex(stop, 4)", "']'" ]
|
||||||
|
|
||||||
patloop0:
|
patloop0:
|
||||||
help: "Depreciated command. Use patloop."
|
help: "Deprecated command. Use patloop."
|
||||||
inherit_actions: patloop
|
inherit_actions: patloop
|
||||||
actions:
|
actions:
|
||||||
GET:
|
GET:
|
||||||
@ -3983,7 +3979,7 @@ patnloop:
|
|||||||
output: [ level,"' '" , nloops ]
|
output: [ level,"' '" , nloops ]
|
||||||
|
|
||||||
patnloop0:
|
patnloop0:
|
||||||
help: "Depreciated command. Use patnloop."
|
help: "Deprecated command. Use patnloop."
|
||||||
inherit_actions: patnloop
|
inherit_actions: patnloop
|
||||||
actions:
|
actions:
|
||||||
GET:
|
GET:
|
||||||
@ -4029,7 +4025,7 @@ patwait:
|
|||||||
output: [level,"' '" , "ToStringHex(addr, 4)" ]
|
output: [level,"' '" , "ToStringHex(addr, 4)" ]
|
||||||
|
|
||||||
patwait0:
|
patwait0:
|
||||||
help: "Depreciated command. Use patwait."
|
help: "Deprecated command. Use patwait."
|
||||||
inherit_actions: patwait
|
inherit_actions: patwait
|
||||||
actions:
|
actions:
|
||||||
GET:
|
GET:
|
||||||
@ -4075,7 +4071,7 @@ patwaittime:
|
|||||||
output: [level,"' '" , "waittime" ]
|
output: [level,"' '" , "waittime" ]
|
||||||
|
|
||||||
patwaittime0:
|
patwaittime0:
|
||||||
help: "Depreciated command. Use patwaittime."
|
help: "Deprecated command. Use patwaittime."
|
||||||
inherit_actions: patwaittime
|
inherit_actions: patwaittime
|
||||||
actions:
|
actions:
|
||||||
GET:
|
GET:
|
||||||
|
@ -5994,7 +5994,7 @@ patloop0:
|
|||||||
store_result_in_t: false
|
store_result_in_t: false
|
||||||
command_name: patloop0
|
command_name: patloop0
|
||||||
function_alias: patloop0
|
function_alias: patloop0
|
||||||
help: Depreciated command. Use patloop.
|
help: Deprecated command. Use patloop.
|
||||||
infer_action: true
|
infer_action: true
|
||||||
patloop1:
|
patloop1:
|
||||||
actions:
|
actions:
|
||||||
@ -6063,7 +6063,7 @@ patloop1:
|
|||||||
store_result_in_t: false
|
store_result_in_t: false
|
||||||
command_name: patloop1
|
command_name: patloop1
|
||||||
function_alias: patloop1
|
function_alias: patloop1
|
||||||
help: Depreciated command. Use patloop.
|
help: Deprecated command. Use patloop.
|
||||||
infer_action: true
|
infer_action: true
|
||||||
patloop2:
|
patloop2:
|
||||||
actions:
|
actions:
|
||||||
@ -6132,7 +6132,7 @@ patloop2:
|
|||||||
store_result_in_t: false
|
store_result_in_t: false
|
||||||
command_name: patloop2
|
command_name: patloop2
|
||||||
function_alias: patloop2
|
function_alias: patloop2
|
||||||
help: Depreciated command. Use patloop.
|
help: Deprecated command. Use patloop.
|
||||||
infer_action: true
|
infer_action: true
|
||||||
patmask:
|
patmask:
|
||||||
actions:
|
actions:
|
||||||
@ -6293,7 +6293,7 @@ patnloop0:
|
|||||||
store_result_in_t: false
|
store_result_in_t: false
|
||||||
command_name: patnloop0
|
command_name: patnloop0
|
||||||
function_alias: patnloop0
|
function_alias: patnloop0
|
||||||
help: Depreciated command. Use patnloop.
|
help: Deprecated command. Use patnloop.
|
||||||
infer_action: true
|
infer_action: true
|
||||||
patnloop1:
|
patnloop1:
|
||||||
actions:
|
actions:
|
||||||
@ -6351,7 +6351,7 @@ patnloop1:
|
|||||||
store_result_in_t: false
|
store_result_in_t: false
|
||||||
command_name: patnloop1
|
command_name: patnloop1
|
||||||
function_alias: patnloop1
|
function_alias: patnloop1
|
||||||
help: Depreciated command. Use patnloop.
|
help: Deprecated command. Use patnloop.
|
||||||
infer_action: true
|
infer_action: true
|
||||||
patnloop2:
|
patnloop2:
|
||||||
actions:
|
actions:
|
||||||
@ -6409,7 +6409,7 @@ patnloop2:
|
|||||||
store_result_in_t: false
|
store_result_in_t: false
|
||||||
command_name: patnloop2
|
command_name: patnloop2
|
||||||
function_alias: patnloop2
|
function_alias: patnloop2
|
||||||
help: Depreciated command. Use patnloop.
|
help: Deprecated command. Use patnloop.
|
||||||
infer_action: true
|
infer_action: true
|
||||||
patsetbit:
|
patsetbit:
|
||||||
actions:
|
actions:
|
||||||
@ -6616,7 +6616,7 @@ patwait0:
|
|||||||
store_result_in_t: false
|
store_result_in_t: false
|
||||||
command_name: patwait0
|
command_name: patwait0
|
||||||
function_alias: patwait0
|
function_alias: patwait0
|
||||||
help: Depreciated command. Use patwait.
|
help: Deprecated command. Use patwait.
|
||||||
infer_action: true
|
infer_action: true
|
||||||
patwait1:
|
patwait1:
|
||||||
actions:
|
actions:
|
||||||
@ -6674,7 +6674,7 @@ patwait1:
|
|||||||
store_result_in_t: false
|
store_result_in_t: false
|
||||||
command_name: patwait1
|
command_name: patwait1
|
||||||
function_alias: patwait1
|
function_alias: patwait1
|
||||||
help: Depreciated command. Use patwait.
|
help: Deprecated command. Use patwait.
|
||||||
infer_action: true
|
infer_action: true
|
||||||
patwait2:
|
patwait2:
|
||||||
actions:
|
actions:
|
||||||
@ -6732,7 +6732,7 @@ patwait2:
|
|||||||
store_result_in_t: false
|
store_result_in_t: false
|
||||||
command_name: patwait2
|
command_name: patwait2
|
||||||
function_alias: patwait2
|
function_alias: patwait2
|
||||||
help: Depreciated command. Use patwait.
|
help: Deprecated command. Use patwait.
|
||||||
infer_action: true
|
infer_action: true
|
||||||
patwaittime:
|
patwaittime:
|
||||||
actions:
|
actions:
|
||||||
@ -6853,7 +6853,7 @@ patwaittime0:
|
|||||||
store_result_in_t: false
|
store_result_in_t: false
|
||||||
command_name: patwaittime0
|
command_name: patwaittime0
|
||||||
function_alias: patwaittime0
|
function_alias: patwaittime0
|
||||||
help: Depreciated command. Use patwaittime.
|
help: Deprecated command. Use patwaittime.
|
||||||
infer_action: true
|
infer_action: true
|
||||||
patwaittime1:
|
patwaittime1:
|
||||||
actions:
|
actions:
|
||||||
@ -6911,7 +6911,7 @@ patwaittime1:
|
|||||||
store_result_in_t: false
|
store_result_in_t: false
|
||||||
command_name: patwaittime1
|
command_name: patwaittime1
|
||||||
function_alias: patwaittime1
|
function_alias: patwaittime1
|
||||||
help: Depreciated command. Use patwaittime.
|
help: Deprecated command. Use patwaittime.
|
||||||
infer_action: true
|
infer_action: true
|
||||||
patwaittime2:
|
patwaittime2:
|
||||||
actions:
|
actions:
|
||||||
@ -6969,7 +6969,7 @@ patwaittime2:
|
|||||||
store_result_in_t: false
|
store_result_in_t: false
|
||||||
command_name: patwaittime2
|
command_name: patwaittime2
|
||||||
function_alias: patwaittime2
|
function_alias: patwaittime2
|
||||||
help: Depreciated command. Use patwaittime.
|
help: Deprecated command. Use patwaittime.
|
||||||
infer_action: true
|
infer_action: true
|
||||||
patword:
|
patword:
|
||||||
actions:
|
actions:
|
||||||
@ -9250,38 +9250,30 @@ rx_zmqip:
|
|||||||
cast_input: []
|
cast_input: []
|
||||||
check_det_id: false
|
check_det_id: false
|
||||||
convert_det_id: true
|
convert_det_id: true
|
||||||
function: getRxZmqIP
|
function: ''
|
||||||
input: []
|
input: []
|
||||||
input_types: []
|
input_types: []
|
||||||
output:
|
output: []
|
||||||
- OutString(t)
|
require_det_id: false
|
||||||
require_det_id: true
|
|
||||||
store_result_in_t: true
|
store_result_in_t: true
|
||||||
PUT:
|
PUT:
|
||||||
args:
|
args:
|
||||||
- arg_types:
|
- arg_types: []
|
||||||
- IpAddr
|
argc: -1
|
||||||
argc: 1
|
cast_input: []
|
||||||
cast_input:
|
|
||||||
- false
|
|
||||||
check_det_id: false
|
check_det_id: false
|
||||||
convert_det_id: true
|
convert_det_id: true
|
||||||
function: setRxZmqIP
|
function: ''
|
||||||
input:
|
input: []
|
||||||
- IpAddr(args[0])
|
input_types: []
|
||||||
input_types:
|
output: []
|
||||||
- IpAddr
|
require_det_id: false
|
||||||
output:
|
|
||||||
- args.front()
|
|
||||||
require_det_id: true
|
|
||||||
store_result_in_t: false
|
store_result_in_t: false
|
||||||
command_name: rx_zmqip
|
command_name: rx_zmqip
|
||||||
function_alias: rx_zmqip
|
function_alias: rx_zmqip
|
||||||
help: "[x.x.x.x]\n\tZmq Ip Address from which data is to be streamed out of the\
|
help: ''
|
||||||
\ receiver. Also restarts receiver zmq streaming if enabled. Default is from rx_hostname.\
|
|
||||||
\ Modified only when using an intermediate process between receiver."
|
|
||||||
infer_action: true
|
infer_action: true
|
||||||
template: true
|
is_description: true
|
||||||
rx_zmqport:
|
rx_zmqport:
|
||||||
actions:
|
actions:
|
||||||
GET:
|
GET:
|
||||||
|
@ -7921,7 +7921,7 @@ std::string Caller::patloop0(int action) {
|
|||||||
// print help
|
// print help
|
||||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||||
os << "Command: patloop0" << std::endl;
|
os << "Command: patloop0" << std::endl;
|
||||||
os << R"V0G0N(Depreciated command. Use patloop. )V0G0N" << std::endl;
|
os << R"V0G0N(Deprecated command. Use patloop. )V0G0N" << std::endl;
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7976,7 +7976,7 @@ std::string Caller::patloop1(int action) {
|
|||||||
// print help
|
// print help
|
||||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||||
os << "Command: patloop1" << std::endl;
|
os << "Command: patloop1" << std::endl;
|
||||||
os << R"V0G0N(Depreciated command. Use patloop. )V0G0N" << std::endl;
|
os << R"V0G0N(Deprecated command. Use patloop. )V0G0N" << std::endl;
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8031,7 +8031,7 @@ std::string Caller::patloop2(int action) {
|
|||||||
// print help
|
// print help
|
||||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||||
os << "Command: patloop2" << std::endl;
|
os << "Command: patloop2" << std::endl;
|
||||||
os << R"V0G0N(Depreciated command. Use patloop. )V0G0N" << std::endl;
|
os << R"V0G0N(Deprecated command. Use patloop. )V0G0N" << std::endl;
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8205,7 +8205,7 @@ std::string Caller::patnloop0(int action) {
|
|||||||
// print help
|
// print help
|
||||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||||
os << "Command: patnloop0" << std::endl;
|
os << "Command: patnloop0" << std::endl;
|
||||||
os << R"V0G0N(Depreciated command. Use patnloop. )V0G0N" << std::endl;
|
os << R"V0G0N(Deprecated command. Use patnloop. )V0G0N" << std::endl;
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8258,7 +8258,7 @@ std::string Caller::patnloop1(int action) {
|
|||||||
// print help
|
// print help
|
||||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||||
os << "Command: patnloop1" << std::endl;
|
os << "Command: patnloop1" << std::endl;
|
||||||
os << R"V0G0N(Depreciated command. Use patnloop. )V0G0N" << std::endl;
|
os << R"V0G0N(Deprecated command. Use patnloop. )V0G0N" << std::endl;
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8311,7 +8311,7 @@ std::string Caller::patnloop2(int action) {
|
|||||||
// print help
|
// print help
|
||||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||||
os << "Command: patnloop2" << std::endl;
|
os << "Command: patnloop2" << std::endl;
|
||||||
os << R"V0G0N(Depreciated command. Use patnloop. )V0G0N" << std::endl;
|
os << R"V0G0N(Deprecated command. Use patnloop. )V0G0N" << std::endl;
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8562,7 +8562,7 @@ std::string Caller::patwait0(int action) {
|
|||||||
// print help
|
// print help
|
||||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||||
os << "Command: patwait0" << std::endl;
|
os << "Command: patwait0" << std::endl;
|
||||||
os << R"V0G0N(Depreciated command. Use patwait. )V0G0N" << std::endl;
|
os << R"V0G0N(Deprecated command. Use patwait. )V0G0N" << std::endl;
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8614,7 +8614,7 @@ std::string Caller::patwait1(int action) {
|
|||||||
// print help
|
// print help
|
||||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||||
os << "Command: patwait1" << std::endl;
|
os << "Command: patwait1" << std::endl;
|
||||||
os << R"V0G0N(Depreciated command. Use patwait. )V0G0N" << std::endl;
|
os << R"V0G0N(Deprecated command. Use patwait. )V0G0N" << std::endl;
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8666,7 +8666,7 @@ std::string Caller::patwait2(int action) {
|
|||||||
// print help
|
// print help
|
||||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||||
os << "Command: patwait2" << std::endl;
|
os << "Command: patwait2" << std::endl;
|
||||||
os << R"V0G0N(Depreciated command. Use patwait. )V0G0N" << std::endl;
|
os << R"V0G0N(Deprecated command. Use patwait. )V0G0N" << std::endl;
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8773,8 +8773,7 @@ std::string Caller::patwaittime0(int action) {
|
|||||||
// print help
|
// print help
|
||||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||||
os << "Command: patwaittime0" << std::endl;
|
os << "Command: patwaittime0" << std::endl;
|
||||||
os << R"V0G0N(Depreciated command. Use patwaittime. )V0G0N"
|
os << R"V0G0N(Deprecated command. Use patwaittime. )V0G0N" << std::endl;
|
||||||
<< std::endl;
|
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8826,8 +8825,7 @@ std::string Caller::patwaittime1(int action) {
|
|||||||
// print help
|
// print help
|
||||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||||
os << "Command: patwaittime1" << std::endl;
|
os << "Command: patwaittime1" << std::endl;
|
||||||
os << R"V0G0N(Depreciated command. Use patwaittime. )V0G0N"
|
os << R"V0G0N(Deprecated command. Use patwaittime. )V0G0N" << std::endl;
|
||||||
<< std::endl;
|
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8879,8 +8877,7 @@ std::string Caller::patwaittime2(int action) {
|
|||||||
// print help
|
// print help
|
||||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||||
os << "Command: patwaittime2" << std::endl;
|
os << "Command: patwaittime2" << std::endl;
|
||||||
os << R"V0G0N(Depreciated command. Use patwaittime. )V0G0N"
|
os << R"V0G0N(Deprecated command. Use patwaittime. )V0G0N" << std::endl;
|
||||||
<< std::endl;
|
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12114,63 +12111,6 @@ std::string Caller::rx_zmqhwm(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Caller::rx_zmqip(int action) {
|
|
||||||
|
|
||||||
std::ostringstream os;
|
|
||||||
// print help
|
|
||||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
|
||||||
os << "Command: rx_zmqip" << std::endl;
|
|
||||||
os << R"V0G0N([x.x.x.x]
|
|
||||||
Zmq Ip Address from which data is to be streamed out of the receiver. Also restarts receiver zmq streaming if enabled. Default is from rx_hostname. Modified only when using an intermediate process between receiver. )V0G0N"
|
|
||||||
<< std::endl;
|
|
||||||
return os.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if action and arguments are valid
|
|
||||||
if (action == slsDetectorDefs::GET_ACTION) {
|
|
||||||
if (1 && args.size() != 0) {
|
|
||||||
throw RuntimeError("Wrong number of arguments for action GET");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.size() == 0) {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (action == slsDetectorDefs::PUT_ACTION) {
|
|
||||||
if (1 && args.size() != 1) {
|
|
||||||
throw RuntimeError("Wrong number of arguments for action PUT");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.size() == 1) {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
|
|
||||||
throw RuntimeError("INTERNAL ERROR: Invalid action: supported actions "
|
|
||||||
"are ['GET', 'PUT']");
|
|
||||||
}
|
|
||||||
|
|
||||||
// generate code for each action
|
|
||||||
if (action == slsDetectorDefs::GET_ACTION) {
|
|
||||||
if (args.size() == 0) {
|
|
||||||
auto t = det->getRxZmqIP(std::vector<int>{det_id});
|
|
||||||
os << OutString(t) << '\n';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (action == slsDetectorDefs::PUT_ACTION) {
|
|
||||||
if (args.size() == 1) {
|
|
||||||
det->setRxZmqIP(IpAddr(args[0]), std::vector<int>{det_id});
|
|
||||||
os << args.front() << '\n';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return os.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string Caller::rx_zmqport(int action) {
|
std::string Caller::rx_zmqport(int action) {
|
||||||
|
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
|
@ -392,7 +392,7 @@ class Caller {
|
|||||||
int rx_id{-1};
|
int rx_id{-1};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool ReplaceIfDepreciated(std::string &command);
|
bool ReplaceIfDeprecated(std::string &command);
|
||||||
using FunctionMap = std::map<std::string, std::string (Caller::*)(int)>;
|
using FunctionMap = std::map<std::string, std::string (Caller::*)(int)>;
|
||||||
using StringMap = std::map<std::string, std::string>;
|
using StringMap = std::map<std::string, std::string>;
|
||||||
Detector *ptr; // pointer to the detector that executes the command
|
Detector *ptr; // pointer to the detector that executes the command
|
||||||
@ -734,7 +734,7 @@ class Caller {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
StringMap depreciated_functions{
|
StringMap deprecated_functions{
|
||||||
|
|
||||||
{"detectorversion", "firmwareversion"},
|
{"detectorversion", "firmwareversion"},
|
||||||
{"softwareversion", "detectorserverversion"},
|
{"softwareversion", "detectorserverversion"},
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "Caller.h"
|
#include "Caller.h"
|
||||||
|
#include "sls/ZmqSocket.h"
|
||||||
#include "sls/bit_utils.h"
|
#include "sls/bit_utils.h"
|
||||||
#include "sls/file_utils.h"
|
#include "sls/file_utils.h"
|
||||||
#include "sls/logger.h"
|
#include "sls/logger.h"
|
||||||
@ -22,7 +23,7 @@ void Caller::call(const std::string &command,
|
|||||||
std::string temp;
|
std::string temp;
|
||||||
while (temp != cmd) {
|
while (temp != cmd) {
|
||||||
temp = cmd;
|
temp = cmd;
|
||||||
ReplaceIfDepreciated(cmd);
|
ReplaceIfDeprecated(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
det_id = detector_id;
|
det_id = detector_id;
|
||||||
@ -37,9 +38,9 @@ void Caller::call(const std::string &command,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Caller::ReplaceIfDepreciated(std::string &command) {
|
bool Caller::ReplaceIfDeprecated(std::string &command) {
|
||||||
auto d_it = depreciated_functions.find(command);
|
auto d_it = deprecated_functions.find(command);
|
||||||
if (d_it != depreciated_functions.end()) {
|
if (d_it != deprecated_functions.end()) {
|
||||||
|
|
||||||
// insert old command into arguments (for dacs)
|
// insert old command into arguments (for dacs)
|
||||||
if (d_it->second == "dac") {
|
if (d_it->second == "dac") {
|
||||||
@ -648,6 +649,25 @@ std::string Caller::rx_hostname(int action) {
|
|||||||
}
|
}
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
std::string Caller::rx_zmqip(int action) {
|
||||||
|
std::string helpMessage =
|
||||||
|
"\n\t[deprecated] The receiver zmq socket (publisher) will "
|
||||||
|
"listen to all interfaces ('tcp://0.0.0.0:[port]'to all interfaces "
|
||||||
|
"(from v9.0.0). This command does nothing and will be removed "
|
||||||
|
"(from v10.0.0). This change makes no difference to the user.\n";
|
||||||
|
std::ostringstream os;
|
||||||
|
if (action == defs::HELP_ACTION) {
|
||||||
|
os << helpMessage << '\n';
|
||||||
|
} else if (action == defs::GET_ACTION) {
|
||||||
|
os << ZMQ_PUBLISHER_IP << '\n';
|
||||||
|
} else if (action == defs::PUT_ACTION) {
|
||||||
|
LOG(logWARNING) << helpMessage << '\n';
|
||||||
|
os << ZMQ_PUBLISHER_IP << '\n';
|
||||||
|
} else {
|
||||||
|
throw RuntimeError("Unknown action");
|
||||||
|
}
|
||||||
|
return os.str();
|
||||||
|
}
|
||||||
std::string Caller::rx_roi(int action) {
|
std::string Caller::rx_roi(int action) {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
|
@ -1483,19 +1483,6 @@ void Detector::setRxZmqPort(uint16_t port, int module_id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<IpAddr> Detector::getRxZmqIP(Positions pos) const {
|
|
||||||
return pimpl->Parallel(&Module::getReceiverStreamingIP, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Detector::setRxZmqIP(const IpAddr ip, Positions pos) {
|
|
||||||
bool previouslyReceiverStreaming = getRxZmqDataStream(pos).squash(false);
|
|
||||||
pimpl->Parallel(&Module::setReceiverStreamingIP, pos, ip);
|
|
||||||
if (previouslyReceiverStreaming) {
|
|
||||||
setRxZmqDataStream(false, pos);
|
|
||||||
setRxZmqDataStream(true, pos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Result<uint16_t> Detector::getClientZmqPort(Positions pos) const {
|
Result<uint16_t> Detector::getClientZmqPort(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getClientStreamingPort, pos);
|
return pimpl->Parallel(&Module::getClientStreamingPort, pos);
|
||||||
}
|
}
|
||||||
|
@ -1429,8 +1429,8 @@ void Module::setReceiverHostname(const std::string &hostname,
|
|||||||
|
|
||||||
shm()->numUDPInterfaces = retval.udpInterfaces;
|
shm()->numUDPInterfaces = retval.udpInterfaces;
|
||||||
|
|
||||||
// to use rx_hostname if empty and also update client zmqip
|
// to use rx_hostname if empty
|
||||||
updateReceiverStreamingIP();
|
updateClientStreamingIP();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t Module::getReceiverPort() const { return shm()->rxTCPPort; }
|
uint16_t Module::getReceiverPort() const { return shm()->rxTCPPort; }
|
||||||
@ -1656,21 +1656,6 @@ void Module::setReceiverStreamingPort(uint16_t port) {
|
|||||||
sendToReceiver(F_SET_RECEIVER_STREAMING_PORT, port, nullptr);
|
sendToReceiver(F_SET_RECEIVER_STREAMING_PORT, port, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
IpAddr Module::getReceiverStreamingIP() const {
|
|
||||||
return sendToReceiver<IpAddr>(F_GET_RECEIVER_STREAMING_SRC_IP);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::setReceiverStreamingIP(const IpAddr ip) {
|
|
||||||
if (ip == 0) {
|
|
||||||
throw RuntimeError("Invalid receiver zmq ip address");
|
|
||||||
}
|
|
||||||
// if client zmqip is empty, update it
|
|
||||||
if (shm()->zmqip == 0) {
|
|
||||||
shm()->zmqip = ip;
|
|
||||||
}
|
|
||||||
sendToReceiver(F_SET_RECEIVER_STREAMING_SRC_IP, ip, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t Module::getClientStreamingPort() const { return shm()->zmqport; }
|
uint16_t Module::getClientStreamingPort() const { return shm()->zmqport; }
|
||||||
|
|
||||||
void Module::setClientStreamingPort(uint16_t port) { shm()->zmqport = port; }
|
void Module::setClientStreamingPort(uint16_t port) { shm()->zmqport = port; }
|
||||||
@ -3613,18 +3598,19 @@ void Module::receiveModule(sls_detector_module *myMod, ClientSocket &client) {
|
|||||||
LOG(level) << myMod->nchan << " chans received";
|
LOG(level) << myMod->nchan << " chans received";
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::updateReceiverStreamingIP() {
|
void Module::updateClientStreamingIP() {
|
||||||
auto ip = getReceiverStreamingIP();
|
auto ip = getClientStreamingIP();
|
||||||
if (ip == 0) {
|
if (ip == 0) {
|
||||||
// Hostname could be ip try to decode otherwise look up the hostname
|
// Hostname could be ip try to decode otherwise look up the hostname
|
||||||
ip = IpAddr{shm()->rxHostname};
|
ip = IpAddr{shm()->rxHostname};
|
||||||
if (ip == 0) {
|
if (ip == 0) {
|
||||||
ip = HostnameToIp(shm()->rxHostname);
|
ip = HostnameToIp(shm()->rxHostname);
|
||||||
}
|
}
|
||||||
LOG(logINFO) << "Setting default receiver " << moduleIndex
|
LOG(logINFO) << "Setting default module " << moduleIndex
|
||||||
<< " streaming zmq ip to " << ip;
|
<< " zmq ip to " << ip;
|
||||||
|
|
||||||
|
setClientStreamingIP(ip);
|
||||||
}
|
}
|
||||||
setReceiverStreamingIP(ip);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::updateRateCorrection() {
|
void Module::updateRateCorrection() {
|
||||||
|
@ -351,8 +351,6 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
void setReceiverStreamingStartingFrame(int fnum);
|
void setReceiverStreamingStartingFrame(int fnum);
|
||||||
uint16_t getReceiverStreamingPort() const;
|
uint16_t getReceiverStreamingPort() const;
|
||||||
void setReceiverStreamingPort(uint16_t port);
|
void setReceiverStreamingPort(uint16_t port);
|
||||||
IpAddr getReceiverStreamingIP() const;
|
|
||||||
void setReceiverStreamingIP(const IpAddr ip);
|
|
||||||
uint16_t getClientStreamingPort() const;
|
uint16_t getClientStreamingPort() const;
|
||||||
void setClientStreamingPort(uint16_t port);
|
void setClientStreamingPort(uint16_t port);
|
||||||
IpAddr getClientStreamingIP() const;
|
IpAddr getClientStreamingIP() const;
|
||||||
@ -766,7 +764,7 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
sls_detector_module getModule();
|
sls_detector_module getModule();
|
||||||
void sendModule(sls_detector_module *myMod, ClientSocket &client);
|
void sendModule(sls_detector_module *myMod, ClientSocket &client);
|
||||||
void receiveModule(sls_detector_module *myMod, ClientSocket &client);
|
void receiveModule(sls_detector_module *myMod, ClientSocket &client);
|
||||||
void updateReceiverStreamingIP();
|
void updateClientStreamingIP();
|
||||||
|
|
||||||
void updateRateCorrection();
|
void updateRateCorrection();
|
||||||
/** Template function to do linear interpolation between two points (Eiger
|
/** Template function to do linear interpolation between two points (Eiger
|
||||||
|
@ -149,7 +149,7 @@ void Pattern::load(const std::string &fname) {
|
|||||||
level = StringTo<int>(args[iArg++]);
|
level = StringTo<int>(args[iArg++]);
|
||||||
} else {
|
} else {
|
||||||
LOG(logWARNING)
|
LOG(logWARNING)
|
||||||
<< "Depreciated command. Please use patloop next time.";
|
<< "Deprecated command. Please use patloop next time.";
|
||||||
if (nargs != 2) {
|
if (nargs != 2) {
|
||||||
throw RuntimeError("Invalid arguments for " +
|
throw RuntimeError("Invalid arguments for " +
|
||||||
ToString(args));
|
ToString(args));
|
||||||
@ -174,7 +174,7 @@ void Pattern::load(const std::string &fname) {
|
|||||||
}
|
}
|
||||||
level = StringTo<int>(args[iArg++]);
|
level = StringTo<int>(args[iArg++]);
|
||||||
} else {
|
} else {
|
||||||
LOG(logWARNING) << "Depreciated command. Please use "
|
LOG(logWARNING) << "Deprecated command. Please use "
|
||||||
"patnloop next time.";
|
"patnloop next time.";
|
||||||
if (nargs != 1) {
|
if (nargs != 1) {
|
||||||
throw RuntimeError("Invalid arguments for " +
|
throw RuntimeError("Invalid arguments for " +
|
||||||
@ -198,7 +198,7 @@ void Pattern::load(const std::string &fname) {
|
|||||||
level = StringTo<int>(args[iArg++]);
|
level = StringTo<int>(args[iArg++]);
|
||||||
} else {
|
} else {
|
||||||
LOG(logWARNING)
|
LOG(logWARNING)
|
||||||
<< "Depreciated command. Please use patwait next time.";
|
<< "Deprecated command. Please use patwait next time.";
|
||||||
if (nargs != 1) {
|
if (nargs != 1) {
|
||||||
throw RuntimeError("Invalid arguments for " +
|
throw RuntimeError("Invalid arguments for " +
|
||||||
ToString(args));
|
ToString(args));
|
||||||
@ -220,7 +220,7 @@ void Pattern::load(const std::string &fname) {
|
|||||||
}
|
}
|
||||||
level = StringTo<int>(args[iArg++]);
|
level = StringTo<int>(args[iArg++]);
|
||||||
} else {
|
} else {
|
||||||
LOG(logWARNING) << "Depreciated command. Please use "
|
LOG(logWARNING) << "Deprecated command. Please use "
|
||||||
"patwaittime next time.";
|
"patwaittime next time.";
|
||||||
if (nargs != 1) {
|
if (nargs != 1) {
|
||||||
throw RuntimeError("Invalid arguments for " +
|
throw RuntimeError("Invalid arguments for " +
|
||||||
|
@ -2993,18 +2993,8 @@ int InferAction::rx_zmqhwm() {
|
|||||||
|
|
||||||
int InferAction::rx_zmqip() {
|
int InferAction::rx_zmqip() {
|
||||||
|
|
||||||
if (args.size() == 0) {
|
throw RuntimeError("sls_detector is disabled for command: rx_zmqip. Use "
|
||||||
return slsDetectorDefs::GET_ACTION;
|
"sls_detector_get or sls_detector_put");
|
||||||
}
|
|
||||||
|
|
||||||
if (args.size() == 1) {
|
|
||||||
return slsDetectorDefs::PUT_ACTION;
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
|
|
||||||
throw RuntimeError("Could not infer action: Wrong number of arguments");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int InferAction::rx_zmqport() {
|
int InferAction::rx_zmqport() {
|
||||||
|
@ -192,12 +192,12 @@ TEST_CASE("Caller::patloop", "[.cmdcall]") {
|
|||||||
std::string sLoop = ToString(iLoop);
|
std::string sLoop = ToString(iLoop);
|
||||||
if (iLoop < 3) {
|
if (iLoop < 3) {
|
||||||
std::string deprecatedCmd = "patloop" + sLoop;
|
std::string deprecatedCmd = "patloop" + sLoop;
|
||||||
{ // depreciated
|
{ // deprecated
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
caller.call(deprecatedCmd, {"0x20", "0x5c"}, -1, PUT, oss);
|
caller.call(deprecatedCmd, {"0x20", "0x5c"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == deprecatedCmd + " [0x0020, 0x005c]\n");
|
REQUIRE(oss.str() == deprecatedCmd + " [0x0020, 0x005c]\n");
|
||||||
}
|
}
|
||||||
{ // depreciated
|
{ // deprecated
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
caller.call(deprecatedCmd, {}, -1, GET, oss);
|
caller.call(deprecatedCmd, {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == deprecatedCmd + " [0x0020, 0x005c]\n");
|
REQUIRE(oss.str() == deprecatedCmd + " [0x0020, 0x005c]\n");
|
||||||
@ -241,12 +241,12 @@ TEST_CASE("Caller::patnloop", "[.cmdcall]") {
|
|||||||
std::string sLoop = ToString(iLoop);
|
std::string sLoop = ToString(iLoop);
|
||||||
if (iLoop < 3) {
|
if (iLoop < 3) {
|
||||||
std::string deprecatedCmd = "patnloop" + sLoop;
|
std::string deprecatedCmd = "patnloop" + sLoop;
|
||||||
{ // depreciated
|
{ // deprecated
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
caller.call(deprecatedCmd, {"5"}, -1, PUT, oss);
|
caller.call(deprecatedCmd, {"5"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == deprecatedCmd + " 5\n");
|
REQUIRE(oss.str() == deprecatedCmd + " 5\n");
|
||||||
}
|
}
|
||||||
{ // depreciated
|
{ // deprecated
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
caller.call(deprecatedCmd, {}, -1, GET, oss);
|
caller.call(deprecatedCmd, {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == deprecatedCmd + " 5\n");
|
REQUIRE(oss.str() == deprecatedCmd + " 5\n");
|
||||||
@ -287,12 +287,12 @@ TEST_CASE("Caller::patwait", "[.cmdcall]") {
|
|||||||
std::string sLoop = ToString(iLoop);
|
std::string sLoop = ToString(iLoop);
|
||||||
if (iLoop < 3) {
|
if (iLoop < 3) {
|
||||||
std::string deprecatedCmd = "patwait" + sLoop;
|
std::string deprecatedCmd = "patwait" + sLoop;
|
||||||
{ // depreciated
|
{ // deprecated
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
caller.call(deprecatedCmd, {"0x5c"}, -1, PUT, oss);
|
caller.call(deprecatedCmd, {"0x5c"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == deprecatedCmd + " 0x005c\n");
|
REQUIRE(oss.str() == deprecatedCmd + " 0x005c\n");
|
||||||
}
|
}
|
||||||
{ // depreciated
|
{ // deprecated
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
caller.call(deprecatedCmd, {}, -1, GET, oss);
|
caller.call(deprecatedCmd, {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == deprecatedCmd + " 0x005c\n");
|
REQUIRE(oss.str() == deprecatedCmd + " 0x005c\n");
|
||||||
@ -333,12 +333,12 @@ TEST_CASE("Caller::patwaittime", "[.cmdcall]") {
|
|||||||
std::string sLoop = ToString(iLoop);
|
std::string sLoop = ToString(iLoop);
|
||||||
if (iLoop < 3) {
|
if (iLoop < 3) {
|
||||||
std::string deprecatedCmd = "patwaittime" + sLoop;
|
std::string deprecatedCmd = "patwaittime" + sLoop;
|
||||||
{ // depreciated
|
{ // deprecated
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
caller.call(deprecatedCmd, {"8589936640"}, -1, PUT, oss);
|
caller.call(deprecatedCmd, {"8589936640"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == deprecatedCmd + " 8589936640\n");
|
REQUIRE(oss.str() == deprecatedCmd + " 8589936640\n");
|
||||||
}
|
}
|
||||||
{ // depreciated
|
{ // deprecated
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
caller.call(deprecatedCmd, {}, -1, GET, oss);
|
caller.call(deprecatedCmd, {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == deprecatedCmd + " 8589936640\n");
|
REQUIRE(oss.str() == deprecatedCmd + " 8589936640\n");
|
||||||
|
@ -861,26 +861,6 @@ TEST_CASE("Caller::rx_zmqport", "[.cmdcall][.rx]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Caller::rx_zmqip", "[.cmdcall][.rx]") {
|
|
||||||
Detector det;
|
|
||||||
Caller caller(&det);
|
|
||||||
auto prev_val = det.getRxZmqIP();
|
|
||||||
{
|
|
||||||
std::ostringstream oss;
|
|
||||||
caller.call("rx_zmqip", {"127.0.0.1"}, 0, PUT, oss);
|
|
||||||
REQUIRE(oss.str() == "rx_zmqip 127.0.0.1\n");
|
|
||||||
std::cout << "ZMQIP: " << det.getRxZmqIP() << '\n';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::ostringstream oss;
|
|
||||||
caller.call("rx_zmqip", {}, 0, GET, oss);
|
|
||||||
REQUIRE(oss.str() == "rx_zmqip 127.0.0.1\n");
|
|
||||||
}
|
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
|
||||||
det.setRxZmqIP(prev_val[i], {i});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("Caller::rx_zmqhwm", "[.cmdcall]") {
|
TEST_CASE("Caller::rx_zmqhwm", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
|
@ -3083,7 +3083,7 @@ TEST_CASE("CALLER::zmqip", "[.cmdcall]") {
|
|||||||
REQUIRE(oss2.str() == "zmqip " + zmqip[0].str() + '\n');
|
REQUIRE(oss2.str() == "zmqip " + zmqip[0].str() + '\n');
|
||||||
|
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setRxZmqIP(zmqip[i], {i});
|
det.setClientZmqIp(zmqip[i], {i});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
// tests to add
|
// tests to add
|
||||||
// help for all docs
|
// help for all docs
|
||||||
// command for all depreciated commands
|
// command for all deprecated commands
|
||||||
|
|
||||||
namespace sls {
|
namespace sls {
|
||||||
|
|
||||||
|
@ -168,8 +168,6 @@ int ClientInterface::functionTable(){
|
|||||||
flist[F_GET_RECEIVER_FILE_FORMAT] = &ClientInterface::get_file_format;
|
flist[F_GET_RECEIVER_FILE_FORMAT] = &ClientInterface::get_file_format;
|
||||||
flist[F_SET_RECEIVER_STREAMING_PORT] = &ClientInterface::set_streaming_port;
|
flist[F_SET_RECEIVER_STREAMING_PORT] = &ClientInterface::set_streaming_port;
|
||||||
flist[F_GET_RECEIVER_STREAMING_PORT] = &ClientInterface::get_streaming_port;
|
flist[F_GET_RECEIVER_STREAMING_PORT] = &ClientInterface::get_streaming_port;
|
||||||
flist[F_SET_RECEIVER_STREAMING_SRC_IP] = &ClientInterface::set_streaming_source_ip;
|
|
||||||
flist[F_GET_RECEIVER_STREAMING_SRC_IP] = &ClientInterface::get_streaming_source_ip;
|
|
||||||
flist[F_SET_RECEIVER_SILENT_MODE] = &ClientInterface::set_silent_mode;
|
flist[F_SET_RECEIVER_SILENT_MODE] = &ClientInterface::set_silent_mode;
|
||||||
flist[F_GET_RECEIVER_SILENT_MODE] = &ClientInterface::get_silent_mode;
|
flist[F_GET_RECEIVER_SILENT_MODE] = &ClientInterface::get_silent_mode;
|
||||||
flist[F_RESTREAM_STOP_FROM_RECEIVER] = &ClientInterface::restream_stop;
|
flist[F_RESTREAM_STOP_FROM_RECEIVER] = &ClientInterface::restream_stop;
|
||||||
@ -1084,21 +1082,6 @@ int ClientInterface::get_streaming_port(Interface &socket) {
|
|||||||
return socket.sendResult(retval);
|
return socket.sendResult(retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ClientInterface::set_streaming_source_ip(Interface &socket) {
|
|
||||||
auto ip = socket.Receive<IpAddr>();
|
|
||||||
if (ip == 0)
|
|
||||||
throw RuntimeError("Invalid zmq ip " + ip.str());
|
|
||||||
verifyIdle(socket);
|
|
||||||
impl()->setStreamingSourceIP(ip);
|
|
||||||
return socket.Send(OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
int ClientInterface::get_streaming_source_ip(Interface &socket) {
|
|
||||||
IpAddr retval = impl()->getStreamingSourceIP();
|
|
||||||
LOG(logDEBUG1) << "streaming IP:" << retval;
|
|
||||||
return socket.sendResult(retval);
|
|
||||||
}
|
|
||||||
|
|
||||||
int ClientInterface::set_silent_mode(Interface &socket) {
|
int ClientInterface::set_silent_mode(Interface &socket) {
|
||||||
auto value = socket.Receive<int>();
|
auto value = socket.Receive<int>();
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
|
@ -117,8 +117,6 @@ class ClientInterface : private virtual slsDetectorDefs {
|
|||||||
int get_file_format(ServerInterface &socket);
|
int get_file_format(ServerInterface &socket);
|
||||||
int set_streaming_port(ServerInterface &socket);
|
int set_streaming_port(ServerInterface &socket);
|
||||||
int get_streaming_port(ServerInterface &socket);
|
int get_streaming_port(ServerInterface &socket);
|
||||||
int set_streaming_source_ip(ServerInterface &socket);
|
|
||||||
int get_streaming_source_ip(ServerInterface &socket);
|
|
||||||
int set_silent_mode(ServerInterface &socket);
|
int set_silent_mode(ServerInterface &socket);
|
||||||
int get_silent_mode(ServerInterface &socket);
|
int get_silent_mode(ServerInterface &socket);
|
||||||
int restream_stop(ServerInterface &socket);
|
int restream_stop(ServerInterface &socket);
|
||||||
|
@ -84,11 +84,10 @@ void DataStreamer::RecordFirstIndex(uint64_t fnum, size_t firstImageIndex) {
|
|||||||
<< ", First Streamer Index:" << fnum;
|
<< ", First Streamer Index:" << fnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataStreamer::CreateZmqSockets(uint16_t port, const IpAddr ip, int hwm) {
|
void DataStreamer::CreateZmqSockets(uint16_t port, int hwm) {
|
||||||
uint16_t portnum = port + index;
|
uint16_t portnum = port + index;
|
||||||
std::string sip = ip.str();
|
|
||||||
try {
|
try {
|
||||||
zmqSocket = new ZmqSocket(portnum, (ip != 0 ? sip.c_str() : nullptr));
|
zmqSocket = new ZmqSocket(portnum);
|
||||||
|
|
||||||
// set if custom
|
// set if custom
|
||||||
if (hwm >= 0) {
|
if (hwm >= 0) {
|
||||||
|
@ -45,10 +45,9 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
* Creates Zmq Sockets
|
* Creates Zmq Sockets
|
||||||
* (throws an exception if it couldnt create zmq sockets)
|
* (throws an exception if it couldnt create zmq sockets)
|
||||||
* @param port streaming port start index
|
* @param port streaming port start index
|
||||||
* @param ip streaming source ip
|
|
||||||
* @param hwm streaming high water mark
|
* @param hwm streaming high water mark
|
||||||
*/
|
*/
|
||||||
void CreateZmqSockets(uint16_t port, const IpAddr ip, int hwm);
|
void CreateZmqSockets(uint16_t port, int hwm);
|
||||||
void CloseZmqSocket();
|
void CloseZmqSocket();
|
||||||
void RestreamStop();
|
void RestreamStop();
|
||||||
|
|
||||||
|
@ -210,8 +210,7 @@ void Implementation::SetupDataProcessor(int i) {
|
|||||||
void Implementation::SetupDataStreamer(int i) {
|
void Implementation::SetupDataStreamer(int i) {
|
||||||
dataStreamer[i]->SetFifo(fifo[i].get());
|
dataStreamer[i]->SetFifo(fifo[i].get());
|
||||||
dataStreamer[i]->SetGeneralData(generalData);
|
dataStreamer[i]->SetGeneralData(generalData);
|
||||||
dataStreamer[i]->CreateZmqSockets(streamingPort, streamingSrcIP,
|
dataStreamer[i]->CreateZmqSockets(streamingPort, streamingHwm);
|
||||||
streamingHwm);
|
|
||||||
dataStreamer[i]->SetAdditionalJsonHeader(additionalJsonHeader);
|
dataStreamer[i]->SetAdditionalJsonHeader(additionalJsonHeader);
|
||||||
dataStreamer[i]->SetFileIndex(fileIndex);
|
dataStreamer[i]->SetFileIndex(fileIndex);
|
||||||
dataStreamer[i]->SetQuadEnable(quadEnable);
|
dataStreamer[i]->SetQuadEnable(quadEnable);
|
||||||
@ -1262,13 +1261,6 @@ void Implementation::setStreamingPort(const uint16_t i) {
|
|||||||
LOG(logINFO) << "Streaming Port: " << streamingPort;
|
LOG(logINFO) << "Streaming Port: " << streamingPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
IpAddr Implementation::getStreamingSourceIP() const { return streamingSrcIP; }
|
|
||||||
|
|
||||||
void Implementation::setStreamingSourceIP(const IpAddr ip) {
|
|
||||||
streamingSrcIP = ip;
|
|
||||||
LOG(logINFO) << "Streaming Source IP: " << streamingSrcIP;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Implementation::getStreamingHwm() const { return streamingHwm; }
|
int Implementation::getStreamingHwm() const { return streamingHwm; }
|
||||||
|
|
||||||
void Implementation::setStreamingHwm(const int i) {
|
void Implementation::setStreamingHwm(const int i) {
|
||||||
|
@ -142,8 +142,6 @@ class Implementation : private virtual slsDetectorDefs {
|
|||||||
void setStreamingStartingFrameNumber(const uint32_t fnum);
|
void setStreamingStartingFrameNumber(const uint32_t fnum);
|
||||||
uint16_t getStreamingPort() const;
|
uint16_t getStreamingPort() const;
|
||||||
void setStreamingPort(const uint16_t i);
|
void setStreamingPort(const uint16_t i);
|
||||||
IpAddr getStreamingSourceIP() const;
|
|
||||||
void setStreamingSourceIP(const IpAddr ip);
|
|
||||||
int getStreamingHwm() const;
|
int getStreamingHwm() const;
|
||||||
void setStreamingHwm(const int i);
|
void setStreamingHwm(const int i);
|
||||||
std::map<std::string, std::string> getAdditionalJsonHeader() const;
|
std::map<std::string, std::string> getAdditionalJsonHeader() const;
|
||||||
@ -346,7 +344,6 @@ class Implementation : private virtual slsDetectorDefs {
|
|||||||
uint32_t streamingTimerInMs{DEFAULT_STREAMING_TIMER_IN_MS};
|
uint32_t streamingTimerInMs{DEFAULT_STREAMING_TIMER_IN_MS};
|
||||||
uint32_t streamingStartFnum{0};
|
uint32_t streamingStartFnum{0};
|
||||||
uint16_t streamingPort{0};
|
uint16_t streamingPort{0};
|
||||||
IpAddr streamingSrcIP = IpAddr{};
|
|
||||||
int streamingHwm{-1};
|
int streamingHwm{-1};
|
||||||
std::map<std::string, std::string> additionalJsonHeader;
|
std::map<std::string, std::string> additionalJsonHeader;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include <rapidjson/document.h> //json header in zmq stream
|
#include <rapidjson/document.h> //json header in zmq stream
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
//#include <zmq.h>
|
// #include <zmq.h>
|
||||||
|
|
||||||
class zmq_msg_t;
|
class zmq_msg_t;
|
||||||
namespace sls {
|
namespace sls {
|
||||||
@ -38,6 +38,8 @@ namespace sls {
|
|||||||
#define DEFAULT_LOW_ZMQ_HWM_BUFFERSIZE (1024 * 1024) // 1MB
|
#define DEFAULT_LOW_ZMQ_HWM_BUFFERSIZE (1024 * 1024) // 1MB
|
||||||
#define DEFAULT_ZMQ_BUFFERSIZE (-1) // os default
|
#define DEFAULT_ZMQ_BUFFERSIZE (-1) // os default
|
||||||
|
|
||||||
|
#define ZMQ_PUBLISHER_IP "0.0.0.0"
|
||||||
|
|
||||||
/** zmq header structure */
|
/** zmq header structure */
|
||||||
struct zmqHeader {
|
struct zmqHeader {
|
||||||
/** true if incoming data, false if end of acquisition */
|
/** true if incoming data, false if end of acquisition */
|
||||||
@ -98,22 +100,11 @@ class ZmqSocket {
|
|||||||
// use this to optimize if optimizing required eg. int value = -1; if
|
// use this to optimize if optimizing required eg. int value = -1; if
|
||||||
// (zmq_setsockopt(socketDescriptor, ZMQ_LINGER, &value,sizeof(value))) {
|
// (zmq_setsockopt(socketDescriptor, ZMQ_LINGER, &value,sizeof(value))) {
|
||||||
// Close();
|
// Close();
|
||||||
/**
|
/** Constructor for a subscriber socket */
|
||||||
* Constructor for a client
|
|
||||||
* Creates socket, context and connects to server
|
|
||||||
* @param hostname_or_ip hostname or ip of server
|
|
||||||
* @param portnumber port number
|
|
||||||
*/
|
|
||||||
ZmqSocket(const char *const hostname_or_ip, const uint16_t portnumber);
|
ZmqSocket(const char *const hostname_or_ip, const uint16_t portnumber);
|
||||||
|
|
||||||
/**
|
/** Constructor for a publisher socket */
|
||||||
* Constructor for a server
|
ZmqSocket(const uint16_t portnumber);
|
||||||
* Creates socket, context and connects to server
|
|
||||||
* socket option: keep alive added
|
|
||||||
* @param portnumber port number
|
|
||||||
* @param ethip is the ip of the ethernet interface to stream zmq from
|
|
||||||
*/
|
|
||||||
ZmqSocket(const uint16_t portnumber, const char *ethip);
|
|
||||||
|
|
||||||
/** Returns high water mark for outbound messages */
|
/** Returns high water mark for outbound messages */
|
||||||
int GetSendHighWaterMark();
|
int GetSendHighWaterMark();
|
||||||
|
@ -181,9 +181,9 @@ class slsDetectorDefs {
|
|||||||
int ymin{-1};
|
int ymin{-1};
|
||||||
int ymax{-1};
|
int ymax{-1};
|
||||||
ROI() = default;
|
ROI() = default;
|
||||||
ROI(int xmin, int xmax) : xmin(xmin), xmax(xmax){};
|
ROI(int xmin, int xmax) : xmin(xmin), xmax(xmax) {};
|
||||||
ROI(int xmin, int xmax, int ymin, int ymax)
|
ROI(int xmin, int xmax, int ymin, int ymax)
|
||||||
: xmin(xmin), xmax(xmax), ymin(ymin), ymax(ymax){};
|
: xmin(xmin), xmax(xmax), ymin(ymin), ymax(ymax) {};
|
||||||
constexpr std::array<int, 4> getIntArray() const {
|
constexpr std::array<int, 4> getIntArray() const {
|
||||||
return std::array<int, 4>({xmin, xmax, ymin, ymax});
|
return std::array<int, 4>({xmin, xmax, ymin, ymax});
|
||||||
}
|
}
|
||||||
@ -234,7 +234,7 @@ typedef struct {
|
|||||||
int x{0};
|
int x{0};
|
||||||
int y{0};
|
int y{0};
|
||||||
xy() = default;
|
xy() = default;
|
||||||
xy(int x, int y) : x(x), y(y){};
|
xy(int x, int y) : x(x), y(y) {};
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -748,8 +748,8 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
|||||||
case F_GET_RECEIVER_FILE_FORMAT: return "F_GET_RECEIVER_FILE_FORMAT";
|
case F_GET_RECEIVER_FILE_FORMAT: return "F_GET_RECEIVER_FILE_FORMAT";
|
||||||
case F_SET_RECEIVER_STREAMING_PORT: return "F_SET_RECEIVER_STREAMING_PORT";
|
case F_SET_RECEIVER_STREAMING_PORT: return "F_SET_RECEIVER_STREAMING_PORT";
|
||||||
case F_GET_RECEIVER_STREAMING_PORT: return "F_GET_RECEIVER_STREAMING_PORT";
|
case F_GET_RECEIVER_STREAMING_PORT: return "F_GET_RECEIVER_STREAMING_PORT";
|
||||||
case F_SET_RECEIVER_STREAMING_SRC_IP: return "F_SET_RECEIVER_STREAMING_SRC_IP";
|
case F_SET_RECEIVER_STREAMING_SRC_IP: return "F_SET_RECEIVER_STREAMING_SRC_IP - obsolete";
|
||||||
case F_GET_RECEIVER_STREAMING_SRC_IP: return "F_GET_RECEIVER_STREAMING_SRC_IP";
|
case F_GET_RECEIVER_STREAMING_SRC_IP: return "F_GET_RECEIVER_STREAMING_SRC_IP - obsolete";
|
||||||
case F_SET_RECEIVER_SILENT_MODE: return "F_SET_RECEIVER_SILENT_MODE";
|
case F_SET_RECEIVER_SILENT_MODE: return "F_SET_RECEIVER_SILENT_MODE";
|
||||||
case F_GET_RECEIVER_SILENT_MODE: return "F_GET_RECEIVER_SILENT_MODE";
|
case F_GET_RECEIVER_SILENT_MODE: return "F_GET_RECEIVER_SILENT_MODE";
|
||||||
case F_RESTREAM_STOP_FROM_RECEIVER: return "F_RESTREAM_STOP_FROM_RECEIVER";
|
case F_RESTREAM_STOP_FROM_RECEIVER: return "F_RESTREAM_STOP_FROM_RECEIVER";
|
||||||
|
@ -53,10 +53,19 @@ ZmqSocket::ZmqSocket(const char *const hostname_or_ip,
|
|||||||
}
|
}
|
||||||
LOG(logDEBUG) << "Default receive high water mark:"
|
LOG(logDEBUG) << "Default receive high water mark:"
|
||||||
<< GetReceiveHighWaterMark();
|
<< GetReceiveHighWaterMark();
|
||||||
|
|
||||||
|
// enable IPv6 addresses
|
||||||
|
int ipv6 = 1;
|
||||||
|
if (zmq_setsockopt(sockfd.socketDescriptor, ZMQ_IPV6, &ipv6,
|
||||||
|
sizeof(ipv6))) {
|
||||||
|
PrintError();
|
||||||
|
throw ZmqSocketError("Could not set ZMQ_IPV6");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ZmqSocket::ZmqSocket(const uint16_t portnumber, const char *ethip)
|
ZmqSocket::ZmqSocket(const uint16_t portnumber)
|
||||||
: portno(portnumber), sockfd(true) {
|
: portno(portnumber), sockfd(true) {
|
||||||
|
|
||||||
// create context
|
// create context
|
||||||
sockfd.contextDescriptor = zmq_ctx_new();
|
sockfd.contextDescriptor = zmq_ctx_new();
|
||||||
if (sockfd.contextDescriptor == nullptr)
|
if (sockfd.contextDescriptor == nullptr)
|
||||||
@ -72,32 +81,44 @@ ZmqSocket::ZmqSocket(const uint16_t portnumber, const char *ethip)
|
|||||||
|
|
||||||
// construct address, can be refactored with libfmt
|
// construct address, can be refactored with libfmt
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "tcp://" << ethip << ":" << portno;
|
oss << "tcp://" << ZMQ_PUBLISHER_IP << ":" << portno;
|
||||||
sockfd.serverAddress = oss.str();
|
sockfd.serverAddress = oss.str();
|
||||||
LOG(logDEBUG) << "zmq address: " << sockfd.serverAddress;
|
LOG(logDEBUG) << "zmq address: " << sockfd.serverAddress;
|
||||||
|
|
||||||
|
// enable IPv6 addresses
|
||||||
|
int ipv6 = 1;
|
||||||
|
if (zmq_setsockopt(sockfd.socketDescriptor, ZMQ_IPV6, &ipv6,
|
||||||
|
sizeof(ipv6))) {
|
||||||
|
PrintError();
|
||||||
|
throw ZmqSocketError("Could not set ZMQ_IPV6");
|
||||||
|
}
|
||||||
|
|
||||||
// Socket Options for keepalive
|
// Socket Options for keepalive
|
||||||
// enable TCP keepalive
|
// enable TCP keepalive
|
||||||
int keepalive = 1;
|
int keepalive = 1;
|
||||||
if (zmq_setsockopt(sockfd.socketDescriptor, ZMQ_TCP_KEEPALIVE, &keepalive, sizeof(keepalive))) {
|
if (zmq_setsockopt(sockfd.socketDescriptor, ZMQ_TCP_KEEPALIVE, &keepalive,
|
||||||
|
sizeof(keepalive))) {
|
||||||
PrintError();
|
PrintError();
|
||||||
throw ZmqSocketError("Could set socket opt ZMQ_TCP_KEEPALIVE");
|
throw ZmqSocketError("Could set socket opt ZMQ_TCP_KEEPALIVE");
|
||||||
}
|
}
|
||||||
// set the number of keepalives before death
|
// set the number of keepalives before death
|
||||||
keepalive = 10;
|
keepalive = 10;
|
||||||
if (zmq_setsockopt(sockfd.socketDescriptor, ZMQ_TCP_KEEPALIVE_CNT, &keepalive, sizeof(keepalive))) {
|
if (zmq_setsockopt(sockfd.socketDescriptor, ZMQ_TCP_KEEPALIVE_CNT,
|
||||||
|
&keepalive, sizeof(keepalive))) {
|
||||||
PrintError();
|
PrintError();
|
||||||
throw ZmqSocketError("Could set socket opt ZMQ_TCP_KEEPALIVE_CNT");
|
throw ZmqSocketError("Could set socket opt ZMQ_TCP_KEEPALIVE_CNT");
|
||||||
}
|
}
|
||||||
// set the time before the first keepalive
|
// set the time before the first keepalive
|
||||||
keepalive = 60;
|
keepalive = 60;
|
||||||
if (zmq_setsockopt(sockfd.socketDescriptor, ZMQ_TCP_KEEPALIVE_IDLE, &keepalive, sizeof(keepalive))) {
|
if (zmq_setsockopt(sockfd.socketDescriptor, ZMQ_TCP_KEEPALIVE_IDLE,
|
||||||
|
&keepalive, sizeof(keepalive))) {
|
||||||
PrintError();
|
PrintError();
|
||||||
throw ZmqSocketError("Could set socket opt ZMQ_TCP_KEEPALIVE_IDLE");
|
throw ZmqSocketError("Could set socket opt ZMQ_TCP_KEEPALIVE_IDLE");
|
||||||
}
|
}
|
||||||
// set the interval between keepalives
|
// set the interval between keepalives
|
||||||
keepalive = 1;
|
keepalive = 1;
|
||||||
if (zmq_setsockopt(sockfd.socketDescriptor, ZMQ_TCP_KEEPALIVE_INTVL, &keepalive, sizeof(keepalive))) {
|
if (zmq_setsockopt(sockfd.socketDescriptor, ZMQ_TCP_KEEPALIVE_INTVL,
|
||||||
|
&keepalive, sizeof(keepalive))) {
|
||||||
PrintError();
|
PrintError();
|
||||||
throw ZmqSocketError("Could set socket opt ZMQ_TCP_KEEPALIVE_INTVL");
|
throw ZmqSocketError("Could set socket opt ZMQ_TCP_KEEPALIVE_INTVL");
|
||||||
}
|
}
|
||||||
@ -109,7 +130,7 @@ ZmqSocket::ZmqSocket(const uint16_t portnumber, const char *ethip)
|
|||||||
}
|
}
|
||||||
// sleep to allow a slow-joiner
|
// sleep to allow a slow-joiner
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
||||||
};
|
}
|
||||||
|
|
||||||
int ZmqSocket::GetSendHighWaterMark() {
|
int ZmqSocket::GetSendHighWaterMark() {
|
||||||
int value = 0;
|
int value = 0;
|
||||||
@ -214,8 +235,9 @@ void ZmqSocket::SetReceiveBuffer(int limit) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZmqSocket::Rebind() { // the purpose is to apply HWL changes, which are
|
void ZmqSocket::Rebind() {
|
||||||
// frozen at bind, which is in the constructor.
|
// the purpose is to apply HWL changes, which are
|
||||||
|
// frozen at bind, which is in the constructor.
|
||||||
|
|
||||||
// unbbind
|
// unbbind
|
||||||
if (zmq_unbind(sockfd.socketDescriptor, sockfd.serverAddress.c_str())) {
|
if (zmq_unbind(sockfd.socketDescriptor, sockfd.serverAddress.c_str())) {
|
||||||
@ -498,8 +520,11 @@ void ZmqSocket::PrintError() {
|
|||||||
LOG(logERROR)
|
LOG(logERROR)
|
||||||
<< "No I/O thread is available to accomplish the task (zmq)";
|
<< "No I/O thread is available to accomplish the task (zmq)";
|
||||||
break;
|
break;
|
||||||
|
case ENOENT:
|
||||||
|
LOG(logERROR) << "The requested endpoint does not exist (zmq)";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
LOG(logERROR) << "Unknown socket error (zmq)";
|
LOG(logERROR) << "Unknown socket error (zmq). Error code: " << errno;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,14 +17,14 @@ TEST_CASE("Get port number for sub") {
|
|||||||
|
|
||||||
TEST_CASE("Get port number for pub") {
|
TEST_CASE("Get port number for pub") {
|
||||||
constexpr int port = 50001;
|
constexpr int port = 50001;
|
||||||
ZmqSocket pub(port, "*");
|
ZmqSocket pub(port);
|
||||||
REQUIRE(pub.GetPortNumber() == port);
|
REQUIRE(pub.GetPortNumber() == port);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Server address") {
|
TEST_CASE("Server address") {
|
||||||
constexpr int port = 50001;
|
constexpr int port = 50001;
|
||||||
ZmqSocket pub(port, "*");
|
ZmqSocket pub(port);
|
||||||
REQUIRE(pub.GetZmqServerAddress() == std::string("tcp://*:50001"));
|
REQUIRE(pub.GetZmqServerAddress() == std::string("tcp://0.0.0.0:50001"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Send header on localhost") {
|
TEST_CASE("Send header on localhost") {
|
||||||
@ -32,7 +32,7 @@ TEST_CASE("Send header on localhost") {
|
|||||||
ZmqSocket sub("localhost", port);
|
ZmqSocket sub("localhost", port);
|
||||||
sub.Connect();
|
sub.Connect();
|
||||||
|
|
||||||
ZmqSocket pub(port, "*");
|
ZmqSocket pub(port);
|
||||||
|
|
||||||
// Header to send
|
// Header to send
|
||||||
zmqHeader header;
|
zmqHeader header;
|
||||||
@ -67,7 +67,7 @@ TEST_CASE("Send serveral headers of different length") {
|
|||||||
ZmqSocket sub("localhost", port);
|
ZmqSocket sub("localhost", port);
|
||||||
sub.Connect();
|
sub.Connect();
|
||||||
|
|
||||||
ZmqSocket pub(port, "*");
|
ZmqSocket pub(port);
|
||||||
|
|
||||||
zmqHeader header;
|
zmqHeader header;
|
||||||
header.data = false; // if true we wait for the data
|
header.data = false; // if true we wait for the data
|
||||||
@ -95,7 +95,7 @@ TEST_CASE("Send header and data") {
|
|||||||
ZmqSocket sub("localhost", port);
|
ZmqSocket sub("localhost", port);
|
||||||
sub.Connect();
|
sub.Connect();
|
||||||
|
|
||||||
ZmqSocket pub(port, "*");
|
ZmqSocket pub(port);
|
||||||
|
|
||||||
std::vector<int> data{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
|
std::vector<int> data{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
|
||||||
const int nbytes = data.size() * sizeof(decltype(data)::value_type);
|
const int nbytes = data.size() * sizeof(decltype(data)::value_type);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user