From 1d31695cc1ff73b9890894d415849ce40000846c Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Fri, 17 Apr 2020 12:15:16 +0200 Subject: [PATCH] WIP --- slsDetectorSoftware/src/Module.cpp | 38 +--------------------------- slsDetectorSoftware/src/Module.h | 8 ------ slsDetectorSoftware/src/Receiver.cpp | 8 ++++-- 3 files changed, 7 insertions(+), 47 deletions(-) diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index 7a91c8f4c..49af316bc 100755 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -644,24 +644,6 @@ int Module::setStopPort(int port_number) { return shm()->stopPort; } -int Module::setReceiverPort(int port_number) { - LOG(logDEBUG1) << "Setting reciever port to " << port_number; - if (port_number >= 0 && port_number != shm()->rxTCPPort) { - if (shm()->useReceiver) { - int retval = -1; - sendToReceiver(F_SET_RECEIVER_PORT, port_number, retval); - shm()->rxTCPPort = retval; - LOG(logDEBUG1) << "Receiver port: " << retval; - - } else { - shm()->rxTCPPort = port_number; - } - } - return shm()->rxTCPPort; -} - -int Module::getReceiverPort() const { return shm()->rxTCPPort; } - int Module::getControlPort() const { return shm()->controlPort; } int Module::getStopPort() const { return shm()->stopPort; } @@ -1498,29 +1480,11 @@ uint32_t Module::clearBit(uint32_t addr, int n) { void Module::setReceiverHostname(const std::string &receiverIP) { LOG(logDEBUG1) << "Setting up Receiver with " << receiverIP; - // recieverIP is none - if (receiverIP == "none") { - memset(shm()->rxHostname, 0, MAX_STR_LENGTH); - sls::strcpy_safe(shm()->rxHostname, "none"); - shm()->useReceiver = false; - } - // stop acquisition if running - if (getRunStatus() == RUNNING) { - LOG(logWARNING) << "Acquisition already running, Stopping it."; - stopAcquisition(); - } - // start updating - std::string host = receiverIP; - auto res = sls::split(host, ':'); - if (res.size() > 1) { - host = res[0]; - shm()->rxTCPPort = std::stoi(res[1]); - } + sls::strcpy_safe(shm()->rxHostname, host.c_str()); shm()->useReceiver = true; - checkReceiverVersionCompatibility(); // populate parameters from detector rxParameters retval; diff --git a/slsDetectorSoftware/src/Module.h b/slsDetectorSoftware/src/Module.h index 6534b7d68..2352963b9 100755 --- a/slsDetectorSoftware/src/Module.h +++ b/slsDetectorSoftware/src/Module.h @@ -238,14 +238,6 @@ class Module : public virtual slsDetectorDefs { */ int getStopPort() const; - int setReceiverPort(int port_number); - - /** - * Returns the receiver TCP port - * @returns the receiver TCP port - */ - int getReceiverPort() const; - /** * Lock server for this client IP * @param p 0 to unlock, 1 to lock (-1 gets) diff --git a/slsDetectorSoftware/src/Receiver.cpp b/slsDetectorSoftware/src/Receiver.cpp index a314ac5f2..27ab95963 100755 --- a/slsDetectorSoftware/src/Receiver.cpp +++ b/slsDetectorSoftware/src/Receiver.cpp @@ -174,14 +174,18 @@ int Receiver::getTCPPort() const { } void Receiver::setTCPPort(const int port) { + LOG(logDEBUG1) << "Setting reciever port to " << port; if (port >= 0 && port != shm()->tcpPort) { if (strlen(shm()->hostname) != 0) { - // send to receiver to change tcpp port - shm()->tcpPort = port; // for now + int retval = -1; + sendToReceiver(F_SET_RECEIVER_PORT, port, retval); + shm()->tcpPort = retval; + LOG(logDEBUG1) << "Receiver port: " << retval; } else { shm()->tcpPort = port; } } + return shm()->tcpPort; } void Receiver::configure() {