1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- //
- // Created by huli on 2020/6/28.
- //
- #ifndef NNXX_TESTS_SYSTEM_COMMUNICATION_H
- #define NNXX_TESTS_SYSTEM_COMMUNICATION_H
- #include <process_message.pb.h>
- #include "../tool/singleton.h"
- #include "../communication/communication_socket_base.h"
- #include "terminal_message.pb.h"
- /*typedef Error_manager (*StoreCommandCallback)(message::Store_command_request_msg& msg,message::Store_command_response_msg& response);
- typedef Error_manager (*PickupCommandCallback)(message::Pickup_command_request_msg& msg,message::Pickup_command_response_msg& response);*/
- class System_communicator:public Singleton<System_communicator>, public Communication_socket_base
- {
- // 子类必须把父类设定为友元函数,这样父类才能使用子类的私有构造函数。
- friend class Singleton<System_communicator>;
- private:
- // 父类的构造函数必须保护,子类的构造函数必须私有。
- System_communicator();
- public:
- //必须关闭拷贝构造和赋值构造,只能通过 get_instance 函数来进行操作唯一的实例。
- System_communicator(const System_communicator& other) = delete;
- System_communicator& operator =(const System_communicator& other) = delete;
- Error_manager post_entrance_statu(message::Storing_process_statu_msg& msg);
- Error_manager post_entrance_statu(message::Picking_process_statu_msg& msg);
- ~System_communicator();
- protected:
- //重载函数
- virtual Error_manager encapsulate_msg(Communication_message* message);
- virtual Error_manager execute_msg(Communication_message* p_msg);
- /*
- * 检测消息是否可被处理
- */
- virtual Error_manager check_msg(Communication_message* p_msg);
- /*
- * 心跳发送函数,重载
- */
- virtual Error_manager encapsulate_send_data();
- //检查消息是否可以被解析, 需要重载
- virtual Error_manager check_executer(Communication_message* p_msg);
- private:
- /*StoreCommandCallback mp_store_command_callback; //收到停车请求回调函数
- PickupCommandCallback mp_pickup_command_callback; //收到取车指令后的回调函数*/
- };
- #endif //NNXX_TESTS_SYSTEM_COMMUNICATION_H
|