mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-16 12:07:44 +01:00
WIP
This commit is contained in:
@@ -569,7 +569,7 @@ Result<int> Detector::getNumberofUDPInterfaces(Positions pos) const {
|
||||
}
|
||||
|
||||
void Detector::setNumberofUDPInterfaces(int n, Positions pos) {
|
||||
int previouslyClientStreaming = pimpl->enableDataStreamingToClient();
|
||||
int previouslyClientStreaming = pimpl->getDataStreamingToClient();
|
||||
bool useReceiver = getUseReceiverFlag().squash(false);
|
||||
bool previouslyReceiverStreaming = false;
|
||||
if (useReceiver) {
|
||||
@@ -583,8 +583,8 @@ void Detector::setNumberofUDPInterfaces(int n, Positions pos) {
|
||||
}
|
||||
// redo the zmq sockets if enabled
|
||||
if (previouslyClientStreaming != 0) {
|
||||
pimpl->enableDataStreamingToClient(0);
|
||||
pimpl->enableDataStreamingToClient(1);
|
||||
pimpl->setDataStreamingToClient(false);
|
||||
pimpl->setDataStreamingToClient(true);
|
||||
}
|
||||
if (previouslyReceiverStreaming) {
|
||||
setRxZmqDataStream(false, pos);
|
||||
@@ -995,11 +995,11 @@ Result<IpAddr> Detector::getClientZmqIp(Positions pos) const {
|
||||
}
|
||||
|
||||
void Detector::setClientZmqIp(const IpAddr ip, Positions pos) {
|
||||
int previouslyClientStreaming = pimpl->enableDataStreamingToClient(-1);
|
||||
int previouslyClientStreaming = pimpl->getDataStreamingToClient();
|
||||
pimpl->Parallel(&Module::setClientStreamingIP, pos, ip);
|
||||
if (previouslyClientStreaming != 0) {
|
||||
pimpl->enableDataStreamingToClient(0);
|
||||
pimpl->enableDataStreamingToClient(1);
|
||||
pimpl->setDataStreamingToClient(false);
|
||||
pimpl->setDataStreamingToClient(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -975,19 +975,18 @@ int DetectorImpl::InsertGapPixels(char *image, char *&gpImage, bool quadEnable,
|
||||
return imagesize;
|
||||
}
|
||||
|
||||
bool DetectorImpl::enableDataStreamingToClient(int enable) {
|
||||
if (enable >= 0) {
|
||||
// destroy data threads
|
||||
if (enable == 0) {
|
||||
createReceivingDataSockets(true);
|
||||
// create data threads
|
||||
} else {
|
||||
if (createReceivingDataSockets() == FAIL) {
|
||||
throw RuntimeError("Could not create data threads in client.");
|
||||
}
|
||||
bool DetectorImpl::getDataStreamingToClient() { return client_downstream; }
|
||||
|
||||
void DetectorImpl::setDataStreamingToClient(bool enable) {
|
||||
// destroy data threads
|
||||
if (!enable) {
|
||||
createReceivingDataSockets(true);
|
||||
// create data threads
|
||||
} else {
|
||||
if (createReceivingDataSockets() == FAIL) {
|
||||
throw RuntimeError("Could not create data threads in client.");
|
||||
}
|
||||
}
|
||||
return client_downstream;
|
||||
}
|
||||
|
||||
void DetectorImpl::registerAcquisitionFinishedCallback(void (*func)(double, int,
|
||||
@@ -1003,7 +1002,7 @@ void DetectorImpl::registerDataCallback(void (*userCallback)(detectorData *,
|
||||
void *pArg) {
|
||||
dataReady = userCallback;
|
||||
pCallbackArg = pArg;
|
||||
enableDataStreamingToClient(dataReady == nullptr ? 0 : 1);
|
||||
setDataStreamingToClient(dataReady == nullptr ? false : true);
|
||||
}
|
||||
|
||||
int DetectorImpl::acquire() {
|
||||
|
||||
@@ -238,12 +238,8 @@ class DetectorImpl : public virtual slsDetectorDefs {
|
||||
/** [Eiger][Jungfrau] */
|
||||
void setGapPixelsinCallback(const bool enable);
|
||||
|
||||
/**
|
||||
* Enable data streaming to client
|
||||
* @param enable 0 to disable, 1 to enable, -1 to get the value
|
||||
* @returns data streaming to client enable
|
||||
*/
|
||||
bool enableDataStreamingToClient(int enable = -1);
|
||||
bool getDataStreamingToClient();
|
||||
void setDataStreamingToClient(bool enable);
|
||||
|
||||
/**
|
||||
* register callback for accessing acquisition final data
|
||||
|
||||
Reference in New Issue
Block a user