Removeudpcache (#65)

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* solved eiger 1-10g issue

* some fixes for remove udp cache to work

* bug fix virtual

* removed special handling of rx_udpip
This commit is contained in:
Dhanya Thattil
2019-09-30 14:46:25 +02:00
committed by GitHub
parent 6e6fcec698
commit ca054626e6
33 changed files with 1759 additions and 1379 deletions

View File

@ -7,6 +7,7 @@
#include <map>
#include <string>
#include <vector>
#include "network_utils.h"
/** Macro to make an integer command.
* CMDNAME name of the function that does the command
@ -72,6 +73,7 @@
return os.str(); \
}
namespace sls {
class CmdProxy {
@ -127,7 +129,19 @@ class CmdProxy {
{"lock", &CmdProxy::lock},
{"rx_readfreq", &CmdProxy::rx_readfreq},
{"rx_padding", &CmdProxy::rx_padding},
{"rx_framesperfile", &CmdProxy::rx_framesperfile}};
{"rx_framesperfile", &CmdProxy::rx_framesperfile},
{"detectormac", &CmdProxy::detectormac},
{"detectormac2", &CmdProxy::detectormac2},
{"rx_udpmac", &CmdProxy::rx_udpmac},
{"rx_udpmac2", &CmdProxy::rx_udpmac2},
{"detectorip", &CmdProxy::detectorip},
{"detectorip2", &CmdProxy::detectorip2},
{"rx_udpip", &CmdProxy::rx_udpip},
{"rx_udpip2", &CmdProxy::rx_udpip2},
{"rx_udpport", &CmdProxy::rx_udpport},
{"rx_udpport2", &CmdProxy::rx_udpport2},
{"numinterfaces", &CmdProxy::numinterfaces},
{"selinterface", &CmdProxy::selinterface}};
StringMap depreciated_functions{{"r_readfreq", "rx_readfreq"},
{"r_padding", "rx_padding"},
@ -179,6 +193,7 @@ class CmdProxy {
"[0, 1]\n\tgets partial frames padding enable in the "
"receiver. 0 does not pad partial frames(fastest), 1 "
"(default) pads partial frames");
INTEGER_COMMAND(rx_framesperfile, getFramesPerFile, setFramesPerFile,
std::stoi, "[n_frames]\n\tNumber of frames per file");
@ -197,6 +212,42 @@ class CmdProxy {
INTEGER_COMMAND(findex, getAcquisitionIndex, setAcquisitionIndex, std::stoi,
"[0, 1]\n\tFile index");
INTEGER_COMMAND(detectormac, getSourceUDPMAC, setSourceUDPMAC, MacAddr,
"[x:x:x:x:x:x]\n\tMac address of the detector (source) udp interface. ");
INTEGER_COMMAND(detectormac2, getSourceUDPMAC2, setSourceUDPMAC2, MacAddr,
"[x:x:x:x:x:x]\n\t[Jungfrau] Mac address of the bottom half of detector (source) udp interface. ");
INTEGER_COMMAND(rx_udpmac, getDestinationUDPMAC, setDestinationUDPMAC, MacAddr,
"[x:x:x:x:x:x]\n\tMac address of the receiver (destination) udp interface. Can be unused as rx_hostname/rx_udpip retrieves it.");
INTEGER_COMMAND(rx_udpmac2, getDestinationUDPMAC2, setDestinationUDPMAC2, MacAddr,
"[x:x:x:x:x:x]\n\t[Jungfrau] Mac address of the receiver (destination) udp interface where the second half of detector data is sent to. Can be unused as rx_hostname/rx_udpip2 retrieves it.")
INTEGER_COMMAND(detectorip, getSourceUDPIP, setSourceUDPIP, IpAddr,
"[x.x.x.x]\n\tIp address of the detector (source) udp interface. Must be same subnet as destination udp ip.");
INTEGER_COMMAND(detectorip2, getSourceUDPIP2, setSourceUDPIP2, IpAddr,
"[x.x.x.x]\n\t[Jungfrau] Ip address of the bottom half of detector (source) udp interface. Must be same subnet as destination udp ip2.");
INTEGER_COMMAND(rx_udpip, getDestinationUDPIP, setDestinationUDPIP, IpAddr,
"[x.x.x.x]\n\tIp address of the receiver (destination) udp interface.");
INTEGER_COMMAND(rx_udpip2, getDestinationUDPIP2, setDestinationUDPIP2, IpAddr,
"[x.x.x.x]\n\t[Jungfrau] Ip address of the receiver (destination) udp interface where the second half of detector data is sent to.");
INTEGER_COMMAND(rx_udpport, getDestinationUDPPort, setDestinationUDPPort, std::stoi,
"[n]\n\tPort number of the receiver (destination) udp interface.");
INTEGER_COMMAND(rx_udpport2, getDestinationUDPPort2, setDestinationUDPPort2, std::stoi,
"[n]\n\t[Jungfrau] Port number of the receiver (destination) udp interface where the second half of detector data is sent to.\n[Eiger] Port number of the reciever (desintation) udp interface where the right half of the detector data is sent to.");
INTEGER_COMMAND(numinterfaces, getNumberofUDPInterfaces, setNumberofUDPInterfaces, std::stoi,
"[1, 2]\n\t[Jungfrau] Number of udp interfaces to stream data from detector. Default: 1.");
INTEGER_COMMAND(selinterface, getSelectedUDPInterface, selectUDPInterface, std::stoi,
"[0, 1]\n\t[Jungfrau] The udp interface to stream data from detector. Effective only when number of interfaces is 1. Default: 0 (outer)");
INTEGER_COMMAND(parallel, getParallelMode, setParallelMode, std::stoi,
"[0, 1]\n\tEnable or disable parallel mode. [Eiger]");

View File

@ -263,12 +263,6 @@ class Detector {
* *
* ************************************************/
/** Configures the destination for UDP packets in the detector
* Needed only if you use a custom receiver (not slsReceiver)
* as it is already included in setReceiverHostname.
*/
void configureMAC(Positions pos = {}); // TODO: find a reasonable name
/** [Jungfrau] */
Result<int> getNumberofUDPInterfaces(Positions pos = {}) const;
@ -291,13 +285,13 @@ class Detector {
* 10G Eiger and other detectors, the source UDP IP must be in the
* same subnet of the destination UDP IP
*/
void setSourceUDPIP(const std::string &ip, Positions pos = {});
void setSourceUDPIP(const IpAddr ip, Positions pos = {});
/** [Jungfrau] bottom half */
Result<IpAddr> getSourceUDPIP2(Positions pos = {}) const;
/** [Jungfrau] bottom half */
void setSourceUDPIP2(const std::string &ip, Positions pos = {});
void setSourceUDPIP2(const IpAddr ip, Positions pos = {});
Result<MacAddr> getSourceUDPMAC(Positions pos = {}) const;
@ -306,24 +300,24 @@ class Detector {
* Others can be anything (beware of certain bits)
*/
void setSourceUDPMAC(const std::string &mac, Positions pos = {});
void setSourceUDPMAC(const MacAddr mac, Positions pos = {});
/** [Jungfrau] bottom half */
Result<MacAddr> getSourceUDPMAC2(Positions pos = {}) const;
/** [Jungfrau] bottom half */
void setSourceUDPMAC2(const std::string &mac, Positions pos = {});
void setSourceUDPMAC2(const MacAddr mac, Positions pos = {});
Result<IpAddr> getDestinationUDPIP(Positions pos = {}) const;
/** IP of the interface in receiver that the detector sends data to */
void setDestinationUDPIP(const std::string &ip, Positions pos = {});
void setDestinationUDPIP(const IpAddr ip, Positions pos = {});
/** [Jungfrau bottom half] */
Result<IpAddr> getDestinationUDPIP2(Positions pos = {}) const;
/** [Jungfrau bottom half] */
void setDestinationUDPIP2(const std::string &ip, Positions pos = {});
void setDestinationUDPIP2(const IpAddr ip, Positions pos = {});
Result<MacAddr> getDestinationUDPMAC(Positions pos = {}) const;
@ -331,13 +325,13 @@ class Detector {
* Only needed if you use a custom receiver (not slsReceiver)
* Must be followed by configuremac.
*/
void setDestinationUDPMAC(const std::string &mac, Positions pos = {});
void setDestinationUDPMAC(const MacAddr mac, Positions pos = {});
/** [Jungfrau bottom half] */
Result<MacAddr> getDestinationUDPMAC2(Positions pos = {}) const;
/** [Jungfrau bottom half] */
void setDestinationUDPMAC2(const std::string &mac, Positions pos = {});
void setDestinationUDPMAC2(const MacAddr mac, Positions pos = {});
Result<int> getDestinationUDPPort(Positions pos = {}) const;

View File

@ -582,7 +582,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* Configures in detector the destination for UDP packets
* @param detPos -1 for all detectors in list or specific detector position
*/
void configureMAC(int detPos = -1); //
//void configureMAC(int detPos = -1); //TODO
/**
* Set starting frame number for the next acquisition
@ -840,73 +840,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
*/
uint32_t clearBit(uint32_t addr, int n, int detPos = -1); //
/**
* Validates the format of the detector MAC address and sets it
* @param detectorMAC detector MAC address
* @param detPos -1 for all detectors in list or specific detector position
* @returns the detector MAC address
*/
std::string setDetectorMAC(const std::string &detectorMAC,
int detPos = -1); //
/**
* Returns the detector MAC address
* @param detPos -1 for all detectors in list or specific detector position
* @returns the detector MAC address
*/
std::string getDetectorMAC(int detPos = -1); //
/**
* Validates the format of the detector MAC address (bottom half) and sets
* it (Jungfrau only)
* @param detectorMAC detector MAC address (bottom half)
* @param detPos -1 for all detectors in list or specific detector position
* @returns the detector MAC address (bottom half)
*/
std::string setDetectorMAC2(const std::string &detectorMAC,
int detPos = -1); //
/**
* Returns the detector MAC address (bottom half) Jungfrau only
* @param detPos -1 for all detectors in list or specific detector position
* @returns the detector MAC address (bottom half)
*/
std::string getDetectorMAC2(int detPos = -1); //
/**
* //TODO: custom ip (eiger 10G and other detectors), use 0.0.0.0 and test
* Validates the format of the detector IP address and sets it
* @param detectorIP detector IP address
* @param detPos -1 for all detectors in list or specific detector position
* @returns the detector IP address
*/
std::string setDetectorIP(const std::string &detectorIP,
int detPos = -1); //
/**
* Returns the detector IP address
* @param detPos -1 for all detectors in list or specific detector position
* @returns the detector IP address
*/
std::string getDetectorIP(int detPos = -1) const; //
/**
* Validates the format of the detector IP address (bottom half) and sets it
* (Jungfrau only)
* @param detectorIP detector IP address (bottom half)
* @param detPos -1 for all detectors in list or specific detector position
* @returns the detector IP address (bottom half)
*/
std::string setDetectorIP2(const std::string &detectorIP,
int detPos = -1); //
/**
* Returns the detector IP address (bottom half) Jungfrau only
* @param detPos -1 for all detectors in list or specific detector position
* @returns the detector IP address (bottom half)
*/
std::string getDetectorIP2(int detPos = -1) const; //
/**
* Validates and sets the receiver.
* Also updates the receiver with all the shared memory parameters
@ -927,108 +860,12 @@ class multiSlsDetector : public virtual slsDetectorDefs {
std::string getReceiverHostname(int detPos = -1) const; //
/**
* TODO: replace this with setEthernetInterface
* Validates the format of the receiver UDP IP address and sets it
* @param udpip receiver UDP IP address
* @param detPos -1 for all detectors in list or specific detector position
* @returns the receiver UDP IP address
*/
std::string setReceiverUDPIP(const std::string &udpip, int detPos = -1); //
/**
* Returns the receiver UDP IP address
* @param detPos -1 for all detectors in list or specific detector position
* @returns the receiver UDP IP address
*/
std::string getReceiverUDPIP(int detPos = -1) const; //
/**
* Validates the format of the receiver UDP IP address (bottom half) and
* sets it(Jungfrau only)
* @param udpip receiver UDP IP address (bottom half)
* @param detPos -1 for all detectors in list or specific detector position
* @returns the receiver UDP IP address (bottom half)
*/
std::string setReceiverUDPIP2(const std::string &udpip, int detPos = -1); //
/**
* Returns the receiver UDP IP address (bottom half) Jungfrau only
* @param detPos -1 for all detectors in list or specific detector position
* @returns the receiver UDP IP address (bottom half)
*/
std::string getReceiverUDPIP2(int detPos = -1) const; //
/**
* Validates the format of the receiver UDP MAC address and sets it
* @param udpmac receiver UDP MAC address
* @param detPos -1 for all detectors in list or specific detector position
* @returns the receiver UDP MAC address
*/
std::string setReceiverUDPMAC(const std::string &udpmac,
int detPos = -1); //
/**
* Returns the receiver UDP MAC address
* @param detPos -1 for all detectors in list or specific detector position
* @returns the receiver UDP MAC address
*/
std::string getReceiverUDPMAC(int detPos = -1) const; //
/**
* Validates the format of the receiver UDP MAC address (bottom half) and
* sets it (Jungfrau only)
* @param udpmac receiver UDP MAC address (bottom half)
* @param detPos -1 for all detectors in list or specific detector position
* @returns the receiver UDP MAC address (bottom half)
*/
std::string setReceiverUDPMAC2(const std::string &udpmac, int detPos = -1);
/**
* Returns the receiver UDP MAC address (bottom half) Jungfrau only
* @param detPos -1 for all detectors in list or specific detector position
* @returns the receiver UDP MAC address (bottom half)
*/
std::string getReceiverUDPMAC2(int detPos = -1) const;
/**
* Sets the receiver UDP port
* @param udpport receiver UDP port
* @param detPos -1 for all detectors in list or specific detector position
* @returns the receiver UDP port
*/
int setReceiverUDPPort(int udpport, int detPos = -1); //
/**
* Returns the receiver UDP port
* @param detPos -1 for all detectors in list or specific detector position
* @returns the receiver UDP port
*/
int getReceiverUDPPort(int detPos = -1) const; //
/**
* Sets the receiver UDP port 2 (Eiger and Jungfrau only)
* @param udpport receiver UDP port 2
* @param detPos -1 for all detectors in list or specific detector position
* @returns the receiver UDP port 2
*/
int setReceiverUDPPort2(int udpport, int detPos = -1); //
/**
* Returns the receiver UDP port 2 of same interface (Eiger and Jungfrau
* only)
* @param detPos -1 for all detectors in list or specific detector position
* @returns the receiver UDP port 2 of same interface
*/
int getReceiverUDPPort2(int detPos = -1) const; //
/**
* Sets the number of UDP interfaces to stream data from detector (Jungfrau
* ets the number of UDP interfaces to stream data from detector (Jungfrau
* only)
* @param n number of interfaces. Options 1 or 2.
* @param detPos -1 for all detectors in list or specific detector position
* @returns the number of interfaces
*/
int setNumberofUDPInterfaces(int n, int detPos = -1); //
void setNumberofUDPInterfaces(int n, int detPos = -1); //
/**
* Returns the number of UDP interfaces to stream data from detector
@ -1036,16 +873,15 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* @param detPos -1 for all detectors in list or specific detector position
* @returns the number of interfaces
*/
int getNumberofUDPInterfaces(int detPos = -1) const; //
int getNumberofUDPInterfaces(int detPos = -1) ; //
/**
* Selects the UDP interfaces to stream data from detector. Effective only
* when number of interfaces is 1. (Jungfrau only)
* @param n selected interface. Options 1 or 2.
* @param detPos -1 for all detectors in list or specific detector position
* @returns the interface selected
*/
int selectUDPInterface(int n, int detPos = -1);
void selectUDPInterface(int n, int detPos = -1);
/**
* Returns the UDP interfaces to stream data from detector. Effective only
@ -1053,7 +889,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* @param detPos -1 for all detectors in list or specific detector position
* @returns the interface selected
*/
int getSelectedUDPInterface(int detPos = -1) const; //
int getSelectedUDPInterface(int detPos = -1) ; //
/**
* (advanced users)

View File

@ -13,7 +13,7 @@
class ServerInterface;
#define SLS_SHMAPIVERSION 0x190726
#define SLS_SHMVERSION 0x190816
#define SLS_SHMVERSION 0x190830
/**
* @short structure allocated in shared memory to store detector settings for
@ -89,45 +89,6 @@ struct sharedSlsDetector {
/** is the TCP port used to communicate between client and the receiver */
int rxTCPPort;
/** is the UDP port used to send data from detector to receiver */
int rxUDPPort;
/** is the port used to communicate between second half module of
* Eiger/ Jungfrau detector and the receiver*/
int rxUDPPort2;
/** ip address of the receiver for the detector to send packets to**/
sls::IpAddr rxUDPIP;
/** ip address of the receiver for the 2nd interface of the detector to send
* packets to**/
sls::IpAddr rxUDPIP2;
/** mac address of receiver for the detector to send packets to **/
sls::MacAddr rxUDPMAC;
/** mac address of receiver for the 2nd interface of the detector to send
* packets to **/
sls::MacAddr rxUDPMAC2;
/** mac address of the detector **/
sls::MacAddr detectorMAC;
/** mac address of the 2nd interface of the detector **/
sls::MacAddr detectorMAC2;
/** ip address of the detector **/
sls::IpAddr detectorIP;
/** ip address of the 2nd interface of the detector **/
sls::IpAddr detectorIP2;
/** number of udp interface */
int numUDPInterfaces;
/** selected udp interface */
int selectedUDPInterface;
/** is set if the receiver hostname given and is connected,
* unset if socket connection is not possible */
bool useReceiverFlag;
@ -719,63 +680,7 @@ class slsDetector : public virtual slsDetectorDefs {
*/
uint32_t clearBit(uint32_t addr, int n);
/**
* Validates the format of the detector MAC address and sets it \sa
* sharedSlsDetector
* @param detectorMAC detector MAC address
* @returns the detector MAC address
*/
std::string setDetectorMAC(const std::string &detectorMAC);
/**
* Returns the detector MAC address\sa sharedSlsDetector
* @returns the detector MAC address
*/
sls::MacAddr getDetectorMAC();
/**
* Validates the format of the detector MAC address (bottom half) and sets
* it (Jungfrau only)
* @param detectorMAC detector MAC address (bottom half)
* @returns the detector MAC address (bottom half)
*/
std::string setDetectorMAC2(const std::string &detectorMAC);
/**
* Returns the detector MAC address (bottom half) Jungfrau only
* @returns the detector MAC address (bottom half)
*/
sls::MacAddr getDetectorMAC2();
/**
* Validates the format of the detector IP address and sets it \sa
* sharedSlsDetector
* @param detectorIP detector IP address
* @returns the detector IP address
*/
std::string setDetectorIP(const std::string &detectorIP);
/**
* Returns the detector IP address\sa sharedSlsDetector
* @returns the detector IP address
*/
sls::IpAddr getDetectorIP() const;
/**
* Validates the format of the detector IP address (bottom half) and sets it
* (Jungfrau only)
* @param detectorIP detector IP address (bottom half)
* @returns the detector IP address (bottom half)
*/
std::string setDetectorIP2(const std::string &detectorIP);
/**
* Returns the detector IP address (bottom half) Jungfrau only
* @returns the detector IP address (bottom half)
*/
sls::IpAddr getDetectorIP2() const;
/**
/**
* Validates and sets the receiver.
* Also updates the receiver with all the shared memory parameters
* significant for the receiver Also configures the detector to the receiver
@ -791,104 +696,164 @@ class slsDetector : public virtual slsDetectorDefs {
*/
std::string getReceiverHostname() const;
/**
* Validates the format of the receiver UDP IP address and sets it \sa
* sharedSlsDetector
* @param udpip receiver UDP IP address
* @returns the receiver UDP IP address
/**
* Validates the format of the detector MAC address and sets it
* @param mac detector MAC address
*/
std::string setReceiverUDPIP(const std::string &udpip);
void setSourceUDPMAC(const sls::MacAddr mac);
/**
* Returns the receiver UDP IP address\sa sharedSlsDetector
* Returns the detector MAC address
* @returns the detector MAC address
*/
sls::MacAddr getSourceUDPMAC();
/**
* Validates the format of the detector MAC address (bottom half) and sets
* it (Jungfrau only)
* @param mac detector MAC address (bottom half)
*/
void setSourceUDPMAC2(const sls::MacAddr mac);
/**
* Returns the detector MAC address (bottom half) Jungfrau only
* @returns the detector MAC address (bottom half)
*/
sls::MacAddr getSourceUDPMAC2();
/**
* Validates the format of the detector IP address and sets it
* @param ip detector IP address
*/
void setSourceUDPIP(const sls::IpAddr ip);
/**
* Returns the detector IP address
* @returns the detector IP address
*/
sls::IpAddr getSourceUDPIP();
/**
* Validates the format of the detector IP address (bottom half) and sets it
* (Jungfrau only)
* @param ip detector IP address (bottom half)
*/
void setSourceUDPIP2(const sls::IpAddr ip);
/**
* Returns the detector IP address (bottom half) Jungfrau only
* @returns the detector IP address (bottom half)
*/
sls::IpAddr getSourceUDPIP2();
/**
* Validates the format of the receiver UDP IP address and sets it
* If slsReceiver used, Gets receiver udp mac address and sends it to the detector
* @param ip receiver UDP IP address
*/
void setDestinationUDPIP(const sls::IpAddr ip);
/**
* Returns the receiver UDP IP address
* If slsReceiver used, Gets receiver udp mac address and sends it to the detector
* @returns the receiver UDP IP address
*/
sls::IpAddr getReceiverUDPIP() const;
sls::IpAddr getDestinationUDPIP();
/**
* Gets destination udp ip from detector,
* if 0, it converts rx_hostname to ip and
* updates both detector and receiver
*/
void updateRxDestinationUDPIP();
/**
* Validates the format of the receiver UDP IP address (bottom half) and
* sets it(Jungfrau only)
* @param udpip receiver UDP IP address (bottom half)
* @returns the receiver UDP IP address (bottom half)
* If slsReceiver used, Gets receiver udp mac address2 and sends it to the detector
* @param ip receiver UDP IP address (bottom half)
*/
std::string setReceiverUDPIP2(const std::string &udpip);
void setDestinationUDPIP2(const sls::IpAddr ip);
/**
* Returns the receiver UDP IP address (bottom half) Jungfrau only
* If slsReceiver used, Gets receiver udp mac address2 and sends it to the detector
* @returns the receiver UDP IP address (bottom half)
*/
sls::IpAddr getReceiverUDPIP2() const;
sls::IpAddr getDestinationUDPIP2();
/**
* Gets destination udp ip2 from detector,
* if 0, it converts rx_hostname to ip and
* updates both detector and receiver
*/
void updateRxDestinationUDPIP2();
/**
* Validates the format of the receiver UDP MAC address and sets it
* @param mac receiver UDP MAC address
*/
void setDestinationUDPMAC(const sls::MacAddr mac);
/**
* Validates the format of the receiver UDP MAC address and sets it \sa
* sharedSlsDetector
* @param udpmac receiver UDP MAC address
* Returns the receiver UDP MAC address
* @returns the receiver UDP MAC address
*/
std::string setReceiverUDPMAC(const std::string &udpmac);
/**
* Returns the receiver UDP MAC address\sa sharedSlsDetector
* @returns the receiver UDP MAC address
*/
sls::MacAddr getReceiverUDPMAC() const;
sls::MacAddr getDestinationUDPMAC();
/**
* Validates the format of the receiver UDP MAC address (bottom half) and
* sets it (Jungfrau only)
* @param udpmac receiver UDP MAC address (bottom half)
* @returns the receiver UDP MAC address (bottom half)
* @param mac receiver UDP MAC address (bottom half)
*/
std::string setReceiverUDPMAC2(const std::string &udpmac);
void setDestinationUDPMAC2(const sls::MacAddr mac);
/**
* Returns the receiver UDP MAC address (bottom half) Jungfrau only
* @returns the receiver UDP MAC address (bottom half)
*/
sls::MacAddr getReceiverUDPMAC2() const;
sls::MacAddr getDestinationUDPMAC2();
/**
* Sets the receiver UDP port\sa sharedSlsDetector
* @param udpport receiver UDP port
* @returns the receiver UDP port
*/
int setReceiverUDPPort(int udpport);
void setDestinationUDPPort(int udpport);
/**
* Returns the receiver UDP port\sa sharedSlsDetector
* @returns the receiver UDP port
*/
int getReceiverUDPPort() const;
int getDestinationUDPPort();
/**
* Sets the receiver UDP port 2\sa sharedSlsDetector (Eiger and Jungfrau
* only)
* @param udpport receiver UDP port 2
* @returns the receiver UDP port 2
*/
int setReceiverUDPPort2(int udpport);
void setDestinationUDPPort2(int udpport);
/**
* Returns the receiver UDP port 2 of same interface\sa sharedSlsDetector
* (Eiger and Jungfrau only)
* @returns the receiver UDP port 2 of same interface
*/
int getReceiverUDPPort2() const;
int getDestinationUDPPort2();
/**
* Sets the number of UDP interfaces to stream data from detector (Jungfrau
* only)
* @param n number of interfaces. Options 1 or 2.
* @returns the number of interfaces
* @returns the number of interface
*/
int setNumberofUDPInterfaces(int n);
void setNumberofUDPInterfaces(int n);
/**
* Returns the number of UDP interfaces to stream data from detector
* (Jungfrau only)
* @returns the number of interfaces
*/
int getNumberofUDPInterfaces() const;
int getNumberofUDPInterfaces();
/**
* Selects the UDP interfaces to stream data from detector. Effective only
@ -896,14 +861,14 @@ class slsDetector : public virtual slsDetectorDefs {
* @param n selected interface. Options 1 or 2.
* @returns the interface selected
*/
int selectUDPInterface(int n);
void selectUDPInterface(int n);
/**
* Returns the UDP interfaces to stream data from detector. Effective only
* when number of interfaces is 1. (Jungfrau only)
* @returns the interface selected
*/
int getSelectedUDPInterface() const;
int getSelectedUDPInterface();
/**
* Sets the client zmq port\sa sharedSlsDetector
@ -1727,7 +1692,7 @@ class slsDetector : public virtual slsDetectorDefs {
void *retval, size_t retval_size);
template <typename Arg, typename Ret>
void sendToDetector(int fnum, const Arg &args, Ret &retval);
void sendToDetector(int fnum, const Arg &args, Ret &retval);
template <typename Arg>
void sendToDetector(int fnum, const Arg &args, std::nullptr_t);
template <typename Ret>

View File

@ -58,7 +58,6 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
static std::string helpPort(int action);
static std::string helpLastClient(int action);
static std::string helpOnline(int action);
static std::string helpConfigureMac(int action);
static std::string helpDetectorSize(int action);
static std::string helpSettings(int action);
static std::string helpSN(int action);
@ -102,7 +101,6 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
std::string cmdPort(int narg, const char * const args[], int action, int detPos = -1);
std::string cmdLastClient(int narg, const char * const args[], int action, int detPos = -1);
std::string cmdOnline(int narg, const char * const args[], int action, int detPos = -1);
std::string cmdConfigureMac(int narg, const char * const args[], int action, int detPos = -1);
std::string cmdDetectorSize(int narg, const char * const args[], int action, int detPos = -1);
std::string cmdSettings(int narg, const char * const args[], int action, int detPos = -1);
std::string cmdSN(int narg, const char * const args[], int action, int detPos = -1);

View File

@ -303,10 +303,6 @@ void Detector::sendSoftwareTrigger(Positions pos) {
// Network Configuration (Detector<->Receiver)
void Detector::configureMAC(Positions pos) {
pimpl->Parallel(&slsDetector::configureMAC, pos);
}
Result<int> Detector::getNumberofUDPInterfaces(Positions pos) const {
return pimpl->Parallel(&slsDetector::getNumberofUDPInterfaces, pos);
}
@ -335,98 +331,98 @@ void Detector::selectUDPInterface(int interface, Positions pos) {
}
Result<IpAddr> Detector::getSourceUDPIP(Positions pos) const {
return pimpl->Parallel(&slsDetector::getDetectorIP, pos);
return pimpl->Parallel(&slsDetector::getSourceUDPIP, pos);
}
void Detector::setSourceUDPIP(const std::string &ip, Positions pos) {
pimpl->Parallel(&slsDetector::setDetectorIP, pos, ip);
void Detector::setSourceUDPIP(const IpAddr ip, Positions pos) {
pimpl->Parallel(&slsDetector::setSourceUDPIP, pos, ip);
}
Result<IpAddr> Detector::getSourceUDPIP2(Positions pos) const {
return pimpl->Parallel(&slsDetector::getDetectorIP2, pos);
return pimpl->Parallel(&slsDetector::getSourceUDPIP2, pos);
}
void Detector::setSourceUDPIP2(const std::string &ip, Positions pos) {
pimpl->Parallel(&slsDetector::setDetectorIP2, pos, ip);
void Detector::setSourceUDPIP2(const IpAddr ip, Positions pos) {
pimpl->Parallel(&slsDetector::setSourceUDPIP2, pos, ip);
}
Result<MacAddr> Detector::getSourceUDPMAC(Positions pos) const {
return pimpl->Parallel(&slsDetector::getDetectorMAC, pos);
return pimpl->Parallel(&slsDetector::getSourceUDPMAC, pos);
}
void Detector::setSourceUDPMAC(const std::string &mac, Positions pos) {
pimpl->Parallel(&slsDetector::setDetectorMAC, pos, mac);
void Detector::setSourceUDPMAC(const MacAddr mac, Positions pos) {
pimpl->Parallel(&slsDetector::setSourceUDPMAC, pos, mac);
}
Result<MacAddr> Detector::getSourceUDPMAC2(Positions pos) const {
return pimpl->Parallel(&slsDetector::getDetectorMAC2, pos);
return pimpl->Parallel(&slsDetector::getSourceUDPMAC2, pos);
}
void Detector::setSourceUDPMAC2(const std::string &mac, Positions pos) {
pimpl->Parallel(&slsDetector::setDetectorMAC2, pos, mac);
void Detector::setSourceUDPMAC2(const MacAddr mac, Positions pos) {
pimpl->Parallel(&slsDetector::setSourceUDPMAC2, pos, mac);
}
Result<IpAddr> Detector::getDestinationUDPIP(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReceiverUDPIP, pos);
return pimpl->Parallel(&slsDetector::getDestinationUDPIP, pos);
}
void Detector::setDestinationUDPIP(const std::string &ip, Positions pos) {
pimpl->Parallel(&slsDetector::setReceiverUDPIP, pos, ip);
void Detector::setDestinationUDPIP(const IpAddr ip, Positions pos) {
pimpl->Parallel(&slsDetector::setDestinationUDPIP, pos, ip);
}
Result<IpAddr> Detector::getDestinationUDPIP2(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReceiverUDPIP2, pos);
return pimpl->Parallel(&slsDetector::getDestinationUDPIP2, pos);
}
void Detector::setDestinationUDPIP2(const std::string &ip, Positions pos) {
pimpl->Parallel(&slsDetector::setReceiverUDPIP2, pos, ip);
void Detector::setDestinationUDPIP2(const IpAddr ip, Positions pos) {
pimpl->Parallel(&slsDetector::setDestinationUDPIP2, pos, ip);
}
Result<MacAddr> Detector::getDestinationUDPMAC(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReceiverUDPMAC, pos);
return pimpl->Parallel(&slsDetector::getDestinationUDPMAC, pos);
}
void Detector::setDestinationUDPMAC(const std::string &mac, Positions pos) {
pimpl->Parallel(&slsDetector::setReceiverUDPMAC, pos, mac);
void Detector::setDestinationUDPMAC(const MacAddr mac, Positions pos) {
pimpl->Parallel(&slsDetector::setDestinationUDPMAC, pos, mac);
}
Result<MacAddr> Detector::getDestinationUDPMAC2(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReceiverUDPMAC2, pos);
return pimpl->Parallel(&slsDetector::getDestinationUDPMAC2, pos);
}
void Detector::setDestinationUDPMAC2(const std::string &mac, Positions pos) {
pimpl->Parallel(&slsDetector::setReceiverUDPMAC2, pos, mac);
void Detector::setDestinationUDPMAC2(const MacAddr mac, Positions pos) {
pimpl->Parallel(&slsDetector::setDestinationUDPMAC2, pos, mac);
}
Result<int> Detector::getDestinationUDPPort(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReceiverUDPPort, pos);
return pimpl->Parallel(&slsDetector::getDestinationUDPPort, pos);
}
void Detector::setDestinationUDPPort(int port, int module_id) {
if (module_id == -1) {
std::vector<int> port_list = getPortNumbers(port);
for (int idet = 0; idet < size(); ++idet) {
pimpl->Parallel(&slsDetector::setReceiverUDPPort, {idet},
pimpl->Parallel(&slsDetector::setDestinationUDPPort, {idet},
port_list[idet]);
}
} else {
pimpl->Parallel(&slsDetector::setReceiverUDPPort, {module_id}, port);
pimpl->Parallel(&slsDetector::setDestinationUDPPort, {module_id}, port);
}
}
Result<int> Detector::getDestinationUDPPort2(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReceiverUDPPort2, pos);
return pimpl->Parallel(&slsDetector::getDestinationUDPPort2, pos);
}
void Detector::setDestinationUDPPort2(int port, int module_id) {
if (module_id == -1) {
std::vector<int> port_list = getPortNumbers(port);
for (int idet = 0; idet < size(); ++idet) {
pimpl->Parallel(&slsDetector::setReceiverUDPPort2, {idet},
pimpl->Parallel(&slsDetector::setDestinationUDPPort2, {idet},
port_list[idet]);
}
} else {
pimpl->Parallel(&slsDetector::setReceiverUDPPort2, {module_id}, port);
pimpl->Parallel(&slsDetector::setDestinationUDPPort2, {module_id}, port);
}
}

View File

@ -888,7 +888,7 @@ void multiSlsDetector::readAll(int detPos) {
// multi
parallelCall(&slsDetector::readAll);
}
/*
void multiSlsDetector::configureMAC(int detPos) {
// single
if (detPos >= 0) {
@ -898,6 +898,7 @@ void multiSlsDetector::configureMAC(int detPos) {
// multi
parallelCall(&slsDetector::configureMAC);
}
*/
void multiSlsDetector::setStartingFrameNumber(const uint64_t value,
int detPos) {
@ -1275,98 +1276,6 @@ uint32_t multiSlsDetector::clearBit(uint32_t addr, int n, int detPos) {
throw RuntimeError(ss.str());
}
std::string multiSlsDetector::setDetectorMAC(const std::string &detectorMAC,
int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setDetectorMAC(detectorMAC);
}
// multi
auto r = parallelCall(&slsDetector::setDetectorMAC, detectorMAC);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::getDetectorMAC(int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->getDetectorMAC().str();
}
// multi
auto r = serialCall(&slsDetector::getDetectorMAC);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::setDetectorMAC2(const std::string &detectorMAC,
int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setDetectorMAC2(detectorMAC);
}
// multi
auto r = parallelCall(&slsDetector::setDetectorMAC2, detectorMAC);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::getDetectorMAC2(int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->getDetectorMAC2().str();
}
// multi
auto r = serialCall(&slsDetector::getDetectorMAC2);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::setDetectorIP(const std::string &detectorIP,
int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setDetectorIP(detectorIP);
}
// multi
auto r = parallelCall(&slsDetector::setDetectorIP, detectorIP);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::getDetectorIP(int detPos) const {
// single
if (detPos >= 0) {
return detectors[detPos]->getDetectorIP().str();
}
// multi
auto r = serialCall(&slsDetector::getDetectorIP);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::setDetectorIP2(const std::string &detectorIP,
int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setDetectorIP2(detectorIP);
}
// multi
auto r = parallelCall(&slsDetector::setDetectorIP2, detectorIP);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::getDetectorIP2(int detPos) const {
// single
if (detPos >= 0) {
return detectors[detPos]->getDetectorIP2().str();
}
// multi
auto r = serialCall(&slsDetector::getDetectorIP2);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::setReceiverHostname(const std::string &receiver,
int detPos) {
// single
@ -1390,155 +1299,19 @@ std::string multiSlsDetector::getReceiverHostname(int detPos) const {
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::setReceiverUDPIP(const std::string &udpip,
int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setReceiverUDPIP(udpip);
}
// multi
auto r = parallelCall(&slsDetector::setReceiverUDPIP, udpip);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::getReceiverUDPIP(int detPos) const {
// single
if (detPos >= 0) {
return detectors[detPos]->getReceiverUDPIP().str();
}
// multi
auto r = serialCall(&slsDetector::getReceiverUDPIP);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::setReceiverUDPIP2(const std::string &udpip,
int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setReceiverUDPIP2(udpip);
}
// multi
auto r = parallelCall(&slsDetector::setReceiverUDPIP2, udpip);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::getReceiverUDPIP2(int detPos) const {
// single
if (detPos >= 0) {
return detectors[detPos]->getReceiverUDPIP2().str();
}
// multi
auto r = serialCall(&slsDetector::getReceiverUDPIP2);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::setReceiverUDPMAC(const std::string &udpmac,
int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setReceiverUDPMAC(udpmac);
}
// multi
auto r = parallelCall(&slsDetector::setReceiverUDPMAC, udpmac);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::getReceiverUDPMAC(int detPos) const {
// single
if (detPos >= 0) {
return detectors[detPos]->getReceiverUDPMAC().str();
}
// multi
auto r = serialCall(&slsDetector::getReceiverUDPMAC);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::setReceiverUDPMAC2(const std::string &udpmac,
int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setReceiverUDPMAC2(udpmac);
}
// multi
auto r = parallelCall(&slsDetector::setReceiverUDPMAC2, udpmac);
return sls::concatenateIfDifferent(r);
}
std::string multiSlsDetector::getReceiverUDPMAC2(int detPos) const {
// single
if (detPos >= 0) {
return detectors[detPos]->getReceiverUDPMAC2().str();
}
// multi
auto r = serialCall(&slsDetector::getReceiverUDPMAC2);
return sls::concatenateIfDifferent(r);
}
int multiSlsDetector::setReceiverUDPPort(int udpport, int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setReceiverUDPPort(udpport);
}
// multi
auto r = parallelCall(&slsDetector::setReceiverUDPPort, udpport);
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::getReceiverUDPPort(int detPos) const {
// single
if (detPos >= 0) {
return detectors[detPos]->getReceiverUDPPort();
}
// multi
auto r = serialCall(&slsDetector::getReceiverUDPPort);
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::setReceiverUDPPort2(int udpport, int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setReceiverUDPPort2(udpport);
}
// multi
auto r = parallelCall(&slsDetector::setReceiverUDPPort2, udpport);
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::getReceiverUDPPort2(int detPos) const {
// single
if (detPos >= 0) {
return detectors[detPos]->getReceiverUDPPort2();
}
// multi
auto r = serialCall(&slsDetector::getReceiverUDPPort2);
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::setNumberofUDPInterfaces(int n, int detPos) {
void multiSlsDetector::setNumberofUDPInterfaces(int n, int detPos) {
bool previouslyClientStreaming = enableDataStreamingToClient();
int previouslyReceiverStreaming = enableDataStreamingFromReceiver();
// single
int ret = OK;
if (detPos >= 0) {
ret = detectors[detPos]->setNumberofUDPInterfaces(n);
detectors[detPos]->setNumberofUDPInterfaces(n);
}
// multi
auto r = parallelCall(&slsDetector::setNumberofUDPInterfaces, n);
parallelCall(&slsDetector::setNumberofUDPInterfaces, n);
// redo the zmq sockets
if (previouslyClientStreaming) {
@ -1549,45 +1322,37 @@ int multiSlsDetector::setNumberofUDPInterfaces(int n, int detPos) {
enableDataStreamingFromReceiver(0);
enableDataStreamingFromReceiver(1);
}
// return single
if (detPos >= 0)
return ret;
// return multi
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::getNumberofUDPInterfaces(int detPos) const {
int multiSlsDetector::getNumberofUDPInterfaces(int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->getNumberofUDPInterfaces();
}
// multi
auto r = serialCall(&slsDetector::getNumberofUDPInterfaces);
auto r = parallelCall(&slsDetector::getNumberofUDPInterfaces);
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::selectUDPInterface(int n, int detPos) {
void multiSlsDetector::selectUDPInterface(int n, int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->selectUDPInterface(n);
detectors[detPos]->selectUDPInterface(n);
}
// multi
auto r = parallelCall(&slsDetector::selectUDPInterface, n);
return sls::minusOneIfDifferent(r);
parallelCall(&slsDetector::selectUDPInterface, n);
}
int multiSlsDetector::getSelectedUDPInterface(int detPos) const {
int multiSlsDetector::getSelectedUDPInterface(int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->getSelectedUDPInterface();
}
// multi
auto r = serialCall(&slsDetector::getSelectedUDPInterface);
auto r = parallelCall(&slsDetector::getSelectedUDPInterface);
return sls::minusOneIfDifferent(r);
}
@ -2410,7 +2175,12 @@ std::string multiSlsDetector::printReceiverConfiguration(int detPos) {
// multi
auto r = parallelCall(&slsDetector::printReceiverConfiguration);
return sls::concatenateIfDifferent(r);
// concatenate without '+'
std::string ret;
for (const auto &s : r)
if (!s.empty())
ret += s;
return ret;
}
bool multiSlsDetector::getUseReceiverFlag(int detPos) {

View File

@ -338,21 +338,6 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
shm()->deadTime = 0;
sls::strcpy_safe(shm()->rxHostname, "none");
shm()->rxTCPPort = DEFAULT_PORTNO + 2;
shm()->rxUDPPort = DEFAULT_UDP_PORTNO;
shm()->rxUDPPort2 = DEFAULT_UDP_PORTNO + 1;
shm()->rxUDPIP = 0u;
shm()->rxUDPIP2 = 0u;
shm()->rxUDPMAC = 0ul;
shm()->rxUDPMAC2 = 0ul;
shm()->detectorMAC = DEFAULT_DET_MAC;
shm()->detectorMAC2 = DEFAULT_DET_MAC2;
shm()->detectorIP = DEFAULT_DET_MAC;
shm()->detectorIP2 = DEFAULT_DET_MAC2;
shm()->numUDPInterfaces = 1;
shm()->selectedUDPInterface = 0;
shm()->useReceiverFlag = false;
shm()->tenGigaEnable = 0;
shm()->flippedDataX = 0;
@ -645,8 +630,11 @@ int slsDetector::getReadNLines() {
void slsDetector::updateMultiSize(slsDetectorDefs::xy det) {
shm()->multiSize = det;
int args[2] = {shm()->multiSize.y, detId};
sendToDetector(F_SET_POSITION, args, nullptr);
}
int slsDetector::setControlPort(int port_number) {
int retval = -1;
FILE_LOG(logDEBUG1) << "Setting control port to " << port_number;
@ -1214,6 +1202,7 @@ void slsDetector::readAll() {
FILE_LOG(logDEBUG1) << "Detector successfully finished reading all frames";
}
/*
void slsDetector::configureMAC() {
int fnum = F_CONFIGURE_MAC;
const size_t array_size = 50;
@ -1321,6 +1310,7 @@ void slsDetector::configureMAC() {
updateCachedDetectorVariables();
}
}
*/
void slsDetector::setStartingFrameNumber(uint64_t value) {
FILE_LOG(logDEBUG1) << "Setting starting frame number to " << value;
@ -1615,75 +1605,6 @@ uint32_t slsDetector::clearBit(uint32_t addr, int n) {
}
}
std::string slsDetector::setDetectorMAC(const std::string &detectorMAC) {
auto addr = MacAddr(detectorMAC);
if (addr == 0) {
throw RuntimeError(
"server MAC Address should be in xx:xx:xx:xx:xx:xx format");
}
shm()->detectorMAC = addr;
if (strcmp(shm()->rxHostname, "none") == 0) {
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
} else {
setUDPConnection();
}
return getDetectorMAC().str();
}
MacAddr slsDetector::getDetectorMAC() { return shm()->detectorMAC; }
std::string slsDetector::setDetectorMAC2(const std::string &detectorMAC) {
auto addr = MacAddr(detectorMAC);
if (addr == 0) {
throw RuntimeError(
"server MAC Address 2 should be in xx:xx:xx:xx:xx:xx format");
}
shm()->detectorMAC2 = addr;
if (strcmp(shm()->rxHostname, "none") == 0) {
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
} else {
setUDPConnection();
}
return getDetectorMAC2().str();
}
MacAddr slsDetector::getDetectorMAC2() { return shm()->detectorMAC2; }
std::string slsDetector::setDetectorIP(const std::string &ip) {
auto addr = IpAddr(ip);
if (addr == 0) {
throw RuntimeError("setDetectorIP: IP Address should be VALID and "
"in xxx.xxx.xxx.xxx format");
}
shm()->detectorIP = ip;
if (strcmp(shm()->rxHostname, "none") == 0) {
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
} else {
setUDPConnection();
}
return getDetectorIP().str();
}
IpAddr slsDetector::getDetectorIP() const { return shm()->detectorIP; }
std::string slsDetector::setDetectorIP2(const std::string &ip) {
auto addr = IpAddr(ip);
if (addr == 0) {
throw RuntimeError("setDetectorIP: IP2 Address should be VALID and "
"in xxx.xxx.xxx.xxx format");
}
shm()->detectorIP2 = ip;
if (strcmp(shm()->rxHostname, "none") == 0) {
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
} else {
setUDPConnection();
}
return getDetectorIP().str();
}
IpAddr slsDetector::getDetectorIP2() const { return shm()->detectorIP2; }
std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
FILE_LOG(logDEBUG1) << "Setting up Receiver with " << receiverIP;
// recieverIP is none
@ -1750,7 +1671,19 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
sendMultiDetectorSize();
setDetectorId();
setDetectorHostname();
setUDPConnection();
// setup udp
updateRxDestinationUDPIP();
setDestinationUDPPort(getDestinationUDPPort());
if (shm()->myDetectorType == JUNGFRAU || shm()->myDetectorType == EIGER ) {
setDestinationUDPPort2(getDestinationUDPPort2());
}
if (shm()->myDetectorType == JUNGFRAU) {
updateRxDestinationUDPIP2();
setNumberofUDPInterfaces(getNumberofUDPInterfaces());
}
FILE_LOG(logDEBUG1) << printReceiverConfiguration();
setReceiverUDPSocketBufferSize(0);
setFilePath(shm()->rxFilePath);
setFileName(shm()->rxFileName);
@ -1825,119 +1758,237 @@ std::string slsDetector::getReceiverHostname() const {
return std::string(shm()->rxHostname);
}
std::string slsDetector::setReceiverUDPIP(const std::string &udpip) {
auto ip = IpAddr(udpip);
if (ip == 0) {
throw ReceiverError("setReceiverUDPIP: UDP IP Address should be "
"VALID and in xxx.xxx.xxx.xxx format");
}
shm()->rxUDPIP = ip;
if (strcmp(shm()->rxHostname, "none") == 0) {
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
} else {
setUDPConnection();
}
return getReceiverUDPIP().str();
}
sls::IpAddr slsDetector::getReceiverUDPIP() const { return shm()->rxUDPIP; }
std::string slsDetector::setReceiverUDPIP2(const std::string &udpip) {
auto ip = IpAddr(udpip);
if (ip == 0) {
throw ReceiverError("setReceiverUDPIP: UDP IP Address 2 should be "
"VALID and in xxx.xxx.xxx.xxx format");
}
shm()->rxUDPIP2 = ip;
if (strcmp(shm()->rxHostname, "none") == 0) {
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
} else {
setUDPConnection();
}
return getReceiverUDPIP2().str();
}
sls::IpAddr slsDetector::getReceiverUDPIP2() const { return shm()->rxUDPIP2; }
std::string slsDetector::setReceiverUDPMAC(const std::string &udpmac) {
auto mac = MacAddr(udpmac);
void slsDetector::setSourceUDPMAC(const sls::MacAddr mac) {
FILE_LOG(logDEBUG1) << "Setting source udp mac to " << mac;
if (mac == 0) {
throw ReceiverError("Could not decode UDPMAC from: " + udpmac);
throw RuntimeError("Invalid source udp mac address");
}
shm()->rxUDPMAC = mac;
return getReceiverUDPMAC().str();
sendToDetector(F_SET_SOURCE_UDP_MAC, mac, nullptr);
}
MacAddr slsDetector::getReceiverUDPMAC() const { return shm()->rxUDPMAC; }
sls::MacAddr slsDetector::getSourceUDPMAC() {
sls::MacAddr retval(0lu);
FILE_LOG(logDEBUG1) << "Getting source udp mac";
sendToDetector(F_GET_SOURCE_UDP_MAC, nullptr, retval);
FILE_LOG(logDEBUG1) << "Source udp mac: " << retval;
return retval;
}
std::string slsDetector::setReceiverUDPMAC2(const std::string &udpmac) {
auto mac = MacAddr(udpmac);
void slsDetector::setSourceUDPMAC2(const sls::MacAddr mac) {
FILE_LOG(logDEBUG1) << "Setting source udp mac2 to " << mac;
if (mac == 0) {
throw ReceiverError("Could not decode UDPMA2C from: " + udpmac);
throw RuntimeError("Invalid source udp mac address2");
}
shm()->rxUDPMAC2 = mac;
return getReceiverUDPMAC2().str();
sendToDetector(F_SET_SOURCE_UDP_MAC2, mac, nullptr);
}
MacAddr slsDetector::getReceiverUDPMAC2() const { return shm()->rxUDPMAC2; }
int slsDetector::setReceiverUDPPort(int udpport) {
shm()->rxUDPPort = udpport;
if (strcmp(shm()->rxHostname, "none") == 0) {
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
} else {
setUDPConnection();
}
return shm()->rxUDPPort;
sls::MacAddr slsDetector::getSourceUDPMAC2() {
sls::MacAddr retval(0lu);
FILE_LOG(logDEBUG1) << "Getting source udp mac2";
sendToDetector(F_GET_SOURCE_UDP_MAC2, nullptr, retval);
FILE_LOG(logDEBUG1) << "Source udp mac2: " << retval;
return retval;
}
int slsDetector::getReceiverUDPPort() const { return shm()->rxUDPPort; }
int slsDetector::setReceiverUDPPort2(int udpport) {
shm()->rxUDPPort2 = udpport;
if (strcmp(shm()->rxHostname, "none") == 0) {
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
} else {
setUDPConnection();
void slsDetector::setSourceUDPIP(const IpAddr ip) {
FILE_LOG(logDEBUG1) << "Setting source udp ip to " << ip;
if (ip == 0) {
throw RuntimeError("Invalid source udp ip address");
}
return shm()->rxUDPPort2;
sendToDetector(F_SET_SOURCE_UDP_IP, ip, nullptr);
}
int slsDetector::getReceiverUDPPort2() const { return shm()->rxUDPPort2; }
int slsDetector::setNumberofUDPInterfaces(int n) {
if (shm()->myDetectorType != JUNGFRAU) {
throw RuntimeError(
"Cannot choose number of interfaces for this detector");
}
shm()->numUDPInterfaces = (n > 1 ? 2 : 1);
if (strcmp(shm()->rxHostname, "none") == 0) {
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
} else {
setUDPConnection();
}
return shm()->numUDPInterfaces;
sls::IpAddr slsDetector::getSourceUDPIP() {
sls::IpAddr retval(0u);
FILE_LOG(logDEBUG1) << "Getting source udp ip";
sendToDetector(F_GET_SOURCE_UDP_IP, nullptr, retval);
FILE_LOG(logDEBUG1) << "Source udp ip: " << retval;
return retval;
}
int slsDetector::getNumberofUDPInterfaces() const {
return shm()->numUDPInterfaces;
void slsDetector::setSourceUDPIP2(const IpAddr ip) {
FILE_LOG(logDEBUG1) << "Setting source udp ip2 to " << ip;
if (ip == 0) {
throw RuntimeError("Invalid source udp ip address2");
}
sendToDetector(F_SET_SOURCE_UDP_IP2, ip, nullptr);
}
int slsDetector::selectUDPInterface(int n) {
if (shm()->myDetectorType != JUNGFRAU) {
throw RuntimeError("Cannot select an interface for this detector");
}
shm()->selectedUDPInterface = (n == 0 ? 0 : 1);
if (strcmp(shm()->rxHostname, "none") == 0) {
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
} else {
setUDPConnection();
}
return shm()->selectedUDPInterface;
sls::IpAddr slsDetector::getSourceUDPIP2() {
sls::IpAddr retval(0u);
FILE_LOG(logDEBUG1) << "Getting source udp ip2";
sendToDetector(F_GET_SOURCE_UDP_IP2, nullptr, retval);
FILE_LOG(logDEBUG1) << "Source udp ip2: " << retval;
return retval;
}
int slsDetector::getSelectedUDPInterface() const {
return shm()->selectedUDPInterface;
void slsDetector::setDestinationUDPIP(const IpAddr ip) {
FILE_LOG(logDEBUG1) << "Setting destination udp ip to " << ip;
if (ip == 0) {
throw RuntimeError("Invalid destination udp ip address");
}
sendToDetector(F_SET_DEST_UDP_IP, ip, nullptr);
if (shm()->useReceiverFlag) {
sls::MacAddr retval(0lu);
sendToReceiver(F_SET_RECEIVER_UDP_IP, ip, retval);
FILE_LOG(logINFO) << "Setting destination udp mac to " << retval;
sendToDetector(F_SET_DEST_UDP_MAC, retval, nullptr);
}
}
sls::IpAddr slsDetector::getDestinationUDPIP() {
sls::IpAddr retval(0u);
FILE_LOG(logDEBUG1) << "Getting destination udp ip";
sendToDetector(F_GET_DEST_UDP_IP, nullptr, retval);
FILE_LOG(logDEBUG1) << "Destination udp ip: " << retval;
return retval;
}
void slsDetector::updateRxDestinationUDPIP() {
auto ip = getDestinationUDPIP();
if (ip == 0) {
// Hostname could be ip try to decode otherwise look up the hostname
ip = shm()->rxHostname;
if (ip == 0) {
ip = HostnameToIp(shm()->rxHostname);
}
FILE_LOG(logINFO) << "Setting destination default udp ip to " << ip;
}
setDestinationUDPIP(ip);
}
void slsDetector::setDestinationUDPIP2(const IpAddr ip) {
FILE_LOG(logDEBUG1) << "Setting destination udp ip2 to " << ip;
if (ip == 0) {
throw RuntimeError("Invalid destination udp ip address2");
}
sendToDetector(F_SET_DEST_UDP_IP2, ip, nullptr);
if (shm()->useReceiverFlag) {
sls::MacAddr retval(0lu);
sendToReceiver(F_SET_RECEIVER_UDP_IP2, ip, retval);
FILE_LOG(logINFO) << "Setting destination udp mac2 to " << retval;
sendToDetector(F_SET_DEST_UDP_MAC2, retval, nullptr);
}
}
sls::IpAddr slsDetector::getDestinationUDPIP2() {
sls::IpAddr retval(0u);
FILE_LOG(logDEBUG1) << "Getting destination udp ip2";
sendToDetector(F_GET_DEST_UDP_IP2, nullptr, retval);
FILE_LOG(logDEBUG1) << "Destination udp ip2: " << retval;
return retval;
}
void slsDetector::updateRxDestinationUDPIP2() {
auto ip = getDestinationUDPIP2();
if (ip == 0) {
// Hostname could be ip try to decode otherwise look up the hostname
ip = shm()->rxHostname;
if (ip == 0) {
ip = HostnameToIp(shm()->rxHostname);
}
FILE_LOG(logINFO) << "Setting destination default udp ip2 to " << ip;
}
setDestinationUDPIP2(ip);
}
void slsDetector::setDestinationUDPMAC(const MacAddr mac) {
FILE_LOG(logDEBUG1) << "Setting destination udp mac to " << mac;
if (mac == 0) {
throw RuntimeError("Invalid destination udp mac address");
}
sendToDetector(F_SET_DEST_UDP_MAC, mac, nullptr);
}
sls::MacAddr slsDetector::getDestinationUDPMAC() {
sls::MacAddr retval(0lu);
FILE_LOG(logDEBUG1) << "Getting destination udp mac";
sendToDetector(F_GET_DEST_UDP_MAC, nullptr, retval);
FILE_LOG(logDEBUG1) << "Destination udp mac: " << retval;
return retval;
}
void slsDetector::setDestinationUDPMAC2(const MacAddr mac) {
FILE_LOG(logDEBUG1) << "Setting destination udp mac2 to " << mac;
if (mac == 0) {
throw RuntimeError("Invalid desinaion udp mac address2");
}
sendToDetector(F_SET_DEST_UDP_MAC2, mac, nullptr);
}
sls::MacAddr slsDetector::getDestinationUDPMAC2() {
sls::MacAddr retval(0lu);
FILE_LOG(logDEBUG1) << "Getting destination udp mac2";
sendToDetector(F_GET_DEST_UDP_MAC2, nullptr, retval);
FILE_LOG(logDEBUG1) << "Destination udp mac2: " << retval;
return retval;
}
void slsDetector::setDestinationUDPPort(const int port) {
FILE_LOG(logDEBUG1) << "Setting destination udp port to " << port;
sendToDetector(F_SET_DEST_UDP_PORT, port, nullptr);
if (shm()->useReceiverFlag) {
sendToReceiver(F_SET_RECEIVER_UDP_PORT, port, nullptr);
}
}
int slsDetector::getDestinationUDPPort() {
int retval = -1;
FILE_LOG(logDEBUG1) << "Getting destination udp port";
sendToDetector(F_GET_DEST_UDP_PORT, nullptr, retval);
FILE_LOG(logDEBUG1) << "Destination udp port: " << retval;
return retval;
}
void slsDetector::setDestinationUDPPort2(const int port) {
FILE_LOG(logDEBUG1) << "Setting destination udp port2 to " << port;
sendToDetector(F_SET_DEST_UDP_PORT2, port, nullptr);
if (shm()->useReceiverFlag) {
sendToReceiver(F_SET_RECEIVER_UDP_PORT2, port, nullptr);
}
}
int slsDetector::getDestinationUDPPort2() {
int retval = -1;
FILE_LOG(logDEBUG1) << "Getting destination udp port2";
sendToDetector(F_GET_DEST_UDP_PORT2, nullptr, retval);
FILE_LOG(logDEBUG1) << "Destination udp port2: " << retval;
return retval;
}
void slsDetector::setNumberofUDPInterfaces(int n) {
FILE_LOG(logDEBUG1) << "Setting number of udp interfaces to " << n;
sendToDetector(F_SET_NUM_INTERFACES, n, nullptr);
if (shm()->useReceiverFlag) {
sendToReceiver(F_SET_RECEIVER_NUM_INTERFACES, n, nullptr);
}
}
int slsDetector::getNumberofUDPInterfaces() {
int retval = -1;
FILE_LOG(logDEBUG1) << "Getting number of udp interfaces";
sendToDetector(F_GET_NUM_INTERFACES, nullptr, retval);
FILE_LOG(logDEBUG1) << "Number of udp interfaces: " << retval;
return retval;
}
void slsDetector::selectUDPInterface(int n) {
FILE_LOG(logDEBUG1) << "Setting selected udp interface to " << n;
sendToDetector(F_SET_INTERFACE_SEL, n, nullptr);
}
int slsDetector::getSelectedUDPInterface() {
int retval = -1;
FILE_LOG(logDEBUG1) << "Getting selected udp interface";
sendToDetector(F_GET_INTERFACE_SEL, nullptr, retval);
FILE_LOG(logDEBUG1) << "Selected udp interface: " << retval;
return retval;
}
void slsDetector::setClientStreamingPort(int port) { shm()->zmqport = port; }
@ -2159,62 +2210,6 @@ int64_t slsDetector::getReceiverRealUDPSocketBufferSize() const {
return retval;
}
void slsDetector::setUDPConnection() {
char args[5][MAX_STR_LENGTH]{};
char retvals[2][MAX_STR_LENGTH]{};
FILE_LOG(logDEBUG1) << "Setting UDP Connection";
// called before set up
if (strcmp(shm()->rxHostname, "none") == 0) {
throw RuntimeError(
"Cannot set udp connection. Receiver hostname not set yet.");
}
if (shm()->rxUDPIP == 0) {
// Hostname could be ip try to decode otherwise look up the hostname
shm()->rxUDPIP = shm()->rxHostname;
if (shm()->rxUDPIP == 0) {
shm()->rxUDPIP = HostnameToIp(shm()->rxHostname);
}
}
// jungfrau 2 interfaces, copy udpip if udpip2 empty
if (shm()->numUDPInterfaces == 2) {
if (shm()->rxUDPIP2 == 0) {
shm()->rxUDPIP2 = shm()->rxUDPIP;
}
}
// copy arguments to args[][]
snprintf(args[0], sizeof(args[0]), "%d", shm()->numUDPInterfaces);
sls::strcpy_safe(args[1], getReceiverUDPIP().str());
sls::strcpy_safe(args[2], getReceiverUDPIP2().str());
snprintf(args[3], sizeof(args[3]), "%d", shm()->rxUDPPort);
snprintf(args[4], sizeof(args[4]), "%d", shm()->rxUDPPort2);
FILE_LOG(logDEBUG1) << "Receiver Number of UDP Interfaces: "
<< shm()->numUDPInterfaces;
FILE_LOG(logDEBUG1) << "Receiver udp ip address: " << shm()->rxUDPIP;
FILE_LOG(logDEBUG1) << "Receiver udp ip address2: " << shm()->rxUDPIP2;
FILE_LOG(logDEBUG1) << "Receiver udp port: " << shm()->rxUDPPort;
FILE_LOG(logDEBUG1) << "Receiver udp port2: " << shm()->rxUDPPort2;
if (shm()->useReceiverFlag) {
sendToReceiver(F_SETUP_RECEIVER_UDP, args, retvals);
if (strlen(retvals[0]) != 0u) {
FILE_LOG(logDEBUG1) << "Receiver UDP MAC returned : " << retvals[0];
shm()->rxUDPMAC = retvals[0];
}
if (strlen(retvals[1]) != 0u) {
FILE_LOG(logDEBUG1)
<< "Receiver UDP MAC2 returned : " << retvals[1];
shm()->rxUDPMAC2 = retvals[1];
}
configureMAC();
} else {
throw ReceiverError("setUDPConnection: Receiver is OFFLINE");
}
FILE_LOG(logDEBUG1) << printReceiverConfiguration();
}
int slsDetector::digitalTest(digitalTestMode mode, int ival) {
int args[]{static_cast<int>(mode), ival};
int retval = -1;
@ -2268,11 +2263,6 @@ void slsDetector::setROI(slsDetectorDefs::ROI arg) {
}
}
// old firmware requires configuremac after setting roi
if (shm()->myDetectorType == GOTTHARD) {
configureMAC();
}
sendROItoReceiver();
}
@ -2805,17 +2795,30 @@ void slsDetector::updateRateCorrection() {
std::string slsDetector::printReceiverConfiguration() {
std::ostringstream os;
os << "#Detector " << detId << ":\n Receiver Hostname:\t"
<< getReceiverHostname() << "\nDetector UDP IP (Source):\t\t"
<< getDetectorIP() << "\nDetector UDP IP2 (Source):\t\t"
<< getDetectorIP2() << "\nDetector UDP MAC:\t\t" << getDetectorMAC()
<< "\nDetector UDP MAC2:\t\t" << getDetectorMAC2()
<< "\nReceiver UDP IP:\t" << getReceiverUDPIP()
<< "\nReceiver UDP IP2:\t" << getReceiverUDPIP2()
<< "\nReceiver UDP MAC:\t" << getReceiverUDPMAC()
<< "\nReceiver UDP MAC2:\t" << getReceiverUDPMAC2()
<< "\nReceiver UDP Port:\t" << getReceiverUDPPort()
<< "\nReceiver UDP Port2:\t" << getReceiverUDPPort2();
os << "\n\nDetector " << detId << "\nReceiver Hostname:\t"
<< getReceiverHostname();
if (shm()->myDetectorType == JUNGFRAU) {
os << "\nNumber of Interfaces:\t" << getNumberofUDPInterfaces()
<< "\nSelected Interface:\t" << getSelectedUDPInterface();
}
os << "\nDetector UDP IP:\t"
<< getSourceUDPIP() << "\nDetector UDP MAC:\t"
<< getSourceUDPMAC() << "\nReceiver UDP IP:\t"
<< getDestinationUDPIP() << "\nReceiver UDP MAC:\t" << getDestinationUDPMAC();
if (shm()->myDetectorType == JUNGFRAU) {
os << "\nDetector UDP IP2:\t" << getSourceUDPIP2()
<< "\nDetector UDP MAC2:\t" << getSourceUDPMAC2()
<< "\nReceiver UDP IP2:\t" << getDestinationUDPIP2()
<< "\nReceiver UDP MAC2:\t" << getDestinationUDPMAC2();
}
os << "\nReceiver UDP Port:\t" << getDestinationUDPPort();
if (shm()->myDetectorType == JUNGFRAU || shm()->myDetectorType == EIGER) {
os << "\nReceiver UDP Port2:\t" << getDestinationUDPPort2();
}
os << "\n";
return os.str();
}
@ -3259,9 +3262,6 @@ int slsDetector::enableTenGigabitEthernet(int value) {
sendToDetector(F_ENABLE_TEN_GIGA, value, retval);
FILE_LOG(logDEBUG1) << "10Gbe: " << retval;
shm()->tenGigaEnable = retval;
if (value >= 0) {
configureMAC();
}
if (shm()->useReceiverFlag) {
retval = -1;
value = shm()->tenGigaEnable;

View File

@ -1492,48 +1492,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>rx_udpip [ip]</b> sets/gets the ip address of the receiver UDP interface where the data from the detector will be streamed to. Normally used for single detectors (Can be multi-detector). Used if different from eth0. \c Returns \c (string)
*/
descrToFuncMap[i].m_pFuncName = "rx_udpip";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>rx_udpip2 [ip]</b> sets/gets the ip address of the second receiver UDP interface where the data from the top half module of the detector will be streamed to. Normally used for single detectors (Can be multi-detector). Used if different from eth0. JUNGFRAU only. \c Returns \c (string)
*/
descrToFuncMap[i].m_pFuncName = "rx_udpip2";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>rx_udpmac [mac]</b> sets/gets the mac address of the receiver UDP interface where the data from the detector will be streamed to. Normally used for single detectors (Can be multi-detector). \c Returns \c (string)
*/
descrToFuncMap[i].m_pFuncName = "rx_udpmac";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>rx_udpmac2 [mac]</b> sets/gets the mac address of the second receiver UDP interface where the data from the top half module of the detector will be streamed to. Normally used for single detectors (Can be multi-detector). JUNGFRAU only.\c Returns \c (string)
*/
descrToFuncMap[i].m_pFuncName = "rx_udpmac2";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>rx_udpport [port]</b> sets/gets the port of the receiver UDP interface where the data from the detector will be streamed to. Use single-detector command. \c Returns \c (int)
*/
descrToFuncMap[i].m_pFuncName = "rx_udpport";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>rx_udpport2 [port]</b> sets/gets the second port of the receiver UDP interface where the data from the second half of the detector will be streamed to. Use single-detector command. For Eiger, it is the right half and for Jungfrau, it is the top half module. \c Returns \c (int)
*/
descrToFuncMap[i].m_pFuncName = "rx_udpport2";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>rx_udpsocksize [size]</b> sets/gets the UDP socket buffer size. Already trying to set by default to 100mb, 2gb for Jungfrau. Does not remember in client shared memory, so must be initialized each time after setting receiver hostname in config file.\c Returns \c (int)
*/
@ -1548,48 +1506,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>detectormac [mac]</b> sets/gets the mac address of the detector UDP interface from where the detector will stream data. Use single-detector command. Normally unused. \c Returns \c (string)
*/
descrToFuncMap[i].m_pFuncName = "detectormac";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>detectormac2 [mac]</b> sets/gets the mac address of the second half of the detector UDP interface from where the top half module of the detector will stream data. Use single-detector command. Normally unused. JUNGFRAU only. \c Returns \c (string)
*/
descrToFuncMap[i].m_pFuncName = "detectormac2";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>detectorip [ip]</b> sets/gets the ip address of the detector UDP interface from where the detector will stream data. Use single-detector command. Keep in same subnet as rx_udpip (if rx_udpip specified). \c Returns \c (string)
*/
descrToFuncMap[i].m_pFuncName = "detectorip";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>detectorip2 [ip]</b> sets/gets the ip address of the top half of the detector UDP interface from where the top half of the detector will stream data. Use single-detector command. Keep in same subnet as rx_udpip2 (if rx_udpip2 specified). JUNGFRAU only. \c Returns \c (string)
*/
descrToFuncMap[i].m_pFuncName = "detectorip2";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>numinterfaces [n]</b> sets/gets the number of interfaces used to stream out from the detector. Options: 1(default), 2. JUNGFRAU only. \c Returns \c (int)
*/
descrToFuncMap[i].m_pFuncName = "numinterfaces";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>selinterface [n]</b> sets/gets interface to use to stream data out of the detector. Options: 0 (outer, default), 1(inner). Effective only when \c numinterfaces is 1. JUNGFRAU only. \c Returns \c (int)
*/
descrToFuncMap[i].m_pFuncName = "selinterface";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
++i;
/*! \page network
- <b>txndelay_left [delay]</b> sets/gets the transmission delay of first packet in an image being streamed out from the detector's left UDP port. Use single-detector command. Used for EIGER only. \c Returns \c (int)
*/
@ -1653,13 +1569,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
i++;
/*! \page network
- <b>configuremac [i]</b> configures the MAC of the detector with these parameters: detectorip, detectormac, rx_udpip, rx_udpmac, rx_udpport, rx_udpport2 (if applicable). This command is already included in \c rx_hsotname. Only put!. \c Returns \c (int)
*/
descrToFuncMap[i].m_pFuncName = "configuremac";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdConfigureMac;
++i;
/*! \page network
- <b>rx_tcpport [port]</b> sets/gets the port of the client-receiver TCP interface. Use single-detector command. Is different for each detector if same \c rx_hostname used. Must be first command to communicate with receiver. \c Returns \c (int)
*/
@ -2574,88 +2483,12 @@ std::string slsDetectorCommand::cmdNetworkParameter(int narg, const char * const
if (action == HELP_ACTION)
return helpNetworkParameter(action);
if (cmd == "detectormac") {
if (action == PUT_ACTION) {
myDet->setDetectorMAC(args[1], detPos);
}
return myDet->getDetectorMAC(detPos);
} else if (cmd == "detectormac2") {
if (action == PUT_ACTION) {
myDet->setDetectorMAC2(args[1], detPos);
}
return myDet->getDetectorMAC2(detPos);
} else if (cmd == "detectorip") {
if (action == PUT_ACTION) {
myDet->setDetectorIP(args[1], detPos);
}
return myDet->getDetectorIP(detPos);
} else if (cmd == "detectorip2") {
if (action == PUT_ACTION) {
myDet->setDetectorIP2(args[1], detPos);
}
return myDet->getDetectorIP2(detPos);
} else if (cmd == "rx_hostname") {
if (cmd == "rx_hostname") {
if (action == PUT_ACTION) {
myDet->setReceiverHostname(args[1], detPos);
}
return myDet->getReceiverHostname(detPos);
} else if (cmd == "rx_udpip") {
if (action == PUT_ACTION) {
myDet->setReceiverUDPIP(args[1], detPos);
}
return myDet->getReceiverUDPIP(detPos);
} else if (cmd == "rx_udpip2") {
if (action == PUT_ACTION) {
myDet->setReceiverUDPIP2(args[1], detPos);
}
return myDet->getReceiverUDPIP2(detPos);
} else if (cmd == "rx_udpmac") {
if (action == PUT_ACTION) {
myDet->setReceiverUDPMAC(args[1], detPos);
}
return myDet->getReceiverUDPMAC(detPos);
} else if (cmd == "rx_udpmac2") {
if (action == PUT_ACTION) {
myDet->setReceiverUDPMAC2(args[1], detPos);
}
return myDet->getReceiverUDPMAC2(detPos);
} else if (cmd == "rx_udpport") {
if (action == PUT_ACTION) {
if (!(sscanf(args[1], "%d", &i))) {
return ("cannot parse argument") + std::string(args[1]);
}
myDet->setReceiverUDPPort(i, detPos);
}
sprintf(ans, "%d", myDet->getReceiverUDPPort(detPos));
return ans;
} else if (cmd == "rx_udpport2") {
if (action == PUT_ACTION) {
if (!(sscanf(args[1], "%d", &i))) {
return ("cannot parse argument") + std::string(args[1]);
}
myDet->setReceiverUDPPort2(i, detPos);
}
sprintf(ans, "%d", myDet->getReceiverUDPPort2(detPos));
return ans;
} else if (cmd == "numinterfaces") {
if (action == PUT_ACTION) {
if (!(sscanf(args[1], "%d", &i))) {
return ("cannot parse argument") + std::string(args[1]);
}
myDet->setNumberofUDPInterfaces(i, detPos);
}
sprintf(ans, "%d", myDet->getNumberofUDPInterfaces(detPos));
return ans;
} else if (cmd == "selinterface") {
if (action == PUT_ACTION) {
if (!(sscanf(args[1], "%d", &i))) {
return ("cannot parse argument") + std::string(args[1]);
}
myDet->selectUDPInterface(i, detPos);
}
sprintf(ans, "%d", myDet->getSelectedUDPInterface(detPos));
return ans;
} else if (cmd == "rx_udpsocksize") {
} else if (cmd == "rx_udpsocksize") {
if (action == PUT_ACTION) {
int64_t ival = -1;
if (!(sscanf(args[1], "%ld", &ival))) {
@ -2748,19 +2581,8 @@ std::string slsDetectorCommand::helpNetworkParameter(int action) {
std::ostringstream os;
if (action == PUT_ACTION || action == HELP_ACTION) {
os << "detectormac mac \n sets detector mac to mac" << std::endl;
os << "detectormac2 mac \n sets detector mac of 2nd udp interface to mac. Jungfrau only" << std::endl;
os << "detectorip ip \n sets detector ip to ip" << std::endl;
os << "detectorip2 ip \n sets detector ip of 2nd udp interface to ip. Jungfrau only" << std::endl;
os << "rx_hostname name \n sets receiver ip/hostname to name" << std::endl;
os << "rx_udpip ip \n sets receiver udp ip to ip" << std::endl;
os << "rx_udpip2 ip \n sets receiver udp ip of 2nd udp interface to ip. Jungfrau only" << std::endl;
os << "rx_udpmac mac \n sets receiver udp mac to mac" << std::endl;
os << "rx_udpmac2 mac \n sets receiver udp mac of 2nd udp interface to mac. Jungfrau only." << std::endl;
os << "rx_udpport port \n sets receiver udp port to port" << std::endl;
os << "rx_udpport2 port \n sets receiver udp port to port. For Eiger, it is the right half and for Jungfrau, it is the top half module and for other detectors, same as rx_udpport" << std::endl;
os << "numinterfaces n \n sets the number of interfaces to n used to stream out from the detector. Options: 1 (default), 2. JUNGFRAU only. " << std::endl;
os << "selinterface n \n sets interface to use to stream data out of the detector. Options: 0 (outer, default), 1(inner). Effective only when numinterfaces is 1. JUNGFRAU only. " << std::endl;
os << "txndelay_left port \n sets detector transmission delay of the left port" << std::endl;
os << "txndelay_right port \n sets detector transmission delay of the right port" << std::endl;
os << "txndelay_frame port \n sets detector transmission delay of the entire frame" << std::endl;
@ -2788,19 +2610,7 @@ std::string slsDetectorCommand::helpNetworkParameter(int action) {
<< std::endl;
}
if (action == GET_ACTION || action == HELP_ACTION) {
os << "detectormac \n gets detector mac " << std::endl;
os << "detectormac2 \n gets detector mac of 2nd udp interface. Jungfrau only" << std::endl;
os << "detectorip \n gets detector ip " << std::endl;
os << "detectorip2 \n gets detector ip of 2nd udp interface. Jungfrau only" << std::endl;
os << "rx_hostname \n gets receiver ip " << std::endl;
os << "rx_udpmac \n gets receiver udp mac " << std::endl;
os << "rx_udpmac2 \n gets receiver udp mac of 2nd udp interface. Jungfrau only" << std::endl;
os << "rx_udpip \n gets receiver udp mac " << std::endl;
os << "rx_udpip2 \n gets receiver udp mac of 2nd udp interface. Jungfrau only" << std::endl;
os << "rx_udpport \n gets receiver udp port " << std::endl;
os << "rx_udpport2 \n gets receiver udp port of 2nd udp interface. For Eiger, it is the right half and for Jungfrau, it is the top half module and for other detectors, same as rx_udpport" << std::endl;
os << "numinterfaces \n gets the number of interfaces to n used to stream out from the detector. Options: 1 (default), 2. JUNGFRAU only. " << std::endl;
os << "selinterface \n gets interface to use to stream data out of the detector. Options: 0 (outer, default), 1(inner). Effective only when numinterfaces is 1. JUNGFRAU only. " << std::endl;
os << "txndelay_left \n gets detector transmission delay of the left port" << std::endl;
os << "txndelay_right \n gets detector transmission delay of the right port" << std::endl;
os << "txndelay_frame \n gets detector transmission delay of the entire frame" << std::endl;
@ -2937,30 +2747,6 @@ std::string slsDetectorCommand::helpOnline(int action) {
return os.str();
}
std::string slsDetectorCommand::cmdConfigureMac(int narg, const char * const args[], int action, int detPos) {
if (action == HELP_ACTION) {
return helpConfigureMac(action);
}
if (action == PUT_ACTION) {
myDet->configureMAC(detPos);
} else
return std::string("Cannot get ") + cmd;
return std::string("successful");
}
std::string slsDetectorCommand::helpConfigureMac(int action) {
std::ostringstream os;
if (action == PUT_ACTION || action == HELP_ACTION)
os << "configuremac i \n configures the MAC of the detector." << std::endl;
if (action == GET_ACTION || action == HELP_ACTION)
os << "configuremac "
<< "Cannot get " << std::endl;
return os.str();
}
std::string slsDetectorCommand::cmdDetectorSize(int narg, const char * const args[], int action, int detPos) {
@ -4534,8 +4320,7 @@ std::string slsDetectorCommand::cmdConfiguration(int narg, const char * const ar
} else if (cmd == "rx_printconfig") {
if (action == PUT_ACTION)
return std::string("cannot put");
FILE_LOG(logINFO) << myDet->printReceiverConfiguration(detPos);
return std::string("");
return myDet->printReceiverConfiguration(detPos);
} else if (cmd == "parameters") {
if (action == PUT_ACTION) {
sval = std::string(args[1]);