mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 06:50:02 +02:00
changed everything to depend on receiver online shared memory flag, and if it is online is only checked rarely
This commit is contained in:
parent
09d146ee55
commit
c70f453de4
@ -1311,7 +1311,7 @@ int slsDetector::activate(int const enable){
|
||||
#endif
|
||||
|
||||
if(ret!=FAIL){
|
||||
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Activating/Deactivating Receiver: " << retval << std::endl;
|
||||
#endif
|
||||
@ -1623,9 +1623,9 @@ int slsDetector::setDetectorType(detectorType const type){
|
||||
|
||||
|
||||
//receiver
|
||||
if((retType != GENERIC) && (setReceiverOnline()==ONLINE_FLAG)) {
|
||||
if((retType != GENERIC) && (thisDetector->receiverOnlineFlag==ONLINE_FLAG)) {
|
||||
retval = FAIL;
|
||||
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending detector type to Receiver " << (int)thisDetector->myDetectorType << std::endl;
|
||||
#endif
|
||||
@ -1997,7 +1997,7 @@ int64_t slsDetector::getId( idMode mode, int imod){
|
||||
retval=SVNREVLIB;
|
||||
retval=(retval<<32) | SVNDATELIB;
|
||||
} else if (mode==RECEIVER_VERSION) {
|
||||
if (setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) {
|
||||
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG) {
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->getInt(fnum2,retval);
|
||||
disconnectData();
|
||||
@ -4068,7 +4068,7 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
|
||||
args[0] = index;
|
||||
args[1] = thisDetector->timerValue[index];
|
||||
|
||||
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
|
||||
//set #frames, #cycles
|
||||
if((index==FRAME_NUMBER)||(index==CYCLES_NUMBER)){
|
||||
@ -4629,7 +4629,7 @@ int slsDetector::setDynamicRange(int n){
|
||||
if(ret != FAIL){
|
||||
retval = thisDetector->dynamicRange;
|
||||
if((n==-1) && (ret!= FORCE_UPDATE)) n =-1;
|
||||
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending/Getting dynamic range to/from receiver " << n << std::endl;
|
||||
#endif
|
||||
@ -5142,7 +5142,7 @@ int slsDetector::setRateCorrection(double t){
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Setting Rate Correction to " << arg << endl;
|
||||
#endif
|
||||
if (setOnline(ONLINE_FLAG)==ONLINE_FLAG) {
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
if (connectControl() == OK){
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->SendDataOnly(&arg,sizeof(arg));
|
||||
@ -5224,7 +5224,7 @@ double slsDetector::getRateCorrectionTau(){
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Setting Rate Correction to " << arg << endl;
|
||||
#endif
|
||||
if (setOnline(ONLINE_FLAG)==ONLINE_FLAG) {
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
if (connectControl() == OK){
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
@ -5768,7 +5768,7 @@ int slsDetector::setUDPConnection(){
|
||||
#endif
|
||||
|
||||
//set up receiver for UDP Connection and get receivermac address
|
||||
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Setting up UDP Connection for Receiver " << args[0] << "\t" << args[1] << std::endl;
|
||||
#endif
|
||||
@ -5934,7 +5934,6 @@ int slsDetector::configureMAC(){
|
||||
pthread_mutex_unlock(&ms);
|
||||
//connect to receiver
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending adc val to receiver " << retval << std::endl;
|
||||
#endif
|
||||
@ -5946,7 +5945,6 @@ int slsDetector::configureMAC(){
|
||||
setErrorMask((getErrorMask())|(COULD_NOT_CONFIGURE_MAC));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -6544,7 +6542,7 @@ int slsDetector::programFPGA(string fname){
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Sending programming binary to detector " << endl;
|
||||
#endif
|
||||
if (setOnline(ONLINE_FLAG)==ONLINE_FLAG) {
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
if (connectControl() == OK){
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->SendDataOnly(&filesize,sizeof(filesize));
|
||||
@ -6639,7 +6637,7 @@ int slsDetector::resetFPGA(){
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Sending reset to FPGA " << endl;
|
||||
#endif
|
||||
if (setOnline(ONLINE_FLAG)==ONLINE_FLAG) {
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
if (connectControl() == OK){
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
|
||||
@ -6675,7 +6673,7 @@ int slsDetector::powerChip(int ival){
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Sending power on/off/get to the chip " << endl;
|
||||
#endif
|
||||
if (setOnline(ONLINE_FLAG)==ONLINE_FLAG) {
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
if (connectControl() == OK){
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->SendDataOnly(&ival,sizeof(ival));
|
||||
@ -7049,10 +7047,10 @@ string slsDetector::checkReceiverOnline() {
|
||||
thisDetector->receiverOnlineFlag=OFFLINE_FLAG;
|
||||
delete dataSocket;
|
||||
dataSocket=NULL;
|
||||
retval = FAIL;
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "receiver offline!" << std::endl;
|
||||
#endif
|
||||
return string(thisDetector->receiver_hostname);
|
||||
} else {
|
||||
thisDetector->receiverOnlineFlag=ONLINE_FLAG;
|
||||
dataSocket->SetTimeOut(100);
|
||||
@ -7060,9 +7058,9 @@ string slsDetector::checkReceiverOnline() {
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "receiver online!" << std::endl;
|
||||
#endif
|
||||
return string("");
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
@ -7158,7 +7156,7 @@ string slsDetector::setFilePath(string s) {
|
||||
}
|
||||
}
|
||||
|
||||
else if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||
else{
|
||||
strcpy(arg,s.c_str());
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending file path to receiver " << arg << std::endl;
|
||||
@ -7207,7 +7205,6 @@ string slsDetector::setFileName(string s) {
|
||||
}
|
||||
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||
strcpy(arg,s.c_str());
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending file name to receiver " << arg << std::endl;
|
||||
@ -7228,7 +7225,6 @@ string slsDetector::setFileName(string s) {
|
||||
if(ret==FORCE_UPDATE)
|
||||
updateReceiver();
|
||||
}
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&ms);
|
||||
s = fileIO::getFileName();
|
||||
@ -7256,7 +7252,7 @@ int slsDetector::setFileIndex(int i) {
|
||||
}
|
||||
}
|
||||
|
||||
else if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||
else{
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending file index to receiver " << arg << std::endl;
|
||||
#endif
|
||||
@ -7284,7 +7280,7 @@ int slsDetector::startReceiver(){
|
||||
int ret = FAIL;
|
||||
char mess[MAX_STR_LENGTH] = "";
|
||||
|
||||
if (setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) {
|
||||
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Starting Receiver " << std::endl;
|
||||
#endif
|
||||
@ -7321,7 +7317,7 @@ int slsDetector::stopReceiver(){
|
||||
if(thisDetector->myDetectorType != EIGER && thisDetector->myDetectorType != JUNGFRAU)
|
||||
detectorSendToReceiver(false);
|
||||
|
||||
if (setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) {
|
||||
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Stopping Receiver " << std::endl;
|
||||
#endif
|
||||
@ -7347,7 +7343,7 @@ slsDetectorDefs::runStatus slsDetector::startReceiverReadout(){
|
||||
int retval=-1;
|
||||
runStatus s=ERROR;
|
||||
|
||||
if (setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) {
|
||||
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Starting Receiver Readout" << std::endl;
|
||||
#endif
|
||||
@ -7405,7 +7401,7 @@ slsDetectorDefs::runStatus slsDetector::getReceiverStatus(){
|
||||
int retval=-1;
|
||||
runStatus s=ERROR;
|
||||
|
||||
if (setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) {
|
||||
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Getting Receiver Status" << std::endl;
|
||||
#endif
|
||||
@ -7430,7 +7426,7 @@ int slsDetector::getFramesCaughtByReceiver(){
|
||||
int ret = FAIL;
|
||||
int retval=-1;
|
||||
|
||||
if (setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) {
|
||||
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Getting Frames Caught by Receiver " << std::endl;
|
||||
#endif
|
||||
@ -7452,7 +7448,7 @@ int slsDetector::getReceiverCurrentFrameIndex(){
|
||||
int ret = FAIL;
|
||||
int retval=-1;
|
||||
|
||||
if (setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) {
|
||||
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Getting Current Frame Index of Receiver " << std::endl;
|
||||
#endif
|
||||
@ -7475,7 +7471,7 @@ int slsDetector::resetFramesCaught(){
|
||||
int ret = FAIL;
|
||||
char mess[MAX_STR_LENGTH] = "";
|
||||
|
||||
if (setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) {
|
||||
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Reset Frames Caught by Receiver" << std::endl;
|
||||
#endif
|
||||
@ -7502,7 +7498,7 @@ int slsDetector::lockReceiver(int lock){
|
||||
int arg=lock;
|
||||
|
||||
|
||||
if(setReceiverOnline(ONLINE_FLAG)!=ONLINE_FLAG){
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Locking or Unlocking Receiver " << std::endl;
|
||||
#endif
|
||||
@ -7527,7 +7523,7 @@ string slsDetector::getReceiverLastClientIP(){
|
||||
int ret = FAIL;
|
||||
char retval[INET_ADDRSTRLEN]="";
|
||||
|
||||
if(setReceiverOnline(ONLINE_FLAG)!=ONLINE_FLAG){
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Geting Last Client IP connected to Receiver " << std::endl;
|
||||
#endif
|
||||
@ -7585,7 +7581,7 @@ int slsDetector::updateReceiver() {
|
||||
int ret=OK;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
|
||||
if (setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) {
|
||||
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG) {
|
||||
if (connectData() == OK){
|
||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
@ -7612,7 +7608,7 @@ int slsDetector::exitReceiver(){
|
||||
int retval;
|
||||
int fnum=F_EXIT_RECEIVER;
|
||||
|
||||
if (setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) {
|
||||
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG) {
|
||||
if (dataSocket) {
|
||||
dataSocket->Connect();
|
||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
@ -7648,7 +7644,7 @@ int slsDetector::enableWriteToFile(int enable){
|
||||
}
|
||||
}
|
||||
|
||||
else if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||
else if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending enable file write to receiver " << arg << std::endl;
|
||||
#endif
|
||||
@ -7690,7 +7686,7 @@ int slsDetector::overwriteFile(int enable){
|
||||
}
|
||||
}
|
||||
|
||||
else if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||
else if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending enable file write to receiver " << arg << std::endl;
|
||||
#endif
|
||||
@ -7729,7 +7725,7 @@ int slsDetector::setFrameIndex(int index){
|
||||
pthread_mutex_unlock(&ms);
|
||||
}
|
||||
|
||||
else if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||
else if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending frame index to receiver " << arg << std::endl;
|
||||
#endif
|
||||
@ -7809,7 +7805,7 @@ int slsDetector::setReadReceiverFrequency(int getFromReceiver, int freq){
|
||||
if(!getFromReceiver)
|
||||
return retval;
|
||||
|
||||
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending read frequency to receiver " << arg << std::endl;
|
||||
#endif
|
||||
@ -7838,7 +7834,7 @@ int slsDetector::setReceiverReadTimer(int time_in_ms){
|
||||
int arg = time_in_ms;
|
||||
int retval = -1;
|
||||
|
||||
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending read timer to receiver " << arg << std::endl;
|
||||
#endif
|
||||
@ -7866,7 +7862,7 @@ int slsDetector::enableDataStreamingFromReceiver(int enable){
|
||||
int arg = enable;
|
||||
|
||||
|
||||
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "***************Sending Data Streaming in Receiver " << arg << std::endl;
|
||||
#endif
|
||||
@ -7895,7 +7891,7 @@ int slsDetector::enableReceiverCompression(int i){
|
||||
int retval=-1;
|
||||
|
||||
|
||||
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Getting/Enabling/Disabling Receiver Compression with argument " << i << std::endl;
|
||||
#endif
|
||||
@ -7917,7 +7913,7 @@ void slsDetector::setDetectorHostname(){
|
||||
char retval[MAX_STR_LENGTH]="";
|
||||
|
||||
|
||||
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending detector hostname to Receiver " << thisDetector->hostname << std::endl;
|
||||
#endif
|
||||
@ -7966,7 +7962,7 @@ int slsDetector::enableTenGigabitEthernet(int i){
|
||||
if(configureMAC() != FAIL){
|
||||
ret = FAIL;
|
||||
retval=-1;
|
||||
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Enabling / Disabling 10Gbe in receiver: " << i << std::endl;
|
||||
#endif
|
||||
@ -7994,7 +7990,7 @@ int slsDetector::setReceiverFifoDepth(int i){
|
||||
int retval=-1;
|
||||
|
||||
|
||||
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
if(i ==-1)
|
||||
std::cout<< "Getting Receiver Fifo Depth" << endl;
|
||||
@ -8029,7 +8025,7 @@ int slsDetector::setCTBPattern(string fname) {
|
||||
char retval[MAX_STR_LENGTH]="";
|
||||
|
||||
|
||||
// if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||
// if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
// #ifdef VERBOSE
|
||||
// std::cout << "Sending detector hostname to Receiver " << thisDetector->hostname << std::endl;
|
||||
// #endif
|
||||
|
@ -1233,12 +1233,13 @@ string slsDetectorCommand::cmdAcquire(int narg, char *args[], int action) {
|
||||
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
|
||||
if(myDet->acquire() == FAIL)
|
||||
return string("acquire unsuccessful");
|
||||
if(myDet->setReceiverOnline()==ONLINE_FLAG){
|
||||
char answer[100];
|
||||
sprintf(answer,"\n%d",myDet->getFramesCaughtByReceiver());
|
||||
sprintf(answer,"\nAcquired %d",myDet->getFramesCaughtByReceiver());
|
||||
return string(answer);
|
||||
}
|
||||
|
||||
@ -1277,6 +1278,7 @@ string slsDetectorCommand::cmdData(int narg, char *args[], int action) {
|
||||
b=myDet->setThreadedProcessing(-1);
|
||||
myDet->setThreadedProcessing(0);
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
myDet->readAll();
|
||||
//processdata in receiver is useful only for gui purposes
|
||||
if(myDet->setReceiverOnline()==OFFLINE_FLAG)
|
||||
@ -1311,6 +1313,7 @@ string slsDetectorCommand::cmdFrame(int narg, char *args[], int action) {
|
||||
b=myDet->setThreadedProcessing(-1);
|
||||
myDet->setThreadedProcessing(0);
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
myDet->readFrame();
|
||||
//processdata in receiver is useful only for gui purposes
|
||||
if(myDet->setReceiverOnline()==OFFLINE_FLAG)
|
||||
@ -1719,6 +1722,7 @@ string slsDetectorCommand::cmdExitServer(int narg, char *args[], int action){
|
||||
return string("Error closing server\n");
|
||||
}
|
||||
else if (cmd=="exitreceiver"){
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
if(myDet->exitReceiver()!=OK)
|
||||
return string("Receiver shut down\n");
|
||||
else
|
||||
@ -1840,6 +1844,7 @@ string slsDetectorCommand::helpTrimEn(int narg, char *args[], int action) {
|
||||
|
||||
|
||||
string slsDetectorCommand::cmdOutDir(int narg, char *args[], int action){
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
if (action==HELP_ACTION)
|
||||
return helpOutDir(narg, args, action);
|
||||
|
||||
@ -1864,6 +1869,7 @@ string slsDetectorCommand::helpOutDir(int narg, char *args[], int action){
|
||||
|
||||
|
||||
string slsDetectorCommand::cmdFileName(int narg, char *args[], int action){
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
if (action==HELP_ACTION)
|
||||
return helpFileName(narg, args, action);
|
||||
if (cmd=="fname") {
|
||||
@ -1893,7 +1899,7 @@ string slsDetectorCommand::cmdEnablefwrite(int narg, char *args[], int action){
|
||||
|
||||
int i;
|
||||
char ans[100];
|
||||
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
if (action==HELP_ACTION) {
|
||||
return helpEnablefwrite(narg, args, action);
|
||||
}
|
||||
@ -1925,7 +1931,7 @@ string slsDetectorCommand::cmdOverwrite(int narg, char *args[], int action){
|
||||
|
||||
int i;
|
||||
char ans[100];
|
||||
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
if (action==HELP_ACTION) {
|
||||
return helpOverwrite(narg, args, action);
|
||||
}
|
||||
@ -1957,7 +1963,7 @@ string slsDetectorCommand::helpOverwrite(int narg, char *args[], int action){
|
||||
string slsDetectorCommand::cmdFileIndex(int narg, char *args[], int action){
|
||||
char ans[100];
|
||||
int i;
|
||||
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
if (action==HELP_ACTION) {
|
||||
return helpFileName(narg, args, action);
|
||||
}
|
||||
@ -2070,6 +2076,8 @@ string slsDetectorCommand::cmdRateCorr(int narg, char *args[], int action){
|
||||
double fval;
|
||||
char answer[1000];
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
|
||||
if (action==PUT_ACTION) {
|
||||
sscanf(args[1],"%lf",&fval);
|
||||
myDet->setRateCorrection(fval);
|
||||
@ -2767,6 +2775,7 @@ string slsDetectorCommand::cmdNetworkParameter(int narg, char *args[], int actio
|
||||
return helpNetworkParameter(narg,args,action);
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
|
||||
if (cmd=="detectormac") {
|
||||
t=DETECTOR_MAC;
|
||||
@ -2936,6 +2945,7 @@ string slsDetectorCommand::cmdLock(int narg, char *args[], int action) {
|
||||
|
||||
|
||||
else if(cmd=="r_lock"){
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
if (action==PUT_ACTION) {
|
||||
if (sscanf(args[1],"%d",&val))
|
||||
myDet->lockReceiver(val);
|
||||
@ -2986,8 +2996,10 @@ string slsDetectorCommand::cmdLastClient(int narg, char *args[], int action) {
|
||||
return myDet->getLastClientIP();
|
||||
}
|
||||
|
||||
else if(cmd=="r_lastclient")
|
||||
else if(cmd=="r_lastclient"){
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
return myDet->getReceiverLastClientIP();
|
||||
}
|
||||
|
||||
return string("cannot decode command");
|
||||
}
|
||||
@ -3033,6 +3045,7 @@ string slsDetectorCommand::cmdOnline(int narg, char *args[], int action) {
|
||||
}
|
||||
else if(cmd=="activate"){
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
if (action==PUT_ACTION) {
|
||||
if (!sscanf(args[1],"%d",&ival))
|
||||
return string("Could not scan activate mode ")+string(args[1]);
|
||||
@ -3054,11 +3067,12 @@ string slsDetectorCommand::cmdOnline(int narg, char *args[], int action) {
|
||||
else{
|
||||
if (action==PUT_ACTION)
|
||||
return string("cannot set");
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
strcpy(ans,myDet->checkReceiverOnline().c_str());
|
||||
if(!strlen(ans))
|
||||
strcpy(ans,"All receiver online");
|
||||
else
|
||||
strcat(ans," :Not receiver online");
|
||||
strcat(ans," :Not all receiver online");
|
||||
}
|
||||
|
||||
return ans;
|
||||
@ -3095,6 +3109,7 @@ string slsDetectorCommand::cmdConfigureMac(int narg, char *args[], int action) {
|
||||
|
||||
if (action==PUT_ACTION){
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
ret=myDet->configureMAC();
|
||||
}
|
||||
else
|
||||
@ -3165,6 +3180,7 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
||||
} else if (cmd=="maxmod") {
|
||||
ret=myDet->getMaxNumberOfModules();
|
||||
} else if (cmd=="dr") {
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
ret=myDet->setDynamicRange(val);
|
||||
} else if (cmd=="roi") {
|
||||
myDet->getROI(ret);
|
||||
@ -3404,6 +3420,7 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
|
||||
}
|
||||
|
||||
if (cmd=="receiverversion") {
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
sprintf(answer,"%llx",myDet->getId(RECEIVER_VERSION));
|
||||
return string(answer);
|
||||
}
|
||||
@ -4082,6 +4099,7 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) {
|
||||
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
|
||||
ret=myDet->setTimer(index,t);
|
||||
if (index==ACQUISITION_TIME || index==SUBFRAME_ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER)
|
||||
@ -4509,10 +4527,12 @@ string slsDetectorCommand::cmdConfiguration(int narg, char *args[], int action)
|
||||
}
|
||||
return sval;
|
||||
} else if (cmd=="rx_printconfig"){
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
if (action==PUT_ACTION)
|
||||
return string("cannot put");
|
||||
return string(""+myDet->printReceiverConfiguration());
|
||||
}else if (cmd=="parameters") {
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
if (action==PUT_ACTION) {
|
||||
sval=string(args[1]);
|
||||
myDet->retrieveDetectorSetup(sval);
|
||||
@ -4522,6 +4542,7 @@ string slsDetectorCommand::cmdConfiguration(int narg, char *args[], int action)
|
||||
}
|
||||
return sval;
|
||||
} else if (cmd=="setup") {
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
if (action==PUT_ACTION) {
|
||||
sval=string(args[1]);
|
||||
myDet->retrieveDetectorSetup(sval,2);
|
||||
@ -4576,6 +4597,7 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
|
||||
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
|
||||
if(cmd=="receiver"){
|
||||
if (action==PUT_ACTION) {
|
||||
|
@ -286,12 +286,6 @@ int slsDetectorUtils::acquire(int delflag){
|
||||
//send receiver file name
|
||||
pthread_mutex_lock(&mg);
|
||||
setFileName(fileIO::getFileName());
|
||||
if(setReceiverOnline()==OFFLINE_FLAG){
|
||||
stopReceiver();
|
||||
*stoppedFlag=1;
|
||||
pthread_mutex_unlock(&mg);
|
||||
break;
|
||||
}
|
||||
//start receiver
|
||||
if(startReceiver() == FAIL) {
|
||||
stopReceiver();
|
||||
@ -349,6 +343,12 @@ int slsDetectorUtils::acquire(int delflag){
|
||||
}
|
||||
//online
|
||||
else{
|
||||
if(setReceiverOnline(ONLINE_FLAG)!=ONLINE_FLAG){
|
||||
stopAcquisition();
|
||||
stopReceiver();
|
||||
pthread_mutex_unlock(&mg);
|
||||
break;
|
||||
}
|
||||
stopReceiver();
|
||||
// cout<<"***********receiver stopped"<<endl;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user