// Output.h: interface for the COutput class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_OUTPUT_H__5B5E0981_F82B_11D6_A627_003064018EFE__INCLUDED_)
#define AFX_OUTPUT_H__5B5E0981_F82B_11D6_A627_003064018EFE__INCLUDED_

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

#include "hardwareini.h"
#include "OutputBase.h"

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

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

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

class IODLLCLASS COutput : public CCard
{
public:
    COutput(const COutputSetting &Setting);
    virtual ~COutput();

// dRange = -10 for 0-10V output
// dRange = 10 for -10-0V output
    BOOL SetVoltage(double dVoltage, double dRange);

    BOOL Off(void);
    BOOL On(void);
    BOOL IsOff(void);
    BOOL IsOn(void);

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

private:
    CMutex       m_OutputMutex;
    COutputBase *m_outputBase;
};

#endif // !defined(AFX_OUTPUT_H__5B5E0981_F82B_11D6_A627_003064018EFE__INCLUDED_)
