mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 13:27:14 +02:00
ensuring acquire, p receiver start and the gui enables and disables data streaming accordingly. those with api will have to know what they want before acquiring
This commit is contained in:
@ -5656,7 +5656,7 @@ int multiSlsDetector::enableDataStreamingFromReceiver(int enable){
|
||||
}
|
||||
}
|
||||
|
||||
}else enable = dataSocketsStarted;
|
||||
}
|
||||
|
||||
int ret=-100, ret1;
|
||||
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
|
||||
@ -5670,11 +5670,11 @@ int multiSlsDetector::enableDataStreamingFromReceiver(int enable){
|
||||
ret=-1;
|
||||
}
|
||||
}
|
||||
/*
|
||||
if(enable == -1)
|
||||
return dataSocketsStarted;
|
||||
*/
|
||||
return (dataSocketsStarted & ret);
|
||||
|
||||
if(ret != dataSocketsStarted)
|
||||
return -1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int multiSlsDetector::enableReceiverCompression(int i){
|
||||
|
@ -1319,7 +1319,15 @@ string slsDetectorCommand::cmdAcquire(int narg, char *args[], int action) {
|
||||
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
if (myDet->setReceiverOnline(ONLINE_FLAG) == ONLINE_FLAG) {
|
||||
//if it was not off
|
||||
if (myDet->enableDataStreamingFromReceiver(-1) != 0){
|
||||
//switch it off, if error
|
||||
if (myDet->enableDataStreamingFromReceiver(0) != 0) {
|
||||
return string("could not disable data streaming in receiver\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(myDet->acquire() == FAIL)
|
||||
return string("acquire unsuccessful");
|
||||
@ -4830,12 +4838,23 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
|
||||
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
int receivers = myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
|
||||
if(cmd=="receiver"){
|
||||
if (action==PUT_ACTION) {
|
||||
if(!strcasecmp(args[1],"start"))
|
||||
if(!strcasecmp(args[1],"start")) {
|
||||
//to ensure data streaming enable is the same across client and receiver
|
||||
if (receivers == ONLINE_FLAG) {
|
||||
//if it was not off
|
||||
if (myDet->enableDataStreamingFromReceiver(-1) != 0){
|
||||
//switch it off, if error
|
||||
if (myDet->enableDataStreamingFromReceiver(0) != 0) {
|
||||
return string("could not disable data streaming in receiver\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
myDet->startReceiver();
|
||||
}
|
||||
else if(!strcasecmp(args[1],"stop")){
|
||||
//myDet->stopReceiver();
|
||||
// myDet->startReceiverReadout();
|
||||
|
@ -62,18 +62,6 @@ int slsDetectorUtils::acquire(int delflag){
|
||||
bool receiver = (setReceiverOnline()==ONLINE_FLAG);
|
||||
if(!receiver){
|
||||
setDetectorIndex(-1);
|
||||
}else{
|
||||
//put receiver read frequency to random if no gui
|
||||
int ret = setReadReceiverFrequency(0);
|
||||
if(ret>0 && (dataReady == NULL)){
|
||||
ret = setReadReceiverFrequency(1,0);
|
||||
std::cout << "No Data call back and hence receiver read frequency reset to " << ret <<" (Random)" << std::endl;
|
||||
}
|
||||
|
||||
//start/stop data streaming threads if threads in client enabled/disabled
|
||||
ret = enableDataStreamingFromReceiver(-1);
|
||||
// cout<<"getting datastream:"<<ret<<endl;
|
||||
// cout<<"result of enabledatastream:"<<enableDataStreamingFromReceiver(ret)<<endl;
|
||||
}
|
||||
|
||||
int nc=setTimer(CYCLES_NUMBER,-1);
|
||||
@ -154,11 +142,6 @@ int slsDetectorUtils::acquire(int delflag){
|
||||
pthread_mutex_lock(&mg); //cout << "lock"<< endl;
|
||||
if(getReceiverStatus()!=IDLE)
|
||||
stopReceiver();
|
||||
//multi detectors shouldnt have different receiver read frequencies enabled/disabled
|
||||
if(setReadReceiverFrequency(0) < 0){
|
||||
std::cout << "Error: The receiver read frequency is invalid:" << setReadReceiverFrequency(0) << std::endl;
|
||||
*stoppedFlag=1;
|
||||
}
|
||||
if(setReceiverOnline()==OFFLINE_FLAG)
|
||||
*stoppedFlag=1;
|
||||
pthread_mutex_unlock(&mg);//cout << "unlock"<< endl;
|
||||
|
Reference in New Issue
Block a user