// OutputBase.h: interface for the COutputBase class.
//
//////////////////////////////////////////////////////////////////////
#pragma once

#include <string>

#include "HardwareIni.h"

class COutputSetting;

class COutputBase : public CCard
{
public:
    COutputBase(const std::string& csMutexName, const COutputSetting& Setting);
    virtual ~COutputBase();

    // virtual method to set analog output voltage
    virtual BOOL SetVoltage(double dVoltage, double dRange);

    virtual BOOL SetState(bool bState) = 0;

    // virtual method to set output to OFF
    BOOL Off();

    // virtual method to set output to ON
    BOOL On();

    BOOL IsOn();

    BOOL IsOff();

    // exposed this variable as public so that when destroying the object,
    // Parent Class (COutput) can access and use it to off the output based on the ON logic.
    BOOL m_bOnState;

protected:
    CMutex m_mutexOutput;

    BOOL m_bCurrentState;

    int m_nPt;
    int m_nSlaveID;
    int m_nPtrNo;
    std::string m_strName;
    int m_nBoardType;
    int m_nCardNo;
    int m_nCardID;

    bool IsDigitalOutput(int nPt);

    bool IsAnalogOutput(int nPt);
};
