mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 21:37:13 +02:00
clang format
This commit is contained in:
@ -1027,14 +1027,14 @@ int ClientInterface::set_flip_rows(Interface &socket) {
|
||||
throw RuntimeError("Could not set flip rows. Invalid argument: " +
|
||||
std::to_string(arg));
|
||||
}
|
||||
verifyIdle(socket);
|
||||
LOG(logDEBUG1) << "Setting flip rows:" << arg;
|
||||
impl()->setFlipRows(static_cast<bool>(arg));
|
||||
verifyIdle(socket);
|
||||
LOG(logDEBUG1) << "Setting flip rows:" << arg;
|
||||
impl()->setFlipRows(static_cast<bool>(arg));
|
||||
|
||||
int retval = impl()->getFlipRows();
|
||||
validate(arg, retval, std::string("set flip rows"), DEC);
|
||||
LOG(logDEBUG1) << "Flip rows:" << retval;
|
||||
return socket.sendResult(retval);
|
||||
int retval = impl()->getFlipRows();
|
||||
validate(arg, retval, std::string("set flip rows"), DEC);
|
||||
LOG(logDEBUG1) << "Flip rows:" << retval;
|
||||
return socket.sendResult(retval);
|
||||
}
|
||||
|
||||
int ClientInterface::set_file_format(Interface &socket) {
|
||||
@ -1372,7 +1372,8 @@ int ClientInterface::set_read_n_rows(Interface &socket) {
|
||||
if (arg >= 0) {
|
||||
verifyIdle(socket);
|
||||
if (detType != EIGER && detType != JUNGFRAU) {
|
||||
throw RuntimeError("Could not set number of rows. Not implemented for this detector");
|
||||
throw RuntimeError("Could not set number of rows. Not implemented "
|
||||
"for this detector");
|
||||
}
|
||||
LOG(logDEBUG1) << "Setting number of rows:" << arg;
|
||||
impl()->setReadNRows(arg);
|
||||
@ -1699,4 +1700,3 @@ int ClientInterface::set_detector_datastream(Interface &socket) {
|
||||
impl()->setDetectorDataStream(port, enable);
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,6 @@ class ClientInterface : private virtual slsDetectorDefs {
|
||||
int set_all_threshold(sls::ServerInterface &socket);
|
||||
int set_detector_datastream(sls::ServerInterface &socket);
|
||||
|
||||
|
||||
Implementation *impl() {
|
||||
if (receiver != nullptr) {
|
||||
return receiver.get();
|
||||
|
@ -28,11 +28,11 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
||||
|
||||
public:
|
||||
DataProcessor(int index, detectorType detectorType, Fifo *fifo,
|
||||
bool *activated, bool *dataStreamEnable, uint32_t *streamingFrequency,
|
||||
uint32_t *streamingTimerInMs, uint32_t *streamingStartFnum,
|
||||
bool *framePadding, std::vector<int> *ctbDbitList,
|
||||
int *ctbDbitOffset, int *ctbAnalogDataBytes,
|
||||
std::mutex *hdf5Lib);
|
||||
bool *activated, bool *dataStreamEnable,
|
||||
uint32_t *streamingFrequency, uint32_t *streamingTimerInMs,
|
||||
uint32_t *streamingStartFnum, bool *framePadding,
|
||||
std::vector<int> *ctbDbitList, int *ctbDbitOffset,
|
||||
int *ctbAnalogDataBytes, std::mutex *hdf5Lib);
|
||||
|
||||
~DataProcessor() override;
|
||||
|
||||
@ -61,10 +61,8 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
||||
const int numUnitsPerReadout,
|
||||
const uint32_t udpPortNumber,
|
||||
const uint32_t maxFramesPerFile,
|
||||
const uint64_t numImages,
|
||||
const uint32_t dynamicRange,
|
||||
const bool detectorDataStream
|
||||
);
|
||||
const uint64_t numImages, const uint32_t dynamicRange,
|
||||
const bool detectorDataStream);
|
||||
#ifdef HDF5C
|
||||
uint32_t GetFilesInAcquisition() const;
|
||||
void CreateVirtualFile(const std::string filePath,
|
||||
|
@ -193,8 +193,8 @@ void DataStreamer::ProcessAnImage(char *buf) {
|
||||
}
|
||||
if (!zmqSocket->SendData(
|
||||
buf + FIFO_HEADER_NUMBYTES + sizeof(sls_receiver_header),
|
||||
(uint32_t)(
|
||||
*((uint32_t *)buf)))) { // new size possibly from callback
|
||||
(uint32_t)(*(
|
||||
(uint32_t *)buf)))) { // new size possibly from callback
|
||||
LOG(logERROR) << "Could not send zmq data for fnum " << fnum
|
||||
<< " and streamer " << index;
|
||||
}
|
||||
|
@ -171,10 +171,10 @@ void Implementation::setDetectorType(const detectorType d) {
|
||||
&actualUDPSocketBufferSize, &framesPerFile, &frameDiscardMode,
|
||||
&activated, &detectorDataStream[i], &silentMode));
|
||||
dataProcessor.push_back(sls::make_unique<DataProcessor>(
|
||||
i, detType, fifo_ptr, &activated,
|
||||
&dataStreamEnable, &streamingFrequency, &streamingTimerInMs,
|
||||
&streamingStartFnum, &framePadding, &ctbDbitList,
|
||||
&ctbDbitOffset, &ctbAnalogDataBytes, &hdf5Lib));
|
||||
i, detType, fifo_ptr, &activated, &dataStreamEnable,
|
||||
&streamingFrequency, &streamingTimerInMs, &streamingStartFnum,
|
||||
&framePadding, &ctbDbitList, &ctbDbitOffset,
|
||||
&ctbAnalogDataBytes, &hdf5Lib));
|
||||
} catch (...) {
|
||||
listener.clear();
|
||||
dataProcessor.clear();
|
||||
@ -621,10 +621,10 @@ void Implementation::stopReceiver() {
|
||||
}
|
||||
if (!detectorDataStream[0]) {
|
||||
LOG(logINFORED) << "Deactivated Left Port";
|
||||
}
|
||||
if (!detectorDataStream[1]) {
|
||||
}
|
||||
if (!detectorDataStream[1]) {
|
||||
LOG(logINFORED) << "Deactivated Right Port";
|
||||
}
|
||||
}
|
||||
// callback
|
||||
if (acquisitionFinishedCallBack) {
|
||||
try {
|
||||
@ -810,8 +810,8 @@ void Implementation::SetupWriter() {
|
||||
dataProcessor[i]->CreateFirstFiles(
|
||||
masterAttributes.get(), filePath, fileName, fileIndex,
|
||||
overwriteEnable, silentMode, modulePos, numThreads,
|
||||
udpPortNum[i], framesPerFile, numberOfTotalFrames,
|
||||
dynamicRange, detectorDataStream[i]);
|
||||
udpPortNum[i], framesPerFile, numberOfTotalFrames, dynamicRange,
|
||||
detectorDataStream[i]);
|
||||
}
|
||||
} catch (const sls::RuntimeError &e) {
|
||||
shutDownUDPSockets();
|
||||
@ -882,12 +882,13 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
||||
i, detType, fifo_ptr, &status, &udpPortNum[i], ð[i],
|
||||
&numberOfTotalFrames, &udpSocketBufferSize,
|
||||
&actualUDPSocketBufferSize, &framesPerFile,
|
||||
&frameDiscardMode, &activated, &detectorDataStream[i], &silentMode));
|
||||
&frameDiscardMode, &activated, &detectorDataStream[i],
|
||||
&silentMode));
|
||||
listener[i]->SetGeneralData(generalData);
|
||||
|
||||
dataProcessor.push_back(sls::make_unique<DataProcessor>(
|
||||
i, detType, fifo_ptr, &activated,
|
||||
&dataStreamEnable, &streamingFrequency, &streamingTimerInMs,
|
||||
i, detType, fifo_ptr, &activated, &dataStreamEnable,
|
||||
&streamingFrequency, &streamingTimerInMs,
|
||||
&streamingStartFnum, &framePadding, &ctbDbitList,
|
||||
&ctbDbitOffset, &ctbAnalogDataBytes, &hdf5Lib));
|
||||
dataProcessor[i]->SetGeneralData(generalData);
|
||||
|
@ -214,8 +214,10 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
* padding is enabled (as it will receive nothing from detector) */
|
||||
void setActivate(const bool enable);
|
||||
bool getDetectorDataStream(const portPosition port) const;
|
||||
/** [Eiger] If datastream is disabled, receiver will create dummy data if deactivated
|
||||
* padding for that port is enabled (as it will receive nothing from detector) */
|
||||
/** [Eiger] If datastream is disabled, receiver will create dummy data if
|
||||
* deactivated
|
||||
* padding for that port is enabled (as it will receive nothing from
|
||||
* detector) */
|
||||
void setDetectorDataStream(const portPosition port, const bool enable);
|
||||
int getReadNRows() const;
|
||||
/* [Eiger][Jungfrau] */
|
||||
|
@ -24,7 +24,7 @@ const std::string Listener::TypeName = "Listener";
|
||||
Listener::Listener(int ind, detectorType dtype, Fifo *f,
|
||||
std::atomic<runStatus> *s, uint32_t *portno, std::string *e,
|
||||
uint64_t *nf, int *us, int *as, uint32_t *fpf,
|
||||
frameDiscardPolicy *fdp, bool *act, bool* detds, bool *sm)
|
||||
frameDiscardPolicy *fdp, bool *act, bool *detds, bool *sm)
|
||||
: ThreadObject(ind, TypeName), fifo(f), myDetectorType(dtype), status(s),
|
||||
udpPortNumber(portno), eth(e), numImages(nf), udpSocketBufferSize(us),
|
||||
actualUDPSocketBufferSize(as), framesPerFile(fpf), frameDiscardMode(fdp),
|
||||
@ -203,7 +203,8 @@ void Listener::ThreadExecution() {
|
||||
<< std::hex << (void *)(buffer) << std::dec << ":" << buffer;
|
||||
|
||||
// udpsocket doesnt exist
|
||||
if (*activated && *detectorDataStream && !udpSocketAlive && !carryOverFlag) {
|
||||
if (*activated && *detectorDataStream && !udpSocketAlive &&
|
||||
!carryOverFlag) {
|
||||
// LOG(logERROR) << "Listening_Thread " << index << ": UDP Socket not
|
||||
// created or shut down earlier";
|
||||
(*((uint32_t *)buffer)) = 0;
|
||||
@ -212,7 +213,8 @@ void Listener::ThreadExecution() {
|
||||
}
|
||||
|
||||
// get data
|
||||
if ((*status != TRANSMITTING && (!(*activated) || !(*detectorDataStream) || udpSocketAlive)) ||
|
||||
if ((*status != TRANSMITTING &&
|
||||
(!(*activated) || !(*detectorDataStream) || udpSocketAlive)) ||
|
||||
carryOverFlag) {
|
||||
rc = ListenToAnImage(buffer);
|
||||
}
|
||||
|
@ -44,7 +44,8 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
|
||||
*/
|
||||
Listener(int ind, detectorType dtype, Fifo *f, std::atomic<runStatus> *s,
|
||||
uint32_t *portno, std::string *e, uint64_t *nf, int *us, int *as,
|
||||
uint32_t *fpf, frameDiscardPolicy *fdp, bool *act, bool* detds, bool *sm);
|
||||
uint32_t *fpf, frameDiscardPolicy *fdp, bool *act, bool *detds,
|
||||
bool *sm);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
@ -189,7 +190,7 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
|
||||
bool *activated;
|
||||
|
||||
/** detector data stream */
|
||||
bool* detectorDataStream;
|
||||
bool *detectorDataStream;
|
||||
|
||||
/** Silent Mode */
|
||||
bool *silentMode;
|
||||
|
@ -436,7 +436,7 @@ class EigerMasterAttributes : public MasterAttributes {
|
||||
DataSpace dataspaceAttr = DataSpace(H5S_SCALAR);
|
||||
StrType strdatatype(PredType::C_S1, 256);
|
||||
Attribute attribute =
|
||||
dataset.createAttribute("Unit", strdatatype, dataspaceAttr);
|
||||
dataset.createAttribute("Unit", strdatatype, dataspaceAttr);
|
||||
sls::strcpy_safe(c, "eV");
|
||||
attribute.write(strdatatype, c);
|
||||
}
|
||||
@ -454,7 +454,7 @@ class EigerMasterAttributes : public MasterAttributes {
|
||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
||||
StrType strdatatype(PredType::C_S1, 256);
|
||||
DataSet dataset =
|
||||
group->createDataSet("Sub Period", strdatatype, dataspace);
|
||||
group->createDataSet("Sub Period", strdatatype, dataspace);
|
||||
sls::strcpy_safe(c, sls::ToString(subPeriod));
|
||||
dataset.write(c, strdatatype);
|
||||
}
|
||||
@ -462,7 +462,7 @@ class EigerMasterAttributes : public MasterAttributes {
|
||||
{
|
||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
||||
DataSet dataset =
|
||||
group->createDataSet("Quad", PredType::NATIVE_INT, dataspace);
|
||||
group->createDataSet("Quad", PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&quad, PredType::NATIVE_INT);
|
||||
}
|
||||
// readNRows
|
||||
|
2
slsReceiverSoftware/src/receiver_defs.h
Executable file → Normal file
2
slsReceiverSoftware/src/receiver_defs.h
Executable file → Normal file
@ -44,7 +44,7 @@
|
||||
#define MAX_CHUNKED_IMAGES (1)
|
||||
|
||||
// parameters to calculate fifo depth
|
||||
#define SAMPLE_TIME_IN_NS (100000000) // 100ms
|
||||
#define SAMPLE_TIME_IN_NS (100000000) // 100ms
|
||||
|
||||
// to differentiate between gotthard and short gotthard
|
||||
#define GOTTHARD_PACKET_SIZE (1286)
|
||||
|
Reference in New Issue
Block a user