中间件底层,websocket

NetInterface.h 956B

1234567891011121314151617181920212223242526272829
  1. #pragma once
  2. #include <afx.h>
  3. #include <functional>
  4. #include "..\Public\pdu\PduLinkInc.h"
  5. class CPduEntity;
  6. class CNetInterface
  7. {
  8. public:
  9. virtual ~CNetInterface() = 0 {};
  10. public:
  11. typedef std::function<void(const PduLinkContent&)>LinkStateChangedFuncCB; // 连接状态变化接收回调函数
  12. typedef std::function<void(CPduEntity* a_pPduEntity)>RecvComdFuncCB; // 命令到达接收回调函数
  13. virtual void setLinkStateChanged(LinkStateChangedFuncCB funcCB) = 0; // PDU连接状态变化事件处理
  14. virtual void setRecvCommand(RecvComdFuncCB funcCB) = 0; // PDU命令到达事件处理
  15. virtual bool Send(CPduEntity* a_pCmd, PDU_DEV_TYPE a_nDestType, int a_nDestId) = 0;
  16. virtual bool CreatePduClient(CString a_strFarIp,
  17. int a_nFarPort,
  18. PDU_DEV_TYPE a_nLocalType,
  19. int a_nLocalId,
  20. bool IsAutoReconnect) = 0; // 创建PDU通讯客户端
  21. virtual bool ClosePduClient(PDU_DEV_TYPE a_nFarType,
  22. int a_nFarId) = 0; // 关闭PDU通讯客户端
  23. static CNetInterface* getNetInstance();
  24. };