WIP, separated rxr from module

This commit is contained in:
2020-04-23 16:09:40 +02:00
parent 45a770cf38
commit 085cbbf0d6
9 changed files with 142 additions and 309 deletions

View File

@ -703,12 +703,12 @@ Result<std::string> Detector::printRxConfiguration(Positions pos) const {
} }
Result<bool> Detector::getTenGiga(Positions pos) const { Result<bool> Detector::getTenGiga(Positions pos) const {
return pimpl->Parallel(&Module::enableTenGigabitEthernet, pos, -1); return pimpl->Parallel(&Module::getTenGiga, pos);
} }
void Detector::setTenGiga(bool value, Positions pos) { void Detector::setTenGiga(bool value, Positions pos) {
pimpl->Parallel(&Module::enableTenGigabitEthernet, pos, pimpl->Parallel(&Module::setTenGiga, pos, value);
static_cast<int>(value)); pimpl->Parallel3(&Receiver::setTenGiga, value);
} }
Result<bool> Detector::getTenGigaFlowControl(Positions pos) const { Result<bool> Detector::getTenGigaFlowControl(Positions pos) const {
@ -751,7 +751,7 @@ void Detector::removeReceivers(const int udpInterface) {
Result<bool> Detector::getUseReceiverFlag(Positions pos) const { Result<bool> Detector::getUseReceiverFlag(Positions pos) const {
return pimpl->Parallel(&Module::getUseReceiverFlag, pos); return (pimpl->isReceiverInitialized(1) || pimpl->isReceiverInitialized(2));
} }
Result<std::string> Detector::getRxHostname(const int udpInterface, Positions pos) const { Result<std::string> Detector::getRxHostname(const int udpInterface, Positions pos) const {
@ -816,19 +816,19 @@ void Detector::setRxPort(const int udpInterface, int port, int module_id) {
} }
Result<int> Detector::getRxFifoDepth(Positions pos) const { Result<int> Detector::getRxFifoDepth(Positions pos) const {
return pimpl->Parallel(&Module::setReceiverFifoDepth, pos, -1); return pimpl->Parallel3(&Receiver::getFifoDepth);
} }
void Detector::setRxFifoDepth(int nframes, Positions pos) { void Detector::setRxFifoDepth(int nframes, Positions pos) {
pimpl->Parallel(&Module::setReceiverFifoDepth, pos, nframes); pimpl->Parallel3(&Receiver::setFifoDepth, nframes);
} }
Result<bool> Detector::getRxSilentMode(Positions pos) const { Result<bool> Detector::getRxSilentMode(Positions pos) const {
return pimpl->Parallel(&Module::getReceiverSilentMode, pos); return pimpl->Parallel3(&Receiver::getSilentMode);
} }
void Detector::setRxSilentMode(bool value, Positions pos) { void Detector::setRxSilentMode(bool value, Positions pos) {
pimpl->Parallel(&Module::setReceiverSilentMode, pos, value); pimpl->Parallel3(&Receiver::setSilentMode, value);
} }
Result<defs::frameDiscardPolicy> Result<defs::frameDiscardPolicy>
@ -1439,6 +1439,7 @@ Result<uint32_t> Detector::getCounterMask(Positions pos) const {
void Detector::setCounterMask(uint32_t countermask, Positions pos) { void Detector::setCounterMask(uint32_t countermask, Positions pos) {
pimpl->Parallel(&Module::setCounterMask, pos, countermask); pimpl->Parallel(&Module::setCounterMask, pos, countermask);
pimpl->Parallel3(&Receiver::setCounterMask, countermask);
} }
// CTB/ Moench Specific // CTB/ Moench Specific

View File

@ -1330,7 +1330,7 @@ void DetectorImpl::startProcessingThread() {
} }
void DetectorImpl::processData() { void DetectorImpl::processData() {
if (Parallel(&Module::getUseReceiverFlag, {}).squash(false)) { if (isReceiverInitialized(1) || isReceiverInitialized(2)) {
if (dataReady != nullptr) { if (dataReady != nullptr) {
readFrameFromReceiver(); readFrameFromReceiver();
} }

View File

@ -242,102 +242,6 @@ void Module::sendToDetectorStop(int fnum) const {
sendToDetectorStop(fnum, nullptr, 0, nullptr, 0); sendToDetectorStop(fnum, nullptr, 0, nullptr, 0);
} }
void Module::sendToReceiver(int fnum, const void *args, size_t args_size,
void *retval, size_t retval_size) {
static_cast<const Module &>(*this).sendToReceiver(
fnum, args, args_size, retval, retval_size);
}
void Module::sendToReceiver(int fnum, const void *args, size_t args_size,
void *retval, size_t retval_size) const {
auto receiver = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort);
receiver.sendCommandThenRead(fnum, args, args_size, retval, retval_size);
receiver.close();
}
template <typename Arg, typename Ret>
void Module::sendToReceiver(int fnum, const Arg &args, Ret &retval) {
sendToReceiver(fnum, &args, sizeof(args), &retval, sizeof(retval));
}
template <typename Arg, typename Ret>
void Module::sendToReceiver(int fnum, const Arg &args, Ret &retval) const {
sendToReceiver(fnum, &args, sizeof(args), &retval, sizeof(retval));
}
template <typename Arg>
void Module::sendToReceiver(int fnum, const Arg &args, std::nullptr_t) {
sendToReceiver(fnum, &args, sizeof(args), nullptr, 0);
}
template <typename Arg>
void Module::sendToReceiver(int fnum, const Arg &args,
std::nullptr_t) const {
sendToReceiver(fnum, &args, sizeof(args), nullptr, 0);
}
template <typename Ret>
void Module::sendToReceiver(int fnum, std::nullptr_t, Ret &retval) {
sendToReceiver(fnum, nullptr, 0, &retval, sizeof(retval));
}
template <typename Ret>
void Module::sendToReceiver(int fnum, std::nullptr_t, Ret &retval) const {
sendToReceiver(fnum, nullptr, 0, &retval, sizeof(retval));
}
template <typename Ret>
Ret Module::sendToReceiver(int fnum){
LOG(logDEBUG1) << "Sending: ["
<< getFunctionNameFromEnum(static_cast<slsDetectorDefs::detFuncs>(fnum))
<< ", nullptr, 0, " << typeid(Ret).name() << ", " << sizeof(Ret) << "]";
Ret retval{};
sendToReceiver(fnum, nullptr, 0, &retval, sizeof(retval));
LOG(logDEBUG1) << "Got back: " << retval;
return retval;
}
template <typename Ret>
Ret Module::sendToReceiver(int fnum) const{
LOG(logDEBUG1) << "Sending: ["
<< getFunctionNameFromEnum(static_cast<slsDetectorDefs::detFuncs>(fnum))
<< ", nullptr, 0, " << typeid(Ret).name() << ", " << sizeof(Ret) << "]";
Ret retval{};
sendToReceiver(fnum, nullptr, 0, &retval, sizeof(retval));
LOG(logDEBUG1) << "Got back: " << retval;
return retval;
}
template <typename Ret, typename Arg>
Ret Module::sendToReceiver(int fnum, const Arg &args){
LOG(logDEBUG1) << "Sending: ["
<< getFunctionNameFromEnum(static_cast<slsDetectorDefs::detFuncs>(fnum))
<< ", " << args << ", " << sizeof(args) << ", " << typeid(Ret).name() << ", " << sizeof(Ret) << "]";
Ret retval{};
sendToReceiver(fnum, &args, sizeof(args), &retval, sizeof(retval));
LOG(logDEBUG1) << "Got back: " << retval;
return retval;
}
template <typename Ret, typename Arg>
Ret Module::sendToReceiver(int fnum, const Arg &args) const{
LOG(logDEBUG1) << "Sending: ["
<< getFunctionNameFromEnum(static_cast<slsDetectorDefs::detFuncs>(fnum))
<< ", " << args << ", " << sizeof(args) << ", " << typeid(Ret).name() << ", " << sizeof(Ret) << "]";
Ret retval{};
sendToReceiver(fnum, &args, sizeof(args), &retval, sizeof(retval));
LOG(logDEBUG1) << "Got back: " << retval;
return retval;
}
// void Module::sendToReceiver(int fnum) {
// sendToReceiver(fnum, nullptr, 0, nullptr, 0);
// }
// void Module::sendToReceiver(int fnum) const {
// sendToReceiver(fnum, nullptr, 0, nullptr, 0);
// }
void Module::freeSharedMemory() { void Module::freeSharedMemory() {
if (shm.IsExisting()) { if (shm.IsExisting()) {
shm.RemoveSharedMemory(); shm.RemoveSharedMemory();
@ -395,12 +299,6 @@ void Module::initializeDetectorStructure(detectorType type) {
shm()->controlPort = DEFAULT_PORTNO; shm()->controlPort = DEFAULT_PORTNO;
shm()->stopPort = DEFAULT_PORTNO + 1; shm()->stopPort = DEFAULT_PORTNO + 1;
sls::strcpy_safe(shm()->settingsDir, getenv("HOME")); sls::strcpy_safe(shm()->settingsDir, getenv("HOME"));
sls::strcpy_safe(shm()->rxHostname, "none");
shm()->rxTCPPort = DEFAULT_PORTNO + 2;
shm()->useReceiver = false;
shm()->zmqport = DEFAULT_ZMQ_CL_PORTNO +
(moduleId * ((shm()->myDetectorType == EIGER) ? 2 : 1));
shm()->zmqip = IpAddr{};
shm()->numUDPInterfaces = 1; shm()->numUDPInterfaces = 1;
// get the detector parameters based on type // get the detector parameters based on type
@ -2264,50 +2162,20 @@ void Module::updateRateCorrection() {
sendToDetector(F_UPDATE_RATE_CORRECTION); sendToDetector(F_UPDATE_RATE_CORRECTION);
} }
bool Module::getUseReceiverFlag() const { return shm()->useReceiver; } bool Module::getTenGiga() {
int retval = -1, arg = -1;
bool Module::enableTenGigabitEthernet(int value) { LOG(logDEBUG1) << "Getting 10Gbe";
int retval = -1; sendToDetector(F_ENABLE_TEN_GIGA, arg, retval);
LOG(logDEBUG1) << "Enabling / Disabling 10Gbe: " << value;
sendToDetector(F_ENABLE_TEN_GIGA, value, retval);
if (value != -1) {
int stopRetval = -1;
sendToDetectorStop(F_ENABLE_TEN_GIGA, value, stopRetval);
}
LOG(logDEBUG1) << "10Gbe: " << retval; LOG(logDEBUG1) << "10Gbe: " << retval;
value = retval;
if (shm()->useReceiver && value != -1) {
int retval = -1;
LOG(logDEBUG1) << "Sending 10Gbe enable to receiver: " << value;
sendToReceiver(F_ENABLE_RECEIVER_TEN_GIGA, value, retval);
LOG(logDEBUG1) << "Receiver 10Gbe enable: " << retval;
}
return static_cast<bool>(retval);
}
int Module::setReceiverFifoDepth(int n_frames) {
int retval = -1;
LOG(logDEBUG1) << "Sending Receiver Fifo Depth: " << n_frames;
if (shm()->useReceiver) {
sendToReceiver(F_SET_RECEIVER_FIFO_DEPTH, n_frames, retval);
LOG(logDEBUG1) << "Receiver Fifo Depth: " << retval;
}
return retval; return retval;
} }
bool Module::getReceiverSilentMode() { void Module::setTenGiga(bool enable) {
if (!shm()->useReceiver) { int retval = -1;
throw RuntimeError("Set rx_hostname first to use receiver parameters (silent mode)");
}
return sendToReceiver<int>(F_GET_RECEIVER_SILENT_MODE);
}
void Module::setReceiverSilentMode(bool enable) {
if (!shm()->useReceiver) {
throw RuntimeError("Set rx_hostname first to use receiver parameters (silent mode)");
}
int arg = static_cast<int>(enable); int arg = static_cast<int>(enable);
sendToReceiver(F_SET_RECEIVER_SILENT_MODE, arg, nullptr); LOG(logDEBUG1) << "Enabling / Disabling 10Gbe: " << arg;
sendToDetector(F_ENABLE_TEN_GIGA, arg, retval);
sendToDetectorStop(F_ENABLE_TEN_GIGA, arg, retval);
} }
void Module::setPattern(const std::string &fname) { void Module::setPattern(const std::string &fname) {
@ -2510,11 +2378,6 @@ void Module::setPipeline(int clkIndex, int value) {
void Module::setCounterMask(uint32_t countermask) { void Module::setCounterMask(uint32_t countermask) {
LOG(logDEBUG1) << "Setting Counter mask to " << countermask; LOG(logDEBUG1) << "Setting Counter mask to " << countermask;
sendToDetector(F_SET_COUNTER_MASK, countermask, nullptr); sendToDetector(F_SET_COUNTER_MASK, countermask, nullptr);
if (shm()->useReceiver) {
int ncounters = __builtin_popcount(countermask);
LOG(logDEBUG1) << "Sending Reciver #counters: " << ncounters;
sendToReceiver(F_RECEIVER_SET_NUM_COUNTERS, ncounters, nullptr);
}
} }
uint32_t Module::getCounterMask() { uint32_t Module::getCounterMask() {

View File

@ -15,7 +15,7 @@ class ServerInterface;
#define MODULE_SHMRXVERSION 0x200415 #define MODULE_SHMRXVERSION 0x200415
#define MODULE_SHMAPIVERSION 0x190726 #define MODULE_SHMAPIVERSION 0x190726
#define MODULE_SHMVERSION 0x200415 #define MODULE_SHMVERSION 0x200423
namespace sls{ namespace sls{
@ -66,22 +66,6 @@ struct sharedModule {
/** number of dacs per module*/ /** number of dacs per module*/
int nDacs; int nDacs;
/** ip address/hostname of the receiver for client control via TCP */
char rxHostname[MAX_STR_LENGTH];
/** is the TCP port used to communicate between client and the receiver */
int rxTCPPort;
/** is set if the receiver hostname given and is connected,
* unset if socket connection is not possible */
bool useReceiver;
/** tcp port from gui/different process to receiver (only data) */
int zmqport;
/** zmq tcp src ip address in client (only data) **/
sls::IpAddr zmqip;
/** num udp interfaces */ /** num udp interfaces */
int numUDPInterfaces; int numUDPInterfaces;
}; };
@ -1139,27 +1123,8 @@ class Module : public virtual slsDetectorDefs {
*/ */
void updateRateCorrection(); void updateRateCorrection();
/** bool getTenGiga();
* Gets the use receiver flag from shared memory void setTenGiga(bool value);
*/
bool getUseReceiverFlag() const;
/**
* Enable/disable or 10Gbe
* @param i is -1 to get, 0 to disable and 1 to enable
* @returns if 10Gbe is enabled
*/
bool enableTenGigabitEthernet(int value = -1);
/**
* Set/get receiver fifo depth
* @param i is -1 to get, any other value to set the fifo deph
* @returns the receiver fifo depth
*/
int setReceiverFifoDepth(int n_frames = -1);
bool getReceiverSilentMode();
void setReceiverSilentMode(bool enable);
/** /**
* Opens pattern file and sends pattern to CTB * Opens pattern file and sends pattern to CTB
@ -1360,50 +1325,6 @@ class Module : public virtual slsDetectorDefs {
void sendToDetectorStop(int fnum) const; void sendToDetectorStop(int fnum) const;
/**
* Send function parameters to receiver
* @param fnum function enum
* @param args argument pointer
* @param args_size size of argument
* @param retval return pointers
* @param retval_size size of return value
*/
void sendToReceiver(int fnum, const void *args, size_t args_size,
void *retval, size_t retval_size);
void sendToReceiver(int fnum, const void *args, size_t args_size,
void *retval, size_t retval_size) const;
template <typename Arg, typename Ret>
void sendToReceiver(int fnum, const Arg &args, Ret &retval);
template <typename Arg, typename Ret>
void sendToReceiver(int fnum, const Arg &args, Ret &retval) const;
template <typename Arg>
void sendToReceiver(int fnum, const Arg &args, std::nullptr_t);
template <typename Arg>
void sendToReceiver(int fnum, const Arg &args, std::nullptr_t) const;
template <typename Ret>
void sendToReceiver(int fnum, std::nullptr_t, Ret &retval);
template <typename Ret>
void sendToReceiver(int fnum, std::nullptr_t, Ret &retval) const;
template <typename Ret>
Ret sendToReceiver(int fnum);
template <typename Ret>
Ret sendToReceiver(int fnum) const;
template <typename Ret, typename Arg>
Ret sendToReceiver(int fnum, const Arg &args);
template <typename Ret, typename Arg>
Ret sendToReceiver(int fnum, const Arg &args) const;
/** /**
* Get Detector Type from Shared Memory (opening shm without verifying size) * Get Detector Type from Shared Memory (opening shm without verifying size)
* @param detector_id multi detector Id * @param detector_id multi detector Id

View File

@ -297,6 +297,20 @@ void Receiver::setUDPPort(const int port) {
sendToReceiver(F_SET_RECEIVER_UDP_PORT, port, nullptr); sendToReceiver(F_SET_RECEIVER_UDP_PORT, port, nullptr);
} }
int64_t Receiver::getUDPSocketBufferSize() const {
return sendToReceiver<int64_t>(F_GET_RECEIVER_UDP_SOCK_BUF_SIZE);
}
void Receiver::setUDPSocketBufferSize(int64_t value) {
LOG(logDEBUG1) << "Sending UDP Socket Buffer size to receiver: "
<< value;
sendToReceiver(F_SET_RECEIVER_UDP_SOCK_BUF_SIZE, value, nullptr);
}
int64_t Receiver::getRealUDPSocketBufferSize() const {
return sendToReceiver<int64_t>(F_GET_RECEIVER_REAL_UDP_SOCK_BUF_SIZE);
}
/** ZMQ Streaming Parameters (Receiver<->Client) */ /** ZMQ Streaming Parameters (Receiver<->Client) */
bool Receiver::getZmq() const { bool Receiver::getZmq() const {
@ -308,50 +322,6 @@ void Receiver::setZmq(const bool enable) {
sendToReceiver(F_SET_RECEIVER_STREAMING, arg, nullptr); sendToReceiver(F_SET_RECEIVER_STREAMING, arg, nullptr);
} }
int Receiver::getClientZmqPort() const {
return shm()->zmqPort;
}
void Receiver::setClientZmqPort(const int port) {
shm()->zmqPort = port;
}
int Receiver::getZmqPort() const {
return sendToReceiver<int>(F_GET_RECEIVER_STREAMING_PORT);
}
void Receiver::setZmqPort(int port) {
sendToReceiver(F_SET_RECEIVER_STREAMING_PORT, port, nullptr);
}
sls::IpAddr Receiver::getClientZmqIP() const {
return shm()->zmqIp;
}
void Receiver::setClientZmqIP(const sls::IpAddr ip) {
LOG(logDEBUG1) << "Setting client zmq ip to " << ip;
if (ip == 0) {
throw RuntimeError("Invalid client zmq ip address");
}
shm()->zmqIp = ip;
}
sls::IpAddr Receiver::getZmqIP() const {
return sendToReceiver<sls::IpAddr>(F_GET_RECEIVER_STREAMING_SRC_IP);
}
void Receiver::setZmqIP(const sls::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);
}
int Receiver::getZmqFrequency() const { int Receiver::getZmqFrequency() const {
return sendToReceiver<int>(F_GET_RECEIVER_STREAMING_FREQUENCY); return sendToReceiver<int>(F_GET_RECEIVER_STREAMING_FREQUENCY);
} }
@ -371,6 +341,50 @@ void Receiver::setZmqTimer(const int time_in_ms) {
sendToReceiver(F_SET_RECEIVER_STREAMING_TIMER, time_in_ms, nullptr); sendToReceiver(F_SET_RECEIVER_STREAMING_TIMER, time_in_ms, nullptr);
} }
int Receiver::getZmqPort() const {
return sendToReceiver<int>(F_GET_RECEIVER_STREAMING_PORT);
}
void Receiver::setZmqPort(int port) {
sendToReceiver(F_SET_RECEIVER_STREAMING_PORT, port, nullptr);
}
sls::IpAddr Receiver::getZmqIP() const {
return sendToReceiver<sls::IpAddr>(F_GET_RECEIVER_STREAMING_SRC_IP);
}
void Receiver::setZmqIP(const sls::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);
}
int Receiver::getClientZmqPort() const {
return shm()->zmqPort;
}
void Receiver::setClientZmqPort(const int port) {
shm()->zmqPort = port;
}
sls::IpAddr Receiver::getClientZmqIP() const {
return shm()->zmqIp;
}
void Receiver::setClientZmqIP(const sls::IpAddr ip) {
LOG(logDEBUG1) << "Setting client zmq ip to " << ip;
if (ip == 0) {
throw RuntimeError("Invalid client zmq ip address");
}
shm()->zmqIp = ip;
}
/** Receiver Parameters */ /** Receiver Parameters */
bool Receiver::getLock() const { bool Receiver::getLock() const {
@ -391,20 +405,6 @@ void Receiver::exitServer() {
sendToReceiver(F_EXIT_RECEIVER, nullptr, nullptr); sendToReceiver(F_EXIT_RECEIVER, nullptr, nullptr);
} }
int64_t Receiver::getUDPSocketBufferSize() const {
return sendToReceiver<int64_t>(F_GET_RECEIVER_UDP_SOCK_BUF_SIZE);
}
void Receiver::setUDPSocketBufferSize(int64_t value) {
LOG(logDEBUG1) << "Sending UDP Socket Buffer size to receiver: "
<< value;
sendToReceiver(F_SET_RECEIVER_UDP_SOCK_BUF_SIZE, value, nullptr);
}
int64_t Receiver::getRealUDPSocketBufferSize() const {
return sendToReceiver<int64_t>(F_GET_RECEIVER_REAL_UDP_SOCK_BUF_SIZE);
}
bool Receiver::getDeactivatedPaddingMode() const { bool Receiver::getDeactivatedPaddingMode() const {
return sendToReceiver<int>(F_GET_RECEIVER_DEACTIVATED_PADDING); return sendToReceiver<int>(F_GET_RECEIVER_DEACTIVATED_PADDING);
} }
@ -445,6 +445,23 @@ void Receiver::setPartialFramesPadding(const bool padding) {
sendToReceiver(F_SET_RECEIVER_PADDING, arg, nullptr); sendToReceiver(F_SET_RECEIVER_PADDING, arg, nullptr);
} }
int Receiver::getFifoDepth() const {
return sendToReceiver<int>(F_GET_RECEIVER_FIFO_DEPTH);
}
void Receiver::setFifoDepth(const int value) {
sendToReceiver(F_SET_RECEIVER_FIFO_DEPTH, value, nullptr);
}
bool Receiver::getSilentMode() const {
return sendToReceiver<int>(F_GET_RECEIVER_SILENT_MODE);
}
void Receiver::setSilentMode(const bool enable) {
int arg = static_cast<int>(enable);
sendToReceiver(F_SET_RECEIVER_SILENT_MODE, arg, nullptr);
}
/** File */ /** File */
std::string Receiver::getFilePath() const { std::string Receiver::getFilePath() const {
@ -669,6 +686,17 @@ void Receiver::setActivate(const bool enable) {
sendToReceiver(F_RECEIVER_ACTIVATE, arg, nullptr); sendToReceiver(F_RECEIVER_ACTIVATE, arg, nullptr);
} }
void Receiver::setTenGiga(const bool enable) {
int arg = static_cast<int>(enable);
sendToReceiver(F_ENABLE_RECEIVER_TEN_GIGA, arg, nullptr);
}
void Receiver::setCounterMask(const uint32_t mask) {
int ncounters = __builtin_popcount(mask);
LOG(logDEBUG1) << "Sending Reciver #counters: " << ncounters;
sendToReceiver(F_RECEIVER_SET_NUM_COUNTERS, ncounters, nullptr);
}
/** Json */ /** Json */
std::map<std::string, std::string> Receiver::getAdditionalJsonHeader() const { std::map<std::string, std::string> Receiver::getAdditionalJsonHeader() const {

View File

@ -81,6 +81,9 @@ class Receiver : public virtual slsDetectorDefs {
* ************************************************/ * ************************************************/
sls::MacAddr setUDPIP(const sls::IpAddr ip); sls::MacAddr setUDPIP(const sls::IpAddr ip);
void setUDPPort(const int udpport); void setUDPPort(const int udpport);
int64_t getUDPSocketBufferSize() const;
void setUDPSocketBufferSize(int64_t value);
int64_t getRealUDPSocketBufferSize() const;
/************************************************** /**************************************************
* * * *
@ -89,19 +92,21 @@ class Receiver : public virtual slsDetectorDefs {
* ************************************************/ * ************************************************/
bool getZmq() const; bool getZmq() const;
void setZmq(const bool enable); void setZmq(const bool enable);
int getClientZmqPort() const;
void setClientZmqPort(const int port);
int getZmqPort() const;
void setZmqPort(int port);
sls::IpAddr getClientZmqIP() const;
void setClientZmqIP(const sls::IpAddr ip);
sls::IpAddr getZmqIP() const;
void setZmqIP(const sls::IpAddr ip);
int getZmqFrequency() const; int getZmqFrequency() const;
/** Freq = 0 for a timer, else frequency */ /** Freq = 0 for a timer, else frequency */
void setZmqFrequency(const int freq); void setZmqFrequency(const int freq);
int getZmqTimer() const; int getZmqTimer() const;
void setZmqTimer(const int time_in_ms = 200); void setZmqTimer(const int time_in_ms = 200);
int getZmqPort() const;
void setZmqPort(int port);
sls::IpAddr getZmqIP() const;
void setZmqIP(const sls::IpAddr ip);
int getClientZmqPort() const;
void setClientZmqPort(const int port);
sls::IpAddr getClientZmqIP() const;
void setClientZmqIP(const sls::IpAddr ip);
/************************************************** /**************************************************
* * * *
@ -111,11 +116,7 @@ class Receiver : public virtual slsDetectorDefs {
bool getLock() const; bool getLock() const;
void setLock(const bool lock); void setLock(const bool lock);
sls::IpAddr getLastClientIP() const; sls::IpAddr getLastClientIP() const;
void exitServer(); void exitServer();
int64_t getUDPSocketBufferSize() const;
void setUDPSocketBufferSize(int64_t value);
int64_t getRealUDPSocketBufferSize() const;
bool getDeactivatedPaddingMode() const; bool getDeactivatedPaddingMode() const;
void setDeactivatedPaddingMode(const bool padding); void setDeactivatedPaddingMode(const bool padding);
@ -125,6 +126,10 @@ class Receiver : public virtual slsDetectorDefs {
void setFramesDiscardPolicy(const frameDiscardPolicy f); void setFramesDiscardPolicy(const frameDiscardPolicy f);
bool getPartialFramesPadding() const; bool getPartialFramesPadding() const;
void setPartialFramesPadding(const bool padding); void setPartialFramesPadding(const bool padding);
int getFifoDepth() const;
void setFifoDepth(const int value);
bool getSilentMode() const;
void setSilentMode(const bool value);
/************************************************** /**************************************************
* * * *
@ -181,6 +186,8 @@ class Receiver : public virtual slsDetectorDefs {
/** Set digital data offset in bytes (CTB only) */ /** Set digital data offset in bytes (CTB only) */
void setDbitOffset(const int value); void setDbitOffset(const int value);
void setActivate(const bool enable); void setActivate(const bool enable);
void setTenGiga(const bool enable);
void setCounterMask(const uint32_t mask);
/************************************************** /**************************************************
* * * *

View File

@ -146,6 +146,7 @@ int ClientInterface::functionTable(){
flist[F_GET_RECEIVER_OVERWRITE] = &ClientInterface::get_overwrite; flist[F_GET_RECEIVER_OVERWRITE] = &ClientInterface::get_overwrite;
flist[F_ENABLE_RECEIVER_TEN_GIGA] = &ClientInterface::enable_tengiga; flist[F_ENABLE_RECEIVER_TEN_GIGA] = &ClientInterface::enable_tengiga;
flist[F_SET_RECEIVER_FIFO_DEPTH] = &ClientInterface::set_fifo_depth; flist[F_SET_RECEIVER_FIFO_DEPTH] = &ClientInterface::set_fifo_depth;
flist[F_GET_RECEIVER_FIFO_DEPTH] = &ClientInterface::get_fifo_depth;
flist[F_RECEIVER_ACTIVATE] = &ClientInterface::set_activate; flist[F_RECEIVER_ACTIVATE] = &ClientInterface::set_activate;
flist[F_SET_RECEIVER_STREAMING] = &ClientInterface::set_streaming; flist[F_SET_RECEIVER_STREAMING] = &ClientInterface::set_streaming;
flist[F_GET_RECEIVER_STREAMING] = &ClientInterface::get_streaming; flist[F_GET_RECEIVER_STREAMING] = &ClientInterface::get_streaming;
@ -1006,7 +1007,8 @@ int ClientInterface::enable_tengiga(Interface &socket) {
int retval = impl()->getTenGigaEnable(); int retval = impl()->getTenGigaEnable();
validate(val, retval, "set 10GbE", DEC); validate(val, retval, "set 10GbE", DEC);
LOG(logDEBUG1) << "10Gbe:" << retval; LOG(logDEBUG1) << "10Gbe:" << retval;
return socket.sendResult(retval); socket.Send(OK);
return OK;
} }
int ClientInterface::set_fifo_depth(Interface &socket) { int ClientInterface::set_fifo_depth(Interface &socket) {
@ -1023,6 +1025,14 @@ int ClientInterface::set_fifo_depth(Interface &socket) {
int retval = impl()->getFifoDepth(); int retval = impl()->getFifoDepth();
validate(value, retval, std::string("set fifo depth"), DEC); validate(value, retval, std::string("set fifo depth"), DEC);
LOG(logDEBUG1) << "fifo depth:" << retval; LOG(logDEBUG1) << "fifo depth:" << retval;
socket.Send(OK);
return OK;
}
int ClientInterface::get_fifo_depth(Interface &socket) {
int retval = impl()->getFifoDepth();
LOG(logDEBUG1) << "fifo depth:" << retval;
return socket.sendResult(retval); return socket.sendResult(retval);
} }

View File

@ -105,6 +105,7 @@ class ClientInterface : private virtual slsDetectorDefs {
int get_overwrite(sls::ServerInterface &socket); int get_overwrite(sls::ServerInterface &socket);
int enable_tengiga(sls::ServerInterface &socket); int enable_tengiga(sls::ServerInterface &socket);
int set_fifo_depth(sls::ServerInterface &socket); int set_fifo_depth(sls::ServerInterface &socket);
int get_fifo_depth(sls::ServerInterface &socket);
int set_activate(sls::ServerInterface &socket); int set_activate(sls::ServerInterface &socket);
int set_streaming(sls::ServerInterface &socket); int set_streaming(sls::ServerInterface &socket);
int get_streaming(sls::ServerInterface &socket); int get_streaming(sls::ServerInterface &socket);

View File

@ -245,6 +245,7 @@ enum detFuncs{
F_GET_RECEIVER_OVERWRITE, F_GET_RECEIVER_OVERWRITE,
F_ENABLE_RECEIVER_TEN_GIGA, F_ENABLE_RECEIVER_TEN_GIGA,
F_SET_RECEIVER_FIFO_DEPTH, F_SET_RECEIVER_FIFO_DEPTH,
F_GET_RECEIVER_FIFO_DEPTH,
F_RECEIVER_ACTIVATE, F_RECEIVER_ACTIVATE,
F_SET_RECEIVER_STREAMING, F_SET_RECEIVER_STREAMING,
F_GET_RECEIVER_STREAMING, F_GET_RECEIVER_STREAMING,
@ -538,6 +539,7 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_GET_RECEIVER_OVERWRITE: return "F_GET_RECEIVER_OVERWRITE"; case F_GET_RECEIVER_OVERWRITE: return "F_GET_RECEIVER_OVERWRITE";
case F_ENABLE_RECEIVER_TEN_GIGA: return "F_ENABLE_RECEIVER_TEN_GIGA"; case F_ENABLE_RECEIVER_TEN_GIGA: return "F_ENABLE_RECEIVER_TEN_GIGA";
case F_SET_RECEIVER_FIFO_DEPTH: return "F_SET_RECEIVER_FIFO_DEPTH"; case F_SET_RECEIVER_FIFO_DEPTH: return "F_SET_RECEIVER_FIFO_DEPTH";
case F_GET_RECEIVER_FIFO_DEPTH: return "F_GET_RECEIVER_FIFO_DEPTH";
case F_RECEIVER_ACTIVATE: return "F_RECEIVER_ACTIVATE"; case F_RECEIVER_ACTIVATE: return "F_RECEIVER_ACTIVATE";
case F_SET_RECEIVER_STREAMING: return "F_SET_RECEIVER_STREAMING"; case F_SET_RECEIVER_STREAMING: return "F_SET_RECEIVER_STREAMING";
case F_GET_RECEIVER_STREAMING: return "F_GET_RECEIVER_STREAMING"; case F_GET_RECEIVER_STREAMING: return "F_GET_RECEIVER_STREAMING";