Procházet zdrojové kódy

20210812 更新底层消息与工具库,系统初始化状态判断

yct před 3 roky
rodič
revize
2259177843

+ 151 - 0
.gitignore

@@ -0,0 +1,151 @@
+#################
+## Eclipse
+
+*.pydevproject
+.project
+.metadata
+bin/
+tmp/
+*.tmp
+*.bak
+*.swp
+.idea
+*~.nib
+local.properties
+.classpath
+.settings/
+.loadpath
+# External tool builders
+.externalToolBuilders/
+# Locally stored "Eclipse launch configurations"
+*.launch
+# CDT-specific
+.cproject
+# PDT-specific
+.buildpath
+## Visual Studio
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+# User-specific files
+*.suo
+*.user
+*.sln.docstates
+# Build results
+[Dd]ebug/
+[Rr]elease/
+*_i.c
+*_p.c
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.vspscc
+.builds
+*.dotCover
+## TODO: If you have NuGet Package Restore enabled, uncomment this
+#packages/
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+# Visual Studio profiler
+*.psess
+*.vsp
+# ReSharper is a .NET coding add-in
+_ReSharper*
+# Installshield output folder
+[Ee]xpress
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+# Click-Once directory
+publish
+# Others
+[Bb]in
+[Oo]bj
+sql
+TestResults
+*.Cache
+ClientBin
+stylecop.*
+~$*
+*.dbmdl
+Generated_Code #added for RIA/Silverlight projects
+# Backup & report files from converting an old project file to a newer
+# Visual Studio version. Backup files are not needed, because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+############
+## Windows
+# Windows image file caches
+Thumbs.db
+# Folder config file
+Desktop.ini
+#############
+## Python
+*.py[co]
+# Packages
+*.egg
+*.egg-info
+dist
+build
+eggs
+parts
+bin
+var
+sdist
+develop-eggs
+.installed.cfg
+# Installer logs
+pip-log.txt
+# Unit test / coverage reports
+.coverage
+.tox
+#Translations
+*.mo
+#Mr Developer
+.mr.developer.cfg
+# Mac crap
+.DS_Store
+/build_64bits_msvc10/
+/test/
+private_plugins
+/data/
+/misc/
+CCCoreLibExport.h
+/.vs/CloudCompare/v15
+/.vs/ProjectSettings.json
+/.vs/slnx.sqlite
+/.vs
+.vscode
+/CMakeSettings.json
+#VS2019 default cmake build & install paths
+/out/
+*.cfg
+*.pb
+*ckpt*
+*.weights
+*.pb*
+*.prototxt
+
+build/**
+cmake-build-debug/**
+
+

+ 1 - 1
CMakeLists.txt

@@ -3,7 +3,7 @@ project(nnxx_tests)
 cmake_minimum_required(VERSION 3.5)
 
 set (CMAKE_CXX_STANDARD 11)
-set(PCL_DIR "/home/youchen/pcl-1.8/share/pcl-1.8")
+#set(PCL_DIR "/home/youchen/pcl-1.8/share/pcl-1.8")
 find_package(PkgConfig REQUIRED)
 pkg_check_modules(nanomsg REQUIRED nanomsg)
 FIND_PACKAGE(Protobuf REQUIRED)

+ 4 - 2
communication/communication_message.cpp

@@ -44,8 +44,6 @@ Communication_message::~Communication_message()
 
 bool Communication_message::is_over_time()
 {
-//	std::cout<<"interval: "<<std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - m_receive_time).count()<<std::endl;
-//	std::cout<<"timeout: "<<m_timeout_ms.count()<<std::endl;
 	if ( std::chrono::system_clock::now() - m_receive_time > m_timeout_ms)
 	{
 	    return true;
@@ -85,6 +83,10 @@ std::string& Communication_message::get_message_buf()
 	return m_message_buf;
 }
 
+std::chrono::system_clock::time_point Communication_message::get_receive_time()
+{
+	return m_receive_time;
+}
 
 
 

+ 71 - 37
communication/communication_message.h

@@ -25,52 +25,85 @@ public:
 		eBase_msg=0x00,
 		eCommand_msg=0x01,                      //指令消息
 
+
 		eLocate_status_msg=0x11,                //定位模块状态消息
 		eLocate_request_msg=0x12,               //定位请求消息
 		eLocate_response_msg=0x13,              //定位反馈消息
 
-        eDispatch_status_msg=0x21,                //调度模块硬件状态消息
-        eDispatch_request_msg=0x22,              //请求调度消息
-        eDispatch_response_msg=0x23,             //调度结果反馈消息
-
-        eParkspace_allocation_status_msg = 0x31,   //车位分配模块状态消息,包括车位信息
-        eParkspace_allocation_request_msg = 0x32,  //请求分配车位消息
-        eParkspace_allocation_response_msg = 0x33, //分配车位结果反馈消息
-        eParkspace_search_request_msg = 0x34,    //查询车位请求消息
-        eParkspace_search_response_msg = 0x35,    //查询车位反馈消息
-        eParkspace_release_request_msg = 0x36,    //释放车位请求消息
-        eParkspace_release_response_msg = 0x37,    //释放车位反馈消息
-        eParkspace_force_update_request_msg = 0x38,	//手动修改车位消息
-        eParkspace_force_update_response_msg = 0x39,//手动修改车位反馈消息
-        eParkspace_confirm_alloc_request_msg = 0x3A,//确认分配车位请求消息
-        eParkspace_confirm_alloc_response_msg = 0x3B,//确认分配车位反馈消息
-		eParkspace_refresh_request_msg = 0x3C,//更新车位数据请求消息
-		eParkspace_allocation_data_response_msg =0x3D,//车位数据反馈消息
-
-        eStore_command_request_msg=0x41,                    //终端停车请求消息
-        eStore_command_response_msg=0x42,                   //停车请求反馈消息
-        ePickup_command_request_msg=0x43,                   //取车请求消息
-        ePickup_command_response_msg=0x44,                  //取车请求反馈消息
-
-        eStoring_process_statu_msg=0x90,                    //停车进度条消息
-        ePicking_process_statu_msg=0x91,                    //取车进度消息
-
-        eCentral_controller_statu_msg=0xa0,                 //中控状态消息
-
-        eEntrance_manual_operation_msg=0xb0,            //针对出入口状态操作的手动消息
-        eProcess_manual_operation_msg=0xb1,
+		eLocate_sift_request_msg = 0x14,            //预测算法请求消息
+		eLocate_sift_response_msg = 0x15,           //预测算法反馈消息
+
+		eDispatch_status_msg=0x21,                //调度模块硬件状态消息
+		eDispatch_request_msg=0x22,              //请求调度消息
+		eDispatch_response_msg=0x23,             //调度结果反馈消息
+
+		eParkspace_allocation_status_msg=0x31,  //车位分配模块状态消息,包括车位信息
+		eParkspace_allocation_request_msg=0x32, //请求分配车位消息
+		eParkspace_allocation_response_msg=0x33,//分配车位结果反馈消息
+		eParkspace_search_request_msg = 0x34,		//查询车位请求消息
+		eParkspace_search_response_msg = 0x35,		//查询车位反馈消息
+		eParkspace_release_request_msg = 0x36,		//释放车位请求消息
+		eParkspace_release_response_msg = 0x37,		//释放车位反馈消息
+		eParkspace_force_update_request_msg = 0x38,	//手动修改车位消息
+		eParkspace_force_update_response_msg = 0x39,//手动修改车位反馈消息
+		eParkspace_confirm_alloc_request_msg = 0x3A,//确认分配车位请求消息
+		eParkspace_confirm_alloc_response_msg = 0x3B,//确认分配车位反馈消息
+        eParkspace_refresh_request_msg=0x3C,        //请求更新车位数据
+        eParkspace_allocation_data_response_msg=0x3D,
+
+		eStore_command_request_msg=0x41,        //终端停车请求消息
+		eStore_command_response_msg=0x42,       //停车请求反馈消息
+		ePickup_command_request_msg=0x43,       //取车请求消息
+		ePickup_command_response_msg=0x44,       //取车请求反馈消息
+
+
+
+		eStoring_process_statu_msg=0x90,        //停车指令进度条消息
+		ePicking_process_statu_msg=0x91,        //取车指令进度消息
+
+
+		eCentral_controller_statu_msg=0xa0,     //中控系统状态消息
+
+
+		eEntrance_manual_operation_msg=0xb0,            //针对出入口状态操作的手动消息
+		eProcess_manual_operation_msg=0xb1,             //针对流程的手动消息
+
+		eDispatch_plan_request_msg          = 0xe0,     //调度总规划的请求(用于启动整个调度算法)(调度管理->调度算法)
+		eDispatch_plan_response_msg         = 0xe1,     //调度总规划的答复(调度算法->调度管理)
+		eDispatch_control_request_msg       = 0xe2,     //调度控制的任务请求(调度算法->调度管理)
+		eDispatch_control_response_msg      = 0xe3,     //调度控制的任务答复(调度管理->调度算法)
+		eDispatch_manager_status_msg        = 0xea,     //调度管理的设备状态消息(调度底下所有硬件设备状态的汇总)
+		eDispatch_manager_data_msg          = 0xeb,     //调度管理的设备详细的数据信息
+		
+		
+		eGround_detect_request_msg=0xf0,        //地面雷达测量请求消息
+    	eGround_detect_response_msg=0xf1,       //地面雷达测量反馈消息
+
+
 	};
 
-	//通讯单元
+//通讯单元
 	enum Communicator
 	{
-		eEmpty=0x0000,		//空
-		eMain=0x0001,    	//主流程
-		eTerminor=0x0100,	//终端
-		eParkspace=0x0200,		//数据表
-		eMeasurer=0x0300,	//测量单元
-		eProcess=0x0400,	//调度机构
+		eEmpty=0x0000,
+		eMain=0x0001,    //主流程
+
+		eTerminor=0x0100,
+		//车位表
+		eParkspace=0x0200,
+		//测量单元
+		eMeasurer=0x0300,
+		//测量单元
+		eMeasurer_sift_server=0x0301,
+
+		//调度机构
+		eDispatch_mamager=0x0400,
+		//调度机构
+		eDispatch_control=0x0401,
 		//...
+
+		//地面测量单元
+		eGround_measurer=0x0f00,
 	};
 public:
 	Communication_message();
@@ -88,6 +121,7 @@ public://get or set member variable
 	Communicator get_sender();
 	Communicator get_receiver();
 	std::string& get_message_buf();
+	std::chrono::system_clock::time_point get_receive_time();
 
 protected://member variable
 	Message_type								m_message_type;				//消息类型

+ 5 - 9
communication/communication_socket_base.cpp

@@ -39,7 +39,6 @@ Error_manager Communication_socket_base::communication_init_from_protobuf(std::s
 		return Error_manager(COMMUNICATION_READ_PROTOBUF_ERROR,MINOR_ERROR,
 		"Communication_socket_base read_proto_param  failed");
 	}
-
 	return communication_init_from_protobuf(t_communication_parameter_all);
 }
 
@@ -57,8 +56,8 @@ Error_manager Communication_socket_base::communication_init_from_protobuf(Commun
 			return t_error;
 		}
 	}
-	std::cout << "communication_parameter_all.communication_parameters().connect_string_vector_size() " <<
-		communication_parameter_all.communication_parameters().connect_string_vector_size()<< std::endl;
+//	std::cout << "communication_parameter_all.communication_parameters().connect_string_vector_size() " <<
+//		communication_parameter_all.communication_parameters().connect_string_vector_size()<< std::endl;
 	for(int i=0;i<communication_parameter_all.communication_parameters().connect_string_vector_size();++i)
 	{
 		t_error = communication_connect( communication_parameter_all.communication_parameters().connect_string_vector(i) );
@@ -67,7 +66,6 @@ Error_manager Communication_socket_base::communication_init_from_protobuf(Commun
 			return t_error;
 		}
 	}
-
 	//启动通信, run thread
 	communication_run();
 
@@ -318,8 +316,8 @@ Error_manager Communication_socket_base::check_msg(Communication_message*  p_msg
 	else
 	{
 		//无效的消息,
-		return Error_code::INVALID_MESSAGE;
-	}
+		return Error_manager(Error_code::INVALID_MESSAGE, Error_level::NEGLIGIBLE_ERROR,
+							 " INVALID_MESSAGE error ");	}
 }
 
 //mp_analysis_data_thread 解析线程执行函数,
@@ -607,6 +605,4 @@ Error_manager Communication_socket_base::encapsulate_msg(Communication_message*
 							 " Communication_socket_base::encapsulate_msg error ");
 	}
 	return Error_code::SUCCESS;
-}
-
-
+}

+ 2 - 2
communication/communication_socket_base.h

@@ -14,7 +14,8 @@
 #ifndef __COMMUNICATION_SOCKET_BASE__HH__
 #define __COMMUNICATION_SOCKET_BASE__HH__
 
-
+#include <mutex>
+#include <thread>
 #include <nnxx/message>
 #include <nnxx/socket.h>
 #include <nnxx/bus.h>
@@ -29,7 +30,6 @@
 #include "../communication/communication_message.h"
 
 #include "../message/message_base.pb.h"
-//#include "../message/measure_message.pb.h"
 
 
 

+ 74 - 224
error_code/error_code.cpp

@@ -15,45 +15,38 @@ Error_manager::Error_manager()
 {
     m_error_code = SUCCESS;
     m_error_level = NORMAL;
-    pm_error_description = 0;
-    m_description_length = 0;
-    return ;
 }
 //拷贝构造
 Error_manager::Error_manager(const Error_manager & error_manager)
 {
     this->m_error_code = error_manager.m_error_code;
     this->m_error_level = error_manager.m_error_level;
-    pm_error_description = NULL;
-    m_description_length = 0;
-    reallocate_memory_and_copy_string(error_manager.pm_error_description, error_manager.m_description_length);
+	this->m_error_description=error_manager.m_error_description;
     return ;
 }
 //赋值构造
 Error_manager::Error_manager(Error_code error_code, Error_level error_level,
-    const char* p_error_description, int description_length)
+    const char* p_error_description)
 {
     m_error_code = error_code;
     m_error_level = error_level;
-    pm_error_description = NULL;
-    m_description_length = 0;
-    reallocate_memory_and_copy_string(p_error_description, description_length);
-    return ;
+    if(p_error_description!= nullptr)
+	{
+		m_error_description=std::string(p_error_description);
+	}
+	return ;
 }
 //赋值构造
 Error_manager::Error_manager(Error_code error_code, Error_level error_level , std::string & error_aggregate_string)
 {
     m_error_code = error_code;
     m_error_level = error_level;
-    pm_error_description = NULL;
-    m_description_length = 0;
-    reallocate_memory_and_copy_string(error_aggregate_string);
-    return ;
+    m_error_description=error_aggregate_string;
+	return ;
 }
 //析构函数
 Error_manager::~Error_manager()
 {
-    free_description();
 }
 
 //初始化
@@ -62,44 +55,49 @@ void Error_manager::error_manager_init()
     error_manager_clear_all();
     return;
 }
-//初始化
-void Error_manager::error_manager_init(Error_code error_code, Error_level error_level, const char* p_error_description, int description_length)
+void Error_manager::error_manager_init(Error_code error_code, Error_level error_level, const char* p_error_description)
 {
     m_error_code = error_code;
     m_error_level = error_level;
-    reallocate_memory_and_copy_string(p_error_description, description_length);
-    return ;
+	if(p_error_description!= nullptr)
+	{
+		m_error_description=std::string(p_error_description);
+	}
+	return ;
 }
 //初始化
 void Error_manager::error_manager_init(Error_code error_code, Error_level error_level , std::string & error_aggregate_string)
 {
     m_error_code = error_code;
     m_error_level = error_level;
-    reallocate_memory_and_copy_string(error_aggregate_string);
+    m_error_description=error_aggregate_string;
     return ;
 }
 //重置
-void Error_manager::error_manager_reset(Error_code error_code, Error_level error_level, const char* p_error_description, int description_length)
+void Error_manager::error_manager_reset(Error_code error_code, Error_level error_level, const char* p_error_description)
 {
     m_error_code = error_code;
     m_error_level = error_level;
-    reallocate_memory_and_copy_string(p_error_description, description_length);
-    return ;
+	if(p_error_description!= nullptr)
+	{
+		m_error_description=std::string(p_error_description);
+	}
+	return ;
 }
 //重置
 void Error_manager::error_manager_reset(Error_code error_code, Error_level error_level , std::string & error_aggregate_string)
 {
     m_error_code = error_code;
     m_error_level = error_level;
-    reallocate_memory_and_copy_string(error_aggregate_string);
-    return ;
+    m_error_description=error_aggregate_string;
+	return;
 }
 //重置
 void Error_manager::error_manager_reset(const Error_manager & error_manager)
 {
     this->m_error_code = error_manager.m_error_code;
     this->m_error_level = error_manager.m_error_level;
-    reallocate_memory_and_copy_string(error_manager.pm_error_description, error_manager.m_description_length);
+	this->m_error_description=error_manager.m_error_description;
     return ;
 }
 //清除所有内容
@@ -107,24 +105,27 @@ void Error_manager::error_manager_clear_all()
 {
     m_error_code = SUCCESS;
     m_error_level = NORMAL;
-    free_description();
+	m_error_description.clear();
+	return;
 }
 
 //重载=
 Error_manager& Error_manager::operator=(const Error_manager & error_manager)
 {
     error_manager_reset(error_manager);
+	return *this;
 }
 //重载=,支持Error_manager和Error_code的直接转化,会清空错误等级和描述
 Error_manager& Error_manager::operator=(Error_code error_code)
 {
     error_manager_clear_all();
     set_error_code(error_code);
+	return *this;
 }
 //重载==
 bool Error_manager::operator==(const Error_manager & error_manager)
 {
-    is_equal_error_manager(error_manager);
+	return is_equal_error_manager(error_manager);
 }
 //重载==,支持Error_manager和Error_code的直接比较
 bool Error_manager::operator==(Error_code error_code)
@@ -142,7 +143,7 @@ bool Error_manager::operator==(Error_code error_code)
 //重载!=
 bool Error_manager::operator!=(const Error_manager & error_manager)
 {
-    ! is_equal_error_manager(error_manager);
+	return (! is_equal_error_manager(error_manager));
 }
 //重载!=,支持Error_manager和Error_code的直接比较
 bool Error_manager::operator!=(Error_code error_code)
@@ -174,51 +175,28 @@ Error_level Error_manager::get_error_level()
     return m_error_level;
 }
 //获取错误描述的指针,(浅拷贝)
-char* Error_manager::get_error_description()
-{
-    return pm_error_description;
-}
-
-int Error_manager::get_description_length()
+std::string Error_manager::get_error_description()
 {
-	return m_description_length;
+    return m_error_description;
 }
 
 //复制错误描述,(深拷贝)
 //output:p_error_description     错误描述的字符串指针,不可以为NULL,必须要有实际的内存
 //output:description_length      错误描述的字符串长度,不可以为0,长度最好足够大,一般256即可。
-void Error_manager::copy_error_description(const char* p_error_description, int description_length)
+void Error_manager::copy_error_description(const char* p_error_description)
 {
-    if(p_error_description != NULL && pm_error_description != NULL)
+    if(p_error_description != NULL)
     {
-        char *pt_source = (char *)p_error_description;
-        char* pt_destination = pm_error_description;
-
-        int t_length_min = m_description_length;
-        if(m_description_length > description_length)
-        {
-            t_length_min = description_length;
-        }
-
-        for(int i=0;i<t_length_min; i++)
-        {
-            *pt_destination = *pt_source;
-            pt_destination++;
-            pt_source++;
-        }
+        m_error_description=std::string(p_error_description);
     }
-
-    return;
+	return;
 }
 //复制错误描述,(深拷贝)
 //output:error_description_string     错误描述的string
 void Error_manager::copy_error_description(std::string & error_description_string)
 {
-    if( (!error_description_string.empty() ) && pm_error_description != NULL)
-    {
-        error_description_string = pm_error_description;
-    }
-    return;
+    m_error_description=error_description_string;
+	return;
 }
 
 //设置错误码
@@ -252,64 +230,33 @@ void Error_manager::set_error_level_location(Error_level error_level)
     return;
 }
 //设置错误描述
-void Error_manager::set_error_description(const char* p_error_description, int description_length)
+void Error_manager::set_error_description(const char* p_error_description)
 {
-    reallocate_memory_and_copy_string(p_error_description, description_length);
-    return ;
+	if(p_error_description != NULL)
+	{
+		m_error_description=std::string(p_error_description);
+	}
+	return;
 }
 //设置错误描述
 void Error_manager::set_error_description(std::string & error_description_string)
 {
-    reallocate_memory_and_copy_string(error_description_string);
-    return ;
+	m_error_description = error_description_string;
+	return ;
 }
 
 //尾部追加错误描述
-void Error_manager::add_error_description(const char* p_error_description, int description_length)
+void Error_manager::add_error_description(const char* p_error_description)
 {
     if(p_error_description !=NULL)
     {
-        char* pt_description_front = pm_error_description;
-        int t_description_front_length = m_description_length;
-        char* pt_description_back = (char *)p_error_description;
-        int t_description_back_length = 0;
-
-        if(description_length == 0)
-        {
-            t_description_back_length = 0;
-            while (*pt_description_back != '\0')
-            {
-                t_description_back_length++;
-                pt_description_back++;
-            }
-            t_description_back_length++;
-            pt_description_back = (char *)p_error_description;
-        }
-        else
-        {
-            t_description_back_length = description_length;
-        }
-
-        int t_description_new_length = t_description_front_length + 5 + t_description_back_length - 1;
-        char* pt_description_new =  (char*) malloc(t_description_new_length );
-
-        sprintf(pt_description_new, "%s ### %s", pt_description_front, pt_description_back);
-        free_description();
-        pm_error_description = pt_description_new;
-        m_description_length = t_description_new_length;
+        m_error_description+=std::string(p_error_description);
     }
-    return ;
 }
 //尾部追加错误描述
 void Error_manager::add_error_description(std::string & error_description_string)
 {
-    if( ! error_description_string.empty() )
-    {
-        std::string t_description_string = pm_error_description ;
-        t_description_string += (" ### "+ error_description_string);
-
-        reallocate_memory_and_copy_string(t_description_string);
-    }
+    m_error_description+=error_description_string;
 }
 
 //比较错误是否相同,
@@ -341,26 +288,20 @@ void Error_manager::compare_and_cover_error(const Error_manager & error_manager)
     else
     {
         Error_manager t_error_manager_new;
-        char* pt_string_inside = NULL;
-        int t_string_inside_length = 0;
+        std::string pt_string_inside ;
         if(this->m_error_level < error_manager.m_error_level)
         {
-            t_string_inside_length = ERROR_NAMAGER_TO_STRING_FRONT_LENGTH + this->m_description_length;
-            pt_string_inside = (char*)malloc(t_string_inside_length);
-            translate_error_to_string(pt_string_inside, t_string_inside_length);
-
+            translate_error_to_string(pt_string_inside);
             error_manager_reset(error_manager);
-            add_error_description(pt_string_inside,t_string_inside_length);
+            add_error_description(pt_string_inside);
         }
         else
         {
-            t_string_inside_length = ERROR_NAMAGER_TO_STRING_FRONT_LENGTH + error_manager.m_description_length;
-            pt_string_inside = (char*)malloc(t_string_inside_length);
-			((Error_manager & )error_manager).translate_error_to_string(pt_string_inside, t_string_inside_length);
-
-            add_error_description(pt_string_inside,t_string_inside_length);
+			((Error_manager&)error_manager).translate_error_to_string(pt_string_inside);
+            add_error_description(pt_string_inside);
         }
     }
+	return;
 }
 //比较并覆盖错误,讲低级错误转为字符串存放于描述中,
 //如果错误相同,则保留this的,将输入参数转入描述。
@@ -372,90 +313,48 @@ void Error_manager::compare_and_cover_error( Error_manager * p_error_manager)
 	}
 	else if (p_error_manager->m_error_code == SUCCESS)
 	{
-		//
+		return;
 	}
 	else
 	{
 		Error_manager t_error_manager_new;
-		char* pt_string_inside = NULL;
-		int t_string_inside_length = 0;
+		std::string pt_string_inside;
 		if(this->m_error_level < p_error_manager->m_error_level)
 		{
-			t_string_inside_length = ERROR_NAMAGER_TO_STRING_FRONT_LENGTH + this->m_description_length;
-			pt_string_inside = (char*)malloc(t_string_inside_length);
-			translate_error_to_string(pt_string_inside, t_string_inside_length);
-
+			translate_error_to_string(pt_string_inside);
 			error_manager_reset(*p_error_manager);
-			add_error_description(pt_string_inside,t_string_inside_length);
+			add_error_description(pt_string_inside);
 		}
 		else
 		{
-			t_string_inside_length = ERROR_NAMAGER_TO_STRING_FRONT_LENGTH + p_error_manager->m_description_length;
-			pt_string_inside = (char*)malloc(t_string_inside_length);
-			p_error_manager->translate_error_to_string(pt_string_inside, t_string_inside_length);
-
-			add_error_description(pt_string_inside,t_string_inside_length);
+			p_error_manager->translate_error_to_string(pt_string_inside);
+			add_error_description(pt_string_inside);
 		}
 	}
 }
 
-//将所有的错误信息,格式化为字符串,用作日志打印。
-//output:p_error_description     错误汇总的字符串指针,不可以为NULL,必须要有实际的内存
-//output:description_length      错误汇总的字符串长度,不可以为0,长度最好足够大,一般256即可。
-void Error_manager::translate_error_to_string(char* p_error_aggregate, int aggregate_length )
-{
-    char t_string_array[ERROR_NAMAGER_TO_STRING_FRONT_LENGTH] = {0};
-    char* pt_index_front = t_string_array;
-    char* pt_index_back = pm_error_description;
-    char* pt_index = p_error_aggregate;
-
-    sprintf(t_string_array, "error_code:0x%08x, error_level:%02d, error_description:", m_error_code , m_error_level );
 
-    int t_length_min = m_description_length + ERROR_NAMAGER_TO_STRING_FRONT_LENGTH -1;
-    if(t_length_min > aggregate_length)
-    {
-        t_length_min = aggregate_length;
-    }
-
-    for(int i=0;i<t_length_min; i++)
-    {
-        if(i < ERROR_NAMAGER_TO_STRING_FRONT_LENGTH -1)
-        {
-            *pt_index = *pt_index_front;
-            pt_index++;
-            pt_index_front++;
-        }
-        else
-        {
-            *pt_index = *pt_index_back;
-            pt_index++;
-            pt_index_back++;
-        }
-    }
-}
 //output:error_description_string     错误汇总的string
 void Error_manager::translate_error_to_string(std::string & error_aggregate_string)
 {
-    char t_string_array[ERROR_NAMAGER_TO_STRING_FRONT_LENGTH] = {0};
-    sprintf(t_string_array, "error_code:0x%08x, error_level:%02d, error_description:", m_error_code , m_error_level );
+    char t_string_array[255] = {0};
+    sprintf(t_string_array, "error_code:0x%08x, error_level:%02d, error_description:",
+            m_error_code , m_error_level);
 
     error_aggregate_string = t_string_array ;
-    if(pm_error_description != NULL)
-    {
-        error_aggregate_string += pm_error_description;
-    }
-    else
-    {
-        //error_aggregate_string += "NULL";
-    }
+	error_aggregate_string+= m_error_description;
+	return;
 }
 //错误码转字符串的简易版,可支持cout<<
 //return     错误汇总的string
 std::string Error_manager::to_string()
 {
-    std::string t_string;
-    translate_error_to_string(t_string);
-    return t_string;
+	char t_string_array[255] = {0};
+	sprintf(t_string_array, "error_code:0x%08x, error_level:%02d, error_description:",
+            m_error_code , m_error_level);
+    std::string error_aggregate_string = t_string_array ;
+	error_aggregate_string+= m_error_description;
+	return error_aggregate_string;
 }
 
 
@@ -464,12 +363,6 @@ std::string Error_manager::to_string()
 //释放错误描述的内存,
 void Error_manager::free_description()
 {
-    if(pm_error_description != NULL)
-    {
-        free (pm_error_description);
-        pm_error_description = NULL;
-    }
-    m_description_length = 0;
 }
 
 //重新分配错误描述的内存,并从外部拷贝新的(深拷贝)
@@ -477,40 +370,6 @@ void Error_manager::free_description()
 //input:description_length      错误描述的字符串长度,如果为0,则从p_error_description里面获取有效的长度
 void Error_manager::reallocate_memory_and_copy_string(const char* p_error_description, int description_length)
 {
-    free_description();
-
-    if(p_error_description != NULL)
-    {
-        char* pt_source = (char *)p_error_description;
-        char* pt_destination = NULL;
-
-        if(description_length == 0)
-        {
-            m_description_length = 0;
-            while (*pt_source != '\0')
-            {
-                m_description_length++;
-                pt_source++;
-            }
-            m_description_length++;
-            pt_source = (char *)p_error_description;
-        }
-        else
-        {
-            m_description_length = description_length;
-        }
-
-        pm_error_description =  (char*) malloc(m_description_length );
-        pt_destination = pm_error_description;
-
-        for(int i=0;i<m_description_length; i++)
-        {
-            *pt_destination = *pt_source;
-            pt_destination++;
-            pt_source++;
-        }
-    }
-
     return;
 }
 
@@ -519,16 +378,7 @@ void Error_manager::reallocate_memory_and_copy_string(const char* p_error_descri
 //input:error_aggregate_string     错误描述的string
 void Error_manager::reallocate_memory_and_copy_string(std::string & error_aggregate_string)
 {
-    free_description();
-
-    if( ! error_aggregate_string.empty())
-    {
-        m_description_length = error_aggregate_string.length()+1;
-
-        pm_error_description =  (char*) malloc( m_description_length );
-
-        strcpy(pm_error_description ,   error_aggregate_string.c_str()  );
-    }
+    return;
 }
 
 

+ 342 - 108
error_code/error_code.h

@@ -1,4 +1,8 @@
 
+#define MAIN_TEST 1
+//#define PROCESS_TEST 1
+//#define TIME_TEST 1
+
 //Error_code是错误码的底层通用模块,
 //功能:用作故障分析和处理。
 
@@ -53,9 +57,18 @@ enum Error_code
     WARNING                         = 0x00000003,//警告
     FAILED                          = 0x00000004,//失败
 
-    NO_DATA                         = 0x00000010,//没有数据,传入参数容器内部没有数据时,
+    NODATA                          = 0x00000010,//没有数据,传入参数容器内部没有数据时,
 	INVALID_MESSAGE					= 0x00000011, //无效的消息,
-    RESPONSE_TIMEOUT                = 0x00000012,
+	PARSE_FAILED					= 0x00000012,//解析失败
+
+    PAUSE                           = 0x00000013,   //急停
+    TASK_CANCEL                     = 0x00000014,   //任务取消
+
+    DISCONNECT                      = 0x00000020,   //通讯中断/断开连接
+    UNKNOW_STATU                    = 0x00000021,   //未知状态
+
+    TASK_TIMEOVER					= 0x00000020,//任务超时
+	RESPONSE_TIMEOUT                = 0x00000021,//答复超时
 
     POINTER_IS_NULL                 = 0x00000101,//空指针
     PARAMETER_ERROR                 = 0x00000102,//参数错误,传入参数不符合规范时,
@@ -78,6 +91,48 @@ enum Error_code
 //    注:错误码的制定从1开始,不要从0开始,
 //        0用作错误码的基数,用来位运算,来判断错误码的范围。
 
+
+	//主控通信
+	LOCATER_MSG_TABLE_NOT_EXIST  				= 0xa0010000,
+    LOCATER_MSG_RESPONSE_TYPE_ERROR,                                //测量反馈消息类型错误(致命)
+    LOCATER_MSG_RESPONSE_INFO_ERROR,
+    LOCATER_MSG_REQUEST_CANCELED,
+    LOCATER_MSG_REQUEST_INVALID,
+    LOCATER_MSG_RESPONSE_HAS_NO_REQUEST,
+    LOCATER_MSG_REQUEST_REPEATED,
+
+   /*
+    * parkspace error code
+    */
+    PARKSPACE_REQUEST_MSG_TYPE_ERROR            = 0xa1010000,
+    PARKSPACE_ALLOCMSG_RESPONSE_HAS_NO_REQUEST,
+    PARKSPACE_SEARCHMSG_RESPONSE_HAS_NO_REQUEST,
+    PARKSPACE_RELEASEMSG_RESPONSE_HAS_NO_REQUEST,
+    PARKSPACE_ALLOC_REQUEST_INVALID,
+    PARKSPACE_SEARCH_REQUEST_INVALID,
+    PARKSPACE_RELEASE_REQUEST_INVALID,
+
+    PARKSPACE_ALLOC_REQUEST_REPEATED,
+    PARKSPACE_SEARCH_REQUEST_REPEATED,
+    PARKSPACE_RELEASE_REQUEST_REPEATED,
+
+    PARKSPACE_ALLOC_RESPONSE_TYPE_ERROR,
+    PARKSPACE_SEARCH_RESPONSE_TYPE_ERROR,
+    PARKSPACE_RELEASE_RESPONSE_TYPE_ERROR,
+
+    PARKSPACE_ALLOC_RESPONSE_INFO_ERROR,
+    PARKSPACE_SEARCH_RESPONSE_INFO_ERROR,
+    PARKSPACE_RELEASE_RESPONSE_INFO_ERROR,
+
+    PARKSPACE_ALLOC_REQUEST_CANCELED,
+    PARKSPACE_SEARCH_REQUEST_CANCELED,
+    PARKSPACE_RELEASE_REQUEST_CANCELED,
+
+
+
+
+
+
 //    laser扫描模块
     LASER_ERROR_BASE                = 0x01000000,
 
@@ -93,7 +148,7 @@ enum Error_code
 	LASER_QUEUE_ERROR,								//雷达基类模块, 数据缓存错误
 
 
-//    laser_livox.cpp的错误码
+//   livox  大疆雷达
     LIVOX_ERROR_BASE                = 0x01020000,
     LIVOX_START_FAILE,								//livox模块,开始扫描失败
 	LIVOX_TASK_TYPE_ERROR,							//livox模块,任务类型错误
@@ -109,8 +164,8 @@ enum Error_code
 	LASER_MANAGER_STATUS_ERROR,						//雷达管理模块,状态错误
 	LASER_MANAGER_TASK_TYPE_ERROR,					//雷达管理模块,任务类型错误
 	LASER_MANAGER_IS_NOT_READY,						//雷达管理模块,不在准备状态
-	LASER_MANAGER_LASER_INDEX_ERRPR,				//雷达管理模块,雷达索引错误,编号错误。
 	LASER_MANAGER_TASK_OVER_TIME,					//雷达管理模块,任务超时
+	LASER_MANAGER_LASER_INDEX_ERRPR,				//雷达管理模块,雷达索引错误,编号错误。
 	LASER_MANAGER_LASER_INDEX_REPEAT,				//雷达管理模块,需要扫描的雷达索引重复,可忽略的错误,提示作用
 
 //livox_driver 雷达livox驱动模块
@@ -123,9 +178,21 @@ enum Error_code
 
 
 
+     //PLC error code  ...
+    PLC_ERROR_BASE                  				= 0x02010000,
+    PLC_UNKNOWN_ERROR,								//plc未知错误
+    PLC_EMPTY_TASK,									//plc任务为空
+    PLC_IP_PORT_ERROR,								//plc的ip端口错误
+    PLC_SLAVE_ID_ERROR,								//plc的身份id错误
+    PLC_CONNECTION_FAILED,							//PLC连接失败
+    PLC_READ_FAILED,								//plc读取失败
+    PLC_WRITE_FAILED,								//plc写入失败
+    PLC_NOT_ENOUGH_DATA_ERROR,						//PLC没有足够的数据错误
+
+
+
     //locate 定位模块,
 	LOCATER_ERROR_BASE                				= 0x03000000,
-
 	//LASER_MANAGER 定位管理模块
 	LOCATER_MANAGER_ERROR_BASE                		= 0x03010000,
 	LOCATER_MANAGER_READ_PROTOBUF_ERROR,				//定位管理模块,读取参数错误
@@ -134,68 +201,73 @@ enum Error_code
 	LOCATER_MANAGER_TASK_TYPE_ERROR,					//定位管理模块,任务类型错误
 	LOCATER_MANAGER_IS_NOT_READY,						//定位管理模块,不在准备状态
 	LOCATER_MANAGER_CLOUD_MAP_ERROR,					//定位管理模块,任务输入点云map的error
-	LOCATE_MANAGER_TASK_OVER_TIME,
+	LOCATER_MANAGER_TASK_OVER_TIME,						//定位管理模块,任务超时
 
 
-	//Locater.cpp error from 0x0301000-0x030100FF
-	LOCATER_TASK_INIT_CLOUD_EMPTY ,
-    LOCATER_TASK_ERROR,
-    LOCATER_TASK_INPUT_CLOUD_UNINIT,
-    LOCATER_INPUT_CLOUD_EMPTY,
-    LOCATER_YOLO_UNINIT,
-    LOCATER_POINTSIFT_UNINIT,
-    LOCATER_3DCNN_UNINIT,
-    LOCATER_INPUT_YOLO_CLOUD_EMPTY,
-    LOCATER_Y_OUT_RANGE_BY_PLC,
-    LOCATER_MEASURE_HEIGHT_CLOUD_UNINIT,
-    LOCATER_MEASURE_HEIGHT_CLOUD_EMPTY,
-    LOCATER_INPUT_CLOUD_UNINIT,
+	//Locater  算法模块	
+	LOCATER_ALGORITHM_ERROR_BASE					= 0x03020000,
+	LOCATER_TASK_INIT_CLOUD_EMPTY,						//定位任务初始化点云为空
+	LOCATER_TASK_ERROR,									//定位任务错误
+	LOCATER_TASK_INPUT_CLOUD_UNINIT,					//定位任务输入点云为空
+	LOCATER_INPUT_CLOUD_EMPTY,							//定位输入点云为空
+	LOCATER_YOLO_UNINIT,								//定位yolo未初始化
+	LOCATER_POINTSIFT_UNINIT,							//定位POINTSIFT未初始化
+	LOCATER_3DCNN_UNINIT,								//定位3DCNN未初始化
+	LOCATER_INPUT_YOLO_CLOUD_EMPTY,						//定位输入yolo点云为空
+	LOCATER_Y_OUT_RANGE_BY_PLC,							//定位超出plc的限制范围
+	LOCATER_MEASURE_HEIGHT_CLOUD_UNINIT,				//定位测量高点云未初始化
+	LOCATER_MEASURE_HEIGHT_CLOUD_EMPTY,					//定位测量高点云为空
+	LOCATER_INPUT_CLOUD_UNINIT,							//定位输入点云未初始化
 
 
     //point sift from 0x03010100-0x030101FF
-    LOCATER_SIFT_INIT_FAILED=0x03010100,
-    LOCATER_SIFT_INPUT_CLOUD_UNINIT,
-	LOCATER_SIFT_INPUT_CLOUD_EMPTY,
-	LOCATER_SIFT_GRID_ERROR,
-	LOCATER_SIFT_SELECT_ERROR,
-	LOCATER_SIFT_CLOUD_VERY_LITTLE,
-	LOCATER_SIFT_CREATE_INPUT_DATA_FAILED,
-	LOCATER_SIFT_PREDICT_FAILED,
-	LOCATER_SIFT_PREDICT_NO_WHEEL_POINT,
-	LOCATER_SIFT_PREDICT_NO_CAR_POINT,
-
-    LOCATER_SIFT_FILTE_OBS_FAILED,
-    LOCATER_SIFT_INPUT_BOX_PARAMETER_FAILED,
-
-//    //yolo from 0x03010200-0x030102FF
-//        LOCATER_YOLO_DETECT_FAILED=0x03010200,
+	LOCATER_SIFT_ERROR_BASE							=0x03020100,
+   	LOCATER_SIFT_INIT_FAILED,							//定位过滤模块,初始化失败
+    LOCATER_SIFT_INPUT_CLOUD_UNINIT,					//定位过滤模块,输入点云未初始化
+	LOCATER_SIFT_INPUT_CLOUD_EMPTY,						//定位过滤模块,输入点云为空
+	LOCATER_SIFT_GRID_ERROR,							//定位过滤模块,筛选网格错误
+	LOCATER_SIFT_SELECT_ERROR,							//定位过滤模块,筛选选择错误
+	LOCATER_SIFT_CLOUD_VERY_LITTLE,						//定位过滤模块,筛选点云很少
+	LOCATER_SIFT_CREATE_INPUT_DATA_FAILED,				//定位过滤模块,筛选创建输入数据失败
+	LOCATER_SIFT_PREDICT_FAILED,						//定位过滤模块,预测失败
+	LOCATER_SIFT_PREDICT_TIMEOUT,						//定位过滤模块,预测超时
+	LOCATER_SIFT_PREDICT_NO_WHEEL_POINT,				//定位过滤模块,预测结果没有车轮点云
+	LOCATER_SIFT_PREDICT_NO_CAR_POINT,					//定位过滤模块,预测结果没有车身点云
+
+    LOCATER_SIFT_FILTE_OBS_FAILED,						//定位过滤模块,过滤OBS失败
+    LOCATER_SIFT_INPUT_BOX_PARAMETER_FAILED,			//定位过滤模块,输入范围参数错误
+
+//    //yolo 
+//    LOCATER_YOLO_ERROR_BASE						=0x03020200,
+//    LOCATER_YOLO_DETECT_FAILED,
 //    LOCATER_YOLO_DETECT_NO_TARGET,
 //    LOCATER_YOLO_PARAMETER_INVALID,
 //    LOCATER_YOLO_INPUT_CLOUD_UNINIT,
 
     //3dcnn from 0x03010300-0x030103FF
-    LOCATER_3DCNN_INIT_FAILED=0x03010300,
-    LOCATER_3DCNN_INPUT_CLOUD_UNINIT,
-	LOCATER_3DCNN_INPUT_CLOUD_EMPTY,
-	LOCATER_3DCNN_INPUT_CLOUD_MAP_ERROR,
-	LOCATER_3DCNN_PCA_OUT_ERROR,
-	LOCATER_3DCNN_EXTRACT_RECT_ERROR,
-	LOCATER_3DCNN_RECT_SIZE_ERROR,
-
-    LOCATER_3DCNN_PREDICT_FAILED,
-    LOCATER_3DCNN_VERIFY_RECT_FAILED_3,
-    LOCATER_3DCNN_VERIFY_RECT_FAILED_4,
-    LOCATER_3DCNN_KMEANS_FAILED,
-    LOCATER_3DCNN_IIU_FAILED,
-    LOCATER_3DCNN_PCA_OUT_CLOUD_EMPTY,
+    LOCATER_3DCNN_ERROR_BASE						=0x03020300,
+    LOCATER_3DCNN_INIT_FAILED,							//定位3DCNN模块,初始化失败
+    LOCATER_3DCNN_INPUT_CLOUD_UNINIT,					//定位3DCNN模块,输入点云未初始化
+	LOCATER_3DCNN_INPUT_CLOUD_EMPTY,					//定位3DCNN模块,输入点云为空
+	LOCATER_3DCNN_INPUT_CLOUD_MAP_ERROR,				//定位3DCNN模块,输入点云的map错误
+	LOCATER_3DCNN_PCA_OUT_ERROR,						//定位3DCNN模块,pca错误
+	LOCATER_3DCNN_EXTRACT_RECT_ERROR,					//定位3DCNN模块,提取矩形错误
+	LOCATER_3DCNN_RECT_SIZE_ERROR,						//定位3DCNN模块,矩形范围错误
+
+    LOCATER_3DCNN_PREDICT_FAILED,						//定位3DCNN模块,预测失败
+    LOCATER_3DCNN_VERIFY_RECT_FAILED_3,					//定位3DCNN模块,验证矩形失败3
+    LOCATER_3DCNN_VERIFY_RECT_FAILED_4,					//定位3DCNN模块,验证矩形失败4
+    LOCATER_3DCNN_KMEANS_FAILED,						//定位3DCNN模块,k均值失败
+    LOCATER_3DCNN_IIU_FAILED,							//定位3DCNN模块,IIU失败
+    LOCATER_3DCNN_PCA_OUT_CLOUD_EMPTY,					//定位3DCNN模块,pca输出点云为空
 
     //System_manager error from 0x04010000-0x0401FFFF
-    SYSTEM_READ_PARAMETER_ERROR=0x04010100,
+    SYSTEM_READ_PARAMETER_ERROR						=0x04010100,
     SYSTEM_PARAMETER_ERROR,
     SYSTEM_INPUT_TERMINOR_NO_LASERS,
 
     //terminor_command_executor.cpp from 0x04010200-0x040102FF
-    TERMINOR_NOT_READY=0x04010200,
+    TERMINOR_NOT_READY								=0x04010200,
     TERMINOR_INPUT_LASER_NULL,
     TERMINOR_NOT_CONTAINS_LASER,
     TERMINOR_INPUT_PLC_NULL,
@@ -208,7 +280,7 @@ enum Error_code
 
     ////Hardware limit from 0x05010000 - 0x0501ffff
     ///railing.cpp from 0x05010100-0x050101ff
-    HARDWARE_LIMIT_LEFT_RAILING=0x05010100,         //左栏杆限制
+    HARDWARE_LIMIT_LEFT_RAILING						=0x05010100,         //左栏杆限制
     HARDWARE_LIMIT_RAILING_PARAMETER_ERROR,
     HARDWARE_LIMIT_RAILING_ERROR,
     HARDWARE_LIMIT_CENTER_X_LEFT,
@@ -223,40 +295,109 @@ enum Error_code
     HARDWARE_LIMIT_TERMINAL_LR_ERROR,
 
 
-    //wj_lidar error from 0x06010000-0x0601FFFF
-        WJ_LIDAR_CONNECT_FAILED=0x06010000,
-    WJ_LIDAR_UNINITIALIZED,
-    WJ_LIDAR_READ_FAILED,
-    WJ_LIDAR_WRITE_FAILED,
-    WJ_LIDAR_GET_CLOUD_TIMEOUT,
-
-    //wj lidar protocol error from 0x06020000-0x0602FFFF
-        WJ_PROTOCOL_ERROR_BASE=0x06020000,
-    WJ_PROTOCOL_INTEGRITY_ERROR,
-    WJ_PROTOCOL_PARSE_FAILED,
-    WJ_PROTOCOL_EMPTY_PACKAGE,
-    WJ_PROTOCOL_EXCEED_MAX_SIZE,
-
-    //wj region detect error from 0x06030000-0x0603FFFF
-        WJ_REGION_EMPTY_CLOUD=0x06030000,
-    WJ_REGION_RECTANGLE_ANGLE_ERROR,
-    WJ_REGION_RECTANGLE_SIZE_ERROR,
-    WJ_REGION_RECTANGLE_SYMMETRY_ERROR,
-    WJ_REGION_CLUSTER_SIZE_ERROR,
-
-    //wj manager error from 0x06040000-0x0604FFFF
-    WJ_MANAGER_UNINITIALIZED=0x06040000,
-    WJ_MANAGER_LIDAR_DISCONNECTED,
-    WJ_MANAGER_PLC_DISCONNECTED,
-    WJ_MANAGER_EMPTY_CLOUD,
-
-    WJ_LIDAR_TASK_EMPTY_RESULT=0x06050000,
-    WJ_LIDAR_TASK_EMPTY_TASK,
-    WJ_LIDAR_TASK_WRONG_TYPE,
-    WJ_LIDAR_TASK_INVALID_TASK,
-    WJ_LIDAR_TASK_MEASURE_FAILED,
-
-
+//万集设备模块,
+    WANJI_LIDAR_DEVICE_ERROR_BASE								=0x06080000,//万集设备模块,错误基类
+	WANJI_LIDAR_DEVICE_STATUS_BUSY,									//万集设备模块,状态正忙
+	WANJI_LIDAR_DEVICE_STATUS_ERROR,								//万集设备模块,状态错误
+	WANJI_LIDAR_DEVICE_TASK_TYPE_ERROR,								//万集设备模块,任务类型错误
+	WANJI_LIDAR_DEVICE_TASK_OVER_TIME,								//万集设备模块,任务超时
+	WANJI_LIDAR_DEVICE_NO_CLOUD,									//万集设备模块,没有点云
+    // velodyne设备模块
+    VELODYNE_LIDAR_DEVICE_ERROR_BASE,								//velodyne设备模块,错误基类
+    VELODYNE_LIDAR_DEVICE_STATUS_BUSY,									//velodyne设备模块,状态正忙
+	VELODYNE_LIDAR_DEVICE_STATUS_ERROR,								//velodyne设备模块,状态错误
+	VELODYNE_LIDAR_DEVICE_TASK_TYPE_ERROR,								//velodyne设备模块,任务类型错误
+	VELODYNE_LIDAR_DEVICE_TASK_OVER_TIME,								//velodyne设备模块,任务超时
+	VELODYNE_LIDAR_DEVICE_NO_CLOUD,									//velodyne设备模块,没有点云
+
+
+	//万集通信wj_lidar error from 0x06010000-0x0601FFFF
+	WJ_LIDAR_COMMUNICATION_ERROR_BASE				=0x06010000,
+	WJ_LIDAR_COMMUNICATION_UNINITIALIZED,							//万集通信,未初始化
+	WJ_LIDAR_COMMUNICATION_DISCONNECT,								//万集通信,断连
+	WJ_LIDAR_COMMUNICATION_FAULT,									//万集通信,故障
+	WJ_LIDAR_CONNECT_FAILED,										//万集通信,连接失败
+    WJ_LIDAR_UNINITIALIZED,											//万集通信,未初始化
+    WJ_LIDAR_READ_FAILED,											//万集通信,读取失败
+    WJ_LIDAR_WRITE_FAILED,											//万集通信,写入失败
+    WJ_LIDAR_GET_CLOUD_TIMEOUT,										//万集通信,获取点云超时
+    // velodyne通信
+    VELODYNE_LIDAR_COMMUNICATION_UNINITIALIZED,							//velodyne通信,未初始化
+	VELODYNE_LIDAR_COMMUNICATION_DISCONNECT,								//velodyne通信,断连
+	VELODYNE_LIDAR_COMMUNICATION_FAULT,									//velodyne通信,故障
+	VELODYNE_LIDAR_CONNECT_FAILED,										//velodyne通信,连接失败
+    VELODYNE_LIDAR_UNINITIALIZED,											//velodyne通信,未初始化
+    VELODYNE_LIDAR_READ_FAILED,											//velodyne通信,读取失败
+    VELODYNE_LIDAR_WRITE_FAILED,											//velodyne通信,写入失败
+    VELODYNE_LIDAR_GET_CLOUD_TIMEOUT,										//velodyne通信,获取点云超时
+
+    //万集解析 wj lidar protocol error from 0x06020000-0x0602FFFF
+        WJ_PROTOCOL_ERROR_BASE						=0x06020000,
+	WJ_PROTOCOL_STATUS_BUSY,										//万集解析, 状态正忙
+	WJ_PROTOCOL_STATUS_ERROR,										//万集解析, 状态错误
+    WJ_PROTOCOL_INTEGRITY_ERROR,									//万集解析, 完整性错误								
+    WJ_PROTOCOL_PARSE_FAILED,										//万集解析, 解析失败
+    WJ_PROTOCOL_EMPTY_PACKAGE,										//万集解析, 空包
+    WJ_PROTOCOL_EXCEED_MAX_SIZE,									//万集解析, 超出最大范围
+
+    //万集测量范围 wj region detect error from 0x06030000-0x0603FFFF
+	WJ_REGION_ERROR_BASE							= 0x06030000,
+	WJ_REGION_EMPTY_CLOUD,											//万集测量,空点云	
+	WJ_REGION_EMPTY_NO_WHEEL_INFORMATION,							//万集测量,没有车轮信息
+    WJ_REGION_RECTANGLE_ANGLE_ERROR,								//万集测量,矩形旋转角错误
+    WJ_REGION_RECTANGLE_SIZE_ERROR,									//万集测量,矩形大小错误
+    WJ_REGION_RECTANGLE_SYMMETRY_ERROR,								//万集测量,矩形对称错误
+    WJ_REGION_CLUSTER_SIZE_ERROR,									//万集测量,簇大小错误
+    WJ_REGION_CERES_SOLVE_ERROR,                                    //万集测量,优化失败
+    //velodyne测量范围
+	VELODYNE_REGION_ERROR_BASE,
+	VELODYNE_REGION_EMPTY_CLOUD,											//velodyne测量,空点云	
+	VELODYNE_REGION_EMPTY_NO_WHEEL_INFORMATION,							//velodyne测量,没有车轮信息
+    VELODYNE_REGION_RECTANGLE_ANGLE_ERROR,								//velodyne测量,矩形旋转角错误
+    VELODYNE_REGION_RECTANGLE_SIZE_ERROR,									//velodyne测量,矩形大小错误
+    VELODYNE_REGION_RECTANGLE_SYMMETRY_ERROR,								//velodyne测量,矩形对称错误
+    VELODYNE_REGION_CLUSTER_SIZE_ERROR,									//velodyne测量,簇大小错误
+    VELODYNE_REGION_CERES_SOLVE_ERROR,                                    //velodyne测量,优化失败
+
+    //万集管理模块 wj manager error from 0x06040000-0x0604FFFF
+	WJ_MANAGER_ERROR_BASE										= 0x06040000,
+    WJ_MANAGER_UNINITIALIZED,									//万集管理模块,未初始化
+    WJ_MANAGER_LIDAR_DISCONNECTED,								//万集管理模块,雷达断链
+    WJ_MANAGER_PLC_DISCONNECTED,								//万集管理模块,plc断链
+    WJ_MANAGER_EMPTY_CLOUD,										//万集管理模块,空点云
+	WJ_MANAGER_READ_PROTOBUF_ERROR,								//万集管理模块,读取参数错误
+	WJ_MANAGER_INIT_ERROR,										//万集管理模块,初始化error
+	WJ_MANAGER_TASK_TYPE_ERROR,									//万集管理模块,任务类型错误
+	WJ_MANAGER_STATUS_BUSY,										//万集管理模块,状态正忙
+	WJ_MANAGER_STATUS_ERROR,									//万集管理模块,状态错误
+	WJ_MANAGER_LASER_INDEX_ERRPR,								//万集管理模块,雷达索引错误,编号错误。
+	WJ_MANAGER_LASER_INDEX_REPEAT,								//万集管理模块,需要扫描的雷达索引重复,可忽略的错误,提示作用
+	WJ_MANAGER_TASK_OVER_TIME,									//万集管理模块,任务超时
+    VELODYNE_MANAGER_ERROR_BASE,										
+    VELODYNE_MANAGER_UNINITIALIZED,									//velodyne管理模块,未初始化
+    VELODYNE_MANAGER_LIDAR_DISCONNECTED,								//velodyne管理模块,雷达断链
+    VELODYNE_MANAGER_EMPTY_CLOUD,										//velodyne管理模块,空点云
+	VELODYNE_MANAGER_READ_PROTOBUF_ERROR,								//velodyne管理模块,读取参数错误
+	VELODYNE_MANAGER_INIT_ERROR,										//velodyne管理模块,初始化error
+	VELODYNE_MANAGER_TASK_TYPE_ERROR,									//velodyne管理模块,任务类型错误
+	VELODYNE_MANAGER_STATUS_BUSY,										//velodyne管理模块,状态正忙
+	VELODYNE_MANAGER_STATUS_ERROR,									//velodyne管理模块,状态错误
+	VELODYNE_MANAGER_LASER_INDEX_ERRPR,								//velodyne管理模块,雷达索引错误,编号错误。
+	VELODYNE_MANAGER_LASER_INDEX_REPEAT,								//velodyne管理模块,需要扫描的雷达索引重复,可忽略的错误,提示作用
+	VELODYNE_MANAGER_TASK_OVER_TIME,									//velodyne管理模块,任务超时
+
+//万集任务模块
+	WJ_LIDAR_TASK_ERROR_BASE									=0x06050000,
+	WJ_LIDAR_TASK_EMPTY_RESULT,									//万集任务模块,空结果
+    WJ_LIDAR_TASK_EMPTY_TASK,									//万集任务模块,空任务
+    WJ_LIDAR_TASK_WRONG_TYPE,									//万集任务模块,错误类型
+    WJ_LIDAR_TASK_INVALID_TASK,									//万集任务模块,无效任务
+    WJ_LIDAR_TASK_MEASURE_FAILED,								//万集任务模块,测量失败
+
+    // 万集滤波
+    WJ_FILTER_ERROR_BASE                                        =0x06060000,
+    WJ_FILTER_LACK_OF_RESULT,                                   //万集滤波,结果不足以进行滤波
+    WJ_FILTER_FLUCTUATING,                                      //万集滤波,结果波动过大
 
     //task module, 任务模块  error from 0x10010000-0x1001FFFF
 	TASK_MODULE_ERROR_BASE 							= 0x10010000,
@@ -272,6 +413,9 @@ enum Error_code
 	COMMUNICATION_ANALYSIS_TIME_OUT,									//解析超时,
 	COMMUNICATION_EXCUTER_IS_BUSY,										//处理器正忙, 请稍等
 
+
+
+
 	//system module, 系统模块
 	SYSTEM_EXECUTOR_ERROR_BASE						= 0x12010000,		//系统执行模块,
 	SYSTEM_EXECUTOR_PARSE_ERROR,										//系统执行模块, 解析消息错误
@@ -279,12 +423,110 @@ enum Error_code
 	SYSTEM_EXECUTOR_STATUS_ERROR,										//系统执行模块, 状态错误
 	SYSTEM_EXECUTOR_CHECK_ERROR,										//系统执行模块, 检查错误
 
-	LOCATER_MSG_TABLE_NOT_EXIST ,
-    LOCATER_MSG_RESPONSE_TYPE_ERROR,
-    LOCATER_MSG_RESPONSE_INFO_ERROR,
-    LOCATER_MSG_REQUEST_INVALID,
-    LOCATER_MSG_RESPONSE_HAS_NO_REQUEST,
-    
+
+
+	//Dispatch 调度 模块 错误码
+	DISPATCH_ERROR_BASE								= 0x13000000,
+
+	//Dispatch_manager 调度管理模块 错误码
+	DISPATCH_MANAGER_ERROR_BASE						= 0x13010000,
+	DISPATCH_MANAGER_READ_PROTOBUF_ERROR,				//调度管理模块,读取参数错误
+	DISPATCH_MANAGER_STATUS_BUSY,						//调度管理模块,状态正忙
+	DISPATCH_MANAGER_STATUS_ERROR,						//调度管理模块,状态错误
+	DISPATCH_MANAGER_TASK_TYPE_ERROR,					//调度管理模块,任务类型错误
+	DISPATCH_MANAGER_IS_NOT_READY,						//调度管理模块,不在准备状态
+	DISPATCH_MANAGER_SPACE_LOCK_ERROR,					//调度管理模块,空间锁错误
+
+
+	DISPATCH_PROCESS_ERROR_BASE								= 0x13020000,
+	DISPATCH_PROCESS_IS_NOT_READY,						//调度流程, 不在准备状态
+	DISPATCH_PROCESS_DEVICE_TYPE_ERROR,					//调度流程, 设备类型错误
+	DISPATCH_PROCESS_DEVICE_STATUS_ERROR,				//调度流程, 设备状态错误
+	DISPATCH_PROCESS_TASK_STATUS_ERROR,					//调度流程, 任务类型错误
+	DISPATCH_PROCESS_COMMAND_KEY_REPEAT,				//调度流程, 唯一码错误
+	DISPATCH_PROCESS_INIT_ERROR,						//调度流程, 初始化错误
+
+
+	DISPATCH_DEVICE_ERROR_BASE								= 0x13030000,
+	DISPATCH_DEVICE_READ_PROTOBUF_ERROR,				//调度设备模块,读取参数错误
+	DISPATCH_DEVICE_STATUS_BUSY,						//调度设备模块,状态正忙
+	DISPATCH_DEVICE_STATUS_ERROR,						//调度设备模块,状态错误
+	DISPATCH_DEVICE_STATUS_DISCONNECT,					//调度设备模块,状态断连
+	DISPATCH_DEVICE_TASK_TYPE_ERROR,					//调度设备模块,任务类型错误
+	DISPATCH_DEVICE_TASK_OVER_TIME,						//调度设备模块,任务超时
+	DISPATCH_DEVICE_TASK_REPEAT,						//调度设备模块,任务重复, 任务已经存在
+	DISPATCH_DEVICE_IS_NOT_READY,						//调度设备模块,不在准备状态
+	DISPATCH_DEVICE_RESPONS_ERROR,						//调度设备模块,指令的执行失败
+	DISPATCH_DEVICE_TASK_NOTHINGNESS,					//调度设备模块,任务不存在
+	DISPATCH_DEVICE_TASK_LEVEL_ERROR,					//调度设备模块,任务等级错误
+
+
+	CARRIER_ERROR_BASE								= 0x13040000,
+	CARRIER_READ_PROTOBUF_ERROR,				//搬运器模块,读取参数错误
+	CARRIER_STATUS_BUSY,						//搬运器模块,状态正忙
+	CARRIER_STATUS_ERROR,						//搬运器模块,状态错误
+	CARRIER_STATUS_DISCONNECT,					//搬运器模块,状态断连
+	CARRIER_TASK_TYPE_ERROR,					//搬运器模块,任务类型错误
+	CARRIER_TASK_OVER_TIME,						//搬运器模块,任务超时
+	CARRIER_IS_NOT_READY,						//搬运器模块,不在准备状态
+	CARRIER_RESPONS_ERROR,						//搬运器模块,指令的执行失败
+	CARRIER_TASK_NOTHINGNESS,					//搬运器模块,任务不存在
+	CARRIER_POSE_ERROR,							//搬运器模块,姿态错误
+	CARRIER_CONRTOL_PARAMETER_ERROR,			//搬运器模块,控制参数错误
+
+	CATCHER_ERROR_BASE								= 0x13050000,
+	CATCHER_READ_PROTOBUF_ERROR,				//抓取器模块,读取参数错误
+	CATCHER_STATUS_BUSY,						//抓取器模块,状态正忙
+	CATCHER_STATUS_ERROR,						//抓取器模块,状态错误
+	CATCHER_STATUS_DISCONNECT,					//抓取器模块,状态断连
+	CATCHER_TASK_TYPE_ERROR,					//抓取器模块,任务类型错误
+	CATCHER_TASK_OVER_TIME,						//抓取器模块,任务超时
+	CATCHER_IS_NOT_READY,						//抓取器模块,不在准备状态
+	CATCHER_RESPONS_ERROR,						//抓取器模块,指令的执行失败
+	CATCHER_TASK_NOTHINGNESS,					//抓取器模块,任务不存在
+	CATCHER_POSE_ERROR,							//抓取器模块,姿态错误
+	CATCHER_CONRTOL_PARAMETER_ERROR,			//抓取器模块,控制参数错误
+
+	PASSAGEWAY_ERROR_BASE								= 0x13060000,
+	PASSAGEWAY_READ_PROTOBUF_ERROR,				//通道口模块,读取参数错误
+	PASSAGEWAY_STATUS_BUSY,						//通道口模块,状态正忙
+	PASSAGEWAY_STATUS_ERROR,						//通道口模块,状态错误
+	PASSAGEWAY_STATUS_DISCONNECT,					//通道口模块,状态断连
+	PASSAGEWAY_TASK_TYPE_ERROR,					//通道口模块,任务类型错误
+	PASSAGEWAY_TASK_OVER_TIME,						//通道口模块,任务超时
+	PASSAGEWAY_IS_NOT_READY,						//通道口模块,不在准备状态
+	PASSAGEWAY_RESPONS_ERROR,						//通道口模块,指令的执行失败
+	PASSAGEWAY_TASK_NOTHINGNESS,					//通道口模块,任务不存在
+
+
+	//DISPATCH_COORDINATES module, 通信模块
+	DISPATCH_COORDINATES_ERROR_BASE					= 0x13060000,
+	DISPATCH_COORDINATES_READ_PROTOBUF_ERROR,				//调度坐标模块,读取参数错误
+	DISPATCH_COORDINATES_ID_ERROR,							//调度坐标模块,坐标id错误
+	DISPATCH_COORDINATES_PATH_ERROR,						//调度坐标模块,路径方向错误
+	DISPATCH_COORDINATES_CAN_NOT_LOCK,						//调度坐标模块,不能加锁
+
+	//Dispatch_plc 调度plc模块
+	DISPATCH_PLC_ERROR_BASE							= 0x13070000,
+	DISPATCH_PLC_REQUEST_ERROR,								//调度plc模块,请求错误
+	DISPATCH_PLC_RESPONS_ERROR,								//调度plc模块,指令的执行失败
+	DISPATCH_PLC_STATUS_ERROR,								//调度plc模块,状态错误
+	DISPATCH_PLC_TIME_OUT,									//调度plc模块,超时
+
+
+	//snap7 通信模块 错误码
+	SNAP7_ERROR_BASE								= 0x1401000,
+	SNAP7_READ_PROTOBUF_ERROR,							//snap7通信模块,读取参数错误
+	SNAP7_CONNECT_ERROR,								//snap7通信模块,连接错误
+	SNAP7_DISCONNECT_ERROR,								//snap7通信模块,断连错误
+	SNAP7_READ_ERROR,									//snap7通信模块,读取错误
+	SNAP7_WRITE_ERROR,									//snap7通信模块,写入错误
+	SNAP7_ANALYSIS_TIME_OUT,									//解析超时,
+	SNAP7_EXCUTER_IS_BUSY,										//处理器正忙, 请稍等
+	
+	
+	
+	
     
     //parkspace allocator,车位分配模块
     PARKSPACE_ALLOCATOR_ERROR_BASE                  = 0x20010000,     
@@ -323,7 +565,6 @@ enum Error_code
 	DB_PROTOBUF_ERROR								//数据库配置参数读取错误
 
 
-
 };
 
 //错误等级,用来做故障处理
@@ -375,7 +616,7 @@ public://外部接口函数
     Error_manager(const Error_manager & error_manager);
     //赋值构造
     Error_manager(Error_code error_code, Error_level error_level = NORMAL,
-                  const char* p_error_description = NULL, int description_length = 0);
+                  const char* p_error_description = NULL);
     //赋值构造
     Error_manager(Error_code error_code, Error_level error_level , std::string & error_aggregate_string);
     //析构函数
@@ -385,12 +626,12 @@ public://外部接口函数
     void error_manager_init();
     //初始化
     void error_manager_init(Error_code error_code, Error_level error_level = NORMAL,
-                            const char* p_error_description = NULL, int description_length = 0);
+                            const char* p_error_description = NULL);
     //初始化
     void error_manager_init(Error_code error_code, Error_level error_level , std::string & error_aggregate_string);
     //重置
     void error_manager_reset(Error_code error_code, Error_level error_level = NORMAL,
-                             const char* p_error_description = NULL, int description_length = 0);
+                             const char* p_error_description = NULL);
     //重置
     void error_manager_reset(Error_code error_code, Error_level error_level , std::string & error_aggregate_string);
     //重置
@@ -419,14 +660,12 @@ public://外部接口函数
     //获取错误等级
     Error_level get_error_level();
     //获取错误描述的指针,(浅拷贝)
-    char* get_error_description();
-
-	int get_description_length();
+    std::string get_error_description();
 
     //复制错误描述,(深拷贝)
     //output:p_error_description     错误描述的字符串指针,不可以为NULL,必须要有实际的内存
     //output:description_length      错误描述的字符串长度,不可以为0,长度最好足够大,一般256即可。
-    void copy_error_description(const char* p_error_description, int description_length);
+    void copy_error_description(const char* p_error_description);
     //复制错误描述,(深拷贝)
     //output:error_description_string     错误描述的string
     void copy_error_description(std::string & error_description_string);
@@ -440,12 +679,12 @@ public://外部接口函数
     //错误等级,设定到固定值
     void set_error_level_location(Error_level error_level);
     //设置错误描述
-    void set_error_description(const char* p_error_description, int description_length = 0);
+    void set_error_description(const char* p_error_description);
     //设置错误描述
     void set_error_description(std::string & error_description_string);
 
     //尾部追加错误描述
-    void add_error_description(const char* p_error_description, int description_length = 0);
+    void add_error_description(const char* p_error_description);
     //尾部追加错误描述
     void add_error_description(std::string & error_description_string);
 
@@ -459,10 +698,6 @@ public://外部接口函数
 	//如果错误相同,则保留this的,将输入参数转入描述。
 	void compare_and_cover_error( Error_manager * p_error_manager);
 
-	//将所有的错误信息,格式化为字符串,用作日志打印。
-    //output:p_error_description     错误汇总的字符串指针,不可以为NULL,必须要有实际的内存
-    //output:description_length      错误汇总的字符串长度,不可以为0,长度最好足够大,一般256即可。
-    void translate_error_to_string(char* p_error_aggregate, int aggregate_length);
     //output:error_description_string     错误汇总的string
     void translate_error_to_string(std::string & error_aggregate_string);
     //错误码转字符串的简易版,可支持cout<<
@@ -474,8 +709,7 @@ public://外部接口函数
 protected:
     Error_code              m_error_code;               //错误码
     Error_level             m_error_level;              //错误等级
-    char*                   pm_error_description;       //错误描述
-    int                     m_description_length;       //错误描述的字符长度
+    std::string             m_error_description;		// 错误描述
 
 protected://内部功能函数
 public:

+ 11 - 3
message/message_base.proto

@@ -31,7 +31,7 @@ enum Message_type
     eParkspace_confirm_alloc_request_msg = 0x3A;//确认分配车位请求消息
     eParkspace_confirm_alloc_response_msg = 0x3B;//确认分配车位反馈消息
     eParkspace_allocation_data_msg = 0x3C;     //车位分配模块车位数据消息
-
+    eParkspace_allocation_data_response_msg =0x3D;//车位数据反馈消息
 
     eStore_command_request_msg=0x41;        //终端停车请求消息
     eStore_command_response_msg=0x42;       //停车请求反馈消息
@@ -57,6 +57,11 @@ enum Message_type
     eDispatch_manager_status_msg        = 0xea;     //调度管理的设备状态消息(调度底下所有硬件设备状态的汇总)
     eDispatch_manager_data_msg          = 0xeb;     //调度管理的设备详细的数据信息
 
+
+    eGround_detect_request_msg=0xf0;        //地面雷达测量请求消息
+    eGround_detect_response_msg=0xf1;       //地面雷达测量反馈消息
+    eGround_status_msg=0xf2;                //地面雷达状态消息
+
 }
 
 //通讯单元
@@ -79,6 +84,8 @@ enum Communicator
     //...
 
 
+    //地面测量单元
+	eGround_measurer=0x0f00;
 }
 ////base message 用于解析未知类型的消息
 message Base_info
@@ -162,11 +169,12 @@ enum Parkspace_status
     eParkspace_error            = 5;         //车位机械结构或硬件故障
 }
 
+//车位朝向, 小号朝前朝南, 大号朝后朝北
 enum Direction
 {
     eDirection_unknow = 0;
-    eForward = 1;
-    eBackward = 2;
+    eForward = 1;                   //小号朝前朝南
+    eBackward = 2;                  //大号朝后朝北
 }
 
 //车位分配路线(根据中跑车的路线来定)

+ 1 - 1
message/parkspace_allocation_message.proto

@@ -106,7 +106,7 @@ message Parkspace_force_update_response_msg
     repeated Parkspace_info             manual_parkspace_info_ex=4;    //已修改后的车位信息
 }
 
-//5.确认分配车位
+// 5.确认分配车位
 message Parkspace_confirm_alloc_request_msg
 {
     required Base_info                  base_info=1;            //消息类型

+ 1 - 1
setting/communication.prototxt

@@ -8,7 +8,7 @@ communication_parameters
 #   connect_string_vector:"tcp://192.168.2.125:9876"
 #   connect_string_vector:"tcp://192.168.2.166:1234"
 
-    bind_string:"tcp://192.168.2.174:30008"
+    bind_string:"tcp://192.168.2.127:30008"
     connect_string_vector:"tcp://192.168.2.127:30000"
 }
 

+ 2 - 2
setting/database_communication.prototxt

@@ -12,9 +12,9 @@ database_communication_configurations
 {
     db_ip:"127.0.0.1",
     db_port:3306,
-    db_username:"wk",
+    db_username:"zx",
     db_passwd:"123456",
-    db_name:"chutian_parkingspace",
+    db_name:"chutian_parkspace",
     db_conn_pool_size:5
 }
 

+ 23 - 7
test/test_parkspace_sample.cpp

@@ -38,12 +38,26 @@ int main()
 //
 //	Database_controller::get_instance_references().database_controller_init();
 
-
-	Database_controller::get_instance_pointer()->database_controller_init();
+	Error_manager ec = Database_controller::get_instance_references().database_controller_init();
+	if(ec!= SUCCESS)
+    {
+	    LOG(ERROR) << ec.to_string();
+	    return -1;
+    }
 //	Database_controller::get_instance_pointer()->database_controller_init("127.0.0.1", 3306, "wk", "123456", "test");
 
-    p_parkspace_allocation_communicater->communication_init();
-	p_parkspace_manage->parkspace_manager_init(4);
+    ec = Parkspace_communicator::get_instance_references().communication_init();
+    if(ec!= SUCCESS)
+    {
+        LOG(ERROR) << ec.to_string();
+        return -1;
+    }
+	ec = Parkspace_manager::get_instance_references().parkspace_manager_init(4);
+    if(ec!= SUCCESS)
+    {
+        LOG(ERROR) << ec.to_string();
+        return -1;
+    }
 //  p_parkspace_allocation_communicater->communication_bind("tcp://192.168.10.210:30005");
 //	p_parkspace_allocation_communicater->communication_bind("tcp://192.168.1.38:30005");
 //  p_parkspace_allocation_communicater->communication_run();
@@ -74,7 +88,7 @@ int main()
     // p_parkspace_allocation_communicater->update_parkspace_status(parkspace_status);
     int k=1;
 
-    while(1) {
+    while(getchar() != 'q') {
         // message::Parkspace_info space;
         // space.set_parkspace_id(3);
         // space.set_index(k);
@@ -86,8 +100,10 @@ int main()
         // space.set_parkspace_status(message::Parkspace_status::eParkspace_occupied);
         // p_parkspace_allocator->update_parkspace_status(3, space);
         usleep(1000*1000);
-        k++;
     }
-	Database_controller::get_instance_pointer()->database_controller_uninit();
+
+    Parkspace_communicator::get_instance_references().communication_uninit();
+    Parkspace_manager::get_instance_references().parkspace_manager_uninit();
+	Database_controller::get_instance_references().database_controller_uninit();
     return 0;
 }

+ 0 - 0
tool/binary_buf.cpp


+ 0 - 0
tool/binary_buf.h


+ 0 - 0
tool/binary_buf.puml


+ 0 - 0
tool/thread_condition.cpp


+ 0 - 0
tool/thread_condition.h


+ 0 - 0
tool/thread_condition.puml


+ 6 - 10
tool/thread_safe_list.h

@@ -156,9 +156,8 @@ bool Thread_safe_list<T>::wait_and_pop(T& value)
 		}
 		else
 		{
-//			value = move(*m_data_list.front());
-			value = (*m_data_list.front());
-
+			value = std::move(*m_data_list.front());
+		
 			m_data_list.pop_front();
 			return true;
 		}
@@ -182,9 +181,8 @@ bool Thread_safe_list<T>::try_pop(T& value)
 		}
 		else
 		{
-//			value = move(*m_data_list.front());
-			value = (*m_data_list.front());
-
+			value = std::move(*m_data_list.front());
+	
 			m_data_list.pop();
 			return true;
 		}
@@ -256,8 +254,7 @@ bool Thread_safe_list<T>::push(T new_value)
 	}
 	else
 	{
-//		std::shared_ptr<T> data(std::make_shared<T>(move(new_value)));
-		std::shared_ptr<T> data(std::make_shared<T>((new_value)));
+		std::shared_ptr<T> data(std::make_shared<T>(std::move(new_value)));
 		std::unique_lock<std::mutex> lk(m_mutex);
 		m_data_list.push_back(data);
 		m_data_cond.notify_one();
@@ -286,8 +283,7 @@ bool Thread_safe_list<T>::clear_and_delete()
 	while (!m_data_list.empty())
 	{
 		T res = NULL;
-//		res = move(*m_data_list.front());
-		res = (*m_data_list.front());
+		res = std::move(*m_data_list.front());
 
 		m_data_list.pop_front();
 		if(res != NULL)

+ 0 - 0
tool/thread_safe_queue.cpp


+ 4 - 5
tool/thread_safe_queue.h

@@ -41,7 +41,6 @@
 #include <mutex>
 #include <condition_variable>
 
-
 template<class T>
 class Thread_safe_queue
 {
@@ -154,7 +153,7 @@ bool Thread_safe_queue<T>::wait_and_pop(T& value)
 		}
 		else
 		{
-			value = move(*m_data_queue.front());
+			value = std::move(*m_data_queue.front());
 			m_data_queue.pop();
 			return true;
 		}
@@ -178,7 +177,7 @@ bool Thread_safe_queue<T>::try_pop(T& value)
 		}
 		else
 		{
-			value = move(*m_data_queue.front());
+			value = std::move(*m_data_queue.front());
 			m_data_queue.pop();
 			return true;
 		}
@@ -247,7 +246,7 @@ bool Thread_safe_queue<T>::push(T new_value)
 	}
 	else
 	{
-		std::shared_ptr<T> data(std::make_shared<T>(move(new_value)));
+		std::shared_ptr<T> data(std::make_shared<T>(std::move(new_value)));
 		std::unique_lock<std::mutex> lk(m_mutex);
 		m_data_queue.push(data);
 		m_data_cond.notify_one();
@@ -274,7 +273,7 @@ bool Thread_safe_queue<T>::clear_and_delete()
 	while (!m_data_queue.empty())
 	{
 		T res = NULL;
-		res = move(*m_data_queue.front());
+		res = std::move(*m_data_queue.front());
 		m_data_queue.pop();
 		if(res != NULL)
 		{

+ 0 - 0
tool/thread_safe_queue.puml