diff --git a/slsDetectorSoftware/include/multiSlsDetector.h b/slsDetectorSoftware/include/multiSlsDetector.h index 40673b069..c493f933b 100755 --- a/slsDetectorSoftware/include/multiSlsDetector.h +++ b/slsDetectorSoftware/include/multiSlsDetector.h @@ -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 diff --git a/slsDetectorSoftware/include/slsDetector.h b/slsDetectorSoftware/include/slsDetector.h index edf05b44d..5faf2806b 100755 --- a/slsDetectorSoftware/include/slsDetector.h +++ b/slsDetectorSoftware/include/slsDetector.h @@ -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 diff --git a/slsDetectorSoftware/include/slsDetectorCommand.h b/slsDetectorSoftware/include/slsDetectorCommand.h index 47795b6c3..396ed1666 100755 --- a/slsDetectorSoftware/include/slsDetectorCommand.h +++ b/slsDetectorSoftware/include/slsDetectorCommand.h @@ -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; diff --git a/slsDetectorSoftware/src/multiSlsDetector.cpp b/slsDetectorSoftware/src/multiSlsDetector.cpp index 4dfd84ba9..2385f042b 100755 --- a/slsDetectorSoftware/src/multiSlsDetector.cpp +++ b/slsDetectorSoftware/src/multiSlsDetector.cpp @@ -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, {}); diff --git a/slsDetectorSoftware/src/slsDetector.cpp b/slsDetectorSoftware/src/slsDetector.cpp index fd642a6a4..b9973cb8e 100755 --- a/slsDetectorSoftware/src/slsDetector.cpp +++ b/slsDetectorSoftware/src/slsDetector.cpp @@ -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(value); int retval = -1; diff --git a/slsDetectorSoftware/src/slsDetectorCommand.cpp b/slsDetectorSoftware/src/slsDetectorCommand.cpp index 8c4865e72..1f35a1110 100755 --- a/slsDetectorSoftware/src/slsDetectorCommand.cpp +++ b/slsDetectorSoftware/src/slsDetectorCommand.cpp @@ -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 - help Returns a list of possible commands. @@ -94,28 +87,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) { descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdHelp; ++i; - /*! \page test - - exitserver Shuts down all the detector servers. Don't use it!!!! - */ - descrToFuncMap[i].m_pFuncName = "exitserver"; - descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdExitServer; - ++i; - - /*! \page test - - rx_exit Shuts down all the receivers. Don't use it!!!! - */ - descrToFuncMap[i].m_pFuncName = "rx_exit"; - descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdExitServer; - ++i; - - /*! \page test - - rx_execcommand 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 - - resetframescaught [i] 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 slsDetectorCommand::getAllCommands(){ std::vector 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(); -} - - diff --git a/slsReceiverSoftware/include/slsReceiverTCPIPInterface.h b/slsReceiverSoftware/include/slsReceiverTCPIPInterface.h index 1a0f72411..dd7c9d79d 100755 --- a/slsReceiverSoftware/include/slsReceiverTCPIPInterface.h +++ b/slsReceiverSoftware/include/slsReceiverTCPIPInterface.h @@ -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); diff --git a/slsReceiverSoftware/src/slsReceiverImplementation.cpp b/slsReceiverSoftware/src/slsReceiverImplementation.cpp index c667b1118..a990533b7 100755 --- a/slsReceiverSoftware/src/slsReceiverImplementation.cpp +++ b/slsReceiverSoftware/src/slsReceiverImplementation.cpp @@ -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 diff --git a/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp b/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp index 5c49e90c0..0479e8b8b 100755 --- a/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp +++ b/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp @@ -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(); if (enable >= 0) { diff --git a/slsSupportLib/include/sls_detector_funcs.h b/slsSupportLib/include/sls_detector_funcs.h index 49decc2a2..cb68fbc23 100755 --- a/slsSupportLib/include/sls_detector_funcs.h +++ b/slsSupportLib/include/sls_detector_funcs.h @@ -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";