mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
connected command to execute command in receiver pc
This commit is contained in:
@ -5990,6 +5990,30 @@ int slsDetector::exitReceiver() {
|
||||
|
||||
}
|
||||
|
||||
int slsDetector::execReceiverCommand(std::string cmd) {
|
||||
|
||||
int fnum=F_EXEC_RECEIVER_COMMAND;
|
||||
int ret=FAIL;
|
||||
char arg[MAX_STR_LENGTH];
|
||||
memset(arg,0,sizeof(arg));
|
||||
char retval[MAX_STR_LENGTH];
|
||||
memset(retval,0, sizeof(retval));
|
||||
|
||||
strcpy(arg,cmd.c_str());
|
||||
|
||||
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending to receiver the command: " << arg << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->SendString(fnum,retval,arg);
|
||||
disconnectData();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int slsDetector::updateReceiverNoWait() {
|
||||
|
||||
@ -7506,3 +7530,5 @@ int slsDetector::writeSettingsFile(std::string fname, sls_detector_module mod,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1377,6 +1377,14 @@ public:
|
||||
*/
|
||||
int exitReceiver();
|
||||
|
||||
/**
|
||||
* Executes a system command on the receiver server
|
||||
* e.g. mount an nfs disk, reboot and returns answer etc.
|
||||
* @param cmd command to be executed
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int execReceiverCommand(std::string cmd);
|
||||
|
||||
/**
|
||||
updates the shared memory receiving the data from the detector (without asking and closing the connection
|
||||
/returns OK
|
||||
|
@ -112,6 +112,13 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdExitServer;
|
||||
++i;
|
||||
|
||||
/*! \page test
|
||||
- <b>rx_execcommand</b> Executes a command on the receiver server. Don't use it!!!!
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="rx_execcommand";//OK
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdExitServer;
|
||||
++i;
|
||||
|
||||
/*! \page test
|
||||
- <b>flippeddatay [i]</b> enables/disables data being flipped across y axis. 1 enables, 0 disables. Not implemented.
|
||||
*/
|
||||
@ -2437,7 +2444,13 @@ string slsDetectorCommand::cmdExitServer(int narg, char *args[], int action, int
|
||||
if(myDet->execCommand(std::string(args[1]), detPos)==OK)
|
||||
return string("Command executed successfully\n");
|
||||
else
|
||||
|
||||
return string("Command failed\n");
|
||||
}
|
||||
else if (cmd=="rx_execcommand"){
|
||||
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
||||
if(myDet->execReceiverCommand(std::string(args[1]), detPos)==OK)
|
||||
return string("Command executed successfully\n");
|
||||
else
|
||||
return string("Command failed\n");
|
||||
}
|
||||
else return("cannot decode command\n");
|
||||
@ -2451,6 +2464,7 @@ string slsDetectorCommand::helpExitServer(int action){
|
||||
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("execcommand \t executes command in detector server. Don't use it if you do not know what you are doing.\n");
|
||||
os << string("rx_execcommand \t executes command in receiver server. Don't use it if you do not know what you are doing.\n");
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user