|
@@ -2,7 +2,7 @@
|
|
|
* @Description: 车位分配算法模块,使用单例模式,接收外部请求并通过调用通信块接口发送反馈
|
|
|
* @Author: yct
|
|
|
* @Date: 2020-07-10 11:02:40
|
|
|
- * @LastEditTime: 2020-07-22 15:33:48
|
|
|
+ * @LastEditTime: 2020-07-22 17:15:43
|
|
|
* @LastEditors: yct
|
|
|
*/
|
|
|
|
|
@@ -292,6 +292,8 @@ void Parkspace_allocator::execute_for_search(message::Car_info car_info, int com
|
|
|
if(index<0){
|
|
|
t_error.set_error_code(PARKSPACE_ALLOCATOR_SEARCH_FAILED);
|
|
|
t_error.set_error_level(message::Error_level::MAJOR_ERROR);
|
|
|
+ // 默认第一个车位
|
|
|
+ t_car_position.CopyFrom(t_current_parkspace_status.parkspace_info(0));
|
|
|
LOG(INFO) << "查询车位失败";
|
|
|
}else{
|
|
|
t_error.set_error_code(SUCCESS);
|
|
@@ -357,6 +359,8 @@ void Parkspace_allocator::execute_for_release(message::Parkspace_info space_info
|
|
|
if(index<0){
|
|
|
t_error.set_error_code(PARKSPACE_ALLOCATOR_RELEASE_FAILED);
|
|
|
t_error.set_error_level(message::Error_level::MAJOR_ERROR);
|
|
|
+ // 传入默认车位信息
|
|
|
+ t_release_space.CopyFrom(space_info);
|
|
|
LOG(WARNING) << "释放车位失败";
|
|
|
}else{
|
|
|
t_error.set_error_code(SUCCESS);
|
|
@@ -426,6 +430,9 @@ void Parkspace_allocator::execute_for_force_update(message::Parkspace_info space
|
|
|
//!!!!!此处跳过外部处理与调用的过程,直接在内部调用,发送分配结果用于测试,目前一直发布第一个车位
|
|
|
message::Parkspace_force_update_response_msg response_msg;
|
|
|
message::Base_info t_response_header;
|
|
|
+ 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);
|
|
|
message::Error_manager t_error;
|
|
|
message::Parkspace_info t_update_space;
|
|
|
//获取当前所有车位状态,找到待释放的车位
|
|
@@ -451,6 +458,7 @@ void Parkspace_allocator::execute_for_force_update(message::Parkspace_info space
|
|
|
if(index<0){
|
|
|
t_error.set_error_code(PARKSPACE_ALLOCATOR_FORCE_UPDATE_FAILED);
|
|
|
t_error.set_error_level(message::Error_level::MAJOR_ERROR);
|
|
|
+ t_update_space.CopyFrom(space_info);
|
|
|
LOG(WARNING) << "手动更新车位失败";
|
|
|
}else{
|
|
|
t_error.set_error_code(SUCCESS);
|
|
@@ -484,6 +492,9 @@ void Parkspace_allocator::execute_for_confirm_alloc(message::Parkspace_info spac
|
|
|
//根据车位信息定位待确认占用车位
|
|
|
message::Parkspace_confirm_alloc_response_msg response_msg;
|
|
|
message::Base_info t_response_header;
|
|
|
+ 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);
|
|
|
message::Error_manager t_error;
|
|
|
message::Parkspace_info t_confirm_space;
|
|
|
//获取当前所有车位状态,找到待释放的车位
|
|
@@ -518,6 +529,7 @@ void Parkspace_allocator::execute_for_confirm_alloc(message::Parkspace_info spac
|
|
|
if(index<0){
|
|
|
t_error.set_error_code(PARKSPACE_ALLOCATOR_CONFIRM_ALLOC_ERROR);
|
|
|
t_error.set_error_level(message::Error_level::MAJOR_ERROR);
|
|
|
+ t_confirm_space.CopyFrom(space_info);
|
|
|
LOG(WARNING) << "确认占用车位失败";
|
|
|
}else{
|
|
|
t_error.set_error_code(SUCCESS);
|