Protocol.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Protocol.h: interface for the CProtocol class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_PROTOCOL_H__DAIKIN__INCLUDED_)
  5. #define AFX_PROTOCOL_H__DAIKIN__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(
  15. int nAddr, //地址
  16. int nVer, //版本号
  17. int nCid1, //控制标识码
  18. int nCid2, //命令信息
  19. WORD wLenId, //INFO字节长度
  20. int nCmdID, //命令ID
  21. int nDataLen, //请求数据长度
  22. int nCmdPos, //变量索引
  23. int nCmdLen, //变量长度
  24. char chMsg[80], //读到的变量值
  25. char *byDataFlag) = 0; //保留未用 =0;
  26. virtual int WriteCommand(
  27. int nCommPort, //端口
  28. int nAddr, //地址
  29. int nVer, //版本号
  30. int nCid1, //控制标识码
  31. int nCid2, //命令信息
  32. WORD wLenId, //INFO字节长度
  33. int nCmdType, //命令类型
  34. int nSetValue) = 0; //设定值
  35. virtual int WriteCommand(
  36. int nCommPort, //端口
  37. int nAddr, //地址
  38. int nSetType, //设定类型
  39. int nSetIndex, //设定值索引,只针对特殊变量(例如:空调制冷、制热温度)
  40. int nSetValue) = 0; //设定值
  41. CProtocol();
  42. virtual ~CProtocol();
  43. protected:
  44. CCommAsyn* m_pComm;
  45. int WriteMessage(BYTE* pBuf, int len);
  46. int ReadMessage(BYTE *pBuf, int len);
  47. public:
  48. RESPONSE_STRUCT m_structResponse;
  49. };
  50. #endif // !defined(AFX_PROTOCOL_H__B54C8930_9411_4B11_B750_261140346F76__INCLUDED_)