mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 12:57:13 +02:00
some more changes, yet to do receiver
This commit is contained in:
@ -962,6 +962,18 @@ int multiSlsDetector::exitServer(int detPos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int multiSlsDetector::execCommand(std::string cmd, int detPos) {
|
||||||
|
// single
|
||||||
|
if (detPos >= 0) {
|
||||||
|
return detectors[detPos]->execCommand(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
// multi
|
||||||
|
auto r = parallelCall(&slsDetector::execCommand, cmd);
|
||||||
|
return sls::allEqualTo(r, static_cast<int>(OK)) ? OK : FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int multiSlsDetector::readConfigurationFile(std::string const fname) {
|
int multiSlsDetector::readConfigurationFile(std::string const fname) {
|
||||||
freeSharedMemory();
|
freeSharedMemory();
|
||||||
setupMultiDetector();
|
setupMultiDetector();
|
||||||
|
@ -453,6 +453,14 @@ public:
|
|||||||
*/
|
*/
|
||||||
int exitServer(int detPos = -1);
|
int exitServer(int detPos = -1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute a command on the detector server
|
||||||
|
* @param cmd command
|
||||||
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
|
* @returns OK or FAIL
|
||||||
|
*/
|
||||||
|
int execCommand(std::string cmd, int detPos);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load configuration from a configuration File
|
* Load configuration from a configuration File
|
||||||
* @param fname configuration file name
|
* @param fname configuration file name
|
||||||
|
@ -916,73 +916,58 @@ slsDetectorDefs::detectorType slsDetector::getDetectorType(const char *name, int
|
|||||||
|
|
||||||
int slsDetector::setDetectorType(detectorType const type) {
|
int slsDetector::setDetectorType(detectorType const type) {
|
||||||
|
|
||||||
int arg, retval=FAIL;
|
int ret=FAIL;
|
||||||
int fnum=F_GET_DETECTOR_TYPE,fnum2=F_GET_RECEIVER_TYPE;
|
int fnum=F_GET_DETECTOR_TYPE,fnum2=F_GET_RECEIVER_TYPE;
|
||||||
arg=int(type);
|
detectorType retval = type;
|
||||||
detectorType retType=type;
|
|
||||||
char mess[MAX_STR_LENGTH];
|
char mess[MAX_STR_LENGTH];
|
||||||
memset(mess, 0, MAX_STR_LENGTH);
|
memset(mess, 0, MAX_STR_LENGTH);
|
||||||
|
|
||||||
|
|
||||||
|
if (type != GET_DETECTOR_TYPE) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< std::endl;
|
std::cout<< std::endl;
|
||||||
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 (connectControl() == OK){
|
if (connectControl() == OK){
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
if (retval!=FAIL)
|
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||||
controlSocket->ReceiveDataOnly(&retType,sizeof(retType));
|
thisDetector->myDetectorType = (detectorType)retval;
|
||||||
else {
|
#ifdef VERBOSE
|
||||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
std::cout<< "Detector type retrieved " << retval << std::endl;
|
||||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
#endif
|
||||||
|
disconnectControl();
|
||||||
|
if (ret==FORCE_UPDATE)
|
||||||
|
updateDetector();
|
||||||
}
|
}
|
||||||
disconnectControl();
|
} else {
|
||||||
if (retval==FORCE_UPDATE)
|
std::cout<< "Get detector type failed " << std::endl;
|
||||||
updateDetector();
|
thisDetector->myDetectorType = GENERIC;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (type==GET_DETECTOR_TYPE)
|
|
||||||
retType=thisDetector->myDetectorType;//FIXME: throw exception?
|
|
||||||
else {
|
|
||||||
retType=type;
|
|
||||||
thisDetector->myDetectorType=type;
|
|
||||||
}
|
|
||||||
retval=OK;
|
|
||||||
}
|
}
|
||||||
#ifdef VERBOSE
|
|
||||||
std::cout<< "Detector type set to " << retType << std::endl;
|
|
||||||
#endif
|
|
||||||
if (retval==FAIL) {
|
|
||||||
std::cout<< "Set detector type failed " << std::endl;
|
|
||||||
retType=GENERIC;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
thisDetector->myDetectorType=retType;
|
|
||||||
|
|
||||||
|
|
||||||
//receiver
|
//receiver
|
||||||
if((retType != GENERIC) && (thisDetector->receiverOnlineFlag==ONLINE_FLAG)
|
if((thisDetector->myDetectorType != GENERIC) &&
|
||||||
&& (arg != GENERIC)) {
|
(thisDetector->receiverOnlineFlag==ONLINE_FLAG)) {
|
||||||
retval = FAIL;
|
ret = FAIL;
|
||||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << "Sending detector type to Receiver " <<
|
std::cout << "Sending detector type to Receiver " <<
|
||||||
(int)thisDetector->myDetectorType << std::endl;
|
(int)thisDetector->myDetectorType << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (connectData() == OK){
|
if (connectData() == OK){
|
||||||
retval=thisReceiver->sendInt(fnum2,arg,(int)thisDetector->myDetectorType);
|
ret=thisReceiver->sendInt(fnum2,retval,(int)thisDetector->myDetectorType);
|
||||||
disconnectData();
|
disconnectData();
|
||||||
}
|
}
|
||||||
if(retval==FAIL){
|
if(ret==FAIL){
|
||||||
std::cout << "ERROR: Could not send detector type to receiver" << std::endl;
|
std::cout << "ERROR: Could not send detector type to receiver" << std::endl;
|
||||||
setErrorMask((getErrorMask())|(RECEIVER_DET_HOSTTYPE_NOT_SET));
|
setErrorMask((getErrorMask())|(RECEIVER_DET_HOSTTYPE_NOT_SET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return retType;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1543,39 +1528,31 @@ std::string slsDetector::getLastClientIP() {
|
|||||||
if (connectControl() == OK){
|
if (connectControl() == OK){
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
if (ret==FAIL) {
|
controlSocket->ReceiveDataOnly(clientName,sizeof(clientName));
|
||||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
|
||||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
|
||||||
} else {
|
|
||||||
controlSocket->ReceiveDataOnly(clientName,sizeof(clientName));
|
|
||||||
}
|
|
||||||
disconnectControl();
|
disconnectControl();
|
||||||
if (ret==FORCE_UPDATE)
|
if (ret==FORCE_UPDATE)
|
||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::string(clientName);
|
return std::string(clientName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int slsDetector::exitServer() {
|
int slsDetector::exitServer() {
|
||||||
|
int ret = FAIL;
|
||||||
int retval;
|
|
||||||
int fnum=F_EXIT_SERVER;
|
int fnum=F_EXIT_SERVER;
|
||||||
|
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (controlSocket) {
|
||||||
controlSocket->Connect();
|
controlSocket->Connect();
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
disconnectControl();
|
disconnectControl();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (retval!=OK) {
|
if (ret==OK) {
|
||||||
std::cout<< std::endl;
|
std::cout<< std::endl;
|
||||||
std::cout<< "Shutting down the server" << std::endl;
|
std::cout<< "Shutting down the Detector server" << std::endl;
|
||||||
std::cout<< std::endl;
|
std::cout<< std::endl;
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
@ -1583,13 +1560,11 @@ int slsDetector::exitServer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int slsDetector::execCommand(std::string cmd, std::string answer) {
|
int slsDetector::execCommand(std::string cmd) {
|
||||||
|
|
||||||
char arg[MAX_STR_LENGTH], retval[MAX_STR_LENGTH];
|
char arg[MAX_STR_LENGTH]="", retval[MAX_STR_LENGTH]="";
|
||||||
int fnum=F_EXEC_COMMAND;
|
int fnum=F_EXEC_COMMAND;
|
||||||
|
|
||||||
int ret=FAIL;
|
int ret=FAIL;
|
||||||
|
|
||||||
strcpy(arg,cmd.c_str());
|
strcpy(arg,cmd.c_str());
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -1598,19 +1573,13 @@ int slsDetector::execCommand(std::string cmd, std::string answer) {
|
|||||||
#endif
|
#endif
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (connectControl() == OK){
|
if (connectControl() == OK){
|
||||||
if (controlSocket->SendDataOnly(&fnum,sizeof(fnum))>=0) {
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
if (controlSocket->SendDataOnly(arg,MAX_STR_LENGTH)>=0) {
|
controlSocket->SendDataOnly(arg,MAX_STR_LENGTH);
|
||||||
if (controlSocket->ReceiveDataOnly(retval,MAX_STR_LENGTH)>=0) {
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
ret=OK;
|
controlSocket->ReceiveDataOnly(retval,MAX_STR_LENGTH);
|
||||||
answer=retval;
|
std::cout << "Detector returned:" << retval << std::endl;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
disconnectControl();
|
disconnectControl();
|
||||||
}
|
}
|
||||||
#ifdef VERBOSE
|
|
||||||
std::cout<< "Detector answer is " << answer << std::endl;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1706,11 +1675,7 @@ int slsDetector::updateDetector() {
|
|||||||
if (connectControl() == OK){
|
if (connectControl() == OK){
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
if (ret==FAIL) {
|
updateDetectorNoWait();
|
||||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
|
||||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
|
||||||
} else
|
|
||||||
updateDetectorNoWait();
|
|
||||||
disconnectControl();
|
disconnectControl();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1905,8 +1870,7 @@ slsDetectorDefs::detectorSettings slsDetector::sendSettingsOnly(detectorSettings
|
|||||||
char mess[MAX_STR_LENGTH];
|
char mess[MAX_STR_LENGTH];
|
||||||
memset(mess, 0, MAX_STR_LENGTH);
|
memset(mess, 0, MAX_STR_LENGTH);
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
int arg;
|
int arg = isettings;
|
||||||
arg = isettings;
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Setting settings to " << arg << std::endl;
|
std::cout<< "Setting settings to " << arg << std::endl;
|
||||||
#endif
|
#endif
|
||||||
@ -1939,7 +1903,7 @@ slsDetectorDefs::detectorSettings slsDetector::sendSettingsOnly(detectorSettings
|
|||||||
int slsDetector::getThresholdEnergy() {
|
int slsDetector::getThresholdEnergy() {
|
||||||
|
|
||||||
int fnum= F_GET_THRESHOLD_ENERGY;
|
int fnum= F_GET_THRESHOLD_ENERGY;
|
||||||
int retval;
|
int retval = -1;
|
||||||
int ret=FAIL;
|
int ret=FAIL;
|
||||||
char mess[MAX_STR_LENGTH]="";
|
char mess[MAX_STR_LENGTH]="";
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
|
@ -105,6 +105,13 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdExitServer;
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdExitServer;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
|
/*! \page test
|
||||||
|
- <b>execcommand</b> Executes a command on the detector server. Don't use it!!!!
|
||||||
|
*/
|
||||||
|
descrToFuncMap[i].m_pFuncName="execcommand";//OK
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdExitServer;
|
||||||
|
++i;
|
||||||
|
|
||||||
/*! \page test
|
/*! \page test
|
||||||
- <b>flippeddatay [i]</b> enables/disables data being flipped across y axis. 1 enables, 0 disables. Not implemented.
|
- <b>flippeddatay [i]</b> enables/disables data being flipped across y axis. 1 enables, 0 disables. Not implemented.
|
||||||
*/
|
*/
|
||||||
@ -1730,6 +1737,7 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* receiver functions */
|
/* receiver functions */
|
||||||
|
|
||||||
/*! \page receiver Receiver commands
|
/*! \page receiver Receiver commands
|
||||||
@ -2412,18 +2420,25 @@ string slsDetectorCommand::cmdExitServer(int narg, char *args[], int action, int
|
|||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
if (cmd=="exitserver"){
|
if (cmd=="exitserver"){
|
||||||
myDet->setOnline(ONLINE_FLAG, detPos);
|
myDet->setOnline(ONLINE_FLAG, detPos);
|
||||||
if (myDet->exitServer(detPos)!=OK)
|
if (myDet->exitServer(detPos)==OK)
|
||||||
return string("Server shut down.");
|
return string("Server shut down.");
|
||||||
else
|
else
|
||||||
return string("Error closing server\n");
|
return string("Error closing server\n");
|
||||||
}
|
}
|
||||||
else if (cmd=="exitreceiver"){
|
else if (cmd=="exitreceiver"){
|
||||||
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
||||||
if(myDet->exitReceiver(detPos)!=OK)
|
if(myDet->exitReceiver(detPos)==OK)
|
||||||
return string("Receiver shut down\n");
|
return string("Receiver shut down\n");
|
||||||
else
|
else
|
||||||
return string("Error closing receiver\n");
|
return string("Error closing receiver\n");
|
||||||
}
|
}
|
||||||
|
else if (cmd=="execcommand"){
|
||||||
|
myDet->setOnline(ONLINE_FLAG, detPos);
|
||||||
|
if(myDet->execCommand(std::string(argv[1]), detPos)==OK)
|
||||||
|
return string("Command executed successfully\n");
|
||||||
|
else
|
||||||
|
return string("Command failed\n");
|
||||||
|
}
|
||||||
else return("cannot decode command\n");
|
else return("cannot decode command\n");
|
||||||
} else
|
} else
|
||||||
return ("cannot get");
|
return ("cannot get");
|
||||||
@ -2434,6 +2449,7 @@ string slsDetectorCommand::helpExitServer(int action){
|
|||||||
ostringstream os;
|
ostringstream os;
|
||||||
os << string("exitserver \t shuts down all the detector servers. Don't use it!!!!\n");
|
os << string("exitserver \t shuts down all the detector servers. Don't use it!!!!\n");
|
||||||
os << string("exitreceiver \t shuts down all the receiver servers.\n");
|
os << string("exitreceiver \t shuts down all the receiver servers.\n");
|
||||||
|
os << string("execcommand \t executes command in detector server. Don't use it if you do not know what you are doing.\n");
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,14 +162,13 @@ int function_table() {
|
|||||||
int M_nofunc(int file_des){
|
int M_nofunc(int file_des){
|
||||||
|
|
||||||
int ret=FAIL;
|
int ret=FAIL;
|
||||||
|
|
||||||
sprintf(mess,"Unrecognized Function. Please do not proceed.\n");
|
|
||||||
cprintf(BG_RED,"Error: %s",mess);
|
|
||||||
|
|
||||||
int n = 1;
|
int n = 1;
|
||||||
while (n > 0)
|
while (n > 0)
|
||||||
n = receiveData(file_des,mess,MAX_STR_LENGTH,OTHER);
|
n = receiveData(file_des,mess,MAX_STR_LENGTH,OTHER);
|
||||||
|
|
||||||
|
sprintf(mess,"Unrecognized Function. Please do not proceed.\n");
|
||||||
|
cprintf(BG_RED,"Error: %s",mess);
|
||||||
|
|
||||||
sendDataOnly(file_des,&ret,sizeof(ret));
|
sendDataOnly(file_des,&ret,sizeof(ret));
|
||||||
sendDataOnly(file_des,mess,sizeof(mess));
|
sendDataOnly(file_des,mess,sizeof(mess));
|
||||||
return GOODBYE;
|
return GOODBYE;
|
||||||
@ -232,32 +231,24 @@ int exec_command(int file_des) {
|
|||||||
|
|
||||||
int get_detector_type(int file_des) {
|
int get_detector_type(int file_des) {
|
||||||
int n=0;
|
int n=0;
|
||||||
enum detectorType ret;
|
enum detectorType retval;
|
||||||
int retval=OK;
|
int ret = OK;
|
||||||
|
|
||||||
sprintf(mess,"Can't return detector type\n");
|
|
||||||
|
|
||||||
|
|
||||||
/* receive arguments */
|
|
||||||
/* execute action */
|
/* execute action */
|
||||||
ret=myDetectorType;
|
retval=myDetectorType;
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("Returning detector type %d\n",ret);
|
printf("Returning detector type %d\n",ret);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* send answer */
|
|
||||||
/* send OK/failed */
|
|
||||||
if (differentClients==1)
|
if (differentClients==1)
|
||||||
retval=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
|
|
||||||
|
/* send OK/failed */
|
||||||
|
n += sendDataOnly(file_des,&ret,sizeof(ret));
|
||||||
|
/* send return argument */
|
||||||
n += sendDataOnly(file_des,&retval,sizeof(retval));
|
n += sendDataOnly(file_des,&retval,sizeof(retval));
|
||||||
if (retval!=FAIL) {
|
|
||||||
/* send return argument */
|
|
||||||
n += sendDataOnly(file_des,&ret,sizeof(ret));
|
|
||||||
} else {
|
|
||||||
n += sendDataOnly(file_des,mess,sizeof(mess));
|
|
||||||
}
|
|
||||||
/*return ok/fail*/
|
/*return ok/fail*/
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
@ -1646,10 +1637,10 @@ int set_speed(int file_des) {
|
|||||||
|
|
||||||
|
|
||||||
int exit_server(int file_des) {
|
int exit_server(int file_des) {
|
||||||
int retval=FAIL;
|
int ret=OK;
|
||||||
sendDataOnly(file_des,&retval,sizeof(retval));
|
sprintf(mess,"closing server\n");
|
||||||
printf("closing server.");
|
cprintf(BG_RED,"Command: %s",mess);
|
||||||
sprintf(mess,"closing server");
|
sendDataOnly(file_des,&ret,sizeof(ret));
|
||||||
sendDataOnly(file_des,mess,sizeof(mess));
|
sendDataOnly(file_des,mess,sizeof(mess));
|
||||||
return GOODBYE;
|
return GOODBYE;
|
||||||
}
|
}
|
||||||
|
@ -1681,6 +1681,9 @@ int get_threshold_energy(int file_des) {
|
|||||||
sprintf(mess,"get threshold energy failed\n");
|
sprintf(mess,"get threshold energy failed\n");
|
||||||
|
|
||||||
#ifndef EIGERD
|
#ifndef EIGERD
|
||||||
|
//to receive any arguments
|
||||||
|
while (n > 0)
|
||||||
|
n = receiveData(file_des,mess,MAX_STR_LENGTH,OTHER);
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess,"Function (Get Threshold Energy) is not implemented for this detector\n");
|
sprintf(mess,"Function (Get Threshold Energy) is not implemented for this detector\n");
|
||||||
cprintf(RED, "Warning: %s", mess);
|
cprintf(RED, "Warning: %s", mess);
|
||||||
@ -2512,9 +2515,9 @@ int set_speed(int file_des) {
|
|||||||
|
|
||||||
|
|
||||||
int exit_server(int file_des) {
|
int exit_server(int file_des) {
|
||||||
int ret=FAIL;
|
int ret=OK;
|
||||||
sprintf(mess,"Closing Server\n");
|
sprintf(mess,"Closing Server\n");
|
||||||
cprintf(BG_RED,"Error: %s",mess);
|
cprintf(BG_RED,"Command: %s",mess);
|
||||||
// send ok / fail
|
// send ok / fail
|
||||||
sendData(file_des,&ret,sizeof(ret),INT32);
|
sendData(file_des,&ret,sizeof(ret),INT32);
|
||||||
// send return argument
|
// send return argument
|
||||||
|
@ -382,14 +382,6 @@ int sendModuleGeneral(int file_des, sls_detector_module *myMod, int sendAll) {
|
|||||||
ts+=sendData(file_des,&(myMod->ndac),sizeof(myMod->ndac),INT32);
|
ts+=sendData(file_des,&(myMod->ndac),sizeof(myMod->ndac),INT32);
|
||||||
ts+=sendData(file_des,&(myMod->nadc),sizeof(myMod->nadc),INT32);
|
ts+=sendData(file_des,&(myMod->nadc),sizeof(myMod->nadc),INT32);
|
||||||
ts+=sendData(file_des,&(myMod->reg),sizeof(myMod->reg),INT32);
|
ts+=sendData(file_des,&(myMod->reg),sizeof(myMod->reg),INT32);
|
||||||
|
|
||||||
#ifdef MYTHEND
|
|
||||||
ts+=sendData(file_des,myMod->dacs,sizeof(myMod->ndac),OTHER);
|
|
||||||
ts+=sendData(file_des,myMod->adcs,sizeof(myMod->nadc),OTHER);
|
|
||||||
ts+=sendData(file_des,myMod->chipregs,sizeof(myMod->nchip),OTHER);
|
|
||||||
ts+=sendData(file_des,myMod->chanregs,sizeof(myMod->nchan),OTHER);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ts+=sendData(file_des,&(myMod->gain), sizeof(myMod->gain),OTHER);
|
ts+=sendData(file_des,&(myMod->gain), sizeof(myMod->gain),OTHER);
|
||||||
ts+=sendData(file_des,&(myMod->offset), sizeof(myMod->offset),OTHER);
|
ts+=sendData(file_des,&(myMod->offset), sizeof(myMod->offset),OTHER);
|
||||||
|
|
||||||
@ -441,22 +433,12 @@ int receiveModuleGeneral(int file_des, sls_detector_module* myMod, int receiveA
|
|||||||
int nChans, nchanold=myMod->nchan, nchandiff;
|
int nChans, nchanold=myMod->nchan, nchandiff;
|
||||||
int nDacs, ndold=myMod->ndac, ndacdiff;
|
int nDacs, ndold=myMod->ndac, ndacdiff;
|
||||||
int nAdcs, naold=myMod->nadc, nadcdiff;
|
int nAdcs, naold=myMod->nadc, nadcdiff;
|
||||||
#ifdef VERBOSE
|
|
||||||
int id=0;
|
|
||||||
#endif
|
|
||||||
// ts+= receiveDataOnly(file_des,myMod,sizeof(sls_detector_module));
|
|
||||||
ts+=receiveData(file_des,&(myMod->serialnumber),sizeof(myMod->serialnumber),INT32);
|
ts+=receiveData(file_des,&(myMod->serialnumber),sizeof(myMod->serialnumber),INT32);
|
||||||
ts+=receiveData(file_des,&(myMod->nchan),sizeof(myMod->nchan),INT32);
|
ts+=receiveData(file_des,&(myMod->nchan),sizeof(myMod->nchan),INT32);
|
||||||
ts+=receiveData(file_des,&(myMod->nchip),sizeof(myMod->nchip),INT32);
|
ts+=receiveData(file_des,&(myMod->nchip),sizeof(myMod->nchip),INT32);
|
||||||
ts+=receiveData(file_des,&(myMod->ndac),sizeof(myMod->ndac),INT32);
|
ts+=receiveData(file_des,&(myMod->ndac),sizeof(myMod->ndac),INT32);
|
||||||
ts+=receiveData(file_des,&(myMod->nadc),sizeof(myMod->nadc),INT32);
|
ts+=receiveData(file_des,&(myMod->nadc),sizeof(myMod->nadc),INT32);
|
||||||
ts+=receiveData(file_des,&(myMod->reg),sizeof(myMod->reg),INT32);
|
ts+=receiveData(file_des,&(myMod->reg),sizeof(myMod->reg),INT32);
|
||||||
#ifdef MYTHEND
|
|
||||||
ts+=receiveData(file_des,myMod->dacs,sizeof(myMod->ndac),INT32);
|
|
||||||
ts+=receiveData(file_des,myMod->adcs,sizeof(myMod->nadc),INT32);
|
|
||||||
ts+=receiveData(file_des,myMod->chipregs,sizeof(myMod->nchip),INT32);
|
|
||||||
ts+=receiveData(file_des,myMod->chanregs,sizeof(myMod->nchan),INT32);
|
|
||||||
#endif
|
|
||||||
ts+=receiveData(file_des,&(myMod->gain), sizeof(myMod->gain),OTHER);
|
ts+=receiveData(file_des,&(myMod->gain), sizeof(myMod->gain),OTHER);
|
||||||
ts+=receiveData(file_des,&(myMod->offset), sizeof(myMod->offset),OTHER);
|
ts+=receiveData(file_des,&(myMod->offset), sizeof(myMod->offset),OTHER);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user