mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 08:10:02 +02:00
WIP
This commit is contained in:
parent
badff47663
commit
4b2cb7ecc1
@ -1494,13 +1494,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
*/
|
||||
uint64_t getReceiverCurrentFrameIndex(int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Resets framescaught in receiver
|
||||
* Use this when using startAcquisition instead of acquire
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
*/
|
||||
void resetFramesCaught(int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Sets/Gets receiver file write enable
|
||||
* @param value 1 or 0 to set/reset file write enable
|
||||
|
@ -1485,12 +1485,6 @@ class slsDetector : public virtual slsDetectorDefs {
|
||||
*/
|
||||
uint64_t getReceiverCurrentFrameIndex() const;
|
||||
|
||||
/**
|
||||
* Resets framescaught in receiver
|
||||
* Use this when using startAcquisition instead of acquire
|
||||
*/
|
||||
void resetFramesCaught();
|
||||
|
||||
/**
|
||||
* Sets/Gets receiver file write enable
|
||||
* @param enable 1 or 0 to set/reset file write enable
|
||||
|
@ -41,27 +41,21 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
||||
/* *\/ */
|
||||
std::string helpLine(int narg, const char * const args[], int action=HELP_ACTION, int detPos = -1);
|
||||
static std::string helpAcquire(int action);
|
||||
static std::string helpData(int action);
|
||||
static std::string helpFree(int action);
|
||||
static std::string helpExitServer(int action);
|
||||
static std::string helpThreaded(int action);
|
||||
static std::string helpSN(int action);
|
||||
static std::string helpConfiguration(int action);
|
||||
static std::string helpReceiver(int action);
|
||||
|
||||
|
||||
private:
|
||||
multiSlsDetector *myDet;
|
||||
|
||||
std::string cmdUnderDevelopment(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdUnknown(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdAcquire(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdData(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdFree(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdHelp(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdExitServer(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdSN(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdConfiguration(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdReceiver(int narg, const char * const args[], int action, int detPos = -1);
|
||||
|
||||
|
||||
int numberOfCommands;
|
||||
std::string cmd;
|
||||
|
@ -2230,16 +2230,6 @@ uint64_t multiSlsDetector::getReceiverCurrentFrameIndex(int detPos) {
|
||||
return ((sls::sum(r)) / (int)detectors.size());
|
||||
}
|
||||
|
||||
void multiSlsDetector::resetFramesCaught(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
detectors[detPos]->resetFramesCaught();
|
||||
}
|
||||
|
||||
// multi
|
||||
parallelCall(&slsDetector::resetFramesCaught);
|
||||
}
|
||||
|
||||
int multiSlsDetector::createReceivingDataSockets(const bool destroy) {
|
||||
if (destroy) {
|
||||
FILE_LOG(logINFO) << "Going to destroy data sockets";
|
||||
@ -3107,11 +3097,6 @@ int multiSlsDetector::acquire() {
|
||||
|
||||
startProcessingThread();
|
||||
|
||||
// resets frames caught in receiver
|
||||
if (receiver) {
|
||||
resetFramesCaught();
|
||||
}
|
||||
|
||||
// start receiver
|
||||
if (receiver) {
|
||||
Parallel(&slsDetector::startReceiver, {});
|
||||
|
@ -3067,13 +3067,6 @@ uint64_t slsDetector::getReceiverCurrentFrameIndex() const {
|
||||
return retval;
|
||||
}
|
||||
|
||||
void slsDetector::resetFramesCaught() {
|
||||
FILE_LOG(logDEBUG1) << "Reset Frames Caught by Receiver";
|
||||
if (shm()->useReceiverFlag) {
|
||||
sendToReceiver(F_RESET_RECEIVER_FRAMES_CAUGHT);
|
||||
}
|
||||
}
|
||||
|
||||
bool slsDetector::setFileWrite(bool value) {
|
||||
int arg = static_cast<int>(value);
|
||||
int retval = -1;
|
||||
|
@ -78,14 +78,7 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
||||
|
||||
cmd = std::string("none");
|
||||
|
||||
/*! \page test Developer
|
||||
Commands to be used only for software debugging. Avoid using them!
|
||||
- \b test returns an error
|
||||
*/
|
||||
|
||||
descrToFuncMap[i].m_pFuncName = "test";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdUnderDevelopment;
|
||||
++i;
|
||||
|
||||
/*! \page test
|
||||
- <b>help</b> Returns a list of possible commands.
|
||||
@ -94,28 +87,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdHelp;
|
||||
++i;
|
||||
|
||||
/*! \page test
|
||||
- <b>exitserver</b> Shuts down all the detector servers. Don't use it!!!!
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "exitserver";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdExitServer;
|
||||
++i;
|
||||
|
||||
/*! \page test
|
||||
- <b>rx_exit</b> Shuts down all the receivers. Don't use it!!!!
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "rx_exit";
|
||||
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";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdExitServer;
|
||||
++i;
|
||||
|
||||
/* digital test and debugging */
|
||||
|
||||
|
||||
|
||||
@ -131,13 +102,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdAcquire;
|
||||
++i;
|
||||
|
||||
/*! \page acquisition
|
||||
- \b data gets all data from the detector (if any) processes them and writes them to file according to the preferences already setup (Eigerr store in ram only). Only get!
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "data";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdData;
|
||||
++i;
|
||||
|
||||
|
||||
/*! \page config
|
||||
- \b free Free shared memory on the control PC
|
||||
@ -169,30 +133,12 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
||||
++i;
|
||||
|
||||
|
||||
/*! \page receiver
|
||||
- <b>resetframescaught [i]</b> resets the number of frames caught to 0. i can be any number. Use this if using status start, instead of acquire (this command is included). Only put! \c Returns \c (int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "resetframescaught";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdReceiver;
|
||||
++i;
|
||||
|
||||
|
||||
/* pattern generator */
|
||||
|
||||
|
||||
numberOfCommands = i;
|
||||
|
||||
// #ifdef VERBOSE
|
||||
// std::cout << "Number of commands is " << numberOfCommands << std::endl;
|
||||
// #endif
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
/*!
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
std::string slsDetectorCommand::executeLine(int narg, const char * const args[], int action, int detPos) {
|
||||
if (action == READOUT_ACTION)
|
||||
@ -227,9 +173,7 @@ std::string slsDetectorCommand::executeLine(int narg, const char * const args[],
|
||||
std::string slsDetectorCommand::cmdUnknown(int narg, const char * const args[], int action, int detPos) {
|
||||
return std::string("Unknown command, use list to list all commands ");
|
||||
}
|
||||
std::string slsDetectorCommand::cmdUnderDevelopment(int narg, const char * const args[], int action, int detPos) {
|
||||
return std::string("Must still develop ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> slsDetectorCommand::getAllCommands(){
|
||||
std::vector<std::string> commands;
|
||||
@ -257,6 +201,23 @@ std::string slsDetectorCommand::helpLine(int narg, const char * const args[], in
|
||||
return executeLine(narg, args, HELP_ACTION, detPos);
|
||||
}
|
||||
|
||||
|
||||
std::string slsDetectorCommand::cmdHelp(int narg, const char * const args[], int action, int detPos) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
||||
#endif
|
||||
|
||||
std::cout << narg << std::endl;
|
||||
|
||||
if (narg >= 1)
|
||||
return helpLine(narg - 1, args, action, detPos);
|
||||
else
|
||||
return helpLine(0, args, action, detPos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
std::string slsDetectorCommand::cmdAcquire(int narg, const char * const args[], int action, int detPos) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
||||
@ -297,35 +258,6 @@ std::string slsDetectorCommand::helpAcquire(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string slsDetectorCommand::cmdData(int narg, const char * const args[], int action, int detPos) {
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
||||
#endif
|
||||
//int b;
|
||||
if (action == PUT_ACTION) {
|
||||
return std::string("cannot set");
|
||||
} else if (action == HELP_ACTION) {
|
||||
return helpData(HELP_ACTION);
|
||||
} else {
|
||||
// b=myDet->setThreadedProcessing(-1);
|
||||
// myDet->setThreadedProcessing(0);
|
||||
// myDet->readAll(detPos);
|
||||
// //processdata in receiver is useful only for gui purposes
|
||||
// if(myDet->getUseReceiverFlag(detPos)==OFFLINE_FLAG)
|
||||
// myDet->processData();
|
||||
// myDet->setThreadedProcessing(b);
|
||||
return std::string("");
|
||||
}
|
||||
}
|
||||
|
||||
std::string slsDetectorCommand::helpData(int action) {
|
||||
|
||||
if (action == PUT_ACTION)
|
||||
return std::string("");
|
||||
else
|
||||
return std::string("data \t gets all data from the detector (if any) processes them and writes them to file according to the preferences already setup\n");
|
||||
}
|
||||
|
||||
|
||||
std::string slsDetectorCommand::cmdFree(int narg, const char * const args[], int action, int detPos) {
|
||||
@ -345,84 +277,6 @@ std::string slsDetectorCommand::helpFree(int action) {
|
||||
}
|
||||
|
||||
|
||||
std::string slsDetectorCommand::cmdHelp(int narg, const char * const args[], int action, int detPos) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
||||
#endif
|
||||
|
||||
std::cout << narg << std::endl;
|
||||
|
||||
if (narg >= 1)
|
||||
return helpLine(narg - 1, args, action, detPos);
|
||||
else
|
||||
return helpLine(0, args, action, detPos);
|
||||
}
|
||||
|
||||
std::string slsDetectorCommand::cmdExitServer(int narg, const char * const args[], int action, int detPos) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
||||
#endif
|
||||
if (action == HELP_ACTION) {
|
||||
return helpExitServer(action);
|
||||
}
|
||||
|
||||
if (action == PUT_ACTION) {
|
||||
if (cmd == "exitserver") {
|
||||
myDet->exitServer(detPos);
|
||||
return std::string("Server shut down.");
|
||||
} else if (cmd == "rx_exit") {
|
||||
|
||||
myDet->exitReceiver(detPos);
|
||||
return std::string("Receiver shut down\n");
|
||||
} else if (cmd == "rx_execcommand") {
|
||||
|
||||
myDet->execReceiverCommand(std::string(args[1]), detPos);
|
||||
return std::string("Command executed successfully\n");
|
||||
} else
|
||||
return ("cannot decode command\n");
|
||||
} else
|
||||
return ("cannot get");
|
||||
}
|
||||
|
||||
std::string slsDetectorCommand::helpExitServer(int action) {
|
||||
std::ostringstream os;
|
||||
os << std::string("exitserver \t shuts down all the detector servers. Don't use it!!!!\n");
|
||||
os << std::string("rx_exit \t shuts down all the receiver servers.\n");
|
||||
os << std::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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// std::string slsDetectorCommand::cmdThreaded(int narg, const char * const args[], int action, int detPos){
|
||||
// int ival;
|
||||
// char answer[1000];
|
||||
|
||||
// if (action==HELP_ACTION)
|
||||
// return helpThreaded(action);
|
||||
|
||||
// if (action==PUT_ACTION) {
|
||||
// if (sscanf(args[1],"%d",&ival))
|
||||
// myDet->setThreadedProcessing(ival);
|
||||
// }
|
||||
// sprintf(answer,"%d",myDet->setThreadedProcessing());
|
||||
// return std::string(answer);
|
||||
|
||||
// }
|
||||
|
||||
std::string slsDetectorCommand::helpThreaded(int action) {
|
||||
std::ostringstream os;
|
||||
if (action == GET_ACTION || action == HELP_ACTION)
|
||||
os << std::string("threaded \t returns wether the data processing is threaded. \n");
|
||||
if (action == PUT_ACTION || action == HELP_ACTION)
|
||||
os << std::string("threaded t \t sets the threading flag ( 1sets, 0 unsets).\n");
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
std::string slsDetectorCommand::cmdSN(int narg, const char * const args[], int action, int detPos) {
|
||||
@ -482,35 +336,5 @@ std::string slsDetectorCommand::helpConfiguration(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string slsDetectorCommand::cmdReceiver(int narg, const char * const args[], int action, int detPos) {
|
||||
|
||||
if (action == HELP_ACTION)
|
||||
return helpReceiver(action);
|
||||
|
||||
if (cmd == "resetframescaught") {
|
||||
if (action == GET_ACTION)
|
||||
return std::string("cannot get");
|
||||
else {
|
||||
myDet->resetFramesCaught(detPos);
|
||||
return std::string("successful");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return std::string("could not decode command");
|
||||
}
|
||||
|
||||
std::string slsDetectorCommand::helpReceiver(int action) {
|
||||
|
||||
std::ostringstream os;
|
||||
if (action == PUT_ACTION || action == HELP_ACTION) {
|
||||
os << "resetframescaught [any value] \t resets frames caught by receiver" << std::endl;
|
||||
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -192,9 +192,6 @@ class slsReceiverTCPIPInterface : private virtual slsDetectorDefs {
|
||||
/** Gets Total Frames Caught */
|
||||
int get_frames_caught(sls::ServerInterface2 &socket);
|
||||
|
||||
/** Resets Total Frames Caught */
|
||||
int reset_frames_caught(sls::ServerInterface2 &socket);
|
||||
|
||||
/** Enable File Write*/
|
||||
int enable_file_write(sls::ServerInterface2 &socket);
|
||||
|
||||
|
@ -1237,6 +1237,7 @@ void slsReceiverImplementation::resetAcquisitionCount() {
|
||||
int slsReceiverImplementation::startReceiver(char *c) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
FILE_LOG(logINFO) << "Starting Receiver";
|
||||
resetAcquisitionCount();
|
||||
ResetParametersforNewMeasurement();
|
||||
|
||||
// listener
|
||||
|
@ -168,7 +168,6 @@ int slsReceiverTCPIPInterface::function_table(){
|
||||
flist[F_SET_RECEIVER_FILE_INDEX] = &slsReceiverTCPIPInterface::set_file_index;
|
||||
flist[F_GET_RECEIVER_FRAME_INDEX] = &slsReceiverTCPIPInterface::get_frame_index;
|
||||
flist[F_GET_RECEIVER_FRAMES_CAUGHT] = &slsReceiverTCPIPInterface::get_frames_caught;
|
||||
flist[F_RESET_RECEIVER_FRAMES_CAUGHT] = &slsReceiverTCPIPInterface::reset_frames_caught;
|
||||
flist[F_ENABLE_RECEIVER_FILE_WRITE] = &slsReceiverTCPIPInterface::enable_file_write;
|
||||
flist[F_ENABLE_RECEIVER_MASTER_FILE_WRITE] = &slsReceiverTCPIPInterface::enable_master_file_write;
|
||||
flist[F_ENABLE_RECEIVER_OVERWRITE] = &slsReceiverTCPIPInterface::enable_overwrite;
|
||||
@ -763,12 +762,6 @@ int slsReceiverTCPIPInterface::get_frames_caught(Interface &socket) {
|
||||
return socket.sendResult(retval);
|
||||
}
|
||||
|
||||
int slsReceiverTCPIPInterface::reset_frames_caught(Interface &socket) {
|
||||
FILE_LOG(logDEBUG1) << "Reset frames caught";
|
||||
impl()->resetAcquisitionCount();
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int slsReceiverTCPIPInterface::enable_file_write(Interface &socket) {
|
||||
auto enable = socket.Receive<int>();
|
||||
if (enable >= 0) {
|
||||
|
@ -156,7 +156,6 @@ enum detFuncs{
|
||||
F_SET_RECEIVER_FILE_INDEX, /**< sets receiver file index */
|
||||
F_GET_RECEIVER_FRAME_INDEX, /**< gets the receiver frame index */
|
||||
F_GET_RECEIVER_FRAMES_CAUGHT, /**< gets the number of frames caught by receiver */
|
||||
F_RESET_RECEIVER_FRAMES_CAUGHT, /**< resets the frames caught by receiver */
|
||||
F_ENABLE_RECEIVER_FILE_WRITE, /**< sets the receiver file write */
|
||||
F_ENABLE_RECEIVER_MASTER_FILE_WRITE, /**< sets the receiver master file write */
|
||||
F_ENABLE_RECEIVER_OVERWRITE, /**< set overwrite flag in receiver */
|
||||
@ -348,7 +347,6 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_SET_RECEIVER_FILE_INDEX: return "F_SET_RECEIVER_FILE_INDEX";
|
||||
case F_GET_RECEIVER_FRAME_INDEX: return "F_GET_RECEIVER_FRAME_INDEX";
|
||||
case F_GET_RECEIVER_FRAMES_CAUGHT: return "F_GET_RECEIVER_FRAMES_CAUGHT";
|
||||
case F_RESET_RECEIVER_FRAMES_CAUGHT: return "F_RESET_RECEIVER_FRAMES_CAUGHT";
|
||||
case F_ENABLE_RECEIVER_FILE_WRITE: return "F_ENABLE_RECEIVER_FILE_WRITE";
|
||||
case F_ENABLE_RECEIVER_MASTER_FILE_WRITE: return "F_ENABLE_RECEIVER_MASTER_FILE_WRITE";
|
||||
case F_ENABLE_RECEIVER_OVERWRITE: return "F_ENABLE_RECEIVER_OVERWRITE";
|
||||
|
Loading…
x
Reference in New Issue
Block a user