#pragma once
|
|
#if _MSC_VER > 1000
|
#pragma once
|
#endif // _MSC_VER > 1000
|
|
#include <vector>
|
#include "TimerThreadPool.h"
|
|
enum SEND_MESSAGE_SECTION {SEND_MESSAGE_ALL=0,SEND_MESSAGE_CONTROLSIGNAL,SEND_MESSAGE_ALARM,SEND_MESSAGE_REVIEWSIGNAL,SEND_MESSAGE_UNKNOWN};
|
|
class CPostSendMessage
|
{
|
public:
|
CPostSendMessage(){Reset();}
|
virtual ~CPostSendMessage(){;}
|
void Reset()
|
{
|
nSignal = nValue = -1;
|
emSection = SEND_MESSAGE_UNKNOWN;
|
}
|
|
SEND_MESSAGE_SECTION emSection;
|
int nSignal;
|
int nValue;
|
};
|
|
class CDisableSendMessage : public CPostSendMessage
|
{
|
public:
|
CDisableSendMessage(){Reset();}
|
virtual ~CDisableSendMessage(){;}
|
void Reset()
|
{
|
CPostSendMessage::Reset();
|
dwOntime = dwStart = 0;
|
}
|
|
DWORD dwOntime;
|
DWORD dwStart;
|
};
|
|
|
interface IPLCSendInterface2Parent
|
{
|
virtual void SendMSG_Received(CPostSendMessage *pSendMSG) = 0;
|
};
|
|
/////////////////////////////////////////////////////////////////////////////
|
// CThread_SendMSG thread
|
|
#define PAD_RECIPE_NAME_CNT 200
|
class CThread_SendMSG : public CTimerThreadPool
|
{
|
public:
|
CThread_SendMSG(DWORD dwPeriod=15); // protected constructor used by dynamic creation
|
virtual ~CThread_SendMSG();
|
|
public:
|
BOOL CreateThread();
|
void SetIN2P(IPLCSendInterface2Parent *pN2M){m_pS2M=pN2M;}
|
|
std::vector<CPostSendMessage> *GetVecSendMSG(){return &m_VecSendMSG;}
|
int AddSendMSG(SEND_MESSAGE_SECTION emSection,int nSignal, int nValue);
|
|
std::vector<CDisableSendMessage> *GetVecDisableMSG(){return &m_VecDisableMSG;}
|
int AddDisableMSG(SEND_MESSAGE_SECTION emSection,int nSignal, int nValue, DWORD dwOntime);
|
|
BOOL ClearMSG();
|
|
virtual void TimerThreadProcess(PVOID pParameter);
|
|
protected:
|
CCriticalSection m_csNetMSG;
|
CCriticalSection m_csDisableMSG;
|
IPLCSendInterface2Parent *m_pS2M;
|
std::vector<CPostSendMessage> m_VecSendMSG;
|
std::vector<CDisableSendMessage> m_VecDisableMSG;
|
|
};
|