|
@@ -2,7 +2,7 @@
|
|
|
* @Description: 车位分配算法模块,使用单例模式,接收外部请求并通过调用通信块接口发送反馈
|
|
|
* @Author: yct
|
|
|
* @Date: 2020-07-10 11:02:40
|
|
|
- * @LastEditTime: 2020-07-22 17:15:43
|
|
|
+ * @LastEditTime: 2020-07-22 19:21:03
|
|
|
* @LastEditors: yct
|
|
|
*/
|
|
|
|
|
@@ -205,9 +205,10 @@ void Parkspace_allocator::execute_for_allocate(message::Car_info car_info, int t
|
|
|
for (size_t i = 0; i < t_current_parkspace_status.parkspace_info_size(); i++)
|
|
|
{
|
|
|
// 找到高于车高且空闲车位,则分配
|
|
|
- if (/*t_current_parkspace_status.parkspace_info(i).height() > car_info.car_height()
|
|
|
- && t_current_parkspace_status.parkspace_info(i).width() > car_info.car_width()
|
|
|
- && */t_current_parkspace_status.parkspace_info(i).parkspace_status() == message::Parkspace_status::eParkspace_empty)
|
|
|
+ if (t_current_parkspace_status.parkspace_info(i).has_car_info()
|
|
|
+ /* && t_current_parkspace_status.parkspace_info(i).height() > car_info.car_height()
|
|
|
+ && t_current_parkspace_status.parkspace_info(i).width() > car_info.car_width() */
|
|
|
+ && t_current_parkspace_status.parkspace_info(i).parkspace_status() == message::Parkspace_status::eParkspace_empty)
|
|
|
{
|
|
|
index = i;
|
|
|
break;
|
|
@@ -324,6 +325,7 @@ void Parkspace_allocator::execute_for_release(message::Parkspace_info space_info
|
|
|
t_response_header.set_msg_type(message::eParkspace_release_response_msg);
|
|
|
t_response_header.set_sender(message::eParkspace);
|
|
|
t_response_header.set_receiver(message::eMain);
|
|
|
+ t_response_header.set_timeout_ms(1000);
|
|
|
message::Error_manager t_error;
|
|
|
message::Parkspace_info t_release_space;
|
|
|
//获取当前所有车位状态,找到待释放的车位
|
|
@@ -433,6 +435,7 @@ void Parkspace_allocator::execute_for_force_update(message::Parkspace_info space
|
|
|
t_response_header.set_msg_type(message::eParkspace_force_update_response_msg);
|
|
|
t_response_header.set_sender(message::eParkspace);
|
|
|
t_response_header.set_receiver(message::eMain);
|
|
|
+ t_response_header.set_timeout_ms(1000);
|
|
|
message::Error_manager t_error;
|
|
|
message::Parkspace_info t_update_space;
|
|
|
//获取当前所有车位状态,找到待释放的车位
|
|
@@ -495,6 +498,7 @@ void Parkspace_allocator::execute_for_confirm_alloc(message::Parkspace_info spac
|
|
|
t_response_header.set_msg_type(message::eParkspace_confirm_alloc_response_msg);
|
|
|
t_response_header.set_sender(message::eParkspace);
|
|
|
t_response_header.set_receiver(message::eMain);
|
|
|
+ t_response_header.set_timeout_ms(1000);
|
|
|
message::Error_manager t_error;
|
|
|
message::Parkspace_info t_confirm_space;
|
|
|
//获取当前所有车位状态,找到待释放的车位
|