mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 19:30:03 +02:00
every function call in slsdetector also sets error mask if it was online and failed to connect
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@492 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
1882454cf3
commit
1f15f7d5cb
@ -293,6 +293,7 @@ slsDetectorDefs::detectorType slsDetector::getDetectorType(const char *name, int
|
|||||||
s->Disconnect();
|
s->Disconnect();
|
||||||
} else {
|
} else {
|
||||||
cout << "Cannot connect to server " << name << " over port " << cport << endl;
|
cout << "Cannot connect to server " << name << " over port " << cport << endl;
|
||||||
|
setErrorMask((getErrorMask())|(CANNOT_CONNECT_TO_DETECTOR));
|
||||||
}
|
}
|
||||||
|
|
||||||
delete s;
|
delete s;
|
||||||
@ -1089,10 +1090,17 @@ int slsDetector::setTCPSocket(string const name, int const control_port, int con
|
|||||||
|
|
||||||
/** connect to the control port */
|
/** connect to the control port */
|
||||||
int slsDetector::connectControl() {
|
int slsDetector::connectControl() {
|
||||||
if (controlSocket)
|
if (controlSocket){
|
||||||
return controlSocket->Connect();
|
if (controlSocket->Connect() >= 0)
|
||||||
|
return OK;
|
||||||
|
else{
|
||||||
|
std::cout << "cannot connect to detector" << endl;
|
||||||
|
setErrorMask((getErrorMask())|(CANNOT_CONNECT_TO_DETECTOR));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return UNDEFINED;
|
||||||
|
}
|
||||||
/** disconnect from the control port */
|
/** disconnect from the control port */
|
||||||
int slsDetector::disconnectControl() {
|
int slsDetector::disconnectControl() {
|
||||||
if (controlSocket)
|
if (controlSocket)
|
||||||
@ -1104,9 +1112,16 @@ int slsDetector::disconnectControl() {
|
|||||||
|
|
||||||
/** connect to the data port */
|
/** connect to the data port */
|
||||||
int slsDetector::connectData() {
|
int slsDetector::connectData() {
|
||||||
if (dataSocket)
|
if (dataSocket){
|
||||||
return dataSocket->Connect();
|
if (dataSocket->Connect() >= 0)
|
||||||
|
return OK;
|
||||||
|
else{
|
||||||
|
std::cout << "cannot connect to receiver" << endl;
|
||||||
|
setErrorMask((getErrorMask())|(CANNOT_CONNECT_TO_RECEIVER));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return UNDEFINED;
|
||||||
};
|
};
|
||||||
/** disconnect from the data port */
|
/** disconnect from the data port */
|
||||||
int slsDetector::disconnectData(){
|
int slsDetector::disconnectData(){
|
||||||
@ -1168,8 +1183,7 @@ int slsDetector::execCommand(string cmd, string answer){
|
|||||||
std::cout<< "Sending command " << arg << std::endl;
|
std::cout<< "Sending command " << arg << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
if (controlSocket->SendDataOnly(&fnum,sizeof(fnum))>=0) {
|
if (controlSocket->SendDataOnly(&fnum,sizeof(fnum))>=0) {
|
||||||
if (controlSocket->SendDataOnly(arg,MAX_STR_LENGTH)>=0) {
|
if (controlSocket->SendDataOnly(arg,MAX_STR_LENGTH)>=0) {
|
||||||
if (controlSocket->ReceiveDataOnly(retval,MAX_STR_LENGTH)>=0) {
|
if (controlSocket->ReceiveDataOnly(retval,MAX_STR_LENGTH)>=0) {
|
||||||
@ -1180,7 +1194,6 @@ int slsDetector::execCommand(string cmd, string answer){
|
|||||||
}
|
}
|
||||||
controlSocket->Disconnect();
|
controlSocket->Disconnect();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Detector answer is " << answer << std::endl;
|
std::cout<< "Detector answer is " << answer << std::endl;
|
||||||
#endif
|
#endif
|
||||||
@ -1219,8 +1232,7 @@ int slsDetector::setDetectorType(detectorType const type){
|
|||||||
std::cout<< "Setting detector type to " << arg << std::endl;
|
std::cout<< "Setting detector type to " << arg << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||||
if (retval!=FAIL)
|
if (retval!=FAIL)
|
||||||
@ -1233,7 +1245,6 @@ int slsDetector::setDetectorType(detectorType const type){
|
|||||||
if (retval==FORCE_UPDATE)
|
if (retval==FORCE_UPDATE)
|
||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (type==GET_DETECTOR_TYPE)
|
if (type==GET_DETECTOR_TYPE)
|
||||||
retType=thisDetector->myDetectorType;
|
retType=thisDetector->myDetectorType;
|
||||||
@ -1276,6 +1287,7 @@ int slsDetector::setNumberOfModules(int n, dimension d){
|
|||||||
int fnum=F_SET_NUMBER_OF_MODULES;
|
int fnum=F_SET_NUMBER_OF_MODULES;
|
||||||
int ret=FAIL;
|
int ret=FAIL;
|
||||||
char mess[100];
|
char mess[100];
|
||||||
|
int connect;
|
||||||
|
|
||||||
|
|
||||||
arg[0]=d;
|
arg[0]=d;
|
||||||
@ -1293,9 +1305,10 @@ int slsDetector::setNumberOfModules(int n, dimension d){
|
|||||||
std::cout<< "Setting number of modules of dimension "<< d << " to " << n << std::endl;
|
std::cout<< "Setting number of modules of dimension "<< d << " to " << n << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
connect = connectControl();
|
||||||
// cout << "connected" << endl;
|
if (connect == UNDEFINED)
|
||||||
if (controlSocket->Connect()>=0) {
|
cout << "no control socket?" << endl;
|
||||||
|
else if (connect == OK){
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&arg,sizeof(arg));
|
controlSocket->SendDataOnly(&arg,sizeof(arg));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
@ -1309,8 +1322,6 @@ int slsDetector::setNumberOfModules(int n, dimension d){
|
|||||||
if (ret==FORCE_UPDATE)
|
if (ret==FORCE_UPDATE)
|
||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
} else
|
|
||||||
cout << "no control socket?" << endl;
|
|
||||||
} else {
|
} else {
|
||||||
cout << "offline" << endl;
|
cout << "offline" << endl;
|
||||||
ret=OK;
|
ret=OK;
|
||||||
@ -1391,8 +1402,7 @@ int slsDetector::getMaxNumberOfModules(dimension d){
|
|||||||
std::cout<< "Getting max number of modules in dimension "<< d <<std::endl;
|
std::cout<< "Getting max number of modules in dimension "<< d <<std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&d,sizeof(d));
|
controlSocket->SendDataOnly(&d,sizeof(d));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
@ -1406,7 +1416,6 @@ int slsDetector::getMaxNumberOfModules(dimension d){
|
|||||||
if (ret==FORCE_UPDATE)
|
if (ret==FORCE_UPDATE)
|
||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
ret=OK;
|
ret=OK;
|
||||||
retval=thisDetector->nModMax[d];
|
retval=thisDetector->nModMax[d];
|
||||||
@ -1460,8 +1469,7 @@ slsDetectorDefs::externalSignalFlag slsDetector::setExternalSignalFlags(external
|
|||||||
std::cout<< "Setting signal "<< signalindex << " to flag" << pol << std::endl;
|
std::cout<< "Setting signal "<< signalindex << " to flag" << pol << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&arg,sizeof(arg));
|
controlSocket->SendDataOnly(&arg,sizeof(arg));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
@ -1475,7 +1483,6 @@ slsDetectorDefs::externalSignalFlag slsDetector::setExternalSignalFlags(external
|
|||||||
if (ret==FORCE_UPDATE)
|
if (ret==FORCE_UPDATE)
|
||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
retval=GET_EXTERNAL_SIGNAL_FLAG;
|
retval=GET_EXTERNAL_SIGNAL_FLAG;
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
@ -1531,8 +1538,7 @@ slsDetectorDefs::externalCommunicationMode slsDetector::setExternalCommunication
|
|||||||
std::cout<< "Setting communication to mode " << pol << std::endl;
|
std::cout<< "Setting communication to mode " << pol << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&arg,sizeof(arg));
|
controlSocket->SendDataOnly(&arg,sizeof(arg));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
@ -1546,7 +1552,6 @@ slsDetectorDefs::externalCommunicationMode slsDetector::setExternalCommunication
|
|||||||
if (ret==FORCE_UPDATE)
|
if (ret==FORCE_UPDATE)
|
||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
retval=GET_EXTERNAL_COMMUNICATION_MODE;
|
retval=GET_EXTERNAL_COMMUNICATION_MODE;
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
@ -1607,8 +1612,9 @@ int64_t slsDetector::getId( idMode mode, int imod){
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() != OK)
|
||||||
if (controlSocket->Connect()>=0) {
|
ret = FAIL;
|
||||||
|
else{
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&mode,sizeof(mode));
|
controlSocket->SendDataOnly(&mode,sizeof(mode));
|
||||||
if (mode==MODULE_SERIAL_NUMBER)
|
if (mode==MODULE_SERIAL_NUMBER)
|
||||||
@ -1623,10 +1629,6 @@ int64_t slsDetector::getId( idMode mode, int imod){
|
|||||||
controlSocket->Disconnect();
|
controlSocket->Disconnect();
|
||||||
if (ret==FORCE_UPDATE)
|
if (ret==FORCE_UPDATE)
|
||||||
updateDetector();
|
updateDetector();
|
||||||
} else
|
|
||||||
ret=FAIL;
|
|
||||||
} else {
|
|
||||||
ret=FAIL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1674,8 +1676,7 @@ int slsDetector::digitalTest( digitalTestMode mode, int imod){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&mode,sizeof(mode));
|
controlSocket->SendDataOnly(&mode,sizeof(mode));
|
||||||
if ((mode==CHIP_TEST)|| (mode==DIGITAL_BIT_TEST))
|
if ((mode==CHIP_TEST)|| (mode==DIGITAL_BIT_TEST))
|
||||||
@ -1691,7 +1692,6 @@ int slsDetector::digitalTest( digitalTestMode mode, int imod){
|
|||||||
if (ret==FORCE_UPDATE)
|
if (ret==FORCE_UPDATE)
|
||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
@ -1769,8 +1769,7 @@ int slsDetector::writeRegister(int addr, int val){
|
|||||||
std::cout<< "Writing to register "<< hex<<addr << " data " << hex<<val << std::endl;
|
std::cout<< "Writing to register "<< hex<<addr << " data " << hex<<val << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(arg,sizeof(arg));
|
controlSocket->SendDataOnly(arg,sizeof(arg));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
@ -1785,7 +1784,6 @@ int slsDetector::writeRegister(int addr, int val){
|
|||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Register returned "<< retval << std::endl;
|
std::cout<< "Register returned "<< retval << std::endl;
|
||||||
#endif
|
#endif
|
||||||
@ -1817,8 +1815,7 @@ int slsDetector::readRegister(int addr){
|
|||||||
std::cout<< "Reading register "<< hex<<addr << std::endl;
|
std::cout<< "Reading register "<< hex<<addr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&arg,sizeof(arg));
|
controlSocket->SendDataOnly(&arg,sizeof(arg));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
@ -1833,7 +1830,6 @@ int slsDetector::readRegister(int addr){
|
|||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Register returned "<< retval << std::endl;
|
std::cout<< "Register returned "<< retval << std::endl;
|
||||||
#endif
|
#endif
|
||||||
@ -1876,8 +1872,7 @@ dacs_t slsDetector::setDAC(dacs_t val, dacIndex index, int imod){
|
|||||||
std::cout<< "Setting DAC "<< index << " of module " << imod << " to " << val << std::endl;
|
std::cout<< "Setting DAC "<< index << " of module " << imod << " to " << val << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(arg,sizeof(arg));
|
controlSocket->SendDataOnly(arg,sizeof(arg));
|
||||||
controlSocket->SendDataOnly(&val,sizeof(val));
|
controlSocket->SendDataOnly(&val,sizeof(val));
|
||||||
@ -1903,7 +1898,6 @@ dacs_t slsDetector::setDAC(dacs_t val, dacIndex index, int imod){
|
|||||||
controlSocket->Disconnect();
|
controlSocket->Disconnect();
|
||||||
if (ret==FORCE_UPDATE)
|
if (ret==FORCE_UPDATE)
|
||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1935,8 +1929,7 @@ dacs_t slsDetector::getADC(dacIndex index, int imod){
|
|||||||
std::cout<< "Getting ADC "<< index << " of module " << imod << std::endl;
|
std::cout<< "Getting ADC "<< index << " of module " << imod << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(arg,sizeof(arg));
|
controlSocket->SendDataOnly(arg,sizeof(arg));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
@ -1952,7 +1945,6 @@ dacs_t slsDetector::getADC(dacIndex index, int imod){
|
|||||||
controlSocket->Disconnect();
|
controlSocket->Disconnect();
|
||||||
if (ret==FORCE_UPDATE)
|
if (ret==FORCE_UPDATE)
|
||||||
updateDetector();
|
updateDetector();
|
||||||
}else setCannotConnectToDetector();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -2029,8 +2021,7 @@ int slsDetector::setChannel(sls_detector_channel chan){
|
|||||||
int imod=chan.module;
|
int imod=chan.module;
|
||||||
|
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
sendChannel(&chan);
|
sendChannel(&chan);
|
||||||
|
|
||||||
@ -2046,7 +2037,6 @@ int slsDetector::setChannel(sls_detector_channel chan){
|
|||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (ret!=FAIL) {
|
if (ret!=FAIL) {
|
||||||
@ -2122,8 +2112,7 @@ slsDetectorDefs::sls_detector_channel slsDetector::getChannel(int ichan, int ic
|
|||||||
arg[1]=ichip;
|
arg[1]=ichip;
|
||||||
arg[2]=imod;
|
arg[2]=imod;
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(arg,sizeof(arg));
|
controlSocket->SendDataOnly(arg,sizeof(arg));
|
||||||
|
|
||||||
@ -2139,7 +2128,6 @@ slsDetectorDefs::sls_detector_channel slsDetector::getChannel(int ichan, int ic
|
|||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (ret!=FAIL) {
|
if (ret!=FAIL) {
|
||||||
@ -2216,8 +2204,7 @@ int slsDetector::setChip(sls_detector_chip chip){
|
|||||||
|
|
||||||
|
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
sendChip(&chip);
|
sendChip(&chip);
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
@ -2232,7 +2219,6 @@ int slsDetector::setChip(sls_detector_chip chip){
|
|||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (ret!=FAIL) {
|
if (ret!=FAIL) {
|
||||||
@ -2270,8 +2256,7 @@ slsDetectorDefs::sls_detector_chip slsDetector::getChip(int ichip, int imod){
|
|||||||
|
|
||||||
|
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(arg,sizeof(arg));
|
controlSocket->SendDataOnly(arg,sizeof(arg));
|
||||||
|
|
||||||
@ -2287,7 +2272,6 @@ slsDetectorDefs::sls_detector_chip slsDetector::getChip(int ichip, int imod){
|
|||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (ret!=FAIL) {
|
if (ret!=FAIL) {
|
||||||
@ -2408,8 +2392,7 @@ int slsDetector::setModule(sls_detector_module module){
|
|||||||
|
|
||||||
|
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
sendModule(&module);
|
sendModule(&module);
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
@ -2424,7 +2407,6 @@ int slsDetector::setModule(sls_detector_module module){
|
|||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (ret!=FAIL) {
|
if (ret!=FAIL) {
|
||||||
@ -2513,8 +2495,7 @@ slsDetectorDefs::sls_detector_module *slsDetector::getModule(int imod){
|
|||||||
|
|
||||||
|
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&imod,sizeof(imod));
|
controlSocket->SendDataOnly(&imod,sizeof(imod));
|
||||||
|
|
||||||
@ -2530,7 +2511,6 @@ slsDetectorDefs::sls_detector_module *slsDetector::getModule(int imod){
|
|||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (ret!=FAIL) {
|
if (ret!=FAIL) {
|
||||||
@ -2617,8 +2597,7 @@ int slsDetector::getThresholdEnergy(int imod){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&imod,sizeof(imod));
|
controlSocket->SendDataOnly(&imod,sizeof(imod));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
@ -2635,7 +2614,6 @@ int slsDetector::getThresholdEnergy(int imod){
|
|||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return thisDetector->currentThresholdEV;
|
return thisDetector->currentThresholdEV;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2649,8 +2627,7 @@ int slsDetector::setThresholdEnergy(int e_eV, int imod, detectorSettings isetti
|
|||||||
std::cout<< "Getting threshold energy "<< std::endl;
|
std::cout<< "Getting threshold energy "<< std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&e_eV,sizeof(e_eV));
|
controlSocket->SendDataOnly(&e_eV,sizeof(e_eV));
|
||||||
controlSocket->SendDataOnly(&imod,sizeof(imod));
|
controlSocket->SendDataOnly(&imod,sizeof(imod));
|
||||||
@ -2671,7 +2648,6 @@ int slsDetector::setThresholdEnergy(int e_eV, int imod, detectorSettings isetti
|
|||||||
if (ret==FORCE_UPDATE)
|
if (ret==FORCE_UPDATE)
|
||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
thisDetector->currentThresholdEV=e_eV;
|
thisDetector->currentThresholdEV=e_eV;
|
||||||
}
|
}
|
||||||
@ -2695,8 +2671,7 @@ slsDetectorDefs::detectorSettings slsDetector::getSettings(int imod){
|
|||||||
std::cout<< "Getting settings "<< std::endl;
|
std::cout<< "Getting settings "<< std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(arg,sizeof(arg));
|
controlSocket->SendDataOnly(arg,sizeof(arg));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
@ -2715,7 +2690,6 @@ slsDetectorDefs::detectorSettings slsDetector::getSettings(int imod){
|
|||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return thisDetector->currentSettings;
|
return thisDetector->currentSettings;
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -2958,8 +2932,7 @@ int slsDetector::updateDetector() {
|
|||||||
char mess[100];
|
char mess[100];
|
||||||
|
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
if (ret==FAIL) {
|
if (ret==FAIL) {
|
||||||
@ -2970,7 +2943,6 @@ int slsDetector::updateDetector() {
|
|||||||
controlSocket->Disconnect();
|
controlSocket->Disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2991,8 +2963,7 @@ int slsDetector::startAcquisition(){
|
|||||||
#endif
|
#endif
|
||||||
thisDetector->stoppedFlag=0;
|
thisDetector->stoppedFlag=0;
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
if (ret==FAIL) {
|
if (ret==FAIL) {
|
||||||
@ -3004,7 +2975,6 @@ int slsDetector::startAcquisition(){
|
|||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
||||||
@ -3049,8 +3019,7 @@ int slsDetector::startReadOut(){
|
|||||||
std::cout<< "Starting readout "<< std::endl;
|
std::cout<< "Starting readout "<< std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
if (ret==FAIL) {
|
if (ret==FAIL) {
|
||||||
@ -3062,7 +3031,6 @@ int slsDetector::startReadOut(){
|
|||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -3105,8 +3073,7 @@ int* slsDetector::readFrame(){
|
|||||||
std::cout<< "slsDetector: Reading frame "<< std::endl;
|
std::cout<< "slsDetector: Reading frame "<< std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
retval=getDataFromDetector();
|
retval=getDataFromDetector();
|
||||||
if (retval) {
|
if (retval) {
|
||||||
@ -3115,7 +3082,6 @@ int* slsDetector::readFrame(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return retval;
|
return retval;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -3196,8 +3162,7 @@ int* slsDetector::readAll(){
|
|||||||
std::cout<< "Reading all frames "<< std::endl;
|
std::cout<< "Reading all frames "<< std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
|
|
||||||
while ((retval=getDataFromDetector())){
|
while ((retval=getDataFromDetector())){
|
||||||
@ -3212,7 +3177,6 @@ int* slsDetector::readAll(){
|
|||||||
controlSocket->Disconnect();
|
controlSocket->Disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "received "<< i<< " frames" << std::endl;
|
std::cout<< "received "<< i<< " frames" << std::endl;
|
||||||
//#else
|
//#else
|
||||||
@ -3235,13 +3199,11 @@ int slsDetector::readAllNoWait(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return FAIL;
|
return FAIL;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -3301,14 +3263,12 @@ int slsDetector::startAndReadAllNoWait(){
|
|||||||
#endif
|
#endif
|
||||||
thisDetector->stoppedFlag=0;
|
thisDetector->stoppedFlag=0;
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
//std::cout<< "connected" << std::endl;
|
//std::cout<< "connected" << std::endl;
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return FAIL;
|
return FAIL;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -3366,8 +3326,7 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
|
|||||||
#endif
|
#endif
|
||||||
ut=t;
|
ut=t;
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&index,sizeof(index));
|
controlSocket->SendDataOnly(&index,sizeof(index));
|
||||||
n=controlSocket->SendDataOnly(&t,sizeof(t));
|
n=controlSocket->SendDataOnly(&t,sizeof(t));
|
||||||
@ -3388,7 +3347,6 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
//std::cout<< "offline " << std::endl;
|
//std::cout<< "offline " << std::endl;
|
||||||
if (t>=0)
|
if (t>=0)
|
||||||
@ -3425,8 +3383,7 @@ int slsDetector::lockServer(int lock) {
|
|||||||
char mess[100];
|
char mess[100];
|
||||||
|
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&lock,sizeof(lock));
|
controlSocket->SendDataOnly(&lock,sizeof(lock));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
@ -3441,7 +3398,6 @@ int slsDetector::lockServer(int lock) {
|
|||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
@ -3457,8 +3413,7 @@ string slsDetector::getLastClientIP() {
|
|||||||
int ret=OK;
|
int ret=OK;
|
||||||
|
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
if (ret==FAIL) {
|
if (ret==FAIL) {
|
||||||
@ -3472,7 +3427,6 @@ string slsDetector::getLastClientIP() {
|
|||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return string(clientName);
|
return string(clientName);
|
||||||
|
|
||||||
@ -3593,6 +3547,14 @@ int slsDetector::setPort(portType index, int num){
|
|||||||
s->ReceiveDataOnly(&retval,sizeof(retval));
|
s->ReceiveDataOnly(&retval,sizeof(retval));
|
||||||
}
|
}
|
||||||
s->Disconnect();
|
s->Disconnect();
|
||||||
|
}else{
|
||||||
|
if (index == CONTROL_PORT){
|
||||||
|
std::cout << "cannot connect to detector" << endl;
|
||||||
|
setErrorMask((getErrorMask())|(CANNOT_CONNECT_TO_DETECTOR));
|
||||||
|
}else if (index == DATA_PORT){
|
||||||
|
std::cout << "cannot connect to receiver" << endl;
|
||||||
|
setErrorMask((getErrorMask())|(CANNOT_CONNECT_TO_RECEIVER));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3770,8 +3732,7 @@ int slsDetector::setSpeed(speedVariable sp, int value) {
|
|||||||
std::cout<< "Setting speed variable"<< sp << " to " << value << std::endl;
|
std::cout<< "Setting speed variable"<< sp << " to " << value << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&sp,sizeof(sp));
|
controlSocket->SendDataOnly(&sp,sizeof(sp));
|
||||||
n=controlSocket->SendDataOnly(&value,sizeof(value));
|
n=controlSocket->SendDataOnly(&value,sizeof(value));
|
||||||
@ -3790,7 +3751,6 @@ int slsDetector::setSpeed(speedVariable sp, int value) {
|
|||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Speed set to "<< retval << std::endl;
|
std::cout<< "Speed set to "<< retval << std::endl;
|
||||||
#endif
|
#endif
|
||||||
@ -3863,8 +3823,7 @@ int slsDetector::setDynamicRange(int n){
|
|||||||
if (n==24)
|
if (n==24)
|
||||||
n=32;
|
n=32;
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&n,sizeof(n));
|
controlSocket->SendDataOnly(&n,sizeof(n));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
@ -3878,7 +3837,6 @@ int slsDetector::setDynamicRange(int n){
|
|||||||
if (ret==FORCE_UPDATE)
|
if (ret==FORCE_UPDATE)
|
||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else if(thisDetector->myDetectorType==MYTHEN){
|
} else if(thisDetector->myDetectorType==MYTHEN){
|
||||||
if (n>0)
|
if (n>0)
|
||||||
thisDetector->dynamicRange=n;
|
thisDetector->dynamicRange=n;
|
||||||
@ -3955,8 +3913,7 @@ int slsDetector::sendROI(int n,ROI roiLimits[]){
|
|||||||
|
|
||||||
|
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&arg,sizeof(arg));
|
controlSocket->SendDataOnly(&arg,sizeof(arg));
|
||||||
if(arg==-1){;
|
if(arg==-1){;
|
||||||
@ -3987,7 +3944,6 @@ int slsDetector::sendROI(int n,ROI roiLimits[]){
|
|||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//update client
|
//update client
|
||||||
if(ret!=FAIL){
|
if(ret!=FAIL){
|
||||||
@ -4031,8 +3987,7 @@ int slsDetector::setReadOutFlags(readOutFlags flag){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&flag,sizeof(flag));
|
controlSocket->SendDataOnly(&flag,sizeof(flag));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
@ -4047,7 +4002,6 @@ int slsDetector::setReadOutFlags(readOutFlags flag){
|
|||||||
if (ret==FORCE_UPDATE)
|
if (ret==FORCE_UPDATE)
|
||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (flag!=GET_READOUT_FLAGS)
|
if (flag!=GET_READOUT_FLAGS)
|
||||||
thisDetector->roFlags=flag;
|
thisDetector->roFlags=flag;
|
||||||
@ -4086,8 +4040,7 @@ int slsDetector::executeTrimming(trimMode mode, int par1, int par2, int imod){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "sending mode bytes= "<< controlSocket->SendDataOnly(&mode,sizeof(mode)) << std::endl;
|
std::cout<< "sending mode bytes= "<< controlSocket->SendDataOnly(&mode,sizeof(mode)) << std::endl;
|
||||||
@ -4114,7 +4067,6 @@ int slsDetector::executeTrimming(trimMode mode, int par1, int par2, int imod){
|
|||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -4918,8 +4870,7 @@ int slsDetector::configureMAC(){
|
|||||||
|
|
||||||
//send to server
|
//send to server
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(arg,sizeof(arg));
|
controlSocket->SendDataOnly(arg,sizeof(arg));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
@ -4935,7 +4886,6 @@ int slsDetector::configureMAC(){
|
|||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (ret==FAIL) {
|
if (ret==FAIL) {
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
std::cout<< "Configuring MAC failed " << std::endl;
|
std::cout<< "Configuring MAC failed " << std::endl;
|
||||||
@ -5059,8 +5009,7 @@ int slsDetector::sendImageToDetector(imageType index,short int imageVals[]){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&index,sizeof(index));
|
controlSocket->SendDataOnly(&index,sizeof(index));
|
||||||
controlSocket->SendDataOnly(imageVals,thisDetector->dataBytes);
|
controlSocket->SendDataOnly(imageVals,thisDetector->dataBytes);
|
||||||
@ -5075,8 +5024,6 @@ int slsDetector::sendImageToDetector(imageType index,short int imageVals[]){
|
|||||||
if (ret==FORCE_UPDATE)
|
if (ret==FORCE_UPDATE)
|
||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -5088,8 +5035,7 @@ int slsDetector::getCounterBlock(short int arg[],int startACQ){
|
|||||||
char mess[100];
|
char mess[100];
|
||||||
|
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&startACQ,sizeof(startACQ));
|
controlSocket->SendDataOnly(&startACQ,sizeof(startACQ));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
@ -5104,7 +5050,6 @@ int slsDetector::getCounterBlock(short int arg[],int startACQ){
|
|||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -5144,8 +5089,7 @@ int slsDetector::resetCounterBlock(int startACQ){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&startACQ,sizeof(startACQ));
|
controlSocket->SendDataOnly(&startACQ,sizeof(startACQ));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
@ -5158,7 +5102,6 @@ int slsDetector::resetCounterBlock(int startACQ){
|
|||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -5533,8 +5476,7 @@ slsDetectorDefs::masterFlags slsDetector::setMaster(masterFlags flag) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&flag,sizeof(flag));
|
controlSocket->SendDataOnly(&flag,sizeof(flag));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
@ -5549,7 +5491,6 @@ slsDetectorDefs::masterFlags slsDetector::setMaster(masterFlags flag) {
|
|||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Master flag set to "<< retval << std::endl;
|
std::cout<< "Master flag set to "<< retval << std::endl;
|
||||||
@ -5579,8 +5520,7 @@ slsDetectorDefs::synchronizationMode slsDetector::setSynchronization(synchroniza
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&flag,sizeof(flag));
|
controlSocket->SendDataOnly(&flag,sizeof(flag));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
@ -5595,7 +5535,6 @@ slsDetectorDefs::synchronizationMode slsDetector::setSynchronization(synchroniza
|
|||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Readout flag set to "<< retval << std::endl;
|
std::cout<< "Readout flag set to "<< retval << std::endl;
|
||||||
@ -5890,8 +5829,7 @@ int slsDetector::detectorSendToReceiver(bool set){
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << "Setting detector to send packets via client to: " << set << std::endl;
|
std::cout << "Setting detector to send packets via client to: " << set << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
if (ret==FAIL){
|
if (ret==FAIL){
|
||||||
@ -5902,7 +5840,6 @@ int slsDetector::detectorSendToReceiver(bool set){
|
|||||||
if (ret==FORCE_UPDATE)
|
if (ret==FORCE_UPDATE)
|
||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}else
|
}else
|
||||||
std::cout << "cannot connect to detector" << endl;
|
std::cout << "cannot connect to detector" << endl;
|
||||||
|
|
||||||
@ -5925,6 +5862,7 @@ slsDetectorDefs::runStatus slsDetector::getReceiverStatus(){
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << "Getting Receiver Status" << std::endl;
|
std::cout << "Getting Receiver Status" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
if (connectData() == OK)
|
||||||
ret=thisReceiver->getInt(fnum,retval);
|
ret=thisReceiver->getInt(fnum,retval);
|
||||||
if(retval!=-1)
|
if(retval!=-1)
|
||||||
s=(runStatus)retval;
|
s=(runStatus)retval;
|
||||||
@ -5947,6 +5885,7 @@ int slsDetector::getFramesCaughtByReceiver(){
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << "Getting Frames Caught by Receiver " << std::endl;
|
std::cout << "Getting Frames Caught by Receiver " << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
if (connectData() == OK)
|
||||||
ret=thisReceiver->getInt(fnum,retval);
|
ret=thisReceiver->getInt(fnum,retval);
|
||||||
if(ret==FORCE_UPDATE)
|
if(ret==FORCE_UPDATE)
|
||||||
ret=updateReceiver();
|
ret=updateReceiver();
|
||||||
@ -5966,6 +5905,7 @@ int slsDetector::getReceiverCurrentFrameIndex(){
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << "Getting Current Frame Index of Receiver " << std::endl;
|
std::cout << "Getting Current Frame Index of Receiver " << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
if (connectData() == OK)
|
||||||
ret=thisReceiver->getInt(fnum,retval);
|
ret=thisReceiver->getInt(fnum,retval);
|
||||||
if(ret==FORCE_UPDATE)
|
if(ret==FORCE_UPDATE)
|
||||||
ret=updateReceiver();
|
ret=updateReceiver();
|
||||||
@ -5985,6 +5925,7 @@ int slsDetector::resetFramesCaught(){
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << "Reset Frames Caught by Receiver" << std::endl;
|
std::cout << "Reset Frames Caught by Receiver" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
if (connectData() == OK)
|
||||||
ret=thisReceiver->executeFunction(fnum);
|
ret=thisReceiver->executeFunction(fnum);
|
||||||
if(ret==FORCE_UPDATE)
|
if(ret==FORCE_UPDATE)
|
||||||
ret=updateReceiver();
|
ret=updateReceiver();
|
||||||
@ -6010,8 +5951,7 @@ int* slsDetector::readFrameFromReceiver(char* fName, int &fIndex){
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "slsDetector: Reading frame from receiver "<< thisDetector->dataBytes << " " <<nel <<std::endl;
|
std::cout<< "slsDetector: Reading frame from receiver "<< thisDetector->dataBytes << " " <<nel <<std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (dataSocket) {
|
if (connectData() == OK){
|
||||||
if (dataSocket->Connect()>=0) {
|
|
||||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
|
|
||||||
@ -6037,7 +5977,6 @@ int* slsDetector::readFrameFromReceiver(char* fName, int &fIndex){
|
|||||||
dataSocket->Disconnect();
|
dataSocket->Disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return retval;
|
return retval;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -6057,6 +5996,7 @@ int slsDetector::lockReceiver(int lock){
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << "Locking or Unlocking Receiver " << std::endl;
|
std::cout << "Locking or Unlocking Receiver " << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
if (connectData() == OK)
|
||||||
ret=thisReceiver->sendInt(fnum,retval,arg);
|
ret=thisReceiver->sendInt(fnum,retval,arg);
|
||||||
if(ret==FORCE_UPDATE)
|
if(ret==FORCE_UPDATE)
|
||||||
updateReceiver();
|
updateReceiver();
|
||||||
@ -6079,6 +6019,7 @@ string slsDetector::getReceiverLastClientIP(){
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << "Geting Last Client IP connected to Receiver " << std::endl;
|
std::cout << "Geting Last Client IP connected to Receiver " << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
if (connectData() == OK)
|
||||||
ret=thisReceiver->getLastClientIP(fnum,retval);
|
ret=thisReceiver->getLastClientIP(fnum,retval);
|
||||||
if(ret==FORCE_UPDATE)
|
if(ret==FORCE_UPDATE)
|
||||||
updateReceiver();
|
updateReceiver();
|
||||||
@ -6121,8 +6062,7 @@ int slsDetector::updateReceiver() {
|
|||||||
char mess[100];
|
char mess[100];
|
||||||
|
|
||||||
if (setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) {
|
if (setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) {
|
||||||
if (dataSocket) {
|
if (connectData() == OK){
|
||||||
if (dataSocket->Connect()>=0) {
|
|
||||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
if (ret!=FAIL)
|
if (ret!=FAIL)
|
||||||
@ -6131,11 +6071,9 @@ int slsDetector::updateReceiver() {
|
|||||||
dataSocket->ReceiveDataOnly(mess,sizeof(mess));
|
dataSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||||
std::cout<< "Receiver returned error: " << mess << std::endl;
|
std::cout<< "Receiver returned error: " << mess << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
dataSocket->Disconnect();
|
dataSocket->Disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -6187,6 +6125,7 @@ int slsDetector::enableWriteToFile(int enable){
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << "Sending enable file write to receiver " << arg << std::endl;
|
std::cout << "Sending enable file write to receiver " << arg << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
if (connectData() == OK)
|
||||||
ret=thisReceiver->sendInt(fnum,retval,arg);
|
ret=thisReceiver->sendInt(fnum,retval,arg);
|
||||||
if(ret!=FAIL)
|
if(ret!=FAIL)
|
||||||
parentDet->enableWriteToFileMask(retval);
|
parentDet->enableWriteToFileMask(retval);
|
||||||
@ -6215,6 +6154,7 @@ int slsDetector::setFrameIndex(int index){
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << "Sending frame index to receiver " << arg << std::endl;
|
std::cout << "Sending frame index to receiver " << arg << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
if (connectData() == OK)
|
||||||
ret=thisReceiver->sendInt(fnum,retval,arg);
|
ret=thisReceiver->sendInt(fnum,retval,arg);
|
||||||
if(ret!=FAIL)
|
if(ret!=FAIL)
|
||||||
fileIO::setFrameIndex(retval);
|
fileIO::setFrameIndex(retval);
|
||||||
@ -6237,8 +6177,7 @@ int slsDetector::calibratePedestal(int frames){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (connectControl() == OK){
|
||||||
if (controlSocket->Connect()>=0) {
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&frames,sizeof(frames));
|
controlSocket->SendDataOnly(&frames,sizeof(frames));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
@ -6253,7 +6192,6 @@ int slsDetector::calibratePedestal(int frames){
|
|||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@ -6270,14 +6208,3 @@ int64_t slsDetector::clearAllErrorMask(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void slsDetector::setCannotConnectToDetector(){
|
|
||||||
std::cout << "cannot connect to detector" << endl;
|
|
||||||
setErrorMask((getErrorMask())|(CANNOT_CONNECT_TO_DETECTOR));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void slsDetector::setCannotConnectToReceiver(){
|
|
||||||
std::cout << "cannot connect to Receiver" << endl;
|
|
||||||
setErrorMask((getErrorMask())|(CANNOT_CONNECT_TO_RECEIVER));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -1554,13 +1554,6 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
*/
|
*/
|
||||||
int64_t clearAllErrorMask();
|
int64_t clearAllErrorMask();
|
||||||
|
|
||||||
/** Sets Cannot connect to Detector error mask and prints it
|
|
||||||
*/
|
|
||||||
void setCannotConnectToDetector();
|
|
||||||
|
|
||||||
/** Sets Cannot connect to Detector error mask and prints it
|
|
||||||
*/
|
|
||||||
void setCannotConnectToReceiver();
|
|
||||||
|
|
||||||
/** returns the detector MAC address\sa sharedSlsDetector */
|
/** returns the detector MAC address\sa sharedSlsDetector */
|
||||||
char* getDetectorMAC() {return thisDetector->detectorMAC;};
|
char* getDetectorMAC() {return thisDetector->detectorMAC;};
|
||||||
|
@ -25,8 +25,6 @@ int receiverInterface::sendString(int fnum, char retval[], char arg[]){
|
|||||||
int ret = slsDetectorDefs::FAIL;
|
int ret = slsDetectorDefs::FAIL;
|
||||||
char mess[100] = "";
|
char mess[100] = "";
|
||||||
|
|
||||||
if (dataSocket) {
|
|
||||||
if (dataSocket->Connect()>=0) {
|
|
||||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
dataSocket->SendDataOnly(arg,MAX_STR_LENGTH);
|
dataSocket->SendDataOnly(arg,MAX_STR_LENGTH);
|
||||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
@ -35,9 +33,8 @@ int receiverInterface::sendString(int fnum, char retval[], char arg[]){
|
|||||||
std::cout<< "Receiver returned error: " << mess << std::endl;
|
std::cout<< "Receiver returned error: " << mess << std::endl;
|
||||||
}
|
}
|
||||||
dataSocket->ReceiveDataOnly(retval,MAX_STR_LENGTH);
|
dataSocket->ReceiveDataOnly(retval,MAX_STR_LENGTH);
|
||||||
}
|
|
||||||
dataSocket->Disconnect();
|
dataSocket->Disconnect();
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,8 +45,6 @@ int receiverInterface::sendUDPDetails(int fnum, char retval[], char arg[2][MAX_S
|
|||||||
int ret = slsDetectorDefs::FAIL;
|
int ret = slsDetectorDefs::FAIL;
|
||||||
char mess[100] = "";
|
char mess[100] = "";
|
||||||
|
|
||||||
if (dataSocket) {
|
|
||||||
if (dataSocket->Connect()>=0) {
|
|
||||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
dataSocket->SendDataOnly(arg,sizeof(args));
|
dataSocket->SendDataOnly(arg,sizeof(args));
|
||||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
@ -59,9 +54,8 @@ int receiverInterface::sendUDPDetails(int fnum, char retval[], char arg[2][MAX_S
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
dataSocket->ReceiveDataOnly(retval,MAX_STR_LENGTH);
|
dataSocket->ReceiveDataOnly(retval,MAX_STR_LENGTH);
|
||||||
}
|
|
||||||
dataSocket->Disconnect();
|
dataSocket->Disconnect();
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,8 +64,6 @@ int receiverInterface::sendInt(int fnum, int &retval, int arg){
|
|||||||
int ret = slsDetectorDefs::FAIL;
|
int ret = slsDetectorDefs::FAIL;
|
||||||
char mess[100] = "";
|
char mess[100] = "";
|
||||||
|
|
||||||
if (dataSocket) {
|
|
||||||
if (dataSocket->Connect()>=0) {
|
|
||||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
dataSocket->SendDataOnly(&arg,sizeof(arg));
|
dataSocket->SendDataOnly(&arg,sizeof(arg));
|
||||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
@ -80,9 +72,8 @@ int receiverInterface::sendInt(int fnum, int &retval, int arg){
|
|||||||
std::cout<< "Receiver returned error: " << mess << std::endl;
|
std::cout<< "Receiver returned error: " << mess << std::endl;
|
||||||
}
|
}
|
||||||
dataSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
dataSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||||
}
|
|
||||||
dataSocket->Disconnect();
|
dataSocket->Disconnect();
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,14 +82,11 @@ int receiverInterface::sendInt(int fnum, int &retval, int arg){
|
|||||||
int receiverInterface::getInt(int fnum, int &retval){
|
int receiverInterface::getInt(int fnum, int &retval){
|
||||||
int ret = slsDetectorDefs::FAIL;
|
int ret = slsDetectorDefs::FAIL;
|
||||||
|
|
||||||
if (dataSocket) {
|
|
||||||
if (dataSocket->Connect()>=0) {
|
|
||||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
dataSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
dataSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||||
}
|
|
||||||
dataSocket->Disconnect();
|
dataSocket->Disconnect();
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,14 +95,11 @@ int receiverInterface::getInt(int fnum, int &retval){
|
|||||||
int receiverInterface::getInt(int fnum, int64_t &retval){
|
int receiverInterface::getInt(int fnum, int64_t &retval){
|
||||||
int ret = slsDetectorDefs::FAIL;
|
int ret = slsDetectorDefs::FAIL;
|
||||||
|
|
||||||
if (dataSocket) {
|
|
||||||
if (dataSocket->Connect()>=0) {
|
|
||||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
dataSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
dataSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||||
}
|
|
||||||
dataSocket->Disconnect();
|
dataSocket->Disconnect();
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,14 +107,11 @@ int receiverInterface::getInt(int fnum, int64_t &retval){
|
|||||||
int receiverInterface::getLastClientIP(int fnum, char retval[]){
|
int receiverInterface::getLastClientIP(int fnum, char retval[]){
|
||||||
int ret = slsDetectorDefs::FAIL;
|
int ret = slsDetectorDefs::FAIL;
|
||||||
|
|
||||||
if (dataSocket) {
|
|
||||||
if (dataSocket->Connect()>=0) {
|
|
||||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
dataSocket->ReceiveDataOnly(retval,sizeof(retval));
|
dataSocket->ReceiveDataOnly(retval,sizeof(retval));
|
||||||
dataSocket->Disconnect();
|
dataSocket->Disconnect();
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,8 +122,6 @@ int receiverInterface::executeFunction(int fnum){
|
|||||||
int ret = slsDetectorDefs::FAIL;
|
int ret = slsDetectorDefs::FAIL;
|
||||||
char mess[100] = "";
|
char mess[100] = "";
|
||||||
|
|
||||||
if (dataSocket) {
|
|
||||||
if (dataSocket->Connect()>=0) {
|
|
||||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
if (ret==slsDetectorDefs::FAIL){
|
if (ret==slsDetectorDefs::FAIL){
|
||||||
@ -149,36 +129,8 @@ int receiverInterface::executeFunction(int fnum){
|
|||||||
std::cout<< "Receiver returned error: " << mess << std::endl;
|
std::cout<< "Receiver returned error: " << mess << std::endl;
|
||||||
}
|
}
|
||||||
dataSocket->Disconnect();
|
dataSocket->Disconnect();
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
int receiverInterface::exitServer(){
|
|
||||||
|
|
||||||
int retval;
|
|
||||||
int fnum=F_EXIT_SERVER;
|
|
||||||
|
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
|
||||||
if (controlSocket) {
|
|
||||||
controlSocket->Connect();
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
|
||||||
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
|
||||||
controlSocket->Disconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (retval!=OK) {
|
|
||||||
std::cout<< std::endl;
|
|
||||||
std::cout<< "Shutting down the server" << std::endl;
|
|
||||||
std::cout<< std::endl;
|
|
||||||
}
|
|
||||||
return retval;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user