mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 03:10:02 +02:00
update release
This commit is contained in:
commit
5d16ba7e16
@ -19,6 +19,7 @@ Checks: '*,
|
||||
-google-readability-braces-around-statements,
|
||||
-modernize-use-trailing-return-type,
|
||||
-readability-isolate-declaration,
|
||||
-readability-implicit-bool-conversion,
|
||||
-llvmlibc-*'
|
||||
|
||||
HeaderFilterRegex: \.h
|
||||
|
@ -61,7 +61,9 @@ This document describes the differences between v7.0.0 and v6.x.x
|
||||
- fixed bug introduced in 6.0.0: hdf5 files created 1 file per frame after the initial file which had maxframesperfile
|
||||
- updatedetectorserver - removes old server current binary pointing to for blackfin
|
||||
- removing copydetectorserver using tftp
|
||||
|
||||
- registerCallBackRawDataReady and registerCallBackRawDataModifyReady now gives a sls_receiver_header* instead of a char*, and uint32_t to size_t
|
||||
- registerCallBackStartAcquisition gave incorrect imagesize (+120 bytes). corrected.
|
||||
- registerCallBackStartAcquisition parameter is a const string reference
|
||||
|
||||
2. Resolved Issues
|
||||
==================
|
||||
|
@ -45,6 +45,7 @@ int main() {
|
||||
|
||||
for (const auto &cmd : commands) {
|
||||
std::ostringstream os;
|
||||
std::cout << cmd << '\n';
|
||||
proxy.Call(cmd, {}, -1, slsDetectorDefs::HELP_ACTION, os);
|
||||
|
||||
auto tmp = os.str().erase(0, cmd.size());
|
||||
|
@ -1056,7 +1056,18 @@ std::string CmdProxy::TemperatureValues(int action) {
|
||||
std::string CmdProxy::Dac(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
|
||||
if (action == defs::HELP_ACTION) {
|
||||
if (args.size() == 0) {
|
||||
os << GetHelpDac(std::to_string(0)) << '\n';
|
||||
} else {
|
||||
os << args[0] << ' ' << GetHelpDac(args[0]) << '\n';
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
auto type = det->getDetectorType().squash();
|
||||
|
||||
// dac indices only for ctb
|
||||
if (args.size() > 0 && action != defs::HELP_ACTION) {
|
||||
if (is_int(args[0]) && type != defs::CHIPTESTBOARD) {
|
||||
@ -1066,13 +1077,7 @@ std::string CmdProxy::Dac(int action) {
|
||||
}
|
||||
}
|
||||
|
||||
if (action == defs::HELP_ACTION) {
|
||||
if (args.size() == 0) {
|
||||
os << GetHelpDac(std::to_string(0)) << '\n';
|
||||
} else {
|
||||
os << args[0] << ' ' << GetHelpDac(args[0]) << '\n';
|
||||
}
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (action == defs::GET_ACTION) {
|
||||
if (args.empty())
|
||||
WrongNumberOfParameters(1); // This prints slightly wrong
|
||||
|
||||
|
@ -16,6 +16,17 @@ using sls::Detector;
|
||||
using test::GET;
|
||||
using test::PUT;
|
||||
|
||||
TEST_CASE("Calling help doesn't throw or cause segfault"){
|
||||
//Dont add [.cmd] tag this should run with normal tests
|
||||
CmdProxy proxy(nullptr);
|
||||
auto commands = proxy.GetProxyCommands();
|
||||
std::ostringstream os;
|
||||
for (const auto &cmd : commands)
|
||||
REQUIRE_NOTHROW(proxy.Call(cmd, {}, -1, slsDetectorDefs::HELP_ACTION, os));
|
||||
|
||||
|
||||
}
|
||||
|
||||
TEST_CASE("Unknown command", "[.cmd]") {
|
||||
|
||||
Detector det;
|
||||
|
@ -39,52 +39,50 @@ class Receiver : private virtual slsDetectorDefs {
|
||||
int64_t getReceiverVersion();
|
||||
|
||||
/**
|
||||
* Call back for start acquisition
|
||||
* callback arguments are
|
||||
* filepath
|
||||
* filename
|
||||
* fileindex
|
||||
* datasize
|
||||
*
|
||||
* return value is undefined at the moment
|
||||
* we write depending on file write enable
|
||||
* users get data to write depending on call backs registered
|
||||
* Start Acquisition Call back (slsMultiReceiver writes data if file write enabled)
|
||||
* if registerCallBackRawDataReady or registerCallBackRawDataModifyReady registered,
|
||||
* users get data
|
||||
* callback arguments are:
|
||||
* - file path
|
||||
* - file name prefix
|
||||
* - file index
|
||||
* - image size in bytes
|
||||
*/
|
||||
void registerCallBackStartAcquisition(int (*func)(std::string, std::string,
|
||||
uint64_t, uint32_t,
|
||||
void *),
|
||||
void registerCallBackStartAcquisition(int (*func)(const std::string &, const std::string &,
|
||||
uint64_t, size_t, void *),
|
||||
void *arg);
|
||||
|
||||
/**
|
||||
* Call back for acquisition finished
|
||||
* callback argument is
|
||||
* total frames caught
|
||||
* callback argument is:
|
||||
* - total frames caught
|
||||
*/
|
||||
void registerCallBackAcquisitionFinished(void (*func)(uint64_t, void *),
|
||||
void *arg);
|
||||
|
||||
/**
|
||||
* Call back for raw data
|
||||
* args to raw data ready callback are
|
||||
* sls_receiver_header frame metadata,
|
||||
* dataPointer is the pointer to the data,
|
||||
* dataSize in bytes is the size of the data in bytes.
|
||||
* args to raw data ready callback are:
|
||||
* - sls_receiver_header frame metadata,
|
||||
* - pointer to data
|
||||
* - image size in bytes
|
||||
*/
|
||||
void registerCallBackRawDataReady(void (*func)(char *, char *, uint32_t,
|
||||
void *),
|
||||
void registerCallBackRawDataReady(void (*func)(sls_receiver_header *,
|
||||
char *, size_t, void *),
|
||||
void *arg);
|
||||
|
||||
/**
|
||||
* Call back for raw data (modified)
|
||||
* args to raw data ready callback are
|
||||
* sls_receiver_header frame metadata,
|
||||
* dataPointer is the pointer to the data,
|
||||
* revDatasize is the reference of data size in bytes.
|
||||
* args to raw data ready callback are:
|
||||
* - sls_receiver_header frame metadata,
|
||||
* - pointer to data
|
||||
* - revDatasize is the reference of data size in bytes.
|
||||
* Can be modified to the new size to be written/streamed. (only smaller
|
||||
* value).
|
||||
* value allowed).
|
||||
*/
|
||||
void registerCallBackRawDataModifyReady(void (*func)(char *, char *,
|
||||
uint32_t &, void *),
|
||||
void registerCallBackRawDataModifyReady(void (*func)(sls_receiver_header *,
|
||||
char *, size_t &,
|
||||
void *),
|
||||
void *arg);
|
||||
|
||||
private:
|
||||
|
@ -55,7 +55,7 @@ int64_t ClientInterface::getReceiverVersion() { return APIRECEIVER; }
|
||||
|
||||
/***callback functions***/
|
||||
void ClientInterface::registerCallBackStartAcquisition(
|
||||
int (*func)(std::string, std::string, uint64_t, uint32_t, void *),
|
||||
int (*func)(const std::string &, const std::string &, uint64_t, size_t, void *),
|
||||
void *arg) {
|
||||
startAcquisitionCallBack = func;
|
||||
pStartAcquisition = arg;
|
||||
@ -69,13 +69,13 @@ void ClientInterface::registerCallBackAcquisitionFinished(void (*func)(uint64_t,
|
||||
}
|
||||
|
||||
void ClientInterface::registerCallBackRawDataReady(
|
||||
void (*func)(char *, char *, uint32_t, void *), void *arg) {
|
||||
void (*func)(sls_receiver_header *, char *, size_t, void *), void *arg) {
|
||||
rawDataReadyCallBack = func;
|
||||
pRawDataReady = arg;
|
||||
}
|
||||
|
||||
void ClientInterface::registerCallBackRawDataModifyReady(
|
||||
void (*func)(char *, char *, uint32_t &, void *), void *arg) {
|
||||
void (*func)(sls_receiver_header *, char *, size_t &, void *), void *arg) {
|
||||
rawDataModifyReadyCallBack = func;
|
||||
pRawDataReady = arg;
|
||||
}
|
||||
|
@ -30,25 +30,24 @@ class ClientInterface : private virtual slsDetectorDefs {
|
||||
int64_t getReceiverVersion();
|
||||
|
||||
//***callback functions***
|
||||
/** params: filepath, filename, fileindex, datasize */
|
||||
void registerCallBackStartAcquisition(int (*func)(std::string, std::string,
|
||||
uint64_t, uint32_t,
|
||||
void *),
|
||||
/** params: file path, file name, file index, image size */
|
||||
void registerCallBackStartAcquisition(int (*func)(const std::string &, const std::string &,
|
||||
uint64_t, size_t, void *),
|
||||
void *arg);
|
||||
|
||||
/** params: total frames caught */
|
||||
void registerCallBackAcquisitionFinished(void (*func)(uint64_t, void *),
|
||||
void *arg);
|
||||
|
||||
/** params: sls_receiver_header frame metadata, dataPointer, dataSize */
|
||||
void registerCallBackRawDataReady(void (*func)(char *, char *, uint32_t,
|
||||
void *),
|
||||
/** params: sls_receiver_header pointer, pointer to data, image size */
|
||||
void registerCallBackRawDataReady(void (*func)(sls_receiver_header *,
|
||||
char *, size_t, void *),
|
||||
void *arg);
|
||||
|
||||
/** params: sls_receiver_header frame metadata, dataPointer, modified size
|
||||
*/
|
||||
void registerCallBackRawDataModifyReady(void (*func)(char *, char *,
|
||||
uint32_t &, void *),
|
||||
/** params: sls_receiver_header pointer, pointer to data, reference to image size */
|
||||
void registerCallBackRawDataModifyReady(void (*func)(sls_receiver_header *,
|
||||
char *, size_t &,
|
||||
void *),
|
||||
void *arg);
|
||||
|
||||
private:
|
||||
@ -180,13 +179,14 @@ class ClientInterface : private virtual slsDetectorDefs {
|
||||
|
||||
//***callback parameters***
|
||||
|
||||
int (*startAcquisitionCallBack)(std::string, std::string, uint64_t,
|
||||
uint32_t, void *) = nullptr;
|
||||
int (*startAcquisitionCallBack)(const std::string &, const std::string &, uint64_t, size_t,
|
||||
void *) = nullptr;
|
||||
void *pStartAcquisition{nullptr};
|
||||
void (*acquisitionFinishedCallBack)(uint64_t, void *) = nullptr;
|
||||
void *pAcquisitionFinished{nullptr};
|
||||
void (*rawDataReadyCallBack)(char *, char *, uint32_t, void *) = nullptr;
|
||||
void (*rawDataModifyReadyCallBack)(char *, char *, uint32_t &,
|
||||
void (*rawDataReadyCallBack)(sls_receiver_header *, char *, size_t,
|
||||
void *) = nullptr;
|
||||
void (*rawDataModifyReadyCallBack)(sls_receiver_header *, char *, size_t &,
|
||||
void *) = nullptr;
|
||||
void *pRawDataReady{nullptr};
|
||||
|
||||
|
@ -42,14 +42,10 @@ DataProcessor::DataProcessor(int index, detectorType detectorType, Fifo *fifo,
|
||||
ctbAnalogDataBytes_(ctbAnalogDataBytes), firstStreamerFrame_(false) {
|
||||
|
||||
LOG(logDEBUG) << "DataProcessor " << index << " created";
|
||||
|
||||
memset((void *)&timerbegin_, 0, sizeof(timespec));
|
||||
}
|
||||
|
||||
DataProcessor::~DataProcessor() { DeleteFiles(); }
|
||||
|
||||
/** getters */
|
||||
|
||||
bool DataProcessor::GetStartedFlag() const { return startedFlag_; }
|
||||
|
||||
void DataProcessor::SetFifo(Fifo *fifo) { fifo_ = fifo; }
|
||||
@ -66,10 +62,8 @@ void DataProcessor::ResetParametersforNewAcquisition() {
|
||||
void DataProcessor::RecordFirstIndex(uint64_t fnum) {
|
||||
// listen to this fnum, later +1
|
||||
currentFrameIndex_ = fnum;
|
||||
|
||||
startedFlag_ = true;
|
||||
firstIndex_ = fnum;
|
||||
|
||||
LOG(logDEBUG1) << index << " First Index:" << firstIndex_;
|
||||
}
|
||||
|
||||
@ -84,10 +78,8 @@ void DataProcessor::CloseFiles() {
|
||||
|
||||
void DataProcessor::DeleteFiles() {
|
||||
CloseFiles();
|
||||
if (dataFile_) {
|
||||
delete dataFile_;
|
||||
dataFile_ = nullptr;
|
||||
}
|
||||
delete dataFile_;
|
||||
dataFile_ = nullptr;
|
||||
}
|
||||
void DataProcessor::SetupFileWriter(const bool filewriteEnable,
|
||||
const fileFormat fileFormatType,
|
||||
@ -231,13 +223,11 @@ std::string DataProcessor::CreateMasterFile(
|
||||
void DataProcessor::ThreadExecution() {
|
||||
char *buffer = nullptr;
|
||||
fifo_->PopAddress(buffer);
|
||||
LOG(logDEBUG5) << "DataProcessor " << index
|
||||
<< ", "
|
||||
"pop 0x"
|
||||
<< std::hex << (void *)(buffer) << std::dec << ":" << buffer;
|
||||
LOG(logDEBUG5) << "DataProcessor " << index << ", " << std::hex
|
||||
<< static_cast<void *>(buffer) << std::dec << ":" << buffer;
|
||||
|
||||
// check dummy
|
||||
auto numBytes = (uint32_t)(*((uint32_t *)buffer));
|
||||
auto numBytes = *reinterpret_cast<uint32_t *>(buffer);
|
||||
LOG(logDEBUG1) << "DataProcessor " << index << ", Numbytes:" << numBytes;
|
||||
if (numBytes == DUMMY_PACKET_VALUE) {
|
||||
StopProcessing(buffer);
|
||||
@ -282,7 +272,7 @@ void DataProcessor::StopProcessing(char *buf) {
|
||||
|
||||
uint64_t DataProcessor::ProcessAnImage(char *buf) {
|
||||
|
||||
auto *rheader = (sls_receiver_header *)(buf + FIFO_HEADER_NUMBYTES);
|
||||
auto *rheader = reinterpret_cast<sls_receiver_header *>(buf + FIFO_HEADER_NUMBYTES);
|
||||
sls_detector_header header = rheader->detHeader;
|
||||
uint64_t fnum = header.frameNumber;
|
||||
currentFrameIndex_ = fnum;
|
||||
@ -316,16 +306,17 @@ uint64_t DataProcessor::ProcessAnImage(char *buf) {
|
||||
try {
|
||||
// normal call back
|
||||
if (rawDataReadyCallBack != nullptr) {
|
||||
rawDataReadyCallBack((char *)rheader,
|
||||
std::size_t dsize = *reinterpret_cast<uint32_t *>(buf);
|
||||
rawDataReadyCallBack(rheader,
|
||||
buf + FIFO_HEADER_NUMBYTES +
|
||||
sizeof(sls_receiver_header),
|
||||
(uint32_t)(*((uint32_t *)buf)), pRawDataReady);
|
||||
dsize, pRawDataReady);
|
||||
}
|
||||
|
||||
// call back with modified size
|
||||
else if (rawDataModifyReadyCallBack != nullptr) {
|
||||
auto revsize = (uint32_t)(*((uint32_t *)buf));
|
||||
rawDataModifyReadyCallBack((char *)rheader,
|
||||
std::size_t revsize = *reinterpret_cast<uint32_t *>(buf);
|
||||
rawDataModifyReadyCallBack(rheader,
|
||||
buf + FIFO_HEADER_NUMBYTES +
|
||||
sizeof(sls_receiver_header),
|
||||
revsize, pRawDataReady);
|
||||
@ -369,14 +360,15 @@ bool DataProcessor::CheckTimer() {
|
||||
struct timespec end;
|
||||
clock_gettime(CLOCK_REALTIME, &end);
|
||||
|
||||
LOG(logDEBUG1) << index << " Timer elapsed time:"
|
||||
<< ((end.tv_sec - timerbegin_.tv_sec) +
|
||||
(end.tv_nsec - timerbegin_.tv_nsec) / 1000000000.0)
|
||||
auto elapsed_s = (end.tv_sec - timerbegin_.tv_sec) +
|
||||
(end.tv_nsec - timerbegin_.tv_nsec) / 1e9;
|
||||
double timer_s = *streamingTimerInMs_ / 1e3;
|
||||
|
||||
LOG(logDEBUG1) << index << " Timer elapsed time:" << elapsed_s
|
||||
<< " seconds";
|
||||
|
||||
// still less than streaming timer, keep waiting
|
||||
if (((end.tv_sec - timerbegin_.tv_sec) +
|
||||
(end.tv_nsec - timerbegin_.tv_nsec) / 1000000000.0) <
|
||||
((double)*streamingTimerInMs_ / 1000.00))
|
||||
if (elapsed_s < timer_s)
|
||||
return false;
|
||||
|
||||
// restart timer
|
||||
@ -393,15 +385,14 @@ bool DataProcessor::CheckCount() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void DataProcessor::registerCallBackRawDataReady(void (*func)(char *, char *,
|
||||
uint32_t, void *),
|
||||
void *arg) {
|
||||
void DataProcessor::registerCallBackRawDataReady(
|
||||
void (*func)(sls_receiver_header *, char *, size_t, void *), void *arg) {
|
||||
rawDataReadyCallBack = func;
|
||||
pRawDataReady = arg;
|
||||
}
|
||||
|
||||
void DataProcessor::registerCallBackRawDataModifyReady(
|
||||
void (*func)(char *, char *, uint32_t &, void *), void *arg) {
|
||||
void (*func)(sls_receiver_header *, char *, size_t &, void *), void *arg) {
|
||||
rawDataModifyReadyCallBack = func;
|
||||
pRawDataReady = arg;
|
||||
}
|
||||
@ -410,7 +401,8 @@ void DataProcessor::PadMissingPackets(char *buf) {
|
||||
LOG(logDEBUG) << index << ": Padding Missing Packets";
|
||||
|
||||
uint32_t pperFrame = generalData_->packetsPerFrame;
|
||||
auto *header = (sls_receiver_header *)(buf + FIFO_HEADER_NUMBYTES);
|
||||
auto *header =
|
||||
reinterpret_cast<sls_receiver_header *>(buf + FIFO_HEADER_NUMBYTES);
|
||||
uint32_t nmissing = pperFrame - header->detHeader.packetNumber;
|
||||
sls_bitset pmask = header->packetsMask;
|
||||
|
||||
@ -483,7 +475,7 @@ void DataProcessor::RearrangeDbitData(char *buf) {
|
||||
|
||||
// ceil as numResult8Bits could be decimal
|
||||
const int numResult8Bits =
|
||||
ceil((double)(numSamples * (*ctbDbitList_).size()) / 8.00);
|
||||
ceil((numSamples * (*ctbDbitList_).size()) / 8.00);
|
||||
std::vector<uint8_t> result(numResult8Bits);
|
||||
uint8_t *dest = &result[0];
|
||||
|
||||
@ -499,7 +491,7 @@ void DataProcessor::RearrangeDbitData(char *buf) {
|
||||
}
|
||||
|
||||
// loop through the frame digital data
|
||||
for (auto ptr = source; ptr < (source + numSamples);) {
|
||||
for (auto *ptr = source; ptr < (source + numSamples);) {
|
||||
// get selected bit from each 8 bit
|
||||
uint8_t bit = (*ptr++ >> bi) & 1;
|
||||
*dest |= bit << bitoffset;
|
||||
|
@ -79,28 +79,16 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
||||
const fileFormat fileFormatType,
|
||||
MasterAttributes *attr,
|
||||
std::mutex *hdf5LibMutex);
|
||||
/**
|
||||
* Call back for raw data
|
||||
* args to raw data ready callback are
|
||||
* sls_receiver_header frame metadata
|
||||
* dataPointer is the pointer to the data
|
||||
* dataSize in bytes is the size of the data in bytes.
|
||||
*/
|
||||
void registerCallBackRawDataReady(void (*func)(char *, char *, uint32_t,
|
||||
void *),
|
||||
|
||||
/** params: sls_receiver_header pointer, pointer to data, image size */
|
||||
void registerCallBackRawDataReady(void (*func)(sls_receiver_header *,
|
||||
char *, size_t, void *),
|
||||
void *arg);
|
||||
|
||||
/**
|
||||
* Call back for raw data (modified)
|
||||
* args to raw data ready callback are
|
||||
* sls_receiver_header frame metadata
|
||||
* dataPointer is the pointer to the data
|
||||
* revDatasize is the reference of data size in bytes.
|
||||
* Can be modified to the new size to be written/streamed. (only smaller
|
||||
* value).
|
||||
*/
|
||||
void registerCallBackRawDataModifyReady(void (*func)(char *, char *,
|
||||
uint32_t &, void *),
|
||||
/** params: sls_receiver_header pointer, pointer to data, reference to image size */
|
||||
void registerCallBackRawDataModifyReady(void (*func)(sls_receiver_header *,
|
||||
char *, size_t &,
|
||||
void *),
|
||||
void *arg);
|
||||
|
||||
private:
|
||||
@ -167,7 +155,7 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
||||
uint32_t *streamingTimerInMs_;
|
||||
uint32_t *streamingStartFnum_;
|
||||
uint32_t currentFreqCount_{0};
|
||||
struct timespec timerbegin_;
|
||||
struct timespec timerbegin_{};
|
||||
bool *framePadding_;
|
||||
std::vector<int> *ctbDbitList_;
|
||||
int *ctbDbitOffset_;
|
||||
@ -195,7 +183,8 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
||||
* dataPointer is the pointer to the data
|
||||
* dataSize in bytes is the size of the data in bytes.
|
||||
*/
|
||||
void (*rawDataReadyCallBack)(char *, char *, uint32_t, void *) = nullptr;
|
||||
void (*rawDataReadyCallBack)(sls_receiver_header *, char *, size_t,
|
||||
void *) = nullptr;
|
||||
|
||||
/**
|
||||
* Call back for raw data (modified)
|
||||
@ -205,7 +194,7 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
||||
* revDatasize is the reference of data size in bytes. Can be modified to
|
||||
* the new size to be written/streamed. (only smaller value).
|
||||
*/
|
||||
void (*rawDataModifyReadyCallBack)(char *, char *, uint32_t &,
|
||||
void (*rawDataModifyReadyCallBack)(sls_receiver_header *, char *, size_t &,
|
||||
void *) = nullptr;
|
||||
|
||||
void *pRawDataReady{nullptr};
|
||||
|
@ -523,10 +523,10 @@ void Implementation::startReceiver() {
|
||||
// callbacks
|
||||
if (startAcquisitionCallBack) {
|
||||
try {
|
||||
startAcquisitionCallBack(filePath, fileName, fileIndex,
|
||||
(generalData->imageSize) +
|
||||
(generalData->fifoBufferHeaderSize),
|
||||
pStartAcquisition);
|
||||
std::size_t imageSize = static_cast<uint32_t>(generalData->imageSize);
|
||||
startAcquisitionCallBack(
|
||||
filePath, fileName, fileIndex, imageSize,
|
||||
pStartAcquisition);
|
||||
} catch (const std::exception &e) {
|
||||
throw sls::RuntimeError("Start Acquisition Callback Error: " +
|
||||
std::string(e.what()));
|
||||
@ -1627,7 +1627,7 @@ void Implementation::setDbitOffset(const int s) { ctbDbitOffset = s; }
|
||||
* *
|
||||
* ************************************************/
|
||||
void Implementation::registerCallBackStartAcquisition(
|
||||
int (*func)(std::string, std::string, uint64_t, uint32_t, void *),
|
||||
int (*func)(const std::string &, const std::string &, uint64_t, size_t, void *),
|
||||
void *arg) {
|
||||
startAcquisitionCallBack = func;
|
||||
pStartAcquisition = arg;
|
||||
@ -1641,7 +1641,7 @@ void Implementation::registerCallBackAcquisitionFinished(void (*func)(uint64_t,
|
||||
}
|
||||
|
||||
void Implementation::registerCallBackRawDataReady(
|
||||
void (*func)(char *, char *, uint32_t, void *), void *arg) {
|
||||
void (*func)(sls_receiver_header *, char *, size_t, void *), void *arg) {
|
||||
rawDataReadyCallBack = func;
|
||||
pRawDataReady = arg;
|
||||
for (const auto &it : dataProcessor)
|
||||
@ -1649,7 +1649,7 @@ void Implementation::registerCallBackRawDataReady(
|
||||
}
|
||||
|
||||
void Implementation::registerCallBackRawDataModifyReady(
|
||||
void (*func)(char *, char *, uint32_t &, void *), void *arg) {
|
||||
void (*func)(sls_receiver_header *, char *, size_t &, void *), void *arg) {
|
||||
rawDataModifyReadyCallBack = func;
|
||||
pRawDataReady = arg;
|
||||
for (const auto &it : dataProcessor)
|
||||
|
@ -252,17 +252,21 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
* Callbacks *
|
||||
* *
|
||||
* ************************************************/
|
||||
void registerCallBackStartAcquisition(int (*func)(std::string, std::string,
|
||||
uint64_t, uint32_t,
|
||||
void *),
|
||||
/** params: file path, file name, file index, image size */
|
||||
void registerCallBackStartAcquisition(int (*func)(const std::string &, const std::string &,
|
||||
uint64_t, size_t, void *),
|
||||
void *arg);
|
||||
/** params: total frames caught */
|
||||
void registerCallBackAcquisitionFinished(void (*func)(uint64_t, void *),
|
||||
void *arg);
|
||||
void registerCallBackRawDataReady(void (*func)(char *, char *, uint32_t,
|
||||
void *),
|
||||
/** params: sls_receiver_header pointer, pointer to data, image size */
|
||||
void registerCallBackRawDataReady(void (*func)(sls_receiver_header *,
|
||||
char *, size_t, void *),
|
||||
void *arg);
|
||||
void registerCallBackRawDataModifyReady(void (*func)(char *, char *,
|
||||
uint32_t &, void *),
|
||||
/** params: sls_receiver_header pointer, pointer to data, reference to image size */
|
||||
void registerCallBackRawDataModifyReady(void (*func)(sls_receiver_header *,
|
||||
char *, size_t &,
|
||||
void *),
|
||||
void *arg);
|
||||
|
||||
private:
|
||||
@ -369,13 +373,14 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
int ctbDbitOffset{0};
|
||||
|
||||
// callbacks
|
||||
int (*startAcquisitionCallBack)(std::string, std::string, uint64_t,
|
||||
uint32_t, void *){nullptr};
|
||||
int (*startAcquisitionCallBack)(const std::string &, const std::string &, uint64_t, size_t,
|
||||
void *){nullptr};
|
||||
void *pStartAcquisition{nullptr};
|
||||
void (*acquisitionFinishedCallBack)(uint64_t, void *){nullptr};
|
||||
void *pAcquisitionFinished{nullptr};
|
||||
void (*rawDataReadyCallBack)(char *, char *, uint32_t, void *){nullptr};
|
||||
void (*rawDataModifyReadyCallBack)(char *, char *, uint32_t &,
|
||||
void (*rawDataReadyCallBack)(sls_receiver_header *, char *, size_t,
|
||||
void *){nullptr};
|
||||
void (*rawDataModifyReadyCallBack)(sls_receiver_header *, char *, size_t &,
|
||||
void *){nullptr};
|
||||
void *pRawDataReady{nullptr};
|
||||
|
||||
|
@ -47,32 +47,21 @@ void printHelp() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Start Acquisition Call back
|
||||
* slsReceiver writes data if file write enabled.
|
||||
* Users get data to write using call back if registerCallBackRawDataReady is
|
||||
* registered.
|
||||
* @param filepath file path
|
||||
* @param filename file name
|
||||
* @param fileindex file index
|
||||
* @param datasize data size in bytes
|
||||
* @param p pointer to object
|
||||
* \returns ignored
|
||||
* Start Acquisition Call back (slsMultiReceiver writes data if file write enabled)
|
||||
* if registerCallBackRawDataReady or registerCallBackRawDataModifyReady registered,
|
||||
* users get data
|
||||
*/
|
||||
int StartAcq(std::string filepath, std::string filename, uint64_t fileindex,
|
||||
uint32_t datasize, void *p) {
|
||||
LOG(logINFOBLUE) << "#### StartAcq: filepath:" << filepath
|
||||
<< " filename:" << filename << " fileindex:" << fileindex
|
||||
<< " datasize:" << datasize << " ####";
|
||||
int StartAcq(const std::string & filePath, const std::string & fileName, uint64_t fileIndex,
|
||||
size_t imageSize, void *objectPointer) {
|
||||
LOG(logINFOBLUE) << "#### StartAcq: filePath:" << filePath
|
||||
<< " fileName:" << fileName << " fileIndex:" << fileIndex
|
||||
<< " imageSize:" << imageSize << " ####";
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Acquisition Finished Call back
|
||||
* @param frames Number of frames caught
|
||||
* @param p pointer to object
|
||||
*/
|
||||
void AcquisitionFinished(uint64_t frames, void *p) {
|
||||
LOG(logINFOBLUE) << "#### AcquisitionFinished: frames:" << frames
|
||||
/** Acquisition Finished Call back */
|
||||
void AcquisitionFinished(uint64_t framesCaught, void *objectPointer) {
|
||||
LOG(logINFOBLUE) << "#### AcquisitionFinished: framesCaught:" << framesCaught
|
||||
<< " ####";
|
||||
}
|
||||
|
||||
@ -80,14 +69,9 @@ void AcquisitionFinished(uint64_t frames, void *p) {
|
||||
* Get Receiver Data Call back
|
||||
* Prints in different colors(for each receiver process) the different headers
|
||||
* for each image call back.
|
||||
* @param metadata sls_receiver_header metadata
|
||||
* @param datapointer pointer to data
|
||||
* @param datasize data size in bytes.
|
||||
* @param p pointer to object
|
||||
*/
|
||||
void GetData(char *metadata, char *datapointer, uint32_t datasize, void *p) {
|
||||
slsDetectorDefs::sls_receiver_header *header =
|
||||
(slsDetectorDefs::sls_receiver_header *)metadata;
|
||||
void GetData(slsDetectorDefs::sls_receiver_header *header, char *dataPointer,
|
||||
size_t imageSize, void *objectPointer) {
|
||||
slsDetectorDefs::sls_detector_header detectorHeader = header->detHeader;
|
||||
|
||||
PRINT_IN_COLOR(
|
||||
@ -98,7 +82,7 @@ void GetData(char *metadata, char *datapointer, uint32_t datasize, void *p) {
|
||||
"row: %u\t\tcolumn: %u\t\treserved: %u\t\tdebug: %u"
|
||||
"\t\troundRNumber: %u\t\tdetType: %u\t\tversion: %u"
|
||||
//"\t\tpacketsMask:%s"
|
||||
"\t\tfirstbytedata: 0x%x\t\tdatsize: %u\n\n",
|
||||
"\t\tfirstbytedata: 0x%x\t\tdatsize: %zu\n\n",
|
||||
detectorHeader.row, (long unsigned int)detectorHeader.frameNumber,
|
||||
detectorHeader.expLength, detectorHeader.packetNumber,
|
||||
(long unsigned int)detectorHeader.bunchId,
|
||||
@ -107,23 +91,18 @@ void GetData(char *metadata, char *datapointer, uint32_t datasize, void *p) {
|
||||
detectorHeader.debug, detectorHeader.roundRNumber,
|
||||
detectorHeader.detType, detectorHeader.version,
|
||||
// header->packetsMask.to_string().c_str(),
|
||||
((uint8_t)(*((uint8_t *)(datapointer)))), datasize);
|
||||
((uint8_t)(*((uint8_t *)(dataPointer)))), imageSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Receiver Data Call back (modified)
|
||||
* Prints in different colors(for each receiver process) the different headers
|
||||
* for each image call back.
|
||||
* @param metadata sls_receiver_header metadata
|
||||
* @param datapointer pointer to data
|
||||
* @param revDatasize new data size in bytes after the callback.
|
||||
* @param modifiedImageSize new data size in bytes after the callback.
|
||||
* This will be the size written/streamed. (only smaller value is allowed).
|
||||
* @param p pointer to object
|
||||
*/
|
||||
void GetData(char *metadata, char *datapointer, uint32_t &revDatasize,
|
||||
void *p) {
|
||||
slsDetectorDefs::sls_receiver_header *header =
|
||||
(slsDetectorDefs::sls_receiver_header *)metadata;
|
||||
void GetData(slsDetectorDefs::sls_receiver_header *header, char *dataPointer,
|
||||
size_t &modifiedImageSize, void *objectPointer) {
|
||||
slsDetectorDefs::sls_detector_header detectorHeader = header->detHeader;
|
||||
|
||||
PRINT_IN_COLOR(
|
||||
@ -135,7 +114,7 @@ void GetData(char *metadata, char *datapointer, uint32_t &revDatasize,
|
||||
"row: %u\t\tcolumn: %u\t\treserved: %u\t\tdebug: %u"
|
||||
"\t\troundRNumber: %u\t\tdetType: %u\t\tversion: %u"
|
||||
//"\t\tpacketsMask:%s"
|
||||
"\t\tfirstbytedata: 0x%x\t\tdatsize: %u\n\n",
|
||||
"\t\tfirstbytedata: 0x%x\t\tdatsize: %zu\n\n",
|
||||
detectorHeader.row, (long long unsigned int)detectorHeader.frameNumber,
|
||||
detectorHeader.expLength, detectorHeader.packetNumber,
|
||||
(long long unsigned int)detectorHeader.bunchId,
|
||||
@ -144,10 +123,10 @@ void GetData(char *metadata, char *datapointer, uint32_t &revDatasize,
|
||||
detectorHeader.debug, detectorHeader.roundRNumber,
|
||||
detectorHeader.detType, detectorHeader.version,
|
||||
// header->packetsMask.to_string().c_str(),
|
||||
((uint8_t)(*((uint8_t *)(datapointer)))), revDatasize);
|
||||
((uint8_t)(*((uint8_t *)(dataPointer)))), modifiedImageSize);
|
||||
|
||||
// if data is modified, eg ROI and size is reduced
|
||||
revDatasize = 26000;
|
||||
modifiedImageSize = 26000;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -129,7 +129,7 @@ int64_t Receiver::getReceiverVersion() {
|
||||
}
|
||||
|
||||
void Receiver::registerCallBackStartAcquisition(
|
||||
int (*func)(std::string, std::string, uint64_t, uint32_t, void *),
|
||||
int (*func)(const std::string &, const std::string &, uint64_t, size_t, void *),
|
||||
void *arg) {
|
||||
tcpipInterface->registerCallBackStartAcquisition(func, arg);
|
||||
}
|
||||
@ -140,14 +140,13 @@ void Receiver::registerCallBackAcquisitionFinished(void (*func)(uint64_t,
|
||||
tcpipInterface->registerCallBackAcquisitionFinished(func, arg);
|
||||
}
|
||||
|
||||
void Receiver::registerCallBackRawDataReady(void (*func)(char *, char *,
|
||||
uint32_t, void *),
|
||||
void *arg) {
|
||||
void Receiver::registerCallBackRawDataReady(
|
||||
void (*func)(sls_receiver_header *, char *, size_t, void *), void *arg) {
|
||||
tcpipInterface->registerCallBackRawDataReady(func, arg);
|
||||
}
|
||||
|
||||
void Receiver::registerCallBackRawDataModifyReady(
|
||||
void (*func)(char *, char *, uint32_t &, void *), void *arg) {
|
||||
void (*func)(sls_receiver_header *, char *, size_t &, void *), void *arg) {
|
||||
tcpipInterface->registerCallBackRawDataModifyReady(func, arg);
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
TEST_CASE("Time 1s restart then time 2s") {
|
||||
TEST_CASE("Time 1s restart then time 2s", "[.timer]") {
|
||||
auto sleep_duration = std::chrono::seconds(1);
|
||||
auto t = sls::Timer();
|
||||
std::this_thread::sleep_for(sleep_duration);
|
||||
@ -17,7 +17,7 @@ TEST_CASE("Time 1s restart then time 2s") {
|
||||
REQUIRE(t.elapsed_s() == Approx(2).epsilon(0.01));
|
||||
}
|
||||
|
||||
TEST_CASE("Return ms") {
|
||||
TEST_CASE("Return ms", "[.timer]") {
|
||||
auto sleep_duration = std::chrono::milliseconds(1300);
|
||||
auto t = sls::Timer();
|
||||
std::this_thread::sleep_for(sleep_duration);
|
||||
|
Loading…
x
Reference in New Issue
Block a user