// // Created by huli on 2020/6/28. // #include "system_communication.h" System_communication::System_communication() { } System_communication::~System_communication() { } //定时封装发送消息, 一般为心跳和状态信息, 需要子类重载 Error_manager System_communication::encapsulate_send_data() { char buf[256] = {0}; static unsigned int t_heartbeat = 0; sprintf(buf, "Communication_socket_base, heartbeat = %d\0\0\0", t_heartbeat); t_heartbeat++; Binary_buf* tp_buf = new Binary_buf(buf, strlen(buf)+1);//+1是为了保证发送了结束符, 方便打印 bool is_push = m_send_data_list.push(tp_buf); if ( is_push == false ) { return Error_manager(Error_code::CONTAINER_IS_TERMINATE, Error_level::MINOR_ERROR, " Communication_socket_base::encapsulate_msg error "); } return Error_code::SUCCESS; }