#pragma once #ifdef BUILD_GUIDLL #define DLLCLASS __declspec(dllexport) #include using namespace boost::interprocess; #else #define DLLCLASS __declspec(dllimport) class managed_shared_memory; #endif class CMtrStatus; class DLLCLASS CGuiMotionController { public: BOOL IsInPosition(CMtrProfile mtrProfile); unsigned short GetMotionIOStatus(CMtrProfile mtrProfile); CGuiMotionController(void); ~CGuiMotionController(void); BOOL InitController(int iNoOfMtr); // check if negative limit hit // BOOL IsNegLimHit(int iMotorNo); BOOL IsNegLimHit(CMtrProfile mtrProfile); // check if positive limit hit // BOOL IsPosLimHit(int iMotorNo); BOOL IsPosLimHit(CMtrProfile mtrProfile); // check if motor at home position // BOOL IsHomed(int iMotorNo); BOOL IsHomed(CMtrProfile mtrProfile); // check if servo ready // BOOL IsServoReady(int iMotorNo); BOOL IsServoReady(CMtrProfile mtrProfile); // check if servo alarm // BOOL IsServoAlarm(int iMotorNo); BOOL IsServoAlarm(CMtrProfile mtrProfile); // get Motor Pos value // double GetMtrPos(int iMotorNo); double GetMtrPos(CMtrProfile mtrProfile); // get Motion status of motor // int GetMotionStatus(int iMotorNo); unsigned short GetMotionStatus(CMtrProfile mtrProfile); // get proportional gain value double GetPValue(int iMotorNo); // get Integral gain value double GetIValue(int iMotorNo); // get Deriative gain value double GetDValue(int iMotorNo); // get position error value // double GetPosErr(int iMotorNo); double GetPosErr(CMtrProfile mtrProfile); // check if Motor type is servo motor BOOL IsServoMtrType(CMtrProfile mtrProfile); // copy all motor status void CopyMtrStatus(); // check if motor position changed bool IsMtrPosChanged(int iMtrNo, int &iPos); // check if motor On/Off States changed bool IsMtrOnOffStateChanged(int iMtrNo, bool &bOnOffState); // check if motor is on BOOL IsMtrOn(CMtrProfile mtrProfile); /* Return Motor(specify by iMtrNo) on or off state. Function Return true = Motor specify by iMtrNo Is On, else return false = Motor is off */ bool GetMtrOnOffState(int iMtrNo); private: int m_iNoOfMtr; int *m_ipMtrCurPos; // array to store motor position before maintenance mode bool *m_bpMtrCurOnOff; // array to store motor On/Off States before maintenance mode managed_shared_memory *m_managed_shm; CMtrStatus *m_pMtrStatus; };