You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
104 lines
2.7 KiB
C++
104 lines
2.7 KiB
C++
// OutputController.h: interface for the COutputController class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#if !defined(AFX_OUTPUTCONTROLLER_H__65E8EEA4_D76F_11D7_89B3_000629A6E157__INCLUDED_)
|
|
#define AFX_OUTPUTCONTROLLER_H__65E8EEA4_D76F_11D7_89B3_000629A6E157__INCLUDED_
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif // _MSC_VER > 1000
|
|
#include "hardwareini.h"
|
|
#include "OutputControllerBase.h"
|
|
#include <map>
|
|
|
|
#ifdef BUILD_IODLL
|
|
#define IODLLCLASS __declspec(dllexport)
|
|
#else
|
|
#define IODLLCLASS __declspec(dllimport)
|
|
#endif
|
|
|
|
class COutputSetting;
|
|
|
|
class IODLLCLASS COpStatus
|
|
{
|
|
public:
|
|
char m_cPtName[100];
|
|
bool m_bOn;
|
|
bool m_bRequestChgState;
|
|
bool m_bChgStateOn;
|
|
};
|
|
|
|
class IODLLCLASS COutputController : public CCard
|
|
{
|
|
public:
|
|
friend UINT OutputControllerThreadFn(LPVOID pParam);
|
|
|
|
COutputController();
|
|
virtual ~COutputController();
|
|
|
|
BOOL SetVoltage(const COutputSetting &OutputSetting, double dVoltage, double dRange);
|
|
BOOL Off(const COutputSetting &OutputSetting);
|
|
BOOL IsOn(const COutputSetting &OutputSetting);
|
|
BOOL On(const COutputSetting &OutputSetting);
|
|
BOOL InitController(void);
|
|
|
|
// return the size of gOutputArray
|
|
int GetSizeofOutputArray();
|
|
|
|
// make a copy of gOutputArray
|
|
void CopyOutputStatus();
|
|
// void CopyOutputArray(BOOL bOutputArray[]);
|
|
|
|
// check if there is state change in output
|
|
BOOL IsOutputStateChange(int iOutputNo, BOOL &bOutputState);
|
|
// BOOL IsOutputStateChange(BOOL bOutputState,int iOutputNo);
|
|
|
|
// allocate array size for output array
|
|
void InitOutputArray();
|
|
|
|
// copy of gOutputArray that is used to compare the output state during machine running vs
|
|
// output state in maintenance mode
|
|
BOOL *m_bpOutputArray;
|
|
|
|
// to keep track output state array size
|
|
int m_iOutputStateArraySize;
|
|
|
|
CMutex m_OutputMutex;
|
|
|
|
static COutputController* GetInstance();
|
|
COutputControllerBase * GetController(int nCardType);
|
|
|
|
void StartUpdateThread();
|
|
|
|
void TerminateThread();
|
|
|
|
void StartUpdate(bool bStartUpdate);
|
|
|
|
void SetSimulateIo(bool simIo)
|
|
{
|
|
m_bsimIo = simIo;
|
|
}
|
|
|
|
bool GetSimulateIo(void)
|
|
{
|
|
return m_bsimIo;
|
|
}
|
|
|
|
bool m_bsimIo; // m_bsimIo - simIo
|
|
private:
|
|
COutputControllerBase* m_outputControllerBase[MAX_OUTPUT_CARD_TYPE];
|
|
|
|
int m_nNoOfCardType;
|
|
CHardwareIni m_iniHardware;
|
|
CArray<stCard, stCard> m_astCard;
|
|
|
|
static COutputController* instance;
|
|
|
|
CWinThread *m_pThread;
|
|
|
|
CEvt m_evtTerminate;
|
|
CEvt m_evtStartUpdate;
|
|
};
|
|
#endif // !defined(AFX_OUTPUTCONTROLLER_H__65E8EEA4_D76F_11D7_89B3_000629A6E157__INCLUDED_)
|