Forráskód Böngészése

db license gibberish debug. four request test.

youchen 4 éve
szülő
commit
8a1d592eeb

+ 9 - 9
parkspace_allocation/database_controller.cpp

@@ -2,7 +2,7 @@
  * @Description: 数据库操作类
  * @Author: yct
  * @Date: 2020-07-15 14:08:46
- * @LastEditTime: 2020-07-19 10:28:11
+ * @LastEditTime: 2020-07-22 14:57:47
  * @LastEditors: yct
  */
 
@@ -102,13 +102,13 @@ Error_manager Database_controller::sql_insert(std::string sql_str)
             catch (sql::SQLException &e)
             {
                 /* Use what() (derived from std::runtime_error) to fetch the error message */
-                sprintf(buf, "# ERR: %s\n (MySQL error code: %d, SQLState: %s", e.what(), e.getErrorCode(), e.getSQLState().c_str());
+                sprintf(buf, "# ERR: %s\n (MySQL error code: %d, SQLState: %s\nsql: %s", e.what(), e.getErrorCode(), e.getSQLState().c_str(), sql_str.c_str());
                 usleep(1000* 3000);
                 return Error_manager(DB_INSERT_FAILED, NEGLIGIBLE_ERROR, buf);
             }
             catch (std::runtime_error &e)
             {
-                sprintf(buf, "# ERR: %s\n ERR: runtime_error in  %s ",e.what(),__FILE__);
+                sprintf(buf, "# ERR: %s\n ERR: runtime_error in  %s \nsql: %s",e.what(),__FILE__, sql_str.c_str());
                 return Error_manager(DB_INSERT_FAILED, NEGLIGIBLE_ERROR, buf);
             }
             // catch (std::exception &e)
@@ -163,12 +163,12 @@ Error_manager Database_controller::sql_delete(std::string sql_str)
             catch (sql::SQLException &e)
             {
                 /* Use what() (derived from std::runtime_error) to fetch the error message */
-                sprintf(buf, "# ERR: %s\n (MySQL error code: %d, SQLState: %s", e.what(), e.getErrorCode(), e.getSQLState().c_str());
+                sprintf(buf, "# ERR: %s\n (MySQL error code: %d, SQLState: %s\nsql: %s", e.what(), e.getErrorCode(), e.getSQLState().c_str(), sql_str.c_str());
                 return Error_manager(DB_DELETE_FAILED, NEGLIGIBLE_ERROR, buf);
             }
             catch (std::runtime_error &e)
             {
-                sprintf(buf, "# ERR: %s\n ERR: runtime_error in  %s ",e.what(),__FILE__);
+                sprintf(buf, "# ERR: %s\n ERR: runtime_error in  %s \nsql: %s",e.what(),__FILE__, sql_str.c_str());
                 return Error_manager(DB_DELETE_FAILED, NEGLIGIBLE_ERROR, buf);
             }
         }
@@ -225,12 +225,12 @@ Error_manager Database_controller::sql_update(std::string sql_str)
             catch (sql::SQLException &e)
             {
                 /* Use what() (derived from std::runtime_error) to fetch the error message */
-                sprintf(buf, "# ERR: %s\n (MySQL error code: %d, SQLState: %s", e.what(), e.getErrorCode(), e.getSQLState().c_str());
+                sprintf(buf, "# ERR: %s\n (MySQL error code: %d, SQLState: %s\nsql: %s", e.what(), e.getErrorCode(), e.getSQLState().c_str(), sql_str.c_str());
                 return Error_manager(DB_UPDATE_FAILED, NEGLIGIBLE_ERROR, buf);
             }
             catch (std::runtime_error &e)
             {
-                sprintf(buf, "# ERR: %s\n ERR: runtime_error in  %s ",e.what(),__FILE__);
+                sprintf(buf, "# ERR: %s\n ERR: runtime_error in  %s \nsql: %s",e.what(),__FILE__, sql_str.c_str());
                 return Error_manager(DB_UPDATE_FAILED, NEGLIGIBLE_ERROR, buf);
             }
         }
@@ -288,12 +288,12 @@ Error_manager Database_controller::sql_query(std::string sql_str, boost::shared_
             catch (sql::SQLException &e)
             {
                 /* Use what() (derived from std::runtime_error) to fetch the error message */
-                sprintf(buf, "# ERR: %s\n (MySQL error code: %d, SQLState: %s", e.what(), e.getErrorCode(), e.getSQLState().c_str());
+                sprintf(buf, "# ERR: %s\n (MySQL error code: %d, SQLState: %s\nsql: %s", e.what(), e.getErrorCode(), e.getSQLState().c_str(), sql_str.c_str());
                 return Error_manager(DB_UPDATE_FAILED, NEGLIGIBLE_ERROR, buf);
             }
             catch (std::runtime_error &e)
             {
-                sprintf(buf, "# ERR: %s\n ERR: runtime_error in  %s ",e.what(),__FILE__);
+                sprintf(buf, "# ERR: %s\n ERR: runtime_error in  %s \nsql: %s",e.what(),__FILE__, sql_str.c_str());
                 return Error_manager(DB_UPDATE_FAILED, NEGLIGIBLE_ERROR, buf);
             }
         }else{

+ 3 - 3
parkspace_allocation/parkspace_allocation_communicator.cpp

@@ -58,9 +58,9 @@ Error_manager Parkspace_allocation_communicator::encapsulate_msg(Communication_m
     {
         case Communication_message::eParkspace_allocation_response_msg:
         {
-            message::Parkspace_allocation_response_msg response;
-            bool result = response.ParseFromString(message->get_message_buf());
-            //可增加待发送分配车位反馈消息校核
+            // message::Parkspace_allocation_response_msg response;
+            // bool result = response.ParseFromString(message->get_message_buf());
+            // //可增加待发送分配车位反馈消息校核
             break;
         }
         case Communication_message::eParkspace_search_response_msg:

+ 26 - 18
parkspace_allocation/parkspace_allocator.cpp

@@ -2,7 +2,7 @@
  * @Description: 车位分配算法模块,使用单例模式,接收外部请求并通过调用通信块接口发送反馈
  * @Author: yct
  * @Date: 2020-07-10 11:02:40
- * @LastEditTime: 2020-07-21 18:15:51
+ * @LastEditTime: 2020-07-22 15:33:48
  * @LastEditors: yct
  */ 
 
@@ -32,9 +32,16 @@ Error_manager Parkspace_allocator::parkspace_allocator_init(int threads_size, pa
     {
         return ec;
     }
-    m_current_status = eParkspace_allocator_normal;
     // 初始化任务处理线程池
 	m_thread_pool.thread_pool_init(threads_size);
+    // 读数据库车位数据,初始化车位管理
+    message::Parkspace_allocation_status_msg all_parkspace_info;
+    ec = mp_db_manager->get_all_parkspace_info(all_parkspace_info);
+    if(ec != SUCCESS)
+    {
+        return ec;
+    }
+    Parkspace_allocation_communicator::get_instance_references().update_parkspace_status(all_parkspace_info);
 	m_current_status = eParkspace_allocator_normal;
 	return Error_code::SUCCESS;
 }
@@ -145,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_force_update, 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_id());
             return SUCCESS;
         }
 	}
@@ -195,13 +202,12 @@ void Parkspace_allocator::execute_for_allocate(message::Car_info car_info, int t
     }
     else
     {
-        
         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() 
+            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)
+            && */t_current_parkspace_status.parkspace_info(i).parkspace_status() == message::Parkspace_status::eParkspace_empty)
             {
                 index = i;
                 break;
@@ -212,6 +218,7 @@ void Parkspace_allocator::execute_for_allocate(message::Car_info car_info, int t
             t_error.set_error_code(PARKSPACE_ALLOCATOR_ALLOCATE_FAILED);
             t_error.set_error_level(message::Error_level::MAJOR_ERROR);
             t_allocated_space.CopyFrom(t_current_parkspace_status.parkspace_info(0));
+            t_allocated_space.mutable_car_info()->CopyFrom(car_info);
             LOG(WARNING) << "分配车位失败";
         }else{
             t_error.set_error_code(SUCCESS);
@@ -222,18 +229,18 @@ void Parkspace_allocator::execute_for_allocate(message::Car_info car_info, int t
             t_allocated_space.CopyFrom(t_space_to_lock);
             // 分配车位后更新车位状态
             Parkspace_allocation_communicator::get_instance_references().update_parkspace_status(index, t_space_to_lock);
-            LOG(INFO) << "第"<<index<<"号位占用, id: "<<t_space_to_lock.parkspace_id();
+            LOG(INFO) << "第"<<index<<"号位占用, id: "<<t_space_to_lock.parkspace_id()<<", 号牌: "<<t_space_to_lock.car_info().license();
             // 数据库操作,修改车位状态为锁定,车辆状态为停车中
             message::Vehicle_status t_vehicle_status = message::Vehicle_status::eVehicle_parking;
             Error_manager ec = Parkspace_db_manager::get_instance_references().update_parkspace_status(t_space_to_lock);
             if(ec != SUCCESS)
             {
-                LOG(ERROR) << "更新db车位状态失败";
+                LOG(ERROR) << "更新db车位状态失败: "<< ec.to_string();
             }
             ec = Parkspace_db_manager::get_instance_references().update_vehicle_status(t_space_to_lock, t_vehicle_status);
             if (ec != SUCCESS)
             {
-                LOG(ERROR) << "更新db车辆状态失败";
+                LOG(ERROR) << "更新db车辆状态失败: " <<ec.to_string();
             }
         }
     }
@@ -366,19 +373,19 @@ void Parkspace_allocator::execute_for_release(message::Parkspace_info space_info
             Error_manager ec = Parkspace_db_manager::get_instance_references().update_parkspace_status(t_space_to_release);
             if(ec != SUCCESS)
             {
-                LOG(ERROR) << "更新db车位状态失败";
+                LOG(ERROR) << "更新db车位状态失败: "<< ec.to_string();
             }
             message::Vehicle_status t_vehicle_status = message::Vehicle_status::eVehicle_idle;
             ec = Parkspace_db_manager::get_instance_references().update_vehicle_status(t_space_to_release, t_vehicle_status);
             if(ec != SUCCESS)
             {
-                LOG(ERROR) << "更新db车辆状态失败";
+                LOG(ERROR) << "更新db车辆状态失败: "<< ec.to_string();
             }
             int t_park_record_id;
             ec = Parkspace_db_manager::get_instance_references().query_vehicle(t_space_to_release.car_info().license(), t_vehicle_status, t_park_record_id);
             if(ec != SUCCESS)
             {
-                LOG(ERROR) << "查询db车辆状态失败";
+                LOG(ERROR) << "查询db车辆状态失败: "<< ec.to_string();
             }else if(t_vehicle_status == message::Vehicle_status::eVehicle_in_garage)
             {
                 time_t tt = time(NULL);
@@ -396,7 +403,7 @@ void Parkspace_allocator::execute_for_release(message::Parkspace_info space_info
                 ec = Parkspace_db_manager::get_instance_references().update_parking_record(t_space_to_release, t_park_record_id);
                 if(ec != SUCCESS)
                 {
-                    LOG(ERROR) << "更新db停车记录失败";
+                    LOG(ERROR) << "更新db停车记录失败: "<< ec.to_string();
                 }
             }
         }
@@ -456,7 +463,7 @@ void Parkspace_allocator::execute_for_force_update(message::Parkspace_info space
             Error_manager ec = Parkspace_db_manager::get_instance_references().update_parkspace_status(t_update_space);
             if(ec != SUCCESS)
             {
-                LOG(ERROR) << "更新db车位状态失败";
+                LOG(ERROR) << "更新db车位状态失败: "<< ec.to_string();
             }
         }
     }
@@ -498,8 +505,9 @@ void Parkspace_allocator::execute_for_confirm_alloc(message::Parkspace_info spac
     {
         for (size_t i = 0; i < t_current_parkspace_status.parkspace_info_size(); i++)
         {
-            // 找到相同车位,车辆信息匹配
+            // 找到相同车位,车辆信息匹配,且车位为锁定状态
             if (t_current_parkspace_status.parkspace_info(i).parkspace_id() == space_info.parkspace_id()
+                && t_current_parkspace_status.parkspace_info(i).parkspace_status() == message::Parkspace_status::eParkspace_locked
                 && t_current_parkspace_status.parkspace_info(i).has_car_info()
                 && t_current_parkspace_status.parkspace_info(i).car_info().license() == space_info.car_info().license())
             {
@@ -535,18 +543,18 @@ void Parkspace_allocator::execute_for_confirm_alloc(message::Parkspace_info spac
             Error_manager ec = Parkspace_db_manager::get_instance_references().update_parkspace_status(t_confirm_space);
             if(ec != SUCCESS)
             {
-                LOG(ERROR) << "更新db车位状态失败";
+                LOG(ERROR) << "更新db车位状态失败: "<< ec.to_string();
             }
             ec = Parkspace_db_manager::get_instance_references().insert_parking_record(t_confirm_space);
             if(ec != SUCCESS)
             {
-                LOG(ERROR) << "插入db停车记录失败";
+                LOG(ERROR) << "插入db停车记录失败: "<< ec.to_string();
             }
             message::Vehicle_status t_vehicle_status = message::Vehicle_status::eVehicle_in_garage;
             ec = Parkspace_db_manager::get_instance_references().update_vehicle_status(t_confirm_space, t_vehicle_status);
             if(ec != SUCCESS)
             {
-                LOG(ERROR) << "更新db车辆状态失败";
+                LOG(ERROR) << "更新db车辆状态失败: "<< ec.to_string();
             }
         }
     }

+ 10 - 8
parkspace_allocation/parkspace_db_manager.cpp

@@ -2,7 +2,7 @@
  * @Description: 车位数据库管理
  * @Author: yct
  * @Date: 2020-07-19 09:57:45
- * @LastEditTime: 2020-07-21 17:58:53
+ * @LastEditTime: 2020-07-22 15:13:17
  * @LastEditors: yct
  */
 
@@ -117,6 +117,8 @@ Error_manager Parkspace_db_manager::get_all_parkspace_info(message::Parkspace_al
                         t_parkspace->set_parkspace_status(message::Parkspace_status::eParkspace_error);
                         break;
                     }
+                    t_parkspace->set_width(tp_result->getDouble("parkSpaceWidth"));
+                    t_parkspace->set_width(tp_result->getDouble("parkSpaceHeight"));
                     t_parkspace->mutable_car_info()->set_license(tp_result->getString("parkSpaceCarLicense"));
                     t_parkspace->mutable_car_info()->set_car_length(tp_result->getDouble("parkSpaceCarLength"));
                     t_parkspace->mutable_car_info()->set_car_width(tp_result->getDouble("parkSpaceCarWidth"));
@@ -265,18 +267,18 @@ Error_manager Parkspace_db_manager::update_vehicle_status(message::Parkspace_inf
                         parkspace_info.car_info().car_length(),
                         parkspace_info.car_info().car_width(),
                         parkspace_info.car_info().car_height(),
-                        parkspace_info.car_info().license());
+                        parkspace_info.car_info().license().c_str());
             }
             //车位不为空,表示车辆所在车位,同时更新
             else
             {
-                 sprintf(update_vehicle_sql, "update vehicle set vehicleParkState = %d,carLength=%.3f,carWidth=%.3f,carHeight=%.3fparkingSpaceID=%d where numberPlate = '%s'", 
+                 sprintf(update_vehicle_sql, "update vehicle set vehicleParkState = %d,carLength=%.3f,carWidth=%.3f,carHeight=%.3f,parkingSpaceID=%d where numberPlate = '%s'", 
                         vehicle_status_code,
                         parkspace_info.car_info().car_length(),
                         parkspace_info.car_info().car_width(),
                         parkspace_info.car_info().car_height(),
                         parkspace_info.parkspace_id(),
-                        parkspace_info.car_info().license());
+                        parkspace_info.car_info().license().c_str());
             }
             if (vehicle_status_code < 0)
                 return ERROR;
@@ -330,7 +332,7 @@ Error_manager Parkspace_db_manager::insert_vehicle(message::Parkspace_info parks
         if(parkspace_info.parkspace_id() <= 0)
         {
             sprintf(insert_vehicle_sql, "INSERT INTO vehicle (numberPlate,vehicleParkState,carLength,carWidth,carHeight) values ('%s',%d,%.3f,%.3f,%.3f)", 
-                    parkspace_info.car_info().license(),
+                    parkspace_info.car_info().license().c_str(),
                     vehicle_status_code,
                     parkspace_info.car_info().car_length(),
                     parkspace_info.car_info().car_width(),
@@ -340,7 +342,7 @@ Error_manager Parkspace_db_manager::insert_vehicle(message::Parkspace_info parks
         else
         {
             sprintf(insert_vehicle_sql, "INSERT INTO vehicle (numberPlate,vehicleParkState,carLength,carWidth,carHeight,parkingSpaceID) values ('%s',%d,%.3f,%.3f,%.3f,%d)", 
-                parkspace_info.car_info().license(),
+                parkspace_info.car_info().license().c_str(),
                 vehicle_status_code,
                 parkspace_info.car_info().car_length(),
                 parkspace_info.car_info().car_width(),
@@ -375,7 +377,7 @@ Error_manager Parkspace_db_manager::insert_parking_record(message::Parkspace_inf
         memset(insert_parking_record_sql, 0, 1024);
         //将车辆号牌,车位ID,记录状态,停车与取车时间写入
             sprintf(insert_parking_record_sql, "INSERT INTO parkingrecords (numberPlate,parkingSpaceID,realParkTime) values ('%s',%d,'%s')", 
-                    parkspace_info.car_info().license(),
+                    parkspace_info.car_info().license().c_str(),
                     parkspace_info.parkspace_id(),
                     parkspace_info.entry_time().c_str());
         Error_manager ec = mp_db_controller->sql_insert(insert_parking_record_sql);
@@ -403,7 +405,7 @@ Error_manager Parkspace_db_manager::update_parking_record(message::Parkspace_inf
         char update_parking_record_sql[1024];
         memset(update_parking_record_sql, 0, 1024);
         sprintf(update_parking_record_sql, "update parkingrecords set realGetTime='%s',parkingPrice=%d where parkingRecordsID = %d",
-                parkspace_info.leave_time(),
+                parkspace_info.leave_time().c_str(),
                 0,
                 record_id);
         Error_manager ec = mp_db_controller->sql_update(update_parking_record_sql);

+ 59 - 15
test/parkspace_client.cpp

@@ -2,7 +2,7 @@
  * @Description: 模拟主程序发送车位分配请求,并监听状态信息
  * @Author: yct
  * @Date: 2020-07-08 15:44:43
- * @LastEditTime: 2020-07-10 17:06:26
+ * @LastEditTime: 2020-07-22 15:28:22
  * @LastEditors: yct
  */
 
@@ -80,7 +80,7 @@ std::string send_release_request(int n)
     car_info.set_car_height(1.5);
     car_info.set_car_width(1.85);
     car_info.set_license("鄂A12345");
-    space_info.set_parkspace_id(1);
+    space_info.set_parkspace_id(5);
     space_info.set_index(1);
     space_info.set_direction(message::Direction::eForward);
     space_info.set_floor(33);
@@ -97,11 +97,44 @@ std::string send_release_request(int n)
     return request.SerializeAsString();
 }
 
+std::string send_confirm_request(int n)
+{
+    // 发送车位释放请求
+    message::Error_manager error_code;
+    message::Base_info base_info;
+    message::Car_info car_info;
+    message::Parkspace_info space_info;
+    message::Parkspace_confirm_alloc_request_msg request;
+
+    base_info.set_msg_type(message::Message_type::eParkspace_confirm_alloc_request_msg);
+    base_info.set_sender(message::eMain);
+    base_info.set_receiver(message::eParkspace);
+    base_info.set_timeout_ms(2000);
+    car_info.set_car_height(1.5);
+    car_info.set_car_width(1.85);
+    car_info.set_license("鄂A12345");
+    space_info.set_parkspace_id(1);
+    space_info.set_index(1);
+    space_info.set_direction(message::Direction::eForward);
+    space_info.set_floor(33);
+    space_info.set_width(1.5);
+    space_info.set_height(1.5);
+    space_info.set_parkspace_status(message::Parkspace_status::eParkspace_occupied);
+    space_info.mutable_car_info()->CopyFrom(car_info);
+
+    request.mutable_base_info()->CopyFrom(base_info);
+    request.set_command_id(n);
+    request.mutable_confirm_space_info()->CopyFrom(space_info);
+
+    // socket.send(request.SerializeAsString());
+    return request.SerializeAsString();
+}
+
 int main()
 {
     nnxx::socket socket{nnxx::SP, nnxx::BUS};
     // socket.bind("tcp://127.0.0.1:7000");
-    socket.connect("tcp://192.168.2.108:7001");
+    socket.connect("tcp://127.0.01:7001");
     int n = 0;
     message::Base_msg base_msg;
 
@@ -109,26 +142,30 @@ int main()
 
     std::string alloc_req = send_allocation_request(1);
     socket.send(alloc_req);
-    alloc_req = send_allocation_request(1);
-    socket.send(alloc_req);
-    // std::string alloc_req = send_allocation_request(2);
+    // alloc_req = send_allocation_request(2);
+    // socket.send(alloc_req);
+    // alloc_req = send_allocation_request(3);
     // socket.send(alloc_req);
-    // std::string alloc_req = send_allocation_request(3);
+    // alloc_req = send_allocation_request(4);
     // socket.send(alloc_req);
-    // std::string alloc_req = send_allocation_request(4);
+    // alloc_req = send_allocation_request(5);
     // socket.send(alloc_req);
+
+    std::string confirm_req = send_confirm_request(1);
+    socket.send(confirm_req);
     
-    std::string search_req = send_search_requests(2);
+    std::string search_req = send_search_requests(1);
     socket.send(search_req);
-    std::string release_req = send_release_request(2);
-    socket.send(release_req);
 
-    usleep(1000*200);
-    search_req = send_search_requests(3);
-    socket.send(search_req);
-    release_req = send_release_request(3);
+    std::string release_req = send_release_request(1);
     socket.send(release_req);
 
+    // usleep(1000*200);
+    // search_req = send_search_requests(3);
+    // socket.send(search_req);
+    // release_req = send_release_request(3);
+    // socket.send(release_req);
+
     while (1)
     {
         // std::string alloc_req = send_allocation_request(n);
@@ -183,6 +220,13 @@ int main()
                     std::cout << "----------------- 释放车位结果 -----------------" << std::endl;
                     std::cout << response.DebugString() << std::endl;
                 }
+                else if (base_msg.base_info().msg_type() == message::Message_type::eParkspace_confirm_alloc_response_msg)
+                {
+                    message::Parkspace_confirm_alloc_response_msg response;
+                    response.ParseFromString(t_receive_string);
+                    std::cout << "----------------- 确认占用车位结果 -----------------" << std::endl;
+                    std::cout << response.DebugString() << std::endl;
+                }
             }
         }
 

+ 27 - 26
test/test_parkspace_sample.cpp

@@ -2,7 +2,7 @@
  * @Description: 测试车位分配模块通信情况
  * @Author: yct
  * @Date: 2020-07-08 15:51:46
- * @LastEditTime: 2020-07-21 18:16:10
+ * @LastEditTime: 2020-07-22 14:17:07
  * @LastEditors: yct
  */ 
 #include "../parkspace_allocation/parkspace_allocation_communicator.h"
@@ -26,34 +26,35 @@ int main()
     config.set_db_name("test");
     config.set_db_conn_pool_size(5);
     p_parkspace_allocator->parkspace_allocator_init(4, config);
-    p_parkspace_allocation_communicater->communication_bind("tcp://192.168.2.125:7001");
+    p_parkspace_allocation_communicater->communication_bind("tcp://127.0.0.1:7001");
+    // p_parkspace_allocation_communicater->communication_bind("tcp://192.168.2.125:7001");
     // p_parkspace_allocation_communicater->communication_connect("tcp://127.0.0.1:7000");
     p_parkspace_allocation_communicater->communication_run();
 
-    // 初始化车位,创建三个车位
-    message::Parkspace_allocation_status_msg parkspace_status;
-    for (size_t i = 1; i < 1000; i++)
-    {
-        message::Parkspace_info* space = parkspace_status.add_parkspace_info();
-        space->set_parkspace_id(i);
-        space->set_index(i);
-        space->set_direction(message::Direction::eForward);
-        space->set_floor(2+i);
-        space->set_length(5.5);
-        space->set_width(2.2);
-        space->set_height(1.75);
-        space->set_parkspace_status(message::Parkspace_status::eParkspace_empty);
-    }
-    message::Base_info base_msg;
-    message::Error_manager error;
-    base_msg.set_msg_type(message::Message_type::eParkspace_allocation_response_msg);
-    base_msg.set_timeout_ms(1000);
-    base_msg.set_sender(message::Communicator::eParkspace);
-    base_msg.set_receiver(message::Communicator::eMain);
-    error.set_error_code(0);
-    parkspace_status.mutable_base_info()->CopyFrom(base_msg);
-    parkspace_status.mutable_error_manager()->CopyFrom(error);
-    p_parkspace_allocation_communicater->update_parkspace_status(parkspace_status);
+    // // 初始化车位,创建三个车位
+    // message::Parkspace_allocation_status_msg parkspace_status;
+    // for (size_t i = 1; i < 1000; i++)
+    // {
+    //     message::Parkspace_info* space = parkspace_status.add_parkspace_info();
+    //     space->set_parkspace_id(i);
+    //     space->set_index(i);
+    //     space->set_direction(message::Direction::eForward);
+    //     space->set_floor(2+i);
+    //     space->set_length(5.5);
+    //     space->set_width(2.2);
+    //     space->set_height(1.75);
+    //     space->set_parkspace_status(message::Parkspace_status::eParkspace_empty);
+    // }
+    // message::Base_info base_msg;
+    // message::Error_manager error;
+    // base_msg.set_msg_type(message::Message_type::eParkspace_allocation_response_msg);
+    // base_msg.set_timeout_ms(1000);
+    // base_msg.set_sender(message::Communicator::eParkspace);
+    // base_msg.set_receiver(message::Communicator::eMain);
+    // error.set_error_code(0);
+    // parkspace_status.mutable_base_info()->CopyFrom(base_msg);
+    // parkspace_status.mutable_error_manager()->CopyFrom(error);
+    // p_parkspace_allocation_communicater->update_parkspace_status(parkspace_status);
     int k=1;
 
     while(1) {