mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 07:20:01 +02:00
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:
parent
b524e0c95f
commit
64a8dd2def
@ -50,10 +50,6 @@ struct sharedMultiSlsDetector {
|
|||||||
/** Number of detectors operated at once */
|
/** Number of detectors operated at once */
|
||||||
int numberOfDetector[2];
|
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 */
|
/** size of the data that are transfered from all detectors */
|
||||||
int dataBytes;
|
int dataBytes;
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
class ServerInterface;
|
class ServerInterface;
|
||||||
|
|
||||||
|
#define SLS_SHMAPIVERSION 0x190726
|
||||||
#define SLS_SHMVERSION 0x190726
|
#define SLS_SHMVERSION 0x190726
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -24,13 +25,6 @@ struct sharedSlsDetector {
|
|||||||
/** shared memory version */
|
/** shared memory version */
|
||||||
int shmversion;
|
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
|
/** is the hostname (or IP address) of the detector. needs to be set
|
||||||
* before starting the communication */
|
* before starting the communication */
|
||||||
char hostname[MAX_STR_LENGTH];
|
char hostname[MAX_STR_LENGTH];
|
||||||
@ -47,6 +41,9 @@ struct sharedSlsDetector {
|
|||||||
/** Number of detectors in multi list in x dir and y dir */
|
/** Number of detectors in multi list in x dir and y dir */
|
||||||
int multiSize[2];
|
int multiSize[2];
|
||||||
|
|
||||||
|
/** is the port used for control functions */
|
||||||
|
int controlPort;
|
||||||
|
|
||||||
/** is the port used to stop the acquisition */
|
/** is the port used to stop the acquisition */
|
||||||
int stopPort;
|
int stopPort;
|
||||||
|
|
||||||
@ -259,6 +256,11 @@ class slsDetector : public virtual slsDetectorDefs{
|
|||||||
*/
|
*/
|
||||||
virtual ~slsDetector();
|
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
|
* Check version compatibility with receiver software
|
||||||
*/
|
*/
|
||||||
|
@ -274,10 +274,13 @@ std::string multiSlsDetector::getUserDetails() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::ostringstream sstream;
|
std::ostringstream sstream;
|
||||||
sstream << "\nHostname: " << getHostname();
|
sstream << "\nHostname: ";
|
||||||
|
for (auto &d : detectors) {
|
||||||
|
sstream << (d->isFixedPatternSharedMemoryCompatible() ? d->getHostname() : "Unknown") << "+";
|
||||||
|
}
|
||||||
sstream << "\nType: ";
|
sstream << "\nType: ";
|
||||||
for (auto &d : detectors) {
|
for (auto &d : detectors) {
|
||||||
sstream << d->getDetectorTypeAsString() << "+";
|
sstream << (d->isFixedPatternSharedMemoryCompatible() ? d->getDetectorTypeAsString() : "Unknown") << "+";
|
||||||
}
|
}
|
||||||
|
|
||||||
sstream << "\nPID: " << multi_shm()->lastPID
|
sstream << "\nPID: " << multi_shm()->lastPID
|
||||||
@ -310,7 +313,6 @@ void multiSlsDetector::initializeDetectorStructure() {
|
|||||||
multi_shm()->numberOfDetectors = 0;
|
multi_shm()->numberOfDetectors = 0;
|
||||||
multi_shm()->numberOfDetector[X] = 0;
|
multi_shm()->numberOfDetector[X] = 0;
|
||||||
multi_shm()->numberOfDetector[Y] = 0;
|
multi_shm()->numberOfDetector[Y] = 0;
|
||||||
multi_shm()->stoppedFlag = 0;
|
|
||||||
multi_shm()->dataBytes = 0;
|
multi_shm()->dataBytes = 0;
|
||||||
multi_shm()->dataBytesInclGapPixels = 0;
|
multi_shm()->dataBytesInclGapPixels = 0;
|
||||||
multi_shm()->numberOfChannels = 0;
|
multi_shm()->numberOfChannels = 0;
|
||||||
@ -992,14 +994,8 @@ void multiSlsDetector::stopAcquisition(int detPos) {
|
|||||||
// thread)
|
// thread)
|
||||||
std::lock_guard<std::mutex> lock(mg);
|
std::lock_guard<std::mutex> lock(mg);
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
// if only 1 detector, set flag to stop current acquisition
|
|
||||||
if (detectors.size() == 1) {
|
|
||||||
multi_shm()->stoppedFlag = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
detectors[detPos]->stopAcquisition();
|
detectors[detPos]->stopAcquisition();
|
||||||
} else {
|
} else {
|
||||||
multi_shm()->stoppedFlag = 1;
|
|
||||||
parallelCall(&slsDetector::stopAcquisition);
|
parallelCall(&slsDetector::stopAcquisition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4188,7 +4184,6 @@ int multiSlsDetector::acquire() {
|
|||||||
|
|
||||||
bool receiver = getUseReceiverFlag();
|
bool receiver = getUseReceiverFlag();
|
||||||
progressIndex = 0;
|
progressIndex = 0;
|
||||||
multi_shm()->stoppedFlag = 0;
|
|
||||||
setJoinThreadFlag(false);
|
setJoinThreadFlag(false);
|
||||||
|
|
||||||
// verify receiver is idle
|
// verify receiver is idle
|
||||||
@ -4202,22 +4197,20 @@ int multiSlsDetector::acquire() {
|
|||||||
startProcessingThread();
|
startProcessingThread();
|
||||||
|
|
||||||
// resets frames caught in receiver
|
// resets frames caught in receiver
|
||||||
if (receiver && multi_shm()->stoppedFlag == 0) {
|
if (receiver) {
|
||||||
std::lock_guard<std::mutex> lock(mg);
|
std::lock_guard<std::mutex> lock(mg);
|
||||||
resetFramesCaught();
|
resetFramesCaught();
|
||||||
}
|
}
|
||||||
|
|
||||||
// start receiver
|
// start receiver
|
||||||
if (receiver && multi_shm()->stoppedFlag == 0) {
|
if (receiver) {
|
||||||
std::lock_guard<std::mutex> lock(mg);
|
std::lock_guard<std::mutex> lock(mg);
|
||||||
startReceiver();
|
startReceiver();
|
||||||
// let processing thread listen to these packets
|
// 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
|
// stop receiver
|
||||||
if (receiver) {
|
if (receiver) {
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user