a
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
// TransferCtrl.h: interface for the CTransferCtrl class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_TRANSFERCTRL_H__46BA1870_8449_4607_98BE_7FFA9DF61523__INCLUDED_)
|
||||
#define AFX_TRANSFERCTRL_H__46BA1870_8449_4607_98BE_7FFA9DF61523__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
#include "StdAfx.h"
|
||||
#include "TcpClient.h"
|
||||
#include <vector>
|
||||
#include "CtrlProtocolDef.h"
|
||||
|
||||
|
||||
|
||||
typedef struct ST_TRANS_CTRL_INFO
|
||||
{
|
||||
BYTE ucDevType;
|
||||
BYTE ucCmd;
|
||||
UINT uiDevID;
|
||||
// WORD wTsn;
|
||||
ST_TRANS_CTRL_INFO()
|
||||
{
|
||||
ucDevType = 0;
|
||||
ucCmd = 0;
|
||||
uiDevID = 0;
|
||||
// wTsn = 0;
|
||||
}
|
||||
|
||||
}STTransCtrlInfo;
|
||||
|
||||
class CTransferCtrl : public CTcpClient
|
||||
{
|
||||
public:
|
||||
CTransferCtrl();
|
||||
virtual ~CTransferCtrl();
|
||||
// void SetConnectServerInfo(CString strIP, WORD wPort){m_strIPAddr = strIP; m_wPort = wPort;}
|
||||
bool Initialize();
|
||||
|
||||
// bool GetConnectStatus(){return GetConnectStatus();}
|
||||
int GetCtrlRspLength(BYTE ucCMd){AfxMessageBox(_T("need implment")); return 0;}
|
||||
int RecvRspMsg(char* pData, int* pLen,int iMaxLen,int iTimeout);
|
||||
int RecvCtrlMsg(char* pData, int* pLen, int iMaxLen, int iTimeout);
|
||||
bool IsCtrlMsg(BYTE ucCMd);
|
||||
int GetCurrCtrlCmd(){return m_ucCtrlCmd;}
|
||||
bool InitialClient();
|
||||
inline bool IsPlcStatusMsg(BYTE ucCmd, BYTE ucSrcType);
|
||||
UINT32 GetPlcAddr(){return m_uiPlcAddr;}
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
void ClearCtrlInfo();
|
||||
bool IsNeedSendCtrl();
|
||||
bool SendCtrlInfoToDev(const STTransCtrlInfo * pTransInfo,const char* pData, WORD wDataLen,BYTE ucDataType = 1);
|
||||
bool SendCtrlInfo(const char*pCtrlHeader, const char* pData, WORD wDataLen, BYTE DataType = 1);
|
||||
bool RecvEnoughMsg(char* pData, int iLen, int iTimeOut);
|
||||
int RecvCommRspMsg(char* pRcvData, int* pRcvLen, int iMaxRcvLen,int iRcvTimeout,bool bIsRcvCtrl = false);
|
||||
protected:
|
||||
//std::vector<STProCtrlInfo> m_vtProCtrl;
|
||||
|
||||
// STCtrlRcvMsgInfo m_stCtrlRcvMsg;
|
||||
BYTE m_ucCmd;
|
||||
bool m_bIsNeedSendCtrMsg;
|
||||
int m_iLastErrNo;
|
||||
int m_iSeriNo;
|
||||
int m_iLastSeriNo;
|
||||
int m_ucDevType;
|
||||
BYTE m_ucCtrlCmd;
|
||||
UINT32 m_uiPlcAddr;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_TRANSFERCTRL_H__46BA1870_8449_4607_98BE_7FFA9DF61523__INCLUDED_)
|
||||
Reference in New Issue
Block a user