fixed loading trimbits

This commit is contained in:
Erik Frojdh 2019-03-14 10:21:18 +01:00
parent 14131f93f1
commit c9422befff
3 changed files with 7 additions and 9 deletions

View File

@ -563,12 +563,11 @@ void slsDetector::connectDataError() {
setErrorMask((getErrorMask()) | (CANNOT_CONNECT_TO_RECEIVER));
}
int slsDetector::sendModule(sls_detector_module *myMod) {
int slsDetector::sendModule(sls_detector_module *myMod, sls::ClientSocket& client) {
TLogLevel level = logDEBUG1;
FILE_LOG(level) << "Sending Module";
int ts = 0;
int n = 0;
auto client = sls::ClientSocket(false, thisDetector->hostname, thisDetector->controlPort);
n = client.sendData(&(myMod->serialnumber), sizeof(myMod->serialnumber));
ts += n;
FILE_LOG(level) << "Serial number sent. " << n << " bytes. serialno: " << myMod->serialnumber;
@ -613,8 +612,7 @@ int slsDetector::sendModule(sls_detector_module *myMod) {
return ts;
}
int slsDetector::receiveModule(sls_detector_module *myMod) {
auto client = sls::ClientSocket(false, thisDetector->hostname, thisDetector->controlPort);
int slsDetector::receiveModule(sls_detector_module *myMod, sls::ClientSocket& client) {
int ts = 0;
ts += client.receiveData(&(myMod->serialnumber), sizeof(myMod->serialnumber));
ts += client.receiveData(&(myMod->nchan), sizeof(myMod->nchan));
@ -4012,7 +4010,7 @@ int slsDetector::setModule(sls_detector_module module, int tb) {
if (thisDetector->onlineFlag == ONLINE_FLAG) {
auto client = sls::ClientSocket(false, thisDetector->hostname, thisDetector->controlPort);
client.sendData(&fnum, sizeof(fnum));
sendModule(&module);
sendModule(&module, client);
client.receiveData(&ret, sizeof(ret));
// handle ret
@ -4082,7 +4080,7 @@ slsDetectorDefs::sls_detector_module *slsDetector::getModule() {
if (ret == FAIL) {
setErrorMask((getErrorMask()) | (OTHER_ERROR_CODE));
} else {
receiveModule(myMod);
receiveModule(myMod, client);
}
}
if (ret == FORCE_UPDATE) {

View File

@ -1711,14 +1711,14 @@ class slsDetector : public virtual slsDetectorDefs, public virtual errorDefs {
* @param myMod module structure to send
* @returns number of bytes sent to the detector
*/
int sendModule(sls_detector_module *myMod);
int sendModule(sls_detector_module *myMod, sls::ClientSocket& client);
/**
* Receive a sls_detector_module structure over socket
* @param myMod module structure to receive
* @returns number of bytes received from the detector
*/
int receiveModule(sls_detector_module *myMod);
int receiveModule(sls_detector_module *myMod, sls::ClientSocket& client);
/**
* Get MAC from the receiver using udpip and

View File

@ -12,7 +12,7 @@ class DataSocket {
virtual ~DataSocket();
DataSocket &operator=(DataSocket &&move) noexcept;
void swap(DataSocket &other) noexcept;
DataSocket(DataSocket const &) = delete;
DataSocket(const DataSocket &) = delete;
DataSocket &operator=(DataSocket const &) = delete;
int getSocketId() const {
return socketId_;