multisize to numberofdetectors

This commit is contained in:
maliakal_d 2020-06-17 09:57:56 +02:00
parent e09fc8cd2b
commit b5781e1f9b
8 changed files with 27 additions and 29 deletions

View File

@ -6916,7 +6916,7 @@ int get_receiver_parameters(int file_des) {
n += sendData(file_des, &i32, sizeof(i32), INT32); n += sendData(file_des, &i32, sizeof(i32), INT32);
if (n < 0) if (n < 0)
return printSocketReadError(); return printSocketReadError();
// multisize // numberOfDetector
i32 = 0; i32 = 0;
n += sendData(file_des, &i32, sizeof(i32), INT32); n += sendData(file_des, &i32, sizeof(i32), INT32);
if (n < 0) if (n < 0)

View File

@ -315,7 +315,7 @@ void DetectorImpl::updateDetectorSize() {
<< multi_shm()->numberOfChannels.y; << multi_shm()->numberOfChannels.y;
for (auto &d : detectors) { for (auto &d : detectors) {
d->updateMultiSize(multi_shm()->numberOfDetector); d->updateNumberOfDetector(multi_shm()->numberOfDetector);
} }
} }

View File

@ -375,8 +375,8 @@ void Module::initializeDetectorStructure(detectorType type) {
shm()->shmversion = SLS_SHMVERSION; shm()->shmversion = SLS_SHMVERSION;
memset(shm()->hostname, 0, MAX_STR_LENGTH); memset(shm()->hostname, 0, MAX_STR_LENGTH);
shm()->myDetectorType = type; shm()->myDetectorType = type;
shm()->multiSize.x = 0; shm()->numberOfDetector.x = 0;
shm()->multiSize.y = 0; shm()->numberOfDetector.y = 0;
shm()->controlPort = DEFAULT_PORTNO; shm()->controlPort = DEFAULT_PORTNO;
shm()->stopPort = DEFAULT_PORTNO + 1; shm()->stopPort = DEFAULT_PORTNO + 1;
sls::strcpy_safe(shm()->settingsDir, getenv("HOME")); sls::strcpy_safe(shm()->settingsDir, getenv("HOME"));
@ -558,9 +558,9 @@ void Module::setReadNLines(const int value) {
int Module::getReadNLines() { return sendToDetector<int>(F_GET_READ_N_LINES); } int Module::getReadNLines() { return sendToDetector<int>(F_GET_READ_N_LINES); }
void Module::updateMultiSize(slsDetectorDefs::xy det) { void Module::updateNumberOfDetector(slsDetectorDefs::xy det) {
shm()->multiSize = det; shm()->numberOfDetector = det;
int args[2] = {shm()->multiSize.y, detId}; int args[2] = {shm()->numberOfDetector.y, detId};
sendToDetector(F_SET_POSITION, args, nullptr); sendToDetector(F_SET_POSITION, args, nullptr);
} }
@ -1434,15 +1434,17 @@ void Module::setReceiverHostname(const std::string &receiverIP) {
// populate from shared memory // populate from shared memory
retval.detType = shm()->myDetectorType; retval.detType = shm()->myDetectorType;
retval.multiSize.x = shm()->multiSize.x; retval.numberOfDetector.x = shm()->numberOfDetector.x;
retval.multiSize.y = shm()->multiSize.y; retval.numberOfDetector.y = shm()->numberOfDetector.y;
retval.detId = detId; retval.detId = detId;
memset(retval.hostname, 0, sizeof(retval.hostname)); memset(retval.hostname, 0, sizeof(retval.hostname));
strcpy_safe(retval.hostname, shm()->hostname); strcpy_safe(retval.hostname, shm()->hostname);
LOG(logDEBUG1) << "detType:" << retval.detType << std::endl LOG(logDEBUG1) << "detType:" << retval.detType << std::endl
<< "multiSize.x:" << retval.multiSize.x << std::endl << "numberOfDetector.x:" << retval.numberOfDetector.x
<< "multiSize.y:" << retval.multiSize.y << std::endl << std::endl
<< "numberOfDetector.y:" << retval.numberOfDetector.y
<< std::endl
<< "detId:" << retval.detId << std::endl << "detId:" << retval.detId << std::endl
<< "hostname:" << retval.hostname << std::endl << "hostname:" << retval.hostname << std::endl
<< "udpInterfaces:" << retval.udpInterfaces << std::endl << "udpInterfaces:" << retval.udpInterfaces << std::endl

View File

@ -26,20 +26,14 @@ struct sharedSlsDetector {
/* FIXED PATTERN FOR STATIC FUNCTIONS. DO NOT CHANGE, ONLY APPEND ------*/ /* FIXED PATTERN FOR STATIC FUNCTIONS. DO NOT CHANGE, ONLY APPEND ------*/
/** shared memory version */
int shmversion; int shmversion;
/** is the hostname (or IP address) of the detector. needs to be set
* before starting the communication */
char hostname[MAX_STR_LENGTH]; char hostname[MAX_STR_LENGTH];
/** detector type \ see :: detectorType*/
slsDetectorDefs::detectorType myDetectorType; slsDetectorDefs::detectorType myDetectorType;
/** END OF FIXED PATTERN -----------------------------------------------*/ /** END OF FIXED PATTERN -----------------------------------------------*/
/** Number of detectors in multi list in x dir and y dir */ /** Number of detectors in multi list in x dir and y dir */
slsDetectorDefs::xy multiSize; slsDetectorDefs::xy numberOfDetector;
/** is the port used for control functions */ /** is the port used for control functions */
int controlPort; int controlPort;
@ -212,7 +206,7 @@ class Module : public virtual slsDetectorDefs {
* Set Detector offset in shared memory in dimension d * Set Detector offset in shared memory in dimension d
* @param det detector size * @param det detector size
*/ */
void updateMultiSize(slsDetectorDefs::xy det); void updateNumberOfDetector(slsDetectorDefs::xy det);
int setControlPort(int port_number); int setControlPort(int port_number);

View File

@ -339,8 +339,10 @@ int ClientInterface::get_version(Interface &socket) {
int ClientInterface::setup_receiver(Interface &socket) { int ClientInterface::setup_receiver(Interface &socket) {
auto arg = socket.Receive<rxParameters>(); auto arg = socket.Receive<rxParameters>();
LOG(logDEBUG) << "detType:" << arg.detType << std::endl LOG(logDEBUG) << "detType:" << arg.detType << std::endl
<< "multiSize.x:" << arg.multiSize.x << std::endl << "numberOfDetector.x:" << arg.numberOfDetector.x
<< "multiSize.y:" << arg.multiSize.y << std::endl << std::endl
<< "numberOfDetector.y:" << arg.numberOfDetector.y
<< std::endl
<< "detId:" << arg.detId << std::endl << "detId:" << arg.detId << std::endl
<< "hostname:" << arg.hostname << std::endl << "hostname:" << arg.hostname << std::endl
<< "udpInterfaces:" << arg.udpInterfaces << std::endl << "udpInterfaces:" << arg.udpInterfaces << std::endl
@ -389,8 +391,8 @@ int ClientInterface::setup_receiver(Interface &socket) {
// basic setup // basic setup
setDetectorType(arg.detType); setDetectorType(arg.detType);
{ {
int msize[2] = {arg.multiSize.x, arg.multiSize.y}; int msize[2] = {arg.numberOfDetector.x, arg.numberOfDetector.y};
impl()->setMultiDetectorSize(msize); impl()->setDetectorSize(msize);
} }
impl()->setDetectorPositionId(arg.detId); impl()->setDetectorPositionId(arg.detId);
impl()->setDetectorHostname(arg.hostname); impl()->setDetectorHostname(arg.hostname);

View File

@ -315,12 +315,12 @@ void Implementation::setDetectorType(const detectorType d) {
LOG(logDEBUG) << " Detector type set to " << sls::ToString(d); LOG(logDEBUG) << " Detector type set to " << sls::ToString(d);
} }
int *Implementation::getMultiDetectorSize() const { int *Implementation::getDetectorSize() const {
LOG(logDEBUG3) << __SHORT_AT__ << " called"; LOG(logDEBUG3) << __SHORT_AT__ << " called";
return (int *)numDet; return (int *)numDet;
} }
void Implementation::setMultiDetectorSize(const int *size) { void Implementation::setDetectorSize(const int *size) {
LOG(logDEBUG3) << __SHORT_AT__ << " called"; LOG(logDEBUG3) << __SHORT_AT__ << " called";
std::string log_message = "Detector Size (ports): ("; std::string log_message = "Detector Size (ports): (";
for (int i = 0; i < MAX_DIMENSIONS; ++i) { for (int i = 0; i < MAX_DIMENSIONS; ++i) {
@ -1062,7 +1062,7 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
SetThreadPriorities(); SetThreadPriorities();
// update (from 1 to 2 interface) & also for printout // update (from 1 to 2 interface) & also for printout
setMultiDetectorSize(numDet); setDetectorSize(numDet);
// update row and column in dataprocessor // update row and column in dataprocessor
setDetectorPositionId(detID); setDetectorPositionId(detID);

View File

@ -28,8 +28,8 @@ class Implementation : private virtual slsDetectorDefs {
* ************************************************/ * ************************************************/
void setDetectorType(const detectorType d); void setDetectorType(const detectorType d);
int *getMultiDetectorSize() const; int *getDetectorSize() const;
void setMultiDetectorSize(const int *size); void setDetectorSize(const int *size);
int getDetectorPositionId() const; int getDetectorPositionId() const;
void setDetectorPositionId(const int id); void setDetectorPositionId(const int id);
std::string getDetectorHostname() const; std::string getDetectorHostname() const;

View File

@ -445,7 +445,7 @@ typedef struct {
*/ */
struct rxParameters { struct rxParameters {
detectorType detType{GENERIC}; detectorType detType{GENERIC};
xy multiSize; xy numberOfDetector;
int detId{0}; int detId{0};
char hostname[MAX_STR_LENGTH]; char hostname[MAX_STR_LENGTH];
int udpInterfaces{1}; int udpInterfaces{1};