From 1bd69fa18f928b90361520130410beaa3d6dc30a Mon Sep 17 00:00:00 2001 From: Maliakal Dhanya Date: Fri, 23 May 2014 14:48:34 +0200 Subject: [PATCH] opened client command interface to the users class --- .../multiSlsDetectorCommand.h | 13 +++++++++- .../slsDetector/slsDetectorUsers.cpp | 17 ++++++++++++- .../slsDetector/slsDetectorUsers.h | 24 ++++++++++++++++--- 3 files changed, 49 insertions(+), 5 deletions(-) diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetectorCommand.h b/slsDetectorSoftware/multiSlsDetector/multiSlsDetectorCommand.h index 11753bf12..a387046c6 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetectorCommand.h +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetectorCommand.h @@ -45,7 +45,18 @@ class multiSlsDetectorCommand : public slsDetectorCommand { return s; }; - + /** + * calls executeLine with PUT_ACTION + */ + string putCommand(int narg, char *args[], int pos=-1){\ + return executeLine(narg, args,slsDetectorDefs::PUT_ACTION,pos);\ + }; + /** + * calls executeLine with GET_ACTION + */ + string getCommand(int narg, char *args[], int pos=-1){\ + return executeLine(narg, args,slsDetectorDefs::GET_ACTION,pos);\ + }; private: diff --git a/slsDetectorSoftware/slsDetector/slsDetectorUsers.cpp b/slsDetectorSoftware/slsDetector/slsDetectorUsers.cpp index 14ded7f7e..bcc9b021b 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorUsers.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorUsers.cpp @@ -1,11 +1,13 @@ #include "slsDetectorUsers.h" #include "detectorData.h" #include "multiSlsDetector.h" +#include "multiSlsDetectorCommand.h" + slsDetectorUsers::slsDetectorUsers(int id) : myDetector(NULL){ myDetector=new multiSlsDetector(id); - + myCmd=new multiSlsDetectorCommand(myDetector); }; @@ -303,5 +305,18 @@ void slsDetectorUsers::registerGetI0Callback( double (*func)(int,void*),void *ar } +string slsDetectorUsers::putCommand(int narg, char *args[], int pos){ + if(narg < 2) + return string("Error: Insufficient Parameters"); + return myCmd->putCommand(narg, args, pos); +} + + +string slsDetectorUsers::getCommand(int narg, char *args[], int pos){ + if(narg < 1) + return string("Error: Insufficient Parameters"); + return myCmd->getCommand(narg, args, pos); +} + diff --git a/slsDetectorSoftware/slsDetector/slsDetectorUsers.h b/slsDetectorSoftware/slsDetector/slsDetectorUsers.h index fac8a5d45..e715b193c 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorUsers.h +++ b/slsDetectorSoftware/slsDetector/slsDetectorUsers.h @@ -15,7 +15,7 @@ class detectorData; class multiSlsDetector; - +class multiSlsDetectorCommand; #include @@ -525,7 +525,25 @@ class slsDetectorUsers \param func function for reading the I0 (called with parameter 0 before the acquisition, 1 after and the return value used as I0) */ void registerGetI0Callback( double (*func)(int,void*),void *arg); - + + /** + @short sets parameters in command interface http://www.psi.ch/detectors/UsersSupportEN/slsDetectorClientHowTo.pdf + \param narg value to be set + \param args value to be set + \param pos position of detector in multislsdetector list + \returns answer string + */ + string putCommand(int narg, char *args[], int pos=-1); + + /** + @short gets parameters in command interface http://www.psi.ch/detectors/UsersSupportEN/slsDetectorClientHowTo.pdf + \param narg value to be set + \param args value to be set + \param pos position of detector in multislsdetector list + \returns answer string + */ + string getCommand(int narg, char *args[], int pos=-1); + /************************************************************************ STATIC FUNCTIONS @@ -614,7 +632,7 @@ class slsDetectorUsers private: multiSlsDetector *myDetector; - + multiSlsDetectorCommand *myCmd; }; #endif