Stoppedflag (#44)

* removed stopped flag from multi and sls shm, since its removed from fixed pattern in sls, slsshmversion api also added to get hostname and type

* clang format
This commit is contained in:
Dhanya Thattil 2019-07-29 11:35:21 +02:00 committed by Erik Fröjdh
parent b524e0c95f
commit 64a8dd2def
4 changed files with 553 additions and 574 deletions

View File

@ -50,10 +50,6 @@ struct sharedMultiSlsDetector {
/** Number of detectors operated at once */
int numberOfDetector[2];
/** stopped flag - is set if an acquisition error occurs or the detector
* is stopped manually. Is reset to 0 at the start of the acquisition */
int stoppedFlag;
/** size of the data that are transfered from all detectors */
int dataBytes;

View File

@ -12,6 +12,7 @@
class ServerInterface;
#define SLS_SHMAPIVERSION 0x190726
#define SLS_SHMVERSION 0x190726
/**
@ -24,13 +25,6 @@ struct sharedSlsDetector {
/** shared memory version */
int shmversion;
/** is the port used for control functions */
int controlPort;
/** stopped flag - is set if an acquisition error occurs or the detector
* is stopped manually. Is reset to 0 at the start of the acquisition */
int stoppedFlag;
/** is the hostname (or IP address) of the detector. needs to be set
* before starting the communication */
char hostname[MAX_STR_LENGTH];
@ -47,6 +41,9 @@ struct sharedSlsDetector {
/** Number of detectors in multi list in x dir and y dir */
int multiSize[2];
/** is the port used for control functions */
int controlPort;
/** is the port used to stop the acquisition */
int stopPort;
@ -259,6 +256,11 @@ class slsDetector : public virtual slsDetectorDefs{
*/
virtual ~slsDetector();
/**
* Returns false if it cannot get fixed pattern from an old version of shm (hostname, type), else true
*/
bool isFixedPatternSharedMemoryCompatible();
/**
* Check version compatibility with receiver software
*/

View File

@ -274,10 +274,13 @@ std::string multiSlsDetector::getUserDetails() {
}
std::ostringstream sstream;
sstream << "\nHostname: " << getHostname();
sstream << "\nHostname: ";
for (auto &d : detectors) {
sstream << (d->isFixedPatternSharedMemoryCompatible() ? d->getHostname() : "Unknown") << "+";
}
sstream << "\nType: ";
for (auto &d : detectors) {
sstream << d->getDetectorTypeAsString() << "+";
sstream << (d->isFixedPatternSharedMemoryCompatible() ? d->getDetectorTypeAsString() : "Unknown") << "+";
}
sstream << "\nPID: " << multi_shm()->lastPID
@ -310,7 +313,6 @@ void multiSlsDetector::initializeDetectorStructure() {
multi_shm()->numberOfDetectors = 0;
multi_shm()->numberOfDetector[X] = 0;
multi_shm()->numberOfDetector[Y] = 0;
multi_shm()->stoppedFlag = 0;
multi_shm()->dataBytes = 0;
multi_shm()->dataBytesInclGapPixels = 0;
multi_shm()->numberOfChannels = 0;
@ -992,14 +994,8 @@ void multiSlsDetector::stopAcquisition(int detPos) {
// thread)
std::lock_guard<std::mutex> lock(mg);
if (detPos >= 0) {
// if only 1 detector, set flag to stop current acquisition
if (detectors.size() == 1) {
multi_shm()->stoppedFlag = 1;
}
detectors[detPos]->stopAcquisition();
} else {
multi_shm()->stoppedFlag = 1;
parallelCall(&slsDetector::stopAcquisition);
}
}
@ -4188,7 +4184,6 @@ int multiSlsDetector::acquire() {
bool receiver = getUseReceiverFlag();
progressIndex = 0;
multi_shm()->stoppedFlag = 0;
setJoinThreadFlag(false);
// verify receiver is idle
@ -4202,22 +4197,20 @@ int multiSlsDetector::acquire() {
startProcessingThread();
// resets frames caught in receiver
if (receiver && multi_shm()->stoppedFlag == 0) {
if (receiver) {
std::lock_guard<std::mutex> lock(mg);
resetFramesCaught();
}
// start receiver
if (receiver && multi_shm()->stoppedFlag == 0) {
if (receiver) {
std::lock_guard<std::mutex> lock(mg);
startReceiver();
// let processing thread listen to these packets
if (multi_shm()->stoppedFlag == 0)
sem_post(&sem_newRTAcquisition);
sem_post(&sem_newRTAcquisition);
}
if (multi_shm()->stoppedFlag == 0)
startAndReadAll();
startAndReadAll();
// stop receiver
if (receiver) {

File diff suppressed because it is too large Load Diff