// InputBase.h: interface for the CInputBase class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_INPUTBASE_H__D4391E87_C111_4153_A8C1_2CF2D1910B65__INCLUDED_) #define AFX_INPUTBASE_H__D4391E87_C111_4153_A8C1_2CF2D1910B65__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "HardwareIni.h" class CInputSetting; class CInputBase : public CCard, public CMyWait { public: CInputBase(CString csMutexName, const CInputSetting &Setting); virtual ~CInputBase(); // virtual method to query if input is OFF virtual BOOL IsOff(); // virtual method to query if input is ON virtual BOOL IsOn(); // virtual method to query Analog input voltage virtual BOOL GetVoltage(double &dVoltage, int nRange); // method to set the last Analog Input Channel for HSL ONLY virtual BOOL SetLastAICh(int nLastChannel); // method to set the Configuration of Analog Input for HSL ONLY virtual BOOL SetAIConfig(int nSignalRange); /***********************************************************************/ /*********************currently for 9222 ONLY***************************/ // virtual method to setup general counter virtual BOOL SetupCounter(int nMode); // virtual method to clear counter virtual BOOL ClearCounter(); // virtual method to enable counter counting virtual BOOL EnableCounter(); // virtual method to disable counter counting virtual BOOL DisableCounter(); // virtual method read the counter virtual unsigned long ReadCounter(); /********************************************/ // method for input thread /********************************************/ // method to query is input thread working BOOL IsThreadChecking(); // method to reset input thread working flag void ResetThreadChecking(); // method to turn on Thread Is Checking flag void ThreadChecking(); // method to stop reset abort check flag void ResetAbortCheck(); // method to stop input thread checking void AbortCheck(); // method to query if the abort check flag is ON/OFF BOOL IsAbortCheck(); // method to get input ON/OFF event HANDLE GetEvt(BOOL bState); void StartWait(BOOL bState, DWORD dwDebounce, DWORD dwTimeout); BOOL Wait(BOOL bState, DWORD dwDebounce, DWORD dwTimeout); CEvent m_evtCheck; CEvent m_evtKillThread; DWORD m_dwDebounce; DWORD m_dwTimeout; BOOL m_bWaitState; // input ON event when using thread to wait upon ON State CEvent m_evtOn; // input OFF event when using thread to wait upon OFF State CEvent m_evtOff; CString GetName(void); protected: CMutex m_mutexInput; // the input point name CString m_csName; // the ON Logic BOOL m_bOnState; // the input point number int m_nPt; // the slave module number (for distributed control - HSL) int m_nSlaveID; // the input point number (for distributed control - HSL) int m_nPtrNo; // the input board type int m_nBoardType; // the input card number in the PC int m_nCardNo; // the input card ID int m_nCardID; CWinThread *m_pThread; BOOL m_bAbortCheck; BOOL m_bThreadChecking; }; #endif // !defined(AFX_INPUTBASE_H__D4391E87_C111_4153_A8C1_2CF2D1910B65__INCLUDED_)