#pragma once #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include #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 *GetVecSendMSG(){return &m_VecSendMSG;} int AddSendMSG(SEND_MESSAGE_SECTION emSection,int nSignal, int nValue); std::vector *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 m_VecSendMSG; std::vector m_VecDisableMSG; };