// // Created by huli on 2020/6/28. // #ifndef NNXX_TESTS_SYSTEM_COMMUNICATION_H #define NNXX_TESTS_SYSTEM_COMMUNICATION_H #include "../tool/singleton.h" #include "../communication/communication_socket_base.h" class System_communication:public Singleton, public Communication_socket_base { enum Message_type { eCommand_msg=0x01, //指令消息 eLocate_status_msg=0x11, //定位模块状态消息 eLocate_request_msg=0x12, //定位请求消息 eLocate_response_msg=0x13, //定位反馈消息 eHarware_statu_msg=0x21, //调度模块硬件状态消息 eExecute_request_msg=0x22, //请求调度消息 eExecute_response_msg=0x23, //调度结果反馈消息 }; // 子类必须把父类设定为友元函数,这样父类才能使用子类的私有构造函数。 friend class Singleton; private: // 父类的构造函数必须保护,子类的构造函数必须私有。 System_communication(); public: //必须关闭拷贝构造和赋值构造,只能通过 get_instance 函数来进行操作唯一的实例。 System_communication(const System_communication& other) = delete; System_communication& operator =(const System_communication& other) = delete; ~System_communication(); public://API functions //定时封装发送消息, 一般为心跳和状态信息, 需要子类重载 virtual Error_manager encapsulate_send_data(); public://get or set member variable protected://member variable private: }; #endif //NNXX_TESTS_SYSTEM_COMMUNICATION_H