/* * GluexXPSGroup.hh * * Created on: Jun 13, 2016 * Author: Hovanes Egiyan */ #ifndef GLUEXXPSGROUP_HH_ #define GLUEXXPSGROUP_HH_ #include #include #include #include #include "epicsExit.h" #include "asynPortDriver.h" #include #include "XPS_C8_drivers.h" #include "xps_ftp.h" #include "GluexXPSController.hh" #include "GluexXPSAxis.hh" class GluexXPSGroup: public asynPortDriver { /* Status codes for XPS Set,Enable and Disable */ enum XPS_GroupStatus { XPS_GROUP_STATUS_UNDEFINED, XPS_GROUP_STATUS_SUCCESS, XPS_GROUP_STATUS_FAILURE, XPS_GROUP_STATUS_TIMEOUT }; /* Status codes for GroupReferencing/Start/Stop/ */ enum GroupReferencingStatus { GROUP_REFERENCING_STATUS_UNDEFINED, GROUP_REFERENCING_STATUS_SUCCESS, GROUP_REFERENCING_STATUS_FAILURE, GROUP_REFERENCING_STATUS_TIMEOUT }; protected: static std::string gxgInitializeString; static std::string gxgInitializeStatusString; static std::string gxgKillString; static std::string gxgKillStatusString; static std::string gxgHomeSearchString; static std::string gxgHomeSearchStatusString; static std::string gxgMotionEnableString; static std::string gxgMotionEnableStatusString; static std::string gxgMotionDisableString; static std::string gxgMotionDisableStatusString; static std::string gxgReferencingStartString; static std::string gxgReferencingStartStatusString; static std::string gxgReferencingStopString; static std::string gxgReferencingStopStatusString; static std::string gxgStatusStringString; static std::string gxgStatusString; static std::string gxgMessageString; static std::string gxgReferencingMessageString; // Controller address GluexXPSController* gxgController ; // Group name std::string gxgName; // Map with pointers to the axis belonging to this group std::map gxgAxisMap; // Socket ID for polling int gxgPollSocket; // Socket ID for moving int gxgMoveSocket; epicsEventId gxgEventID; // Event ID for waking up reading thread // Define the first parameter #define FIRST_GLUEX_XPS_GROUP_PARAM gxgInitialize_ // asyn parameters int gxgInitialize_; int gxgInitializeStatus_; int gxgKill_; int gxgKillStatus_; int gxgHomeSearch_; int gxgHomeSearchStatus_; int gxgMotionEnable_; int gxgMotionEnableStatus_; int gxgMotionDisable_; int gxgMotionDisableStatus_; int gxgReferencingStart_; int gxgReferencingStartStatus_; int gxgReferencingStop_; int gxgReferencingStopStatus_; int gxgStatus_; int gxgStatusString_; int gxgMessage_; int gxgReferencingMessage_; // Define a macro for the last parameter. Make sure that if you add new parameters at the // bottom you also change its name in the define directive below. #define LAST_GLUEX_XPS_GROUP_PARAM gxgReferencingMessage_ // Define the number of parameters as the difference between pointer between last and first // integer parameter defined above. #define NUM_GLUEX_XPS_GROUP_PARAMS ( (int)(&LAST_GLUEX_XPS_GROUP_PARAM - &FIRST_GLUEX_XPS_GROUP_PARAM + 1) ) public: GluexXPSGroup( const std::string pName, const std::string groupName, GluexXPSController* pC ); virtual ~GluexXPSGroup(); virtual void createParameters(); void report(FILE *fp, int details); asynStatus poll(); void pollingLoop(); static void pollingThreadFunction( void *drvPvt ) ; /* These are the functions for GroupInitialize, GroupKill, GroupHomeSearch, GroupMotionEnable and GroupMotionDisable */ virtual asynStatus initialize(); virtual asynStatus kill(); virtual asynStatus homeSearch(); virtual asynStatus motionEnable(); virtual asynStatus motionDisable(); // Start and stop referencing state for the group virtual asynStatus referencingStart(); virtual asynStatus referencingStop(); // Override these functions defined for the base class virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value); virtual void addAxis( const std::string positionerName, GluexXPSAxis* axisPtr ); virtual bool contains( const std::string positionerName ); virtual bool shouldContain( const std::string positionerName ); virtual void refreshAxisMap(); virtual void assignAxes(); static void shutdownCallback(void *pPvt); virtual inline GluexXPSController* getController() {return gxgController;} virtual inline std::string getName() {return gxgName;} virtual inline std::map& getAxisMap() {return gxgAxisMap;} virtual inline int getPollSocket() const {return gxgPollSocket;} virtual inline int getMoveSocker() const {return gxgMoveSocket;} virtual inline std::string getPortName() const {return portName;} }; #endif /* GLUEXXPSGROUP_HH_ */