mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-20 02:40:03 +02:00
client: moved shortenable to roi in reciever, roi not yet written in master file
This commit is contained in:
parent
961489edb1
commit
c784f0f539
@ -146,19 +146,6 @@ typedef struct {
|
||||
} sls_detector_module;
|
||||
|
||||
|
||||
/**
|
||||
@short structure for a region of interest
|
||||
|
||||
xmin,xmax,ymin,ymax define the limits of the region
|
||||
*/
|
||||
typedef struct {
|
||||
int xmin; /**< is the roi xmin (in channel number) */
|
||||
int xmax; /**< is the roi xmax (in channel number)*/
|
||||
int ymin; /**< is the roi ymin (in channel number)*/
|
||||
int ymax; /**< is the roi ymax (in channel number)*/
|
||||
} ROI ;
|
||||
|
||||
|
||||
/* /\* */
|
||||
/* @short structure for a generic integer array */
|
||||
/* *\/ */
|
||||
|
@ -43,12 +43,12 @@ multiSlsDetector::multiSlsDetector(int id, bool verify, bool update)
|
||||
|
||||
multiSlsDetector::~multiSlsDetector() {
|
||||
// delete zmq sockets first
|
||||
for (vector<ZmqSocket*>::const_iterator it = zmqSocket.begin(); it != zmqSocket.end(); ++it) {
|
||||
for (std::vector<ZmqSocket*>::const_iterator it = zmqSocket.begin(); it != zmqSocket.end(); ++it) {
|
||||
delete(*it);
|
||||
}
|
||||
zmqSocket.clear();
|
||||
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
delete(*it);
|
||||
}
|
||||
detectors.clear();
|
||||
@ -101,12 +101,12 @@ T multiSlsDetector::callDetectorMember(T (slsDetector::*somefunc)())
|
||||
return minusOneIfDifferent(values);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::callDetectorMember(string (slsDetector::*somefunc)()) {
|
||||
string concatenatedValue, firstValue;
|
||||
std::string multiSlsDetector::callDetectorMember(std::string (slsDetector::*somefunc)()) {
|
||||
std::string concatenatedValue, firstValue;
|
||||
bool valueNotSame = false;
|
||||
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
string thisValue = (detectors[idet]->*somefunc)();
|
||||
std::string thisValue = (detectors[idet]->*somefunc)();
|
||||
;
|
||||
if (detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask() | (1 << idet));
|
||||
@ -347,14 +347,14 @@ double* multiSlsDetector::decodeData(int* datain, int& nn, double* fdata) {
|
||||
|
||||
|
||||
|
||||
int multiSlsDetector::writeDataFile(string fname, double* data, double* err,
|
||||
int multiSlsDetector::writeDataFile(std::string fname, double* data, double* err,
|
||||
double* ang, char dataformat, int nch) {
|
||||
#ifdef VERBOSE
|
||||
cout << "using overloaded multiSlsDetector function to write formatted data file "
|
||||
<< getTotalNumberOfChannels() << endl;
|
||||
#endif
|
||||
|
||||
ofstream outfile;
|
||||
std::ofstream outfile;
|
||||
int choff = 0, off = 0; //idata,
|
||||
double *pe = err, *pa = ang;
|
||||
int nch_left = nch, n; //, nd;
|
||||
@ -365,7 +365,7 @@ int multiSlsDetector::writeDataFile(string fname, double* data, double* err,
|
||||
if (data == NULL)
|
||||
return FAIL;
|
||||
|
||||
outfile.open(fname.c_str(), ios_base::out);
|
||||
outfile.open(fname.c_str(), std::ios_base::out);
|
||||
if (outfile.is_open()) {
|
||||
|
||||
for (unsigned int i = 0; i < detectors.size(); ++i) {
|
||||
@ -399,8 +399,8 @@ int multiSlsDetector::writeDataFile(string fname, double* data, double* err,
|
||||
}
|
||||
}
|
||||
|
||||
int multiSlsDetector::writeDataFile(string fname, int* data) {
|
||||
ofstream outfile;
|
||||
int multiSlsDetector::writeDataFile(std::string fname, int* data) {
|
||||
std::ofstream outfile;
|
||||
int choff = 0, off = 0;
|
||||
#ifdef VERBOSE
|
||||
cout << "using overloaded multiSlsDetector function to write raw data file " << endl;
|
||||
@ -409,7 +409,7 @@ int multiSlsDetector::writeDataFile(string fname, int* data) {
|
||||
if (data == NULL)
|
||||
return FAIL;
|
||||
|
||||
outfile.open(fname.c_str(), ios_base::out);
|
||||
outfile.open(fname.c_str(), std::ios_base::out);
|
||||
if (outfile.is_open()) {
|
||||
for (unsigned int i = 0; i < detectors.size(); ++i) {
|
||||
#ifdef VERBOSE
|
||||
@ -430,22 +430,22 @@ int multiSlsDetector::writeDataFile(string fname, int* data) {
|
||||
}
|
||||
}
|
||||
|
||||
int multiSlsDetector::readDataFile(string fname, double* data, double* err,
|
||||
int multiSlsDetector::readDataFile(std::string fname, double* data, double* err,
|
||||
double* ang, char dataformat) {
|
||||
#ifdef VERBOSE
|
||||
cout << "using overloaded multiSlsDetector function to read formatted data file " << endl;
|
||||
#endif
|
||||
|
||||
ifstream infile;
|
||||
std::ifstream infile;
|
||||
int iline = 0;
|
||||
string str;
|
||||
std::string str;
|
||||
int choff = 0, off = 0;
|
||||
double *pe = err, *pa = ang;
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Opening file " << fname << std::endl;
|
||||
#endif
|
||||
infile.open(fname.c_str(), ios_base::in);
|
||||
infile.open(fname.c_str(), std::ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
|
||||
for (unsigned int i = 0; i < detectors.size(); ++i) {
|
||||
@ -469,19 +469,19 @@ int multiSlsDetector::readDataFile(string fname, double* data, double* err,
|
||||
return iline;
|
||||
}
|
||||
|
||||
int multiSlsDetector::readDataFile(string fname, int* data) {
|
||||
int multiSlsDetector::readDataFile(std::string fname, int* data) {
|
||||
#ifdef VERBOSE
|
||||
cout << "using overloaded multiSlsDetector function to read raw data file " << endl;
|
||||
#endif
|
||||
ifstream infile;
|
||||
std::ifstream infile;
|
||||
int iline = 0;
|
||||
string str;
|
||||
std::string str;
|
||||
int choff = 0, off = 0;
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Opening file " << fname << std::endl;
|
||||
#endif
|
||||
infile.open(fname.c_str(), ios_base::in);
|
||||
infile.open(fname.c_str(), std::ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
|
||||
for (unsigned int i = 0; i < detectors.size(); ++i) {
|
||||
@ -501,17 +501,17 @@ int multiSlsDetector::readDataFile(string fname, int* data) {
|
||||
}
|
||||
|
||||
|
||||
string multiSlsDetector::getErrorMessage(int& critical) {
|
||||
std::string multiSlsDetector::getErrorMessage(int& critical) {
|
||||
int64_t multiMask, slsMask = 0;
|
||||
string retval = "";
|
||||
std::string retval = "";
|
||||
char sNumber[100];
|
||||
critical = 0;
|
||||
|
||||
multiMask = getErrorMask();
|
||||
if (multiMask) {
|
||||
if (multiMask & MULTI_DETECTORS_NOT_ADDED) {
|
||||
retval.append("Detectors not added:\n" + string(getNotAddedList()) +
|
||||
string("\n"));
|
||||
retval.append("Detectors not added:\n" + std::string(getNotAddedList()) +
|
||||
std::string("\n"));
|
||||
critical = 1;
|
||||
}
|
||||
if (multiMask & MULTI_HAVE_DIFFERENT_VALUES) {
|
||||
@ -529,13 +529,13 @@ string multiSlsDetector::getErrorMessage(int& critical) {
|
||||
if (multiMask & (1 << idet)) {
|
||||
//append detector id
|
||||
sprintf(sNumber, "%d", idet);
|
||||
retval.append("Detector " + string(sNumber) + string(":\n"));
|
||||
retval.append("Detector " + std::string(sNumber) + std::string(":\n"));
|
||||
//get sls det error mask
|
||||
slsMask = detectors[idet]->getErrorMask();
|
||||
#ifdef VERYVERBOSE
|
||||
//append sls det error mask
|
||||
sprintf(sNumber, "0x%lx", slsMask);
|
||||
retval.append("Error Mask " + string(sNumber) + string("\n"));
|
||||
retval.append("Error Mask " + std::string(sNumber) + std::string("\n"));
|
||||
#endif
|
||||
//get the error critical level
|
||||
if ((slsMask > 0xFFFFFFFF) | critical)
|
||||
@ -643,7 +643,7 @@ void multiSlsDetector::freeSharedMemory(int multiId) {
|
||||
|
||||
void multiSlsDetector::freeSharedMemory() {
|
||||
// clear zmq vector
|
||||
for (vector<ZmqSocket*>::const_iterator it = zmqSocket.begin(); it != zmqSocket.end(); ++it) {
|
||||
for (std::vector<ZmqSocket*>::const_iterator it = zmqSocket.begin(); it != zmqSocket.end(); ++it) {
|
||||
delete(*it);
|
||||
}
|
||||
zmqSocket.clear();
|
||||
@ -652,7 +652,7 @@ void multiSlsDetector::freeSharedMemory() {
|
||||
clearAllErrorMask();
|
||||
|
||||
// clear sls detector vector shm
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
(*it)->freeSharedMemory();
|
||||
delete (*it);
|
||||
}
|
||||
@ -687,7 +687,7 @@ std::string multiSlsDetector::getUserDetails() {
|
||||
//type
|
||||
sstream<< "\nType: ";
|
||||
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it)
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it)
|
||||
sstream<< (*it)->sgetDetectorsType() << "+";
|
||||
//PID
|
||||
sstream << "\nPID: " << thisMultiDetector->lastPID
|
||||
@ -695,7 +695,7 @@ std::string multiSlsDetector::getUserDetails() {
|
||||
<< "\nUser: " << thisMultiDetector->lastUser
|
||||
<< "\nDate: " << thisMultiDetector->lastDate << endl;
|
||||
|
||||
string s = sstream.str();
|
||||
std::string s = sstream.str();
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -876,7 +876,7 @@ void multiSlsDetector::initializeMembers(bool verify) {
|
||||
badFFList = NULL;
|
||||
|
||||
//multiSlsDetector
|
||||
for (vector<ZmqSocket*>::const_iterator it = zmqSocket.begin(); it != zmqSocket.end(); ++it) {
|
||||
for (std::vector<ZmqSocket*>::const_iterator it = zmqSocket.begin(); it != zmqSocket.end(); ++it) {
|
||||
delete(*it);
|
||||
}
|
||||
zmqSocket.clear();
|
||||
@ -888,7 +888,7 @@ void multiSlsDetector::initializeMembers(bool verify) {
|
||||
detectors.push_back(sdet);
|
||||
} catch (...) {
|
||||
// clear detectors list
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
delete(*it);
|
||||
}
|
||||
detectors.clear();
|
||||
@ -951,21 +951,21 @@ void multiSlsDetector::setHostname(const char* name) {
|
||||
}
|
||||
|
||||
|
||||
string multiSlsDetector::getHostname(int pos) {
|
||||
std::string multiSlsDetector::getHostname(int pos) {
|
||||
return concatResultOrPos(&slsDetector::getHostname, pos);
|
||||
}
|
||||
|
||||
void multiSlsDetector::addMultipleDetectors(const char* name) {
|
||||
size_t p1 = 0;
|
||||
string temp = string(name);
|
||||
std::string temp = std::string(name);
|
||||
size_t p2 = temp.find('+', p1);
|
||||
//single
|
||||
if (p2 == string::npos) {
|
||||
if (p2 == std::string::npos) {
|
||||
addSlsDetector(temp);
|
||||
}
|
||||
// multi
|
||||
else {
|
||||
while(p2 != string::npos) {
|
||||
while(p2 != std::string::npos) {
|
||||
addSlsDetector(temp.substr(p1, p2-p1));
|
||||
temp = temp.substr(p2 + 1);
|
||||
p2 = temp.find('+');
|
||||
@ -982,7 +982,7 @@ void multiSlsDetector::addSlsDetector (std::string s) {
|
||||
#ifdef VERBOSE
|
||||
cout << "Adding detector " << s << endl;
|
||||
#endif
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
if ((*it)->getHostname((it-detectors.begin())) == s) {
|
||||
cout << "Detector " << s << "already part of the multiDetector!" << endl
|
||||
<< "Remove it before adding it back in a new position!" << endl;
|
||||
@ -1048,7 +1048,7 @@ void multiSlsDetector::createThreadPool() {
|
||||
threadpool = new ThreadPool(numthreads);
|
||||
switch (threadpool->initialize_threadpool()) {
|
||||
case 0:
|
||||
cerr << "Failed to initialize thread pool!" << endl;
|
||||
std::cerr << "Failed to initialize thread pool!" << endl;
|
||||
throw ThreadpoolException();
|
||||
case 1:
|
||||
#ifdef VERBOSE
|
||||
@ -1089,7 +1089,7 @@ void multiSlsDetector::getNumberOfDetectors(int& nx, int& ny) {
|
||||
|
||||
int multiSlsDetector::getNMods() {
|
||||
int nm = 0;
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
nm += (*it)->getNMods();
|
||||
}
|
||||
return nm;
|
||||
@ -1097,7 +1097,7 @@ int multiSlsDetector::getNMods() {
|
||||
|
||||
int multiSlsDetector::getNMod(dimension d) {
|
||||
int nm = 0;
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
nm += (*it)->getNMod(d);
|
||||
}
|
||||
return nm;
|
||||
@ -1105,7 +1105,7 @@ int multiSlsDetector::getNMod(dimension d) {
|
||||
|
||||
int multiSlsDetector::getMaxMods() {
|
||||
int ret = 0;
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
ret += (*it)->getMaxMods();
|
||||
}
|
||||
return ret;
|
||||
@ -1113,7 +1113,7 @@ int multiSlsDetector::getMaxMods() {
|
||||
|
||||
int multiSlsDetector::getMaxMod(dimension d) {
|
||||
int ret = 0, ret1;
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
ret1 = (*it)->getNMaxMod(d);
|
||||
#ifdef VERBOSE
|
||||
cout << "detector " << (it-detectors.begin()) << " maxmods " <<
|
||||
@ -1130,7 +1130,7 @@ int multiSlsDetector::getMaxMod(dimension d) {
|
||||
|
||||
int multiSlsDetector::getMaxNumberOfModules(dimension d) {
|
||||
int ret = 0;
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
ret += (*it)->getMaxNumberOfModules(d);
|
||||
}
|
||||
return ret;
|
||||
@ -1181,7 +1181,7 @@ int multiSlsDetector::getChansPerMod(int imod) {
|
||||
|
||||
int multiSlsDetector::getTotalNumberOfChannels() {
|
||||
thisMultiDetector->numberOfChannels = 0;
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
thisMultiDetector->numberOfChannels += (*it)->getTotalNumberOfChannels();
|
||||
}
|
||||
return thisMultiDetector->numberOfChannels;
|
||||
@ -1197,7 +1197,7 @@ int multiSlsDetector::getTotalNumberOfChannelsInclGapPixels(dimension d) {
|
||||
|
||||
int multiSlsDetector::getMaxNumberOfChannels() {
|
||||
thisMultiDetector->maxNumberOfChannels = 0;
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
thisMultiDetector->maxNumberOfChannels += (*it)->getMaxNumberOfChannels();
|
||||
}
|
||||
return thisMultiDetector->maxNumberOfChannels;
|
||||
@ -1401,10 +1401,10 @@ int multiSlsDetector::setOnline(int off) {
|
||||
}
|
||||
|
||||
|
||||
string multiSlsDetector::checkOnline() {
|
||||
string offlineDetectors = "";
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
string tmp = (*it)->checkOnline();
|
||||
std::string multiSlsDetector::checkOnline() {
|
||||
std::string offlineDetectors = "";
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
std::string tmp = (*it)->checkOnline();
|
||||
if (!tmp.empty())
|
||||
offlineDetectors += tmp + "+";
|
||||
}
|
||||
@ -1420,7 +1420,7 @@ int multiSlsDetector::lockServer(int p) {
|
||||
return callDetectorMember(&slsDetector::lockServer, p);
|
||||
}
|
||||
|
||||
string multiSlsDetector::getLastClientIP() {
|
||||
std::string multiSlsDetector::getLastClientIP() {
|
||||
return callDetectorMember(&slsDetector::getLastClientIP);
|
||||
}
|
||||
|
||||
@ -1434,26 +1434,26 @@ int multiSlsDetector::exitServer() {
|
||||
return ival;
|
||||
}
|
||||
|
||||
int multiSlsDetector::readConfigurationFile(string const fname) {
|
||||
int multiSlsDetector::readConfigurationFile(std::string const fname) {
|
||||
|
||||
freeSharedMemory();
|
||||
setupMultiDetector();
|
||||
|
||||
|
||||
multiSlsDetectorClient* cmd;
|
||||
string ans;
|
||||
string str;
|
||||
ifstream infile;
|
||||
std::string ans;
|
||||
std::string str;
|
||||
std::ifstream infile;
|
||||
int iargval;
|
||||
int interrupt = 0;
|
||||
char* args[1000];
|
||||
|
||||
char myargs[1000][1000];
|
||||
|
||||
string sargname, sargval;
|
||||
std::string sargname, sargval;
|
||||
int iline = 0;
|
||||
std::cout << "config file name " << fname << std::endl;
|
||||
infile.open(fname.c_str(), ios_base::in);
|
||||
infile.open(fname.c_str(), std::ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
|
||||
while (infile.good() and interrupt == 0) {
|
||||
@ -1463,7 +1463,7 @@ int multiSlsDetector::readConfigurationFile(string const fname) {
|
||||
++iline;
|
||||
|
||||
// remove comments that come after
|
||||
if (str.find('#') != string::npos)
|
||||
if (str.find('#') != std::string::npos)
|
||||
str.erase(str.find('#'));
|
||||
#ifdef VERBOSE
|
||||
std::cout << "string:" << str << std::endl;
|
||||
@ -1474,7 +1474,7 @@ int multiSlsDetector::readConfigurationFile(string const fname) {
|
||||
#endif
|
||||
continue;
|
||||
} else {
|
||||
istringstream ssstr(str);
|
||||
std::istringstream ssstr(str);
|
||||
iargval = 0;
|
||||
while (ssstr.good()) {
|
||||
ssstr >> sargname;
|
||||
@ -1524,9 +1524,9 @@ int multiSlsDetector::readConfigurationFile(string const fname) {
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::writeConfigurationFile(string const fname) {
|
||||
int multiSlsDetector::writeConfigurationFile(std::string const fname) {
|
||||
|
||||
string names[] = {
|
||||
std::string names[] = {
|
||||
"detsizechan",
|
||||
"hostname",
|
||||
"master",
|
||||
@ -1551,10 +1551,10 @@ int multiSlsDetector::writeConfigurationFile(string const fname) {
|
||||
}
|
||||
int ret = OK, ret1 = OK;
|
||||
|
||||
ofstream outfile;
|
||||
std::ofstream outfile;
|
||||
int iline = 0;
|
||||
|
||||
outfile.open(fname.c_str(), ios_base::out);
|
||||
outfile.open(fname.c_str(), std::ios_base::out);
|
||||
if (outfile.is_open()) {
|
||||
|
||||
slsDetectorCommand* cmd = new slsDetectorCommand(this);
|
||||
@ -1610,7 +1610,7 @@ int multiSlsDetector::writeConfigurationFile(string const fname) {
|
||||
|
||||
|
||||
|
||||
string multiSlsDetector::getSettingsFile() {
|
||||
std::string multiSlsDetector::getSettingsFile() {
|
||||
return callDetectorMember(&slsDetector::getSettingsFile);
|
||||
}
|
||||
|
||||
@ -1774,14 +1774,14 @@ slsDetectorDefs::detectorSettings multiSlsDetector::setSettings(detectorSettings
|
||||
}
|
||||
|
||||
|
||||
string multiSlsDetector::getSettingsDir() {
|
||||
std::string multiSlsDetector::getSettingsDir() {
|
||||
return callDetectorMember(&slsDetector::getSettingsDir);
|
||||
}
|
||||
|
||||
|
||||
string multiSlsDetector::setSettingsDir(string s) {
|
||||
std::string multiSlsDetector::setSettingsDir(std::string s) {
|
||||
|
||||
if (s.find('+') == string::npos) {
|
||||
if (s.find('+') == std::string::npos) {
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
detectors[idet]->setSettingsDir(s);
|
||||
if (detectors[idet]->getErrorMask())
|
||||
@ -1791,7 +1791,7 @@ string multiSlsDetector::setSettingsDir(string s) {
|
||||
size_t p1 = 0;
|
||||
size_t p2 = s.find('+', p1);
|
||||
int id = 0;
|
||||
while (p2 != string::npos) {
|
||||
while (p2 != std::string::npos) {
|
||||
detectors[id]->setSettingsDir(s.substr(p1, p2 - p1));
|
||||
if (detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask() | (1 << id));
|
||||
@ -1805,13 +1805,13 @@ string multiSlsDetector::setSettingsDir(string s) {
|
||||
return getSettingsDir();
|
||||
}
|
||||
|
||||
string multiSlsDetector::getCalDir() {
|
||||
std::string multiSlsDetector::getCalDir() {
|
||||
return callDetectorMember(&slsDetector::getCalDir);
|
||||
}
|
||||
|
||||
string multiSlsDetector::setCalDir(string s) {
|
||||
std::string multiSlsDetector::setCalDir(std::string s) {
|
||||
|
||||
if (s.find('+') == string::npos) {
|
||||
if (s.find('+') == std::string::npos) {
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
detectors[idet]->setCalDir(s);
|
||||
if (detectors[idet]->getErrorMask())
|
||||
@ -1821,7 +1821,7 @@ string multiSlsDetector::setCalDir(string s) {
|
||||
size_t p1 = 0;
|
||||
size_t p2 = s.find('+', p1);
|
||||
int id = 0;
|
||||
while (p2 != string::npos) {
|
||||
while (p2 != std::string::npos) {
|
||||
|
||||
if (detectors[id]) {
|
||||
detectors[id]->setCalDir(s.substr(p1, p2 - p1));
|
||||
@ -1839,7 +1839,7 @@ string multiSlsDetector::setCalDir(string s) {
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::loadSettingsFile(string fname, int imod) {
|
||||
int multiSlsDetector::loadSettingsFile(std::string fname, int imod) {
|
||||
int ret = OK;
|
||||
|
||||
// single
|
||||
@ -1864,7 +1864,7 @@ int multiSlsDetector::loadSettingsFile(string fname, int imod) {
|
||||
int* iret[detectors.size()];
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
iret[idet] = new int(OK);
|
||||
Task* task = new Task(new func2_t<int, string, int>(&slsDetector::loadSettingsFile,
|
||||
Task* task = new Task(new func2_t<int, std::string, int>(&slsDetector::loadSettingsFile,
|
||||
detectors[idet], fname, imod, iret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
@ -1884,7 +1884,7 @@ int multiSlsDetector::loadSettingsFile(string fname, int imod) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int multiSlsDetector::saveSettingsFile(string fname, int imod) {
|
||||
int multiSlsDetector::saveSettingsFile(std::string fname, int imod) {
|
||||
int id = -1, im = -1, ret;
|
||||
|
||||
if (decodeNMod(imod, id, im) >= 0) {
|
||||
@ -1905,7 +1905,7 @@ int multiSlsDetector::saveSettingsFile(string fname, int imod) {
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::loadCalibrationFile(string fname, int imod) {
|
||||
int multiSlsDetector::loadCalibrationFile(std::string fname, int imod) {
|
||||
int ret = OK;
|
||||
|
||||
// single
|
||||
@ -1931,7 +1931,7 @@ int multiSlsDetector::loadCalibrationFile(string fname, int imod) {
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
if (detectors[idet]) {
|
||||
iret[idet] = new int(OK);
|
||||
Task* task = new Task(new func2_t<int, string, int>(&slsDetector::loadCalibrationFile,
|
||||
Task* task = new Task(new func2_t<int, std::string, int>(&slsDetector::loadCalibrationFile,
|
||||
detectors[idet], fname, imod, iret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
@ -1954,7 +1954,7 @@ int multiSlsDetector::loadCalibrationFile(string fname, int imod) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int multiSlsDetector::saveCalibrationFile(string fname, int imod) {
|
||||
int multiSlsDetector::saveCalibrationFile(std::string fname, int imod) {
|
||||
int id = -1, im = -1, ret;
|
||||
if (decodeNMod(imod, id, im) >= 0) {
|
||||
if (id < 0 || id >= (int)detectors.size())
|
||||
@ -3030,21 +3030,21 @@ uint32_t multiSlsDetector::clearBit(uint32_t addr, int n) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
string multiSlsDetector::setNetworkParameter(networkParameter p, string s) {
|
||||
std::string multiSlsDetector::setNetworkParameter(networkParameter p, std::string s) {
|
||||
|
||||
if (s.find('+') == string::npos) {
|
||||
if (s.find('+') == std::string::npos) {
|
||||
|
||||
if (!threadpool) {
|
||||
cout << "Error in creating threadpool. Exiting" << endl;
|
||||
return getNetworkParameter(p);
|
||||
} else {
|
||||
string* sret[detectors.size()];
|
||||
std::string* sret[detectors.size()];
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
if (p == RECEIVER_STREAMING_PORT || p == CLIENT_STREAMING_PORT)
|
||||
s.append("multi\0");
|
||||
sret[idet] = new string("error");
|
||||
Task* task = new Task(new func2_t<string, networkParameter,
|
||||
string>(&slsDetector::setNetworkParameter,
|
||||
sret[idet] = new std::string("error");
|
||||
Task* task = new Task(new func2_t<std::string, networkParameter,
|
||||
std::string>(&slsDetector::setNetworkParameter,
|
||||
detectors[idet], p, s, sret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
@ -3063,7 +3063,7 @@ string multiSlsDetector::setNetworkParameter(networkParameter p, string s) {
|
||||
size_t p1 = 0;
|
||||
size_t p2 = s.find('+', p1);
|
||||
int id = 0;
|
||||
while (p2 != string::npos) {
|
||||
while (p2 != std::string::npos) {
|
||||
detectors[id]->setNetworkParameter(p, s.substr(p1, p2 - p1));
|
||||
if (detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask() | (1 << id));
|
||||
@ -3078,18 +3078,18 @@ string multiSlsDetector::setNetworkParameter(networkParameter p, string s) {
|
||||
return getNetworkParameter(p);
|
||||
}
|
||||
|
||||
string multiSlsDetector::getNetworkParameter(networkParameter p) {
|
||||
string s0 = "", s1 = "", s;
|
||||
string ans = "";
|
||||
std::string multiSlsDetector::getNetworkParameter(networkParameter p) {
|
||||
std::string s0 = "", s1 = "", s;
|
||||
std::string ans = "";
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
s = detectors[idet]->getNetworkParameter(p);
|
||||
if (detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask() | (1 << idet));
|
||||
|
||||
if (s0 == "")
|
||||
s0 = s + string("+");
|
||||
s0 = s + std::string("+");
|
||||
else
|
||||
s0 += s + string("+");
|
||||
s0 += s + std::string("+");
|
||||
|
||||
if (s1 == "")
|
||||
s1 = s;
|
||||
@ -3168,13 +3168,13 @@ int multiSlsDetector::executeTrimming(trimMode mode, int par1, int par2, int imo
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::loadImageToDetector(imageType index, string const fname) {
|
||||
int multiSlsDetector::loadImageToDetector(imageType index, std::string const fname) {
|
||||
|
||||
int ret = -100, ret1;
|
||||
short int imageVals[thisMultiDetector->numberOfChannels];
|
||||
|
||||
ifstream infile;
|
||||
infile.open(fname.c_str(), ios_base::in);
|
||||
std::ifstream infile;
|
||||
infile.open(fname.c_str(), std::ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << std::endl
|
||||
@ -3204,11 +3204,11 @@ int multiSlsDetector::loadImageToDetector(imageType index, string const fname) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int multiSlsDetector::writeCounterBlockFile(string const fname, int startACQ) {
|
||||
int multiSlsDetector::writeCounterBlockFile(std::string const fname, int startACQ) {
|
||||
int ret = OK, ret1 = OK;
|
||||
short int arg[thisMultiDetector->numberOfChannels];
|
||||
ofstream outfile;
|
||||
outfile.open(fname.c_str(), ios_base::out);
|
||||
std::ofstream outfile;
|
||||
outfile.open(fname.c_str(), std::ios_base::out);
|
||||
if (outfile.is_open()) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << std::endl
|
||||
@ -3872,7 +3872,7 @@ int multiSlsDetector::setStoragecellStart(int pos) {
|
||||
return parallelCallDetectorMember(&slsDetector::setStoragecellStart, pos);
|
||||
}
|
||||
|
||||
int multiSlsDetector::programFPGA(string fname) {
|
||||
int multiSlsDetector::programFPGA(std::string fname) {
|
||||
int ret = OK, ret1 = OK;
|
||||
|
||||
for (unsigned int i = 0; i < detectors.size(); ++i) {
|
||||
@ -4173,14 +4173,14 @@ int multiSlsDetector::rateCorrect(double* datain, double* errin, double* dataout
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::setFlatFieldCorrection(string fname) {
|
||||
int multiSlsDetector::setFlatFieldCorrection(std::string fname) {
|
||||
double* data = new double[thisMultiDetector->numberOfChannels];
|
||||
double* ffcoefficients = new double[thisMultiDetector->numberOfChannels];
|
||||
double* fferrors = new double[thisMultiDetector->numberOfChannels];
|
||||
char ffffname[MAX_STR_LENGTH * 2];
|
||||
int nch;
|
||||
if (fname == "default") {
|
||||
fname = string(thisMultiDetector->flatFieldFile);
|
||||
fname = std::string(thisMultiDetector->flatFieldFile);
|
||||
}
|
||||
|
||||
thisMultiDetector->correctionMask &= ~(1 << FLAT_FIELD_CORRECTION);
|
||||
@ -4200,7 +4200,7 @@ int multiSlsDetector::setFlatFieldCorrection(string fname) {
|
||||
std::cout << "Setting flat field correction from file " << fname << std::endl;
|
||||
#endif
|
||||
sprintf(ffffname, "%s/%s", thisMultiDetector->flatFieldDir, fname.c_str());
|
||||
nch = readDataFile(string(ffffname), data);
|
||||
nch = readDataFile(std::string(ffffname), data);
|
||||
|
||||
if (nch > thisMultiDetector->numberOfChannels)
|
||||
nch = thisMultiDetector->numberOfChannels;
|
||||
@ -4298,7 +4298,7 @@ int multiSlsDetector::flatFieldCorrect(double* datain, double* errin, double* da
|
||||
return 0;
|
||||
}
|
||||
|
||||
int multiSlsDetector::setBadChannelCorrection(string fname) {
|
||||
int multiSlsDetector::setBadChannelCorrection(std::string fname) {
|
||||
int badlist[MAX_BADCHANS];
|
||||
int nbad = 0;
|
||||
int ret = 0;
|
||||
@ -4306,7 +4306,7 @@ int multiSlsDetector::setBadChannelCorrection(string fname) {
|
||||
cout << thisMultiDetector->badChanFile << endl;
|
||||
|
||||
if (fname == "default")
|
||||
fname = string(thisMultiDetector->badChanFile);
|
||||
fname = std::string(thisMultiDetector->badChanFile);
|
||||
|
||||
ret = setBadChannelCorrection(fname, nbad, badlist);
|
||||
//#ifdef VERBOSE
|
||||
@ -4428,11 +4428,11 @@ int multiSlsDetector::getBadChannelCorrection(int* bad) {
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::readAngularConversionFile(string fname) {
|
||||
int multiSlsDetector::readAngularConversionFile(std::string fname) {
|
||||
|
||||
ifstream infile;
|
||||
std::ifstream infile;
|
||||
//int nm=0;
|
||||
infile.open(fname.c_str(), ios_base::in);
|
||||
infile.open(fname.c_str(), std::ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
@ -4451,11 +4451,11 @@ int multiSlsDetector::readAngularConversionFile(string fname) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int multiSlsDetector::writeAngularConversion(string fname) {
|
||||
int multiSlsDetector::writeAngularConversion(std::string fname) {
|
||||
|
||||
ofstream outfile;
|
||||
std::ofstream outfile;
|
||||
// int nm=0;
|
||||
outfile.open(fname.c_str(), ios_base::out);
|
||||
outfile.open(fname.c_str(), std::ios_base::out);
|
||||
if (outfile.is_open()) {
|
||||
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
@ -4548,8 +4548,8 @@ int multiSlsDetector::setReceiverOnline(int off) {
|
||||
return thisMultiDetector->receiverOnlineFlag;
|
||||
}
|
||||
|
||||
string multiSlsDetector::checkReceiverOnline() {
|
||||
string retval1 = "", retval;
|
||||
std::string multiSlsDetector::checkReceiverOnline() {
|
||||
std::string retval1 = "", retval;
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
retval = detectors[idet]->checkReceiverOnline();
|
||||
if (!retval.empty()) {
|
||||
@ -4564,7 +4564,7 @@ int multiSlsDetector::lockReceiver(int lock) {
|
||||
return callDetectorMember(&slsDetector::lockReceiver, lock);
|
||||
}
|
||||
|
||||
string multiSlsDetector::getReceiverLastClientIP() {
|
||||
std::string multiSlsDetector::getReceiverLastClientIP() {
|
||||
return callDetectorMember(&slsDetector::getReceiverLastClientIP);
|
||||
}
|
||||
|
||||
@ -4583,9 +4583,9 @@ std::string multiSlsDetector::getFilePath() {
|
||||
return setFilePath();
|
||||
}
|
||||
|
||||
string multiSlsDetector::setFilePath(string s) {
|
||||
std::string multiSlsDetector::setFilePath(std::string s) {
|
||||
|
||||
string ret = "errorerror", ret1;
|
||||
std::string ret = "errorerror", ret1;
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
ret1 = detectors[idet]->setFilePath(s);
|
||||
if (detectors[idet]->getErrorMask())
|
||||
@ -4603,9 +4603,9 @@ std::string multiSlsDetector::getFileName() {
|
||||
return setFileName();
|
||||
}
|
||||
|
||||
string multiSlsDetector::setFileName(string s) {
|
||||
std::string multiSlsDetector::setFileName(std::string s) {
|
||||
|
||||
string ret = "error";
|
||||
std::string ret = "error";
|
||||
int posmax = detectors.size();
|
||||
|
||||
if (!s.empty()) {
|
||||
@ -4616,12 +4616,12 @@ string multiSlsDetector::setFileName(string s) {
|
||||
|
||||
if (!threadpool) {
|
||||
cout << "Error in creating threadpool. Exiting" << endl;
|
||||
return string("");
|
||||
return std::string("");
|
||||
} else {
|
||||
string* sret[detectors.size()];
|
||||
std::string* sret[detectors.size()];
|
||||
for (int idet = 0; idet < posmax; ++idet) {
|
||||
sret[idet] = new string("error");
|
||||
Task* task = new Task(new func1_t<string, string>(&slsDetector::setFileName,
|
||||
sret[idet] = new std::string("error");
|
||||
Task* task = new Task(new func1_t<std::string, std::string>(&slsDetector::setFileName,
|
||||
detectors[idet], s, sret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
@ -4928,7 +4928,7 @@ int multiSlsDetector::createReceivingDataSockets(const bool destroy) {
|
||||
if (destroy) {
|
||||
cprintf(MAGENTA, "Going to destroy data sockets\n");
|
||||
//close socket
|
||||
for (vector<ZmqSocket*>::const_iterator it = zmqSocket.begin(); it != zmqSocket.end(); ++it) {
|
||||
for (std::vector<ZmqSocket*>::const_iterator it = zmqSocket.begin(); it != zmqSocket.end(); ++it) {
|
||||
(*it)->Close();
|
||||
delete(*it);
|
||||
}
|
||||
@ -5010,7 +5010,7 @@ void multiSlsDetector::readFrameFromReceiver() {
|
||||
uint32_t size = 0, nPixelsX = 0, nPixelsY = 0, dynamicRange = 0;
|
||||
float bytesPerPixel = 0;
|
||||
// header info every header
|
||||
string currentFileName = "";
|
||||
std::string currentFileName = "";
|
||||
uint64_t currentAcquisitionIndex = -1, currentFrameIndex = -1, currentFileIndex = -1;
|
||||
uint32_t currentSubFrameIndex = -1, coordX = -1, coordY = -1, flippedDataX = -1;
|
||||
|
||||
@ -5375,7 +5375,7 @@ int multiSlsDetector::setReceiverSilentMode(int i) {
|
||||
return callDetectorMember(&slsDetector::setReceiverSilentMode, i);
|
||||
}
|
||||
|
||||
int multiSlsDetector::setCTBPattern(string fname) {
|
||||
int multiSlsDetector::setCTBPattern(std::string fname) {
|
||||
uint64_t word;
|
||||
int addr = 0;
|
||||
FILE* fd = fopen(fname.c_str(), "r");
|
||||
|
@ -19,7 +19,7 @@ class multiSlsDetectorClient {
|
||||
|
||||
public:
|
||||
multiSlsDetectorClient(int argc, char *argv[], int action, multiSlsDetector *myDetector=NULL) { \
|
||||
string answer; \
|
||||
std::string answer; \
|
||||
multiSlsDetectorCommand *myCmd; \
|
||||
int id = -1, pos = -1, iv = 0; \
|
||||
bool verify = true, update = true; \
|
||||
@ -90,7 +90,7 @@ public:
|
||||
strcpy(cmd, argv[0]); \
|
||||
} \
|
||||
// special commands
|
||||
string scmd = cmd; \
|
||||
std::string scmd = cmd; \
|
||||
// free without calling multiSlsDetector constructor
|
||||
if (scmd == "free") { \
|
||||
if (pos != -1) \
|
||||
|
@ -28,8 +28,8 @@ class multiSlsDetectorCommand : public slsDetectorCommand {
|
||||
/* \returns answer string */
|
||||
/* *\/ */
|
||||
|
||||
string executeLine(int narg, char *args[], int action, int id=-1) { \
|
||||
string s; \
|
||||
std::string executeLine(int narg, char *args[], int action, int id=-1) { \
|
||||
std::string s; \
|
||||
if (id>=0) {
|
||||
slsDetector *d=myDet->getSlsDetector(id); \
|
||||
if (d) { \
|
||||
@ -39,7 +39,7 @@ class multiSlsDetectorCommand : public slsDetectorCommand {
|
||||
myDet->setErrorMask((myDet->getErrorMask())|(1<<id)); \
|
||||
delete cmd;
|
||||
} else
|
||||
s=string("detector does no exist"); \
|
||||
s=std::string("detector does no exist"); \
|
||||
} else \
|
||||
s=slsDetectorCommand::executeLine(narg,args,action); \
|
||||
return s;
|
||||
@ -48,13 +48,13 @@ class multiSlsDetectorCommand : public slsDetectorCommand {
|
||||
/**
|
||||
* calls executeLine with PUT_ACTION
|
||||
*/
|
||||
string putCommand(int narg, char *args[], int pos=-1){\
|
||||
std::string putCommand(int narg, char *args[], int pos=-1){\
|
||||
return executeLine(narg, args,slsDetectorDefs::PUT_ACTION,pos);\
|
||||
};
|
||||
/**
|
||||
* calls executeLine with GET_ACTION
|
||||
*/
|
||||
string getCommand(int narg, char *args[], int pos=-1){\
|
||||
std::string getCommand(int narg, char *args[], int pos=-1){\
|
||||
return executeLine(narg, args,slsDetectorDefs::GET_ACTION,pos);\
|
||||
};
|
||||
|
||||
|
@ -4149,22 +4149,6 @@ int slsDetector::configureMAC() {
|
||||
std::cout<< "Configuring MAC failed " << std::endl;
|
||||
setErrorMask((getErrorMask())|(COULD_NOT_CONFIGURE_MAC));
|
||||
}
|
||||
else if (thisDetector->myDetectorType==GOTTHARD){
|
||||
|
||||
// update roi in update receiver
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
int fnum=F_RECEIVER_SHORT_FRAME;
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending adc val to receiver " << retval << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->sendInt(fnum,retval,retval);
|
||||
disconnectData();
|
||||
}
|
||||
if(ret==FAIL)
|
||||
setErrorMask((getErrorMask())|(COULDNOT_SET_ROI));
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -5316,6 +5300,9 @@ string slsDetector::setReceiver(string receiverIP) {
|
||||
setReceiverStreamingIP(getReceiverStreamingIP());
|
||||
setAdditionalJsonHeader(getAdditionalJsonHeader());
|
||||
enableDataStreamingFromReceiver(enableDataStreamingFromReceiver(-1));
|
||||
|
||||
if(thisDetector->myDetectorType == GOTTHARD)
|
||||
sendROI(-1, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6060,9 +6047,6 @@ int slsDetector::setROI(int n,ROI roiLimits[]) {
|
||||
}
|
||||
|
||||
ret = sendROI(n,roiLimits);
|
||||
if(ret==FAIL)
|
||||
setErrorMask((getErrorMask())|(COULDNOT_SET_ROI));
|
||||
|
||||
|
||||
if(thisDetector->myDetectorType==JUNGFRAUCTB) getTotalNumberOfChannels();
|
||||
return ret;
|
||||
@ -6141,9 +6125,25 @@ int slsDetector::sendROI(int n,ROI roiLimits[]) {
|
||||
<<roiLimits[j].ymin<<"\t"<<roiLimits[j].ymax<<")"<<endl;
|
||||
#endif
|
||||
|
||||
// update receiver
|
||||
if (thisDetector->myDetectorType == GOTTHARD)
|
||||
// old firmware requires configuremac after setting roi
|
||||
if (thisDetector->myDetectorType == GOTTHARD) {
|
||||
configureMAC();
|
||||
}
|
||||
|
||||
// update roi in receiver
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
int fnum=F_RECEIVER_SET_ROI;
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending ROI to receiver " << thisDetector->nROI << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->sendROI(fnum, thisDetector->nROI, thisDetector->roiLimits);
|
||||
disconnectData();
|
||||
}
|
||||
if(ret==FAIL)
|
||||
setErrorMask((getErrorMask())|(COULDNOT_SET_ROI));
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -519,7 +519,7 @@ public:
|
||||
* @param pos insignificant
|
||||
* @returns hostname
|
||||
*/
|
||||
string getHostname(int pos = -1);
|
||||
std::string getHostname(int pos = -1);
|
||||
|
||||
/**
|
||||
* Appends detectors to the end of the list in shared memory
|
||||
@ -582,7 +582,7 @@ public:
|
||||
* @param type string of detector type
|
||||
* @returns detector type in receiver
|
||||
*/
|
||||
int setDetectorType(string stype);
|
||||
int setDetectorType(std::string stype);
|
||||
|
||||
/**
|
||||
* Get Detector type from shared memory variable
|
||||
@ -596,14 +596,14 @@ public:
|
||||
* @param pos insignificant
|
||||
* @returns string version of detector type from shared memory variable
|
||||
*/
|
||||
string sgetDetectorsType(int pos=-1);
|
||||
std::string sgetDetectorsType(int pos=-1);
|
||||
|
||||
/**
|
||||
* Just to overload getDetectorType from users
|
||||
* Gets string version of detector type from shared memory variable
|
||||
* @returns gets string version of detector type from shared memory variable
|
||||
*/
|
||||
string getDetectorType();
|
||||
std::string getDetectorType();
|
||||
|
||||
/**
|
||||
* Returns number of modules from shared memory (Mythen)
|
||||
@ -768,7 +768,7 @@ public:
|
||||
* @returns empty string if it is online
|
||||
* else returns hostnameif it is offline
|
||||
*/
|
||||
string checkOnline();
|
||||
std::string checkOnline();
|
||||
|
||||
/**
|
||||
* Configure the TCP socket communciation and initializes the socket instances
|
||||
@ -778,7 +778,7 @@ public:
|
||||
* @returns OK or FAIL
|
||||
* \sa sharedSlsDetector
|
||||
*/
|
||||
int setTCPSocket(string const name="", int const control_port=-1, int const stop_port=-1);
|
||||
int setTCPSocket(std::string const name="", int const control_port=-1, int const stop_port=-1);
|
||||
|
||||
|
||||
/**
|
||||
@ -818,7 +818,7 @@ public:
|
||||
* Get last client IP saved on detector server
|
||||
* @returns last client IP saved on detector server
|
||||
*/
|
||||
string getLastClientIP();
|
||||
std::string getLastClientIP();
|
||||
|
||||
/**
|
||||
* Exit detector server
|
||||
@ -833,7 +833,7 @@ public:
|
||||
* @param answer is the answer from the detector
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int execCommand(string cmd, string answer);
|
||||
int execCommand(std::string cmd, std::string answer);
|
||||
|
||||
/**
|
||||
* Updates some of the shared memory receiving the data from the detector
|
||||
@ -854,14 +854,14 @@ public:
|
||||
* @param fname configuration file name
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int readConfigurationFile(string const fname);
|
||||
int readConfigurationFile(std::string const fname);
|
||||
|
||||
/**
|
||||
* Load configuration from a stream
|
||||
* @param infile stream
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int readConfigurationFile(ifstream &infile);
|
||||
int readConfigurationFile(std::ifstream &infile);
|
||||
|
||||
/**
|
||||
* Write current configuration to a file
|
||||
@ -869,7 +869,7 @@ public:
|
||||
* @param fname configuration file name
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int writeConfigurationFile(string const fname);
|
||||
int writeConfigurationFile(std::string const fname);
|
||||
|
||||
/**
|
||||
* Write current configuration to a stream
|
||||
@ -877,13 +877,13 @@ public:
|
||||
* @param id detector id
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int writeConfigurationFile(ofstream &outfile, int id=-1);
|
||||
int writeConfigurationFile(std::ofstream &outfile, int id=-1);
|
||||
|
||||
/**
|
||||
* Returns the trimfile or settings file name (Useless??)
|
||||
* @returns the trimfile or settings file name
|
||||
*/
|
||||
string getSettingsFile();
|
||||
std::string getSettingsFile();
|
||||
|
||||
/**
|
||||
* Writes a trim/settings file for module number imod,
|
||||
@ -896,7 +896,7 @@ public:
|
||||
* \sa ::sls_detector_module sharedSlsDetector mythenDetector::writeSettingsFile(string, int)
|
||||
*/
|
||||
using energyConversion::writeSettingsFile;
|
||||
int writeSettingsFile(string fname, int imod, int iodelay, int tau);
|
||||
int writeSettingsFile(std::string fname, int imod, int iodelay, int tau);
|
||||
|
||||
/**
|
||||
* Get detector settings
|
||||
@ -965,7 +965,7 @@ public:
|
||||
* @param s trimbits/settings directory
|
||||
* @returns the trimbit/settings directory
|
||||
*/
|
||||
std::string setSettingsDir(string s);
|
||||
std::string setSettingsDir(std::string s);
|
||||
|
||||
/**
|
||||
* Returns the calibration files directory \sa sharedSlsDetector (Mythen)
|
||||
@ -978,7 +978,7 @@ public:
|
||||
* @param s the calibration files directory
|
||||
* @returns the calibration files directory
|
||||
*/
|
||||
std::string setCalDir(string s);
|
||||
std::string setCalDir(std::string s);
|
||||
|
||||
/**
|
||||
* Loads the modules settings/trimbits reading from a specific file
|
||||
@ -988,7 +988,7 @@ public:
|
||||
* from which will be calculated the detector index and the module index (-1 for all)
|
||||
* returns OK or FAIL
|
||||
*/
|
||||
int loadSettingsFile(string fname, int imod=-1);
|
||||
int loadSettingsFile(std::string fname, int imod=-1);
|
||||
|
||||
/**
|
||||
* Saves the modules settings/trimbits to a specific file
|
||||
@ -997,7 +997,7 @@ public:
|
||||
* @param imod module number (-1 for all)
|
||||
* returns OK or FAIL
|
||||
*/
|
||||
int saveSettingsFile(string fname, int imod=-1);
|
||||
int saveSettingsFile(std::string fname, int imod=-1);
|
||||
|
||||
/**
|
||||
* Loads the modules calibration data reading from a specific file (Mythen)
|
||||
@ -1006,7 +1006,7 @@ public:
|
||||
* @param imod module number (-1 for all)
|
||||
* returns OK or FAIL
|
||||
*/
|
||||
int loadCalibrationFile(string fname, int imod=-1);
|
||||
int loadCalibrationFile(std::string fname, int imod=-1);
|
||||
|
||||
/**
|
||||
* Saves the modules calibration data to a specific file (Mythen)
|
||||
@ -1015,7 +1015,7 @@ public:
|
||||
* @param imod module number (-1 for all)
|
||||
* returns OK or FAIL
|
||||
*/
|
||||
int saveCalibrationFile(string fname, int imod=-1);
|
||||
int saveCalibrationFile(std::string fname, int imod=-1);
|
||||
|
||||
/**
|
||||
* Sets/gets the detector in position i as master of the structure (Mythen)
|
||||
@ -1275,94 +1275,94 @@ public:
|
||||
* @param s network parameter value
|
||||
* @returns network parameter value set (from getNetworkParameter)
|
||||
*/
|
||||
string setNetworkParameter(networkParameter index, string value);
|
||||
std::string setNetworkParameter(networkParameter index, std::string value);
|
||||
|
||||
/**
|
||||
* Get network parameter
|
||||
* @param p network parameter type
|
||||
* @returns network parameter value set (from getNetworkParameter)
|
||||
*/
|
||||
string getNetworkParameter(networkParameter index);
|
||||
std::string getNetworkParameter(networkParameter index);
|
||||
|
||||
/**
|
||||
* Returns the detector MAC address\sa sharedSlsDetector
|
||||
* @returns the detector MAC address
|
||||
*/
|
||||
string getDetectorMAC();
|
||||
std::string getDetectorMAC();
|
||||
|
||||
/**
|
||||
* Returns the detector IP address\sa sharedSlsDetector
|
||||
* @returns the detector IP address
|
||||
*/
|
||||
string getDetectorIP();
|
||||
std::string getDetectorIP();
|
||||
|
||||
/**
|
||||
* Returns the receiver IP address\sa sharedSlsDetector
|
||||
* @returns the receiver IP address
|
||||
*/
|
||||
string getReceiver();
|
||||
std::string getReceiver();
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP IP address\sa sharedSlsDetector
|
||||
* @returns the receiver UDP IP address
|
||||
*/
|
||||
string getReceiverUDPIP();
|
||||
std::string getReceiverUDPIP();
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP MAC address\sa sharedSlsDetector
|
||||
* @returns the receiver UDP MAC address
|
||||
*/
|
||||
string getReceiverUDPMAC();
|
||||
std::string getReceiverUDPMAC();
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP port\sa sharedSlsDetector
|
||||
* @returns the receiver UDP port
|
||||
*/
|
||||
string getReceiverUDPPort();
|
||||
std::string getReceiverUDPPort();
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP port 2 of same interface\sa sharedSlsDetector
|
||||
* @returns the receiver UDP port 2 of same interface
|
||||
*/
|
||||
string getReceiverUDPPort2();
|
||||
std::string getReceiverUDPPort2();
|
||||
|
||||
/**
|
||||
* Returns the client zmq port \sa sharedSlsDetector
|
||||
* @returns the client zmq port
|
||||
*/
|
||||
string getClientStreamingPort();
|
||||
std::string getClientStreamingPort();
|
||||
|
||||
/**
|
||||
* Returns the receiver zmq port \sa sharedSlsDetector
|
||||
* @returns the receiver zmq port
|
||||
*/
|
||||
string getReceiverStreamingPort();
|
||||
std::string getReceiverStreamingPort();
|
||||
|
||||
/**
|
||||
* Returns the client zmq ip \sa sharedSlsDetector
|
||||
* @returns the client zmq ip, returns "none" if default setting and no custom ip set
|
||||
*/
|
||||
string getClientStreamingIP();
|
||||
std::string getClientStreamingIP();
|
||||
|
||||
/**
|
||||
* Returns the receiver zmq ip \sa sharedSlsDetector
|
||||
* @returns the receiver zmq ip, returns "none" if default setting and no custom ip set
|
||||
*/
|
||||
string getReceiverStreamingIP();
|
||||
std::string getReceiverStreamingIP();
|
||||
|
||||
/**
|
||||
* Validates the format of the detector MAC address and sets it \sa sharedSlsDetector
|
||||
* @param detectorMAC detector MAC address
|
||||
* @returns the detector MAC address
|
||||
*/
|
||||
string setDetectorMAC(string detectorMAC);
|
||||
std::string setDetectorMAC(std::string detectorMAC);
|
||||
|
||||
/**
|
||||
* Validates the format of the detector IP address and sets it \sa sharedSlsDetector
|
||||
* @param detectorIP detector IP address
|
||||
* @returns the detector IP address
|
||||
*/
|
||||
string setDetectorIP(string detectorIP);
|
||||
std::string setDetectorIP(std::string detectorIP);
|
||||
|
||||
/**
|
||||
* Validates and sets the receiver.
|
||||
@ -1371,21 +1371,21 @@ public:
|
||||
* @param receiver receiver hostname or IP address
|
||||
* @returns the receiver IP address from shared memory
|
||||
*/
|
||||
string setReceiver(string receiver);
|
||||
std::string setReceiver(std::string receiver);
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
string setReceiverUDPIP(string udpip);
|
||||
std::string setReceiverUDPIP(std::string udpip);
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
string setReceiverUDPMAC(string udpmac);
|
||||
std::string setReceiverUDPMAC(std::string udpmac);
|
||||
|
||||
/**
|
||||
* Sets the receiver UDP port\sa sharedSlsDetector
|
||||
@ -1407,7 +1407,7 @@ public:
|
||||
* calculate individual ports)
|
||||
* @returns the client zmq port
|
||||
*/
|
||||
string setClientStreamingPort(string port);
|
||||
std::string setClientStreamingPort(std::string port);
|
||||
|
||||
/**
|
||||
* Sets the receiver zmq port\sa sharedSlsDetector
|
||||
@ -1415,21 +1415,21 @@ public:
|
||||
* calculate individual ports)
|
||||
* @returns the receiver zmq port
|
||||
*/
|
||||
string setReceiverStreamingPort(string port);
|
||||
std::string setReceiverStreamingPort(std::string port);
|
||||
|
||||
/**
|
||||
* Sets the client zmq ip\sa sharedSlsDetector
|
||||
* @param sourceIP client zmq ip
|
||||
* @returns the client zmq ip, returns "none" if default setting and no custom ip set
|
||||
*/
|
||||
string setClientStreamingIP(string sourceIP);
|
||||
std::string setClientStreamingIP(std::string sourceIP);
|
||||
|
||||
/**
|
||||
* Sets the receiver zmq ip\sa sharedSlsDetector
|
||||
* @param sourceIP receiver zmq ip. If empty, uses rx_hostname
|
||||
* @returns the receiver zmq ip, returns "none" if default setting and no custom ip set
|
||||
*/
|
||||
string setReceiverStreamingIP(string sourceIP);
|
||||
std::string setReceiverStreamingIP(std::string sourceIP);
|
||||
|
||||
/**
|
||||
* Execute a digital test (Gotthard, Mythen)
|
||||
@ -1455,7 +1455,7 @@ public:
|
||||
* @param fname file name from which to load image
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int loadImageToDetector(imageType index,string const fname);
|
||||
int loadImageToDetector(imageType index,std::string const fname);
|
||||
|
||||
/**
|
||||
* Called from loadImageToDetector to send the image to detector
|
||||
@ -1471,7 +1471,7 @@ public:
|
||||
* @param startACQ is 1 to start acquisition after reading counter
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int writeCounterBlockFile(string const fname,int startACQ=0);
|
||||
int writeCounterBlockFile(std::string const fname,int startACQ=0);
|
||||
|
||||
/**
|
||||
* Gets counter memory block in detector (Gotthard)
|
||||
@ -1658,7 +1658,7 @@ public:
|
||||
* @param fname file name
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int programFPGA(string fname);
|
||||
int programFPGA(std::string fname);
|
||||
|
||||
/**
|
||||
* Resets FPGA (Jungfrau)
|
||||
@ -1845,7 +1845,7 @@ public:
|
||||
* @param fname name of the flat field file (or "" if disable)
|
||||
* @returns 0 if disable (or file could not be read), >0 otherwise
|
||||
*/
|
||||
int setFlatFieldCorrection(string fname="");
|
||||
int setFlatFieldCorrection(std::string fname="");
|
||||
|
||||
/**
|
||||
* Set flat field corrections (Mythen)
|
||||
@ -1880,7 +1880,7 @@ public:
|
||||
* @param fname file with bad channel list ("" disable)
|
||||
* @returns 0 if bad channel disabled, >0 otherwise
|
||||
*/
|
||||
int setBadChannelCorrection(string fname="");
|
||||
int setBadChannelCorrection(std::string fname="");
|
||||
|
||||
/**
|
||||
* Set bad channels correction (Mythen)
|
||||
@ -1905,7 +1905,7 @@ public:
|
||||
* @param fname file to be read
|
||||
* @returns 0 if angular conversion disabled, >0 otherwise
|
||||
*/
|
||||
int readAngularConversionFile(string fname="");
|
||||
int readAngularConversionFile(std::string fname="");
|
||||
|
||||
/**
|
||||
* Reads an angular conversion file (Mythen, Gotthard)
|
||||
@ -1913,7 +1913,7 @@ public:
|
||||
* @param ifs input stream
|
||||
* @returns 0 if angular conversion disabled, >0 otherwise
|
||||
*/
|
||||
int readAngularConversion(ifstream& ifs);
|
||||
int readAngularConversion(std::ifstream& ifs);
|
||||
|
||||
/**
|
||||
* Writes an angular conversion file (Mythen, Gotthard)
|
||||
@ -1921,7 +1921,7 @@ public:
|
||||
* @param fname file to be written
|
||||
* @returns 0 if angular conversion disabled, >0 otherwise
|
||||
*/
|
||||
int writeAngularConversion(string fname="");
|
||||
int writeAngularConversion(std::string fname="");
|
||||
|
||||
/**
|
||||
* Writes an angular conversion file (Mythen, Gotthard)
|
||||
@ -1929,7 +1929,7 @@ public:
|
||||
* @param ofs output stream
|
||||
* @returns 0 if angular conversion disabled, >0 otherwise
|
||||
*/
|
||||
int writeAngularConversion(ofstream &ofs);
|
||||
int writeAngularConversion(std::ofstream &ofs);
|
||||
|
||||
/**
|
||||
* Get angular conversion (Mythen, Gotthard)
|
||||
@ -1965,7 +1965,7 @@ public:
|
||||
* Checks if the receiver is really online
|
||||
* @returns empty string if online, else returns receiver hostname
|
||||
*/
|
||||
string checkReceiverOnline();
|
||||
std::string checkReceiverOnline();
|
||||
|
||||
/**
|
||||
* Configure the socket communication and initializes the socket instances
|
||||
@ -1974,7 +1974,7 @@ public:
|
||||
* @returns OK is connection succeded, FAIL otherwise
|
||||
* \sa sharedSlsDetector
|
||||
*/
|
||||
int setReceiverTCPSocket(string const name="", int const receiver_port=-1);
|
||||
int setReceiverTCPSocket(std::string const name="", int const receiver_port=-1);
|
||||
|
||||
/**
|
||||
* Locks/Unlocks the connection to the receiver
|
||||
@ -1987,7 +1987,7 @@ public:
|
||||
* Returns the IP of the last client connecting to the receiver
|
||||
* @returns the IP of the last client connecting to the receiver
|
||||
*/
|
||||
string getReceiverLastClientIP();
|
||||
std::string getReceiverLastClientIP();
|
||||
|
||||
/**
|
||||
* Exits the receiver TCP server
|
||||
@ -2028,27 +2028,27 @@ public:
|
||||
* Returns output file directory
|
||||
* @returns output file directory
|
||||
*/
|
||||
string getFilePath();
|
||||
std::string getFilePath();
|
||||
|
||||
/**
|
||||
* Sets up the file directory
|
||||
* @param s file directory
|
||||
* @returns file dir
|
||||
*/
|
||||
string setFilePath(string s="");
|
||||
std::string setFilePath(std::string s="");
|
||||
|
||||
/**
|
||||
* Returns file name prefix
|
||||
* @returns file name prefix
|
||||
*/
|
||||
string getFileName();
|
||||
std::string getFileName();
|
||||
|
||||
/**
|
||||
* Sets up the file name prefix
|
||||
* @param s file name prefix
|
||||
* @returns file name prefix
|
||||
*/
|
||||
string setFileName(string s="");
|
||||
std::string setFileName(std::string s="");
|
||||
|
||||
/**
|
||||
* Sets the max frames per file in receiver
|
||||
@ -2236,7 +2236,7 @@ public:
|
||||
* @param fname pattern file to open
|
||||
* @returns OK/FAIL
|
||||
*/
|
||||
int setCTBPattern(string fname);
|
||||
int setCTBPattern(std::string fname);
|
||||
|
||||
/**
|
||||
* Writes a pattern word to the CTB
|
||||
@ -2394,33 +2394,33 @@ private:
|
||||
* Returns the additional json header \sa sharedSlsDetector
|
||||
* @returns the additional json header, returns "none" if default setting and no custom ip set
|
||||
*/
|
||||
string getAdditionalJsonHeader();
|
||||
std::string getAdditionalJsonHeader();
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP socket buffer size\sa sharedSlsDetector
|
||||
* @returns the receiver UDP socket buffer size
|
||||
*/
|
||||
string getReceiverUDPSocketBufferSize() ;
|
||||
std::string getReceiverUDPSocketBufferSize() ;
|
||||
|
||||
/**
|
||||
* Returns the receiver real UDP socket buffer size\sa sharedSlsDetector
|
||||
* @returns the receiver real UDP socket buffer size
|
||||
*/
|
||||
string getReceiverRealUDPSocketBufferSize();
|
||||
std::string getReceiverRealUDPSocketBufferSize();
|
||||
|
||||
/**
|
||||
* Sets the additional json header\sa sharedSlsDetector
|
||||
* @param jsonheader additional json header
|
||||
* @returns additional json header, returns "none" if default setting and no custom ip set
|
||||
*/
|
||||
string setAdditionalJsonHeader(string jsonheader);
|
||||
std::string setAdditionalJsonHeader(std::string jsonheader);
|
||||
|
||||
/**
|
||||
* Sets the receiver UDP socket buffer size
|
||||
* @param udpsockbufsize additional json header
|
||||
* @returns receiver udp socket buffer size
|
||||
*/
|
||||
string setReceiverUDPSocketBufferSize(int udpsockbufsize=-1);
|
||||
std::string setReceiverUDPSocketBufferSize(int udpsockbufsize=-1);
|
||||
|
||||
/**
|
||||
* Sets the transmission delay for left, right or entire frame
|
||||
@ -2429,7 +2429,7 @@ private:
|
||||
* @param delay delay
|
||||
* @returns transmission delay
|
||||
*/
|
||||
string setDetectorNetworkParameter(networkParameter index, int delay);
|
||||
std::string setDetectorNetworkParameter(networkParameter index, int delay);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -197,3 +197,21 @@ int receiverInterface::executeFunction(int fnum,char mess[]){
|
||||
}
|
||||
|
||||
|
||||
|
||||
int receiverInterface::sendROI(int fnum, int n, slsReceiverDefs::ROI roiLimits[]) {
|
||||
int ret = slsDetectorDefs::FAIL;
|
||||
char mess[MAX_STR_LENGTH];
|
||||
memset(mess, 0, MAX_STR_LENGTH);
|
||||
|
||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
dataSocket->SendDataOnly(&n,sizeof(n));
|
||||
dataSocket->SendDataOnly(roiLimits,n * sizeof(slsReceiverDefs::ROI));
|
||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==slsDetectorDefs::FAIL){
|
||||
dataSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
cprintf(RED, "Receiver returned error: %s", mess);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
@ -131,6 +131,15 @@ public:
|
||||
*/
|
||||
int executeFunction(int fnum,char mess[]);
|
||||
|
||||
/**
|
||||
* Send an integer to receiver
|
||||
* @param fnum function enum to determine what parameter
|
||||
* @param n number of ROIs to send
|
||||
* @param roiLimits ROI structure
|
||||
* \returns success of operation
|
||||
*/
|
||||
int sendROI(int fnum, int n, slsReceiverDefs::ROI roiLimits[]);
|
||||
|
||||
//here one should implement the funcs listed in
|
||||
|
||||
private:
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include <string>
|
||||
#include <iomanip>
|
||||
#include <string.h>
|
||||
using namespace std;
|
||||
|
||||
#define MAX_MASTER_FILE_LENGTH 2000
|
||||
|
||||
@ -44,10 +43,10 @@ class BinaryFileStatic {
|
||||
static std::string CreateFileName(char* fpath, char* fnameprefix, uint64_t findex, bool frindexenable,
|
||||
uint64_t fnum = 0, int dindex = -1, int numunits = 1, int unitindex = 0)
|
||||
{
|
||||
ostringstream osfn;
|
||||
std::ostringstream osfn;
|
||||
osfn << fpath << "/" << fnameprefix;
|
||||
if (dindex >= 0) osfn << "_d" << (dindex * numunits + unitindex);
|
||||
if (frindexenable) osfn << "_f" << setfill('0') << setw(12) << fnum;
|
||||
if (frindexenable) osfn << "_f" << std::setfill('0') << std::setw(12) << fnum;
|
||||
osfn << "_" << findex;
|
||||
osfn << ".raw";
|
||||
return osfn.str();
|
||||
@ -60,9 +59,9 @@ class BinaryFileStatic {
|
||||
* @param findex file index
|
||||
* @returns master file name
|
||||
*/
|
||||
string CreateMasterFileName(char* fpath, char* fnameprefix, uint64_t findex)
|
||||
std::string CreateMasterFileName(char* fpath, char* fnameprefix, uint64_t findex)
|
||||
{
|
||||
ostringstream osfn;
|
||||
std::ostringstream osfn;
|
||||
osfn << fpath << "/" << fnameprefix;
|
||||
osfn << "_master";
|
||||
osfn << "_" << findex;
|
||||
@ -115,7 +114,7 @@ class BinaryFileStatic {
|
||||
* @param version version of software for binary writing
|
||||
* @returns 0 for success and 1 for fail
|
||||
*/
|
||||
static int CreateMasterDataFile(FILE*& fd, string fname, bool owenable,
|
||||
static int CreateMasterDataFile(FILE*& fd, std::string fname, bool owenable,
|
||||
uint32_t dr, bool tenE, uint32_t size,
|
||||
uint32_t nPixelsX, uint32_t nPixelsY, uint64_t nf,
|
||||
uint32_t maxf,
|
||||
|
@ -14,6 +14,8 @@ class Fifo;
|
||||
class DataStreamer;
|
||||
class ZmqSocket;
|
||||
|
||||
#include <vector>
|
||||
|
||||
class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
|
||||
|
||||
public:
|
||||
@ -23,13 +25,13 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
|
||||
* @param ind self index
|
||||
* @param f address of Fifo pointer
|
||||
* @param dr pointer to dynamic range
|
||||
* @param sEnable pointer to short frame enable
|
||||
* @param r roi
|
||||
* @param fi pointer to file index
|
||||
* @param fd flipped data enable for x and y dimensions
|
||||
* @param ajh additional json header
|
||||
* @param sm pointer to silent mode
|
||||
*/
|
||||
DataStreamer(int ind, Fifo*& f, uint32_t* dr, int* sEnable,
|
||||
DataStreamer(int ind, Fifo*& f, uint32_t* dr, std::vector<ROI*>* r,
|
||||
uint64_t* fi, int* fd, char* ajh, bool* sm);
|
||||
|
||||
/**
|
||||
@ -172,8 +174,11 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
|
||||
/** Pointer to dynamic range */
|
||||
uint32_t* dynamicRange;
|
||||
|
||||
/** Pointer to short frame enable */
|
||||
int* shortFrameEnable;
|
||||
/** ROI */
|
||||
std::vector<ROI*>* roi;
|
||||
|
||||
/** adc Configured */
|
||||
int adcConfigured;
|
||||
|
||||
/** Pointer to file index */
|
||||
uint64_t* fileIndex;
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "receiver_defs.h"
|
||||
|
||||
#include <math.h> //ceil
|
||||
#include <vector>
|
||||
|
||||
|
||||
class GeneralData {
|
||||
@ -155,6 +156,25 @@ public:
|
||||
frameNumber = (frameNumber & frameIndexMask) >> frameIndexOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ROI
|
||||
* @param i ROI
|
||||
*/
|
||||
virtual void SetROI(std::vector<slsReceiverDefs::ROI*> i) {
|
||||
cprintf(RED,"This is a generic function that should be overloaded by a derived class\n");
|
||||
};
|
||||
|
||||
/**
|
||||
* Get Adc configured
|
||||
* @param index thread index for debugging purposes
|
||||
* @param i ROI
|
||||
* @returns adc configured
|
||||
*/
|
||||
virtual const int GetAdcConfigured(int index, std::vector<slsReceiverDefs::ROI*> i) const{
|
||||
cprintf(RED,"This is a generic function that should be overloaded by a derived class\n");
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Setting dynamic range changes member variables
|
||||
* @param dr dynamic range
|
||||
@ -225,6 +245,10 @@ public:
|
||||
|
||||
class GotthardData : public GeneralData {
|
||||
|
||||
private:
|
||||
const static int nChip = 10;
|
||||
const static int nChan = 128;
|
||||
const static int nChipsPerAdc = 2;
|
||||
public:
|
||||
|
||||
/** Constructor */
|
||||
@ -244,32 +268,8 @@ class GotthardData : public GeneralData {
|
||||
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + sizeof(slsReceiverDefs::sls_receiver_header);
|
||||
defaultFifoDepth = 50000;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
class ShortGotthardData : public GeneralData {
|
||||
|
||||
public:
|
||||
|
||||
/** Constructor */
|
||||
ShortGotthardData(){
|
||||
myDetectorType = slsReceiverDefs::GOTTHARD;
|
||||
nPixelsX = 256;
|
||||
nPixelsY = 1;
|
||||
headerSizeinPacket = 4;
|
||||
dataSize = 512;
|
||||
packetSize = 518;
|
||||
packetsPerFrame = 1;
|
||||
imageSize = dataSize*packetsPerFrame;
|
||||
frameIndexMask = 0xFFFFFFFF;
|
||||
maxFramesPerFile = SHORT_MAX_FRAMES_PER_FILE;
|
||||
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + sizeof(slsReceiverDefs::sls_receiver_header);
|
||||
defaultFifoDepth = 50000;
|
||||
nPixelsXComplete = 1280;
|
||||
nPixelsYComplete = 1;
|
||||
imageSizeComplete = 1280 * 2;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get Header Infomation (frame number, packet number)
|
||||
* @param index thread index for debugging purposes
|
||||
@ -279,9 +279,16 @@ class ShortGotthardData : public GeneralData {
|
||||
*/
|
||||
virtual void GetHeaderInfo(int index, char* packetData, uint64_t& frameNumber, uint32_t& packetNumber) const
|
||||
{
|
||||
if (nPixelsX == 1280) {
|
||||
frameNumber = ((uint32_t)(*((uint32_t*)(packetData))));
|
||||
frameNumber++;
|
||||
packetNumber = frameNumber&packetIndexMask;
|
||||
frameNumber = (frameNumber & frameIndexMask) >> frameIndexOffset;
|
||||
} else {
|
||||
frameNumber = ((uint32_t)(*((uint32_t*)(packetData))));
|
||||
packetNumber = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Header Infomation (frame number, packet number)
|
||||
@ -296,11 +303,96 @@ class ShortGotthardData : public GeneralData {
|
||||
virtual void GetHeaderInfo(int index, char* packetData, uint32_t dynamicRange,
|
||||
uint64_t& frameNumber, uint32_t& packetNumber, uint32_t& subFrameNumber, uint64_t& bunchId) const
|
||||
{
|
||||
if (nPixelsX == 1280) {
|
||||
subFrameNumber = -1;
|
||||
bunchId = -1;
|
||||
frameNumber = ((uint32_t)(*((uint32_t*)(packetData))));
|
||||
frameNumber++;
|
||||
packetNumber = frameNumber&packetIndexMask;
|
||||
frameNumber = (frameNumber & frameIndexMask) >> frameIndexOffset;
|
||||
} else {
|
||||
subFrameNumber = -1;
|
||||
bunchId = -1;
|
||||
frameNumber = ((uint32_t)(*((uint32_t*)(packetData))));
|
||||
packetNumber = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set ROI
|
||||
* @param i ROI
|
||||
*/
|
||||
virtual void SetROI(std::vector<slsReceiverDefs::ROI*> i) {
|
||||
// all adcs
|
||||
if(!i.size()) {
|
||||
nPixelsX = 1280;
|
||||
dataSize = 1280;
|
||||
packetSize = GOTTHARD_PACKET_SIZE;
|
||||
packetsPerFrame = 2;
|
||||
imageSize = dataSize*packetsPerFrame;
|
||||
frameIndexMask = 0xFFFFFFFE;
|
||||
frameIndexOffset = 1;
|
||||
packetIndexMask = 1;
|
||||
maxFramesPerFile = MAX_FRAMES_PER_FILE;
|
||||
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + sizeof(slsReceiverDefs::sls_receiver_header);
|
||||
defaultFifoDepth = 50000;
|
||||
nPixelsXComplete = 0;
|
||||
nPixelsYComplete = 0;
|
||||
imageSizeComplete = 0;
|
||||
}
|
||||
|
||||
// single adc
|
||||
else {
|
||||
nPixelsX = 256;
|
||||
dataSize = 512;
|
||||
packetSize = 518;
|
||||
packetsPerFrame = 1;
|
||||
imageSize = dataSize*packetsPerFrame;
|
||||
frameIndexMask = 0xFFFFFFFF;
|
||||
frameIndexOffset = 0;
|
||||
packetIndexMask = 0;
|
||||
maxFramesPerFile = SHORT_MAX_FRAMES_PER_FILE;
|
||||
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + sizeof(slsReceiverDefs::sls_receiver_header);
|
||||
defaultFifoDepth = 25000;
|
||||
nPixelsXComplete = 1280;
|
||||
nPixelsYComplete = 1;
|
||||
imageSizeComplete = 1280 * 2;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get Adc configured
|
||||
* @param index thread index for debugging purposes
|
||||
* @param i ROI
|
||||
* @returns adc configured
|
||||
*/
|
||||
virtual const int GetAdcConfigured(int index, std::vector<slsReceiverDefs::ROI*> i) const{
|
||||
int adc = -1;
|
||||
// single adc
|
||||
if(i.size()) {
|
||||
|
||||
// gotthard can have only one adc per detector enabled (or all)
|
||||
// so just looking at the first roi is enough (more not possible at the moment)
|
||||
|
||||
//if its for 1 adc or general
|
||||
if ((i[0]->xmin == 0) && (i[0]->xmax == nChip * nChan))
|
||||
adc = -1;
|
||||
else {
|
||||
//adc = mid value/numchans also for only 1 roi
|
||||
adc = ((((i[0]->xmax) + (i[0]->xmin))/2)/
|
||||
(nChan * nChipsPerAdc));
|
||||
if((adc < 0) || (adc > 4)) {
|
||||
FILE_LOG(logWARNING) << index << ": Deleting ROI. "
|
||||
"Adc value should be between 0 and 4";
|
||||
adc = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return adc;
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -23,7 +23,6 @@ using namespace H5;
|
||||
#include <stdlib.h> //malloc
|
||||
#include <sstream>
|
||||
#include <cstring> //memset
|
||||
using namespace std;
|
||||
|
||||
class HDF5FileStatic: public virtual slsReceiverDefs {
|
||||
|
||||
|
@ -182,10 +182,10 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
|
||||
//***acquisition parameters***
|
||||
/**
|
||||
* Get Short Frame Enabled, later will be moved to getROI (so far only for gotthard)
|
||||
* Get ROI
|
||||
* @return index of adc enabled, else -1 if all enabled
|
||||
*/
|
||||
int getShortFrameEnable() const;
|
||||
std::vector<ROI*> getROI() const;
|
||||
|
||||
/**
|
||||
* Get the Frequency of Frames Sent to GUI
|
||||
@ -332,7 +332,7 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
* Configure command line parameters
|
||||
* @param config_map mapping of config parameters passed from command line arguments
|
||||
*/
|
||||
void configure(map<string, string> config_map);
|
||||
void configure(std::map<std::string, std::string> config_map);
|
||||
|
||||
/*
|
||||
* Set multi detector size
|
||||
@ -448,11 +448,11 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
|
||||
//***acquisition parameters***
|
||||
/**
|
||||
* Set Short Frame Enabled, later will be moved to getROI (so far only for gotthard)
|
||||
* @param i index of adc enabled, else -1 if all enabled
|
||||
* Set ROI
|
||||
* @param i ROI
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int setShortFrameEnable(const int i);
|
||||
int setROI(const std::vector<ROI*> i);
|
||||
|
||||
/**
|
||||
* Set the Frequency of Frames Sent to GUI
|
||||
@ -785,8 +785,8 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
bool dataCompressionEnable;
|
||||
|
||||
//***acquisition parameters***
|
||||
/* Short Frame Enable or index of adc enabled, else -1 if all enabled (gotthard specific) TODO: move to setROI */
|
||||
int shortFrameEnable;
|
||||
/* ROI */
|
||||
std::vector<ROI*> roi;
|
||||
/** Frequency of Frames sent to GUI */
|
||||
uint32_t frameToGuiFrequency;
|
||||
/** Timer of Frames sent to GUI when frequency is 0 */
|
||||
|
@ -11,13 +11,13 @@
|
||||
* @short Base class with all the functions for the UDP inteface of the receiver
|
||||
*/
|
||||
|
||||
#include <exception>
|
||||
|
||||
#include "sls_receiver_defs.h"
|
||||
#include "receiver_defs.h"
|
||||
#include "utilities.h"
|
||||
#include "logger.h"
|
||||
|
||||
#include <exception>
|
||||
#include <vector>
|
||||
|
||||
class UDPInterface {
|
||||
|
||||
@ -54,6 +54,8 @@ class UDPInterface {
|
||||
* -setStreamingSourceIP
|
||||
* -setAdditionalJsonHeader
|
||||
* -setDataStreamEnable
|
||||
* -setROI
|
||||
*
|
||||
*
|
||||
*
|
||||
* supported sequence of method-calls:
|
||||
@ -114,7 +116,7 @@ class UDPInterface {
|
||||
* @param [in] receiver_type type can be standard or custom (must be derived from base class)
|
||||
* @return a UDPInterface reference to object depending on receiver type
|
||||
*/
|
||||
static UDPInterface *create(string receiver_type = "standard");
|
||||
static UDPInterface *create(std::string receiver_type = "standard");
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
@ -271,10 +273,10 @@ class UDPInterface {
|
||||
|
||||
//***acquisition parameters***
|
||||
/**
|
||||
* Get Short Frame Enabled, later will be moved to getROI (so far only for gotthard)
|
||||
* Get ROI
|
||||
* @return index of adc enabled, else -1 if all enabled
|
||||
*/
|
||||
virtual int getShortFrameEnable() const = 0;
|
||||
virtual std::vector<slsReceiverDefs::ROI*> getROI() const = 0;
|
||||
|
||||
/**
|
||||
* Get the Frequency of Frames Sent to GUI
|
||||
@ -420,7 +422,7 @@ class UDPInterface {
|
||||
* Configure command line parameters
|
||||
* @param config_map mapping of config parameters passed from command line arguments
|
||||
*/
|
||||
virtual void configure(map<string, string> config_map) = 0;
|
||||
virtual void configure(std::map<std::string, std::string> config_map) = 0;
|
||||
|
||||
/*
|
||||
* Set multi detector size
|
||||
@ -535,11 +537,11 @@ class UDPInterface {
|
||||
|
||||
//***acquisition parameters***
|
||||
/**
|
||||
* Set Short Frame Enabled, later will be moved to getROI (so far only for gotthard)
|
||||
* @param i index of adc enabled, else -1 if all enabled
|
||||
* Set ROI
|
||||
* @param i ROI
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
virtual int setShortFrameEnable(const int i) = 0;
|
||||
virtual int setROI(const std::vector<slsReceiverDefs::ROI*> i) = 0;
|
||||
|
||||
/**
|
||||
* Set the Frequency of Frames Sent to GUI
|
||||
|
@ -14,7 +14,6 @@ class DataProcessor;
|
||||
class DataStreamer;
|
||||
class Fifo;
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBaseImplementation {
|
||||
@ -74,11 +73,11 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
|
||||
void setFileWriteEnable(const bool b);
|
||||
|
||||
/**
|
||||
* Set Short Frame Enabled, later will be moved to getROI (so far only for gotthard)
|
||||
* @param i index of adc enabled, else -1 if all enabled
|
||||
* Set ROI
|
||||
* @param i ROI
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int setShortFrameEnable(const int i);
|
||||
int setROI(const std::vector<ROI*> i);
|
||||
|
||||
/**
|
||||
* Set the Frequency of Frames Sent to GUI
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <semaphore.h>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
typedef double double32_t;
|
||||
typedef float float32_t;
|
||||
@ -46,7 +45,7 @@ public:
|
||||
int getFreeValue() const;
|
||||
|
||||
private:
|
||||
vector <Element*> array;
|
||||
std::vector <Element*> array;
|
||||
unsigned int tail; // input index
|
||||
unsigned int head; // output index
|
||||
unsigned int Capacity;
|
||||
|
@ -43,7 +43,7 @@ class sockaddr_in;
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include "logger.h"
|
||||
using namespace std;
|
||||
|
||||
|
||||
#define DEFAULT_PACKET_SIZE 1286
|
||||
#define SOCKET_BUFFER_SIZE (100*1024*1024) //100 MB
|
||||
@ -142,8 +142,8 @@ public:
|
||||
strcpy(ip,"0.0.0.0");
|
||||
clientAddress_length=sizeof(clientAddress);
|
||||
if (eth) {
|
||||
strcpy(ip,nameToIp(string(eth)).c_str());
|
||||
if (string(ip)==string("0.0.0.0"))
|
||||
strcpy(ip,nameToIp(std::string(eth)).c_str());
|
||||
if (std::string(ip)==std::string("0.0.0.0"))
|
||||
strcpy(ip,eth);
|
||||
}
|
||||
|
||||
@ -161,7 +161,7 @@ public:
|
||||
serverAddress.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
|
||||
|
||||
if (string(ip)!=string("0.0.0.0")) {
|
||||
if (std::string(ip)!=std::string("0.0.0.0")) {
|
||||
if (inet_pton(AF_INET, ip, &(serverAddress.sin_addr)));
|
||||
else
|
||||
serverAddress.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
@ -493,7 +493,7 @@ public:
|
||||
* @param ip IP
|
||||
* @returns hostname
|
||||
*/
|
||||
static string ipToName(string ip) {
|
||||
static std::string ipToName(std::string ip) {
|
||||
struct ifaddrs *addrs, *iap;
|
||||
struct sockaddr_in *sa;
|
||||
|
||||
@ -507,7 +507,7 @@ public:
|
||||
if (iap->ifa_addr && (iap->ifa_flags & IFF_UP) && iap->ifa_addr->sa_family == AF_INET) {
|
||||
sa = (struct sockaddr_in *)(iap->ifa_addr);
|
||||
inet_ntop(iap->ifa_addr->sa_family, (void *)&(sa->sin_addr), buf, buf_len);
|
||||
if (ip==string(buf)) {
|
||||
if (ip==std::string(buf)) {
|
||||
//printf("%s\n", iap->ifa_name);
|
||||
strcpy(buf,iap->ifa_name);
|
||||
break;
|
||||
@ -515,7 +515,7 @@ public:
|
||||
}
|
||||
}
|
||||
freeifaddrs(addrs);
|
||||
return string(buf);
|
||||
return std::string(buf);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -523,7 +523,7 @@ public:
|
||||
* @param inf interface
|
||||
* @returns mac address
|
||||
*/
|
||||
static string nameToMac(string inf) {
|
||||
static std::string nameToMac(std::string inf) {
|
||||
struct ifreq ifr;
|
||||
int sock, j, k;
|
||||
char mac[32];
|
||||
@ -534,7 +534,7 @@ public:
|
||||
|
||||
if (-1==ioctl(sock, SIOCGIFHWADDR, &ifr)) {
|
||||
perror("ioctl(SIOCGIFHWADDR) ");
|
||||
return string("00:00:00:00:00:00");
|
||||
return std::string("00:00:00:00:00:00");
|
||||
}
|
||||
for (j=0, k=0; j<6; j++) {
|
||||
k+=snprintf(mac+k, mac_len-k-1, j ? ":%02X" : "%02X",
|
||||
@ -545,7 +545,7 @@ public:
|
||||
if(sock!=1){
|
||||
close(sock);
|
||||
}
|
||||
return string(mac);
|
||||
return std::string(mac);
|
||||
|
||||
};
|
||||
|
||||
@ -554,7 +554,7 @@ public:
|
||||
* @param inf hostname
|
||||
* @returns IP
|
||||
*/
|
||||
static string nameToIp(string inf){
|
||||
static std::string nameToIp(std::string inf){
|
||||
struct ifreq ifr;
|
||||
int sock;
|
||||
char *p, addr[32];
|
||||
@ -565,7 +565,7 @@ public:
|
||||
|
||||
if (-1==ioctl(sock, SIOCGIFADDR, &ifr)) {
|
||||
perror("ioctl(SIOCGIFADDR) ");
|
||||
return string("0.0.0.0");
|
||||
return std::string("0.0.0.0");
|
||||
}
|
||||
p=inet_ntoa(((struct sockaddr_in *)(&ifr.ifr_addr))->sin_addr);
|
||||
strncpy(addr,p,addr_len-1);
|
||||
@ -574,7 +574,7 @@ public:
|
||||
if(sock!=1){
|
||||
close(sock);
|
||||
}
|
||||
return string(addr);
|
||||
return std::string(addr);
|
||||
|
||||
};
|
||||
|
||||
@ -584,7 +584,7 @@ public:
|
||||
* @param ifr interface request structure
|
||||
* @returns sock
|
||||
*/
|
||||
static int getSock(string inf, struct ifreq *ifr) {
|
||||
static int getSock(std::string inf, struct ifreq *ifr) {
|
||||
|
||||
int sock;
|
||||
sock=socket(PF_INET, SOCK_STREAM, 0);
|
||||
|
@ -24,13 +24,13 @@
|
||||
#define STRINGIFY(x) #x
|
||||
#define TOSTRING(x) STRINGIFY(x)
|
||||
#define MYCONCAT(x,y)
|
||||
#define __AT__ string(__FILE__) + string("::") + string(__func__) + string("(): ")
|
||||
#define __AT__ std::string(__FILE__) + std::string("::") + std::string(__func__) + std::string("(): ")
|
||||
#define __SHORT_FORM_OF_FILE__ \
|
||||
(strrchr(__FILE__,'/') \
|
||||
? strrchr(__FILE__,'/')+1 \
|
||||
: __FILE__ \
|
||||
)
|
||||
#define __SHORT_AT__ string(__SHORT_FORM_OF_FILE__) + string("::") + string(__func__) + string("(): ")
|
||||
#define __SHORT_AT__ std::string(__SHORT_FORM_OF_FILE__) + std::string("::") + std::string(__func__) + std::string("(): ")
|
||||
|
||||
|
||||
|
||||
|
@ -163,8 +163,8 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
|
||||
/** set detector hostname */
|
||||
int set_detector_hostname();
|
||||
|
||||
/** set short frame */
|
||||
int set_short_frame();
|
||||
/** set roi */
|
||||
int set_roi();
|
||||
|
||||
/** Set up UDP Details */
|
||||
int setup_udp();
|
||||
|
@ -205,6 +205,19 @@ public:
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@short structure for a region of interest
|
||||
xmin,xmax,ymin,ymax define the limits of the region
|
||||
*/
|
||||
typedef struct {
|
||||
int xmin; /**< is the roi xmin (in channel number) */
|
||||
int xmax; /**< is the roi xmax (in channel number)*/
|
||||
int ymin; /**< is the roi ymin (in channel number)*/
|
||||
int ymax; /**< is the roi ymax (in channel number)*/
|
||||
} ROI ;
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
/** returns string from enabled/disabled
|
||||
\param b true or false
|
||||
|
@ -22,7 +22,7 @@ enum recFuncs{
|
||||
F_SEND_RECEIVER_DETHOSTNAME, /**< set detector hostname to receiver */
|
||||
|
||||
//network functions
|
||||
F_RECEIVER_SHORT_FRAME, /**< Sets receiver to receive short frames */
|
||||
F_RECEIVER_SET_ROI, /**< Sets receiver ROI */
|
||||
F_SETUP_RECEIVER_UDP, /**< sets the receiver udp connection and returns receiver mac address */
|
||||
|
||||
//Acquisition setup functions
|
||||
|
@ -5,12 +5,11 @@
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
|
||||
using namespace std;
|
||||
#include "sls_receiver_defs.h"
|
||||
|
||||
/* uncomment next line to enable debug output */
|
||||
//#define EIGER_DEBUG
|
||||
|
||||
|
||||
int read_config_file(string fname, int *tcpip_port_no, map<string, string> * configuration_map);
|
||||
int read_config_file(std::string fname, int *tcpip_port_no, std::map<std::string, std::string> * configuration_map);
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "Fifo.h"
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
FILE* BinaryFile::masterfd = 0;
|
||||
|
@ -18,9 +18,8 @@
|
||||
#include <iostream>
|
||||
#include <errno.h>
|
||||
#include <cstring>
|
||||
using namespace std;
|
||||
|
||||
const string DataProcessor::TypeName = "DataProcessor";
|
||||
const std::string DataProcessor::TypeName = "DataProcessor";
|
||||
|
||||
|
||||
DataProcessor::DataProcessor(int ind, detectorType dtype, Fifo*& f,
|
||||
@ -78,7 +77,7 @@ DataProcessor::~DataProcessor() {
|
||||
}
|
||||
|
||||
/** getters */
|
||||
string DataProcessor::GetType(){
|
||||
std::string DataProcessor::GetType(){
|
||||
return TypeName;
|
||||
}
|
||||
|
||||
@ -478,7 +477,7 @@ void DataProcessor::PadMissingPackets(char* buf) {
|
||||
if (!nmissing)
|
||||
break;
|
||||
|
||||
FILE_LOG(logDEBUG) << "padding for " << index << " for pnum: " << pnum << endl;
|
||||
FILE_LOG(logDEBUG) << "padding for " << index << " for pnum: " << pnum << std::endl;
|
||||
|
||||
// missing packet
|
||||
switch(myDetectorType) {
|
||||
|
@ -11,12 +11,11 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <errno.h>
|
||||
using namespace std;
|
||||
|
||||
const string DataStreamer::TypeName = "DataStreamer";
|
||||
const std::string DataStreamer::TypeName = "DataStreamer";
|
||||
|
||||
|
||||
DataStreamer::DataStreamer(int ind, Fifo*& f, uint32_t* dr, int* sEnable,
|
||||
DataStreamer::DataStreamer(int ind, Fifo*& f, uint32_t* dr, std::vector<ROI*>* r,
|
||||
uint64_t* fi, int* fd, char* ajh, bool* sm) :
|
||||
ThreadObject(ind),
|
||||
runningFlag(0),
|
||||
@ -24,7 +23,8 @@ DataStreamer::DataStreamer(int ind, Fifo*& f, uint32_t* dr, int* sEnable,
|
||||
fifo(f),
|
||||
zmqSocket(0),
|
||||
dynamicRange(dr),
|
||||
shortFrameEnable(sEnable),
|
||||
roi(r),
|
||||
adcConfigured(-1),
|
||||
fileIndex(fi),
|
||||
flippedData(fd),
|
||||
additionJsonHeader(ajh),
|
||||
@ -51,7 +51,7 @@ DataStreamer::~DataStreamer() {
|
||||
}
|
||||
|
||||
/** getters */
|
||||
string DataStreamer::GetType(){
|
||||
std::string DataStreamer::GetType(){
|
||||
return TypeName;
|
||||
}
|
||||
|
||||
@ -88,7 +88,9 @@ void DataStreamer::ResetParametersforNewMeasurement(char* fname){
|
||||
delete [] completeBuffer;
|
||||
completeBuffer = 0;
|
||||
}
|
||||
if (*shortFrameEnable >= 0) {
|
||||
if (roi->size()) {
|
||||
if (generalData->myDetectorType == GOTTHARD)
|
||||
adcConfigured = generalData->GetAdcConfigured(index, *roi);
|
||||
completeBuffer = new char[generalData->imageSizeComplete];
|
||||
memset(completeBuffer, 0, generalData->imageSizeComplete);
|
||||
}
|
||||
@ -216,7 +218,7 @@ void DataStreamer::ProcessAnImage(char* buf) {
|
||||
cprintf(RED,"Error: Could not send zmq header for fnum %lld and streamer %d\n",
|
||||
(long long int) fnum, index);
|
||||
|
||||
memcpy(completeBuffer + ((generalData->imageSize)**shortFrameEnable), buf + FIFO_HEADER_NUMBYTES + sizeof(sls_receiver_header), (uint32_t)(*((uint32_t*)buf)) ); // new size possibly from callback
|
||||
memcpy(completeBuffer + ((generalData->imageSize) * adcConfigured), buf + FIFO_HEADER_NUMBYTES + sizeof(sls_receiver_header), (uint32_t)(*((uint32_t*)buf)) ); // new size possibly from callback
|
||||
if (!zmqSocket->SendData(completeBuffer, generalData->imageSizeComplete))
|
||||
cprintf(RED,"Error: Could not send zmq data for fnum %lld and streamer %d\n",
|
||||
(long long int) fnum, index);
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
using namespace std;
|
||||
|
||||
|
||||
Fifo::Fifo(int ind, uint32_t fifoItemSize, uint32_t depth):
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include "File.h"
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
File::File(int ind, uint32_t* maxf,
|
||||
@ -35,28 +34,28 @@ File::File(int ind, uint32_t* maxf,
|
||||
|
||||
File::~File() {}
|
||||
|
||||
string File::GetCurrentFileName() {
|
||||
std::string File::GetCurrentFileName() {
|
||||
return currentFileName;
|
||||
}
|
||||
|
||||
void File::PrintMembers() {
|
||||
FILE_LOG(logINFO) << "\nGeneral Writer Variables:" << endl
|
||||
<< "Index: " << index << endl
|
||||
<< "Max Frames Per File: " << *maxFramesPerFile << endl
|
||||
<< "Number of Detectors in x dir: " << numDetX << endl
|
||||
<< "Number of Detectors in y dir: " << numDetY << endl
|
||||
<< "File Name Prefix: " << fileNamePrefix << endl
|
||||
<< "File Path: " << filePath << endl
|
||||
<< "File Index: " << *fileIndex << endl
|
||||
<< "Over Write Enable: " << *overWriteEnable << endl
|
||||
FILE_LOG(logINFO) << "\nGeneral Writer Variables:" << std::endl
|
||||
<< "Index: " << index << std::endl
|
||||
<< "Max Frames Per File: " << *maxFramesPerFile << std::endl
|
||||
<< "Number of Detectors in x dir: " << numDetX << std::endl
|
||||
<< "Number of Detectors in y dir: " << numDetY << std::endl
|
||||
<< "File Name Prefix: " << fileNamePrefix << std::endl
|
||||
<< "File Path: " << filePath << std::endl
|
||||
<< "File Index: " << *fileIndex << std::endl
|
||||
<< "Over Write Enable: " << *overWriteEnable << std::endl
|
||||
|
||||
<< "Detector Index: " << *detIndex << endl
|
||||
<< "Number of Units Per Detector: " << *numUnitsPerDetector << endl
|
||||
<< "Number of Images in Acquisition: " << *numImages << endl
|
||||
<< "Dynamic Range: " << *dynamicRange << endl
|
||||
<< "UDP Port number: " << *udpPortNumber << endl
|
||||
<< "Master File Name: " << masterFileName << endl
|
||||
<< "Current File Name: " << currentFileName << endl
|
||||
<< "Detector Index: " << *detIndex << std::endl
|
||||
<< "Number of Units Per Detector: " << *numUnitsPerDetector << std::endl
|
||||
<< "Number of Images in Acquisition: " << *numImages << std::endl
|
||||
<< "Dynamic Range: " << *dynamicRange << std::endl
|
||||
<< "UDP Port number: " << *udpPortNumber << std::endl
|
||||
<< "Master File Name: " << masterFileName << std::endl
|
||||
<< "Current File Name: " << currentFileName << std::endl
|
||||
<< "Silent Mode: " << *silentMode;
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,6 @@
|
||||
#include <iomanip>
|
||||
#include <libgen.h> //basename
|
||||
#include <string.h>
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
pthread_mutex_t HDF5File::Mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
@ -14,9 +14,8 @@
|
||||
#include <iostream>
|
||||
#include <errno.h>
|
||||
#include <cstring>
|
||||
using namespace std;
|
||||
|
||||
const string Listener::TypeName = "Listener";
|
||||
const std::string Listener::TypeName = "Listener";
|
||||
|
||||
|
||||
Listener::Listener(int ind, detectorType dtype, Fifo*& f, runStatus* s,
|
||||
@ -74,7 +73,7 @@ Listener::~Listener() {
|
||||
}
|
||||
|
||||
/** getters */
|
||||
string Listener::GetType(){
|
||||
std::string Listener::GetType(){
|
||||
return TypeName;
|
||||
}
|
||||
|
||||
|
@ -7,13 +7,6 @@
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <syscall.h>
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include <sys/stat.h> // stat
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
@ -82,7 +81,9 @@ void UDPBaseImplementation::initializeMembers(){
|
||||
dataCompressionEnable = false;
|
||||
|
||||
//***acquisition parameters***
|
||||
shortFrameEnable = -1;
|
||||
for (std::vector<slsReceiverDefs::ROI*>::const_iterator it = roi.begin(); it != roi.end(); ++it)
|
||||
delete(*it);
|
||||
roi.clear();
|
||||
frameToGuiFrequency = 0;
|
||||
frameToGuiTimerinMS = DEFAULT_STREAMING_TIMER_IN_MS;
|
||||
dataStreamEnable = false;
|
||||
@ -250,9 +251,9 @@ char *UDPBaseImplementation::getEthernetInterface() const{
|
||||
|
||||
|
||||
/***acquisition parameters***/
|
||||
int UDPBaseImplementation::getShortFrameEnable() const{
|
||||
std::vector<slsReceiverDefs::ROI*> UDPBaseImplementation::getROI() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return shortFrameEnable;
|
||||
return roi;
|
||||
}
|
||||
|
||||
uint32_t UDPBaseImplementation::getFrameToGuiFrequency() const{
|
||||
@ -373,7 +374,7 @@ uint32_t UDPBaseImplementation::getActualUDPSocketBufferSize() const {
|
||||
*************************************************************************/
|
||||
|
||||
/**initial parameters***/
|
||||
void UDPBaseImplementation::configure(map<string, string> config_map){
|
||||
void UDPBaseImplementation::configure(std::map<std::string, std::string> config_map){
|
||||
FILE_LOG(logERROR) << __AT__ << " doing nothing...";
|
||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
||||
}
|
||||
@ -541,11 +542,27 @@ void UDPBaseImplementation::setEthernetInterface(const char* c){
|
||||
|
||||
|
||||
/***acquisition parameters***/
|
||||
int UDPBaseImplementation::setShortFrameEnable(const int i){
|
||||
int UDPBaseImplementation::setROI(const std::vector<slsReceiverDefs::ROI*> i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
shortFrameEnable = i;
|
||||
FILE_LOG(logINFO) << "Short Frame Enable: " << stringEnable(shortFrameEnable);
|
||||
roi = i;
|
||||
|
||||
std::stringstream sstm;
|
||||
sstm << "ROI: ";
|
||||
if (!roi.size())
|
||||
sstm << "0";
|
||||
else {
|
||||
for (unsigned int i = 0; i < roi.size(); ++i) {
|
||||
sstm << "( " <<
|
||||
roi[i]->xmin << ", " <<
|
||||
roi[i]->xmax << ", " <<
|
||||
roi[i]->ymin << ", " <<
|
||||
roi[i]->ymax << " )";
|
||||
}
|
||||
}
|
||||
std::string message = sstm.str();
|
||||
FILE_LOG(logINFO) << message;
|
||||
|
||||
//overrridden child classes might return FAIL
|
||||
return OK;
|
||||
}
|
||||
|
@ -7,16 +7,14 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#include "UDPInterface.h"
|
||||
#include "UDPBaseImplementation.h"
|
||||
#include "UDPStandardImplementation.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
UDPInterface * UDPInterface::create(string receiver_type){
|
||||
UDPInterface * UDPInterface::create(std::string receiver_type){
|
||||
|
||||
if (receiver_type == "standard"){
|
||||
FILE_LOG(logINFO) << "Starting " << receiver_type;
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <cstring> //strcpy
|
||||
#include <errno.h> //eperm
|
||||
#include <fstream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
/** cosntructor & destructor */
|
||||
@ -33,16 +32,16 @@ UDPStandardImplementation::~UDPStandardImplementation() {
|
||||
|
||||
void UDPStandardImplementation::DeleteMembers() {
|
||||
if (generalData) { delete generalData; generalData=0;}
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
delete(*it);
|
||||
listener.clear();
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
delete(*it);
|
||||
dataProcessor.clear();
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
delete(*it);
|
||||
dataStreamer.clear();
|
||||
for (vector<Fifo*>::const_iterator it = fifo.begin(); it != fifo.end(); ++it)
|
||||
for (std::vector<Fifo*>::const_iterator it = fifo.begin(); it != fifo.end(); ++it)
|
||||
delete(*it);
|
||||
fifo.clear();
|
||||
}
|
||||
@ -69,8 +68,8 @@ uint64_t UDPStandardImplementation::getTotalFramesCaught() const {
|
||||
uint64_t sum = 0;
|
||||
uint32_t flagsum = 0;
|
||||
|
||||
vector<DataProcessor*>::const_iterator it;
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) {
|
||||
std::vector<DataProcessor*>::const_iterator it;
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) {
|
||||
flagsum += ((*it)->GetMeasurementStartedFlag() ? 1 : 0);
|
||||
sum += (*it)->GetNumTotalFramesCaught();
|
||||
}
|
||||
@ -85,7 +84,7 @@ uint64_t UDPStandardImplementation::getFramesCaught() const {
|
||||
uint64_t sum = 0;
|
||||
uint32_t flagsum = 0;
|
||||
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) {
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) {
|
||||
flagsum += ((*it)->GetAcquisitionStartedFlag() ? 1 : 0);
|
||||
sum += (*it)->GetNumFramesCaught();
|
||||
}
|
||||
@ -100,7 +99,7 @@ int64_t UDPStandardImplementation::getAcquisitionIndex() const {
|
||||
uint64_t sum = 0;
|
||||
uint32_t flagsum = 0;
|
||||
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it){
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it){
|
||||
flagsum += ((*it)->GetAcquisitionStartedFlag() ? 1 : 0);
|
||||
sum += (*it)->GetActualProcessedAcquisitionIndex();
|
||||
}
|
||||
@ -120,7 +119,7 @@ int UDPStandardImplementation::setGapPixelsEnable(const bool b) {
|
||||
// side effects
|
||||
generalData->SetGapPixelsEnable(b, dynamicRange);
|
||||
// to update npixelsx, npixelsy in file writer
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
(*it)->SetPixelDimension();
|
||||
|
||||
numberofJobs = -1; //changes to imagesize has to be noted to recreate fifo structure
|
||||
@ -144,7 +143,7 @@ void UDPStandardImplementation::setFileFormat(const fileFormat f){
|
||||
break;
|
||||
}
|
||||
//destroy file writer, set file format and create file writer
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
(*it)->SetFileFormat(f);
|
||||
|
||||
FILE_LOG(logINFO) << "File Format:" << getFileFormatType(fileFormatType);
|
||||
@ -168,35 +167,64 @@ void UDPStandardImplementation::setFileWriteEnable(const bool b){
|
||||
|
||||
|
||||
|
||||
int UDPStandardImplementation::setShortFrameEnable(const int i) {
|
||||
int UDPStandardImplementation::setROI(const std::vector<slsReceiverDefs::ROI*> i) {
|
||||
if (myDetectorType != GOTTHARD) {
|
||||
cprintf(RED, "Error: Can not set short frame for this detector\n");
|
||||
cprintf(RED, "Error: Can not set ROI for this detector\n");
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
if (shortFrameEnable != i) {
|
||||
shortFrameEnable = i;
|
||||
|
||||
if (generalData)
|
||||
delete generalData;
|
||||
if (i != -1)
|
||||
generalData = new ShortGotthardData();
|
||||
else
|
||||
generalData = new GotthardData();
|
||||
bool change = false;
|
||||
if (roi.size() != i.size())
|
||||
change = true;
|
||||
else {
|
||||
for (unsigned int iloop = 0; iloop < i.size(); ++iloop) {
|
||||
if (
|
||||
(roi[iloop]->xmin != i[iloop]->xmin) ||
|
||||
(roi[iloop]->xmax != i[iloop]->xmax) ||
|
||||
(roi[iloop]->ymin != i[iloop]->ymin) ||
|
||||
(roi[iloop]->xmax != i[iloop]->xmax)) {
|
||||
change = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (change) {
|
||||
|
||||
roi = i;
|
||||
|
||||
generalData->SetROI(i);
|
||||
framesPerFile = generalData->maxFramesPerFile;
|
||||
|
||||
numberofJobs = -1; //changes to imagesize has to be noted to recreate fifo structure
|
||||
if (SetupFifoStructure() == FAIL)
|
||||
return FAIL;
|
||||
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
(*it)->SetGeneralData(generalData);
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
(*it)->SetGeneralData(generalData);
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
(*it)->SetGeneralData(generalData);
|
||||
}
|
||||
FILE_LOG(logINFO) << "Short Frame Enable: " << shortFrameEnable;
|
||||
|
||||
|
||||
std::stringstream sstm;
|
||||
sstm << "ROI: ";
|
||||
if (!roi.size())
|
||||
sstm << "0";
|
||||
else {
|
||||
for (unsigned int i = 0; i < roi.size(); ++i) {
|
||||
sstm << "( " <<
|
||||
roi[i]->xmin << ", " <<
|
||||
roi[i]->xmax << ", " <<
|
||||
roi[i]->ymin << ", " <<
|
||||
roi[i]->ymax << " )";
|
||||
}
|
||||
}
|
||||
std::string message = sstm.str();
|
||||
FILE_LOG(logINFO) << message;
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -216,21 +244,22 @@ int UDPStandardImplementation::setDataStreamEnable(const bool enable) {
|
||||
dataStreamEnable = enable;
|
||||
|
||||
//data sockets have to be created again as the client ones are
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
delete(*it);
|
||||
dataStreamer.clear();
|
||||
|
||||
if (enable) {
|
||||
for ( int i = 0; i < numThreads; ++i ) {
|
||||
try {
|
||||
|
||||
DataStreamer* s = new DataStreamer(i, fifo[i], &dynamicRange,
|
||||
&shortFrameEnable, &fileIndex, flippedData, additionalJsonHeader, &silentMode);
|
||||
&roi, &fileIndex, flippedData, additionalJsonHeader, &silentMode);
|
||||
dataStreamer.push_back(s);
|
||||
dataStreamer[i]->SetGeneralData(generalData);
|
||||
dataStreamer[i]->CreateZmqSockets(&numThreads, streamingPort, streamingSrcIP);
|
||||
}
|
||||
catch(...) {
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
delete(*it);
|
||||
dataStreamer.clear();
|
||||
dataStreamEnable = false;
|
||||
@ -269,7 +298,7 @@ int UDPStandardImplementation::setDynamicRange(const uint32_t i) {
|
||||
generalData->SetDynamicRange(i,tengigaEnable);
|
||||
generalData->SetGapPixelsEnable(gapPixelsEnable, dynamicRange);
|
||||
// to update npixelsx, npixelsy in file writer
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
(*it)->SetPixelDimension();
|
||||
|
||||
numberofJobs = -1; //changes to imagesize has to be noted to recreate fifo structure
|
||||
@ -374,10 +403,10 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) {
|
||||
}
|
||||
catch (...) {
|
||||
FILE_LOG(logERROR) << "Could not create listener/dataprocessor threads (index:" << i << ")";
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
delete(*it);
|
||||
listener.clear();
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
delete(*it);
|
||||
dataProcessor.clear();
|
||||
return FAIL;
|
||||
@ -385,9 +414,9 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) {
|
||||
}
|
||||
|
||||
//set up writer and callbacks
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
(*it)->SetGeneralData(generalData);
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
(*it)->SetGeneralData(generalData);
|
||||
|
||||
SetThreadPriorities();
|
||||
@ -427,13 +456,13 @@ void UDPStandardImplementation::setDetectorPositionId(const int i){
|
||||
|
||||
|
||||
void UDPStandardImplementation::resetAcquisitionCount() {
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
(*it)->ResetParametersforNewAcquisition();
|
||||
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
(*it)->ResetParametersforNewAcquisition();
|
||||
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
(*it)->ResetParametersforNewAcquisition();
|
||||
|
||||
FILE_LOG(logINFO) << "Acquisition Count has been reset";
|
||||
@ -498,10 +527,10 @@ void UDPStandardImplementation::stopReceiver(){
|
||||
bool running = true;
|
||||
while(running) {
|
||||
running = false;
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
if ((*it)->IsRunning())
|
||||
running = true;
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
if ((*it)->IsRunning())
|
||||
running = true;
|
||||
usleep(5000);
|
||||
@ -512,8 +541,8 @@ void UDPStandardImplementation::stopReceiver(){
|
||||
if (fileWriteEnable && fileFormatType == HDF5) {
|
||||
uint64_t maxIndexCaught = 0;
|
||||
bool anycaught = false;
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) {
|
||||
maxIndexCaught = max(maxIndexCaught, (*it)->GetProcessedMeasurementIndex());
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) {
|
||||
maxIndexCaught = std::max(maxIndexCaught, (*it)->GetProcessedMeasurementIndex());
|
||||
if((*it)->GetMeasurementStartedFlag())
|
||||
anycaught = true;
|
||||
}
|
||||
@ -525,7 +554,7 @@ void UDPStandardImplementation::stopReceiver(){
|
||||
running = true;
|
||||
while(running) {
|
||||
running = false;
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
if ((*it)->IsRunning())
|
||||
running = true;
|
||||
usleep(5000);
|
||||
@ -575,7 +604,7 @@ void UDPStandardImplementation::startReadout(){
|
||||
// wait for incoming delayed packets
|
||||
//current packets caught
|
||||
volatile int totalP = 0,prev=-1;
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
totalP += (*it)->GetPacketsCaught();
|
||||
|
||||
//wait for all packets
|
||||
@ -594,7 +623,7 @@ void UDPStandardImplementation::startReadout(){
|
||||
prev = totalP;
|
||||
totalP = 0;
|
||||
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
totalP += (*it)->GetPacketsCaught();
|
||||
#ifdef VERY_VERBOSE
|
||||
cprintf(MAGENTA,"\tupdated: totalP:%d\n",totalP);
|
||||
@ -613,7 +642,7 @@ void UDPStandardImplementation::startReadout(){
|
||||
|
||||
|
||||
void UDPStandardImplementation::shutDownUDPSockets() {
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
(*it)->ShutDownUDPSocket();
|
||||
}
|
||||
|
||||
@ -622,9 +651,9 @@ void UDPStandardImplementation::shutDownUDPSockets() {
|
||||
void UDPStandardImplementation::closeFiles() {
|
||||
uint64_t maxIndexCaught = 0;
|
||||
bool anycaught = false;
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) {
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) {
|
||||
(*it)->CloseFiles();
|
||||
maxIndexCaught = max(maxIndexCaught, (*it)->GetProcessedMeasurementIndex());
|
||||
maxIndexCaught = std::max(maxIndexCaught, (*it)->GetProcessedMeasurementIndex());
|
||||
if((*it)->GetMeasurementStartedFlag())
|
||||
anycaught = true;
|
||||
}
|
||||
@ -640,7 +669,7 @@ int UDPStandardImplementation::setUDPSocketBufferSize(const uint32_t s) {
|
||||
|
||||
int UDPStandardImplementation::restreamStop() {
|
||||
bool ret = OK;
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it) {
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it) {
|
||||
if ((*it)->RestreamStop() == FAIL)
|
||||
ret = FAIL;
|
||||
}
|
||||
@ -660,14 +689,14 @@ void UDPStandardImplementation::SetLocalNetworkParameters() {
|
||||
int max_back_log;
|
||||
const char *proc_file_name = "/proc/sys/net/core/netdev_max_backlog";
|
||||
{
|
||||
ifstream proc_file(proc_file_name);
|
||||
std::ifstream proc_file(proc_file_name);
|
||||
proc_file >> max_back_log;
|
||||
}
|
||||
|
||||
if (max_back_log < MAX_SOCKET_INPUT_PACKET_QUEUE) {
|
||||
ofstream proc_file(proc_file_name);
|
||||
std::ofstream proc_file(proc_file_name);
|
||||
if (proc_file.good()) {
|
||||
proc_file << MAX_SOCKET_INPUT_PACKET_QUEUE << endl;
|
||||
proc_file << MAX_SOCKET_INPUT_PACKET_QUEUE << std::endl;
|
||||
cprintf(GREEN, "Max length of input packet queue "
|
||||
"[/proc/sys/net/core/netdev_max_backlog] modified to %d\n",
|
||||
MAX_SOCKET_INPUT_PACKET_QUEUE);
|
||||
@ -683,13 +712,13 @@ void UDPStandardImplementation::SetLocalNetworkParameters() {
|
||||
|
||||
void UDPStandardImplementation::SetThreadPriorities() {
|
||||
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it){
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it){
|
||||
if ((*it)->SetThreadPriority(LISTENER_PRIORITY) == FAIL) {
|
||||
FILE_LOG(logWARNING) << "Could not prioritize listener threads. (No Root Privileges?)";
|
||||
return;
|
||||
}
|
||||
}
|
||||
ostringstream osfn;
|
||||
std::ostringstream osfn;
|
||||
osfn << "Priorities set - "
|
||||
"Listener:" << LISTENER_PRIORITY;
|
||||
|
||||
@ -701,7 +730,7 @@ int UDPStandardImplementation::SetupFifoStructure() {
|
||||
numberofJobs = 1;
|
||||
|
||||
|
||||
for (vector<Fifo*>::const_iterator it = fifo.begin(); it != fifo.end(); ++it)
|
||||
for (std::vector<Fifo*>::const_iterator it = fifo.begin(); it != fifo.end(); ++it)
|
||||
delete(*it);
|
||||
fifo.clear();
|
||||
for ( int i = 0; i < numThreads; i++ ) {
|
||||
@ -714,7 +743,7 @@ int UDPStandardImplementation::SetupFifoStructure() {
|
||||
fifo.push_back(f);
|
||||
} catch (...) {
|
||||
cprintf(RED,"Error: Could not allocate memory for fifo structure of index %d\n", i);
|
||||
for (vector<Fifo*>::const_iterator it = fifo.begin(); it != fifo.end(); ++it)
|
||||
for (std::vector<Fifo*>::const_iterator it = fifo.begin(); it != fifo.end(); ++it)
|
||||
delete(*it);
|
||||
fifo.clear();
|
||||
return FAIL;
|
||||
@ -733,15 +762,15 @@ int UDPStandardImplementation::SetupFifoStructure() {
|
||||
|
||||
|
||||
void UDPStandardImplementation::ResetParametersforNewMeasurement() {
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
(*it)->ResetParametersforNewMeasurement();
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
(*it)->ResetParametersforNewMeasurement();
|
||||
|
||||
if (dataStreamEnable) {
|
||||
char fnametostream[MAX_STR_LENGTH];
|
||||
snprintf(fnametostream, MAX_STR_LENGTH, "%s/%s", filePath, fileName);
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
(*it)->ResetParametersforNewMeasurement(fnametostream);
|
||||
}
|
||||
}
|
||||
@ -785,15 +814,15 @@ int UDPStandardImplementation::SetupWriter() {
|
||||
|
||||
void UDPStandardImplementation::StartRunning() {
|
||||
//set running mask and post semaphore to start the inner loop in execution thread
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it) {
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it) {
|
||||
(*it)->StartRunning();
|
||||
(*it)->Continue();
|
||||
}
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it){
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it){
|
||||
(*it)->StartRunning();
|
||||
(*it)->Continue();
|
||||
}
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it){
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it){
|
||||
(*it)->StartRunning();
|
||||
(*it)->Continue();
|
||||
}
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <sys/wait.h> //wait
|
||||
#include <unistd.h> //usleep
|
||||
#include <syscall.h>
|
||||
using namespace std;
|
||||
|
||||
|
||||
bool keeprunning;
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "slsReceiver.h"
|
||||
#include "gitInfoReceiver.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
@ -22,9 +21,9 @@ slsReceiver::slsReceiver(int argc, char *argv[]):
|
||||
tcpipInterface (0) {
|
||||
|
||||
// options
|
||||
map<string, string> configuration_map;
|
||||
std::map<std::string, std::string> configuration_map;
|
||||
int tcpip_port_no = 1954;
|
||||
string fname = "";
|
||||
std::string fname = "";
|
||||
int64_t tempval = 0;
|
||||
|
||||
//parse command line for config
|
||||
@ -68,28 +67,28 @@ slsReceiver::slsReceiver(int argc, char *argv[]):
|
||||
case 'v':
|
||||
tempval = GITREV;
|
||||
tempval = (tempval <<32) | GITDATE;
|
||||
cout << "SLS Receiver " << GITBRANCH << " (0x" << hex << tempval << ")" << endl;
|
||||
throw exception();
|
||||
std::cout << "SLS Receiver " << GITBRANCH << " (0x" << std::hex << tempval << ")" << std::endl;
|
||||
throw std::exception();
|
||||
|
||||
case 'h':
|
||||
default:
|
||||
string help_message = "\n"
|
||||
+ string(argv[0]) + "\n"
|
||||
+ "Usage: " + string(argv[0]) + " [arguments]\n"
|
||||
std::string help_message = "\n"
|
||||
+ std::string(argv[0]) + "\n"
|
||||
+ "Usage: " + std::string(argv[0]) + " [arguments]\n"
|
||||
+ "Possible arguments are:\n"
|
||||
+ "\t-f, --config <fname> : Loads config from file\n"
|
||||
+ "\t-t, --rx_tcpport <port> : TCP Communication Port with client. \n"
|
||||
+ "\t Default: 1954. Required for multiple \n"
|
||||
+ "\t receivers\n\n";
|
||||
|
||||
FILE_LOG(logINFO) << help_message << endl;
|
||||
throw exception();
|
||||
FILE_LOG(logINFO) << help_message << std::endl;
|
||||
throw std::exception();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if( !fname.empty() && read_config_file(fname, &tcpip_port_no, &configuration_map) == FAIL) {
|
||||
throw exception();
|
||||
throw std::exception();
|
||||
}
|
||||
|
||||
// might throw an exception
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <fstream>
|
||||
#include <stdlib.h>
|
||||
#include <syscall.h>
|
||||
using namespace std;
|
||||
#include <vector>
|
||||
|
||||
|
||||
|
||||
@ -140,7 +140,7 @@ void* slsReceiverTCPIPInterface::startTCPServerThread(void *this_pointer){
|
||||
|
||||
void slsReceiverTCPIPInterface::startTCPServer(){
|
||||
cprintf(BLUE,"Created [ TCP server Tid: %ld ]\n", (long)syscall(SYS_gettid));
|
||||
FILE_LOG(logINFO) << "SLS Receiver starting TCP Server on port " << portNumber << endl;
|
||||
FILE_LOG(logINFO) << "SLS Receiver starting TCP Server on port " << portNumber << std::endl;
|
||||
|
||||
#ifdef VERYVERBOSE
|
||||
FILE_LOG(logDEBUG5) << "Starting Receiver TCP Server";
|
||||
@ -206,7 +206,7 @@ const char* slsReceiverTCPIPInterface::getFunctionName(enum recFuncs func) {
|
||||
case F_GET_RECEIVER_ID: return "F_GET_RECEIVER_ID";
|
||||
case F_GET_RECEIVER_TYPE: return "F_GET_RECEIVER_TYPE";
|
||||
case F_SEND_RECEIVER_DETHOSTNAME: return "F_SEND_RECEIVER_DETHOSTNAME";
|
||||
case F_RECEIVER_SHORT_FRAME: return "F_RECEIVER_SHORT_FRAME";
|
||||
case F_RECEIVER_SET_ROI: return "F_RECEIVER_SET_ROI";
|
||||
case F_SETUP_RECEIVER_UDP: return "F_SETUP_RECEIVER_UDP";
|
||||
case F_SET_RECEIVER_TIMER: return "F_SET_RECEIVER_TIMER";
|
||||
case F_SET_RECEIVER_DYNAMIC_RANGE: return "F_SET_RECEIVER_DYNAMIC_RANGE";
|
||||
@ -263,7 +263,7 @@ int slsReceiverTCPIPInterface::function_table(){
|
||||
flist[F_GET_RECEIVER_ID] = &slsReceiverTCPIPInterface::get_id;
|
||||
flist[F_GET_RECEIVER_TYPE] = &slsReceiverTCPIPInterface::set_detector_type;
|
||||
flist[F_SEND_RECEIVER_DETHOSTNAME] = &slsReceiverTCPIPInterface::set_detector_hostname;
|
||||
flist[F_RECEIVER_SHORT_FRAME] = &slsReceiverTCPIPInterface::set_short_frame;
|
||||
flist[F_RECEIVER_SET_ROI] = &slsReceiverTCPIPInterface::set_roi;
|
||||
flist[F_SETUP_RECEIVER_UDP] = &slsReceiverTCPIPInterface::setup_udp;
|
||||
flist[F_SET_RECEIVER_TIMER] = &slsReceiverTCPIPInterface::set_timer;
|
||||
flist[F_SET_RECEIVER_DYNAMIC_RANGE] = &slsReceiverTCPIPInterface::set_dynamic_range;
|
||||
@ -535,7 +535,7 @@ int slsReceiverTCPIPInterface::set_port() {
|
||||
sprintf(mess,"Port Number (%d) too low\n", p_number);
|
||||
FILE_LOG(logERROR) << mess;
|
||||
} else {
|
||||
FILE_LOG(logINFO) << "set port to " << p_number <<endl;
|
||||
FILE_LOG(logINFO) << "set port to " << p_number <<std::endl;
|
||||
strcpy(oldLastClientIP, mySock->lastClientIP);
|
||||
|
||||
try {
|
||||
@ -879,16 +879,24 @@ int slsReceiverTCPIPInterface::set_detector_hostname() {
|
||||
|
||||
|
||||
|
||||
int slsReceiverTCPIPInterface::set_short_frame() {
|
||||
int slsReceiverTCPIPInterface::set_roi() {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int index = 0;
|
||||
int retval = -100;
|
||||
int nroi = 0;
|
||||
|
||||
// receive arguments
|
||||
if (mySock->ReceiveDataOnly(&index,sizeof(index)) < 0 )
|
||||
if (mySock->ReceiveDataOnly(&nroi,sizeof(nroi)) < 0 )
|
||||
return printSocketReadError();
|
||||
|
||||
std::vector <ROI*> roiLimits;
|
||||
int iloop = 0;
|
||||
for (iloop = 0; iloop < nroi; iloop++) {
|
||||
ROI temp;
|
||||
if ( mySock->ReceiveDataOnly(&temp,sizeof(ROI)) < 0 )
|
||||
return printSocketReadError();
|
||||
roiLimits.push_back(&temp);
|
||||
}
|
||||
|
||||
//does not exist
|
||||
if (myDetectorType != GOTTHARD)
|
||||
functionNotImplemented();
|
||||
@ -904,8 +912,8 @@ int slsReceiverTCPIPInterface::set_short_frame() {
|
||||
else if (receiverBase->getStatus() != IDLE)
|
||||
receiverNotIdle();
|
||||
else {
|
||||
receiverBase->setShortFrameEnable(index);
|
||||
retval = receiverBase->getShortFrameEnable();
|
||||
ret = receiverBase->setROI(roiLimits);
|
||||
//retval = receiverBase->getROI();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -916,7 +924,6 @@ int slsReceiverTCPIPInterface::set_short_frame() {
|
||||
mySock->SendDataOnly(&ret,sizeof(ret));
|
||||
if (ret == FAIL)
|
||||
mySock->SendDataOnly(mess,sizeof(mess));
|
||||
mySock->SendDataOnly(&retval,sizeof(retval));
|
||||
|
||||
// return ok/fail
|
||||
return ret;
|
||||
@ -957,7 +964,7 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
||||
//setup udpip
|
||||
//get ethernet interface or IP to listen to
|
||||
FILE_LOG(logINFO) << "Receiver UDP IP: " << args[0];
|
||||
string temp = genericSocket::ipToName(args[0]);
|
||||
std::string temp = genericSocket::ipToName(args[0]);
|
||||
if (temp == "none"){
|
||||
ret = FAIL;
|
||||
strcpy(mess, "Failed to get ethernet interface or IP\n");
|
||||
|
@ -11,20 +11,19 @@
|
||||
#include "logger.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
int read_config_file(string fname, int *tcpip_port_no, map<string, string> * configuration_map ){
|
||||
int read_config_file(std::string fname, int *tcpip_port_no, std::map<std::string, std::string> * configuration_map ){
|
||||
|
||||
ifstream infile;
|
||||
string sLine,sargname, sargvalue;
|
||||
std::ifstream infile;
|
||||
std::string sLine,sargname, sargvalue;
|
||||
int iline = 0;
|
||||
int success = slsReceiverDefs::OK;
|
||||
|
||||
|
||||
FILE_LOG(logINFO) << "config file name " << fname;
|
||||
try {
|
||||
infile.open(fname.c_str(), ios_base::in);
|
||||
infile.open(fname.c_str(), std::ios_base::in);
|
||||
} catch(...) {
|
||||
FILE_LOG(logERROR) << "Could not open configuration file " << fname ;
|
||||
success = slsReceiverDefs::FAIL;
|
||||
@ -37,14 +36,14 @@ int read_config_file(string fname, int *tcpip_port_no, map<string, string> * con
|
||||
|
||||
//VERBOSE_PRINT(sLine);
|
||||
|
||||
if(sLine.find('#') != string::npos)
|
||||
if(sLine.find('#') != std::string::npos)
|
||||
continue;
|
||||
|
||||
else if(sLine.length()<2)
|
||||
continue;
|
||||
|
||||
else{
|
||||
istringstream sstr(sLine);
|
||||
std::istringstream sstr(sLine);
|
||||
|
||||
//parameter name
|
||||
if(sstr.good()){
|
||||
|
Loading…
x
Reference in New Issue
Block a user