system_communication.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //
  2. // Created by huli on 2020/6/28.
  3. //
  4. #ifndef NNXX_TESTS_SYSTEM_COMMUNICATION_H
  5. #define NNXX_TESTS_SYSTEM_COMMUNICATION_H
  6. #include "../tool/singleton.h"
  7. #include "../communication/communication_socket_base.h"
  8. class System_communication:public Singleton<System_communication>, public Communication_socket_base
  9. {
  10. enum Message_type
  11. {
  12. eCommand_msg=0x01, //指令消息
  13. eLocate_status_msg=0x11, //定位模块状态消息
  14. eLocate_request_msg=0x12, //定位请求消息
  15. eLocate_response_msg=0x13, //定位反馈消息
  16. eHarware_statu_msg=0x21, //调度模块硬件状态消息
  17. eExecute_request_msg=0x22, //请求调度消息
  18. eExecute_response_msg=0x23, //调度结果反馈消息
  19. };
  20. // 子类必须把父类设定为友元函数,这样父类才能使用子类的私有构造函数。
  21. friend class Singleton<System_communication>;
  22. private:
  23. // 父类的构造函数必须保护,子类的构造函数必须私有。
  24. System_communication();
  25. public:
  26. //必须关闭拷贝构造和赋值构造,只能通过 get_instance 函数来进行操作唯一的实例。
  27. System_communication(const System_communication& other) = delete;
  28. System_communication& operator =(const System_communication& other) = delete;
  29. ~System_communication();
  30. public://API functions
  31. //定时封装发送消息, 一般为心跳和状态信息, 需要子类重载
  32. virtual Error_manager encapsulate_send_data();
  33. public://get or set member variable
  34. protected://member variable
  35. private:
  36. };
  37. #endif //NNXX_TESTS_SYSTEM_COMMUNICATION_H