#ifndef SLS_DETECTOR_COMMAND_H #define SLS_DETECTOR_COMMAND_H #include "sls_detector_defs.h" #include "slsDetectorBase.h" using namespace std; /* /\** This class handles the command line I/Os, help etc. */ /* It is inherited by both slsDetector and multiSlsDetector */ /* *\/ */ class slsDetectorCommand : public slsDetectorBase{ public: slsDetectorCommand(); /* /\** */ /* 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) */ /* \returns answer string */ /* *\/ */ string executeLine(int narg, char *args[], int action=HELP_ACTION); /* /\** */ /* returns the help for the executeLine command */ /* \param os output stream to return the help to */ /* \param action can be PUT_ACTION or GET_ACTION (from text client even READOUT_ACTION for acquisition) */ /* *\/ */ static string helpLine(int narg, char *args[], int action=HELP_ACTION); static string helpAcquire(int narg, char *args[], int action); static string helpData(int narg, char *args[], int action); static string helpFrame(int narg, char *args[], int action); static string helpStatus(int narg, char *args[], int action); static string helpFree(int narg, char *args[], int action); static string helpAdd(int narg, char *args[], int action); static string helpRemove(int narg, char *args[], int action); static string helpHostname(int narg, char *args[], int action); static string helpId(int narg, char *args[], int action); static string helpMaster(int narg, char *args[], int action); static string helpSync(int narg, char *args[], int action); static string helpExitServer(int narg, char *args[], int action); static string helpSettingsDir(int narg, char *args[], int action); static string helpCalDir(int narg, char *args[], int action); static string helpTrimEn(int narg, char *args[], int action); static string helpOutDir(int narg, char *args[], int action); static string helpFileName(int narg, char *args[], int action); static string helpFileIndex(int narg, char *args[], int action); static string helpFlatField(int narg, char *args[], int action); static string helpRateCorr(int narg, char *args[], int action); static string helpBadChannels(int narg, char *args[], int action); static string helpAngConv(int narg, char *args[], int action); static string helpThreaded(int narg, char *args[], int action); static string helpPositions(int narg, char *args[], int action); static string helpScripts(int narg, char *args[], int action); static string helpScans(int narg, char *args[], int action); static string helpNetworkParameter(int narg, char *args[], int action); static string helpPort(int narg, char *args[], int action); static string helpLock(int narg, char *args[], int action); static string helpLastClient(int narg, char *args[], int action); static string helpOnline(int narg, char *args[], int action); static string helpConfigureMac(int narg, char *args[], int action); static string helpDetectorSize(int narg, char *args[], int action); static string helpSettings(int narg, char *args[], int action); static string helpSN(int narg, char *args[], int action); static string helpDigiTest(int narg, char *args[], int action); static string helpRegister(int narg, char *args[], int action); static string helpDAC(int narg, char *args[], int action); static string helpTimer(int narg, char *args[], int action); static string helpTimeLeft(int narg, char *args[], int action); static string helpSpeed(int narg, char *args[], int action); static string helpAdvanced(int narg, char *args[], int action); static string helpConfiguration(int narg, char *args[], int action); static string helpImage(int narg, char *args[], int action); static string helpADC(int narg, char *args[], int action); /** returns string from run status index \param s can be ERROR, WAITING, RUNNING, TRANSMITTING, RUN_FINISHED \returns string error, waiting, running, data, finished */ static string runStatusType(runStatus); /** returns detector type string from detector type index \param type string can be Mythen, Pilatus, Eiger, Gotthard, Agipd, Unknown \returns MYTHEN, PILATUS, EIGER, GOTTHARD, AGIPD, GENERIC */ static string getDetectorType(detectorType t); /** returns detector type index from detector type string \param t can be MYTHEN, PILATUS, EIGER, GOTTHARD, AGIPD, GENERIC \returns Mythen, Pilatus, Eiger, Gotthard, Agipd, Unknown */ static detectorType getDetectorType(string const type); /** returns synchronization type index from string \param t can be none, gating, trigger, complementary \returns ONE, MASTER_GATES, MASTER_TRIGGERS, SLAVE_STARTS_WHEN_MASTER_STOPS */ static synchronizationMode getSyncType(string const type); /** returns synchronization type string from index \param t can be NONE, MASTER_GATES, MASTER_TRIGGERS, SLAVE_STARTS_WHEN_MASTER_STOPS \returns none, gating, trigger, complementary */ static string getSyncType(synchronizationMode s ); /** returns string from external signal type index \param f can be SIGNAL_OFF, GATE_IN_ACTIVE_HIGH, GATE_IN_ACTIVE_LOW, TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE, RO_TRIGGER_IN_RISING_EDGE, RO_TRIGGER_IN_FALLING_EDGE, GATE_OUT_ACTIVE_HIGH, GATE_OUT_ACTIVE_LOW, =TRIGGER_OUT_RISING_EDGE, TRIGGER_OUT_FALLING_EDGE, RO_TRIGGER_OUT_RISING_EDGE, RO_TRIGGER_OUT_FALLING_EDGE \returns string off, gate_in_active_high, gate_in_active_low, trigger_in_rising_edge, trigger_in_falling_edge, ro_trigger_in_rising_edge, ro_trigger_in_falling_edge, gate_out_active_high, gate_out_active_low, trigger_out_rising_edge, trigger_out_falling_edge, ro_trigger_out_rising_edge, ro_trigger_out_falling_edge, unknown */ static string externalSignalType(externalSignalFlag f); /** returns external signal type index from string \param string off, gate_in_active_high, gate_in_active_low, trigger_in_rising_edge, trigger_in_falling_edge, ro_trigger_in_rising_edge, ro_trigger_in_falling_edge, gate_out_active_high, gate_out_active_low, trigger_out_rising_edge, trigger_out_falling_edge, ro_trigger_out_rising_edge, ro_trigger_out_falling_edge, unknown \returns f can be SIGNAL_OFF, GATE_IN_ACTIVE_HIGH, GATE_IN_ACTIVE_LOW, TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE, RO_TRIGGER_IN_RISING_EDGE, RO_TRIGGER_IN_FALLING_EDGE, GATE_OUT_ACTIVE_HIGH, GATE_OUT_ACTIVE_LOW, =TRIGGER_OUT_RISING_EDGE, TRIGGER_OUT_FALLING_EDGE, RO_TRIGGER_OUT_RISING_EDGE, RO_TRIGGER_OUT_FALLING_EDGE,GET_EXTERNAL_SIGNAL_FLAG (if unknown) */ static externalSignalFlag externalSignalType(string sval); /** returns synchronization type string from index \param t can be NONE, MASTER_GATES, MASTER_TRIGGERS, SLAVE_STARTS_WHEN_MASTER_STOPS \returns none, gating, trigger, complementary */ static detectorSettings getDetectorSettings(string s); /** returns detector settings string from index \param t can be STANDARD, FAST, HIGHGAIN, DYNAMICGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN, GET_SETTINGS \returns standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain, undefined */ static string getDetectorSettings(detectorSettings s); private: string cmdUnderDevelopment(int narg, char *args[], int action); string cmdUnknown(int narg, char *args[], int action); string cmdAcquire(int narg, char *args[], int action); string cmdData(int narg, char *args[], int action); string cmdFrame(int narg, char *args[], int action); string cmdStatus(int narg, char *args[], int action); string cmdFree(int narg, char *args[], int action); string cmdAdd(int narg, char *args[], int action); string cmdRemove(int narg, char *args[], int action); string cmdHostname(int narg, char *args[], int action); string cmdId(int narg, char *args[], int action); string cmdMaster(int narg, char *args[], int action); string cmdSync(int narg, char *args[], int action); string cmdHelp(int narg, char *args[], int action); string cmdExitServer(int narg, char *args[], int action); string cmdSettingsDir(int narg, char *args[], int action); string cmdCalDir(int narg, char *args[], int action); string cmdTrimEn(int narg, char *args[], int action); string cmdOutDir(int narg, char *args[], int action); string cmdFileName(int narg, char *args[], int action); string cmdFileIndex(int narg, char *args[], int action); string cmdFlatField(int narg, char *args[], int action); string cmdRateCorr(int narg, char *args[], int action); string cmdBadChannels(int narg, char *args[], int action); string cmdAngConv(int narg, char *args[], int action); string cmdThreaded(int narg, char *args[], int action); string cmdPositions(int narg, char *args[], int action); string cmdScripts(int narg, char *args[], int action); string cmdScans(int narg, char *args[], int action); string cmdNetworkParameter(int narg, char *args[], int action); string cmdPort(int narg, char *args[], int action); string cmdLock(int narg, char *args[], int action); string cmdLastClient(int narg, char *args[], int action); string cmdOnline(int narg, char *args[], int action); string cmdConfigureMac(int narg, char *args[], int action); string cmdDetectorSize(int narg, char *args[], int action); string cmdSettings(int narg, char *args[], int action); string cmdSN(int narg, char *args[], int action); string cmdDigiTest(int narg, char *args[], int action); string cmdRegister(int narg, char *args[], int action); string cmdDAC(int narg, char *args[], int action); string cmdTimer(int narg, char *args[], int action); string cmdTimeLeft(int narg, char *args[], int action); string cmdSpeed(int narg, char *args[], int action); string cmdAdvanced(int narg, char *args[], int action); string cmdConfiguration(int narg, char *args[], int action); string cmdImage(int narg, char *args[], int action); string cmdADC(int narg, char *args[], int action); int numberOfCommands; string cmd; typedef string (slsDetectorCommand::*MemFuncGetter)(int narg, char *args[], int action); struct FuncTable { string m_pFuncName; //const char* m_pFuncName; MemFuncGetter m_pFuncPtr; }; FuncTable descrToFuncMap[1000]; }; #endif