// 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){return FALSE;}; // virtual method to clear counter virtual BOOL ClearCounter(){return FALSE;}; // virtual method to enable counter counting virtual BOOL EnableCounter(){return FALSE;}; // virtual method to disable counter counting virtual BOOL DisableCounter(){return FALSE;}; // virtual method read the counter virtual unsigned long ReadCounter(){return FALSE;}; /********************************************/ // method for input thread /********************************************/ // method to query is input thread working BOOL IsThreadChecking(){return m_bThreadChecking;}; // method to reset input thread working flag void ResetThreadChecking(){m_bThreadChecking = FALSE;}; // method to turn on Thread Is Checking flag void ThreadChecking(){m_bThreadChecking = TRUE;}; // method to stop reset abort check flag void ResetAbortCheck(){m_bAbortCheck = FALSE;}; // method to stop input thread checking void AbortCheck(){m_bAbortCheck = TRUE;}; // method to query if the abort check flag is ON/OFF BOOL IsAbortCheck(){return m_bAbortCheck;}; // method to get input ON/OFF event HANDLE GetEvt(BOOL bState){return (bState==TRUE)?m_evtOn.m_hObject:m_evtOff.m_hObject;}; 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){ return m_csName;} 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_)