// Input.h: interface for the CInput class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_INPUT_H__5B6F2601_F780_11D6_A626_003064018EFE__INCLUDED_)
#define AFX_INPUT_H__5B6F2601_F780_11D6_A626_003064018EFE__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "hardwareini.h"
#include "InputBase.h"

#ifdef  BUILD_IODLL
#define     IODLLCLASS  __declspec(dllexport)
#else
#define     IODLLCLASS  __declspec(dllimport)
#endif

class IODLLCLASS CInputSetting
{
public:
// configuration
    CInputSetting() :
        m_szName(nullptr),
        m_szModuleName(nullptr),
        m_bLogic(FALSE),
        m_nPointNo(0),
        m_nSlaveID(0),
        m_nPtrNo(0),
        m_nBoardType(0),
        m_nCardNo(0)
    {
    }

    LPCTSTR m_szName;
    LPCTSTR m_szModuleName;
    BOOL    m_bLogic;
    int     m_nPointNo;
    int     m_nSlaveID;
    int     m_nPtrNo;
    int     m_nBoardType;
    int     m_nCardNo;
};

class IODLLCLASS CInput : public CCard
{
public:
    CInput(const CInputSetting &Setting);
    virtual ~CInput();

    BOOL SetLastAICh(int nLastChannel);
    BOOL SetAIConfig(int nSignalRange);

    BOOL GetVoltage(double &dVoltage, int nRange);

    void AbortCheck(void);

    HANDLE GetEvt(BOOL bState);

    void StartWait(BOOL bState, DWORD dwDebounce, DWORD dwTimeout);

    BOOL Wait(BOOL bState, DWORD dwDebounce, DWORD dwTimeout);

    BOOL IsOff(void);

    BOOL IsOn(void);

    BOOL operator ==(const BOOL bState);
    BOOL operator !=(const BOOL bState);

/***********************************************************************/
/*********************currently for 9222 ONLY***************************/

// method to setup general counter
    BOOL SetupCounter(int nMode);

// method to clear counter
    BOOL ClearCounter();

// method to enable counter counting
    BOOL EnableCounter();

// method to disable counter counting
    BOOL DisableCounter();

// method read the counter
    unsigned long ReadCounter();

private:
    CInputBase* m_inputBase;
};

#endif // !defined(AFX_INPUT_H__5B6F2601_F780_11D6_A626_003064018EFE__INCLUDED_)
