中间件底层,websocket

NetworkClient.h 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*************************************************************************
  2. 【文件名】 NetworkClient.h
  3. 【功能模块和目的】 ACD端网络控制类头文件
  4. 【开发者及日期】 郑石诺 2015/09/22
  5. 【版本】 V1.0.0
  6. 【版权信息】 Copyright (C)2015 河南加一信息技术有限公司
  7. 【更改记录】
  8. *************************************************************************/
  9. #pragma once
  10. #include "../Public/GlobalDef/CommonTypeDef.h"
  11. #include <functional>
  12. /*************************************************************************
  13. 【类名】 CNetworkClient
  14. 【功能】
  15. 【接口说明】 ACD端网络控制类
  16. 【开发者及日期】 郑石诺 2015/09/22
  17. 【版本】 V1.0.0
  18. 【版权信息】 Copyright (C)2015 河南加一信息技术有限公司
  19. 【更改记录】
  20. *************************************************************************/
  21. class CNetworkClient
  22. {
  23. SINGLETON_DECLARE(CNetworkClient)
  24. public:
  25. CNetworkClient(void);
  26. virtual ~CNetworkClient(void);
  27. bool isAcdConnected() const { return m_IsAcdConnected; } // 获取Acd连接状态
  28. bool isCtiConnected() const { return m_IsCtiConnected; }
  29. bool init(void); // 初始化
  30. void release(void); // 连接释放
  31. bool send2ACD(CPduEntity* a_pPduEntity);
  32. ////////////////////////////////////////////////////////////////////////////////
  33. //继承自IPduLinkProc, IPduCommProc
  34. void OnLinkStateChanged(const PduLinkContent& linkContent); // PDU连接状态变化事件处理
  35. void OnRecvCommand(CPduEntity* a_pPduEntity); // PDU命令到达事件处理
  36. typedef std::function<void(CPduEntity*)> AcdRecMsgFun;
  37. void setAcdRecMsgFun(AcdRecMsgFun fun) { this->m_acdRecvMsgFun = fun; };
  38. private:
  39. int m_AcdDevID; // ACD设备ID
  40. bool m_IsAcdConnected; // 连接与否
  41. bool m_IsCtiConnected; // cti是否连接
  42. CCriticalSection m_Lock4CTi;
  43. AcdRecMsgFun m_acdRecvMsgFun;
  44. };