www.pudn.com > Fronter_xie3.rar > Connect790Socket.h


// CConnect790Socket.h: interface for the CTransferSocket class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#if !defined(AFX_TRANSFERSOCKET_H__F50B148E_152B_47CA_89B1_93CD7E4F6CFF__INCLUDED_) 
#define AFX_TRANSFERSOCKET_H__F50B148E_152B_47CA_89B1_93CD7E4F6CFF__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
#include "stdafx.h" 
#include "struct.h" 
 
/*#define GB_FRM_SIZE   		2048 
typedef struct{ 
BYTE  wTxCnt;		//发送次数 
BYTE  pBuf[ GB_FRM_SIZE ]; 
WORD  wBufSize;		//发送帧缓冲区的大小 
WORD  wBufLen;		//发送帧长度 
WORD  wBufPointer; 
}GBMsg;*/ 
 
 
class CConnect790Socket   
{ 
	friend UINT CL790DGBLocalSocketThread(void* pvPara); 
	 
public: 
	CConnect790Socket(); 
	virtual ~CConnect790Socket(); 
	int ReceiveTask(); 
	 
protected: 
	//虚函数 
    bool Send(BYTE* pbTxBuf, WORD wLen); 
	bool Send2TestGB(BYTE* pbTxBuf, WORD wLen); 
	WORD Receive(BYTE* pbTxBuf, WORD wLen); 
	BYTE RecvCycPool[ GB_FRM_SIZE ]; 
	WORD wRecvCycPoolSize,wRecvCycPoolHead,wRecvCycPoolTail; 
	BYTE m_bRxBuf[GB_FRM_SIZE]; 
	WORD m_wRxPtr, m_nRxCnt, m_nRxStep,	m_wRxFrmLen; 
    GBMsg	TxMsg; 
    GBMsg	TxPrmMsg; 
    GBMsg	RxMsg;   
	GBCommInfo_T GBCommInfo; 
	bool m_bFlush; 
	 
	bool VeryRxFrm(const BYTE *pRxBufStart,WORD wRxLen); 
    int RxProcess(); 
	int RxCmd_CONFIRM( ); 
	void PutReturnValue(int ret); 
	int AnsCmd_CONFIRM(); 
	int AnsCmd_RESET(BYTE bERR); 
	int MakeTxFrm(bool fPRM,BYTE bCmd,BYTE bAFN,GBMsg *pTxMsg); 
	int SearchSocket(); 
	 
public: 
	SOCKET m_Localsockfd; 
	 
	bool m_fConnected; 
	bool m_fExit; 
	bool m_fExitDone; 
	bool SearchOneFrame(BYTE **pRxFrmStart,WORD *wRxLen); 
	int RcvBlock(BYTE* pbBlock, int nLen); 
private: 
	int m_index; 
	 
	//有关testgb的信息 
	SOCKET m_TestGBLocalsockfd; 
	int m_TestGBindex; 
}; 
/*typedef struct 
{ 
	HWND     hWnd; 
	bool     cl790D_Valid;	 
	char     cl790D_GBAddress[20];	 
	char     cl790D_MainIP[20]; 
	SOCKET   cl790D_SOCKET; 
	bool     TestGB_Valid; 
	char     TestGB_GBAddress[20]; 
	char     TestGB_MainIP[20]; 
	SOCKET 	 TestGB_SOCKET; 
	BYTE     state; 
    CConnect790Socket pFapLocal; 
}Para_Address;*/ 
typedef struct 
{ 
	HWND     hWnd; 
	bool     cl790D_Valid;	 
	char     cl790D_GBAddress[20];	 
	char     cl790D_MainIP[20]; 
	SOCKET   cl790D_SOCKET; 
	bool     TestGB_Valid; 
	char     TestGB_GBAddress[20]; 
	char     TestGB_MainIP[20]; 
	SOCKET 	 TestGB_SOCKET; 
	BYTE     state; 
	DWORD    revbytenum; 
	DWORD    revfrmnum; 
	DWORD    sendbytenum; 
	DWORD    sendfrmnum; 
    CConnect790Socket pFapLocal; 
}Para_Address; 
 
 
#endif // !defined(AFX_TRANSFERSOCKET_H__F50B148E_152B_47CA_89B1_93CD7E4F6CFF__INCLUDED_)