mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +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:
@ -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
|
||||
@ -81,7 +81,7 @@ class Caller {
|
||||
|
||||
};
|
||||
|
||||
StringMap depreciated_functions{
|
||||
StringMap deprecated_functions{
|
||||
|
||||
// THIS COMMENT TO BE REPLACED BY THE ACTUAL CODE (3)
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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
|
||||
@ -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:
|
||||
@ -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:
|
||||
@ -3983,7 +3979,7 @@ patnloop:
|
||||
output: [ level,"' '" , nloops ]
|
||||
|
||||
patnloop0:
|
||||
help: "Depreciated command. Use patnloop."
|
||||
help: "Deprecated command. Use patnloop."
|
||||
inherit_actions: patnloop
|
||||
actions:
|
||||
GET:
|
||||
@ -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:
|
||||
@ -4075,7 +4071,7 @@ patwaittime:
|
||||
output: [level,"' '" , "waittime" ]
|
||||
|
||||
patwaittime0:
|
||||
help: "Depreciated command. Use patwaittime."
|
||||
help: "Deprecated command. Use patwaittime."
|
||||
inherit_actions: patwaittime
|
||||
actions:
|
||||
GET:
|
||||
|
@ -5994,7 +5994,7 @@ patloop0:
|
||||
store_result_in_t: false
|
||||
command_name: patloop0
|
||||
function_alias: patloop0
|
||||
help: Depreciated command. Use patloop.
|
||||
help: Deprecated command. Use patloop.
|
||||
infer_action: true
|
||||
patloop1:
|
||||
actions:
|
||||
@ -6063,7 +6063,7 @@ patloop1:
|
||||
store_result_in_t: false
|
||||
command_name: patloop1
|
||||
function_alias: patloop1
|
||||
help: Depreciated command. Use patloop.
|
||||
help: Deprecated command. Use patloop.
|
||||
infer_action: true
|
||||
patloop2:
|
||||
actions:
|
||||
@ -6132,7 +6132,7 @@ patloop2:
|
||||
store_result_in_t: false
|
||||
command_name: patloop2
|
||||
function_alias: patloop2
|
||||
help: Depreciated command. Use patloop.
|
||||
help: Deprecated command. Use patloop.
|
||||
infer_action: true
|
||||
patmask:
|
||||
actions:
|
||||
@ -6293,7 +6293,7 @@ patnloop0:
|
||||
store_result_in_t: false
|
||||
command_name: patnloop0
|
||||
function_alias: patnloop0
|
||||
help: Depreciated command. Use patnloop.
|
||||
help: Deprecated command. Use patnloop.
|
||||
infer_action: true
|
||||
patnloop1:
|
||||
actions:
|
||||
@ -6351,7 +6351,7 @@ patnloop1:
|
||||
store_result_in_t: false
|
||||
command_name: patnloop1
|
||||
function_alias: patnloop1
|
||||
help: Depreciated command. Use patnloop.
|
||||
help: Deprecated command. Use patnloop.
|
||||
infer_action: true
|
||||
patnloop2:
|
||||
actions:
|
||||
@ -6409,7 +6409,7 @@ patnloop2:
|
||||
store_result_in_t: false
|
||||
command_name: patnloop2
|
||||
function_alias: patnloop2
|
||||
help: Depreciated command. Use patnloop.
|
||||
help: Deprecated command. Use patnloop.
|
||||
infer_action: true
|
||||
patsetbit:
|
||||
actions:
|
||||
@ -6616,7 +6616,7 @@ patwait0:
|
||||
store_result_in_t: false
|
||||
command_name: patwait0
|
||||
function_alias: patwait0
|
||||
help: Depreciated command. Use patwait.
|
||||
help: Deprecated command. Use patwait.
|
||||
infer_action: true
|
||||
patwait1:
|
||||
actions:
|
||||
@ -6674,7 +6674,7 @@ patwait1:
|
||||
store_result_in_t: false
|
||||
command_name: patwait1
|
||||
function_alias: patwait1
|
||||
help: Depreciated command. Use patwait.
|
||||
help: Deprecated command. Use patwait.
|
||||
infer_action: true
|
||||
patwait2:
|
||||
actions:
|
||||
@ -6732,7 +6732,7 @@ patwait2:
|
||||
store_result_in_t: false
|
||||
command_name: patwait2
|
||||
function_alias: patwait2
|
||||
help: Depreciated command. Use patwait.
|
||||
help: Deprecated command. Use patwait.
|
||||
infer_action: true
|
||||
patwaittime:
|
||||
actions:
|
||||
@ -6853,7 +6853,7 @@ patwaittime0:
|
||||
store_result_in_t: false
|
||||
command_name: patwaittime0
|
||||
function_alias: patwaittime0
|
||||
help: Depreciated command. Use patwaittime.
|
||||
help: Deprecated command. Use patwaittime.
|
||||
infer_action: true
|
||||
patwaittime1:
|
||||
actions:
|
||||
@ -6911,7 +6911,7 @@ patwaittime1:
|
||||
store_result_in_t: false
|
||||
command_name: patwaittime1
|
||||
function_alias: patwaittime1
|
||||
help: Depreciated command. Use patwaittime.
|
||||
help: Deprecated command. Use patwaittime.
|
||||
infer_action: true
|
||||
patwaittime2:
|
||||
actions:
|
||||
@ -6969,7 +6969,7 @@ patwaittime2:
|
||||
store_result_in_t: false
|
||||
command_name: patwaittime2
|
||||
function_alias: patwaittime2
|
||||
help: Depreciated command. Use patwaittime.
|
||||
help: Deprecated command. Use patwaittime.
|
||||
infer_action: true
|
||||
patword:
|
||||
actions:
|
||||
@ -9250,38 +9250,30 @@ rx_zmqip:
|
||||
cast_input: []
|
||||
check_det_id: false
|
||||
convert_det_id: true
|
||||
function: getRxZmqIP
|
||||
function: ''
|
||||
input: []
|
||||
input_types: []
|
||||
output:
|
||||
- OutString(t)
|
||||
require_det_id: true
|
||||
output: []
|
||||
require_det_id: false
|
||||
store_result_in_t: true
|
||||
PUT:
|
||||
args:
|
||||
- arg_types:
|
||||
- IpAddr
|
||||
argc: 1
|
||||
cast_input:
|
||||
- false
|
||||
- arg_types: []
|
||||
argc: -1
|
||||
cast_input: []
|
||||
check_det_id: false
|
||||
convert_det_id: true
|
||||
function: setRxZmqIP
|
||||
input:
|
||||
- IpAddr(args[0])
|
||||
input_types:
|
||||
- IpAddr
|
||||
output:
|
||||
- args.front()
|
||||
require_det_id: true
|
||||
function: ''
|
||||
input: []
|
||||
input_types: []
|
||||
output: []
|
||||
require_det_id: false
|
||||
store_result_in_t: false
|
||||
command_name: 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\
|
||||
\ receiver. Also restarts receiver zmq streaming if enabled. Default is from rx_hostname.\
|
||||
\ Modified only when using an intermediate process between receiver."
|
||||
help: ''
|
||||
infer_action: true
|
||||
template: true
|
||||
is_description: true
|
||||
rx_zmqport:
|
||||
actions:
|
||||
GET:
|
||||
|
@ -7921,7 +7921,7 @@ std::string Caller::patloop0(int action) {
|
||||
// print help
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
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();
|
||||
}
|
||||
|
||||
@ -7976,7 +7976,7 @@ std::string Caller::patloop1(int action) {
|
||||
// print help
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
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();
|
||||
}
|
||||
|
||||
@ -8031,7 +8031,7 @@ std::string Caller::patloop2(int action) {
|
||||
// print help
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
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();
|
||||
}
|
||||
|
||||
@ -8205,7 +8205,7 @@ std::string Caller::patnloop0(int action) {
|
||||
// print help
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
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();
|
||||
}
|
||||
|
||||
@ -8258,7 +8258,7 @@ std::string Caller::patnloop1(int action) {
|
||||
// print help
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
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();
|
||||
}
|
||||
|
||||
@ -8311,7 +8311,7 @@ std::string Caller::patnloop2(int action) {
|
||||
// print help
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
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();
|
||||
}
|
||||
|
||||
@ -8562,7 +8562,7 @@ std::string Caller::patwait0(int action) {
|
||||
// print help
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
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();
|
||||
}
|
||||
|
||||
@ -8614,7 +8614,7 @@ std::string Caller::patwait1(int action) {
|
||||
// print help
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
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();
|
||||
}
|
||||
|
||||
@ -8666,7 +8666,7 @@ std::string Caller::patwait2(int action) {
|
||||
// print help
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
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();
|
||||
}
|
||||
|
||||
@ -8773,8 +8773,7 @@ std::string Caller::patwaittime0(int action) {
|
||||
// print help
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: patwaittime0" << std::endl;
|
||||
os << R"V0G0N(Depreciated command. Use patwaittime. )V0G0N"
|
||||
<< std::endl;
|
||||
os << R"V0G0N(Deprecated command. Use patwaittime. )V0G0N" << std::endl;
|
||||
return os.str();
|
||||
}
|
||||
|
||||
@ -8826,8 +8825,7 @@ std::string Caller::patwaittime1(int action) {
|
||||
// print help
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: patwaittime1" << std::endl;
|
||||
os << R"V0G0N(Depreciated command. Use patwaittime. )V0G0N"
|
||||
<< std::endl;
|
||||
os << R"V0G0N(Deprecated command. Use patwaittime. )V0G0N" << std::endl;
|
||||
return os.str();
|
||||
}
|
||||
|
||||
@ -8879,8 +8877,7 @@ std::string Caller::patwaittime2(int action) {
|
||||
// print help
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: patwaittime2" << std::endl;
|
||||
os << R"V0G0N(Depreciated command. Use patwaittime. )V0G0N"
|
||||
<< std::endl;
|
||||
os << R"V0G0N(Deprecated command. Use patwaittime. )V0G0N" << std::endl;
|
||||
return os.str();
|
||||
}
|
||||
|
||||
@ -12114,63 +12111,6 @@ std::string Caller::rx_zmqhwm(int action) {
|
||||
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::ostringstream os;
|
||||
|
@ -392,7 +392,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
|
||||
@ -734,7 +734,7 @@ class Caller {
|
||||
|
||||
};
|
||||
|
||||
StringMap depreciated_functions{
|
||||
StringMap deprecated_functions{
|
||||
|
||||
{"detectorversion", "firmwareversion"},
|
||||
{"softwareversion", "detectorserverversion"},
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "Caller.h"
|
||||
#include "sls/ZmqSocket.h"
|
||||
#include "sls/bit_utils.h"
|
||||
#include "sls/file_utils.h"
|
||||
#include "sls/logger.h"
|
||||
@ -22,7 +23,7 @@ void Caller::call(const std::string &command,
|
||||
std::string temp;
|
||||
while (temp != cmd) {
|
||||
temp = cmd;
|
||||
ReplaceIfDepreciated(cmd);
|
||||
ReplaceIfDeprecated(cmd);
|
||||
}
|
||||
|
||||
det_id = detector_id;
|
||||
@ -37,9 +38,9 @@ void Caller::call(const std::string &command,
|
||||
}
|
||||
}
|
||||
|
||||
bool Caller::ReplaceIfDepreciated(std::string &command) {
|
||||
auto d_it = depreciated_functions.find(command);
|
||||
if (d_it != depreciated_functions.end()) {
|
||||
bool Caller::ReplaceIfDeprecated(std::string &command) {
|
||||
auto d_it = deprecated_functions.find(command);
|
||||
if (d_it != deprecated_functions.end()) {
|
||||
|
||||
// insert old command into arguments (for dacs)
|
||||
if (d_it->second == "dac") {
|
||||
@ -648,6 +649,25 @@ std::string Caller::rx_hostname(int action) {
|
||||
}
|
||||
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::ostringstream os;
|
||||
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 {
|
||||
return pimpl->Parallel(&Module::getClientStreamingPort, pos);
|
||||
}
|
||||
|
@ -1429,8 +1429,8 @@ void Module::setReceiverHostname(const std::string &hostname,
|
||||
|
||||
shm()->numUDPInterfaces = retval.udpInterfaces;
|
||||
|
||||
// to use rx_hostname if empty and also update client zmqip
|
||||
updateReceiverStreamingIP();
|
||||
// to use rx_hostname if empty
|
||||
updateClientStreamingIP();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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; }
|
||||
|
||||
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";
|
||||
}
|
||||
|
||||
void Module::updateReceiverStreamingIP() {
|
||||
auto ip = getReceiverStreamingIP();
|
||||
void Module::updateClientStreamingIP() {
|
||||
auto ip = getClientStreamingIP();
|
||||
if (ip == 0) {
|
||||
// Hostname could be ip try to decode otherwise look up the hostname
|
||||
ip = IpAddr{shm()->rxHostname};
|
||||
if (ip == 0) {
|
||||
ip = HostnameToIp(shm()->rxHostname);
|
||||
}
|
||||
LOG(logINFO) << "Setting default receiver " << moduleIndex
|
||||
<< " streaming zmq ip to " << ip;
|
||||
LOG(logINFO) << "Setting default module " << moduleIndex
|
||||
<< " zmq ip to " << ip;
|
||||
|
||||
setClientStreamingIP(ip);
|
||||
}
|
||||
setReceiverStreamingIP(ip);
|
||||
}
|
||||
|
||||
void Module::updateRateCorrection() {
|
||||
|
@ -351,8 +351,6 @@ class Module : public virtual slsDetectorDefs {
|
||||
void setReceiverStreamingStartingFrame(int fnum);
|
||||
uint16_t getReceiverStreamingPort() const;
|
||||
void setReceiverStreamingPort(uint16_t port);
|
||||
IpAddr getReceiverStreamingIP() const;
|
||||
void setReceiverStreamingIP(const IpAddr ip);
|
||||
uint16_t getClientStreamingPort() const;
|
||||
void setClientStreamingPort(uint16_t port);
|
||||
IpAddr getClientStreamingIP() const;
|
||||
@ -766,7 +764,7 @@ class Module : public virtual slsDetectorDefs {
|
||||
sls_detector_module getModule();
|
||||
void sendModule(sls_detector_module *myMod, ClientSocket &client);
|
||||
void receiveModule(sls_detector_module *myMod, ClientSocket &client);
|
||||
void updateReceiverStreamingIP();
|
||||
void updateClientStreamingIP();
|
||||
|
||||
void updateRateCorrection();
|
||||
/** 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++]);
|
||||
} else {
|
||||
LOG(logWARNING)
|
||||
<< "Depreciated command. Please use patloop next time.";
|
||||
<< "Deprecated command. Please use patloop next time.";
|
||||
if (nargs != 2) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
ToString(args));
|
||||
@ -174,7 +174,7 @@ void Pattern::load(const std::string &fname) {
|
||||
}
|
||||
level = StringTo<int>(args[iArg++]);
|
||||
} else {
|
||||
LOG(logWARNING) << "Depreciated command. Please use "
|
||||
LOG(logWARNING) << "Deprecated command. Please use "
|
||||
"patnloop next time.";
|
||||
if (nargs != 1) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
@ -198,7 +198,7 @@ void Pattern::load(const std::string &fname) {
|
||||
level = StringTo<int>(args[iArg++]);
|
||||
} else {
|
||||
LOG(logWARNING)
|
||||
<< "Depreciated command. Please use patwait next time.";
|
||||
<< "Deprecated command. Please use patwait next time.";
|
||||
if (nargs != 1) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
ToString(args));
|
||||
@ -220,7 +220,7 @@ void Pattern::load(const std::string &fname) {
|
||||
}
|
||||
level = StringTo<int>(args[iArg++]);
|
||||
} else {
|
||||
LOG(logWARNING) << "Depreciated command. Please use "
|
||||
LOG(logWARNING) << "Deprecated command. Please use "
|
||||
"patwaittime next time.";
|
||||
if (nargs != 1) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
|
@ -2993,18 +2993,8 @@ int InferAction::rx_zmqhwm() {
|
||||
|
||||
int InferAction::rx_zmqip() {
|
||||
|
||||
if (args.size() == 0) {
|
||||
return slsDetectorDefs::GET_ACTION;
|
||||
}
|
||||
|
||||
if (args.size() == 1) {
|
||||
return slsDetectorDefs::PUT_ACTION;
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
throw RuntimeError("Could not infer action: Wrong number of arguments");
|
||||
}
|
||||
throw RuntimeError("sls_detector is disabled for command: rx_zmqip. Use "
|
||||
"sls_detector_get or sls_detector_put");
|
||||
}
|
||||
|
||||
int InferAction::rx_zmqport() {
|
||||
|
@ -192,12 +192,12 @@ TEST_CASE("Caller::patloop", "[.cmdcall]") {
|
||||
std::string sLoop = ToString(iLoop);
|
||||
if (iLoop < 3) {
|
||||
std::string deprecatedCmd = "patloop" + sLoop;
|
||||
{ // depreciated
|
||||
{ // deprecated
|
||||
std::ostringstream oss;
|
||||
caller.call(deprecatedCmd, {"0x20", "0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == deprecatedCmd + " [0x0020, 0x005c]\n");
|
||||
}
|
||||
{ // depreciated
|
||||
{ // deprecated
|
||||
std::ostringstream oss;
|
||||
caller.call(deprecatedCmd, {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == deprecatedCmd + " [0x0020, 0x005c]\n");
|
||||
@ -241,12 +241,12 @@ TEST_CASE("Caller::patnloop", "[.cmdcall]") {
|
||||
std::string sLoop = ToString(iLoop);
|
||||
if (iLoop < 3) {
|
||||
std::string deprecatedCmd = "patnloop" + sLoop;
|
||||
{ // depreciated
|
||||
{ // deprecated
|
||||
std::ostringstream oss;
|
||||
caller.call(deprecatedCmd, {"5"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == deprecatedCmd + " 5\n");
|
||||
}
|
||||
{ // depreciated
|
||||
{ // deprecated
|
||||
std::ostringstream oss;
|
||||
caller.call(deprecatedCmd, {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == deprecatedCmd + " 5\n");
|
||||
@ -287,12 +287,12 @@ TEST_CASE("Caller::patwait", "[.cmdcall]") {
|
||||
std::string sLoop = ToString(iLoop);
|
||||
if (iLoop < 3) {
|
||||
std::string deprecatedCmd = "patwait" + sLoop;
|
||||
{ // depreciated
|
||||
{ // deprecated
|
||||
std::ostringstream oss;
|
||||
caller.call(deprecatedCmd, {"0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == deprecatedCmd + " 0x005c\n");
|
||||
}
|
||||
{ // depreciated
|
||||
{ // deprecated
|
||||
std::ostringstream oss;
|
||||
caller.call(deprecatedCmd, {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == deprecatedCmd + " 0x005c\n");
|
||||
@ -333,12 +333,12 @@ TEST_CASE("Caller::patwaittime", "[.cmdcall]") {
|
||||
std::string sLoop = ToString(iLoop);
|
||||
if (iLoop < 3) {
|
||||
std::string deprecatedCmd = "patwaittime" + sLoop;
|
||||
{ // depreciated
|
||||
{ // deprecated
|
||||
std::ostringstream oss;
|
||||
caller.call(deprecatedCmd, {"8589936640"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == deprecatedCmd + " 8589936640\n");
|
||||
}
|
||||
{ // depreciated
|
||||
{ // deprecated
|
||||
std::ostringstream oss;
|
||||
caller.call(deprecatedCmd, {}, -1, GET, oss);
|
||||
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]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
|
@ -3083,7 +3083,7 @@ TEST_CASE("CALLER::zmqip", "[.cmdcall]") {
|
||||
REQUIRE(oss2.str() == "zmqip " + zmqip[0].str() + '\n');
|
||||
|
||||
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
|
||||
// help for all docs
|
||||
// command for all depreciated commands
|
||||
// command for all deprecated commands
|
||||
|
||||
namespace sls {
|
||||
|
||||
|
Reference in New Issue
Block a user