Protocol.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Protocol.h: interface for the CProtocol class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_PROTOCOL_H__B54C8930_9411_4B11_B750_261140346F76__INCLUDED_)
  5. #define AFX_PROTOCOL_H__B54C8930_9411_4B11_B750_261140346F76__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. class CCommAsyn;
  10. class CProtocol
  11. {
  12. public:
  13. virtual BOOL InitParam(PPORTPARAM pPortParam,CCommAsyn*pComm);
  14. virtual int WorkMain( int nRequestLen, //请求数据总长度
  15. int nResponseLen, //响应数据总长度
  16. int nCmd, //命令
  17. int nCmdPos, //变量索引
  18. int nCmdLen, //变量长度
  19. int nParam, //参数
  20. char chMsg[80] ) = 0; //读到变量值
  21. virtual int WriteCommand(SETBASEPARAM SetBasePara, double dbData, int nDataLen) = 0;
  22. CProtocol();
  23. virtual ~CProtocol();
  24. protected:
  25. CCommAsyn* m_pComm;
  26. int WriteMessage(BYTE* pBuf, int len);
  27. int ReadMessage(BYTE *pBuf, int len);
  28. public:
  29. RESPONSE_STRUCT m_structResponse;
  30. };
  31. #endif // !defined(AFX_PROTOCOL_H__B54C8930_9411_4B11_B750_261140346F76__INCLUDED_)