|
@@ -2,7 +2,7 @@
|
|
|
* @Description: 车位分配算法模块,使用单例模式,接收外部请求并通过调用通信块接口发送反馈
|
|
|
* @Author: yct
|
|
|
* @Date: 2020-07-10 11:02:40
|
|
|
- * @LastEditTime: 2020-07-22 19:21:03
|
|
|
+ * @LastEditTime: 2020-08-05 17:10:58
|
|
|
* @LastEditors: yct
|
|
|
*/
|
|
|
|
|
@@ -92,7 +92,7 @@ Error_manager Parkspace_allocator::execute_msg(Communication_message* p_msg)
|
|
|
}
|
|
|
//往线程池添加执行任务, 之后会唤醒一个线程去执行他.
|
|
|
m_thread_pool.enqueue(&Parkspace_allocator::execute_for_allocate, this,
|
|
|
- request.car_info(), request.terminal_id(), request.command_id());
|
|
|
+ request.car_info(), request.terminal_id(), request.command_info());
|
|
|
return SUCCESS;
|
|
|
}
|
|
|
// 车位查询请求消息
|
|
@@ -107,7 +107,7 @@ Error_manager Parkspace_allocator::execute_msg(Communication_message* p_msg)
|
|
|
" message::Parkspace_search_request_msg ParseFromString error ");
|
|
|
}
|
|
|
//往线程池添加执行任务, 之后会唤醒一个线程去执行他.
|
|
|
- m_thread_pool.enqueue(&Parkspace_allocator::execute_for_search, this, request.car_info(), request.command_id());
|
|
|
+ m_thread_pool.enqueue(&Parkspace_allocator::execute_for_search, this, request.car_info(), request.command_info());
|
|
|
return SUCCESS;
|
|
|
}
|
|
|
// 车位释放请求消息
|
|
@@ -122,7 +122,7 @@ Error_manager Parkspace_allocator::execute_msg(Communication_message* p_msg)
|
|
|
" message::Parkspace_release_request_msg ParseFromString error ");
|
|
|
}
|
|
|
//往线程池添加执行任务, 之后会唤醒一个线程去执行他.
|
|
|
- m_thread_pool.enqueue(&Parkspace_allocator::execute_for_release, this, request.release_space_info(), request.command_id());
|
|
|
+ m_thread_pool.enqueue(&Parkspace_allocator::execute_for_release, this, request.release_space_info(), request.command_info());
|
|
|
return SUCCESS;
|
|
|
}
|
|
|
// 车位手动更新请求消息
|
|
@@ -137,7 +137,7 @@ Error_manager Parkspace_allocator::execute_msg(Communication_message* p_msg)
|
|
|
" message::Parkspace_force_update_request_msg ParseFromString error ");
|
|
|
}
|
|
|
//往线程池添加执行任务, 之后会唤醒一个线程去执行他.
|
|
|
- m_thread_pool.enqueue(&Parkspace_allocator::execute_for_force_update, this, request.update_space_info(), request.command_id());
|
|
|
+ m_thread_pool.enqueue(&Parkspace_allocator::execute_for_force_update, this, request.update_space_info(), request.command_info());
|
|
|
return SUCCESS;
|
|
|
}
|
|
|
// 车位确认占用请求消息
|
|
@@ -152,7 +152,7 @@ Error_manager Parkspace_allocator::execute_msg(Communication_message* p_msg)
|
|
|
" message::Parkspace_force_update_request_msg ParseFromString error ");
|
|
|
}
|
|
|
//往线程池添加执行任务, 之后会唤醒一个线程去执行他.
|
|
|
- m_thread_pool.enqueue(&Parkspace_allocator::execute_for_confirm_alloc, this, request.confirm_space_info(), request.command_id());
|
|
|
+ m_thread_pool.enqueue(&Parkspace_allocator::execute_for_confirm_alloc, this, request.confirm_space_info(), request.command_info());
|
|
|
return SUCCESS;
|
|
|
}
|
|
|
}
|
|
@@ -178,7 +178,7 @@ Parkspace_allocator::parkspace_allocator_status Parkspace_allocator::get_parkspa
|
|
|
}
|
|
|
|
|
|
//分配车位线程函数
|
|
|
-void Parkspace_allocator::execute_for_allocate(message::Car_info car_info, int terminal_id, int command_id)
|
|
|
+void Parkspace_allocator::execute_for_allocate(message::Car_info car_info, int terminal_id, message::Command_info command_info)
|
|
|
{
|
|
|
std::lock_guard<std::mutex> lck(m_mutex);
|
|
|
LOG(INFO) << "分配";
|
|
@@ -246,7 +246,7 @@ void Parkspace_allocator::execute_for_allocate(message::Car_info car_info, int t
|
|
|
}
|
|
|
}
|
|
|
response_msg.mutable_base_info()->CopyFrom(t_response_header);
|
|
|
- response_msg.set_command_id(command_id);
|
|
|
+ response_msg.CopyFrom(command_info);
|
|
|
response_msg.mutable_error_manager()->CopyFrom(t_error);
|
|
|
response_msg.mutable_allocated_space_info()->CopyFrom(t_allocated_space);
|
|
|
Communication_message response=Communication_message();
|
|
@@ -255,7 +255,7 @@ void Parkspace_allocator::execute_for_allocate(message::Car_info car_info, int t
|
|
|
}
|
|
|
|
|
|
//查询车位线程函数
|
|
|
-void Parkspace_allocator::execute_for_search(message::Car_info car_info, int command_id)
|
|
|
+void Parkspace_allocator::execute_for_search(message::Car_info car_info, message::Command_info command_info)
|
|
|
{
|
|
|
std::lock_guard<std::mutex> lck(m_mutex);
|
|
|
LOG(INFO) << "查询";
|
|
@@ -306,7 +306,7 @@ void Parkspace_allocator::execute_for_search(message::Car_info car_info, int com
|
|
|
}
|
|
|
}
|
|
|
response_msg.mutable_base_info()->CopyFrom(t_response_header);
|
|
|
- response_msg.set_command_id(command_id);
|
|
|
+ response_msg.CopyFrom(command_info);
|
|
|
response_msg.mutable_error_manager()->CopyFrom(t_error);
|
|
|
response_msg.mutable_car_position()->CopyFrom(t_car_position);
|
|
|
Communication_message response=Communication_message();
|
|
@@ -315,7 +315,7 @@ void Parkspace_allocator::execute_for_search(message::Car_info car_info, int com
|
|
|
}
|
|
|
|
|
|
//释放车位线程函数
|
|
|
-void Parkspace_allocator::execute_for_release(message::Parkspace_info space_info, int command_id)
|
|
|
+void Parkspace_allocator::execute_for_release(message::Parkspace_info space_info, message::Command_info command_info)
|
|
|
{
|
|
|
std::lock_guard<std::mutex> lck(m_mutex);
|
|
|
LOG(INFO) << "释放";
|
|
@@ -415,7 +415,7 @@ void Parkspace_allocator::execute_for_release(message::Parkspace_info space_info
|
|
|
}
|
|
|
}
|
|
|
response_msg.mutable_base_info()->CopyFrom(t_response_header);
|
|
|
- response_msg.set_command_id(command_id);
|
|
|
+ response_msg.CopyFrom(command_info);
|
|
|
response_msg.mutable_error_manager()->CopyFrom(t_error);
|
|
|
response_msg.mutable_release_space_info()->CopyFrom(t_release_space);
|
|
|
Communication_message response=Communication_message();
|
|
@@ -424,7 +424,7 @@ void Parkspace_allocator::execute_for_release(message::Parkspace_info space_info
|
|
|
}
|
|
|
|
|
|
//强制更新车位信息线程函数
|
|
|
-void Parkspace_allocator::execute_for_force_update(message::Parkspace_info space_info, int command_id)
|
|
|
+void Parkspace_allocator::execute_for_force_update(message::Parkspace_info space_info, message::Command_info command_info)
|
|
|
{
|
|
|
std::lock_guard<std::mutex> lck(m_mutex);
|
|
|
LOG(INFO) << "手动";
|
|
@@ -479,7 +479,7 @@ void Parkspace_allocator::execute_for_force_update(message::Parkspace_info space
|
|
|
}
|
|
|
}
|
|
|
response_msg.mutable_base_info()->CopyFrom(t_response_header);
|
|
|
- response_msg.set_command_id(command_id);
|
|
|
+ response_msg.CopyFrom(command_info);
|
|
|
response_msg.mutable_error_manager()->CopyFrom(t_error);
|
|
|
response_msg.mutable_update_space_info()->CopyFrom(t_update_space);
|
|
|
Communication_message response=Communication_message();
|
|
@@ -488,7 +488,7 @@ void Parkspace_allocator::execute_for_force_update(message::Parkspace_info space
|
|
|
}
|
|
|
|
|
|
//确认分配车位线程函数
|
|
|
-void Parkspace_allocator::execute_for_confirm_alloc(message::Parkspace_info space_info, int command_id)
|
|
|
+void Parkspace_allocator::execute_for_confirm_alloc(message::Parkspace_info space_info, message::Command_info command_info)
|
|
|
{
|
|
|
std::lock_guard<std::mutex> lck(m_mutex);
|
|
|
LOG(INFO) << "确认分配";
|
|
@@ -575,7 +575,7 @@ void Parkspace_allocator::execute_for_confirm_alloc(message::Parkspace_info spac
|
|
|
}
|
|
|
}
|
|
|
response_msg.mutable_base_info()->CopyFrom(t_response_header);
|
|
|
- response_msg.set_command_id(command_id);
|
|
|
+ response_msg.CopyFrom(command_info);
|
|
|
response_msg.mutable_error_manager()->CopyFrom(t_error);
|
|
|
response_msg.mutable_confirm_alloc_space_info()->CopyFrom(t_confirm_space);
|
|
|
Communication_message response=Communication_message();
|