CommAsyn.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // CommAsyn.h: interface for the CCommAsyn class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_COMMASYN_H__DAIKIN__INCLUDED_)
  5. #define AFX_COMMASYN_H__DAIKIN__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. #define STATUS_NORMAL 0
  10. #define STATUS_FAULT 1
  11. #define STATUS_NOUSE 2
  12. #define STATUS_TYPEERROR 3
  13. #define COMM_CORRECT 0
  14. #define COMM_ERROR 1
  15. #define MAX_DATA_NUM128 128
  16. #define MAX_YXNO 2048
  17. #define MAX_YCNO 2048
  18. class CProtocol;
  19. class CCommAsyn
  20. {
  21. public:
  22. CProtocol* m_pProtocol;
  23. virtual int Write(BYTE * pBuf, int len) =0;
  24. virtual int Read(BYTE * pBuf, int len) =0;
  25. virtual int WorkMain(
  26. int nAddr, //地址
  27. int nVer, //版本号
  28. int nCid1, //控制标识码
  29. int nCid2, //命令信息
  30. WORD wLenId, //INFO字节长度
  31. int nCmdID, //命令ID
  32. int nDataLen, //请求数据长度
  33. int nCmdPos, //变量索引
  34. int nCmdLen, //变量长度
  35. char chMsg[80], //读到的变量值
  36. char *byDataFlag); //保留未用
  37. virtual int WriteCommand(
  38. int nCommPort, //端口
  39. int nAddr, //地址
  40. int nVer, //版本号
  41. int nCid1, //控制标识码
  42. int nCid2, //命令信息
  43. WORD wLenId, //INFO字节长度
  44. int nCmdType, //命令类型
  45. int nSetValue); //设定值
  46. virtual int WriteCommand(
  47. int nCommPort, //端口
  48. int nAddr, //地址
  49. int nSetType, //设定类型
  50. int nSetIndex, //设定值索引,只针对特殊变量(例如:空调制冷、制热温度)
  51. int nSetValue); //设定值
  52. virtual BOOL InitParam(PPORTPARAM pPortParam);
  53. virtual BOOL CloseComm();
  54. CCommAsyn();
  55. virtual ~CCommAsyn();
  56. };
  57. #endif // !defined(AFX_COMMASYN_H__8351010D_0DD3_4F8C_8F3B_959BA59019E7__INCLUDED_)