Skip to content

Commit

Permalink
Dev/zmq stream all ipv6 adn remove rx_zmqip (#958)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
thattil authored Sep 10, 2024
1 parent 15e8c0d commit e848293
Show file tree
Hide file tree
Showing 35 changed files with 168 additions and 426 deletions.
6 changes: 3 additions & 3 deletions docs/src/commandline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ Commands
.. include:: ../commands.rst


Depreciated commands
Deprecated commands
------------------------

.. 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.
.. csv-table:: Depreciated commands
:file: ../depreciated.csv
.. csv-table:: Deprecated commands
:file: ../deprecated.csv
:widths: 35, 35
:header-rows: 1

Expand Down
4 changes: 2 additions & 2 deletions docs/src/gendoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ int main() {
fs << '\t' << cmd << usage << help << "\n";
}

std::ofstream fs2("depreciated.csv");
std::ofstream fs2("deprecated.csv");
fs2 << "Old, New\n";
auto cmds = proxy.GetDepreciatedCommands();
auto cmds = proxy.GetDeprecatedCommands();
for (auto it : cmds) {
fs2 << it.first << ", " << it.second << '\n';
}
Expand Down
25 changes: 0 additions & 25 deletions python/slsdet/detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -1210,31 +1210,6 @@ def zmqport(self, port):
else:
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
@element
def zmqip(self):
Expand Down
7 changes: 3 additions & 4 deletions slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,11 @@ int main(int argc, char *argv[]) {
if (send) {
// receive socket
try {
zmqsocket2 = new sls::ZmqSocket(portnum2, socketip2.c_str());
zmqsocket2 = new sls::ZmqSocket(portnum2);
} catch (...) {
cprintf(RED,
"Error: Could not create Zmq sending socket on port %d and "
"ip %s\n",
portnum2, socketip2.c_str());
"Error: Could not create Zmq sending socket on port %d\n",
portnum2);
// delete zmqsocket2;
// zmqsocket2=NULL;
// delete zmqsocket;
Expand Down
61 changes: 2 additions & 59 deletions slsDetectorGui/forms/form_tab_advanced.ui
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Sets Listening ZMQ IP of client interface (packets streamed from receiver for gui)&lt;/p&gt;&lt;p&gt;#zmqip#&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;Has to be same as rx_zmqip for gui&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Sets Listening ZMQ IP of client interface (packets streamed from receiver for gui)&lt;/p&gt;&lt;p&gt;#zmqip#&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Client ZMQ IP:</string>
Expand Down Expand Up @@ -886,7 +886,7 @@
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Sets Listening ZMQ IP of client interface (packets streamed from receiver for gui)&lt;/p&gt;&lt;p&gt;#zmqip#&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;Has to be same as rx_zmqip for gui&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Sets Listening ZMQ IP of client interface (packets streamed from receiver for gui)&lt;/p&gt;&lt;p&gt;#zmqip#&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>0</string>
Expand Down Expand Up @@ -948,28 +948,6 @@
</property>
</widget>
</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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Sets Publishing ZMQ IP of reciever (packets streamed from receiver for gui)&lt;/p&gt;&lt;p&gt;#rx_zmqip#&lt;/p&gt;&lt;p&gt;Has to be same as zmqip for gui&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Receiver ZMQ IP:</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
Expand Down Expand Up @@ -1121,40 +1099,6 @@
</property>
</widget>
</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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Sets Publishing ZMQ IP of reciever (packets streamed from receiver for gui)&lt;/p&gt;&lt;p&gt;#rx_zmqip#&lt;/p&gt;&lt;p&gt;Has to be same as zmqip for gui&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_11">
<property name="sizePolicy">
Expand Down Expand Up @@ -2312,7 +2256,6 @@ Exposure Time of a sub frame. Only for Eiger in 32 bit mode
<tabstop>dispRxrUDPIP</tabstop>
<tabstop>dispRxrUDPMAC</tabstop>
<tabstop>spinRxrZMQPort</tabstop>
<tabstop>dispRxrZMQIP</tabstop>
<tabstop>spinNumStoragecells</tabstop>
<tabstop>spinSubExpTime</tabstop>
<tabstop>comboSubExpTimeUnit</tabstop>
Expand Down
3 changes: 0 additions & 3 deletions slsDetectorGui/include/qTabAdvanced.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ class qTabAdvanced : public QWidget, private Ui::TabAdvancedObject {
void SetRxrUDPMAC(bool force = false);
void ForceSetRxrUDPMAC();
void SetRxrZMQPort(int port);
void SetRxrZMQIP(bool force = false);
void ForceSetRxrZMQIP();
void GetROI();
void ClearROI();
void SetROI();
Expand Down Expand Up @@ -68,7 +66,6 @@ class qTabAdvanced : public QWidget, private Ui::TabAdvancedObject {
void GetRxrUDPIP();
void GetRxrUDPMAC();
void GetRxrZMQPort();
void GetRxrZMQIP();
void GetAllTrimbits();
void GetNumStoragecells();
void GetSubExposureTime();
Expand Down
35 changes: 0 additions & 35 deletions slsDetectorGui/src/qTabAdvanced.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ void qTabAdvanced::Initialization() {
SLOT(ForceSetRxrUDPMAC()));
connect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this,
SLOT(SetRxrZMQPort(int)));
connect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP()));
connect(dispRxrZMQIP, SIGNAL(returnPressed()), this,
SLOT(ForceSetRxrZMQIP()));

// roi
if (tab_roi->isEnabled()) {
Expand Down Expand Up @@ -388,20 +385,6 @@ void qTabAdvanced::GetRxrZMQPort() {
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() {
LOG(logDEBUG) << "Set Detector: "
<< comboDetector->currentText().toLatin1().data();
Expand All @@ -418,7 +401,6 @@ void qTabAdvanced::SetDetector() {
GetRxrUDPIP();
GetRxrUDPMAC();
GetRxrZMQPort();
GetRxrZMQIP();

LOG(logDEBUG) << det->printRxConfiguration();
}
Expand Down Expand Up @@ -588,23 +570,6 @@ void qTabAdvanced::SetRxrZMQPort(int port) {
&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() {
LOG(logDEBUG) << "Getting ROI";
try {
Expand Down
4 changes: 2 additions & 2 deletions slsDetectorSoftware/generator/Caller.in.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Caller {
int rx_id{-1};

private:
bool ReplaceIfDepreciated(std::string &command);
bool ReplaceIfDeprecated(std::string &command);
using FunctionMap = std::map<std::string, std::string (Caller::*)(int)>;
using StringMap = std::map<std::string, std::string>;
Detector *ptr; // pointer to the detector that executes the command
Expand All @@ -81,7 +81,7 @@ class Caller {

};

StringMap depreciated_functions{
StringMap deprecated_functions{

// THIS COMMENT TO BE REPLACED BY THE ACTUAL CODE (3)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2111,11 +2111,6 @@ return 0
}
__rx_zmqip() {
FCN_RETURN=""
if [[ ${IS_GET} -eq 0 ]]; then
if [[ "${cword}" == "2" ]]; then
FCN_RETURN=""
fi
fi
return 0
}
__rx_zmqport() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2035,11 +2035,6 @@ return 0
}
__rx_zmqip() {
FCN_RETURN=""
if [[ ${IS_GET} -eq 0 ]]; then
if [[ "${cword}" == "2" ]]; then
FCN_RETURN=""
fi
fi
return 0
}
__rx_zmqport() {
Expand Down
28 changes: 12 additions & 16 deletions slsDetectorSoftware/generator/commands.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1041,18 +1041,6 @@ rx_zmqstartfnum:
PUT:
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:
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
Expand Down Expand Up @@ -2578,6 +2566,14 @@ rx_hostname:
PUT:
argc: -1

rx_zmqip:
is_description: true
actions:
GET:
argc: 0
PUT:
argc: -1

rx_roi:
is_description: true
actions:
Expand Down Expand Up @@ -3936,7 +3932,7 @@ patloop:
output: [level,"' '" , "'['" , "ToStringHex(start, 4)" , '", "' , "ToStringHex(stop, 4)", "']'" ]

patloop0:
help: "Depreciated command. Use patloop."
help: "Deprecated command. Use patloop."
inherit_actions: patloop
actions:
GET:
Expand Down Expand Up @@ -3983,7 +3979,7 @@ patnloop:
output: [ level,"' '" , nloops ]

patnloop0:
help: "Depreciated command. Use patnloop."
help: "Deprecated command. Use patnloop."
inherit_actions: patnloop
actions:
GET:
Expand Down Expand Up @@ -4029,7 +4025,7 @@ patwait:
output: [level,"' '" , "ToStringHex(addr, 4)" ]

patwait0:
help: "Depreciated command. Use patwait."
help: "Deprecated command. Use patwait."
inherit_actions: patwait
actions:
GET:
Expand Down Expand Up @@ -4075,7 +4071,7 @@ patwaittime:
output: [level,"' '" , "waittime" ]

patwaittime0:
help: "Depreciated command. Use patwaittime."
help: "Deprecated command. Use patwaittime."
inherit_actions: patwaittime
actions:
GET:
Expand Down
Loading

0 comments on commit e848293

Please sign in to comment.