Explorar o código

楚天大厦主流程,消息粗略定义

zx %!s(int64=5) %!d(string=hai) anos
achega
b41e164c1e

+ 31 - 0
CMakeLists.txt

@@ -0,0 +1,31 @@
+project(nnxx_tests)
+
+cmake_minimum_required(VERSION 3.5)
+
+set (CMAKE_CXX_STANDARD 11)
+
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(nanomsg REQUIRED nanomsg)
+FIND_PACKAGE(Protobuf REQUIRED)
+FIND_PACKAGE(Glog REQUIRED)
+
+include_directories(
+        /usr/local/include
+        ${PROTOBUF_INCLUDE_DIRS}
+        ./message
+        ./nnxx
+        ./error_code
+)
+
+message(STATUS ${EXECUTABLE_OUTPUT_PATH})
+
+aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/message message_src )
+aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/lidar_locate locate_src )
+aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/robot robot_src )
+
+add_executable(terminal main.cpp ./error_code/error_code.cpp ./nnxx/nnxx_client.cpp
+        ${locate_src} ${robot_src} ${message_src})
+target_link_libraries(terminal nnxx nanomsg ${PROTOBUF_LIBRARIES}
+        /usr/local/lib/libglog.a
+        /usr/local/lib/libgflags.a)
+

+ 532 - 0
error_code/error_code.cpp

@@ -0,0 +1,532 @@
+
+//Error_code是错误码的底层通用模块,
+//功能:用作故障分析和处理。
+
+//用法:所有的功能接口函数return错误管理类,
+//然后上层判断分析错误码,并进行故障处理。
+
+
+
+#include "error_code.h"
+
+/////////////////////////////////////////////
+//构造函数
+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);
+    return ;
+}
+//赋值构造
+Error_manager::Error_manager(Error_code error_code, Error_level error_level,
+    const char* p_error_description, int description_length)
+{
+    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 ;
+}
+//赋值构造
+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 ;
+}
+//析构函数
+Error_manager::~Error_manager()
+{
+    free_description();
+}
+
+//初始化
+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)
+{
+    m_error_code = error_code;
+    m_error_level = error_level;
+    reallocate_memory_and_copy_string(p_error_description, description_length);
+    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);
+    return ;
+}
+//重置
+void Error_manager::error_manager_reset(Error_code error_code, Error_level error_level, const char* p_error_description, int description_length)
+{
+    m_error_code = error_code;
+    m_error_level = error_level;
+    reallocate_memory_and_copy_string(p_error_description, description_length);
+    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 ;
+}
+//重置
+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);
+    return ;
+}
+//清除所有内容
+void Error_manager::error_manager_clear_all()
+{
+    m_error_code = SUCCESS;
+    m_error_level = NORMAL;
+    free_description();
+}
+
+//重载=
+Error_manager& Error_manager::operator=(const Error_manager & error_manager)
+{
+    error_manager_reset(error_manager);
+}
+//重载=,支持Error_manager和Error_code的直接转化,会清空错误等级和描述
+Error_manager& Error_manager::operator=(Error_code error_code)
+{
+    error_manager_clear_all();
+    set_error_code(error_code);
+}
+//重载==
+bool Error_manager::operator==(const Error_manager & error_manager)
+{
+    is_equal_error_manager(error_manager);
+}
+//重载==,支持Error_manager和Error_code的直接比较
+bool Error_manager::operator==(Error_code error_code)
+{
+    if(m_error_code == error_code)
+    {
+        return true;
+    }
+    else
+    {
+        return false;
+    }
+}
+
+//重载!=
+bool Error_manager::operator!=(const Error_manager & error_manager)
+{
+    ! is_equal_error_manager(error_manager);
+}
+//重载!=,支持Error_manager和Error_code的直接比较
+bool Error_manager::operator!=(Error_code error_code)
+{
+    if(m_error_code != error_code)
+    {
+        return true;
+    }
+    else
+    {
+        return false;
+    }
+}
+//重载<<,支持cout<<
+std::ostream & operator<<(std::ostream &out, Error_manager &error_manager)
+{
+	out << error_manager.to_string();
+	return out;
+}
+
+//获取错误码
+Error_code Error_manager::get_error_code()
+{
+    return m_error_code;
+}
+//获取错误等级
+Error_level Error_manager::get_error_level()
+{
+    return m_error_level;
+}
+//获取错误描述的指针,(浅拷贝)
+char* Error_manager::get_error_description()
+{
+    return pm_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)
+{
+    if(p_error_description != NULL && pm_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++;
+        }
+    }
+
+    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;
+}
+
+//设置错误码
+void Error_manager::set_error_code(Error_code error_code)
+{
+    m_error_code = error_code;
+    return;
+}
+//比较错误等级并升级,取高等级的结果
+void Error_manager::set_error_level_up(Error_level error_level)
+{
+    if(m_error_level < error_level)
+    {
+        m_error_level = error_level;
+    }
+    return;
+}
+//比较错误等级并降级,取低等级的结果
+void Error_manager::set_error_level_down(Error_level error_level)
+{
+    if(m_error_level > error_level)
+    {
+        m_error_level = error_level;
+    }
+    return;
+}
+//错误等级,设定到固定值
+void Error_manager::set_error_level_location(Error_level error_level)
+{
+    m_error_level = error_level;
+    return;
+}
+//设置错误描述
+void Error_manager::set_error_description(const char* p_error_description, int description_length)
+{
+    reallocate_memory_and_copy_string(p_error_description, description_length);
+    return ;
+}
+//设置错误描述
+void Error_manager::set_error_description(std::string & error_description_string)
+{
+    reallocate_memory_and_copy_string(error_description_string);
+    return ;
+}
+
+//尾部追加错误描述
+void Error_manager::add_error_description(const char* p_error_description, int description_length)
+{
+    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;
+    }
+    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);
+    }
+}
+
+//比较错误是否相同,
+// 注:只比较错误码和等级
+bool Error_manager::is_equal_error_manager(const Error_manager & error_manager)
+{
+    if(this->m_error_code == error_manager.m_error_code
+       && this->m_error_level == error_manager.m_error_level)
+    {
+        return true;
+    }
+    else
+    {
+        return false;
+    }
+}
+//比较并覆盖错误,讲低级错误转为字符串存放于描述中,
+//如果错误相同,则保留this的,将输入参数转入描述。
+void Error_manager::compare_and_cover_error(const Error_manager & error_manager)
+{
+    if(this->m_error_code == SUCCESS)
+    {
+        error_manager_reset(error_manager);
+    }
+    else if (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;
+        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);
+
+            error_manager_reset(error_manager);
+            add_error_description(pt_string_inside,t_string_inside_length);
+        }
+        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);
+        }
+    }
+}
+//比较并覆盖错误,讲低级错误转为字符串存放于描述中,
+//如果错误相同,则保留this的,将输入参数转入描述。
+void Error_manager::compare_and_cover_error( Error_manager * p_error_manager)
+{
+	if(this->m_error_code == SUCCESS)
+	{
+		error_manager_reset(*p_error_manager);
+	}
+	else if (p_error_manager->m_error_code == SUCCESS)
+	{
+		//
+	}
+	else
+	{
+		Error_manager t_error_manager_new;
+		char* pt_string_inside = NULL;
+		int t_string_inside_length = 0;
+		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);
+
+			error_manager_reset(*p_error_manager);
+			add_error_description(pt_string_inside,t_string_inside_length);
+		}
+		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);
+		}
+	}
+}
+
+//将所有的错误信息,格式化为字符串,用作日志打印。
+//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 );
+
+    error_aggregate_string = t_string_array ;
+    if(pm_error_description != NULL)
+    {
+        error_aggregate_string += pm_error_description;
+    }
+    else
+    {
+        //error_aggregate_string += "NULL";
+    }
+}
+//错误码转字符串的简易版,可支持cout<<
+//return     错误汇总的string
+std::string Error_manager::to_string()
+{
+    std::string t_string;
+    translate_error_to_string(t_string);
+    return t_string;
+}
+
+
+
+
+//释放错误描述的内存,
+void Error_manager::free_description()
+{
+    if(pm_error_description != NULL)
+    {
+        free (pm_error_description);
+        pm_error_description = NULL;
+    }
+    m_description_length = 0;
+}
+
+//重新分配错误描述的内存,并从外部拷贝新的(深拷贝)
+//input:p_error_description     错误描述的字符串指针,可以为NULL,
+//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;
+}
+
+
+//重新分配错误描述的内存,并从外部拷贝新的(深拷贝)
+//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()  );
+    }
+}
+
+
+
+
+

+ 255 - 0
error_code/error_code.h

@@ -0,0 +1,255 @@
+
+//Error_code是错误码的底层通用模块,
+//功能:用作故障分析和处理。
+
+//用法:所有的功能接口函数return错误管理类,
+//然后上层判断分析错误码,并进行故障处理。
+
+
+
+#ifndef TEST_ERROR_ERROR_CODE_H
+#define TEST_ERROR_ERROR_CODE_H
+
+#include <string>
+#include <string.h>
+#include<iostream>
+
+//错误管理类转化为字符串 的前缀,固定长度为58
+//这个是由显示格式来确定的,如果要修改格式或者 Error_code长度超过8位,Error_level长度超过2位,折需要重新计算
+#define ERROR_NAMAGER_TO_STRING_FRONT_LENGTH   58
+
+//进程加锁的状态,
+enum Lock_status
+{
+    UNLOCK      = 0,
+    LOCK        = 1,
+};
+
+//设备使能状态,
+enum Able_status
+{
+    UNABLE      = 0,
+    ENABLE      = 1,
+};
+
+//数据是否为空
+enum Empty_status
+{
+    NON_EMPTY   = 0,
+    EMPTY       = 1,
+};
+
+
+//错误码的枚举,用来做故障分析
+enum Error_code
+{
+    //成功,没有错误,默认值0
+    SUCCESS                         = 0x00000000,
+
+
+    //基本错误码,
+    ERROR                           = 0x00000001,//错误
+    PARTIAL_SUCCESS                 = 0x00000002,//部分成功
+    WARNING                         = 0x00000003,//警告
+    FAILED                          = 0x00000004,//失败
+
+    NO_DATA                          = 0x00000010,//没有数据,传入参数容器内部没有数据时,
+
+    POINTER_IS_NULL                 = 0x00000101,//空指针
+    PARAMETER_ERROR                 = 0x00000102,//参数错误,传入参数不符合规范时,
+    POINTER_MALLOC_FAIL             = 0x00000103,//手动分配内存失败
+
+    CLASS_BASE_FUNCTION_CANNOT_USE  = 0x00000201,//基类函数不允许使用,必须使用子类的
+
+
+//    错误码的规范,
+//    错误码是int型,32位,十六进制。
+//    例如0x12345678
+//    12表示功能模块,例如:laser雷达模块               	框架制定
+//    34表示文件名称,例如:laser_livox.cpp             框架制定
+//    56表示具体的类,例如:class laser_livox           个人制定
+//    78表示类的函数,例如:laser_livox::start();       个人制定
+//    注:错误码的制定从1开始,不要从0开始,
+//        0用作错误码的基数,用来位运算,来判断错误码的范围。
+
+//    nnxx client
+    NNXX_CLIENT_ERROR                = 0x01000000,
+    NNXX_CLIENT_REQUEST_TIMEOUT,
+    NNXX_CLIENT_REQUEST_UNKNOW,
+    NNXX_CLIENT_UNCONNECT,
+
+    //locate 错误
+    LOCATE_RESPONSE_PARSE_ERROR     =   0x02000000,
+
+};
+
+//错误等级,用来做故障处理
+enum Error_level
+{
+//    正常,没有错误,默认值0
+    NORMAL                = 0,
+
+
+//    轻微故障,可忽略的故障,NEGLIGIBLE_ERROR
+//    提示作用,不做任何处理,不影响代码的流程,
+//    用作一些不重要的事件,即使出错也不会影响到系统功能,
+//    例如:文件保存错误,等
+    NEGLIGIBLE_ERROR      = 1,
+
+
+//    一般故障,MINOR_ERROR
+//    用作底层功能函数的错误返回,表示该功能函数执行失败,
+//    返回给应用层之后,需要做故障分析和处理,
+//    例如:雷达数据传输失败,应用层就需要进行重新扫描,或者重连,或者重置参数等。
+    MINOR_ERROR           = 2,
+
+
+//    严重故障,MAJOR_ERROR
+//    用作应用层的任务事件的结果,表示该功能模块失败。
+//    通常是底层函数返回一般故障之后,应用层无法处理并解决故障,此时就要进行故障升级,
+//    从一般故障升级为严重故障,然后进行回退流程,回退已经执行的操作,最终回到故障待机状态。
+//    需要外部清除故障,并复位至正常待机状态,才能恢复功能的使用。
+//    例如:雷达扫描任务失败,且无法自动恢复。
+    MAJOR_ERROR           = 3,
+
+
+//    致命故障,CRITICAL_ERROR
+//    系统出现致命错误。导致系统无法正常运行,
+//    此时系统应该紧急停机,执行紧急流程,快速停机。
+//    此时不允许再执行任何函数和任务指令,防止系统故障更加严重。
+//    也不需要做任何错误处理了,快速执行紧急流程。
+//    例如:内存错误,进程挂死,关键设备失控,监控设备报警,等
+    CRITICAL_ERROR        = 4,
+};
+
+
+class Error_manager
+{
+public://外部接口函数
+    //构造函数
+    Error_manager();
+    //拷贝构造
+    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);
+    //赋值构造
+    Error_manager(Error_code error_code, Error_level error_level , std::string & error_aggregate_string);
+    //析构函数
+    ~Error_manager();
+
+    //初始化
+    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);
+    //初始化
+    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);
+    //重置
+    void error_manager_reset(Error_code error_code, Error_level error_level , std::string & error_aggregate_string);
+    //重置
+    void error_manager_reset(const Error_manager & error_manager);
+    //清除所有内容
+    void error_manager_clear_all();
+
+    //重载=
+    Error_manager& operator=(const Error_manager & error_manager);
+    //重载=,支持Error_manager和Error_code的直接转化,会清空错误等级和描述
+    Error_manager& operator=(Error_code error_code);
+    //重载==
+    bool operator==(const Error_manager & error_manager);
+    //重载==,支持Error_manager和Error_code的直接比较
+    bool operator==(Error_code error_code);
+    //重载!=
+    bool operator!=(const Error_manager & error_manager);
+    //重载!=,支持Error_manager和Error_code的直接比较
+    bool operator!=(Error_code error_code);
+	//重载<<,支持cout<<
+	friend std::ostream & operator<<(std::ostream &out, Error_manager &error_manager);
+
+
+    //获取错误码
+    Error_code get_error_code();
+    //获取错误等级
+    Error_level get_error_level();
+    //获取错误描述的指针,(浅拷贝)
+    char* 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);
+    //复制错误描述,(深拷贝)
+    //output:error_description_string     错误描述的string
+    void copy_error_description(std::string & error_description_string);
+
+    //设置错误码
+    void set_error_code(Error_code error_code);
+    //比较错误等级并升级,取高等级的结果
+    void set_error_level_up(Error_level error_level);
+    //比较错误等级并降级,取低等级的结果
+    void set_error_level_down(Error_level error_level);
+    //错误等级,设定到固定值
+    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(std::string & error_description_string);
+
+    //尾部追加错误描述
+    void add_error_description(const char* p_error_description, int description_length = 0);
+    //尾部追加错误描述
+    void add_error_description(std::string & error_description_string);
+
+    //比较错误是否相同,
+    // 注:只比较错误码和等级
+	bool is_equal_error_manager(const Error_manager & error_manager);
+	//比较并覆盖错误,讲低级错误转为字符串存放于描述中,
+	//如果错误相同,则保留this的,将输入参数转入描述。
+	void compare_and_cover_error(const Error_manager & error_manager);
+	//比较并覆盖错误,讲低级错误转为字符串存放于描述中,
+	//如果错误相同,则保留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<<
+    //return     错误汇总的string
+    std::string to_string();
+
+
+
+protected:
+    Error_code              m_error_code;               //错误码
+    Error_level             m_error_level;              //错误等级
+    char*                   pm_error_description;       //错误描述
+    int                     m_description_length;       //错误描述的字符长度
+
+protected://内部功能函数
+public:
+    //释放错误描述的内存,
+    void free_description();
+
+    //重新分配错误描述的内存,并从外部拷贝新的(深拷贝)
+    //input:p_error_description     错误描述的字符串指针,可以为NULL,
+    //input:description_length      错误描述的字符串长度,如果为0,则从p_error_description里面获取有效的长度
+    void reallocate_memory_and_copy_string(const char* p_error_description, int description_length = 0);
+
+    //重新分配错误描述的内存,并从外部拷贝新的(深拷贝)
+    //input:error_aggregate_string     错误描述的string
+    void reallocate_memory_and_copy_string(std::string & error_aggregate_string);
+};
+
+
+
+
+#endif //TEST_ERROR_ERROR_CODE_H
+
+

+ 79 - 0
lidar_locate/Locate_communicator.cpp

@@ -0,0 +1,79 @@
+//
+// Created by zx on 2020/6/18.
+//
+
+#include "Locate_communicator.h"
+#include "locate_message.pb.h"
+
+
+Locate_communicator* Locate_communicator::mp_locate_communicator=NULL;
+
+Locate_communicator::Locate_communicator()
+{
+
+}
+Locate_communicator::~Locate_communicator()
+{
+
+}
+Error_manager Locate_communicator::locate_request(message::Locate_request_msg request,message::Locate_response_msg& result,unsigned int timeout)
+{
+    /*
+     * 检查request合法性,以及模块状态
+     */
+
+    std::string response_string;
+    Error_manager code=m_nnxx_client.request(request.SerializeAsString(),response_string,timeout);
+
+    if(code==SUCCESS)
+    {
+        //解析返回数据
+        message::Locate_response_msg response;
+        if(false==response.ParseFromString(response_string))
+        {
+            //解析response数据错误,
+            return Error_manager(LOCATE_RESPONSE_PARSE_ERROR,MAJOR_ERROR,"response string parse failed");
+        }
+        else if(response.error_code()==SUCCESS)
+        {
+            result=response;
+            return SUCCESS;
+        }
+        else
+        {
+            ///将response中的错误信息,转换成错误码,返回
+            return Error_manager(Error_code(response.error_code()),MAJOR_ERROR,response.error_description().c_str());
+        }
+    }
+    else if(code.get_error_level()==MINOR_ERROR)
+    {
+        //处理底层处理不了的错误
+    }
+    else if(code.get_error_level()==MAJOR_ERROR)
+    {
+        //本模块功能失败的错误,向上抛出
+        return code;
+    }
+}
+
+Error_manager Locate_communicator::create_locate_communicator(std::string str_ip,int port)
+{
+    Error_manager code=SUCCESS;
+    if(mp_locate_communicator==NULL)
+    {
+        mp_locate_communicator=new Locate_communicator();
+        char connect_str[255]={0};
+        sprintf(connect_str,"tcp://%s:%d",str_ip.c_str(),port);
+        code=mp_locate_communicator->m_nnxx_client.connect(connect_str);
+        return code;
+    } else
+    {
+        return code;
+    }
+
+}
+
+Locate_communicator* Locate_communicator::get_instance()
+{
+    return mp_locate_communicator;
+}

+ 24 - 0
lidar_locate/Locate_communicator.h

@@ -0,0 +1,24 @@
+//
+// Created by zx on 2020/6/18.
+//
+
+#ifndef NNXX_TESTS_LOCATE_COMMUNICATOR_H
+#define NNXX_TESTS_LOCATE_COMMUNICATOR_H
+
+#include <mutex>
+#include "nnxx_client.h"
+#include "locate_message.pb.h"
+class Locate_communicator {
+public:
+    virtual ~Locate_communicator();
+    Error_manager locate_request(message::Locate_request_msg request,message::Locate_response_msg& result,unsigned int timeout=3000);
+    static Error_manager create_locate_communicator(std::string str_ip,int port);
+    static Locate_communicator* get_instance();
+protected:
+    Locate_communicator();
+    Client          m_nnxx_client;
+    static  Locate_communicator*  mp_locate_communicator;
+};
+
+
+#endif //NNXX_TESTS_LOCATE_COMMUNICATOR_H

+ 59 - 0
main.cpp

@@ -0,0 +1,59 @@
+//
+// Created by zx on 2020/6/18.
+//
+
+#include <iostream>
+#include <glog/logging.h>
+#include "setting.pb.h"
+#include "lidar_locate/Locate_communicator.h"
+
+#include <fcntl.h>
+#include <google/protobuf/io/zero_copy_stream_impl.h>
+#include <google/protobuf/text_format.h>
+using google::protobuf::io::FileInputStream;
+using google::protobuf::io::FileOutputStream;
+using google::protobuf::io::ZeroCopyInputStream;
+using google::protobuf::io::CodedInputStream;
+using google::protobuf::io::ZeroCopyOutputStream;
+using google::protobuf::io::CodedOutputStream;
+using google::protobuf::Message;
+
+bool read_proto_param(std::string file, ::google::protobuf::Message& parameter)
+{
+    int fd = open(file.c_str(), O_RDONLY);
+    if (fd == -1) return false;
+    FileInputStream* input = new FileInputStream(fd);
+    bool success = google::protobuf::TextFormat::Parse(input, &parameter);
+    delete input;
+    close(fd);
+    return success;
+}
+
+int main(int argc,char* argv[])
+{
+    //读取配置
+    global::setting parameter;
+    if(false==read_proto_param("",parameter))
+    {
+        LOG(ERROR)<<"read setting file failed";
+        return 0;
+    }
+
+    //创建各个模块的通讯对象
+    global::locate_setting locate_parameter=parameter.locate_parameter();
+    Error_manager code=Locate_communicator::create_locate_communicator(locate_parameter.ip(),locate_parameter.port());
+    if(code!=SUCCESS)
+    {
+        LOG(ERROR)<<code.to_string();
+    }
+    //测试各个模块
+    message::Command_message cmd_msg;
+    message::Locate_request_msg request;
+    message::Locate_response_msg result;
+    code=Locate_communicator::get_instance()->locate_request(request,result);
+    if(code!=SUCCESS)
+    {
+        LOG(ERROR)<<code.to_string();
+    }
+    return 0;
+}

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 2238 - 0
message/hardware_message.pb.cc


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1525 - 0
message/hardware_message.pb.h


+ 55 - 0
message/hardware_message.proto

@@ -0,0 +1,55 @@
+syntax = "proto2";
+package message;
+import "message_base.proto";
+
+enum Hardware_statu        //硬件状态
+{
+    eNormal=0;             //正常且空闲
+    eBusy=1;               //工作中
+    eMiss=2;                //连接丢失
+    eError=3;              //故障报错
+
+}
+
+//硬件位置.
+message Position
+{
+    required float x=1;
+    required float y=2;
+    required float z=3;
+}
+
+//搬运器状态
+message Carrier_status
+{
+    required Hardware_statu             statu=1;                   //状态
+    optional Command_message            cmd_msg=2;                 //正在执行的指令信息(可无)
+    optional string                     error_destination=3;       //搬运器错误信息(可无)
+    optional Position                   position=4;                //搬运器位置(z表示电梯位置)
+    required bool                       empty=5;                   //是否空载
+}
+
+//所有硬件状态集合
+message Harware_statu_msg
+{
+    required Carrier_status             carrier1_statu=1;           //搬运器1状态
+    required Carrier_status             carrier2_statu=2;           //搬运器2状态
+    required Carrier_status             carrier3_statu=3;           //搬运器3状态
+}
+
+//执行搬运请求
+message Execute_request_msg
+{
+    required Command_message        cmd_msg=1;                 //指令信息
+    optional int32                  time_out=3 [default=200000];           //定位测量超时设置,默认200s
+}
+
+//搬运动作执行完成后反馈结果
+message Execute_response_msg
+{
+    required Command_message        cmd_msg=1;
+    required int32                  error_code=2;
+    optional string                 error_description=3;
+}
+
+

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1592 - 0
message/locate_message.pb.cc


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1110 - 0
message/locate_message.pb.h


+ 49 - 0
message/locate_message.proto

@@ -0,0 +1,49 @@
+syntax = "proto2";
+package message;
+import "message_base.proto";
+
+enum Lidar_statu        //雷达状态
+{
+    eNormal=0;
+    eBusy=1;
+    eLidarMiss=2;
+
+}
+
+message Locate_status_msg
+{
+    optional Command_message            cmd_msg=1;                 //正在执行的指令信息(可无)
+    required Lidar_statu                statu=2;                       //测量雷达连接状态
+}
+
+//定位类型
+enum Locate_type
+{
+    eReal_time=0;           //实时定位
+    eTrigger=1;             //触发式定位
+}
+
+message Locate_request_msg
+{
+    required Command_message            cmd_msg=1;                 //指令信息
+    required Locate_type                locate_type=2;
+    optional int32                      time_out=3 [default=3000];           //定位测量超时设置
+}
+
+
+message Locate_response_msg
+{
+    required Command_message            cmd_msg=1;
+    required int32                      error_code=2;
+    optional string                     error_description=3;
+    optional float                      length=4;
+    optional float                      width=5;
+    optional float                      height=6;
+    optional float                      wheel_base=7;
+    optional float                      x=8;
+    optional float                      y=9;
+    optional float                      theta=10;
+
+}
+
+

+ 542 - 0
message/message_base.pb.cc

@@ -0,0 +1,542 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: message_base.proto
+
+#include "message_base.pb.h"
+
+#include <algorithm>
+
+#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/stubs/port.h>
+#include <google/protobuf/stubs/once.h>
+#include <google/protobuf/io/coded_stream.h>
+#include <google/protobuf/wire_format_lite_inl.h>
+#include <google/protobuf/descriptor.h>
+#include <google/protobuf/generated_message_reflection.h>
+#include <google/protobuf/reflection_ops.h>
+#include <google/protobuf/wire_format.h>
+// This is a temporary google only hack
+#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
+#include "third_party/protobuf/version.h"
+#endif
+// @@protoc_insertion_point(includes)
+namespace message {
+class Command_messageDefaultTypeInternal {
+ public:
+  ::google::protobuf::internal::ExplicitlyConstructed<Command_message>
+      _instance;
+} _Command_message_default_instance_;
+}  // namespace message
+namespace protobuf_message_5fbase_2eproto {
+void InitDefaultsCommand_messageImpl() {
+  GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
+  ::google::protobuf::internal::InitProtobufDefaultsForceUnique();
+#else
+  ::google::protobuf::internal::InitProtobufDefaults();
+#endif  // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
+  {
+    void* ptr = &::message::_Command_message_default_instance_;
+    new (ptr) ::message::Command_message();
+    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
+  }
+  ::message::Command_message::InitAsDefaultInstance();
+}
+
+void InitDefaultsCommand_message() {
+  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+  ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsCommand_messageImpl);
+}
+
+::google::protobuf::Metadata file_level_metadata[1];
+const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[1];
+
+const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Command_message, _has_bits_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Command_message, _internal_metadata_),
+  ~0u,  // no _extensions_
+  ~0u,  // no _oneof_case_
+  ~0u,  // no _weak_field_map_
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Command_message, command_id_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Command_message, act_type_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Command_message, from_id_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Command_message, destination_id_),
+  0,
+  1,
+  2,
+  3,
+};
+static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+  { 0, 9, sizeof(::message::Command_message)},
+};
+
+static ::google::protobuf::Message const * const file_default_instances[] = {
+  reinterpret_cast<const ::google::protobuf::Message*>(&::message::_Command_message_default_instance_),
+};
+
+void protobuf_AssignDescriptors() {
+  AddDescriptors();
+  ::google::protobuf::MessageFactory* factory = NULL;
+  AssignDescriptors(
+      "message_base.proto", schemas, file_default_instances, TableStruct::offsets, factory,
+      file_level_metadata, file_level_enum_descriptors, NULL);
+}
+
+void protobuf_AssignDescriptorsOnce() {
+  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+  ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
+}
+
+void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
+void protobuf_RegisterTypes(const ::std::string&) {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 1);
+}
+
+void AddDescriptorsImpl() {
+  InitDefaults();
+  static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+      "\n\022message_base.proto\022\007message\"v\n\017Command"
+      "_message\022\022\n\ncommand_id\030\001 \002(\005\022&\n\010act_type"
+      "\030\002 \002(\0162\024.message.Action_type\022\017\n\007from_id\030"
+      "\003 \002(\005\022\026\n\016destination_id\030\004 \002(\005*#\n\013Action_"
+      "type\022\t\n\005ePark\020\000\022\t\n\005ePick\020\001"
+  };
+  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
+      descriptor, 186);
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
+    "message_base.proto", &protobuf_RegisterTypes);
+}
+
+void AddDescriptors() {
+  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+  ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
+}
+// Force AddDescriptors() to be called at dynamic initialization time.
+struct StaticDescriptorInitializer {
+  StaticDescriptorInitializer() {
+    AddDescriptors();
+  }
+} static_descriptor_initializer;
+}  // namespace protobuf_message_5fbase_2eproto
+namespace message {
+const ::google::protobuf::EnumDescriptor* Action_type_descriptor() {
+  protobuf_message_5fbase_2eproto::protobuf_AssignDescriptorsOnce();
+  return protobuf_message_5fbase_2eproto::file_level_enum_descriptors[0];
+}
+bool Action_type_IsValid(int value) {
+  switch (value) {
+    case 0:
+    case 1:
+      return true;
+    default:
+      return false;
+  }
+}
+
+
+// ===================================================================
+
+void Command_message::InitAsDefaultInstance() {
+}
+#if !defined(_MSC_VER) || _MSC_VER >= 1900
+const int Command_message::kCommandIdFieldNumber;
+const int Command_message::kActTypeFieldNumber;
+const int Command_message::kFromIdFieldNumber;
+const int Command_message::kDestinationIdFieldNumber;
+#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900
+
+Command_message::Command_message()
+  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
+  if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+    ::protobuf_message_5fbase_2eproto::InitDefaultsCommand_message();
+  }
+  SharedCtor();
+  // @@protoc_insertion_point(constructor:message.Command_message)
+}
+Command_message::Command_message(const Command_message& from)
+  : ::google::protobuf::Message(),
+      _internal_metadata_(NULL),
+      _has_bits_(from._has_bits_),
+      _cached_size_(0) {
+  _internal_metadata_.MergeFrom(from._internal_metadata_);
+  ::memcpy(&command_id_, &from.command_id_,
+    static_cast<size_t>(reinterpret_cast<char*>(&destination_id_) -
+    reinterpret_cast<char*>(&command_id_)) + sizeof(destination_id_));
+  // @@protoc_insertion_point(copy_constructor:message.Command_message)
+}
+
+void Command_message::SharedCtor() {
+  _cached_size_ = 0;
+  ::memset(&command_id_, 0, static_cast<size_t>(
+      reinterpret_cast<char*>(&destination_id_) -
+      reinterpret_cast<char*>(&command_id_)) + sizeof(destination_id_));
+}
+
+Command_message::~Command_message() {
+  // @@protoc_insertion_point(destructor:message.Command_message)
+  SharedDtor();
+}
+
+void Command_message::SharedDtor() {
+}
+
+void Command_message::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* Command_message::descriptor() {
+  ::protobuf_message_5fbase_2eproto::protobuf_AssignDescriptorsOnce();
+  return ::protobuf_message_5fbase_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+}
+
+const Command_message& Command_message::default_instance() {
+  ::protobuf_message_5fbase_2eproto::InitDefaultsCommand_message();
+  return *internal_default_instance();
+}
+
+Command_message* Command_message::New(::google::protobuf::Arena* arena) const {
+  Command_message* n = new Command_message;
+  if (arena != NULL) {
+    arena->Own(n);
+  }
+  return n;
+}
+
+void Command_message::Clear() {
+// @@protoc_insertion_point(message_clear_start:message.Command_message)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  // Prevent compiler warnings about cached_has_bits being unused
+  (void) cached_has_bits;
+
+  cached_has_bits = _has_bits_[0];
+  if (cached_has_bits & 15u) {
+    ::memset(&command_id_, 0, static_cast<size_t>(
+        reinterpret_cast<char*>(&destination_id_) -
+        reinterpret_cast<char*>(&command_id_)) + sizeof(destination_id_));
+  }
+  _has_bits_.Clear();
+  _internal_metadata_.Clear();
+}
+
+bool Command_message::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
+  ::google::protobuf::uint32 tag;
+  // @@protoc_insertion_point(parse_start:message.Command_message)
+  for (;;) {
+    ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+    tag = p.first;
+    if (!p.second) goto handle_unusual;
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // required int32 command_id = 1;
+      case 1: {
+        if (static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) {
+          set_has_command_id();
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &command_id_)));
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      // required .message.Action_type act_type = 2;
+      case 2: {
+        if (static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) {
+          int value;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          if (::message::Action_type_IsValid(value)) {
+            set_act_type(static_cast< ::message::Action_type >(value));
+          } else {
+            mutable_unknown_fields()->AddVarint(
+                2, static_cast< ::google::protobuf::uint64>(value));
+          }
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      // required int32 from_id = 3;
+      case 3: {
+        if (static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(24u /* 24 & 0xFF */)) {
+          set_has_from_id();
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &from_id_)));
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      // required int32 destination_id = 4;
+      case 4: {
+        if (static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(32u /* 32 & 0xFF */)) {
+          set_has_destination_id();
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &destination_id_)));
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      default: {
+      handle_unusual:
+        if (tag == 0) {
+          goto success;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, _internal_metadata_.mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+success:
+  // @@protoc_insertion_point(parse_success:message.Command_message)
+  return true;
+failure:
+  // @@protoc_insertion_point(parse_failure:message.Command_message)
+  return false;
+#undef DO_
+}
+
+void Command_message::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // @@protoc_insertion_point(serialize_start:message.Command_message)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  cached_has_bits = _has_bits_[0];
+  // required int32 command_id = 1;
+  if (cached_has_bits & 0x00000001u) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->command_id(), output);
+  }
+
+  // required .message.Action_type act_type = 2;
+  if (cached_has_bits & 0x00000002u) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      2, this->act_type(), output);
+  }
+
+  // required int32 from_id = 3;
+  if (cached_has_bits & 0x00000004u) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->from_id(), output);
+  }
+
+  // required int32 destination_id = 4;
+  if (cached_has_bits & 0x00000008u) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(4, this->destination_id(), output);
+  }
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        _internal_metadata_.unknown_fields(), output);
+  }
+  // @@protoc_insertion_point(serialize_end:message.Command_message)
+}
+
+::google::protobuf::uint8* Command_message::InternalSerializeWithCachedSizesToArray(
+    bool deterministic, ::google::protobuf::uint8* target) const {
+  (void)deterministic; // Unused
+  // @@protoc_insertion_point(serialize_to_array_start:message.Command_message)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  cached_has_bits = _has_bits_[0];
+  // required int32 command_id = 1;
+  if (cached_has_bits & 0x00000001u) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->command_id(), target);
+  }
+
+  // required .message.Action_type act_type = 2;
+  if (cached_has_bits & 0x00000002u) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+      2, this->act_type(), target);
+  }
+
+  // required int32 from_id = 3;
+  if (cached_has_bits & 0x00000004u) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(3, this->from_id(), target);
+  }
+
+  // required int32 destination_id = 4;
+  if (cached_has_bits & 0x00000008u) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(4, this->destination_id(), target);
+  }
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        _internal_metadata_.unknown_fields(), target);
+  }
+  // @@protoc_insertion_point(serialize_to_array_end:message.Command_message)
+  return target;
+}
+
+size_t Command_message::RequiredFieldsByteSizeFallback() const {
+// @@protoc_insertion_point(required_fields_byte_size_fallback_start:message.Command_message)
+  size_t total_size = 0;
+
+  if (has_command_id()) {
+    // required int32 command_id = 1;
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::Int32Size(
+        this->command_id());
+  }
+
+  if (has_act_type()) {
+    // required .message.Action_type act_type = 2;
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::EnumSize(this->act_type());
+  }
+
+  if (has_from_id()) {
+    // required int32 from_id = 3;
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::Int32Size(
+        this->from_id());
+  }
+
+  if (has_destination_id()) {
+    // required int32 destination_id = 4;
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::Int32Size(
+        this->destination_id());
+  }
+
+  return total_size;
+}
+size_t Command_message::ByteSizeLong() const {
+// @@protoc_insertion_point(message_byte_size_start:message.Command_message)
+  size_t total_size = 0;
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        _internal_metadata_.unknown_fields());
+  }
+  if (((_has_bits_[0] & 0x0000000f) ^ 0x0000000f) == 0) {  // All required fields are present.
+    // required int32 command_id = 1;
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::Int32Size(
+        this->command_id());
+
+    // required .message.Action_type act_type = 2;
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::EnumSize(this->act_type());
+
+    // required int32 from_id = 3;
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::Int32Size(
+        this->from_id());
+
+    // required int32 destination_id = 4;
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::Int32Size(
+        this->destination_id());
+
+  } else {
+    total_size += RequiredFieldsByteSizeFallback();
+  }
+  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = cached_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void Command_message::MergeFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_merge_from_start:message.Command_message)
+  GOOGLE_DCHECK_NE(&from, this);
+  const Command_message* source =
+      ::google::protobuf::internal::DynamicCastToGenerated<const Command_message>(
+          &from);
+  if (source == NULL) {
+  // @@protoc_insertion_point(generalized_merge_from_cast_fail:message.Command_message)
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+  // @@protoc_insertion_point(generalized_merge_from_cast_success:message.Command_message)
+    MergeFrom(*source);
+  }
+}
+
+void Command_message::MergeFrom(const Command_message& from) {
+// @@protoc_insertion_point(class_specific_merge_from_start:message.Command_message)
+  GOOGLE_DCHECK_NE(&from, this);
+  _internal_metadata_.MergeFrom(from._internal_metadata_);
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  cached_has_bits = from._has_bits_[0];
+  if (cached_has_bits & 15u) {
+    if (cached_has_bits & 0x00000001u) {
+      command_id_ = from.command_id_;
+    }
+    if (cached_has_bits & 0x00000002u) {
+      act_type_ = from.act_type_;
+    }
+    if (cached_has_bits & 0x00000004u) {
+      from_id_ = from.from_id_;
+    }
+    if (cached_has_bits & 0x00000008u) {
+      destination_id_ = from.destination_id_;
+    }
+    _has_bits_[0] |= cached_has_bits;
+  }
+}
+
+void Command_message::CopyFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_copy_from_start:message.Command_message)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void Command_message::CopyFrom(const Command_message& from) {
+// @@protoc_insertion_point(class_specific_copy_from_start:message.Command_message)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool Command_message::IsInitialized() const {
+  if ((_has_bits_[0] & 0x0000000f) != 0x0000000f) return false;
+  return true;
+}
+
+void Command_message::Swap(Command_message* other) {
+  if (other == this) return;
+  InternalSwap(other);
+}
+void Command_message::InternalSwap(Command_message* other) {
+  using std::swap;
+  swap(command_id_, other->command_id_);
+  swap(act_type_, other->act_type_);
+  swap(from_id_, other->from_id_);
+  swap(destination_id_, other->destination_id_);
+  swap(_has_bits_[0], other->_has_bits_[0]);
+  _internal_metadata_.Swap(&other->_internal_metadata_);
+  swap(_cached_size_, other->_cached_size_);
+}
+
+::google::protobuf::Metadata Command_message::GetMetadata() const {
+  protobuf_message_5fbase_2eproto::protobuf_AssignDescriptorsOnce();
+  return ::protobuf_message_5fbase_2eproto::file_level_metadata[kIndexInFileMessages];
+}
+
+
+// @@protoc_insertion_point(namespace_scope)
+}  // namespace message
+
+// @@protoc_insertion_point(global_scope)

+ 351 - 0
message/message_base.pb.h

@@ -0,0 +1,351 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: message_base.proto
+
+#ifndef PROTOBUF_message_5fbase_2eproto__INCLUDED
+#define PROTOBUF_message_5fbase_2eproto__INCLUDED
+
+#include <string>
+
+#include <google/protobuf/stubs/common.h>
+
+#if GOOGLE_PROTOBUF_VERSION < 3005000
+#error This file was generated by a newer version of protoc which is
+#error incompatible with your Protocol Buffer headers.  Please update
+#error your headers.
+#endif
+#if 3005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#error This file was generated by an older version of protoc which is
+#error incompatible with your Protocol Buffer headers.  Please
+#error regenerate this file with a newer version of protoc.
+#endif
+
+#include <google/protobuf/io/coded_stream.h>
+#include <google/protobuf/arena.h>
+#include <google/protobuf/arenastring.h>
+#include <google/protobuf/generated_message_table_driven.h>
+#include <google/protobuf/generated_message_util.h>
+#include <google/protobuf/metadata.h>
+#include <google/protobuf/message.h>
+#include <google/protobuf/repeated_field.h>  // IWYU pragma: export
+#include <google/protobuf/extension_set.h>  // IWYU pragma: export
+#include <google/protobuf/generated_enum_reflection.h>
+#include <google/protobuf/unknown_field_set.h>
+// @@protoc_insertion_point(includes)
+
+namespace protobuf_message_5fbase_2eproto {
+// Internal implementation detail -- do not use these members.
+struct TableStruct {
+  static const ::google::protobuf::internal::ParseTableField entries[];
+  static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
+  static const ::google::protobuf::internal::ParseTable schema[1];
+  static const ::google::protobuf::internal::FieldMetadata field_metadata[];
+  static const ::google::protobuf::internal::SerializationTable serialization_table[];
+  static const ::google::protobuf::uint32 offsets[];
+};
+void AddDescriptors();
+void InitDefaultsCommand_messageImpl();
+void InitDefaultsCommand_message();
+inline void InitDefaults() {
+  InitDefaultsCommand_message();
+}
+}  // namespace protobuf_message_5fbase_2eproto
+namespace message {
+class Command_message;
+class Command_messageDefaultTypeInternal;
+extern Command_messageDefaultTypeInternal _Command_message_default_instance_;
+}  // namespace message
+namespace message {
+
+enum Action_type {
+  ePark = 0,
+  ePick = 1
+};
+bool Action_type_IsValid(int value);
+const Action_type Action_type_MIN = ePark;
+const Action_type Action_type_MAX = ePick;
+const int Action_type_ARRAYSIZE = Action_type_MAX + 1;
+
+const ::google::protobuf::EnumDescriptor* Action_type_descriptor();
+inline const ::std::string& Action_type_Name(Action_type value) {
+  return ::google::protobuf::internal::NameOfEnum(
+    Action_type_descriptor(), value);
+}
+inline bool Action_type_Parse(
+    const ::std::string& name, Action_type* value) {
+  return ::google::protobuf::internal::ParseNamedEnum<Action_type>(
+    Action_type_descriptor(), name, value);
+}
+// ===================================================================
+
+class Command_message : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:message.Command_message) */ {
+ public:
+  Command_message();
+  virtual ~Command_message();
+
+  Command_message(const Command_message& from);
+
+  inline Command_message& operator=(const Command_message& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  #if LANG_CXX11
+  Command_message(Command_message&& from) noexcept
+    : Command_message() {
+    *this = ::std::move(from);
+  }
+
+  inline Command_message& operator=(Command_message&& from) noexcept {
+    if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
+      if (this != &from) InternalSwap(&from);
+    } else {
+      CopyFrom(from);
+    }
+    return *this;
+  }
+  #endif
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _internal_metadata_.unknown_fields();
+  }
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return _internal_metadata_.mutable_unknown_fields();
+  }
+
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const Command_message& default_instance();
+
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
+  static inline const Command_message* internal_default_instance() {
+    return reinterpret_cast<const Command_message*>(
+               &_Command_message_default_instance_);
+  }
+  static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+    0;
+
+  void Swap(Command_message* other);
+  friend void swap(Command_message& a, Command_message& b) {
+    a.Swap(&b);
+  }
+
+  // implements Message ----------------------------------------------
+
+  inline Command_message* New() const PROTOBUF_FINAL { return New(NULL); }
+
+  Command_message* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+  void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+  void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+  void CopyFrom(const Command_message& from);
+  void MergeFrom(const Command_message& from);
+  void Clear() PROTOBUF_FINAL;
+  bool IsInitialized() const PROTOBUF_FINAL;
+
+  size_t ByteSizeLong() const PROTOBUF_FINAL;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
+  ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
+      bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+  int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const PROTOBUF_FINAL;
+  void InternalSwap(Command_message* other);
+  private:
+  inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
+    return NULL;
+  }
+  inline void* MaybeArenaPtr() const {
+    return NULL;
+  }
+  public:
+
+  ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
+
+  // nested types ----------------------------------------------------
+
+  // accessors -------------------------------------------------------
+
+  // required int32 command_id = 1;
+  bool has_command_id() const;
+  void clear_command_id();
+  static const int kCommandIdFieldNumber = 1;
+  ::google::protobuf::int32 command_id() const;
+  void set_command_id(::google::protobuf::int32 value);
+
+  // required .message.Action_type act_type = 2;
+  bool has_act_type() const;
+  void clear_act_type();
+  static const int kActTypeFieldNumber = 2;
+  ::message::Action_type act_type() const;
+  void set_act_type(::message::Action_type value);
+
+  // required int32 from_id = 3;
+  bool has_from_id() const;
+  void clear_from_id();
+  static const int kFromIdFieldNumber = 3;
+  ::google::protobuf::int32 from_id() const;
+  void set_from_id(::google::protobuf::int32 value);
+
+  // required int32 destination_id = 4;
+  bool has_destination_id() const;
+  void clear_destination_id();
+  static const int kDestinationIdFieldNumber = 4;
+  ::google::protobuf::int32 destination_id() const;
+  void set_destination_id(::google::protobuf::int32 value);
+
+  // @@protoc_insertion_point(class_scope:message.Command_message)
+ private:
+  void set_has_command_id();
+  void clear_has_command_id();
+  void set_has_act_type();
+  void clear_has_act_type();
+  void set_has_from_id();
+  void clear_has_from_id();
+  void set_has_destination_id();
+  void clear_has_destination_id();
+
+  // helper for ByteSizeLong()
+  size_t RequiredFieldsByteSizeFallback() const;
+
+  ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
+  ::google::protobuf::internal::HasBits<1> _has_bits_;
+  mutable int _cached_size_;
+  ::google::protobuf::int32 command_id_;
+  int act_type_;
+  ::google::protobuf::int32 from_id_;
+  ::google::protobuf::int32 destination_id_;
+  friend struct ::protobuf_message_5fbase_2eproto::TableStruct;
+  friend void ::protobuf_message_5fbase_2eproto::InitDefaultsCommand_messageImpl();
+};
+// ===================================================================
+
+
+// ===================================================================
+
+#ifdef __GNUC__
+  #pragma GCC diagnostic push
+  #pragma GCC diagnostic ignored "-Wstrict-aliasing"
+#endif  // __GNUC__
+// Command_message
+
+// required int32 command_id = 1;
+inline bool Command_message::has_command_id() const {
+  return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void Command_message::set_has_command_id() {
+  _has_bits_[0] |= 0x00000001u;
+}
+inline void Command_message::clear_has_command_id() {
+  _has_bits_[0] &= ~0x00000001u;
+}
+inline void Command_message::clear_command_id() {
+  command_id_ = 0;
+  clear_has_command_id();
+}
+inline ::google::protobuf::int32 Command_message::command_id() const {
+  // @@protoc_insertion_point(field_get:message.Command_message.command_id)
+  return command_id_;
+}
+inline void Command_message::set_command_id(::google::protobuf::int32 value) {
+  set_has_command_id();
+  command_id_ = value;
+  // @@protoc_insertion_point(field_set:message.Command_message.command_id)
+}
+
+// required .message.Action_type act_type = 2;
+inline bool Command_message::has_act_type() const {
+  return (_has_bits_[0] & 0x00000002u) != 0;
+}
+inline void Command_message::set_has_act_type() {
+  _has_bits_[0] |= 0x00000002u;
+}
+inline void Command_message::clear_has_act_type() {
+  _has_bits_[0] &= ~0x00000002u;
+}
+inline void Command_message::clear_act_type() {
+  act_type_ = 0;
+  clear_has_act_type();
+}
+inline ::message::Action_type Command_message::act_type() const {
+  // @@protoc_insertion_point(field_get:message.Command_message.act_type)
+  return static_cast< ::message::Action_type >(act_type_);
+}
+inline void Command_message::set_act_type(::message::Action_type value) {
+  assert(::message::Action_type_IsValid(value));
+  set_has_act_type();
+  act_type_ = value;
+  // @@protoc_insertion_point(field_set:message.Command_message.act_type)
+}
+
+// required int32 from_id = 3;
+inline bool Command_message::has_from_id() const {
+  return (_has_bits_[0] & 0x00000004u) != 0;
+}
+inline void Command_message::set_has_from_id() {
+  _has_bits_[0] |= 0x00000004u;
+}
+inline void Command_message::clear_has_from_id() {
+  _has_bits_[0] &= ~0x00000004u;
+}
+inline void Command_message::clear_from_id() {
+  from_id_ = 0;
+  clear_has_from_id();
+}
+inline ::google::protobuf::int32 Command_message::from_id() const {
+  // @@protoc_insertion_point(field_get:message.Command_message.from_id)
+  return from_id_;
+}
+inline void Command_message::set_from_id(::google::protobuf::int32 value) {
+  set_has_from_id();
+  from_id_ = value;
+  // @@protoc_insertion_point(field_set:message.Command_message.from_id)
+}
+
+// required int32 destination_id = 4;
+inline bool Command_message::has_destination_id() const {
+  return (_has_bits_[0] & 0x00000008u) != 0;
+}
+inline void Command_message::set_has_destination_id() {
+  _has_bits_[0] |= 0x00000008u;
+}
+inline void Command_message::clear_has_destination_id() {
+  _has_bits_[0] &= ~0x00000008u;
+}
+inline void Command_message::clear_destination_id() {
+  destination_id_ = 0;
+  clear_has_destination_id();
+}
+inline ::google::protobuf::int32 Command_message::destination_id() const {
+  // @@protoc_insertion_point(field_get:message.Command_message.destination_id)
+  return destination_id_;
+}
+inline void Command_message::set_destination_id(::google::protobuf::int32 value) {
+  set_has_destination_id();
+  destination_id_ = value;
+  // @@protoc_insertion_point(field_set:message.Command_message.destination_id)
+}
+
+#ifdef __GNUC__
+  #pragma GCC diagnostic pop
+#endif  // __GNUC__
+
+// @@protoc_insertion_point(namespace_scope)
+
+}  // namespace message
+
+namespace google {
+namespace protobuf {
+
+template <> struct is_proto_enum< ::message::Action_type> : ::google::protobuf::internal::true_type {};
+template <>
+inline const EnumDescriptor* GetEnumDescriptor< ::message::Action_type>() {
+  return ::message::Action_type_descriptor();
+}
+
+}  // namespace protobuf
+}  // namespace google
+
+// @@protoc_insertion_point(global_scope)
+
+#endif  // PROTOBUF_message_5fbase_2eproto__INCLUDED

+ 17 - 0
message/message_base.proto

@@ -0,0 +1,17 @@
+syntax = "proto2";
+package message;
+
+enum Action_type
+{
+    ePark=0;
+    ePick=1;
+}
+
+//指令信息
+message Command_message
+{
+    required int32          command_id=1;                //指令唯一标识符id
+    required Action_type    act_type=2;            //指令类型
+    required int32          from_id=3;                   //指令动作出发地
+    required int32          destination_id=4;            //指令动作目的地
+}

+ 40 - 0
nnxx/nnxx_client.cpp

@@ -0,0 +1,40 @@
+//
+// Created by zx on 2020/6/10.
+//
+
+#include "nnxx_client.h"
+
+
+Client::Client()
+{
+    m_socket=nnxx::socket{ nnxx::SP, nnxx::REQ};
+}
+Client::~Client()
+{
+    std::lock_guard<std::mutex> lck (m_lock);
+    m_socket.close();
+}
+Error_manager Client::connect(std::string connect_str)
+{
+    std::lock_guard<std::mutex> lck (m_lock);
+    m_socket.connect(connect_str);
+    return SUCCESS;
+}
+Error_manager Client::request(std::string request_str, std::string& response,unsigned int timeout)
+{
+    std::lock_guard<std::mutex> lck (m_lock);
+    m_socket.send(request_str);
+
+    nnxx::message message;
+    try { nnxx::with_recv_timeout _ { m_socket, std::chrono::milliseconds(timeout) };
+        message=m_socket.recv();
+    }
+    catch (const nnxx::timeout_error &) {
+        return Error_manager(NNXX_CLIENT_REQUEST_TIMEOUT,MINOR_ERROR,"nnxx client request timeout");
+    }
+    catch (const std::exception &) {
+        return Error_manager(NNXX_CLIENT_REQUEST_UNKNOW,MINOR_ERROR,"nnxx client request unknow error");
+    }
+    response=nnxx::to_string(message);
+    return SUCCESS;
+}

+ 33 - 0
nnxx/nnxx_client.h

@@ -0,0 +1,33 @@
+//
+// Created by zx on 2020/6/10.
+//
+
+#ifndef NNXX_TESTS_CLIENT_H
+#define NNXX_TESTS_CLIENT_H
+
+#include <nnxx/message.h>
+#include <nnxx/message_control.h>
+#include <nnxx/socket.h>
+#include <nnxx/reqrep.h>
+#include <string>
+#include <iostream>
+
+#include <nnxx/timeout.h>
+#include <nnxx/error.h>
+#include "../error_code/error_code.h"
+#include <mutex>
+class Client {
+public:
+    Client();
+    virtual ~Client();
+    Error_manager connect(std::string connect_str);
+    virtual Error_manager request(std::string request_str, std::string& response,unsigned int timeout);
+
+protected:
+    bool    mb_connect;
+    nnxx::socket    m_socket;
+    std::mutex      m_lock;
+};
+
+
+#endif //NNXX_TESTS_CLIENT_H

+ 56 - 0
nnxx/nnxx_server.cpp

@@ -0,0 +1,56 @@
+//
+// Created by zx on 2020/6/10.
+//
+
+#include "nnxx_server.h"
+Server::Server()
+{
+    m_service_thread= nullptr;
+    m_socket=nnxx::socket{nnxx::SP_RAW, nnxx::REP};
+}
+
+Server::~Server()
+{
+    mb_close=true;
+    if(m_service_thread!= nullptr)
+    {
+        if(m_service_thread->joinable())
+        {
+            m_service_thread->join();
+        }
+        delete m_service_thread;
+        m_service_thread= nullptr;
+    }
+    m_socket.close();
+}
+
+bool Server::bind(std::string connect_str) {
+    m_socket.bind(connect_str);
+    mb_close=false;
+    m_service_thread=new std::thread(service_handle,this);
+}
+bool Server::service_response(nnxx::message& message,nnxx::message_control& c1)
+{
+    static int response_num=0;
+    std::string msg=to_string(message);
+    std::cout<<" recieve request : "<<msg<<"total response : "<<++response_num<<std::endl;
+    std::string response="response : ";
+    response+=msg;
+    m_socket.send(response.c_str(),response.length(),0,std::move(c1));
+}
+
+void Server::service_handle(Server* pServer)
+{
+    if(pServer== nullptr)
+        return;
+    nnxx::message_control msg_control;
+    while(pServer->mb_close==false)
+    {
+        //非阻塞式读取
+        nnxx::message msg = pServer->m_socket.recv(1, msg_control);
+        if(msg.size()!=0)
+            pServer->service_response(msg,msg_control);
+        std::this_thread::yield();
+    }
+}
+

+ 32 - 0
nnxx/nnxx_server.h

@@ -0,0 +1,32 @@
+//
+// Created by zx on 2020/6/10.
+//
+
+#ifndef NNXX_TESTS_NNXX_SERVER_H
+#define NNXX_TESTS_NNXX_SERVER_H
+
+#include <nnxx/message.h>
+#include <nnxx/message_control.h>
+#include <nnxx/socket.h>
+#include <nnxx/reqrep.h>
+#include <string>
+#include <iostream>
+#include <thread>
+
+class Server {
+public:
+    Server();
+    ~Server();
+    bool bind(std::string connect_str);
+    bool service_response(nnxx::message& message,nnxx::message_control& c1);
+protected:
+    static void service_handle(Server* pServer);
+protected:
+    std::thread*        m_service_thread;
+    nnxx::socket        m_socket;
+    bool                mb_close;
+
+};
+
+
+#endif //NNXX_TESTS_NNXX_SERVER_H

+ 4 - 0
proto.sh

@@ -0,0 +1,4 @@
+protoc -I=./message message_base.proto --cpp_out=./message
+protoc -I=./message locate_message.proto --cpp_out=./message
+protoc -I=./message hardware_message.proto --cpp_out=./message
+protoc -I=./ setting.proto --cpp_out=./

+ 744 - 0
setting.pb.cc

@@ -0,0 +1,744 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: setting.proto
+
+#include "setting.pb.h"
+
+#include <algorithm>
+
+#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/stubs/port.h>
+#include <google/protobuf/stubs/once.h>
+#include <google/protobuf/io/coded_stream.h>
+#include <google/protobuf/wire_format_lite_inl.h>
+#include <google/protobuf/descriptor.h>
+#include <google/protobuf/generated_message_reflection.h>
+#include <google/protobuf/reflection_ops.h>
+#include <google/protobuf/wire_format.h>
+// This is a temporary google only hack
+#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
+#include "third_party/protobuf/version.h"
+#endif
+// @@protoc_insertion_point(includes)
+namespace global {
+class locate_settingDefaultTypeInternal {
+ public:
+  ::google::protobuf::internal::ExplicitlyConstructed<locate_setting>
+      _instance;
+} _locate_setting_default_instance_;
+class settingDefaultTypeInternal {
+ public:
+  ::google::protobuf::internal::ExplicitlyConstructed<setting>
+      _instance;
+} _setting_default_instance_;
+}  // namespace global
+namespace protobuf_setting_2eproto {
+void InitDefaultslocate_settingImpl() {
+  GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
+  ::google::protobuf::internal::InitProtobufDefaultsForceUnique();
+#else
+  ::google::protobuf::internal::InitProtobufDefaults();
+#endif  // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
+  {
+    void* ptr = &::global::_locate_setting_default_instance_;
+    new (ptr) ::global::locate_setting();
+    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
+  }
+  ::global::locate_setting::InitAsDefaultInstance();
+}
+
+void InitDefaultslocate_setting() {
+  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+  ::google::protobuf::GoogleOnceInit(&once, &InitDefaultslocate_settingImpl);
+}
+
+void InitDefaultssettingImpl() {
+  GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
+  ::google::protobuf::internal::InitProtobufDefaultsForceUnique();
+#else
+  ::google::protobuf::internal::InitProtobufDefaults();
+#endif  // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
+  protobuf_setting_2eproto::InitDefaultslocate_setting();
+  {
+    void* ptr = &::global::_setting_default_instance_;
+    new (ptr) ::global::setting();
+    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
+  }
+  ::global::setting::InitAsDefaultInstance();
+}
+
+void InitDefaultssetting() {
+  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+  ::google::protobuf::GoogleOnceInit(&once, &InitDefaultssettingImpl);
+}
+
+::google::protobuf::Metadata file_level_metadata[2];
+
+const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::global::locate_setting, _has_bits_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::global::locate_setting, _internal_metadata_),
+  ~0u,  // no _extensions_
+  ~0u,  // no _oneof_case_
+  ~0u,  // no _weak_field_map_
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::global::locate_setting, ip_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::global::locate_setting, port_),
+  0,
+  1,
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::global::setting, _has_bits_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::global::setting, _internal_metadata_),
+  ~0u,  // no _extensions_
+  ~0u,  // no _oneof_case_
+  ~0u,  // no _weak_field_map_
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::global::setting, locate_parameter_),
+  0,
+};
+static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+  { 0, 7, sizeof(::global::locate_setting)},
+  { 9, 15, sizeof(::global::setting)},
+};
+
+static ::google::protobuf::Message const * const file_default_instances[] = {
+  reinterpret_cast<const ::google::protobuf::Message*>(&::global::_locate_setting_default_instance_),
+  reinterpret_cast<const ::google::protobuf::Message*>(&::global::_setting_default_instance_),
+};
+
+void protobuf_AssignDescriptors() {
+  AddDescriptors();
+  ::google::protobuf::MessageFactory* factory = NULL;
+  AssignDescriptors(
+      "setting.proto", schemas, file_default_instances, TableStruct::offsets, factory,
+      file_level_metadata, NULL, NULL);
+}
+
+void protobuf_AssignDescriptorsOnce() {
+  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+  ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
+}
+
+void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
+void protobuf_RegisterTypes(const ::std::string&) {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 2);
+}
+
+void AddDescriptorsImpl() {
+  InitDefaults();
+  static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+      "\n\rsetting.proto\022\006global\"*\n\016locate_settin"
+      "g\022\n\n\002ip\030\001 \002(\t\022\014\n\004port\030\002 \002(\005\";\n\007setting\0220"
+      "\n\020locate_parameter\030\001 \002(\0132\026.global.locate"
+      "_setting"
+  };
+  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
+      descriptor, 128);
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
+    "setting.proto", &protobuf_RegisterTypes);
+}
+
+void AddDescriptors() {
+  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+  ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
+}
+// Force AddDescriptors() to be called at dynamic initialization time.
+struct StaticDescriptorInitializer {
+  StaticDescriptorInitializer() {
+    AddDescriptors();
+  }
+} static_descriptor_initializer;
+}  // namespace protobuf_setting_2eproto
+namespace global {
+
+// ===================================================================
+
+void locate_setting::InitAsDefaultInstance() {
+}
+#if !defined(_MSC_VER) || _MSC_VER >= 1900
+const int locate_setting::kIpFieldNumber;
+const int locate_setting::kPortFieldNumber;
+#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900
+
+locate_setting::locate_setting()
+  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
+  if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+    ::protobuf_setting_2eproto::InitDefaultslocate_setting();
+  }
+  SharedCtor();
+  // @@protoc_insertion_point(constructor:global.locate_setting)
+}
+locate_setting::locate_setting(const locate_setting& from)
+  : ::google::protobuf::Message(),
+      _internal_metadata_(NULL),
+      _has_bits_(from._has_bits_),
+      _cached_size_(0) {
+  _internal_metadata_.MergeFrom(from._internal_metadata_);
+  ip_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  if (from.has_ip()) {
+    ip_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.ip_);
+  }
+  port_ = from.port_;
+  // @@protoc_insertion_point(copy_constructor:global.locate_setting)
+}
+
+void locate_setting::SharedCtor() {
+  _cached_size_ = 0;
+  ip_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  port_ = 0;
+}
+
+locate_setting::~locate_setting() {
+  // @@protoc_insertion_point(destructor:global.locate_setting)
+  SharedDtor();
+}
+
+void locate_setting::SharedDtor() {
+  ip_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+
+void locate_setting::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* locate_setting::descriptor() {
+  ::protobuf_setting_2eproto::protobuf_AssignDescriptorsOnce();
+  return ::protobuf_setting_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+}
+
+const locate_setting& locate_setting::default_instance() {
+  ::protobuf_setting_2eproto::InitDefaultslocate_setting();
+  return *internal_default_instance();
+}
+
+locate_setting* locate_setting::New(::google::protobuf::Arena* arena) const {
+  locate_setting* n = new locate_setting;
+  if (arena != NULL) {
+    arena->Own(n);
+  }
+  return n;
+}
+
+void locate_setting::Clear() {
+// @@protoc_insertion_point(message_clear_start:global.locate_setting)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  // Prevent compiler warnings about cached_has_bits being unused
+  (void) cached_has_bits;
+
+  cached_has_bits = _has_bits_[0];
+  if (cached_has_bits & 0x00000001u) {
+    GOOGLE_DCHECK(!ip_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+    (*ip_.UnsafeRawStringPointer())->clear();
+  }
+  port_ = 0;
+  _has_bits_.Clear();
+  _internal_metadata_.Clear();
+}
+
+bool locate_setting::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
+  ::google::protobuf::uint32 tag;
+  // @@protoc_insertion_point(parse_start:global.locate_setting)
+  for (;;) {
+    ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+    tag = p.first;
+    if (!p.second) goto handle_unusual;
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // required string ip = 1;
+      case 1: {
+        if (static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
+          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+                input, this->mutable_ip()));
+          ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
+            this->ip().data(), static_cast<int>(this->ip().length()),
+            ::google::protobuf::internal::WireFormat::PARSE,
+            "global.locate_setting.ip");
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      // required int32 port = 2;
+      case 2: {
+        if (static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) {
+          set_has_port();
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &port_)));
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      default: {
+      handle_unusual:
+        if (tag == 0) {
+          goto success;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, _internal_metadata_.mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+success:
+  // @@protoc_insertion_point(parse_success:global.locate_setting)
+  return true;
+failure:
+  // @@protoc_insertion_point(parse_failure:global.locate_setting)
+  return false;
+#undef DO_
+}
+
+void locate_setting::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // @@protoc_insertion_point(serialize_start:global.locate_setting)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  cached_has_bits = _has_bits_[0];
+  // required string ip = 1;
+  if (cached_has_bits & 0x00000001u) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
+      this->ip().data(), static_cast<int>(this->ip().length()),
+      ::google::protobuf::internal::WireFormat::SERIALIZE,
+      "global.locate_setting.ip");
+    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
+      1, this->ip(), output);
+  }
+
+  // required int32 port = 2;
+  if (cached_has_bits & 0x00000002u) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->port(), output);
+  }
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        _internal_metadata_.unknown_fields(), output);
+  }
+  // @@protoc_insertion_point(serialize_end:global.locate_setting)
+}
+
+::google::protobuf::uint8* locate_setting::InternalSerializeWithCachedSizesToArray(
+    bool deterministic, ::google::protobuf::uint8* target) const {
+  (void)deterministic; // Unused
+  // @@protoc_insertion_point(serialize_to_array_start:global.locate_setting)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  cached_has_bits = _has_bits_[0];
+  // required string ip = 1;
+  if (cached_has_bits & 0x00000001u) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
+      this->ip().data(), static_cast<int>(this->ip().length()),
+      ::google::protobuf::internal::WireFormat::SERIALIZE,
+      "global.locate_setting.ip");
+    target =
+      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+        1, this->ip(), target);
+  }
+
+  // required int32 port = 2;
+  if (cached_has_bits & 0x00000002u) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->port(), target);
+  }
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        _internal_metadata_.unknown_fields(), target);
+  }
+  // @@protoc_insertion_point(serialize_to_array_end:global.locate_setting)
+  return target;
+}
+
+size_t locate_setting::RequiredFieldsByteSizeFallback() const {
+// @@protoc_insertion_point(required_fields_byte_size_fallback_start:global.locate_setting)
+  size_t total_size = 0;
+
+  if (has_ip()) {
+    // required string ip = 1;
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::StringSize(
+        this->ip());
+  }
+
+  if (has_port()) {
+    // required int32 port = 2;
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::Int32Size(
+        this->port());
+  }
+
+  return total_size;
+}
+size_t locate_setting::ByteSizeLong() const {
+// @@protoc_insertion_point(message_byte_size_start:global.locate_setting)
+  size_t total_size = 0;
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        _internal_metadata_.unknown_fields());
+  }
+  if (((_has_bits_[0] & 0x00000003) ^ 0x00000003) == 0) {  // All required fields are present.
+    // required string ip = 1;
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::StringSize(
+        this->ip());
+
+    // required int32 port = 2;
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::Int32Size(
+        this->port());
+
+  } else {
+    total_size += RequiredFieldsByteSizeFallback();
+  }
+  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = cached_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void locate_setting::MergeFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_merge_from_start:global.locate_setting)
+  GOOGLE_DCHECK_NE(&from, this);
+  const locate_setting* source =
+      ::google::protobuf::internal::DynamicCastToGenerated<const locate_setting>(
+          &from);
+  if (source == NULL) {
+  // @@protoc_insertion_point(generalized_merge_from_cast_fail:global.locate_setting)
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+  // @@protoc_insertion_point(generalized_merge_from_cast_success:global.locate_setting)
+    MergeFrom(*source);
+  }
+}
+
+void locate_setting::MergeFrom(const locate_setting& from) {
+// @@protoc_insertion_point(class_specific_merge_from_start:global.locate_setting)
+  GOOGLE_DCHECK_NE(&from, this);
+  _internal_metadata_.MergeFrom(from._internal_metadata_);
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  cached_has_bits = from._has_bits_[0];
+  if (cached_has_bits & 3u) {
+    if (cached_has_bits & 0x00000001u) {
+      set_has_ip();
+      ip_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.ip_);
+    }
+    if (cached_has_bits & 0x00000002u) {
+      port_ = from.port_;
+    }
+    _has_bits_[0] |= cached_has_bits;
+  }
+}
+
+void locate_setting::CopyFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_copy_from_start:global.locate_setting)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void locate_setting::CopyFrom(const locate_setting& from) {
+// @@protoc_insertion_point(class_specific_copy_from_start:global.locate_setting)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool locate_setting::IsInitialized() const {
+  if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
+  return true;
+}
+
+void locate_setting::Swap(locate_setting* other) {
+  if (other == this) return;
+  InternalSwap(other);
+}
+void locate_setting::InternalSwap(locate_setting* other) {
+  using std::swap;
+  ip_.Swap(&other->ip_);
+  swap(port_, other->port_);
+  swap(_has_bits_[0], other->_has_bits_[0]);
+  _internal_metadata_.Swap(&other->_internal_metadata_);
+  swap(_cached_size_, other->_cached_size_);
+}
+
+::google::protobuf::Metadata locate_setting::GetMetadata() const {
+  protobuf_setting_2eproto::protobuf_AssignDescriptorsOnce();
+  return ::protobuf_setting_2eproto::file_level_metadata[kIndexInFileMessages];
+}
+
+
+// ===================================================================
+
+void setting::InitAsDefaultInstance() {
+  ::global::_setting_default_instance_._instance.get_mutable()->locate_parameter_ = const_cast< ::global::locate_setting*>(
+      ::global::locate_setting::internal_default_instance());
+}
+#if !defined(_MSC_VER) || _MSC_VER >= 1900
+const int setting::kLocateParameterFieldNumber;
+#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900
+
+setting::setting()
+  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
+  if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+    ::protobuf_setting_2eproto::InitDefaultssetting();
+  }
+  SharedCtor();
+  // @@protoc_insertion_point(constructor:global.setting)
+}
+setting::setting(const setting& from)
+  : ::google::protobuf::Message(),
+      _internal_metadata_(NULL),
+      _has_bits_(from._has_bits_),
+      _cached_size_(0) {
+  _internal_metadata_.MergeFrom(from._internal_metadata_);
+  if (from.has_locate_parameter()) {
+    locate_parameter_ = new ::global::locate_setting(*from.locate_parameter_);
+  } else {
+    locate_parameter_ = NULL;
+  }
+  // @@protoc_insertion_point(copy_constructor:global.setting)
+}
+
+void setting::SharedCtor() {
+  _cached_size_ = 0;
+  locate_parameter_ = NULL;
+}
+
+setting::~setting() {
+  // @@protoc_insertion_point(destructor:global.setting)
+  SharedDtor();
+}
+
+void setting::SharedDtor() {
+  if (this != internal_default_instance()) delete locate_parameter_;
+}
+
+void setting::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* setting::descriptor() {
+  ::protobuf_setting_2eproto::protobuf_AssignDescriptorsOnce();
+  return ::protobuf_setting_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+}
+
+const setting& setting::default_instance() {
+  ::protobuf_setting_2eproto::InitDefaultssetting();
+  return *internal_default_instance();
+}
+
+setting* setting::New(::google::protobuf::Arena* arena) const {
+  setting* n = new setting;
+  if (arena != NULL) {
+    arena->Own(n);
+  }
+  return n;
+}
+
+void setting::Clear() {
+// @@protoc_insertion_point(message_clear_start:global.setting)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  // Prevent compiler warnings about cached_has_bits being unused
+  (void) cached_has_bits;
+
+  cached_has_bits = _has_bits_[0];
+  if (cached_has_bits & 0x00000001u) {
+    GOOGLE_DCHECK(locate_parameter_ != NULL);
+    locate_parameter_->Clear();
+  }
+  _has_bits_.Clear();
+  _internal_metadata_.Clear();
+}
+
+bool setting::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
+  ::google::protobuf::uint32 tag;
+  // @@protoc_insertion_point(parse_start:global.setting)
+  for (;;) {
+    ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+    tag = p.first;
+    if (!p.second) goto handle_unusual;
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // required .global.locate_setting locate_parameter = 1;
+      case 1: {
+        if (static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
+          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+               input, mutable_locate_parameter()));
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      default: {
+      handle_unusual:
+        if (tag == 0) {
+          goto success;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, _internal_metadata_.mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+success:
+  // @@protoc_insertion_point(parse_success:global.setting)
+  return true;
+failure:
+  // @@protoc_insertion_point(parse_failure:global.setting)
+  return false;
+#undef DO_
+}
+
+void setting::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // @@protoc_insertion_point(serialize_start:global.setting)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  cached_has_bits = _has_bits_[0];
+  // required .global.locate_setting locate_parameter = 1;
+  if (cached_has_bits & 0x00000001u) {
+    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
+      1, *this->locate_parameter_, output);
+  }
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        _internal_metadata_.unknown_fields(), output);
+  }
+  // @@protoc_insertion_point(serialize_end:global.setting)
+}
+
+::google::protobuf::uint8* setting::InternalSerializeWithCachedSizesToArray(
+    bool deterministic, ::google::protobuf::uint8* target) const {
+  (void)deterministic; // Unused
+  // @@protoc_insertion_point(serialize_to_array_start:global.setting)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  cached_has_bits = _has_bits_[0];
+  // required .global.locate_setting locate_parameter = 1;
+  if (cached_has_bits & 0x00000001u) {
+    target = ::google::protobuf::internal::WireFormatLite::
+      InternalWriteMessageToArray(
+        1, *this->locate_parameter_, deterministic, target);
+  }
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        _internal_metadata_.unknown_fields(), target);
+  }
+  // @@protoc_insertion_point(serialize_to_array_end:global.setting)
+  return target;
+}
+
+size_t setting::ByteSizeLong() const {
+// @@protoc_insertion_point(message_byte_size_start:global.setting)
+  size_t total_size = 0;
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        _internal_metadata_.unknown_fields());
+  }
+  // required .global.locate_setting locate_parameter = 1;
+  if (has_locate_parameter()) {
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::MessageSize(
+        *this->locate_parameter_);
+  }
+  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = cached_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void setting::MergeFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_merge_from_start:global.setting)
+  GOOGLE_DCHECK_NE(&from, this);
+  const setting* source =
+      ::google::protobuf::internal::DynamicCastToGenerated<const setting>(
+          &from);
+  if (source == NULL) {
+  // @@protoc_insertion_point(generalized_merge_from_cast_fail:global.setting)
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+  // @@protoc_insertion_point(generalized_merge_from_cast_success:global.setting)
+    MergeFrom(*source);
+  }
+}
+
+void setting::MergeFrom(const setting& from) {
+// @@protoc_insertion_point(class_specific_merge_from_start:global.setting)
+  GOOGLE_DCHECK_NE(&from, this);
+  _internal_metadata_.MergeFrom(from._internal_metadata_);
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  if (from.has_locate_parameter()) {
+    mutable_locate_parameter()->::global::locate_setting::MergeFrom(from.locate_parameter());
+  }
+}
+
+void setting::CopyFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_copy_from_start:global.setting)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void setting::CopyFrom(const setting& from) {
+// @@protoc_insertion_point(class_specific_copy_from_start:global.setting)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool setting::IsInitialized() const {
+  if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
+  if (has_locate_parameter()) {
+    if (!this->locate_parameter_->IsInitialized()) return false;
+  }
+  return true;
+}
+
+void setting::Swap(setting* other) {
+  if (other == this) return;
+  InternalSwap(other);
+}
+void setting::InternalSwap(setting* other) {
+  using std::swap;
+  swap(locate_parameter_, other->locate_parameter_);
+  swap(_has_bits_[0], other->_has_bits_[0]);
+  _internal_metadata_.Swap(&other->_internal_metadata_);
+  swap(_cached_size_, other->_cached_size_);
+}
+
+::google::protobuf::Metadata setting::GetMetadata() const {
+  protobuf_setting_2eproto::protobuf_AssignDescriptorsOnce();
+  return ::protobuf_setting_2eproto::file_level_metadata[kIndexInFileMessages];
+}
+
+
+// @@protoc_insertion_point(namespace_scope)
+}  // namespace global
+
+// @@protoc_insertion_point(global_scope)

+ 475 - 0
setting.pb.h

@@ -0,0 +1,475 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: setting.proto
+
+#ifndef PROTOBUF_setting_2eproto__INCLUDED
+#define PROTOBUF_setting_2eproto__INCLUDED
+
+#include <string>
+
+#include <google/protobuf/stubs/common.h>
+
+#if GOOGLE_PROTOBUF_VERSION < 3005000
+#error This file was generated by a newer version of protoc which is
+#error incompatible with your Protocol Buffer headers.  Please update
+#error your headers.
+#endif
+#if 3005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#error This file was generated by an older version of protoc which is
+#error incompatible with your Protocol Buffer headers.  Please
+#error regenerate this file with a newer version of protoc.
+#endif
+
+#include <google/protobuf/io/coded_stream.h>
+#include <google/protobuf/arena.h>
+#include <google/protobuf/arenastring.h>
+#include <google/protobuf/generated_message_table_driven.h>
+#include <google/protobuf/generated_message_util.h>
+#include <google/protobuf/metadata.h>
+#include <google/protobuf/message.h>
+#include <google/protobuf/repeated_field.h>  // IWYU pragma: export
+#include <google/protobuf/extension_set.h>  // IWYU pragma: export
+#include <google/protobuf/unknown_field_set.h>
+// @@protoc_insertion_point(includes)
+
+namespace protobuf_setting_2eproto {
+// Internal implementation detail -- do not use these members.
+struct TableStruct {
+  static const ::google::protobuf::internal::ParseTableField entries[];
+  static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
+  static const ::google::protobuf::internal::ParseTable schema[2];
+  static const ::google::protobuf::internal::FieldMetadata field_metadata[];
+  static const ::google::protobuf::internal::SerializationTable serialization_table[];
+  static const ::google::protobuf::uint32 offsets[];
+};
+void AddDescriptors();
+void InitDefaultslocate_settingImpl();
+void InitDefaultslocate_setting();
+void InitDefaultssettingImpl();
+void InitDefaultssetting();
+inline void InitDefaults() {
+  InitDefaultslocate_setting();
+  InitDefaultssetting();
+}
+}  // namespace protobuf_setting_2eproto
+namespace global {
+class locate_setting;
+class locate_settingDefaultTypeInternal;
+extern locate_settingDefaultTypeInternal _locate_setting_default_instance_;
+class setting;
+class settingDefaultTypeInternal;
+extern settingDefaultTypeInternal _setting_default_instance_;
+}  // namespace global
+namespace global {
+
+// ===================================================================
+
+class locate_setting : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:global.locate_setting) */ {
+ public:
+  locate_setting();
+  virtual ~locate_setting();
+
+  locate_setting(const locate_setting& from);
+
+  inline locate_setting& operator=(const locate_setting& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  #if LANG_CXX11
+  locate_setting(locate_setting&& from) noexcept
+    : locate_setting() {
+    *this = ::std::move(from);
+  }
+
+  inline locate_setting& operator=(locate_setting&& from) noexcept {
+    if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
+      if (this != &from) InternalSwap(&from);
+    } else {
+      CopyFrom(from);
+    }
+    return *this;
+  }
+  #endif
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _internal_metadata_.unknown_fields();
+  }
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return _internal_metadata_.mutable_unknown_fields();
+  }
+
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const locate_setting& default_instance();
+
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
+  static inline const locate_setting* internal_default_instance() {
+    return reinterpret_cast<const locate_setting*>(
+               &_locate_setting_default_instance_);
+  }
+  static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+    0;
+
+  void Swap(locate_setting* other);
+  friend void swap(locate_setting& a, locate_setting& b) {
+    a.Swap(&b);
+  }
+
+  // implements Message ----------------------------------------------
+
+  inline locate_setting* New() const PROTOBUF_FINAL { return New(NULL); }
+
+  locate_setting* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+  void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+  void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+  void CopyFrom(const locate_setting& from);
+  void MergeFrom(const locate_setting& from);
+  void Clear() PROTOBUF_FINAL;
+  bool IsInitialized() const PROTOBUF_FINAL;
+
+  size_t ByteSizeLong() const PROTOBUF_FINAL;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
+  ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
+      bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+  int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const PROTOBUF_FINAL;
+  void InternalSwap(locate_setting* other);
+  private:
+  inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
+    return NULL;
+  }
+  inline void* MaybeArenaPtr() const {
+    return NULL;
+  }
+  public:
+
+  ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
+
+  // nested types ----------------------------------------------------
+
+  // accessors -------------------------------------------------------
+
+  // required string ip = 1;
+  bool has_ip() const;
+  void clear_ip();
+  static const int kIpFieldNumber = 1;
+  const ::std::string& ip() const;
+  void set_ip(const ::std::string& value);
+  #if LANG_CXX11
+  void set_ip(::std::string&& value);
+  #endif
+  void set_ip(const char* value);
+  void set_ip(const char* value, size_t size);
+  ::std::string* mutable_ip();
+  ::std::string* release_ip();
+  void set_allocated_ip(::std::string* ip);
+
+  // required int32 port = 2;
+  bool has_port() const;
+  void clear_port();
+  static const int kPortFieldNumber = 2;
+  ::google::protobuf::int32 port() const;
+  void set_port(::google::protobuf::int32 value);
+
+  // @@protoc_insertion_point(class_scope:global.locate_setting)
+ private:
+  void set_has_ip();
+  void clear_has_ip();
+  void set_has_port();
+  void clear_has_port();
+
+  // helper for ByteSizeLong()
+  size_t RequiredFieldsByteSizeFallback() const;
+
+  ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
+  ::google::protobuf::internal::HasBits<1> _has_bits_;
+  mutable int _cached_size_;
+  ::google::protobuf::internal::ArenaStringPtr ip_;
+  ::google::protobuf::int32 port_;
+  friend struct ::protobuf_setting_2eproto::TableStruct;
+  friend void ::protobuf_setting_2eproto::InitDefaultslocate_settingImpl();
+};
+// -------------------------------------------------------------------
+
+class setting : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:global.setting) */ {
+ public:
+  setting();
+  virtual ~setting();
+
+  setting(const setting& from);
+
+  inline setting& operator=(const setting& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  #if LANG_CXX11
+  setting(setting&& from) noexcept
+    : setting() {
+    *this = ::std::move(from);
+  }
+
+  inline setting& operator=(setting&& from) noexcept {
+    if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
+      if (this != &from) InternalSwap(&from);
+    } else {
+      CopyFrom(from);
+    }
+    return *this;
+  }
+  #endif
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _internal_metadata_.unknown_fields();
+  }
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return _internal_metadata_.mutable_unknown_fields();
+  }
+
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const setting& default_instance();
+
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
+  static inline const setting* internal_default_instance() {
+    return reinterpret_cast<const setting*>(
+               &_setting_default_instance_);
+  }
+  static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+    1;
+
+  void Swap(setting* other);
+  friend void swap(setting& a, setting& b) {
+    a.Swap(&b);
+  }
+
+  // implements Message ----------------------------------------------
+
+  inline setting* New() const PROTOBUF_FINAL { return New(NULL); }
+
+  setting* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+  void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+  void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+  void CopyFrom(const setting& from);
+  void MergeFrom(const setting& from);
+  void Clear() PROTOBUF_FINAL;
+  bool IsInitialized() const PROTOBUF_FINAL;
+
+  size_t ByteSizeLong() const PROTOBUF_FINAL;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
+  ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
+      bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+  int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const PROTOBUF_FINAL;
+  void InternalSwap(setting* other);
+  private:
+  inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
+    return NULL;
+  }
+  inline void* MaybeArenaPtr() const {
+    return NULL;
+  }
+  public:
+
+  ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
+
+  // nested types ----------------------------------------------------
+
+  // accessors -------------------------------------------------------
+
+  // required .global.locate_setting locate_parameter = 1;
+  bool has_locate_parameter() const;
+  void clear_locate_parameter();
+  static const int kLocateParameterFieldNumber = 1;
+  const ::global::locate_setting& locate_parameter() const;
+  ::global::locate_setting* release_locate_parameter();
+  ::global::locate_setting* mutable_locate_parameter();
+  void set_allocated_locate_parameter(::global::locate_setting* locate_parameter);
+
+  // @@protoc_insertion_point(class_scope:global.setting)
+ private:
+  void set_has_locate_parameter();
+  void clear_has_locate_parameter();
+
+  ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
+  ::google::protobuf::internal::HasBits<1> _has_bits_;
+  mutable int _cached_size_;
+  ::global::locate_setting* locate_parameter_;
+  friend struct ::protobuf_setting_2eproto::TableStruct;
+  friend void ::protobuf_setting_2eproto::InitDefaultssettingImpl();
+};
+// ===================================================================
+
+
+// ===================================================================
+
+#ifdef __GNUC__
+  #pragma GCC diagnostic push
+  #pragma GCC diagnostic ignored "-Wstrict-aliasing"
+#endif  // __GNUC__
+// locate_setting
+
+// required string ip = 1;
+inline bool locate_setting::has_ip() const {
+  return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void locate_setting::set_has_ip() {
+  _has_bits_[0] |= 0x00000001u;
+}
+inline void locate_setting::clear_has_ip() {
+  _has_bits_[0] &= ~0x00000001u;
+}
+inline void locate_setting::clear_ip() {
+  ip_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  clear_has_ip();
+}
+inline const ::std::string& locate_setting::ip() const {
+  // @@protoc_insertion_point(field_get:global.locate_setting.ip)
+  return ip_.GetNoArena();
+}
+inline void locate_setting::set_ip(const ::std::string& value) {
+  set_has_ip();
+  ip_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+  // @@protoc_insertion_point(field_set:global.locate_setting.ip)
+}
+#if LANG_CXX11
+inline void locate_setting::set_ip(::std::string&& value) {
+  set_has_ip();
+  ip_.SetNoArena(
+    &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+  // @@protoc_insertion_point(field_set_rvalue:global.locate_setting.ip)
+}
+#endif
+inline void locate_setting::set_ip(const char* value) {
+  GOOGLE_DCHECK(value != NULL);
+  set_has_ip();
+  ip_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+  // @@protoc_insertion_point(field_set_char:global.locate_setting.ip)
+}
+inline void locate_setting::set_ip(const char* value, size_t size) {
+  set_has_ip();
+  ip_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+      ::std::string(reinterpret_cast<const char*>(value), size));
+  // @@protoc_insertion_point(field_set_pointer:global.locate_setting.ip)
+}
+inline ::std::string* locate_setting::mutable_ip() {
+  set_has_ip();
+  // @@protoc_insertion_point(field_mutable:global.locate_setting.ip)
+  return ip_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+inline ::std::string* locate_setting::release_ip() {
+  // @@protoc_insertion_point(field_release:global.locate_setting.ip)
+  clear_has_ip();
+  return ip_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+inline void locate_setting::set_allocated_ip(::std::string* ip) {
+  if (ip != NULL) {
+    set_has_ip();
+  } else {
+    clear_has_ip();
+  }
+  ip_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ip);
+  // @@protoc_insertion_point(field_set_allocated:global.locate_setting.ip)
+}
+
+// required int32 port = 2;
+inline bool locate_setting::has_port() const {
+  return (_has_bits_[0] & 0x00000002u) != 0;
+}
+inline void locate_setting::set_has_port() {
+  _has_bits_[0] |= 0x00000002u;
+}
+inline void locate_setting::clear_has_port() {
+  _has_bits_[0] &= ~0x00000002u;
+}
+inline void locate_setting::clear_port() {
+  port_ = 0;
+  clear_has_port();
+}
+inline ::google::protobuf::int32 locate_setting::port() const {
+  // @@protoc_insertion_point(field_get:global.locate_setting.port)
+  return port_;
+}
+inline void locate_setting::set_port(::google::protobuf::int32 value) {
+  set_has_port();
+  port_ = value;
+  // @@protoc_insertion_point(field_set:global.locate_setting.port)
+}
+
+// -------------------------------------------------------------------
+
+// setting
+
+// required .global.locate_setting locate_parameter = 1;
+inline bool setting::has_locate_parameter() const {
+  return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void setting::set_has_locate_parameter() {
+  _has_bits_[0] |= 0x00000001u;
+}
+inline void setting::clear_has_locate_parameter() {
+  _has_bits_[0] &= ~0x00000001u;
+}
+inline void setting::clear_locate_parameter() {
+  if (locate_parameter_ != NULL) locate_parameter_->Clear();
+  clear_has_locate_parameter();
+}
+inline const ::global::locate_setting& setting::locate_parameter() const {
+  const ::global::locate_setting* p = locate_parameter_;
+  // @@protoc_insertion_point(field_get:global.setting.locate_parameter)
+  return p != NULL ? *p : *reinterpret_cast<const ::global::locate_setting*>(
+      &::global::_locate_setting_default_instance_);
+}
+inline ::global::locate_setting* setting::release_locate_parameter() {
+  // @@protoc_insertion_point(field_release:global.setting.locate_parameter)
+  clear_has_locate_parameter();
+  ::global::locate_setting* temp = locate_parameter_;
+  locate_parameter_ = NULL;
+  return temp;
+}
+inline ::global::locate_setting* setting::mutable_locate_parameter() {
+  set_has_locate_parameter();
+  if (locate_parameter_ == NULL) {
+    locate_parameter_ = new ::global::locate_setting;
+  }
+  // @@protoc_insertion_point(field_mutable:global.setting.locate_parameter)
+  return locate_parameter_;
+}
+inline void setting::set_allocated_locate_parameter(::global::locate_setting* locate_parameter) {
+  ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
+  if (message_arena == NULL) {
+    delete locate_parameter_;
+  }
+  if (locate_parameter) {
+    ::google::protobuf::Arena* submessage_arena = NULL;
+    if (message_arena != submessage_arena) {
+      locate_parameter = ::google::protobuf::internal::GetOwnedMessage(
+          message_arena, locate_parameter, submessage_arena);
+    }
+    set_has_locate_parameter();
+  } else {
+    clear_has_locate_parameter();
+  }
+  locate_parameter_ = locate_parameter;
+  // @@protoc_insertion_point(field_set_allocated:global.setting.locate_parameter)
+}
+
+#ifdef __GNUC__
+  #pragma GCC diagnostic pop
+#endif  // __GNUC__
+// -------------------------------------------------------------------
+
+
+// @@protoc_insertion_point(namespace_scope)
+
+}  // namespace global
+
+// @@protoc_insertion_point(global_scope)
+
+#endif  // PROTOBUF_setting_2eproto__INCLUDED

+ 15 - 0
setting.proto

@@ -0,0 +1,15 @@
+syntax = "proto2";
+package global;
+
+message locate_setting
+{
+    required string ip=1;
+    required int32 port=2;
+
+}
+
+message setting
+{
+    required locate_setting locate_parameter=1;
+}
+