feature:
1.Add spdlog to save log file 2.Add program options to connect specific broadcast code and decide whether to save log file 3.Add comments in readme for windows 64-bit project compilation
This commit is contained in:
@@ -78,7 +78,7 @@ void CommandChannel::OnData(apr_socket_t *, void *) {
|
||||
apr_status_t rv = apr_socket_recvfrom(&addr, sock_, 0, reinterpret_cast<char *>(cache_buf), &size);
|
||||
comm_port_->UpdateCacheWrIdx(size);
|
||||
if (rv != APR_SUCCESS) {
|
||||
LOG_ERROR << PrintAPRStatus(rv) << std::endl;
|
||||
LOG_ERROR(PrintAPRStatus(rv));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -132,8 +132,8 @@ void CommandChannel::OnTimer(apr_time_t now) {
|
||||
}
|
||||
|
||||
for (list<Command>::iterator ite = timeout_commands.begin(); ite != timeout_commands.end(); ++ite) {
|
||||
LOG_WARN << PrintAPRTime(apr_time_now()) << " Command Timeout: Set " << (uint16_t)ite->packet.cmd_set << " Id "
|
||||
<< ite->packet.cmd_code << " Seq " << ite->packet.seq_num << std::endl;
|
||||
LOG_WARN("Apr time now: {}, Command Timeout: Set {}, Id {}, Seq {}", PrintAPRTime(apr_time_now()),
|
||||
(uint16_t)ite->packet.cmd_set, ite->packet.cmd_code, ite->packet.seq_num);
|
||||
if (callback_) {
|
||||
ite->packet.packet_type = kCommandTypeAck;
|
||||
callback_->OnCommand(handle_, *ite);
|
||||
@@ -230,6 +230,7 @@ void CommandChannel::DeviceDisconnect(uint8_t handle) {
|
||||
}
|
||||
|
||||
void CommandChannel::Send(const Command &command) {
|
||||
LOG_INFO(" Send Command: Set {} Id {} Seq {}", (uint16_t)command.packet.cmd_set, command.packet.cmd_code, command.packet.seq_num);
|
||||
SendInternal(command);
|
||||
commands_[command.packet.seq_num] = make_pair(command, apr_time_now() + apr_time_from_msec(command.time_out));
|
||||
Command &cmd = commands_[command.packet.seq_num].first;
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "command_handler.h"
|
||||
#include <boost/thread/lock_guard.hpp>
|
||||
#include <boost/thread/locks.hpp>
|
||||
#include "base/logging.h"
|
||||
#include "command_impl.h"
|
||||
#include "device_manager.h"
|
||||
#include "hub_command_handler.h"
|
||||
@@ -100,8 +101,10 @@ void CommandHandler::Uninit() {
|
||||
|
||||
void CommandHandler::OnCommand(uint8_t handle, const Command &command) {
|
||||
if (command.packet.packet_type == kCommandTypeAck) {
|
||||
LOG_INFO(" Recieve Ack: Set {} Id {} Seq {}", (uint16_t)command.packet.cmd_set, command.packet.cmd_code, command.packet.seq_num);
|
||||
OnCommandAck(handle, command);
|
||||
} else if (command.packet.packet_type == kCommandTypeMsg) {
|
||||
LOG_INFO(" Recieve Message: Set {} Id {} Seq {}", (uint16_t)command.packet.cmd_set, command.packet.cmd_code, command.packet.seq_num);
|
||||
OnCommandMsg(handle, command);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user