// OutputControllerBase.h: interface for the COutputControllerBase class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_OUTPUTCONTROLLERBASE_H__4CB4F3BE_2733_4600_8A61_3B14634363A5__INCLUDED_)
#define AFX_OUTPUTCONTROLLERBASE_H__4CB4F3BE_2733_4600_8A61_3B14634363A5__INCLUDED_

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

#include "HardwareIni.h"

class COutputSetting;
class COutputBase;

class COutputControllerBase : public CCard
{
public:
    COutputControllerBase(CString csMutexName);
    virtual ~COutputControllerBase();

    void RegisterOutput(const COutputSetting &outputSetting, COutputBase *pOutput);

    void DeRegisterOutput(const COutputSetting &outputSetting);

    BOOL Init(int nHardwareIniTypeID);

// virtual method to initialise the output controller card
    virtual int InitCard(int nHardwareIniTypeID, int nHardwareIniTypeCardNo, int *pPhysicalCardID) = 0;

// virtual method to close the output controller card
    void Close(int nHardwareIniTypeID);

    virtual int CloseCard(int nPhysicalCardID) = 0;

// virtual method to set analog voltage
    BOOL SetVoltage(const COutputSetting &OutputSetting,  double dVoltage, double dRange);

// virtual method to turn output OFF
    BOOL Off(const COutputSetting &OutputSetting);

// virtual method to turn output ON
    BOOL On(const COutputSetting &OutputSetting);

protected:
    CMutex m_mutexOutput;

    CHardwareIni m_iniHardware;

    void UpdateOutputMap(const COutputSetting &OutputSetting, BOOL bLogic);
};

#endif // !defined(AFX_OUTPUTCONTROLLERBASE_H__4CB4F3BE_2733_4600_8A61_3B14634363A5__INCLUDED_)
