New command line app and removing slsDetectorCommand (#69)

* WIP

* WIP

* WIP

* WIP

* config2 working

* removed slsDetectorCommand

* WIP

* added test file

* more tests
This commit is contained in:
Erik Fröjdh
2019-11-18 09:29:17 +01:00
committed by Dhanya Thattil
parent 6a27207875
commit fa2c842745
23 changed files with 5964 additions and 1451 deletions

View File

@@ -417,12 +417,11 @@ class CmdProxy {
explicit CmdProxy(Detector *ptr) : det(ptr) {}
std::string Call(const std::string &command,
const std::vector<std::string> &arguments, int detector_id,
const std::vector<std::string> &arguments, int detector_id = -1,
int action = -1, std::ostream &os = std::cout);
bool ReplaceIfDepreciated(std::string &command);
size_t GetFunctionMapSize() const noexcept { return functions.size(); };
std::vector<std::string> GetAllCommands();
std::vector<std::string> GetProxyCommands();
private:
@@ -549,7 +548,8 @@ class CmdProxy {
FunctionMap functions{{"list", &CmdProxy::ListCommands},
/* configuration */
//{"config", &CmdProxy::config},
{"config", &CmdProxy::config},
{"free2", &CmdProxy::free},
{"parameters", &CmdProxy::parameters},
{"hostname", &CmdProxy::Hostname},
{"virtual", &CmdProxy::VirtualServer},
@@ -565,6 +565,7 @@ class CmdProxy {
{"settings", &CmdProxy::settings},
/* acquisition parameters */
{"acquire", &CmdProxy::acquire},
{"frames", &CmdProxy::frames},
{"triggers", &CmdProxy::triggers},
{"exptime", &CmdProxy::exptime},
@@ -885,6 +886,8 @@ class CmdProxy {
/* Commands */
std::string ListCommands(int action);
/* configuration */
std::string free(int action);
// std::string config2(int action);
std::string Hostname(int action);
std::string VirtualServer(int action);
std::string FirmwareVersion(int action);
@@ -893,6 +896,7 @@ class CmdProxy {
std::string ClientVersion(int action);
std::string DetectorSize(int action);
/* acquisition parameters */
std::string acquire(int action);
std::string Speed(int action);
std::string Adcphase(int action);
std::string ClockFrequency(int action);

View File

@@ -13,6 +13,12 @@ using ns = std::chrono::nanoseconds;
class MacAddr;
class IpAddr;
//Free function to avoid dependence on class
//and avoid the option to free another objects
//shm by mistake
void freeSharedMemory(int multiId, int detPos = -1);
/**
* \class Detector
*/
@@ -73,6 +79,8 @@ class Detector {
/** Gets the total number of detectors */
int size() const;
bool empty() const;
defs::xy getModuleGeometry() const;
Result<defs::xy> getModuleSize(Positions pos = {}) const;

View File

@@ -261,8 +261,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* Sets maximum number of channels of all sls detectors */
void setNumberOfChannels(const slsDetectorDefs::xy c);
void readConfigurationFile(const std::string &fname);
/**
* Enable gap pixels, only for Eiger and for 8,16 and 32 bit mode. (Eiger)
* 4 bit mode gap pixels only in gui call back
@@ -278,8 +276,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
void savePattern(const std::string &fname);
void loadParameters(const std::string &fname);
/**
* register callback for accessing acquisition final data
* @param func function to be called at the end of the acquisition.

View File

@@ -1,72 +0,0 @@
#ifndef SLS_DETECTOR_COMMAND_H
#define SLS_DETECTOR_COMMAND_H
#include "sls_detector_defs.h"
#include <vector>
class multiSlsDetector;
/** @short This class handles the command line I/Os, help etc. of the text clients */
class slsDetectorCommand : public virtual slsDetectorDefs {
public:
slsDetectorCommand(multiSlsDetector *det);
/*
* Executes a set of string arguments according to a given format.
* It is used to read/write configuration file, dump and retrieve detector
* settings and for the command line interface command parsing
* @param narg number of arguments
* @param args array of string arguments
* @param action can be PUT_ACTION or GET_ACTION(from text client even READOUT_ACTION for acquisition)
* @param detPos -1 for all detectors in multi detector list or position of a specific detector in list
*/
std::string executeLine(int narg, const char * const args[], int action, int detPos = -1);
std::vector<std::string> getAllCommands();
static std::string helpAcquire(int action);
static std::string helpConfiguration(int action);
private:
multiSlsDetector *myDet;
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 cmdConfiguration(int narg, const char * const args[], int action, int detPos = -1);
int numberOfCommands;
std::string cmd;
typedef std::string (slsDetectorCommand::*MemFuncGetter)(int narg, const char * const args[], int action, int detPos);
struct FuncTable
{
std::string m_pFuncName;
MemFuncGetter m_pFuncPtr;
};
FuncTable descrToFuncMap[1000];
};
#endif