Browse Source

20220209 create

huli 3 năm trước cách đây
commit
f7576e3272
100 tập tin đã thay đổi với 148905 bổ sung0 xóa
  1. 96 0
      CMakeLists.txt
  2. 729 0
      communication/communication.pb.cc
  3. 530 0
      communication/communication.pb.h
  4. 14 0
      communication/communication.proto
  5. 93 0
      communication/communication_message.cpp
  6. 149 0
      communication/communication_message.h
  7. 610 0
      communication/communication_socket_base.cpp
  8. 169 0
      communication/communication_socket_base.h
  9. 387 0
      error_code/error_code.cpp
  10. 744 0
      error_code/error_code.h
  11. 14 0
      hulitest.sh
  12. 97 0
      main.cpp
  13. 596 0
      message/UnNormalized_module_message.pb.cc
  14. 450 0
      message/UnNormalized_module_message.pb.h
  15. 11 0
      message/UnNormalized_module_message.proto
  16. 1925 0
      message/central_control_message.pb.cc
  17. 1273 0
      message/central_control_message.pb.h
  18. 56 0
      message/central_control_message.proto
  19. 2821 0
      message/dispatch_control.pb.cc
  20. 2085 0
      message/dispatch_control.pb.h
  21. 209 0
      message/dispatch_control.proto
  22. 7461 0
      message/dispatch_message.pb.cc
  23. 5829 0
      message/dispatch_message.pb.h
  24. 348 0
      message/dispatch_message.proto
  25. 2671 0
      message/log_process.pb.cc
  26. 1754 0
      message/log_process.pb.h
  27. 59 0
      message/log_process.proto
  28. 5540 0
      message/measure_message.pb.cc
  29. 4015 0
      message/measure_message.pb.h
  30. 187 0
      message/measure_message.proto
  31. 4207 0
      message/message_base.pb.cc
  32. 3120 0
      message/message_base.pb.h
  33. 311 0
      message/message_base.proto
  34. 1664 0
      message/notify_message.pb.cc
  35. 1230 0
      message/notify_message.pb.h
  36. 28 0
      message/notify_message.proto
  37. 7511 0
      message/parkspace_allocation_message.pb.cc
  38. 5268 0
      message/parkspace_allocation_message.pb.h
  39. 170 0
      message/parkspace_allocation_message.proto
  40. 8882 0
      message/process_message.pb.cc
  41. 6626 0
      message/process_message.pb.h
  42. 156 0
      message/process_message.proto
  43. 3594 0
      message/singlechip_msg.pb.cc
  44. 2627 0
      message/singlechip_msg.pb.h
  45. 211 0
      message/singlechip_msg.proto
  46. 2063 0
      message/terminal_message.pb.cc
  47. 1496 0
      message/terminal_message.pb.h
  48. 39 0
      message/terminal_message.proto
  49. 24 0
      proto.sh
  50. 63 0
      setting/communication.prototxt
  51. 53 0
      setting/communication_a.prototxt
  52. 52 0
      setting/communication_b.prototxt
  53. 52 0
      setting/communication_c.prototxt
  54. 3384 0
      setting/dispatch_coordinates.prototxt
  55. 33 0
      setting/dispatch_device.prototxt
  56. 86 0
      setting/laser.prototxt
  57. 54 0
      setting/locate.prototxt
  58. 16 0
      setting/snap7_communication.prototxt
  59. 21 0
      setting/snap7_communication_a.prototxt
  60. 16 0
      setting/snap7_communication_b.prototxt
  61. 16 0
      setting/snap7_communication_c.prototxt
  62. 108 0
      system/system_communication.cpp
  63. 49 0
      system/system_communication.h
  64. 456 0
      system/system_executor.cpp
  65. 96 0
      system/system_executor.h
  66. 193 0
      task/task_base.cpp
  67. 163 0
      task/task_base.h
  68. 80 0
      task/task_base.puml
  69. 56 0
      task/task_command_manager.cpp
  70. 42 0
      task/task_command_manager.h
  71. 12 0
      task/task_command_manager.puml
  72. 51309 0
      test.txt
  73. 33 0
      tool/TaskQueue/BaseTask.cpp
  74. 29 0
      tool/TaskQueue/BaseTask.h
  75. 23 0
      tool/TaskQueue/TQFactory.cpp
  76. 24 0
      tool/TaskQueue/TQFactory.h
  77. 58 0
      tool/TaskQueue/TQInterface.h
  78. 89 0
      tool/TaskQueue/TaskPool.h
  79. 288 0
      tool/TaskQueue/ThreadTaskQueue.cpp
  80. 89 0
      tool/TaskQueue/ThreadTaskQueue.h
  81. 35 0
      tool/TaskQueue/threadpp/impl/pthread_lock.h
  82. 73 0
      tool/TaskQueue/threadpp/impl/pthread_lock.hpp
  83. 45 0
      tool/TaskQueue/threadpp/impl/pthread_thread.h
  84. 110 0
      tool/TaskQueue/threadpp/impl/pthread_thread.hpp
  85. 33 0
      tool/TaskQueue/threadpp/impl/std_lock.h
  86. 52 0
      tool/TaskQueue/threadpp/impl/std_lock.hpp
  87. 40 0
      tool/TaskQueue/threadpp/impl/std_thread.h
  88. 64 0
      tool/TaskQueue/threadpp/impl/std_thread.hpp
  89. 37 0
      tool/TaskQueue/threadpp/impl/win_lock.h
  90. 80 0
      tool/TaskQueue/threadpp/impl/win_lock.hpp
  91. 53 0
      tool/TaskQueue/threadpp/impl/win_thread.h
  92. 81 0
      tool/TaskQueue/threadpp/impl/win_thread.hpp
  93. 101 0
      tool/TaskQueue/threadpp/recursive_lock.h
  94. 40 0
      tool/TaskQueue/threadpp/threadpp.h
  95. 33 0
      tool/TaskQueue/threadpp/threadpp_assert.h
  96. 341 0
      tool/binary_buf.cpp
  97. 91 0
      tool/binary_buf.h
  98. 85 0
      tool/binary_buf.puml
  99. 319 0
      tool/common_data.cpp
  100. 0 0
      tool/common_data.h

+ 96 - 0
CMakeLists.txt

@@ -0,0 +1,96 @@
+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)
+#FIND_PACKAGE(OpenCV REQUIRED)
+#FIND_PACKAGE(PCL REQUIRED)
+
+
+MESSAGE(WARN "pcl:: ${PCL_INCLUDE_DIRS} --- ${PCL_LIBRARIES}")
+include_directories(
+        /usr/local/include
+		/usr/local/include/snap7
+#        ${PCL_INCLUDE_DIRS}
+#        ${OpenCV_INCLUDE_DIRS}
+        ${PROTOBUF_INCLUDE_DIRS}
+        laser
+        Locate
+        communication
+        message
+        error_code
+        tool
+		system
+		dispatch
+)
+link_directories("/usr/local/lib")
+
+message(STATUS ${EXECUTABLE_OUTPUT_PATH})
+
+
+aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/error_code error_src )
+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 )
+aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/laser LASER_SRC )
+#aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/plc PLC_SRC )
+aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/locate LOCATE_SRC )
+aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/terminor TERMINOR_SRC )
+aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/task TASK_MANAGER_SRC )
+aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/tool TOOL_SRC )
+aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/tool/TaskQueue TASK_QUEUE_SRC )
+aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/communication COMMUNICATION_SRC )
+aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/system SYSTEM_SRC )
+aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/dispatch DISPATCH_SRC )
+aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/snap7_communication SNAP7_COMMUNICATION_SRC )
+
+
+add_executable(terminal
+        main.cpp
+        ${error_src}
+        ${locate_src}
+        ${robot_src}
+        ${message_src}
+
+        ${LASER_SRC}
+        ${PLC_SRC}
+        ${TERMINOR_SRC}
+        ${LOCATE_SRC}
+        ${TASK_MANAGER_SRC}
+		${TOOL_SRC}
+		${TASK_QUEUE_SRC}
+		${COMMUNICATION_SRC}
+		${SNAP7_COMMUNICATION_SRC}
+        ${SYSTEM_SRC}
+		${DISPATCH_SRC}
+
+		)
+
+
+
+target_link_libraries(terminal
+        /usr/local/lib/libglog.a
+        /usr/local/lib/libgflags.a
+#        /usr/local/lib/liblivox_sdk_static.a
+#        /usr/local/apr/lib/libapr-1.a
+        nnxx
+        nanomsg
+
+        ${PROTOBUF_LIBRARIES}
+#        ${OpenCV_LIBS}
+        ${GLOG_LIBRARIES}
+#        ${PCL_LIBRARIES}
+        ${PROTOBUF_LIBRARIES}
+
+#        libtensorflow_cc.so
+        #tf_3dcnn_api.so
+#        pointSIFT_API.so
+		snap7
+        -lpthread
+        )
+

+ 729 - 0
communication/communication.pb.cc

@@ -0,0 +1,729 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: communication.proto
+
+#include "communication.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 Communication_proto {
+class Communication_parameterDefaultTypeInternal {
+ public:
+  ::google::protobuf::internal::ExplicitlyConstructed<Communication_parameter>
+      _instance;
+} _Communication_parameter_default_instance_;
+class Communication_parameter_allDefaultTypeInternal {
+ public:
+  ::google::protobuf::internal::ExplicitlyConstructed<Communication_parameter_all>
+      _instance;
+} _Communication_parameter_all_default_instance_;
+}  // namespace Communication_proto
+namespace protobuf_communication_2eproto {
+void InitDefaultsCommunication_parameterImpl() {
+  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 = &::Communication_proto::_Communication_parameter_default_instance_;
+    new (ptr) ::Communication_proto::Communication_parameter();
+    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
+  }
+  ::Communication_proto::Communication_parameter::InitAsDefaultInstance();
+}
+
+void InitDefaultsCommunication_parameter() {
+  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+  ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsCommunication_parameterImpl);
+}
+
+void InitDefaultsCommunication_parameter_allImpl() {
+  GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
+  ::google::protobuf::internal::InitProtobufDefaultsForceUnique();
+#else
+  ::google::protobuf::internal::InitProtobufDefaults();
+#endif  // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
+  protobuf_communication_2eproto::InitDefaultsCommunication_parameter();
+  {
+    void* ptr = &::Communication_proto::_Communication_parameter_all_default_instance_;
+    new (ptr) ::Communication_proto::Communication_parameter_all();
+    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
+  }
+  ::Communication_proto::Communication_parameter_all::InitAsDefaultInstance();
+}
+
+void InitDefaultsCommunication_parameter_all() {
+  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+  ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsCommunication_parameter_allImpl);
+}
+
+::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(::Communication_proto::Communication_parameter, _has_bits_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::Communication_proto::Communication_parameter, _internal_metadata_),
+  ~0u,  // no _extensions_
+  ~0u,  // no _oneof_case_
+  ~0u,  // no _weak_field_map_
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::Communication_proto::Communication_parameter, bind_string_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::Communication_proto::Communication_parameter, connect_string_vector_),
+  0,
+  ~0u,
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::Communication_proto::Communication_parameter_all, _has_bits_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::Communication_proto::Communication_parameter_all, _internal_metadata_),
+  ~0u,  // no _extensions_
+  ~0u,  // no _oneof_case_
+  ~0u,  // no _weak_field_map_
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::Communication_proto::Communication_parameter_all, communication_parameters_),
+  0,
+};
+static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+  { 0, 7, sizeof(::Communication_proto::Communication_parameter)},
+  { 9, 15, sizeof(::Communication_proto::Communication_parameter_all)},
+};
+
+static ::google::protobuf::Message const * const file_default_instances[] = {
+  reinterpret_cast<const ::google::protobuf::Message*>(&::Communication_proto::_Communication_parameter_default_instance_),
+  reinterpret_cast<const ::google::protobuf::Message*>(&::Communication_proto::_Communication_parameter_all_default_instance_),
+};
+
+void protobuf_AssignDescriptors() {
+  AddDescriptors();
+  ::google::protobuf::MessageFactory* factory = NULL;
+  AssignDescriptors(
+      "communication.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\023communication.proto\022\023Communication_pro"
+      "to\"M\n\027Communication_parameter\022\023\n\013bind_st"
+      "ring\030\001 \001(\t\022\035\n\025connect_string_vector\030\002 \003("
+      "\t\"m\n\033Communication_parameter_all\022N\n\030comm"
+      "unication_parameters\030\001 \001(\0132,.Communicati"
+      "on_proto.Communication_parameter"
+  };
+  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
+      descriptor, 232);
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
+    "communication.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_communication_2eproto
+namespace Communication_proto {
+
+// ===================================================================
+
+void Communication_parameter::InitAsDefaultInstance() {
+}
+#if !defined(_MSC_VER) || _MSC_VER >= 1900
+const int Communication_parameter::kBindStringFieldNumber;
+const int Communication_parameter::kConnectStringVectorFieldNumber;
+#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900
+
+Communication_parameter::Communication_parameter()
+  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
+  if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+    ::protobuf_communication_2eproto::InitDefaultsCommunication_parameter();
+  }
+  SharedCtor();
+  // @@protoc_insertion_point(constructor:Communication_proto.Communication_parameter)
+}
+Communication_parameter::Communication_parameter(const Communication_parameter& from)
+  : ::google::protobuf::Message(),
+      _internal_metadata_(NULL),
+      _has_bits_(from._has_bits_),
+      _cached_size_(0),
+      connect_string_vector_(from.connect_string_vector_) {
+  _internal_metadata_.MergeFrom(from._internal_metadata_);
+  bind_string_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  if (from.has_bind_string()) {
+    bind_string_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.bind_string_);
+  }
+  // @@protoc_insertion_point(copy_constructor:Communication_proto.Communication_parameter)
+}
+
+void Communication_parameter::SharedCtor() {
+  _cached_size_ = 0;
+  bind_string_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+
+Communication_parameter::~Communication_parameter() {
+  // @@protoc_insertion_point(destructor:Communication_proto.Communication_parameter)
+  SharedDtor();
+}
+
+void Communication_parameter::SharedDtor() {
+  bind_string_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+
+void Communication_parameter::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* Communication_parameter::descriptor() {
+  ::protobuf_communication_2eproto::protobuf_AssignDescriptorsOnce();
+  return ::protobuf_communication_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+}
+
+const Communication_parameter& Communication_parameter::default_instance() {
+  ::protobuf_communication_2eproto::InitDefaultsCommunication_parameter();
+  return *internal_default_instance();
+}
+
+Communication_parameter* Communication_parameter::New(::google::protobuf::Arena* arena) const {
+  Communication_parameter* n = new Communication_parameter;
+  if (arena != NULL) {
+    arena->Own(n);
+  }
+  return n;
+}
+
+void Communication_parameter::Clear() {
+// @@protoc_insertion_point(message_clear_start:Communication_proto.Communication_parameter)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  // Prevent compiler warnings about cached_has_bits being unused
+  (void) cached_has_bits;
+
+  connect_string_vector_.Clear();
+  cached_has_bits = _has_bits_[0];
+  if (cached_has_bits & 0x00000001u) {
+    GOOGLE_DCHECK(!bind_string_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+    (*bind_string_.UnsafeRawStringPointer())->clear();
+  }
+  _has_bits_.Clear();
+  _internal_metadata_.Clear();
+}
+
+bool Communication_parameter::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:Communication_proto.Communication_parameter)
+  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)) {
+      // optional string bind_string = 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_bind_string()));
+          ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
+            this->bind_string().data(), static_cast<int>(this->bind_string().length()),
+            ::google::protobuf::internal::WireFormat::PARSE,
+            "Communication_proto.Communication_parameter.bind_string");
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      // repeated string connect_string_vector = 2;
+      case 2: {
+        if (static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
+          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+                input, this->add_connect_string_vector()));
+          ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
+            this->connect_string_vector(this->connect_string_vector_size() - 1).data(),
+            static_cast<int>(this->connect_string_vector(this->connect_string_vector_size() - 1).length()),
+            ::google::protobuf::internal::WireFormat::PARSE,
+            "Communication_proto.Communication_parameter.connect_string_vector");
+        } 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:Communication_proto.Communication_parameter)
+  return true;
+failure:
+  // @@protoc_insertion_point(parse_failure:Communication_proto.Communication_parameter)
+  return false;
+#undef DO_
+}
+
+void Communication_parameter::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // @@protoc_insertion_point(serialize_start:Communication_proto.Communication_parameter)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  cached_has_bits = _has_bits_[0];
+  // optional string bind_string = 1;
+  if (cached_has_bits & 0x00000001u) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
+      this->bind_string().data(), static_cast<int>(this->bind_string().length()),
+      ::google::protobuf::internal::WireFormat::SERIALIZE,
+      "Communication_proto.Communication_parameter.bind_string");
+    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
+      1, this->bind_string(), output);
+  }
+
+  // repeated string connect_string_vector = 2;
+  for (int i = 0, n = this->connect_string_vector_size(); i < n; i++) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
+      this->connect_string_vector(i).data(), static_cast<int>(this->connect_string_vector(i).length()),
+      ::google::protobuf::internal::WireFormat::SERIALIZE,
+      "Communication_proto.Communication_parameter.connect_string_vector");
+    ::google::protobuf::internal::WireFormatLite::WriteString(
+      2, this->connect_string_vector(i), output);
+  }
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        _internal_metadata_.unknown_fields(), output);
+  }
+  // @@protoc_insertion_point(serialize_end:Communication_proto.Communication_parameter)
+}
+
+::google::protobuf::uint8* Communication_parameter::InternalSerializeWithCachedSizesToArray(
+    bool deterministic, ::google::protobuf::uint8* target) const {
+  (void)deterministic; // Unused
+  // @@protoc_insertion_point(serialize_to_array_start:Communication_proto.Communication_parameter)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  cached_has_bits = _has_bits_[0];
+  // optional string bind_string = 1;
+  if (cached_has_bits & 0x00000001u) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
+      this->bind_string().data(), static_cast<int>(this->bind_string().length()),
+      ::google::protobuf::internal::WireFormat::SERIALIZE,
+      "Communication_proto.Communication_parameter.bind_string");
+    target =
+      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+        1, this->bind_string(), target);
+  }
+
+  // repeated string connect_string_vector = 2;
+  for (int i = 0, n = this->connect_string_vector_size(); i < n; i++) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
+      this->connect_string_vector(i).data(), static_cast<int>(this->connect_string_vector(i).length()),
+      ::google::protobuf::internal::WireFormat::SERIALIZE,
+      "Communication_proto.Communication_parameter.connect_string_vector");
+    target = ::google::protobuf::internal::WireFormatLite::
+      WriteStringToArray(2, this->connect_string_vector(i), 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:Communication_proto.Communication_parameter)
+  return target;
+}
+
+size_t Communication_parameter::ByteSizeLong() const {
+// @@protoc_insertion_point(message_byte_size_start:Communication_proto.Communication_parameter)
+  size_t total_size = 0;
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        _internal_metadata_.unknown_fields());
+  }
+  // repeated string connect_string_vector = 2;
+  total_size += 1 *
+      ::google::protobuf::internal::FromIntSize(this->connect_string_vector_size());
+  for (int i = 0, n = this->connect_string_vector_size(); i < n; i++) {
+    total_size += ::google::protobuf::internal::WireFormatLite::StringSize(
+      this->connect_string_vector(i));
+  }
+
+  // optional string bind_string = 1;
+  if (has_bind_string()) {
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::StringSize(
+        this->bind_string());
+  }
+
+  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 Communication_parameter::MergeFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_merge_from_start:Communication_proto.Communication_parameter)
+  GOOGLE_DCHECK_NE(&from, this);
+  const Communication_parameter* source =
+      ::google::protobuf::internal::DynamicCastToGenerated<const Communication_parameter>(
+          &from);
+  if (source == NULL) {
+  // @@protoc_insertion_point(generalized_merge_from_cast_fail:Communication_proto.Communication_parameter)
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+  // @@protoc_insertion_point(generalized_merge_from_cast_success:Communication_proto.Communication_parameter)
+    MergeFrom(*source);
+  }
+}
+
+void Communication_parameter::MergeFrom(const Communication_parameter& from) {
+// @@protoc_insertion_point(class_specific_merge_from_start:Communication_proto.Communication_parameter)
+  GOOGLE_DCHECK_NE(&from, this);
+  _internal_metadata_.MergeFrom(from._internal_metadata_);
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  connect_string_vector_.MergeFrom(from.connect_string_vector_);
+  if (from.has_bind_string()) {
+    set_has_bind_string();
+    bind_string_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.bind_string_);
+  }
+}
+
+void Communication_parameter::CopyFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_copy_from_start:Communication_proto.Communication_parameter)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void Communication_parameter::CopyFrom(const Communication_parameter& from) {
+// @@protoc_insertion_point(class_specific_copy_from_start:Communication_proto.Communication_parameter)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool Communication_parameter::IsInitialized() const {
+  return true;
+}
+
+void Communication_parameter::Swap(Communication_parameter* other) {
+  if (other == this) return;
+  InternalSwap(other);
+}
+void Communication_parameter::InternalSwap(Communication_parameter* other) {
+  using std::swap;
+  connect_string_vector_.InternalSwap(&other->connect_string_vector_);
+  bind_string_.Swap(&other->bind_string_);
+  swap(_has_bits_[0], other->_has_bits_[0]);
+  _internal_metadata_.Swap(&other->_internal_metadata_);
+  swap(_cached_size_, other->_cached_size_);
+}
+
+::google::protobuf::Metadata Communication_parameter::GetMetadata() const {
+  protobuf_communication_2eproto::protobuf_AssignDescriptorsOnce();
+  return ::protobuf_communication_2eproto::file_level_metadata[kIndexInFileMessages];
+}
+
+
+// ===================================================================
+
+void Communication_parameter_all::InitAsDefaultInstance() {
+  ::Communication_proto::_Communication_parameter_all_default_instance_._instance.get_mutable()->communication_parameters_ = const_cast< ::Communication_proto::Communication_parameter*>(
+      ::Communication_proto::Communication_parameter::internal_default_instance());
+}
+#if !defined(_MSC_VER) || _MSC_VER >= 1900
+const int Communication_parameter_all::kCommunicationParametersFieldNumber;
+#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900
+
+Communication_parameter_all::Communication_parameter_all()
+  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
+  if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+    ::protobuf_communication_2eproto::InitDefaultsCommunication_parameter_all();
+  }
+  SharedCtor();
+  // @@protoc_insertion_point(constructor:Communication_proto.Communication_parameter_all)
+}
+Communication_parameter_all::Communication_parameter_all(const Communication_parameter_all& from)
+  : ::google::protobuf::Message(),
+      _internal_metadata_(NULL),
+      _has_bits_(from._has_bits_),
+      _cached_size_(0) {
+  _internal_metadata_.MergeFrom(from._internal_metadata_);
+  if (from.has_communication_parameters()) {
+    communication_parameters_ = new ::Communication_proto::Communication_parameter(*from.communication_parameters_);
+  } else {
+    communication_parameters_ = NULL;
+  }
+  // @@protoc_insertion_point(copy_constructor:Communication_proto.Communication_parameter_all)
+}
+
+void Communication_parameter_all::SharedCtor() {
+  _cached_size_ = 0;
+  communication_parameters_ = NULL;
+}
+
+Communication_parameter_all::~Communication_parameter_all() {
+  // @@protoc_insertion_point(destructor:Communication_proto.Communication_parameter_all)
+  SharedDtor();
+}
+
+void Communication_parameter_all::SharedDtor() {
+  if (this != internal_default_instance()) delete communication_parameters_;
+}
+
+void Communication_parameter_all::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* Communication_parameter_all::descriptor() {
+  ::protobuf_communication_2eproto::protobuf_AssignDescriptorsOnce();
+  return ::protobuf_communication_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+}
+
+const Communication_parameter_all& Communication_parameter_all::default_instance() {
+  ::protobuf_communication_2eproto::InitDefaultsCommunication_parameter_all();
+  return *internal_default_instance();
+}
+
+Communication_parameter_all* Communication_parameter_all::New(::google::protobuf::Arena* arena) const {
+  Communication_parameter_all* n = new Communication_parameter_all;
+  if (arena != NULL) {
+    arena->Own(n);
+  }
+  return n;
+}
+
+void Communication_parameter_all::Clear() {
+// @@protoc_insertion_point(message_clear_start:Communication_proto.Communication_parameter_all)
+  ::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(communication_parameters_ != NULL);
+    communication_parameters_->Clear();
+  }
+  _has_bits_.Clear();
+  _internal_metadata_.Clear();
+}
+
+bool Communication_parameter_all::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:Communication_proto.Communication_parameter_all)
+  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)) {
+      // optional .Communication_proto.Communication_parameter communication_parameters = 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_communication_parameters()));
+        } 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:Communication_proto.Communication_parameter_all)
+  return true;
+failure:
+  // @@protoc_insertion_point(parse_failure:Communication_proto.Communication_parameter_all)
+  return false;
+#undef DO_
+}
+
+void Communication_parameter_all::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // @@protoc_insertion_point(serialize_start:Communication_proto.Communication_parameter_all)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  cached_has_bits = _has_bits_[0];
+  // optional .Communication_proto.Communication_parameter communication_parameters = 1;
+  if (cached_has_bits & 0x00000001u) {
+    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
+      1, *this->communication_parameters_, output);
+  }
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        _internal_metadata_.unknown_fields(), output);
+  }
+  // @@protoc_insertion_point(serialize_end:Communication_proto.Communication_parameter_all)
+}
+
+::google::protobuf::uint8* Communication_parameter_all::InternalSerializeWithCachedSizesToArray(
+    bool deterministic, ::google::protobuf::uint8* target) const {
+  (void)deterministic; // Unused
+  // @@protoc_insertion_point(serialize_to_array_start:Communication_proto.Communication_parameter_all)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  cached_has_bits = _has_bits_[0];
+  // optional .Communication_proto.Communication_parameter communication_parameters = 1;
+  if (cached_has_bits & 0x00000001u) {
+    target = ::google::protobuf::internal::WireFormatLite::
+      InternalWriteMessageToArray(
+        1, *this->communication_parameters_, 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:Communication_proto.Communication_parameter_all)
+  return target;
+}
+
+size_t Communication_parameter_all::ByteSizeLong() const {
+// @@protoc_insertion_point(message_byte_size_start:Communication_proto.Communication_parameter_all)
+  size_t total_size = 0;
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        _internal_metadata_.unknown_fields());
+  }
+  // optional .Communication_proto.Communication_parameter communication_parameters = 1;
+  if (has_communication_parameters()) {
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::MessageSize(
+        *this->communication_parameters_);
+  }
+
+  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 Communication_parameter_all::MergeFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_merge_from_start:Communication_proto.Communication_parameter_all)
+  GOOGLE_DCHECK_NE(&from, this);
+  const Communication_parameter_all* source =
+      ::google::protobuf::internal::DynamicCastToGenerated<const Communication_parameter_all>(
+          &from);
+  if (source == NULL) {
+  // @@protoc_insertion_point(generalized_merge_from_cast_fail:Communication_proto.Communication_parameter_all)
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+  // @@protoc_insertion_point(generalized_merge_from_cast_success:Communication_proto.Communication_parameter_all)
+    MergeFrom(*source);
+  }
+}
+
+void Communication_parameter_all::MergeFrom(const Communication_parameter_all& from) {
+// @@protoc_insertion_point(class_specific_merge_from_start:Communication_proto.Communication_parameter_all)
+  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_communication_parameters()) {
+    mutable_communication_parameters()->::Communication_proto::Communication_parameter::MergeFrom(from.communication_parameters());
+  }
+}
+
+void Communication_parameter_all::CopyFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_copy_from_start:Communication_proto.Communication_parameter_all)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void Communication_parameter_all::CopyFrom(const Communication_parameter_all& from) {
+// @@protoc_insertion_point(class_specific_copy_from_start:Communication_proto.Communication_parameter_all)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool Communication_parameter_all::IsInitialized() const {
+  return true;
+}
+
+void Communication_parameter_all::Swap(Communication_parameter_all* other) {
+  if (other == this) return;
+  InternalSwap(other);
+}
+void Communication_parameter_all::InternalSwap(Communication_parameter_all* other) {
+  using std::swap;
+  swap(communication_parameters_, other->communication_parameters_);
+  swap(_has_bits_[0], other->_has_bits_[0]);
+  _internal_metadata_.Swap(&other->_internal_metadata_);
+  swap(_cached_size_, other->_cached_size_);
+}
+
+::google::protobuf::Metadata Communication_parameter_all::GetMetadata() const {
+  protobuf_communication_2eproto::protobuf_AssignDescriptorsOnce();
+  return ::protobuf_communication_2eproto::file_level_metadata[kIndexInFileMessages];
+}
+
+
+// @@protoc_insertion_point(namespace_scope)
+}  // namespace Communication_proto
+
+// @@protoc_insertion_point(global_scope)

+ 530 - 0
communication/communication.pb.h

@@ -0,0 +1,530 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: communication.proto
+
+#ifndef PROTOBUF_communication_2eproto__INCLUDED
+#define PROTOBUF_communication_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_communication_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 InitDefaultsCommunication_parameterImpl();
+void InitDefaultsCommunication_parameter();
+void InitDefaultsCommunication_parameter_allImpl();
+void InitDefaultsCommunication_parameter_all();
+inline void InitDefaults() {
+  InitDefaultsCommunication_parameter();
+  InitDefaultsCommunication_parameter_all();
+}
+}  // namespace protobuf_communication_2eproto
+namespace Communication_proto {
+class Communication_parameter;
+class Communication_parameterDefaultTypeInternal;
+extern Communication_parameterDefaultTypeInternal _Communication_parameter_default_instance_;
+class Communication_parameter_all;
+class Communication_parameter_allDefaultTypeInternal;
+extern Communication_parameter_allDefaultTypeInternal _Communication_parameter_all_default_instance_;
+}  // namespace Communication_proto
+namespace Communication_proto {
+
+// ===================================================================
+
+class Communication_parameter : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:Communication_proto.Communication_parameter) */ {
+ public:
+  Communication_parameter();
+  virtual ~Communication_parameter();
+
+  Communication_parameter(const Communication_parameter& from);
+
+  inline Communication_parameter& operator=(const Communication_parameter& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  #if LANG_CXX11
+  Communication_parameter(Communication_parameter&& from) noexcept
+    : Communication_parameter() {
+    *this = ::std::move(from);
+  }
+
+  inline Communication_parameter& operator=(Communication_parameter&& 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 Communication_parameter& default_instance();
+
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
+  static inline const Communication_parameter* internal_default_instance() {
+    return reinterpret_cast<const Communication_parameter*>(
+               &_Communication_parameter_default_instance_);
+  }
+  static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+    0;
+
+  void Swap(Communication_parameter* other);
+  friend void swap(Communication_parameter& a, Communication_parameter& b) {
+    a.Swap(&b);
+  }
+
+  // implements Message ----------------------------------------------
+
+  inline Communication_parameter* New() const PROTOBUF_FINAL { return New(NULL); }
+
+  Communication_parameter* 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 Communication_parameter& from);
+  void MergeFrom(const Communication_parameter& 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(Communication_parameter* 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 -------------------------------------------------------
+
+  // repeated string connect_string_vector = 2;
+  int connect_string_vector_size() const;
+  void clear_connect_string_vector();
+  static const int kConnectStringVectorFieldNumber = 2;
+  const ::std::string& connect_string_vector(int index) const;
+  ::std::string* mutable_connect_string_vector(int index);
+  void set_connect_string_vector(int index, const ::std::string& value);
+  #if LANG_CXX11
+  void set_connect_string_vector(int index, ::std::string&& value);
+  #endif
+  void set_connect_string_vector(int index, const char* value);
+  void set_connect_string_vector(int index, const char* value, size_t size);
+  ::std::string* add_connect_string_vector();
+  void add_connect_string_vector(const ::std::string& value);
+  #if LANG_CXX11
+  void add_connect_string_vector(::std::string&& value);
+  #endif
+  void add_connect_string_vector(const char* value);
+  void add_connect_string_vector(const char* value, size_t size);
+  const ::google::protobuf::RepeatedPtrField< ::std::string>& connect_string_vector() const;
+  ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_connect_string_vector();
+
+  // optional string bind_string = 1;
+  bool has_bind_string() const;
+  void clear_bind_string();
+  static const int kBindStringFieldNumber = 1;
+  const ::std::string& bind_string() const;
+  void set_bind_string(const ::std::string& value);
+  #if LANG_CXX11
+  void set_bind_string(::std::string&& value);
+  #endif
+  void set_bind_string(const char* value);
+  void set_bind_string(const char* value, size_t size);
+  ::std::string* mutable_bind_string();
+  ::std::string* release_bind_string();
+  void set_allocated_bind_string(::std::string* bind_string);
+
+  // @@protoc_insertion_point(class_scope:Communication_proto.Communication_parameter)
+ private:
+  void set_has_bind_string();
+  void clear_has_bind_string();
+
+  ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
+  ::google::protobuf::internal::HasBits<1> _has_bits_;
+  mutable int _cached_size_;
+  ::google::protobuf::RepeatedPtrField< ::std::string> connect_string_vector_;
+  ::google::protobuf::internal::ArenaStringPtr bind_string_;
+  friend struct ::protobuf_communication_2eproto::TableStruct;
+  friend void ::protobuf_communication_2eproto::InitDefaultsCommunication_parameterImpl();
+};
+// -------------------------------------------------------------------
+
+class Communication_parameter_all : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:Communication_proto.Communication_parameter_all) */ {
+ public:
+  Communication_parameter_all();
+  virtual ~Communication_parameter_all();
+
+  Communication_parameter_all(const Communication_parameter_all& from);
+
+  inline Communication_parameter_all& operator=(const Communication_parameter_all& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  #if LANG_CXX11
+  Communication_parameter_all(Communication_parameter_all&& from) noexcept
+    : Communication_parameter_all() {
+    *this = ::std::move(from);
+  }
+
+  inline Communication_parameter_all& operator=(Communication_parameter_all&& 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 Communication_parameter_all& default_instance();
+
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
+  static inline const Communication_parameter_all* internal_default_instance() {
+    return reinterpret_cast<const Communication_parameter_all*>(
+               &_Communication_parameter_all_default_instance_);
+  }
+  static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+    1;
+
+  void Swap(Communication_parameter_all* other);
+  friend void swap(Communication_parameter_all& a, Communication_parameter_all& b) {
+    a.Swap(&b);
+  }
+
+  // implements Message ----------------------------------------------
+
+  inline Communication_parameter_all* New() const PROTOBUF_FINAL { return New(NULL); }
+
+  Communication_parameter_all* 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 Communication_parameter_all& from);
+  void MergeFrom(const Communication_parameter_all& 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(Communication_parameter_all* 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 -------------------------------------------------------
+
+  // optional .Communication_proto.Communication_parameter communication_parameters = 1;
+  bool has_communication_parameters() const;
+  void clear_communication_parameters();
+  static const int kCommunicationParametersFieldNumber = 1;
+  const ::Communication_proto::Communication_parameter& communication_parameters() const;
+  ::Communication_proto::Communication_parameter* release_communication_parameters();
+  ::Communication_proto::Communication_parameter* mutable_communication_parameters();
+  void set_allocated_communication_parameters(::Communication_proto::Communication_parameter* communication_parameters);
+
+  // @@protoc_insertion_point(class_scope:Communication_proto.Communication_parameter_all)
+ private:
+  void set_has_communication_parameters();
+  void clear_has_communication_parameters();
+
+  ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
+  ::google::protobuf::internal::HasBits<1> _has_bits_;
+  mutable int _cached_size_;
+  ::Communication_proto::Communication_parameter* communication_parameters_;
+  friend struct ::protobuf_communication_2eproto::TableStruct;
+  friend void ::protobuf_communication_2eproto::InitDefaultsCommunication_parameter_allImpl();
+};
+// ===================================================================
+
+
+// ===================================================================
+
+#ifdef __GNUC__
+  #pragma GCC diagnostic push
+  #pragma GCC diagnostic ignored "-Wstrict-aliasing"
+#endif  // __GNUC__
+// Communication_parameter
+
+// optional string bind_string = 1;
+inline bool Communication_parameter::has_bind_string() const {
+  return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void Communication_parameter::set_has_bind_string() {
+  _has_bits_[0] |= 0x00000001u;
+}
+inline void Communication_parameter::clear_has_bind_string() {
+  _has_bits_[0] &= ~0x00000001u;
+}
+inline void Communication_parameter::clear_bind_string() {
+  bind_string_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  clear_has_bind_string();
+}
+inline const ::std::string& Communication_parameter::bind_string() const {
+  // @@protoc_insertion_point(field_get:Communication_proto.Communication_parameter.bind_string)
+  return bind_string_.GetNoArena();
+}
+inline void Communication_parameter::set_bind_string(const ::std::string& value) {
+  set_has_bind_string();
+  bind_string_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+  // @@protoc_insertion_point(field_set:Communication_proto.Communication_parameter.bind_string)
+}
+#if LANG_CXX11
+inline void Communication_parameter::set_bind_string(::std::string&& value) {
+  set_has_bind_string();
+  bind_string_.SetNoArena(
+    &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+  // @@protoc_insertion_point(field_set_rvalue:Communication_proto.Communication_parameter.bind_string)
+}
+#endif
+inline void Communication_parameter::set_bind_string(const char* value) {
+  GOOGLE_DCHECK(value != NULL);
+  set_has_bind_string();
+  bind_string_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+  // @@protoc_insertion_point(field_set_char:Communication_proto.Communication_parameter.bind_string)
+}
+inline void Communication_parameter::set_bind_string(const char* value, size_t size) {
+  set_has_bind_string();
+  bind_string_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+      ::std::string(reinterpret_cast<const char*>(value), size));
+  // @@protoc_insertion_point(field_set_pointer:Communication_proto.Communication_parameter.bind_string)
+}
+inline ::std::string* Communication_parameter::mutable_bind_string() {
+  set_has_bind_string();
+  // @@protoc_insertion_point(field_mutable:Communication_proto.Communication_parameter.bind_string)
+  return bind_string_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+inline ::std::string* Communication_parameter::release_bind_string() {
+  // @@protoc_insertion_point(field_release:Communication_proto.Communication_parameter.bind_string)
+  clear_has_bind_string();
+  return bind_string_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+inline void Communication_parameter::set_allocated_bind_string(::std::string* bind_string) {
+  if (bind_string != NULL) {
+    set_has_bind_string();
+  } else {
+    clear_has_bind_string();
+  }
+  bind_string_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), bind_string);
+  // @@protoc_insertion_point(field_set_allocated:Communication_proto.Communication_parameter.bind_string)
+}
+
+// repeated string connect_string_vector = 2;
+inline int Communication_parameter::connect_string_vector_size() const {
+  return connect_string_vector_.size();
+}
+inline void Communication_parameter::clear_connect_string_vector() {
+  connect_string_vector_.Clear();
+}
+inline const ::std::string& Communication_parameter::connect_string_vector(int index) const {
+  // @@protoc_insertion_point(field_get:Communication_proto.Communication_parameter.connect_string_vector)
+  return connect_string_vector_.Get(index);
+}
+inline ::std::string* Communication_parameter::mutable_connect_string_vector(int index) {
+  // @@protoc_insertion_point(field_mutable:Communication_proto.Communication_parameter.connect_string_vector)
+  return connect_string_vector_.Mutable(index);
+}
+inline void Communication_parameter::set_connect_string_vector(int index, const ::std::string& value) {
+  // @@protoc_insertion_point(field_set:Communication_proto.Communication_parameter.connect_string_vector)
+  connect_string_vector_.Mutable(index)->assign(value);
+}
+#if LANG_CXX11
+inline void Communication_parameter::set_connect_string_vector(int index, ::std::string&& value) {
+  // @@protoc_insertion_point(field_set:Communication_proto.Communication_parameter.connect_string_vector)
+  connect_string_vector_.Mutable(index)->assign(std::move(value));
+}
+#endif
+inline void Communication_parameter::set_connect_string_vector(int index, const char* value) {
+  GOOGLE_DCHECK(value != NULL);
+  connect_string_vector_.Mutable(index)->assign(value);
+  // @@protoc_insertion_point(field_set_char:Communication_proto.Communication_parameter.connect_string_vector)
+}
+inline void Communication_parameter::set_connect_string_vector(int index, const char* value, size_t size) {
+  connect_string_vector_.Mutable(index)->assign(
+    reinterpret_cast<const char*>(value), size);
+  // @@protoc_insertion_point(field_set_pointer:Communication_proto.Communication_parameter.connect_string_vector)
+}
+inline ::std::string* Communication_parameter::add_connect_string_vector() {
+  // @@protoc_insertion_point(field_add_mutable:Communication_proto.Communication_parameter.connect_string_vector)
+  return connect_string_vector_.Add();
+}
+inline void Communication_parameter::add_connect_string_vector(const ::std::string& value) {
+  connect_string_vector_.Add()->assign(value);
+  // @@protoc_insertion_point(field_add:Communication_proto.Communication_parameter.connect_string_vector)
+}
+#if LANG_CXX11
+inline void Communication_parameter::add_connect_string_vector(::std::string&& value) {
+  connect_string_vector_.Add(std::move(value));
+  // @@protoc_insertion_point(field_add:Communication_proto.Communication_parameter.connect_string_vector)
+}
+#endif
+inline void Communication_parameter::add_connect_string_vector(const char* value) {
+  GOOGLE_DCHECK(value != NULL);
+  connect_string_vector_.Add()->assign(value);
+  // @@protoc_insertion_point(field_add_char:Communication_proto.Communication_parameter.connect_string_vector)
+}
+inline void Communication_parameter::add_connect_string_vector(const char* value, size_t size) {
+  connect_string_vector_.Add()->assign(reinterpret_cast<const char*>(value), size);
+  // @@protoc_insertion_point(field_add_pointer:Communication_proto.Communication_parameter.connect_string_vector)
+}
+inline const ::google::protobuf::RepeatedPtrField< ::std::string>&
+Communication_parameter::connect_string_vector() const {
+  // @@protoc_insertion_point(field_list:Communication_proto.Communication_parameter.connect_string_vector)
+  return connect_string_vector_;
+}
+inline ::google::protobuf::RepeatedPtrField< ::std::string>*
+Communication_parameter::mutable_connect_string_vector() {
+  // @@protoc_insertion_point(field_mutable_list:Communication_proto.Communication_parameter.connect_string_vector)
+  return &connect_string_vector_;
+}
+
+// -------------------------------------------------------------------
+
+// Communication_parameter_all
+
+// optional .Communication_proto.Communication_parameter communication_parameters = 1;
+inline bool Communication_parameter_all::has_communication_parameters() const {
+  return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void Communication_parameter_all::set_has_communication_parameters() {
+  _has_bits_[0] |= 0x00000001u;
+}
+inline void Communication_parameter_all::clear_has_communication_parameters() {
+  _has_bits_[0] &= ~0x00000001u;
+}
+inline void Communication_parameter_all::clear_communication_parameters() {
+  if (communication_parameters_ != NULL) communication_parameters_->Clear();
+  clear_has_communication_parameters();
+}
+inline const ::Communication_proto::Communication_parameter& Communication_parameter_all::communication_parameters() const {
+  const ::Communication_proto::Communication_parameter* p = communication_parameters_;
+  // @@protoc_insertion_point(field_get:Communication_proto.Communication_parameter_all.communication_parameters)
+  return p != NULL ? *p : *reinterpret_cast<const ::Communication_proto::Communication_parameter*>(
+      &::Communication_proto::_Communication_parameter_default_instance_);
+}
+inline ::Communication_proto::Communication_parameter* Communication_parameter_all::release_communication_parameters() {
+  // @@protoc_insertion_point(field_release:Communication_proto.Communication_parameter_all.communication_parameters)
+  clear_has_communication_parameters();
+  ::Communication_proto::Communication_parameter* temp = communication_parameters_;
+  communication_parameters_ = NULL;
+  return temp;
+}
+inline ::Communication_proto::Communication_parameter* Communication_parameter_all::mutable_communication_parameters() {
+  set_has_communication_parameters();
+  if (communication_parameters_ == NULL) {
+    communication_parameters_ = new ::Communication_proto::Communication_parameter;
+  }
+  // @@protoc_insertion_point(field_mutable:Communication_proto.Communication_parameter_all.communication_parameters)
+  return communication_parameters_;
+}
+inline void Communication_parameter_all::set_allocated_communication_parameters(::Communication_proto::Communication_parameter* communication_parameters) {
+  ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
+  if (message_arena == NULL) {
+    delete communication_parameters_;
+  }
+  if (communication_parameters) {
+    ::google::protobuf::Arena* submessage_arena = NULL;
+    if (message_arena != submessage_arena) {
+      communication_parameters = ::google::protobuf::internal::GetOwnedMessage(
+          message_arena, communication_parameters, submessage_arena);
+    }
+    set_has_communication_parameters();
+  } else {
+    clear_has_communication_parameters();
+  }
+  communication_parameters_ = communication_parameters;
+  // @@protoc_insertion_point(field_set_allocated:Communication_proto.Communication_parameter_all.communication_parameters)
+}
+
+#ifdef __GNUC__
+  #pragma GCC diagnostic pop
+#endif  // __GNUC__
+// -------------------------------------------------------------------
+
+
+// @@protoc_insertion_point(namespace_scope)
+
+}  // namespace Communication_proto
+
+// @@protoc_insertion_point(global_scope)
+
+#endif  // PROTOBUF_communication_2eproto__INCLUDED

+ 14 - 0
communication/communication.proto

@@ -0,0 +1,14 @@
+syntax = "proto2";
+package Communication_proto;
+
+message Communication_parameter
+{
+    optional string bind_string = 1;
+    repeated string connect_string_vector = 2;
+
+}
+
+message Communication_parameter_all
+{
+    optional Communication_parameter        communication_parameters=1;
+}

+ 93 - 0
communication/communication_message.cpp

@@ -0,0 +1,93 @@
+//
+// Created by huli on 2020/6/29.
+//
+
+#include "communication_message.h"
+
+
+Communication_message::Communication_message()
+{
+	m_message_type = eBase_msg;
+	m_receive_time = std::chrono::system_clock::now();
+	m_timeout_ms = std::chrono::milliseconds(5000);		//超时默认5秒
+	m_sender = eEmpty;
+	m_receiver = eEmpty;
+//	m_message_buf = "";
+}
+
+Communication_message::Communication_message(std::string message_buf)
+{
+	m_message_type = eBase_msg;
+	m_receive_time = std::chrono::system_clock::now();
+	m_timeout_ms = std::chrono::milliseconds(5000);		//超时默认5秒
+	m_sender = eEmpty;
+	m_receiver = eEmpty;
+	m_message_buf = message_buf;
+}
+
+Communication_message::Communication_message(char* p_buf, int size)
+{
+	m_message_type = eBase_msg;
+	m_receive_time = std::chrono::system_clock::now();
+	m_timeout_ms = std::chrono::milliseconds(5000);		//超时默认5秒
+	m_sender = eEmpty;
+	m_receiver = eEmpty;
+	m_message_buf = std::string(p_buf, size);
+}
+
+
+
+Communication_message::~Communication_message()
+{
+
+}
+
+bool Communication_message::is_over_time()
+{
+	if ( std::chrono::system_clock::now() - m_receive_time > m_timeout_ms)
+	{
+	    return true;
+	}
+	else
+	{
+		return false;
+	}
+}
+
+
+void Communication_message::reset(const message::Base_info& base_info, std::string receive_string)
+{
+	m_message_type = (Message_type)(base_info.msg_type());
+
+	m_receive_time = std::chrono::system_clock::now();
+	m_timeout_ms = std::chrono::milliseconds(base_info.timeout_ms());
+	m_sender = (Communicator)(base_info.sender());
+	m_receiver = (Communicator)(base_info.receiver());
+	m_message_buf = receive_string;
+}
+
+Communication_message::Message_type Communication_message::get_message_type()
+{
+	return m_message_type;
+}
+Communication_message::Communicator Communication_message::get_sender()
+{
+	return m_sender;
+}
+Communication_message::Communicator Communication_message::get_receiver()
+{
+	return m_receiver;
+}
+std::string& Communication_message::get_message_buf()
+{
+	return m_message_buf;
+}
+
+std::chrono::system_clock::time_point Communication_message::get_receive_time()
+{
+	return m_receive_time;
+}
+
+
+
+

+ 149 - 0
communication/communication_message.h

@@ -0,0 +1,149 @@
+//
+// Created by huli on 2020/6/29.
+//
+
+#ifndef NNXX_TESTS_COMMUNICATION_MESSAGE_H
+#define NNXX_TESTS_COMMUNICATION_MESSAGE_H
+
+#include "../error_code/error_code.h"
+
+#include <time.h>
+#include <sys/time.h>
+#include <chrono>
+//#include <iosfwd>
+
+#include <string>
+#include "../message/message_base.pb.h"
+
+
+class Communication_message
+{
+public:
+	//消息类型定义,每个在网络上传输的消息必须含有这个属性
+	enum Message_type
+	{
+		eBase_msg=0x00,
+		eCommand_msg=0x01,                      //指令消息
+
+
+		eLocate_status_msg=0x11,                //定位模块状态消息
+		eLocate_request_msg=0x12,               //定位请求消息
+		eLocate_response_msg=0x13,              //定位反馈消息
+
+		eLocate_sift_request_msg = 0x14,            //预测算法请求消息
+		eLocate_sift_response_msg = 0x15,           //预测算法反馈消息
+
+		eDispatch_status_msg=0x21,                //调度模块硬件状态消息
+		eDispatch_request_msg=0x22,              //请求调度消息
+		eDispatch_response_msg=0x23,             //调度结果反馈消息
+
+		eParkspace_allocation_status_msg=0x31,  //车位分配模块状态消息,包括车位信息
+		eParkspace_allocation_request_msg=0x32, //请求分配车位消息
+		eParkspace_allocation_response_msg=0x33,//分配车位结果反馈消息
+		eParkspace_search_request_msg = 0x34,		//查询车位请求消息
+		eParkspace_search_response_msg = 0x35,		//查询车位反馈消息
+		eParkspace_release_request_msg = 0x36,		//释放车位请求消息
+		eParkspace_release_response_msg = 0x37,		//释放车位反馈消息
+		eParkspace_force_update_request_msg = 0x38,	//手动修改车位消息
+		eParkspace_force_update_response_msg = 0x39,//手动修改车位反馈消息
+		eParkspace_confirm_alloc_request_msg = 0x3A,//确认分配车位请求消息
+		eParkspace_confirm_alloc_response_msg = 0x3B,//确认分配车位反馈消息
+		eParkspace_refresh_request_msg = 0x3C,     //车位分配模块车位数据消息
+		eParkspace_allocation_data_response_msg =0x3D,//车位数据反馈消息
+		eParkspace_manual_search_request_msg = 0x3E,	//手动查询车位请求消息
+		eParkspace_manual_search_response_msg = 0x3F,//手动查询车位反馈消息
+
+		eStore_command_request_msg=0x41,        //终端停车请求消息
+		eStore_command_response_msg=0x42,       //停车请求反馈消息
+		ePickup_command_request_msg=0x43,       //取车请求消息
+		ePickup_command_response_msg=0x44,       //取车请求反馈消息
+
+		eTerminal_status_msg = 0x50,	 //终端状态消息
+
+		eStoring_process_statu_msg=0x90,        //停车指令进度条消息
+		ePicking_process_statu_msg=0x91,        //取车指令进度消息
+
+
+		eCentral_controller_statu_msg=0xa0,     //中控系统状态消息
+
+
+		eEntrance_manual_operation_msg=0xb0,            //针对出入口状态操作的手动消息
+		eProcess_manual_operation_msg=0xb1,             //针对流程的手动消息
+
+		eNotify_request_msg=0xc0,               //取车等候区通知请求
+		eNotify_response_msg=0xc1,              //等候区反馈
+		eNotify_status_msg=0xc2,                //等候区通知节点状态
+
+		eUnNormalized_module_statu_msg = 0xd0, //非标节点状态
+
+		eDispatch_plan_request_msg          = 0xe0,     //调度总规划的请求(用于启动整个调度算法)(调度管理->调度算法)
+		eDispatch_plan_response_msg         = 0xe1,     //调度总规划的答复(调度算法->调度管理)
+		eDispatch_control_request_msg       = 0xe2,     //调度控制的任务请求(调度算法->调度管理)
+		eDispatch_control_response_msg      = 0xe3,     //调度控制的任务答复(调度管理->调度算法)
+		eDispatch_manager_status_msg        = 0xea,     //调度管理的设备状态消息(调度底下所有硬件设备状态的汇总)
+		eDispatch_manager_data_msg          = 0xeb,     //调度管理的设备详细的数据信息
+
+
+		eGround_detect_request_msg=0xf0,        //地面雷达测量请求消息
+		eGround_detect_response_msg=0xf1,       //地面雷达测量反馈消息
+		eGround_status_msg=0xf2,                //地面雷达状态消息
+
+	};
+
+//通讯单元
+	enum Communicator
+	{
+		eEmpty=0x0000,
+		eMain=0x0001,    //主流程
+
+		eTerminor=0x0100,
+		//车位表
+		eParkspace=0x0200,
+		//测量单元
+		eMeasurer=0x0300,
+		//测量单元
+		eMeasurer_sift_server=0x0301,
+
+		//调度机构
+		eDispatch_mamager=0x0400,
+		//调度机构
+		eDispatch_control=0x0401,
+		//取车等候区通知节点
+		eNotify=0x0501,
+
+		//地面测量单元
+		eGround_measurer=0x0f00,
+	};
+public:
+	Communication_message();
+	Communication_message(std::string message_buf);
+	Communication_message(char* p_buf, int size);
+	Communication_message(const Communication_message& other)= default;
+	Communication_message& operator =(const Communication_message& other)= default;
+	~Communication_message();
+public://API functions
+	bool is_over_time();
+public://get or set member variable
+	void reset(const message::Base_info& base_info, std::string receive_string);
+
+	Message_type get_message_type();
+	Communicator get_sender();
+	Communicator get_receiver();
+	std::string& get_message_buf();
+	std::chrono::system_clock::time_point get_receive_time();
+
+protected://member variable
+	Message_type								m_message_type;				//消息类型
+	std::chrono::system_clock::time_point		m_receive_time;				//接收消息的时间点
+	std::chrono::milliseconds					m_timeout_ms;				//超时时间, 整个软件都统一为毫秒
+	Communicator								m_sender;					//发送者
+	Communicator								m_receiver;					//接受者
+
+	std::string									m_message_buf;				//消息数据
+
+private:
+
+};
+
+
+#endif //NNXX_TESTS_COMMUNICATION_MESSAGE_H

+ 610 - 0
communication/communication_socket_base.cpp

@@ -0,0 +1,610 @@
+
+
+
+#include "communication_socket_base.h"
+#include "../tool/proto_tool.h"
+
+Communication_socket_base::Communication_socket_base()
+{
+	m_communication_statu = COMMUNICATION_UNKNOW;
+
+	mp_receive_data_thread = NULL;
+	mp_analysis_data_thread = NULL;
+	mp_send_data_thread = NULL;
+	mp_encapsulate_data_thread = NULL;
+
+	m_analysis_cycle_time = 1000;//默认1000ms,就自动解析(接受list)
+	m_encapsulate_cycle_time = 1000;//默认1000ms,就自动发送一次状态信息
+}
+
+Communication_socket_base::~Communication_socket_base()
+{
+	communication_uninit();
+}
+
+//初始化 通信 模块。如下三选一
+Error_manager Communication_socket_base::communication_init()
+{
+	LOG(INFO) << " ---Communication_socket_base::communication_init() run--- "<< this;
+
+	return  communication_init_from_protobuf(COMMUNICATION_PARAMETER_PATH);
+}
+
+//初始化 通信 模块。从文件读取
+Error_manager Communication_socket_base::communication_init_from_protobuf(std::string prototxt_path)
+{
+	Communication_proto::Communication_parameter_all t_communication_parameter_all;
+	if(!  proto_tool::read_proto_param(prototxt_path,t_communication_parameter_all) )
+	{
+		return Error_manager(COMMUNICATION_READ_PROTOBUF_ERROR,MINOR_ERROR,
+		"Communication_socket_base read_proto_param  failed");
+	}
+	return communication_init_from_protobuf(t_communication_parameter_all);
+}
+
+//初始化 通信 模块。从protobuf读取
+Error_manager Communication_socket_base::communication_init_from_protobuf(Communication_proto::Communication_parameter_all& communication_parameter_all)
+{
+	LOG(INFO) << " ---Communication_socket_base::communication_init_from_protobuf() run--- "<< this;
+	Error_manager t_error;
+
+	if ( communication_parameter_all.communication_parameters().has_bind_string() )
+	{
+		t_error = communication_bind(communication_parameter_all.communication_parameters().bind_string());
+		if ( t_error != Error_code::SUCCESS )
+		{
+			return t_error;
+		}
+	}
+//	std::cout << "communication_parameter_all.communication_parameters().connect_string_vector_size() " <<
+//		communication_parameter_all.communication_parameters().connect_string_vector_size()<< std::endl;
+	for(int i=0;i<communication_parameter_all.communication_parameters().connect_string_vector_size();++i)
+	{
+		t_error = communication_connect( communication_parameter_all.communication_parameters().connect_string_vector(i) );
+		if ( t_error != Error_code::SUCCESS )
+		{
+			return t_error;
+		}
+	}
+	//启动通信, run thread
+	communication_run();
+
+	return Error_code::SUCCESS;
+}
+
+//初始化
+Error_manager Communication_socket_base::communication_init(std::string bind_string, std::vector<std::string>& connect_string_vector)
+{
+	LOG(INFO) << " ---Communication_socket_base::communication_init() run--- "<< this;
+	Error_manager t_error;
+
+	t_error = communication_bind(bind_string);
+	if ( t_error != Error_code::SUCCESS )
+	{
+		return t_error;
+	}
+
+	t_error = communication_connect(connect_string_vector);
+	if ( t_error != Error_code::SUCCESS )
+	{
+		return t_error;
+	}
+
+	//启动通信, run thread
+	communication_run();
+
+	return Error_code::SUCCESS;
+}
+//bind
+Error_manager Communication_socket_base::communication_bind(std::string bind_string)
+{
+	Error_manager t_error;
+	int t_socket_result;
+
+	//m_socket 自己作为一个服务器, 绑定一个端口
+	t_socket_result = m_socket.bind(bind_string);
+	if ( t_socket_result <0 )
+	{
+		return Error_manager(Error_code::COMMUNICATION_BIND_ERROR, Error_level::MINOR_ERROR,
+							 " m_socket.bind error ");
+	}
+	LOG(INFO) << " ---Communication_socket_base::communication_bind() bind::  "<< bind_string << "  " << this;
+
+	return Error_code::SUCCESS;
+}
+//connect
+Error_manager Communication_socket_base::communication_connect(std::vector<std::string>& connect_string_vector)
+{
+	Error_manager t_error;
+	for (auto iter = connect_string_vector.begin(); iter != connect_string_vector.end(); ++iter)
+	{
+		t_error = communication_connect(*iter);
+		if ( t_error != Error_code::SUCCESS )
+		{
+			return t_error;
+		}
+	}
+	return Error_code::SUCCESS;
+}
+//connect
+Error_manager Communication_socket_base::communication_connect(std::string connect_string)
+{
+	Error_manager t_error;
+	int t_socket_result;
+	//m_socket 和远端通信, 连接远端服务器的端口
+	t_socket_result = m_socket.connect(connect_string);
+	if ( t_socket_result <0 )
+	{
+		return Error_manager(Error_code::COMMUNICATION_CONNECT_ERROR, Error_level::MINOR_ERROR,
+							 " m_socket.connect error ");
+	}
+	LOG(INFO) << " ---Communication_socket_base::communication_connect() connect::  "<< connect_string << "  " << this;
+
+	return Error_code::SUCCESS;
+}
+//启动通信, run thread
+Error_manager Communication_socket_base::communication_run()
+{
+	m_communication_statu = COMMUNICATION_READY;
+	//启动4个线程。
+	//接受线程默认循环, 内部的nn_recv进行等待, 超时1ms
+	m_receive_condition.reset(false, false, false);
+	mp_receive_data_thread = new std::thread(&Communication_socket_base::receive_data_thread, this);
+	//解析线程默认等待, 需要接受线程去唤醒, 超时1ms, 超时后主动遍历m_receive_data_list
+	m_analysis_data_condition.reset(false, false, false);
+	mp_analysis_data_thread = new std::thread(&Communication_socket_base::analysis_data_thread, this);
+	//发送线程默认循环, 内部的wait_and_pop进行等待,
+	m_send_data_condition.reset(false, true, false);
+	mp_send_data_thread = new std::thread(&Communication_socket_base::send_data_thread, this);
+	//封装线程默认等待, ...., 超时1ms, 超时后主动 封装心跳和状态信息,
+	m_encapsulate_data_condition.reset(false, false, false);
+	mp_encapsulate_data_thread = new std::thread(&Communication_socket_base::encapsulate_data_thread, this);
+
+	return Error_code::SUCCESS;
+}
+
+
+//反初始化 通信 模块。
+Error_manager Communication_socket_base::communication_uninit()
+{
+	//终止list,防止 wait_and_pop 阻塞线程。
+	m_receive_data_list.termination_list();
+	m_send_data_list.termination_list();
+
+	//杀死4个线程,强制退出
+	if (mp_receive_data_thread)
+	{
+		m_receive_condition.kill_all();
+	}
+	if (mp_analysis_data_thread)
+	{
+		m_analysis_data_condition.kill_all();
+	}
+	if (mp_send_data_thread)
+	{
+		m_send_data_condition.kill_all();
+	}
+	if (mp_encapsulate_data_thread)
+	{
+		m_encapsulate_data_condition.kill_all();
+	}
+	//回收4个线程的资源
+	if (mp_receive_data_thread)
+	{
+		mp_receive_data_thread->join();
+		delete mp_receive_data_thread;
+		mp_receive_data_thread = NULL;
+	}
+	if (mp_analysis_data_thread)
+	{
+		mp_analysis_data_thread->join();
+		delete mp_analysis_data_thread;
+		mp_analysis_data_thread = 0;
+	}
+	if (mp_send_data_thread)
+	{
+		mp_send_data_thread->join();
+		delete mp_send_data_thread;
+		mp_send_data_thread = NULL;
+	}
+	if (mp_encapsulate_data_thread)
+	{
+		mp_encapsulate_data_thread->join();
+		delete mp_encapsulate_data_thread;
+		mp_encapsulate_data_thread = NULL;
+	}
+
+	//清空list
+	m_receive_data_list.clear_and_delete();
+	m_send_data_list.clear_and_delete();
+
+	m_communication_statu = COMMUNICATION_UNKNOW;
+	m_socket.close();
+
+	return Error_code::SUCCESS;
+}
+
+
+void Communication_socket_base::set_analysis_cycle_time(unsigned int analysis_cycle_time)
+{
+	m_analysis_cycle_time = analysis_cycle_time;
+}
+void Communication_socket_base::set_encapsulate_cycle_time(unsigned int encapsulate_cycle_time)
+{
+	m_encapsulate_cycle_time = encapsulate_cycle_time;
+}
+
+
+
+
+//mp_receive_data_thread 接受线程执行函数,
+//receive_data_thread 内部线程负责接受消息
+void Communication_socket_base::receive_data_thread()
+{
+	LOG(INFO) << " Communication_socket_base::receive_data_thread start "<< this;
+
+	//通信接受线程, 负责接受socket消息, 并存入 m_receive_data_list
+	while (m_receive_condition.is_alive())
+	{
+		m_receive_condition.wait_for_ex(std::chrono::microseconds(1));
+		if ( m_receive_condition.is_alive() )
+		{
+			std::this_thread::yield();
+
+			std::string t_receive_string;
+			{//这个大括号表示只对 recv 和 send 加锁, 不要因为后面的复杂逻辑影响通信效率
+				std::unique_lock<std::mutex> lk(m_mutex);
+				//flags为1, 非阻塞接受消息, 如果接收到消息, 那么接受数据长度大于0
+				t_receive_string = m_socket.recv<std::string>(1);
+			}
+			if ( t_receive_string.size()>0 )
+			{
+//				std::cout << " huli test :::: " << " t_receive_string = " << t_receive_string << std::endl;
+
+				//如果这里接受到了消息, 在这提前解析消息最前面的Base_msg (消息公共内容), 用于后续的check
+				message::Base_msg t_base_msg;
+				if( t_base_msg.ParseFromString(t_receive_string) )
+				{
+					//第一次解析之后转化为, Communication_message, 自定义的通信消息格式
+					Communication_message  * tp_communication_message = new Communication_message;
+					tp_communication_message->reset(t_base_msg.base_info(), t_receive_string);
+					//检查消息是否有效, 主要检查消息类型和接受者, 判断这条消息是不是给我的.
+					if ( check_msg(tp_communication_message) == SUCCESS )
+					{
+						bool is_push = m_receive_data_list.push(tp_communication_message);
+						//push成功之后, tp_communication_message内存的管理权限交给链表, 如果失败就要回收内存
+						if ( is_push )
+						{
+							//唤醒解析线程一次,
+							m_analysis_data_condition.notify_all(false, true);
+						}
+						else
+						{
+//						push失败, 就要回收内存
+							delete(tp_communication_message);
+							tp_communication_message = NULL;
+//					return Error_manager(Error_code::CONTAINER_IS_TERMINATE, Error_level::MINOR_ERROR,
+//										 " m_receive_data_list.push error ");
+						}
+					}
+					else
+					{
+						delete(tp_communication_message);
+						tp_communication_message = NULL;
+					}
+
+
+				}
+				//解析失败, 就当做什么也没发生, 认为接收消息无效,
+			}
+			//没有接受到消息, 返回空字符串
+		}
+	}
+
+	LOG(INFO) << " Communication_socket_base::receive_data_thread end "<< this;
+	return;
+}
+
+//检查消息是否有效, 主要检查消息类型和接受者, 判断这条消息是不是给我的.
+Error_manager Communication_socket_base::check_msg(Communication_message*  p_msg)
+{
+	//通过 p_msg->get_message_type() 和 p_msg->get_receiver() 判断这条消息是不是给我的.
+	//子类重载时, 增加自己模块的判断逻辑, 以后再写.
+	if ( p_msg->get_message_type() == Communication_message::Message_type::eBase_msg
+		 && p_msg->get_receiver() == Communication_message::Communicator::eMain )
+	{
+		return Error_code::SUCCESS;
+	}
+	else
+	{
+		//无效的消息,
+		return Error_manager(Error_code::INVALID_MESSAGE, Error_level::NEGLIGIBLE_ERROR,
+							 " INVALID_MESSAGE error ");	}
+}
+
+//mp_analysis_data_thread 解析线程执行函数,
+//analysis_data_thread 内部线程负责解析消息
+void Communication_socket_base::analysis_data_thread()
+{
+	LOG(INFO) << " Communication_socket_base::analysis_data_thread start "<< this;
+
+	//通信解析线程, 负责巡检m_receive_data_list, 并解析和处理消息
+	while (m_analysis_data_condition.is_alive())
+	{
+		bool t_pass_flag = m_analysis_data_condition.wait_for_millisecond(m_analysis_cycle_time);
+		if ( m_analysis_data_condition.is_alive() )
+		{
+			std::this_thread::yield();
+			//如果解析线程被主动唤醒, 那么就表示 收到新的消息, 那就遍历整个链表
+			if ( t_pass_flag )
+			{
+				analysis_receive_list();
+			}
+				//如果解析线程超时通过, 那么就定时处理链表残留的消息,
+			else
+			{
+				analysis_receive_list();
+			}
+		}
+	}
+
+	LOG(INFO) << " Communication_socket_base::analysis_data_thread end "<< this;
+	return;
+}
+
+//循环接受链表, 解析消息,
+Error_manager Communication_socket_base::analysis_receive_list()
+{
+	Error_manager t_error;
+	if ( m_receive_data_list.m_termination_flag )
+	{
+		return Error_manager(Error_code::CONTAINER_IS_TERMINATE, Error_level::MINOR_ERROR,
+							 " Communication_socket_base::analysis_receive_list error ");
+	}
+	else
+	{
+		std::unique_lock<std::mutex> lk(m_receive_data_list.m_mutex);
+		for (auto iter = m_receive_data_list.m_data_list.begin(); iter != m_receive_data_list.m_data_list.end(); )
+		{
+			Communication_message* tp_msg = **iter;
+			if ( tp_msg == NULL )
+			{
+				iter = m_receive_data_list.m_data_list.erase(iter);
+				//注:erase 删除当前 iter 之后返回下一个节点,当前的 iter 无效化,
+			}
+			else
+			{
+				//检查消息是否可以被处理
+				t_error = check_executer(tp_msg);
+				if ( t_error == SUCCESS)
+				{
+					//处理消息
+					t_error = execute_msg(tp_msg);
+//				if ( t_error )
+//				{
+//					//执行结果不管
+//				}
+//				else
+//				{
+//					//执行结果不管
+//				}
+					delete(tp_msg);
+					tp_msg = NULL;
+					iter = m_receive_data_list.m_data_list.erase(iter);
+					//注:erase 删除当前 iter 之后返回下一个节点,当前的 iter 无效化,
+				}
+				else if( t_error == COMMUNICATION_EXCUTER_IS_BUSY)
+				{
+					//处理器正忙, 那就不做处理, 直接处理下一个
+					//注:这条消息就被保留了下来, wait_for_millisecond 超时通过之后, 会循环检查残留的消息.
+					iter++;
+				}
+				else //if( t_error == COMMUNICATION_ANALYSIS_TIME_OUT )
+				{
+					//超时了就直接删除
+					delete(tp_msg);
+					tp_msg = NULL;
+					iter = m_receive_data_list.m_data_list.erase(iter);
+					//注:erase 删除当前 iter 之后返回下一个节点,当前的 iter 无效化,
+
+					//注:消息删除之后, 不需要发送答复消息, 发送方也会有超时处理的,  只有 execute_msg 里面可以答复消息
+				}
+			}
+		}
+	}
+	return Error_code::SUCCESS;
+}
+
+
+
+//检查执行者的状态, 判断能否处理这条消息, 需要子类重载
+Error_manager Communication_socket_base::check_executer(Communication_message*  p_msg)
+{
+	//检查对应模块的状态, 判断是否可以处理这条消息
+	//同时也要判断是否超时, 超时返回 COMMUNICATION_ANALYSIS_TIME_OUT
+	//如果处理器正在忙别的, 那么返回 COMMUNICATION_EXCUTER_IS_BUSY
+
+	if ( p_msg->is_over_time() )
+	{
+		std::cout << "Communication_socket_base::check_msg  p_buf =  " << p_msg->get_message_buf() << std::endl;
+		std::cout << "Communication_socket_base::check_msg   size =  " << p_msg->get_message_buf().size() << std::endl;
+		std::cout << "COMMUNICATION_ANALYSIS_TIME_OUT , " << std::endl;
+		return Error_code::COMMUNICATION_ANALYSIS_TIME_OUT;
+	}
+	else
+	{
+		bool executer_is_ready = false;
+		//通过 p_msg->get_message_type() 和 p_msg->get_receiver() 找到处理模块的实例对象, 查询执行人是否可以处理这条消息
+		//这里子类重载时, 增加判断逻辑, 以后再写.
+		executer_is_ready = true;
+
+		std::cout << "Communication_socket_base::check_msg  p_buf =  " << p_msg->get_message_buf() << std::endl;
+		std::cout << "Communication_socket_base::check_msg   size =  " << p_msg->get_message_buf().size() << std::endl;
+
+		if ( executer_is_ready )
+		{
+			std::cout << "executer_is_ready , " << std::endl;
+			return Error_code::SUCCESS;
+		}
+		else
+		{
+			std::cout << "executer_is_busy , " << std::endl;
+			return Error_code::COMMUNICATION_EXCUTER_IS_BUSY;
+		}
+	}
+
+	return Error_code::SUCCESS;
+}
+
+//处理消息
+Error_manager Communication_socket_base::execute_msg(Communication_message*  p_msg)
+{
+	//先将 p_msg 转化为 对应的格式, 使用对应模块的protobuf来二次解析
+	// 不能一直使用 Communication_message*  p_msg, 这个是要销毁的
+	//然后处理这个消息, 就是调用对应模块的 execute 接口函数
+	//执行结果不管, 如果需要答复, 那么对应模块 在自己内部 封装一条消息发送即可.
+	//子类重载, 需要完全重写, 以后再写.
+
+	//注注注注注意了, 本模块只是用来做通信,
+	//在做处理消息的时候, 可能会调用执行者的接口函数,
+	//这里不应该长时间阻塞或者处理复杂的逻辑,
+	//请执行者另开线程来处理任务.
+
+	std::cout << "Communication_socket_base::excute_msg  p_buf =  " << p_msg->get_message_buf() << std::endl;
+	std::cout << "Communication_socket_base::excute_msg   size =  " << p_msg->get_message_buf().size() << std::endl;
+	return Error_code::SUCCESS;
+}
+
+//mp_send_data_thread 发送线程执行函数,
+//send_data_thread 内部线程负责发送消息
+void Communication_socket_base::send_data_thread()
+{
+	LOG(INFO) << " Communication_socket_base::send_data_thread start "<< this;
+
+	//通信发送线程, 负责巡检m_send_data_list, 并发送消息
+	while (m_send_data_condition.is_alive())
+	{
+		m_send_data_condition.wait();
+		if ( m_send_data_condition.is_alive() )
+		{
+			std::this_thread::yield();
+
+			Communication_message* tp_msg = NULL;
+			//这里 wait_and_pop 会使用链表内部的 m_data_cond 条件变量来控制等待,
+			//封装线程使用push的时候, 会唤醒线程并通过等待, 此时 m_send_data_condition 是一直通过的.
+			//如果需要退出, 那么就要 m_send_data_list.termination_list();	和 m_send_data_condition.kill_all();
+			bool is_pop = m_send_data_list.wait_and_pop(tp_msg);
+			if ( is_pop )
+			{
+				if ( tp_msg != NULL )
+				{
+					{//这个大括号表示只对 recv 和 send 加锁, 不要因为后面的复杂逻辑影响通信效率
+						std::unique_lock<std::mutex> lk(m_mutex);
+						m_socket.send(tp_msg->get_message_buf());
+					}
+					delete(tp_msg);
+					tp_msg = NULL;
+				}
+			}
+			else
+			{
+				//没有取出, 那么应该就是 m_termination_flag 结束了
+//				return Error_manager(Error_code::CONTAINER_IS_TERMINATE, Error_level::MINOR_ERROR,
+//									 " Communication_socket_base::send_data_thread() error ");
+			}
+		}
+	}
+
+	LOG(INFO) << " Communication_socket_base::send_data_thread end "<< this;
+	return;
+}
+
+//mp_encapsulate_data_thread 封装线程执行函数,
+//encapsulate_data_thread 内部线程负责封装消息
+void Communication_socket_base::encapsulate_data_thread()
+{
+	LOG(INFO) << " Communication_socket_base::encapsulate_data_thread start "<< this;
+
+	//通信封装线程, 负责定时封装消息, 并存入 m_send_data_list
+	while (m_encapsulate_data_condition.is_alive())
+	{
+		bool t_pass_flag = m_encapsulate_data_condition.wait_for_millisecond(m_encapsulate_cycle_time);
+
+		if ( m_encapsulate_data_condition.is_alive() )
+		{
+			std::this_thread::yield();
+			//如果封装线程被主动唤醒, 那么就表示 需要主动发送消息,
+			if ( t_pass_flag )
+			{
+				//主动发送消息,
+			}
+				//如果封装线程超时通过, 那么就定时封装心跳和状态信息
+			else
+			{
+				encapsulate_send_data();
+			}
+		}
+	}
+
+	LOG(INFO) << " Communication_socket_base::encapsulate_data_thread end "<< this;
+	return;
+}
+
+
+//定时封装发送消息, 一般为心跳和状态信息, 需要子类重载
+Error_manager Communication_socket_base::encapsulate_send_data()
+{
+//	char buf[256] = {0};
+//	static unsigned int t_heartbeat = 0;
+//	sprintf(buf, "Communication_socket_base, heartbeat = %d\0\0\0, test\0", t_heartbeat);
+//	t_heartbeat++;
+    return SUCCESS;
+	message::Base_msg t_base_msg;
+	t_base_msg.mutable_base_info()->set_msg_type(message::Message_type::eBase_msg);
+	t_base_msg.mutable_base_info()->set_timeout_ms(5000);
+	t_base_msg.mutable_base_info()->set_sender(message::Communicator::eMain);
+	t_base_msg.mutable_base_info()->set_receiver(message::Communicator::eMain);
+
+	Communication_message* tp_msg = new Communication_message(t_base_msg.SerializeAsString());
+	bool is_push = m_send_data_list.push(tp_msg);
+	if ( is_push == false )
+	{
+		delete(tp_msg);
+		tp_msg = NULL;
+		return Error_manager(Error_code::CONTAINER_IS_TERMINATE, Error_level::MINOR_ERROR,
+							 " Communication_socket_base::encapsulate_msg error ");
+	}
+	return Error_code::SUCCESS;
+}
+
+
+
+//封装消息, 需要子类重载
+Error_manager Communication_socket_base::encapsulate_msg(std::string message)
+{
+	Communication_message* tp_msg = new Communication_message(message);
+	bool is_push = m_send_data_list.push(tp_msg);
+	if ( is_push == false )
+	{
+		delete(tp_msg);
+		tp_msg = NULL;
+		return Error_manager(Error_code::CONTAINER_IS_TERMINATE, Error_level::MINOR_ERROR,
+							 " Communication_socket_base::encapsulate_msg error ");
+	}
+	return Error_code::SUCCESS;
+}
+
+//封装消息, 需要子类重载
+Error_manager Communication_socket_base::encapsulate_msg(Communication_message* p_msg)
+{
+	Communication_message* tp_msg = new Communication_message(*p_msg);
+	bool is_push = m_send_data_list.push(tp_msg);
+	if ( is_push == false )
+	{
+		delete(tp_msg);
+		tp_msg = NULL;
+		return Error_manager(Error_code::CONTAINER_IS_TERMINATE, Error_level::MINOR_ERROR,
+							 " Communication_socket_base::encapsulate_msg error ");
+	}
+	return Error_code::SUCCESS;
+}

+ 169 - 0
communication/communication_socket_base.h

@@ -0,0 +1,169 @@
+
+
+/*
+ * communication_socket_base 通信模块的基类,
+ * 用户从这个基类继承, 初始化之后, 便可以自动进行通信
+ * 重载解析消息和封装消息,
+ *
+ *Thread_safe_list<Binary_buf*> 使用 Binary_buf , 而不是string
+ * 主要是为了支持直接发送数字0
+ * 
+ * 
+ * */
+
+#ifndef __COMMUNICATION_SOCKET_BASE__HH__
+#define __COMMUNICATION_SOCKET_BASE__HH__
+
+#include <mutex>
+#include <thread>
+#include <nnxx/message>
+#include <nnxx/socket.h>
+#include <nnxx/bus.h>
+
+#include <glog/logging.h>
+#include "../error_code/error_code.h"
+#include "../tool/binary_buf.h"
+#include "../tool/thread_safe_list.h"
+#include "../tool/thread_condition.h"
+
+#include "../communication/communication.pb.h"
+#include "../communication/communication_message.h"
+
+#include "../message/message_base.pb.h"
+//#include "../message/measure_message.pb.h"
+
+
+
+#define COMMUNICATION_PARAMETER_PATH "../setting/communication.prototxt"
+#define COMMUNICATION_PARAMETER_PATH_A "../setting/communication_a.prototxt"
+#define COMMUNICATION_PARAMETER_PATH_B "../setting/communication_b.prototxt"
+#define COMMUNICATION_PARAMETER_PATH_C "../setting/communication_c.prototxt"
+
+class Communication_socket_base
+{
+	//通信状态
+	enum Communication_statu
+	{
+		COMMUNICATION_UNKNOW		=0,	        //通信状态 未知
+		COMMUNICATION_READY			=1,			//通信状态 正常
+
+		COMMUNICATION_FAULT			=3,         //通信状态 错误
+	};
+
+public:
+	Communication_socket_base();
+	Communication_socket_base(const Communication_socket_base& other)= delete;
+	Communication_socket_base& operator =(const Communication_socket_base& other)= delete;
+	~Communication_socket_base();
+public://API functions
+	//初始化 通信 模块。如下三选一
+	virtual Error_manager communication_init();
+	//初始化 通信 模块。从文件读取
+	Error_manager communication_init_from_protobuf(std::string prototxt_path);
+	//初始化 通信 模块。从protobuf读取
+	Error_manager communication_init_from_protobuf(Communication_proto::Communication_parameter_all& communication_parameter_all);
+
+	//初始化
+	virtual Error_manager communication_init(std::string bind_string, std::vector<std::string>& connect_string_vector);
+	//bind
+	virtual Error_manager communication_bind(std::string bind_string);
+	//connect
+	virtual Error_manager communication_connect(std::vector<std::string>& connect_string_vector);
+	//connect
+	virtual Error_manager communication_connect(std::string connect_string);
+	//启动通信, run thread
+	virtual Error_manager communication_run();
+
+	//反初始化 通信 模块。
+	virtual Error_manager communication_uninit();
+	
+	
+public://get or set member variable
+	void set_analysis_cycle_time(unsigned int analysis_cycle_time);
+	void set_encapsulate_cycle_time(unsigned int encapsulate_cycle_time);
+
+protected:
+	//mp_receive_data_thread 接受线程执行函数,
+	//receive_data_thread 内部线程负责接受消息
+	void receive_data_thread();
+
+	//检查消息是否有效, 主要检查消息类型和接受者, 判断这条消息是不是给我的.
+	virtual Error_manager check_msg(Communication_message* p_msg);
+
+	//mp_analysis_data_thread 解析线程执行函数,
+	//analysis_data_thread 内部线程负责解析消息
+	void analysis_data_thread();
+
+	//遍历接受链表, 解析消息,
+	Error_manager analysis_receive_list();
+
+	//检查执行者的状态, 判断能否处理这条消息, 需要子类重载
+	virtual Error_manager check_executer(Communication_message* p_msg);
+
+	//处理消息, 需要子类重载
+	virtual Error_manager execute_msg(Communication_message* p_msg);
+
+	//mp_send_data_thread 发送线程执行函数,
+	//send_data_thread 内部线程负责发送消息
+	void send_data_thread();
+
+	//mp_encapsulate_data_thread 封装线程执行函数,
+	//encapsulate_data_thread 内部线程负责封装消息
+	void encapsulate_data_thread();
+
+	//定时封装发送消息, 一般为心跳和状态信息, 需要子类重载
+	virtual Error_manager encapsulate_send_data();
+
+public:
+	//封装消息, 需要子类重载
+	virtual Error_manager encapsulate_msg(std::string message);
+	//封装消息, 需要子类重载
+	virtual Error_manager encapsulate_msg(Communication_message* p_msg);
+
+protected://member variable
+
+	//通用的网络编程接口, 默认使用总线模式, (网状结构)
+	nnxx::socket 						m_socket { nnxx::SP, nnxx::BUS };
+	std::mutex 							m_mutex;				//m_socket的锁
+
+	//通信状态
+	Communication_statu 				m_communication_statu;			//通信状态
+
+	//接受模块,
+	Thread_safe_list<Communication_message*>		m_receive_data_list; 			//接受的list容器
+	std::thread*						mp_receive_data_thread;    		//接受的线程指针
+	Thread_condition					m_receive_condition;			//接受的条件变量
+	std::thread*						mp_analysis_data_thread;    	//解析的线程指针
+	Thread_condition					m_analysis_data_condition;		//解析的条件变量
+	unsigned int 						m_analysis_cycle_time;			//自动解析的时间周期
+
+	//发送模块,
+	Thread_safe_list<Communication_message*>		m_send_data_list;				//发送的list容器
+	std::thread*						mp_send_data_thread;    		//发送的线程指针
+	Thread_condition					m_send_data_condition;			//发送的条件变量
+	std::thread*						mp_encapsulate_data_thread;    	//封装的线程指针
+	Thread_condition					m_encapsulate_data_condition;	//封装的条件变量
+	unsigned int 						m_encapsulate_cycle_time;		//自动封装的时间周期
+
+
+
+private:
+
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#endif //__COMMUNICATION_SOCKET_BASE__HH__

+ 387 - 0
error_code/error_code.cpp

@@ -0,0 +1,387 @@
+
+//Error_code是错误码的底层通用模块,
+//功能:用作故障分析和处理。
+
+//用法:所有的功能接口函数return错误管理类,
+//然后上层判断分析错误码,并进行故障处理。
+
+
+
+#include "error_code.h"
+
+/////////////////////////////////////////////
+//构造函数
+Error_manager::Error_manager()
+{
+    m_error_code = SUCCESS;
+    m_error_level = NORMAL;
+}
+//拷贝构造
+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;
+	this->m_error_description=error_manager.m_error_description;
+    return ;
+}
+//赋值构造
+Error_manager::Error_manager(Error_code error_code, Error_level error_level,
+    const char* p_error_description)
+{
+    m_error_code = error_code;
+    m_error_level = error_level;
+    if(p_error_description!= nullptr)
+	{
+		m_error_description=std::string(p_error_description);
+	}
+	return ;
+}
+//赋值构造
+Error_manager::Error_manager(Error_code error_code, Error_level error_level , std::string & error_aggregate_string)
+{
+    m_error_code = error_code;
+    m_error_level = error_level;
+    m_error_description=error_aggregate_string;
+	return ;
+}
+//析构函数
+Error_manager::~Error_manager()
+{
+}
+
+//初始化
+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)
+{
+    m_error_code = error_code;
+    m_error_level = error_level;
+	if(p_error_description!= nullptr)
+	{
+		m_error_description=std::string(p_error_description);
+	}
+	return ;
+}
+//初始化
+void Error_manager::error_manager_init(Error_code error_code, Error_level error_level , std::string & error_aggregate_string)
+{
+    m_error_code = error_code;
+    m_error_level = error_level;
+    m_error_description=error_aggregate_string;
+    return ;
+}
+//重置
+void Error_manager::error_manager_reset(Error_code error_code, Error_level error_level, const char* p_error_description)
+{
+    m_error_code = error_code;
+    m_error_level = error_level;
+	if(p_error_description!= nullptr)
+	{
+		m_error_description=std::string(p_error_description);
+	}
+	return ;
+}
+//重置
+void Error_manager::error_manager_reset(Error_code error_code, Error_level error_level , std::string & error_aggregate_string)
+{
+    m_error_code = error_code;
+    m_error_level = error_level;
+    m_error_description=error_aggregate_string;
+	return;
+}
+//重置
+void Error_manager::error_manager_reset(const Error_manager & error_manager)
+{
+    this->m_error_code = error_manager.m_error_code;
+    this->m_error_level = error_manager.m_error_level;
+	this->m_error_description=error_manager.m_error_description;
+    return ;
+}
+//清除所有内容
+void Error_manager::error_manager_clear_all()
+{
+    m_error_code = SUCCESS;
+    m_error_level = NORMAL;
+	m_error_description.clear();
+	return;
+}
+
+//重载=
+Error_manager& Error_manager::operator=(const Error_manager & error_manager)
+{
+    error_manager_reset(error_manager);
+	return *this;
+}
+//重载=,支持Error_manager和Error_code的直接转化,会清空错误等级和描述
+Error_manager& Error_manager::operator=(Error_code error_code)
+{
+    error_manager_clear_all();
+    set_error_code(error_code);
+	return *this;
+}
+//重载==
+bool Error_manager::operator==(const Error_manager & error_manager)
+{
+	return 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)
+{
+	return (! 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;
+}
+//获取错误描述的指针,(浅拷贝)
+std::string Error_manager::get_error_description()
+{
+    return m_error_description;
+}
+
+//复制错误描述,(深拷贝)
+//output:p_error_description     错误描述的字符串指针,不可以为NULL,必须要有实际的内存
+//output:description_length      错误描述的字符串长度,不可以为0,长度最好足够大,一般256即可。
+void Error_manager::copy_error_description(const char* p_error_description)
+{
+    if(p_error_description != NULL)
+    {
+        m_error_description=std::string(p_error_description);
+    }
+	return;
+}
+//复制错误描述,(深拷贝)
+//output:error_description_string     错误描述的string
+void Error_manager::copy_error_description(std::string & error_description_string)
+{
+    m_error_description=error_description_string;
+	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)
+{
+	if(p_error_description != NULL)
+	{
+		m_error_description=std::string(p_error_description);
+	}
+	return;
+}
+//设置错误描述
+void Error_manager::set_error_description(std::string & error_description_string)
+{
+	m_error_description = error_description_string;
+	return ;
+}
+
+//尾部追加错误描述
+void Error_manager::add_error_description(const char* p_error_description)
+{
+    if(p_error_description !=NULL)
+    {
+        m_error_description+=std::string(p_error_description);
+    }
+}
+//尾部追加错误描述
+void Error_manager::add_error_description(std::string & error_description_string)
+{
+    m_error_description+=error_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;
+        std::string pt_string_inside ;
+        if(this->m_error_level < error_manager.m_error_level)
+        {
+            translate_error_to_string(pt_string_inside);
+            error_manager_reset(error_manager);
+            add_error_description(pt_string_inside);
+        }
+        else
+        {
+			((Error_manager&)error_manager).translate_error_to_string(pt_string_inside);
+            add_error_description(pt_string_inside);
+        }
+    }
+	return;
+}
+//比较并覆盖错误,讲低级错误转为字符串存放于描述中,
+//如果错误相同,则保留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)
+	{
+		return;
+	}
+	else
+	{
+		Error_manager t_error_manager_new;
+		std::string pt_string_inside;
+		if(this->m_error_level < p_error_manager->m_error_level)
+		{
+			translate_error_to_string(pt_string_inside);
+			error_manager_reset(*p_error_manager);
+			add_error_description(pt_string_inside);
+		}
+		else
+		{
+			p_error_manager->translate_error_to_string(pt_string_inside);
+			add_error_description(pt_string_inside);
+		}
+	}
+}
+
+
+//output:error_description_string     错误汇总的string
+void Error_manager::translate_error_to_string(std::string & error_aggregate_string)
+{
+    char t_string_array[255] = {0};
+    sprintf(t_string_array, "error_code:0x%08x, error_level:%02d, error_description:",
+            m_error_code , m_error_level);
+
+    error_aggregate_string = t_string_array ;
+	error_aggregate_string+= m_error_description;
+	return;
+}
+//错误码转字符串的简易版,可支持cout<<
+//return     错误汇总的string
+std::string Error_manager::to_string()
+{
+	char t_string_array[255] = {0};
+	sprintf(t_string_array, "error_code:0x%08x, error_level:%02d, error_description:",
+            m_error_code , m_error_level);
+    std::string error_aggregate_string = t_string_array ;
+	error_aggregate_string+= m_error_description;
+	return error_aggregate_string;
+}
+
+
+
+
+//释放错误描述的内存,
+void Error_manager::free_description()
+{
+}
+
+//重新分配错误描述的内存,并从外部拷贝新的(深拷贝)
+//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)
+{
+    return;
+}
+
+
+//重新分配错误描述的内存,并从外部拷贝新的(深拷贝)
+//input:error_aggregate_string     错误描述的string
+void Error_manager::reallocate_memory_and_copy_string(std::string & error_aggregate_string)
+{
+    return;
+}
+
+
+
+
+

+ 744 - 0
error_code/error_code.h

@@ -0,0 +1,744 @@
+
+//20211125
+
+#define MAIN_TEST 1
+//#define PROCESS_TEST 1
+//#define TIME_TEST 1
+
+#define PLC_S7_COMMUNICATION 1	//是否开启plc的通信
+#define WAIT_PLC_RESPONSE 1		//是否等待plc的答复
+//#define MEASURE_TO_PLC_CORRECTION 1		//修正感测数据
+
+
+//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,//失败
+
+    NODATA                          = 0x00000010,//没有数据,传入参数容器内部没有数据时,
+	INVALID_MESSAGE					= 0x00000011, //无效的消息,
+	PARSE_FAILED					= 0x00000012,//解析失败
+
+    PAUSE                           = 0x00000013,   //急停
+    TASK_CANCEL                     = 0x00000014,   //任务取消
+
+    DISCONNECT                      = 0x00000020,   //通讯中断/断开连接
+    UNKNOW_STATU                    = 0x00000021,   //未知状态
+
+    TASK_TIMEOVER					= 0x00000020,//任务超时
+	RESPONSE_TIMEOUT                = 0x00000021,//答复超时
+
+    POINTER_IS_NULL                 = 0x00000101,//空指针
+    PARAMETER_ERROR                 = 0x00000102,//参数错误,传入参数不符合规范时,
+    POINTER_MALLOC_FAIL             = 0x00000103,//手动分配内存失败
+
+    CLASS_BASE_FUNCTION_CANNOT_USE  = 0x00000201,//基类函数不允许使用,必须使用子类的
+
+	CONTAINER_IS_TERMINATE			= 0x00000301,//容器被终止
+
+
+
+
+//    错误码的规范,
+//    错误码是int型,32位,十六进制。
+//    例如0x12345678
+//    12表示功能模块,例如:laser雷达模块               	框架制定
+//    34表示文件名称,例如:laser_livox.cpp             框架制定
+//    56表示具体的类,例如:class laser_livox           个人制定
+//    78表示类的函数,例如:laser_livox::start();       个人制定
+//    注:错误码的制定从1开始,不要从0开始,
+//        0用作错误码的基数,用来位运算,来判断错误码的范围。
+
+
+
+
+
+
+
+//    laser扫描模块
+    LASER_ERROR_BASE                = 0x01000000,
+
+//    laser_base基类
+	LASER_BASE_ERROR_BASE			= 0x01010000,
+    LASER_TASK_PARAMETER_ERROR      = 0x01010001,   //雷达基类模块, 任务输入参数错误
+    LASER_CONNECT_FAILED,							//雷达基类模块, 连接失败
+	LASER_START_FAILED,								//雷达基类模块, 开始扫描失败
+	LASER_CHECK_FAILED,								//雷达基类模块, 检查失败
+	LASER_STATUS_BUSY,								//雷达基类模块, 状态正忙
+	LASER_STATUS_ERROR,								//雷达基类模块, 状态错误
+	LASER_TASK_OVER_TIME,							//雷达基类模块, 任务超时
+	LASER_QUEUE_ERROR,								//雷达基类模块, 数据缓存错误
+
+
+//   livox  大疆雷达
+    LIVOX_ERROR_BASE                = 0x01020000,
+    LIVOX_START_FAILE,								//livox模块,开始扫描失败
+	LIVOX_TASK_TYPE_ERROR,							//livox模块,任务类型错误
+	lIVOX_CANNOT_PUSH_DATA,							//livox模块,不能添加扫描的数据
+	lIVOX_CHECK_FAILED,								//livox模块,检查失败
+	lIVOX_STATUS_BUSY,								//livox模块,状态正忙
+	lIVOX_STATUS_ERROR,								//livox模块,状态错误
+
+	//laser_manager 雷达管理模块
+	LASER_MANAGER_ERROR_BASE						= 0x01030000,
+	LASER_MANAGER_READ_PROTOBUF_ERROR,				//雷达管理模块,读取参数错误
+	LASER_MANAGER_STATUS_BUSY,						//雷达管理模块,状态正忙
+	LASER_MANAGER_STATUS_ERROR,						//雷达管理模块,状态错误
+	LASER_MANAGER_TASK_TYPE_ERROR,					//雷达管理模块,任务类型错误
+	LASER_MANAGER_IS_NOT_READY,						//雷达管理模块,不在准备状态
+	LASER_MANAGER_TASK_OVER_TIME,					//雷达管理模块,任务超时
+	LASER_MANAGER_LASER_INDEX_ERRPR,				//雷达管理模块,雷达索引错误,编号错误。
+	LASER_MANAGER_LASER_INDEX_REPEAT,				//雷达管理模块,需要扫描的雷达索引重复,可忽略的错误,提示作用
+
+//livox_driver 雷达livox驱动模块
+	LIVOX_DRIVER_ERROR_BASE							= 0x01040000,
+	LIVOX_DRIVER_SN_REPEAT,							//livox驱动模块, 雷达广播码重复
+	LIVOX_DRIVER_SN_ERROR,							//livox驱动模块, 雷达广播码错误
+	LIVOX_SKD_INIT_FAILED,							//livox驱动模块, livox_sdk初始化失败
+	LIVOX_DRIVER_NOT_READY,							//livox驱动模块, livox没有准备好.
+
+
+
+
+     //PLC error code  ...
+    PLC_ERROR_BASE                  				= 0x02010000,
+    PLC_UNKNOWN_ERROR,								//plc未知错误
+    PLC_EMPTY_TASK,									//plc任务为空
+    PLC_IP_PORT_ERROR,								//plc的ip端口错误
+    PLC_SLAVE_ID_ERROR,								//plc的身份id错误
+    PLC_CONNECTION_FAILED,							//PLC连接失败
+    PLC_READ_FAILED,								//plc读取失败
+    PLC_WRITE_FAILED,								//plc写入失败
+    PLC_NOT_ENOUGH_DATA_ERROR,						//PLC没有足够的数据错误
+
+
+
+    //locate 定位模块,
+	LOCATER_ERROR_BASE                				= 0x03000000,
+	//LASER_MANAGER 定位管理模块
+	LOCATER_MANAGER_ERROR_BASE                		= 0x03010000,
+	LOCATER_MANAGER_READ_PROTOBUF_ERROR,				//定位管理模块,读取参数错误
+	LOCATER_MANAGER_STATUS_BUSY,						//定位管理模块,状态正忙
+	LOCATER_MANAGER_STATUS_ERROR,						//定位管理模块,状态错误
+	LOCATER_MANAGER_TASK_TYPE_ERROR,					//定位管理模块,任务类型错误
+	LOCATER_MANAGER_IS_NOT_READY,						//定位管理模块,不在准备状态
+	LOCATER_MANAGER_CLOUD_MAP_ERROR,					//定位管理模块,任务输入点云map的error
+	LOCATER_MANAGER_TASK_OVER_TIME,						//定位管理模块,任务超时
+
+
+	//Locater  算法模块	
+	LOCATER_ALGORITHM_ERROR_BASE					= 0x03020000,
+	LOCATER_TASK_INIT_CLOUD_EMPTY,						//定位任务初始化点云为空
+	LOCATER_TASK_ERROR,									//定位任务错误
+	LOCATER_TASK_INPUT_CLOUD_UNINIT,					//定位任务输入点云为空
+	LOCATER_INPUT_CLOUD_EMPTY,							//定位输入点云为空
+	LOCATER_YOLO_UNINIT,								//定位yolo未初始化
+	LOCATER_POINTSIFT_UNINIT,							//定位POINTSIFT未初始化
+	LOCATER_3DCNN_UNINIT,								//定位3DCNN未初始化
+	LOCATER_INPUT_YOLO_CLOUD_EMPTY,						//定位输入yolo点云为空
+	LOCATER_Y_OUT_RANGE_BY_PLC,							//定位超出plc的限制范围
+	LOCATER_MEASURE_HEIGHT_CLOUD_UNINIT,				//定位测量高点云未初始化
+	LOCATER_MEASURE_HEIGHT_CLOUD_EMPTY,					//定位测量高点云为空
+	LOCATER_INPUT_CLOUD_UNINIT,							//定位输入点云未初始化
+
+
+    //point sift from 0x03010100-0x030101FF
+	LOCATER_SIFT_ERROR_BASE							=0x03020100,
+   	LOCATER_SIFT_INIT_FAILED,							//定位过滤模块,初始化失败
+    LOCATER_SIFT_INPUT_CLOUD_UNINIT,					//定位过滤模块,输入点云未初始化
+	LOCATER_SIFT_INPUT_CLOUD_EMPTY,						//定位过滤模块,输入点云为空
+	LOCATER_SIFT_GRID_ERROR,							//定位过滤模块,筛选网格错误
+	LOCATER_SIFT_SELECT_ERROR,							//定位过滤模块,筛选选择错误
+	LOCATER_SIFT_CLOUD_VERY_LITTLE,						//定位过滤模块,筛选点云很少
+	LOCATER_SIFT_CREATE_INPUT_DATA_FAILED,				//定位过滤模块,筛选创建输入数据失败
+	LOCATER_SIFT_PREDICT_FAILED,						//定位过滤模块,预测失败
+	LOCATER_SIFT_PREDICT_TIMEOUT,						//定位过滤模块,预测超时
+	LOCATER_SIFT_PREDICT_NO_WHEEL_POINT,				//定位过滤模块,预测结果没有车轮点云
+	LOCATER_SIFT_PREDICT_NO_CAR_POINT,					//定位过滤模块,预测结果没有车身点云
+
+    LOCATER_SIFT_FILTE_OBS_FAILED,						//定位过滤模块,过滤OBS失败
+    LOCATER_SIFT_INPUT_BOX_PARAMETER_FAILED,			//定位过滤模块,输入范围参数错误
+
+//    //yolo 
+//    LOCATER_YOLO_ERROR_BASE						=0x03020200,
+//    LOCATER_YOLO_DETECT_FAILED,
+//    LOCATER_YOLO_DETECT_NO_TARGET,
+//    LOCATER_YOLO_PARAMETER_INVALID,
+//    LOCATER_YOLO_INPUT_CLOUD_UNINIT,
+
+    //3dcnn from 0x03010300-0x030103FF
+    LOCATER_3DCNN_ERROR_BASE						=0x03020300,
+    LOCATER_3DCNN_INIT_FAILED,							//定位3DCNN模块,初始化失败
+    LOCATER_3DCNN_INPUT_CLOUD_UNINIT,					//定位3DCNN模块,输入点云未初始化
+	LOCATER_3DCNN_INPUT_CLOUD_EMPTY,					//定位3DCNN模块,输入点云为空
+	LOCATER_3DCNN_INPUT_CLOUD_MAP_ERROR,				//定位3DCNN模块,输入点云的map错误
+	LOCATER_3DCNN_PCA_OUT_ERROR,						//定位3DCNN模块,pca错误
+	LOCATER_3DCNN_EXTRACT_RECT_ERROR,					//定位3DCNN模块,提取矩形错误
+	LOCATER_3DCNN_RECT_SIZE_ERROR,						//定位3DCNN模块,矩形范围错误
+
+    LOCATER_3DCNN_PREDICT_FAILED,						//定位3DCNN模块,预测失败
+    LOCATER_3DCNN_VERIFY_RECT_FAILED_3,					//定位3DCNN模块,验证矩形失败3
+    LOCATER_3DCNN_VERIFY_RECT_FAILED_4,					//定位3DCNN模块,验证矩形失败4
+    LOCATER_3DCNN_KMEANS_FAILED,						//定位3DCNN模块,k均值失败
+    LOCATER_3DCNN_IIU_FAILED,							//定位3DCNN模块,IIU失败
+    LOCATER_3DCNN_PCA_OUT_CLOUD_EMPTY,					//定位3DCNN模块,pca输出点云为空
+
+	//感测和主控通信
+	LOCATER_MSG_TABLE_NOT_EXIST  				= 0x03030100,
+    LOCATER_MSG_RESPONSE_TYPE_ERROR,                                //测量反馈消息类型错误(致命)
+    LOCATER_MSG_RESPONSE_INFO_ERROR,
+    LOCATER_MSG_REQUEST_CANCELED,
+    LOCATER_MSG_REQUEST_INVALID,
+    LOCATER_MSG_RESPONSE_HAS_NO_REQUEST,
+    LOCATER_MSG_REQUEST_REPEATED,
+
+    //System_manager error from 0x04010000-0x0401FFFF
+    SYSTEM_READ_PARAMETER_ERROR						=0x04010100,
+    SYSTEM_PARAMETER_ERROR,
+    SYSTEM_INPUT_TERMINOR_NO_LASERS,
+
+    //terminor_command_executor.cpp from 0x04010200-0x040102FF
+    TERMINOR_NOT_READY								=0x04010200,
+    TERMINOR_INPUT_LASER_NULL,
+    TERMINOR_NOT_CONTAINS_LASER,
+    TERMINOR_INPUT_PLC_NULL,
+    TERMINOR_INPUT_LOCATER_NULL,
+    TERMINOR_CREATE_WORKING_THREAD_FAILED,
+    TERMINOR_FORCE_QUIT,
+    TERMINOR_LASER_TIMEOUT,
+    TERMINOR_POST_PLC_TIMEOUT,
+    TERMINOR_CHECK_RESULTS_ERROR,
+
+    ////Hardware limit from 0x05010000 - 0x0501ffff
+    ///railing.cpp from 0x05010100-0x050101ff
+    HARDWARE_LIMIT_LEFT_RAILING						=0x05010100,         //左栏杆限制
+    HARDWARE_LIMIT_RAILING_PARAMETER_ERROR,
+    HARDWARE_LIMIT_RAILING_ERROR,
+    HARDWARE_LIMIT_CENTER_X_LEFT,
+    HARDWARE_LIMIT_CENTER_X_RIGHT,
+    HARDWARE_LIMIT_CENTER_Y_TOP,
+    HARDWARE_LIMIT_CENTER_Y_BOTTOM,
+    HARDWARE_LIMIT_HEIGHT_OUT_RANGE,
+    HARDWARE_LIMIT_ANGLE_OUT_RANGE,
+    //termonal_limit from 0x05010200-0x050102ff
+    HARDWARE_LIMIT_TERMINAL_LEFT_ERROR,
+    HARDWARE_LIMIT_TERMINAL_RIGHT_ERROR,
+    HARDWARE_LIMIT_TERMINAL_LR_ERROR,
+
+
+//万集设备模块,
+    WANJI_LIDAR_DEVICE_ERROR_BASE								=0x06080000,//万集设备模块,错误基类
+	WANJI_LIDAR_DEVICE_STATUS_BUSY,									//万集设备模块,状态正忙
+	WANJI_LIDAR_DEVICE_STATUS_ERROR,								//万集设备模块,状态错误
+	WANJI_LIDAR_DEVICE_TASK_TYPE_ERROR,								//万集设备模块,任务类型错误
+	WANJI_LIDAR_DEVICE_TASK_OVER_TIME,								//万集设备模块,任务超时
+	WANJI_LIDAR_DEVICE_NO_CLOUD,									//万集设备模块,没有点云
+    // velodyne设备模块
+    VELODYNE_LIDAR_DEVICE_ERROR_BASE,								//velodyne设备模块,错误基类
+    VELODYNE_LIDAR_DEVICE_STATUS_BUSY,									//velodyne设备模块,状态正忙
+	VELODYNE_LIDAR_DEVICE_STATUS_ERROR,								//velodyne设备模块,状态错误
+	VELODYNE_LIDAR_DEVICE_TASK_TYPE_ERROR,								//velodyne设备模块,任务类型错误
+	VELODYNE_LIDAR_DEVICE_TASK_OVER_TIME,								//velodyne设备模块,任务超时
+	VELODYNE_LIDAR_DEVICE_NO_CLOUD,									//velodyne设备模块,没有点云
+
+
+	//万集通信wj_lidar error from 0x06010000-0x0601FFFF
+	WJ_LIDAR_COMMUNICATION_ERROR_BASE				=0x06010000,
+	WJ_LIDAR_COMMUNICATION_UNINITIALIZED,							//万集通信,未初始化
+	WJ_LIDAR_COMMUNICATION_DISCONNECT,								//万集通信,断连
+	WJ_LIDAR_COMMUNICATION_FAULT,									//万集通信,故障
+	WJ_LIDAR_CONNECT_FAILED,										//万集通信,连接失败
+    WJ_LIDAR_UNINITIALIZED,											//万集通信,未初始化
+    WJ_LIDAR_READ_FAILED,											//万集通信,读取失败
+    WJ_LIDAR_WRITE_FAILED,											//万集通信,写入失败
+    WJ_LIDAR_GET_CLOUD_TIMEOUT,										//万集通信,获取点云超时
+    // velodyne通信
+    VELODYNE_LIDAR_COMMUNICATION_UNINITIALIZED,							//velodyne通信,未初始化
+	VELODYNE_LIDAR_COMMUNICATION_DISCONNECT,								//velodyne通信,断连
+	VELODYNE_LIDAR_COMMUNICATION_FAULT,									//velodyne通信,故障
+	VELODYNE_LIDAR_CONNECT_FAILED,										//velodyne通信,连接失败
+    VELODYNE_LIDAR_UNINITIALIZED,											//velodyne通信,未初始化
+    VELODYNE_LIDAR_READ_FAILED,											//velodyne通信,读取失败
+    VELODYNE_LIDAR_WRITE_FAILED,											//velodyne通信,写入失败
+    VELODYNE_LIDAR_GET_CLOUD_TIMEOUT,										//velodyne通信,获取点云超时
+
+    //万集解析 wj lidar protocol error from 0x06020000-0x0602FFFF
+        WJ_PROTOCOL_ERROR_BASE						=0x06020000,
+	WJ_PROTOCOL_STATUS_BUSY,										//万集解析, 状态正忙
+	WJ_PROTOCOL_STATUS_ERROR,										//万集解析, 状态错误
+    WJ_PROTOCOL_INTEGRITY_ERROR,									//万集解析, 完整性错误								
+    WJ_PROTOCOL_PARSE_FAILED,										//万集解析, 解析失败
+    WJ_PROTOCOL_EMPTY_PACKAGE,										//万集解析, 空包
+    WJ_PROTOCOL_EXCEED_MAX_SIZE,									//万集解析, 超出最大范围
+
+    //万集测量范围 wj region detect error from 0x06030000-0x0603FFFF
+	WJ_REGION_ERROR_BASE							= 0x06030000,
+	WJ_REGION_EMPTY_CLOUD,											//万集测量,空点云	
+	WJ_REGION_EMPTY_NO_WHEEL_INFORMATION,							//万集测量,没有车轮信息
+    WJ_REGION_RECTANGLE_ANGLE_ERROR,								//万集测量,矩形旋转角错误
+    WJ_REGION_RECTANGLE_SIZE_ERROR,									//万集测量,矩形大小错误
+    WJ_REGION_RECTANGLE_SYMMETRY_ERROR,								//万集测量,矩形对称错误
+    WJ_REGION_CLUSTER_SIZE_ERROR,									//万集测量,簇大小错误
+    WJ_REGION_CERES_SOLVE_ERROR,                                    //万集测量,优化失败
+    //velodyne测量范围
+	VELODYNE_REGION_ERROR_BASE,
+	VELODYNE_REGION_EMPTY_CLOUD,											//velodyne测量,空点云	
+	VELODYNE_REGION_EMPTY_NO_WHEEL_INFORMATION,							//velodyne测量,没有车轮信息
+    VELODYNE_REGION_RECTANGLE_ANGLE_ERROR,								//velodyne测量,矩形旋转角错误
+    VELODYNE_REGION_RECTANGLE_SIZE_ERROR,									//velodyne测量,矩形大小错误
+    VELODYNE_REGION_RECTANGLE_SYMMETRY_ERROR,								//velodyne测量,矩形对称错误
+    VELODYNE_REGION_CLUSTER_SIZE_ERROR,									//velodyne测量,簇大小错误
+    VELODYNE_REGION_CERES_SOLVE_ERROR,                                    //velodyne测量,优化失败
+
+    //万集管理模块 wj manager error from 0x06040000-0x0604FFFF
+	WJ_MANAGER_ERROR_BASE										= 0x06040000,
+    WJ_MANAGER_UNINITIALIZED,									//万集管理模块,未初始化
+    WJ_MANAGER_LIDAR_DISCONNECTED,								//万集管理模块,雷达断链
+    WJ_MANAGER_PLC_DISCONNECTED,								//万集管理模块,plc断链
+    WJ_MANAGER_EMPTY_CLOUD,										//万集管理模块,空点云
+	WJ_MANAGER_READ_PROTOBUF_ERROR,								//万集管理模块,读取参数错误
+	WJ_MANAGER_INIT_ERROR,										//万集管理模块,初始化error
+	WJ_MANAGER_TASK_TYPE_ERROR,									//万集管理模块,任务类型错误
+	WJ_MANAGER_STATUS_BUSY,										//万集管理模块,状态正忙
+	WJ_MANAGER_STATUS_ERROR,									//万集管理模块,状态错误
+	WJ_MANAGER_LASER_INDEX_ERRPR,								//万集管理模块,雷达索引错误,编号错误。
+	WJ_MANAGER_LASER_INDEX_REPEAT,								//万集管理模块,需要扫描的雷达索引重复,可忽略的错误,提示作用
+	WJ_MANAGER_TASK_OVER_TIME,									//万集管理模块,任务超时
+    VELODYNE_MANAGER_ERROR_BASE,										
+    VELODYNE_MANAGER_UNINITIALIZED,									//velodyne管理模块,未初始化
+    VELODYNE_MANAGER_LIDAR_DISCONNECTED,								//velodyne管理模块,雷达断链
+    VELODYNE_MANAGER_EMPTY_CLOUD,										//velodyne管理模块,空点云
+	VELODYNE_MANAGER_READ_PROTOBUF_ERROR,								//velodyne管理模块,读取参数错误
+	VELODYNE_MANAGER_INIT_ERROR,										//velodyne管理模块,初始化error
+	VELODYNE_MANAGER_TASK_TYPE_ERROR,									//velodyne管理模块,任务类型错误
+	VELODYNE_MANAGER_STATUS_BUSY,										//velodyne管理模块,状态正忙
+	VELODYNE_MANAGER_STATUS_ERROR,									//velodyne管理模块,状态错误
+	VELODYNE_MANAGER_LASER_INDEX_ERRPR,								//velodyne管理模块,雷达索引错误,编号错误。
+	VELODYNE_MANAGER_LASER_INDEX_REPEAT,								//velodyne管理模块,需要扫描的雷达索引重复,可忽略的错误,提示作用
+	VELODYNE_MANAGER_TASK_OVER_TIME,									//velodyne管理模块,任务超时
+
+//万集任务模块
+	WJ_LIDAR_TASK_ERROR_BASE									=0x06050000,
+	WJ_LIDAR_TASK_EMPTY_RESULT,									//万集任务模块,空结果
+    WJ_LIDAR_TASK_EMPTY_TASK,									//万集任务模块,空任务
+    WJ_LIDAR_TASK_WRONG_TYPE,									//万集任务模块,错误类型
+    WJ_LIDAR_TASK_INVALID_TASK,									//万集任务模块,无效任务
+    WJ_LIDAR_TASK_MEASURE_FAILED,								//万集任务模块,测量失败
+
+    // 万集滤波
+    WJ_FILTER_ERROR_BASE                                        =0x06060000,
+    WJ_FILTER_LACK_OF_RESULT,                                   //万集滤波,结果不足以进行滤波
+    WJ_FILTER_FLUCTUATING,                                      //万集滤波,结果波动过大
+
+    //task module, 任务模块  error from 0x10010000-0x1001FFFF
+	TASK_MODULE_ERROR_BASE 							= 0x10010000,
+	TASK_TYPE_IS_UNKNOW,
+	TASK_NO_RECEIVER,
+
+
+	//Communication module, 通信模块
+	COMMUNICATION_BASE_ERROR_BASE					= 0x11010000,
+	COMMUNICATION_READ_PROTOBUF_ERROR,				//模块,读取参数错误
+	COMMUNICATION_BIND_ERROR,
+	COMMUNICATION_CONNECT_ERROR,
+	COMMUNICATION_ANALYSIS_TIME_OUT,									//解析超时,
+	COMMUNICATION_EXCUTER_IS_BUSY,										//处理器正忙, 请稍等
+
+
+
+
+	//system module, 系统模块
+	SYSTEM_EXECUTOR_ERROR_BASE						= 0x12010000,		//系统执行模块,
+	SYSTEM_EXECUTOR_PARSE_ERROR,										//系统执行模块, 解析消息错误
+	SYSTEM_EXECUTOR_STATUS_BUSY,										//系统执行模块, 状态正忙
+	SYSTEM_EXECUTOR_STATUS_ERROR,										//系统执行模块, 状态错误
+	SYSTEM_EXECUTOR_CHECK_ERROR,										//系统执行模块, 检查错误
+
+
+
+	//Dispatch 调度 模块 错误码
+	DISPATCH_ERROR_BASE								= 0x13000000,
+
+	//Dispatch_manager 调度管理模块 错误码
+	DISPATCH_MANAGER_ERROR_BASE						= 0x13010000,
+	DISPATCH_MANAGER_READ_PROTOBUF_ERROR,				//调度管理模块,读取参数错误
+	DISPATCH_MANAGER_STATUS_BUSY,						//调度管理模块,状态正忙
+	DISPATCH_MANAGER_STATUS_ERROR,						//调度管理模块,状态错误
+	DISPATCH_MANAGER_TASK_TYPE_ERROR,					//调度管理模块,任务类型错误
+	DISPATCH_MANAGER_IS_NOT_READY,						//调度管理模块,不在准备状态
+	DISPATCH_MANAGER_SPACE_LOCK_ERROR,					//调度管理模块,空间锁错误
+
+
+	DISPATCH_PROCESS_ERROR_BASE								= 0x13020000,
+	DISPATCH_PROCESS_IS_NOT_READY,						//调度流程, 不在准备状态
+	DISPATCH_PROCESS_DEVICE_TYPE_ERROR,					//调度流程, 设备类型错误
+	DISPATCH_PROCESS_DEVICE_STATUS_ERROR,				//调度流程, 设备状态错误
+	DISPATCH_PROCESS_TASK_STATUS_ERROR,					//调度流程, 任务类型错误
+	DISPATCH_PROCESS_COMMAND_KEY_REPEAT,				//调度流程, 唯一码错误
+	DISPATCH_PROCESS_INIT_ERROR,						//调度流程, 初始化错误
+
+
+	DISPATCH_DEVICE_ERROR_BASE								= 0x13030000,
+	DISPATCH_DEVICE_READ_PROTOBUF_ERROR,				//调度设备模块,读取参数错误
+	DISPATCH_DEVICE_STATUS_BUSY,						//调度设备模块,状态正忙
+	DISPATCH_DEVICE_STATUS_ERROR,						//调度设备模块,状态错误
+	DISPATCH_DEVICE_STATUS_DISCONNECT,					//调度设备模块,状态断连
+	DISPATCH_DEVICE_TASK_TYPE_ERROR,					//调度设备模块,任务类型错误
+	DISPATCH_DEVICE_TASK_OVER_TIME,						//调度设备模块,任务超时
+	DISPATCH_DEVICE_TASK_REPEAT,						//调度设备模块,任务重复, 任务已经存在
+	DISPATCH_DEVICE_IS_NOT_READY,						//调度设备模块,不在准备状态
+	DISPATCH_DEVICE_RESPONS_ERROR,						//调度设备模块,指令的执行失败
+	DISPATCH_DEVICE_TASK_NOTHINGNESS,					//调度设备模块,任务不存在
+	DISPATCH_DEVICE_TASK_LEVEL_ERROR,					//调度设备模块,任务等级错误
+
+
+	CARRIER_ERROR_BASE								= 0x13040000,
+	CARRIER_READ_PROTOBUF_ERROR,				//搬运器模块,读取参数错误
+	CARRIER_STATUS_BUSY,						//搬运器模块,状态正忙
+	CARRIER_STATUS_ERROR,						//搬运器模块,状态错误
+	CARRIER_STATUS_DISCONNECT,					//搬运器模块,状态断连
+	CARRIER_TASK_TYPE_ERROR,					//搬运器模块,任务类型错误
+	CARRIER_TASK_OVER_TIME,						//搬运器模块,任务超时
+	CARRIER_IS_NOT_READY,						//搬运器模块,不在准备状态
+	CARRIER_RESPONS_ERROR,						//搬运器模块,指令的执行失败
+	CARRIER_TASK_NOTHINGNESS,					//搬运器模块,任务不存在
+	CARRIER_POSE_ERROR,							//搬运器模块,姿态错误
+	CARRIER_CONRTOL_PARAMETER_ERROR,			//搬运器模块,控制参数错误
+
+	CATCHER_ERROR_BASE								= 0x13050000,
+	CATCHER_READ_PROTOBUF_ERROR,				//抓取器模块,读取参数错误
+	CATCHER_STATUS_BUSY,						//抓取器模块,状态正忙
+	CATCHER_STATUS_ERROR,						//抓取器模块,状态错误
+	CATCHER_STATUS_DISCONNECT,					//抓取器模块,状态断连
+	CATCHER_TASK_TYPE_ERROR,					//抓取器模块,任务类型错误
+	CATCHER_TASK_OVER_TIME,						//抓取器模块,任务超时
+	CATCHER_IS_NOT_READY,						//抓取器模块,不在准备状态
+	CATCHER_RESPONS_ERROR,						//抓取器模块,指令的执行失败
+	CATCHER_TASK_NOTHINGNESS,					//抓取器模块,任务不存在
+	CATCHER_POSE_ERROR,							//抓取器模块,姿态错误
+	CATCHER_CONRTOL_PARAMETER_ERROR,			//抓取器模块,控制参数错误
+
+	PASSAGEWAY_ERROR_BASE								= 0x13060000,
+	PASSAGEWAY_READ_PROTOBUF_ERROR,				//通道口模块,读取参数错误
+	PASSAGEWAY_STATUS_BUSY,						//通道口模块,状态正忙
+	PASSAGEWAY_STATUS_ERROR,						//通道口模块,状态错误
+	PASSAGEWAY_STATUS_DISCONNECT,					//通道口模块,状态断连
+	PASSAGEWAY_TASK_TYPE_ERROR,					//通道口模块,任务类型错误
+	PASSAGEWAY_TASK_OVER_TIME,						//通道口模块,任务超时
+	PASSAGEWAY_IS_NOT_READY,						//通道口模块,不在准备状态
+	PASSAGEWAY_RESPONS_ERROR,						//通道口模块,指令的执行失败
+	PASSAGEWAY_TASK_NOTHINGNESS,					//通道口模块,任务不存在
+
+
+	//DISPATCH_COORDINATES module, 通信模块
+	DISPATCH_COORDINATES_ERROR_BASE					= 0x13060000,
+	DISPATCH_COORDINATES_READ_PROTOBUF_ERROR,				//调度坐标模块,读取参数错误
+	DISPATCH_COORDINATES_ID_ERROR,							//调度坐标模块,坐标id错误
+	DISPATCH_COORDINATES_PATH_ERROR,						//调度坐标模块,路径方向错误
+	DISPATCH_COORDINATES_CAN_NOT_LOCK,						//调度坐标模块,不能加锁
+
+	//Dispatch_plc 调度plc模块
+	DISPATCH_PLC_ERROR_BASE							= 0x13070000,
+	DISPATCH_PLC_REQUEST_ERROR,								//调度plc模块,请求错误
+	DISPATCH_PLC_RESPONS_ERROR,								//调度plc模块,指令的执行失败
+	DISPATCH_PLC_STATUS_ERROR,								//调度plc模块,状态错误
+	DISPATCH_PLC_TIME_OUT,									//调度plc模块,超时
+	DISPATCH_PLC_DIRECTION_ERROR,							//调度plc模块,方向错误
+
+
+
+	//snap7 通信模块 错误码
+	SNAP7_ERROR_BASE								= 0x1401000,
+	SNAP7_READ_PROTOBUF_ERROR,							//snap7通信模块,读取参数错误
+	SNAP7_CONNECT_ERROR,								//snap7通信模块,连接错误
+	SNAP7_DISCONNECT_ERROR,								//snap7通信模块,断连错误
+	SNAP7_READ_ERROR,									//snap7通信模块,读取错误
+	SNAP7_WRITE_ERROR,									//snap7通信模块,写入错误
+	SNAP7_ANALYSIS_TIME_OUT,									//解析超时,
+	SNAP7_EXCUTER_IS_BUSY,										//处理器正忙, 请稍等
+	
+
+	
+	
+    
+    //parkspace allocator,车位分配模块
+    PARKSPACE_ALLOCATOR_ERROR_BASE                  = 0x20010000,     
+    PARKSPACE_ALLOCATOR_MSG_REQUEST_TYPE_ERROR,    //反馈车位消息类型错误 
+    PARKSPACE_ALLOCATOR_MSG_RESPONSE_TYPE_ERROR,    //反馈车位消息类型错误
+    PARKSPACE_ALLOCATOR_MSG_PARSE_ERROR,            //请求消息解析错误
+    PARKSPACE_ALLOCATOR_SPACE_EMPTY,                //空车位异常,车库无车位。或许由模块初始化异常产生
+    PARKSPACE_ALLOCATOR_ALLOCATE_FAILED,            //无合适车位,分配失败
+    PARKSPACE_ALLOCATOR_SEARCH_FAILED,              //未找到车辆对应车位
+    PARKSPACE_ALLOCATOR_RELEASE_FAILED,             //未找到匹配的车位,车位未释放
+    PARKSPACE_ALLOCATOR_FORCE_UPDATE_FAILED,        //手动更新失败,未找到匹配车位
+    PARKSPACE_ALLOCATOR_PARAM_ERROR,                //传入参数错误
+    PARKSPACE_ALLOCATOR_CONFIRM_ALLOC_ERROR,        //确认分配车位错误
+    PARKSPACE_ALLOCATOR_CAR_ALREADY_EXIST,          //车辆已存在
+
+    // 数据库操作
+    DB_ERROR_BASE                                   = 0x20020000,
+    DB_INIT_FAILED,									//数据库初始化失败
+    DB_CONNECT_FAILED,                              //数据库连接失败
+    DB_STATUS_ERROR,								//数据库状态错误
+	DB_MANAGER_STATUS_ERROR,						//数据库管理状态错误
+    DB_INSERT_FAILED,                               //数据库插入失败
+    DB_DELETE_FAILED,                               //数据库删除失败
+    DB_UPDATE_FAILED,                               //数据库更新失败
+    DB_QUERY_FAILED,                                //数据库查询失败
+    DB_UNINITIALIZED,                               //数据库外层未初始化
+    DB_DISCONNECTED,                                //数据库外层连接失去
+    DB_RESULT_SET_EMPTY,                            //数据库外层查询返回结果空指针
+    DB_RESULT_SET_PARSE_ERROR,                      //数据库外层查询结果解析失败
+    DB_CONNECT_CHANNEL_NOT_FOUND,					//数据库连接通道未找到
+    DB_CONNECT_CHANNEL_NUMBER_ERROR,				//数据库连接通道数量错误
+    DB_QUERY_DATA_REPEAT,							//数据库查询数据重复
+    DB_QUERY_NOT_DATA,								//数据库未查询到数据
+	DB_QUERY_DATA_FAILED,							//数据库查询数据错误
+	DB_NOT_QUERY_EMPTY_PARKSPACE,					//数据库未查询到空车位
+	DB_PROTOBUF_ERROR,								//数据库配置参数读取错误
+
+
+
+
+    //parkspace error code
+    PARKSPACE_REQUEST_MSG_TYPE_ERROR            	= 0x20030000,
+    PARKSPACE_ALLOCMSG_RESPONSE_HAS_NO_REQUEST,
+    PARKSPACE_SEARCHMSG_RESPONSE_HAS_NO_REQUEST,
+    PARKSPACE_RELEASEMSG_RESPONSE_HAS_NO_REQUEST,
+    PARKSPACE_ALLOC_REQUEST_INVALID,
+    PARKSPACE_SEARCH_REQUEST_INVALID,
+    PARKSPACE_RELEASE_REQUEST_INVALID,
+
+    PARKSPACE_ALLOC_REQUEST_REPEATED,
+    PARKSPACE_SEARCH_REQUEST_REPEATED,
+    PARKSPACE_RELEASE_REQUEST_REPEATED,
+
+    PARKSPACE_ALLOC_RESPONSE_TYPE_ERROR,
+    PARKSPACE_SEARCH_RESPONSE_TYPE_ERROR,
+    PARKSPACE_RELEASE_RESPONSE_TYPE_ERROR,
+
+    PARKSPACE_ALLOC_RESPONSE_INFO_ERROR,
+    PARKSPACE_SEARCH_RESPONSE_INFO_ERROR,
+    PARKSPACE_RELEASE_RESPONSE_INFO_ERROR,
+
+    PARKSPACE_ALLOC_REQUEST_CANCELED,
+    PARKSPACE_SEARCH_REQUEST_CANCELED,
+    PARKSPACE_RELEASE_REQUEST_CANCELED,
+
+
+};
+
+//错误等级,用来做故障处理
+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);
+    //赋值构造
+    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);
+    //初始化
+    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);
+    //重置
+    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();
+    //获取错误描述的指针,(浅拷贝)
+    std::string get_error_description();
+
+    //复制错误描述,(深拷贝)
+    //output:p_error_description     错误描述的字符串指针,不可以为NULL,必须要有实际的内存
+    //output:description_length      错误描述的字符串长度,不可以为0,长度最好足够大,一般256即可。
+    void copy_error_description(const char* p_error_description);
+    //复制错误描述,(深拷贝)
+    //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);
+    //设置错误描述
+    void set_error_description(std::string & error_description_string);
+
+    //尾部追加错误描述
+    void add_error_description(const char* p_error_description);
+    //尾部追加错误描述
+    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: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;              //错误等级
+    std::string             m_error_description;		// 错误描述
+
+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
+
+

+ 14 - 0
hulitest.sh

@@ -0,0 +1,14 @@
+#!/bin/bash
+ 
+
+{
+gnome-terminal -x bash -c "cd /home/huli/huli/chutian_project/chutian_dispatch/chutian_dispatch/cmake-build-debug/&&./terminal 0; exec bash"
+}&
+ 
+{
+gnome-terminal -x bash -c "cd /home/huli/huli/chutian_project/chutian_dispatch/chutian_dispatch/cmake-build-debug/&&./terminal 1; exec bash"
+}&
+
+{
+gnome-terminal -x bash -c "cd /home/huli/huli/chutian_project/chutian_dispatch/chutian_dispatch/cmake-build-debug/&&./terminal 2; exec bash"
+}&

+ 97 - 0
main.cpp

@@ -0,0 +1,97 @@
+//
+//
+// 20210425, hl_dispatch 和 hl_dispatch_B的版本进行同步, 此时调度管理的功能全部完成.后续可能还需要日志记录.
+//
+
+#include <iostream>
+#include "./error_code/error_code.h"
+//#include "LogFiles.h"
+#include <glog/logging.h>
+
+#include "./communication/communication_socket_base.h"
+
+#include "./tool/thread_pool.h"
+#include "./system/system_communication.h"
+#include "./system/system_executor.h"
+
+#include "./tool/common_data.h"
+
+
+
+#include <algorithm>    // std::for_each
+GOOGLE_GLOG_DLL_DECL void shut_down_logging(const char* data, int size)
+{
+	time_t tt;
+	time( &tt );
+	tt = tt + 8*3600;  // transform the time zone
+	tm* t= gmtime( &tt );
+	char buf[255]={0};
+	sprintf(buf,"./%d%02d%02d-%02d%02d%02d-dump.txt",
+			t->tm_year + 1900,
+			t->tm_mon + 1,
+			t->tm_mday,
+			t->tm_hour,
+			t->tm_min,
+			t->tm_sec);
+
+	FILE* tp_file=fopen(buf,"w");
+	fprintf(tp_file,data,strlen(data));
+	fclose(tp_file);
+
+}
+
+#include <chrono>
+using namespace std;
+
+int main(int argc,char* argv[])
+{
+
+	int t_id = 0;
+	if ( argc == 2 )
+	{
+		t_id = stoi(argv[1]);
+	}
+
+
+	Error_manager t_error;
+
+	const char* logPath = "./";
+	google::InitGoogleLogging("LidarMeasurement");
+	google::SetStderrLogging(google::INFO);
+	google::SetLogDestination(0, logPath);
+	google::SetLogFilenameExtension("zxlog");
+	google::InstallFailureSignalHandler();
+	google::InstallFailureWriter(&shut_down_logging);
+	FLAGS_colorlogtostderr = true;        // Set log color
+	FLAGS_logbufsecs = 0;                // Set log output speed(s)
+	FLAGS_max_log_size = 1024;            // Set max log file size(GB)
+	FLAGS_stop_logging_if_full_disk = true;
+
+
+//#define MAIN_TEST 1
+#ifdef MAIN_TEST
+
+	System_executor::get_instance_references().system_executor_init(10);
+	System_communication::get_instance_references().communication_init();
+	System_communication::get_instance_references().set_encapsulate_cycle_time(1000);
+
+
+
+	while (1)
+	{
+		std::string test_string;
+		std::cin >> test_string ;
+
+		if ( test_string == "9" )
+		{
+
+		}
+
+		std::this_thread::sleep_for(std::chrono::seconds(1));
+	}
+	return 0;
+#endif
+
+
+	return 0;
+}

+ 596 - 0
message/UnNormalized_module_message.pb.cc

@@ -0,0 +1,596 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: UnNormalized_module_message.proto
+
+#include "UnNormalized_module_message.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 UnNormalized_module_statu_msgDefaultTypeInternal {
+ public:
+  ::google::protobuf::internal::ExplicitlyConstructed<UnNormalized_module_statu_msg>
+      _instance;
+} _UnNormalized_module_statu_msg_default_instance_;
+}  // namespace message
+namespace protobuf_UnNormalized_5fmodule_5fmessage_2eproto {
+void InitDefaultsUnNormalized_module_statu_msgImpl() {
+  GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
+  ::google::protobuf::internal::InitProtobufDefaultsForceUnique();
+#else
+  ::google::protobuf::internal::InitProtobufDefaults();
+#endif  // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
+  protobuf_message_5fbase_2eproto::InitDefaultsBase_info();
+  protobuf_message_5fbase_2eproto::InitDefaultsId_struct();
+  protobuf_message_5fbase_2eproto::InitDefaultsError_manager();
+  {
+    void* ptr = &::message::_UnNormalized_module_statu_msg_default_instance_;
+    new (ptr) ::message::UnNormalized_module_statu_msg();
+    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
+  }
+  ::message::UnNormalized_module_statu_msg::InitAsDefaultInstance();
+}
+
+void InitDefaultsUnNormalized_module_statu_msg() {
+  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+  ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsUnNormalized_module_statu_msgImpl);
+}
+
+::google::protobuf::Metadata file_level_metadata[1];
+
+const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::UnNormalized_module_statu_msg, _has_bits_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::UnNormalized_module_statu_msg, _internal_metadata_),
+  ~0u,  // no _extensions_
+  ~0u,  // no _oneof_case_
+  ~0u,  // no _weak_field_map_
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::UnNormalized_module_statu_msg, base_info_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::UnNormalized_module_statu_msg, id_struct_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::UnNormalized_module_statu_msg, statu_code_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::UnNormalized_module_statu_msg, car_license_),
+  1,
+  2,
+  3,
+  0,
+};
+static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+  { 0, 9, sizeof(::message::UnNormalized_module_statu_msg)},
+};
+
+static ::google::protobuf::Message const * const file_default_instances[] = {
+  reinterpret_cast<const ::google::protobuf::Message*>(&::message::_UnNormalized_module_statu_msg_default_instance_),
+};
+
+void protobuf_AssignDescriptors() {
+  AddDescriptors();
+  ::google::protobuf::MessageFactory* factory = NULL;
+  AssignDescriptors(
+      "UnNormalized_module_message.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, 1);
+}
+
+void AddDescriptorsImpl() {
+  InitDefaults();
+  static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+      "\n!UnNormalized_module_message.proto\022\007mes"
+      "sage\032\022message_base.proto\"\256\001\n\035UnNormalize"
+      "d_module_statu_msg\022%\n\tbase_info\030\001 \002(\0132\022."
+      "message.Base_info\022%\n\tid_struct\030\002 \002(\0132\022.m"
+      "essage.Id_struct\022*\n\nstatu_code\030\003 \002(\0132\026.m"
+      "essage.Error_manager\022\023\n\013car_license\030\004 \001("
+      "\t"
+  };
+  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
+      descriptor, 241);
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
+    "UnNormalized_module_message.proto", &protobuf_RegisterTypes);
+  ::protobuf_message_5fbase_2eproto::AddDescriptors();
+}
+
+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_UnNormalized_5fmodule_5fmessage_2eproto
+namespace message {
+
+// ===================================================================
+
+void UnNormalized_module_statu_msg::InitAsDefaultInstance() {
+  ::message::_UnNormalized_module_statu_msg_default_instance_._instance.get_mutable()->base_info_ = const_cast< ::message::Base_info*>(
+      ::message::Base_info::internal_default_instance());
+  ::message::_UnNormalized_module_statu_msg_default_instance_._instance.get_mutable()->id_struct_ = const_cast< ::message::Id_struct*>(
+      ::message::Id_struct::internal_default_instance());
+  ::message::_UnNormalized_module_statu_msg_default_instance_._instance.get_mutable()->statu_code_ = const_cast< ::message::Error_manager*>(
+      ::message::Error_manager::internal_default_instance());
+}
+void UnNormalized_module_statu_msg::clear_base_info() {
+  if (base_info_ != NULL) base_info_->Clear();
+  clear_has_base_info();
+}
+void UnNormalized_module_statu_msg::clear_id_struct() {
+  if (id_struct_ != NULL) id_struct_->Clear();
+  clear_has_id_struct();
+}
+void UnNormalized_module_statu_msg::clear_statu_code() {
+  if (statu_code_ != NULL) statu_code_->Clear();
+  clear_has_statu_code();
+}
+#if !defined(_MSC_VER) || _MSC_VER >= 1900
+const int UnNormalized_module_statu_msg::kBaseInfoFieldNumber;
+const int UnNormalized_module_statu_msg::kIdStructFieldNumber;
+const int UnNormalized_module_statu_msg::kStatuCodeFieldNumber;
+const int UnNormalized_module_statu_msg::kCarLicenseFieldNumber;
+#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900
+
+UnNormalized_module_statu_msg::UnNormalized_module_statu_msg()
+  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
+  if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+    ::protobuf_UnNormalized_5fmodule_5fmessage_2eproto::InitDefaultsUnNormalized_module_statu_msg();
+  }
+  SharedCtor();
+  // @@protoc_insertion_point(constructor:message.UnNormalized_module_statu_msg)
+}
+UnNormalized_module_statu_msg::UnNormalized_module_statu_msg(const UnNormalized_module_statu_msg& from)
+  : ::google::protobuf::Message(),
+      _internal_metadata_(NULL),
+      _has_bits_(from._has_bits_),
+      _cached_size_(0) {
+  _internal_metadata_.MergeFrom(from._internal_metadata_);
+  car_license_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  if (from.has_car_license()) {
+    car_license_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.car_license_);
+  }
+  if (from.has_base_info()) {
+    base_info_ = new ::message::Base_info(*from.base_info_);
+  } else {
+    base_info_ = NULL;
+  }
+  if (from.has_id_struct()) {
+    id_struct_ = new ::message::Id_struct(*from.id_struct_);
+  } else {
+    id_struct_ = NULL;
+  }
+  if (from.has_statu_code()) {
+    statu_code_ = new ::message::Error_manager(*from.statu_code_);
+  } else {
+    statu_code_ = NULL;
+  }
+  // @@protoc_insertion_point(copy_constructor:message.UnNormalized_module_statu_msg)
+}
+
+void UnNormalized_module_statu_msg::SharedCtor() {
+  _cached_size_ = 0;
+  car_license_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  ::memset(&base_info_, 0, static_cast<size_t>(
+      reinterpret_cast<char*>(&statu_code_) -
+      reinterpret_cast<char*>(&base_info_)) + sizeof(statu_code_));
+}
+
+UnNormalized_module_statu_msg::~UnNormalized_module_statu_msg() {
+  // @@protoc_insertion_point(destructor:message.UnNormalized_module_statu_msg)
+  SharedDtor();
+}
+
+void UnNormalized_module_statu_msg::SharedDtor() {
+  car_license_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  if (this != internal_default_instance()) delete base_info_;
+  if (this != internal_default_instance()) delete id_struct_;
+  if (this != internal_default_instance()) delete statu_code_;
+}
+
+void UnNormalized_module_statu_msg::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* UnNormalized_module_statu_msg::descriptor() {
+  ::protobuf_UnNormalized_5fmodule_5fmessage_2eproto::protobuf_AssignDescriptorsOnce();
+  return ::protobuf_UnNormalized_5fmodule_5fmessage_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+}
+
+const UnNormalized_module_statu_msg& UnNormalized_module_statu_msg::default_instance() {
+  ::protobuf_UnNormalized_5fmodule_5fmessage_2eproto::InitDefaultsUnNormalized_module_statu_msg();
+  return *internal_default_instance();
+}
+
+UnNormalized_module_statu_msg* UnNormalized_module_statu_msg::New(::google::protobuf::Arena* arena) const {
+  UnNormalized_module_statu_msg* n = new UnNormalized_module_statu_msg;
+  if (arena != NULL) {
+    arena->Own(n);
+  }
+  return n;
+}
+
+void UnNormalized_module_statu_msg::Clear() {
+// @@protoc_insertion_point(message_clear_start:message.UnNormalized_module_statu_msg)
+  ::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) {
+    if (cached_has_bits & 0x00000001u) {
+      GOOGLE_DCHECK(!car_license_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+      (*car_license_.UnsafeRawStringPointer())->clear();
+    }
+    if (cached_has_bits & 0x00000002u) {
+      GOOGLE_DCHECK(base_info_ != NULL);
+      base_info_->Clear();
+    }
+    if (cached_has_bits & 0x00000004u) {
+      GOOGLE_DCHECK(id_struct_ != NULL);
+      id_struct_->Clear();
+    }
+    if (cached_has_bits & 0x00000008u) {
+      GOOGLE_DCHECK(statu_code_ != NULL);
+      statu_code_->Clear();
+    }
+  }
+  _has_bits_.Clear();
+  _internal_metadata_.Clear();
+}
+
+bool UnNormalized_module_statu_msg::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.UnNormalized_module_statu_msg)
+  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 .message.Base_info base_info = 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_base_info()));
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      // required .message.Id_struct id_struct = 2;
+      case 2: {
+        if (static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
+          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+               input, mutable_id_struct()));
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      // required .message.Error_manager statu_code = 3;
+      case 3: {
+        if (static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
+          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+               input, mutable_statu_code()));
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      // optional string car_license = 4;
+      case 4: {
+        if (static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) {
+          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+                input, this->mutable_car_license()));
+          ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
+            this->car_license().data(), static_cast<int>(this->car_license().length()),
+            ::google::protobuf::internal::WireFormat::PARSE,
+            "message.UnNormalized_module_statu_msg.car_license");
+        } 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.UnNormalized_module_statu_msg)
+  return true;
+failure:
+  // @@protoc_insertion_point(parse_failure:message.UnNormalized_module_statu_msg)
+  return false;
+#undef DO_
+}
+
+void UnNormalized_module_statu_msg::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // @@protoc_insertion_point(serialize_start:message.UnNormalized_module_statu_msg)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  cached_has_bits = _has_bits_[0];
+  // required .message.Base_info base_info = 1;
+  if (cached_has_bits & 0x00000002u) {
+    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
+      1, *this->base_info_, output);
+  }
+
+  // required .message.Id_struct id_struct = 2;
+  if (cached_has_bits & 0x00000004u) {
+    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
+      2, *this->id_struct_, output);
+  }
+
+  // required .message.Error_manager statu_code = 3;
+  if (cached_has_bits & 0x00000008u) {
+    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
+      3, *this->statu_code_, output);
+  }
+
+  // optional string car_license = 4;
+  if (cached_has_bits & 0x00000001u) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
+      this->car_license().data(), static_cast<int>(this->car_license().length()),
+      ::google::protobuf::internal::WireFormat::SERIALIZE,
+      "message.UnNormalized_module_statu_msg.car_license");
+    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
+      4, this->car_license(), output);
+  }
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        _internal_metadata_.unknown_fields(), output);
+  }
+  // @@protoc_insertion_point(serialize_end:message.UnNormalized_module_statu_msg)
+}
+
+::google::protobuf::uint8* UnNormalized_module_statu_msg::InternalSerializeWithCachedSizesToArray(
+    bool deterministic, ::google::protobuf::uint8* target) const {
+  (void)deterministic; // Unused
+  // @@protoc_insertion_point(serialize_to_array_start:message.UnNormalized_module_statu_msg)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  cached_has_bits = _has_bits_[0];
+  // required .message.Base_info base_info = 1;
+  if (cached_has_bits & 0x00000002u) {
+    target = ::google::protobuf::internal::WireFormatLite::
+      InternalWriteMessageToArray(
+        1, *this->base_info_, deterministic, target);
+  }
+
+  // required .message.Id_struct id_struct = 2;
+  if (cached_has_bits & 0x00000004u) {
+    target = ::google::protobuf::internal::WireFormatLite::
+      InternalWriteMessageToArray(
+        2, *this->id_struct_, deterministic, target);
+  }
+
+  // required .message.Error_manager statu_code = 3;
+  if (cached_has_bits & 0x00000008u) {
+    target = ::google::protobuf::internal::WireFormatLite::
+      InternalWriteMessageToArray(
+        3, *this->statu_code_, deterministic, target);
+  }
+
+  // optional string car_license = 4;
+  if (cached_has_bits & 0x00000001u) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
+      this->car_license().data(), static_cast<int>(this->car_license().length()),
+      ::google::protobuf::internal::WireFormat::SERIALIZE,
+      "message.UnNormalized_module_statu_msg.car_license");
+    target =
+      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+        4, this->car_license(), 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.UnNormalized_module_statu_msg)
+  return target;
+}
+
+size_t UnNormalized_module_statu_msg::RequiredFieldsByteSizeFallback() const {
+// @@protoc_insertion_point(required_fields_byte_size_fallback_start:message.UnNormalized_module_statu_msg)
+  size_t total_size = 0;
+
+  if (has_base_info()) {
+    // required .message.Base_info base_info = 1;
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::MessageSize(
+        *this->base_info_);
+  }
+
+  if (has_id_struct()) {
+    // required .message.Id_struct id_struct = 2;
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::MessageSize(
+        *this->id_struct_);
+  }
+
+  if (has_statu_code()) {
+    // required .message.Error_manager statu_code = 3;
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::MessageSize(
+        *this->statu_code_);
+  }
+
+  return total_size;
+}
+size_t UnNormalized_module_statu_msg::ByteSizeLong() const {
+// @@protoc_insertion_point(message_byte_size_start:message.UnNormalized_module_statu_msg)
+  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] & 0x0000000e) ^ 0x0000000e) == 0) {  // All required fields are present.
+    // required .message.Base_info base_info = 1;
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::MessageSize(
+        *this->base_info_);
+
+    // required .message.Id_struct id_struct = 2;
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::MessageSize(
+        *this->id_struct_);
+
+    // required .message.Error_manager statu_code = 3;
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::MessageSize(
+        *this->statu_code_);
+
+  } else {
+    total_size += RequiredFieldsByteSizeFallback();
+  }
+  // optional string car_license = 4;
+  if (has_car_license()) {
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::StringSize(
+        this->car_license());
+  }
+
+  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 UnNormalized_module_statu_msg::MergeFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_merge_from_start:message.UnNormalized_module_statu_msg)
+  GOOGLE_DCHECK_NE(&from, this);
+  const UnNormalized_module_statu_msg* source =
+      ::google::protobuf::internal::DynamicCastToGenerated<const UnNormalized_module_statu_msg>(
+          &from);
+  if (source == NULL) {
+  // @@protoc_insertion_point(generalized_merge_from_cast_fail:message.UnNormalized_module_statu_msg)
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+  // @@protoc_insertion_point(generalized_merge_from_cast_success:message.UnNormalized_module_statu_msg)
+    MergeFrom(*source);
+  }
+}
+
+void UnNormalized_module_statu_msg::MergeFrom(const UnNormalized_module_statu_msg& from) {
+// @@protoc_insertion_point(class_specific_merge_from_start:message.UnNormalized_module_statu_msg)
+  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) {
+      set_has_car_license();
+      car_license_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.car_license_);
+    }
+    if (cached_has_bits & 0x00000002u) {
+      mutable_base_info()->::message::Base_info::MergeFrom(from.base_info());
+    }
+    if (cached_has_bits & 0x00000004u) {
+      mutable_id_struct()->::message::Id_struct::MergeFrom(from.id_struct());
+    }
+    if (cached_has_bits & 0x00000008u) {
+      mutable_statu_code()->::message::Error_manager::MergeFrom(from.statu_code());
+    }
+  }
+}
+
+void UnNormalized_module_statu_msg::CopyFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_copy_from_start:message.UnNormalized_module_statu_msg)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void UnNormalized_module_statu_msg::CopyFrom(const UnNormalized_module_statu_msg& from) {
+// @@protoc_insertion_point(class_specific_copy_from_start:message.UnNormalized_module_statu_msg)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool UnNormalized_module_statu_msg::IsInitialized() const {
+  if ((_has_bits_[0] & 0x0000000e) != 0x0000000e) return false;
+  if (has_base_info()) {
+    if (!this->base_info_->IsInitialized()) return false;
+  }
+  if (has_statu_code()) {
+    if (!this->statu_code_->IsInitialized()) return false;
+  }
+  return true;
+}
+
+void UnNormalized_module_statu_msg::Swap(UnNormalized_module_statu_msg* other) {
+  if (other == this) return;
+  InternalSwap(other);
+}
+void UnNormalized_module_statu_msg::InternalSwap(UnNormalized_module_statu_msg* other) {
+  using std::swap;
+  car_license_.Swap(&other->car_license_);
+  swap(base_info_, other->base_info_);
+  swap(id_struct_, other->id_struct_);
+  swap(statu_code_, other->statu_code_);
+  swap(_has_bits_[0], other->_has_bits_[0]);
+  _internal_metadata_.Swap(&other->_internal_metadata_);
+  swap(_cached_size_, other->_cached_size_);
+}
+
+::google::protobuf::Metadata UnNormalized_module_statu_msg::GetMetadata() const {
+  protobuf_UnNormalized_5fmodule_5fmessage_2eproto::protobuf_AssignDescriptorsOnce();
+  return ::protobuf_UnNormalized_5fmodule_5fmessage_2eproto::file_level_metadata[kIndexInFileMessages];
+}
+
+
+// @@protoc_insertion_point(namespace_scope)
+}  // namespace message
+
+// @@protoc_insertion_point(global_scope)

+ 450 - 0
message/UnNormalized_module_message.pb.h

@@ -0,0 +1,450 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: UnNormalized_module_message.proto
+
+#ifndef PROTOBUF_UnNormalized_5fmodule_5fmessage_2eproto__INCLUDED
+#define PROTOBUF_UnNormalized_5fmodule_5fmessage_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>
+#include "message_base.pb.h"
+// @@protoc_insertion_point(includes)
+
+namespace protobuf_UnNormalized_5fmodule_5fmessage_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 InitDefaultsUnNormalized_module_statu_msgImpl();
+void InitDefaultsUnNormalized_module_statu_msg();
+inline void InitDefaults() {
+  InitDefaultsUnNormalized_module_statu_msg();
+}
+}  // namespace protobuf_UnNormalized_5fmodule_5fmessage_2eproto
+namespace message {
+class UnNormalized_module_statu_msg;
+class UnNormalized_module_statu_msgDefaultTypeInternal;
+extern UnNormalized_module_statu_msgDefaultTypeInternal _UnNormalized_module_statu_msg_default_instance_;
+}  // namespace message
+namespace message {
+
+// ===================================================================
+
+class UnNormalized_module_statu_msg : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:message.UnNormalized_module_statu_msg) */ {
+ public:
+  UnNormalized_module_statu_msg();
+  virtual ~UnNormalized_module_statu_msg();
+
+  UnNormalized_module_statu_msg(const UnNormalized_module_statu_msg& from);
+
+  inline UnNormalized_module_statu_msg& operator=(const UnNormalized_module_statu_msg& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  #if LANG_CXX11
+  UnNormalized_module_statu_msg(UnNormalized_module_statu_msg&& from) noexcept
+    : UnNormalized_module_statu_msg() {
+    *this = ::std::move(from);
+  }
+
+  inline UnNormalized_module_statu_msg& operator=(UnNormalized_module_statu_msg&& 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 UnNormalized_module_statu_msg& default_instance();
+
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
+  static inline const UnNormalized_module_statu_msg* internal_default_instance() {
+    return reinterpret_cast<const UnNormalized_module_statu_msg*>(
+               &_UnNormalized_module_statu_msg_default_instance_);
+  }
+  static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+    0;
+
+  void Swap(UnNormalized_module_statu_msg* other);
+  friend void swap(UnNormalized_module_statu_msg& a, UnNormalized_module_statu_msg& b) {
+    a.Swap(&b);
+  }
+
+  // implements Message ----------------------------------------------
+
+  inline UnNormalized_module_statu_msg* New() const PROTOBUF_FINAL { return New(NULL); }
+
+  UnNormalized_module_statu_msg* 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 UnNormalized_module_statu_msg& from);
+  void MergeFrom(const UnNormalized_module_statu_msg& 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(UnNormalized_module_statu_msg* 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 -------------------------------------------------------
+
+  // optional string car_license = 4;
+  bool has_car_license() const;
+  void clear_car_license();
+  static const int kCarLicenseFieldNumber = 4;
+  const ::std::string& car_license() const;
+  void set_car_license(const ::std::string& value);
+  #if LANG_CXX11
+  void set_car_license(::std::string&& value);
+  #endif
+  void set_car_license(const char* value);
+  void set_car_license(const char* value, size_t size);
+  ::std::string* mutable_car_license();
+  ::std::string* release_car_license();
+  void set_allocated_car_license(::std::string* car_license);
+
+  // required .message.Base_info base_info = 1;
+  bool has_base_info() const;
+  void clear_base_info();
+  static const int kBaseInfoFieldNumber = 1;
+  const ::message::Base_info& base_info() const;
+  ::message::Base_info* release_base_info();
+  ::message::Base_info* mutable_base_info();
+  void set_allocated_base_info(::message::Base_info* base_info);
+
+  // required .message.Id_struct id_struct = 2;
+  bool has_id_struct() const;
+  void clear_id_struct();
+  static const int kIdStructFieldNumber = 2;
+  const ::message::Id_struct& id_struct() const;
+  ::message::Id_struct* release_id_struct();
+  ::message::Id_struct* mutable_id_struct();
+  void set_allocated_id_struct(::message::Id_struct* id_struct);
+
+  // required .message.Error_manager statu_code = 3;
+  bool has_statu_code() const;
+  void clear_statu_code();
+  static const int kStatuCodeFieldNumber = 3;
+  const ::message::Error_manager& statu_code() const;
+  ::message::Error_manager* release_statu_code();
+  ::message::Error_manager* mutable_statu_code();
+  void set_allocated_statu_code(::message::Error_manager* statu_code);
+
+  // @@protoc_insertion_point(class_scope:message.UnNormalized_module_statu_msg)
+ private:
+  void set_has_base_info();
+  void clear_has_base_info();
+  void set_has_id_struct();
+  void clear_has_id_struct();
+  void set_has_statu_code();
+  void clear_has_statu_code();
+  void set_has_car_license();
+  void clear_has_car_license();
+
+  // 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 car_license_;
+  ::message::Base_info* base_info_;
+  ::message::Id_struct* id_struct_;
+  ::message::Error_manager* statu_code_;
+  friend struct ::protobuf_UnNormalized_5fmodule_5fmessage_2eproto::TableStruct;
+  friend void ::protobuf_UnNormalized_5fmodule_5fmessage_2eproto::InitDefaultsUnNormalized_module_statu_msgImpl();
+};
+// ===================================================================
+
+
+// ===================================================================
+
+#ifdef __GNUC__
+  #pragma GCC diagnostic push
+  #pragma GCC diagnostic ignored "-Wstrict-aliasing"
+#endif  // __GNUC__
+// UnNormalized_module_statu_msg
+
+// required .message.Base_info base_info = 1;
+inline bool UnNormalized_module_statu_msg::has_base_info() const {
+  return (_has_bits_[0] & 0x00000002u) != 0;
+}
+inline void UnNormalized_module_statu_msg::set_has_base_info() {
+  _has_bits_[0] |= 0x00000002u;
+}
+inline void UnNormalized_module_statu_msg::clear_has_base_info() {
+  _has_bits_[0] &= ~0x00000002u;
+}
+inline const ::message::Base_info& UnNormalized_module_statu_msg::base_info() const {
+  const ::message::Base_info* p = base_info_;
+  // @@protoc_insertion_point(field_get:message.UnNormalized_module_statu_msg.base_info)
+  return p != NULL ? *p : *reinterpret_cast<const ::message::Base_info*>(
+      &::message::_Base_info_default_instance_);
+}
+inline ::message::Base_info* UnNormalized_module_statu_msg::release_base_info() {
+  // @@protoc_insertion_point(field_release:message.UnNormalized_module_statu_msg.base_info)
+  clear_has_base_info();
+  ::message::Base_info* temp = base_info_;
+  base_info_ = NULL;
+  return temp;
+}
+inline ::message::Base_info* UnNormalized_module_statu_msg::mutable_base_info() {
+  set_has_base_info();
+  if (base_info_ == NULL) {
+    base_info_ = new ::message::Base_info;
+  }
+  // @@protoc_insertion_point(field_mutable:message.UnNormalized_module_statu_msg.base_info)
+  return base_info_;
+}
+inline void UnNormalized_module_statu_msg::set_allocated_base_info(::message::Base_info* base_info) {
+  ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
+  if (message_arena == NULL) {
+    delete reinterpret_cast< ::google::protobuf::MessageLite*>(base_info_);
+  }
+  if (base_info) {
+    ::google::protobuf::Arena* submessage_arena = NULL;
+    if (message_arena != submessage_arena) {
+      base_info = ::google::protobuf::internal::GetOwnedMessage(
+          message_arena, base_info, submessage_arena);
+    }
+    set_has_base_info();
+  } else {
+    clear_has_base_info();
+  }
+  base_info_ = base_info;
+  // @@protoc_insertion_point(field_set_allocated:message.UnNormalized_module_statu_msg.base_info)
+}
+
+// required .message.Id_struct id_struct = 2;
+inline bool UnNormalized_module_statu_msg::has_id_struct() const {
+  return (_has_bits_[0] & 0x00000004u) != 0;
+}
+inline void UnNormalized_module_statu_msg::set_has_id_struct() {
+  _has_bits_[0] |= 0x00000004u;
+}
+inline void UnNormalized_module_statu_msg::clear_has_id_struct() {
+  _has_bits_[0] &= ~0x00000004u;
+}
+inline const ::message::Id_struct& UnNormalized_module_statu_msg::id_struct() const {
+  const ::message::Id_struct* p = id_struct_;
+  // @@protoc_insertion_point(field_get:message.UnNormalized_module_statu_msg.id_struct)
+  return p != NULL ? *p : *reinterpret_cast<const ::message::Id_struct*>(
+      &::message::_Id_struct_default_instance_);
+}
+inline ::message::Id_struct* UnNormalized_module_statu_msg::release_id_struct() {
+  // @@protoc_insertion_point(field_release:message.UnNormalized_module_statu_msg.id_struct)
+  clear_has_id_struct();
+  ::message::Id_struct* temp = id_struct_;
+  id_struct_ = NULL;
+  return temp;
+}
+inline ::message::Id_struct* UnNormalized_module_statu_msg::mutable_id_struct() {
+  set_has_id_struct();
+  if (id_struct_ == NULL) {
+    id_struct_ = new ::message::Id_struct;
+  }
+  // @@protoc_insertion_point(field_mutable:message.UnNormalized_module_statu_msg.id_struct)
+  return id_struct_;
+}
+inline void UnNormalized_module_statu_msg::set_allocated_id_struct(::message::Id_struct* id_struct) {
+  ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
+  if (message_arena == NULL) {
+    delete reinterpret_cast< ::google::protobuf::MessageLite*>(id_struct_);
+  }
+  if (id_struct) {
+    ::google::protobuf::Arena* submessage_arena = NULL;
+    if (message_arena != submessage_arena) {
+      id_struct = ::google::protobuf::internal::GetOwnedMessage(
+          message_arena, id_struct, submessage_arena);
+    }
+    set_has_id_struct();
+  } else {
+    clear_has_id_struct();
+  }
+  id_struct_ = id_struct;
+  // @@protoc_insertion_point(field_set_allocated:message.UnNormalized_module_statu_msg.id_struct)
+}
+
+// required .message.Error_manager statu_code = 3;
+inline bool UnNormalized_module_statu_msg::has_statu_code() const {
+  return (_has_bits_[0] & 0x00000008u) != 0;
+}
+inline void UnNormalized_module_statu_msg::set_has_statu_code() {
+  _has_bits_[0] |= 0x00000008u;
+}
+inline void UnNormalized_module_statu_msg::clear_has_statu_code() {
+  _has_bits_[0] &= ~0x00000008u;
+}
+inline const ::message::Error_manager& UnNormalized_module_statu_msg::statu_code() const {
+  const ::message::Error_manager* p = statu_code_;
+  // @@protoc_insertion_point(field_get:message.UnNormalized_module_statu_msg.statu_code)
+  return p != NULL ? *p : *reinterpret_cast<const ::message::Error_manager*>(
+      &::message::_Error_manager_default_instance_);
+}
+inline ::message::Error_manager* UnNormalized_module_statu_msg::release_statu_code() {
+  // @@protoc_insertion_point(field_release:message.UnNormalized_module_statu_msg.statu_code)
+  clear_has_statu_code();
+  ::message::Error_manager* temp = statu_code_;
+  statu_code_ = NULL;
+  return temp;
+}
+inline ::message::Error_manager* UnNormalized_module_statu_msg::mutable_statu_code() {
+  set_has_statu_code();
+  if (statu_code_ == NULL) {
+    statu_code_ = new ::message::Error_manager;
+  }
+  // @@protoc_insertion_point(field_mutable:message.UnNormalized_module_statu_msg.statu_code)
+  return statu_code_;
+}
+inline void UnNormalized_module_statu_msg::set_allocated_statu_code(::message::Error_manager* statu_code) {
+  ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
+  if (message_arena == NULL) {
+    delete reinterpret_cast< ::google::protobuf::MessageLite*>(statu_code_);
+  }
+  if (statu_code) {
+    ::google::protobuf::Arena* submessage_arena = NULL;
+    if (message_arena != submessage_arena) {
+      statu_code = ::google::protobuf::internal::GetOwnedMessage(
+          message_arena, statu_code, submessage_arena);
+    }
+    set_has_statu_code();
+  } else {
+    clear_has_statu_code();
+  }
+  statu_code_ = statu_code;
+  // @@protoc_insertion_point(field_set_allocated:message.UnNormalized_module_statu_msg.statu_code)
+}
+
+// optional string car_license = 4;
+inline bool UnNormalized_module_statu_msg::has_car_license() const {
+  return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void UnNormalized_module_statu_msg::set_has_car_license() {
+  _has_bits_[0] |= 0x00000001u;
+}
+inline void UnNormalized_module_statu_msg::clear_has_car_license() {
+  _has_bits_[0] &= ~0x00000001u;
+}
+inline void UnNormalized_module_statu_msg::clear_car_license() {
+  car_license_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  clear_has_car_license();
+}
+inline const ::std::string& UnNormalized_module_statu_msg::car_license() const {
+  // @@protoc_insertion_point(field_get:message.UnNormalized_module_statu_msg.car_license)
+  return car_license_.GetNoArena();
+}
+inline void UnNormalized_module_statu_msg::set_car_license(const ::std::string& value) {
+  set_has_car_license();
+  car_license_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+  // @@protoc_insertion_point(field_set:message.UnNormalized_module_statu_msg.car_license)
+}
+#if LANG_CXX11
+inline void UnNormalized_module_statu_msg::set_car_license(::std::string&& value) {
+  set_has_car_license();
+  car_license_.SetNoArena(
+    &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+  // @@protoc_insertion_point(field_set_rvalue:message.UnNormalized_module_statu_msg.car_license)
+}
+#endif
+inline void UnNormalized_module_statu_msg::set_car_license(const char* value) {
+  GOOGLE_DCHECK(value != NULL);
+  set_has_car_license();
+  car_license_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+  // @@protoc_insertion_point(field_set_char:message.UnNormalized_module_statu_msg.car_license)
+}
+inline void UnNormalized_module_statu_msg::set_car_license(const char* value, size_t size) {
+  set_has_car_license();
+  car_license_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+      ::std::string(reinterpret_cast<const char*>(value), size));
+  // @@protoc_insertion_point(field_set_pointer:message.UnNormalized_module_statu_msg.car_license)
+}
+inline ::std::string* UnNormalized_module_statu_msg::mutable_car_license() {
+  set_has_car_license();
+  // @@protoc_insertion_point(field_mutable:message.UnNormalized_module_statu_msg.car_license)
+  return car_license_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+inline ::std::string* UnNormalized_module_statu_msg::release_car_license() {
+  // @@protoc_insertion_point(field_release:message.UnNormalized_module_statu_msg.car_license)
+  clear_has_car_license();
+  return car_license_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+inline void UnNormalized_module_statu_msg::set_allocated_car_license(::std::string* car_license) {
+  if (car_license != NULL) {
+    set_has_car_license();
+  } else {
+    clear_has_car_license();
+  }
+  car_license_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), car_license);
+  // @@protoc_insertion_point(field_set_allocated:message.UnNormalized_module_statu_msg.car_license)
+}
+
+#ifdef __GNUC__
+  #pragma GCC diagnostic pop
+#endif  // __GNUC__
+
+// @@protoc_insertion_point(namespace_scope)
+
+}  // namespace message
+
+// @@protoc_insertion_point(global_scope)
+
+#endif  // PROTOBUF_UnNormalized_5fmodule_5fmessage_2eproto__INCLUDED

+ 11 - 0
message/UnNormalized_module_message.proto

@@ -0,0 +1,11 @@
+syntax = "proto2";
+ package message;
+ import "message_base.proto";
+ //地面定位模块测量结果 
+message UnNormalized_module_statu_msg
+ {
+	required Base_info base_info=1; //消息类型 
+	required Id_struct   id_struct=2; 
+	required Error_manager statu_code=3; //模块状态 
+	optional string car_license=4; //号牌数据 
+}

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1925 - 0
message/central_control_message.pb.cc


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1273 - 0
message/central_control_message.pb.h


+ 56 - 0
message/central_control_message.proto

@@ -0,0 +1,56 @@
+syntax = "proto2";
+package message;
+import "message_base.proto";
+
+
+//针对流程的手动操作类型
+enum Process_operation_type
+{
+    eManual_cancel=0;                   //取消流程
+    eManual_retry=1;                    //重试
+    eManual_ignore=2;                   //忽略
+}
+
+enum Module_statu
+{
+    eConnected=0;               //连接
+    eDisconnected=1;            //连接丢失
+    eFault=2;                   //故障
+}
+
+//出入口状态
+message Entrance_statu
+{
+    required    bool                paused=1;
+    optional    Module_statu        parkspace_statu=2;
+    optional    Module_statu        dispatch_statu=3;
+    optional    Module_statu        notify_statu=4;
+}
+
+//中控状态消息
+message Central_controller_statu_msg
+{
+    required Base_info                  base_info=1;                 //消息类型
+    repeated Entrance_statu             entrance_statu_vector=2;    //入口状态(关闭或者开放)
+    repeated Entrance_statu             export_statu_vector=3;      //出口状态
+}
+
+//出入口手动急停/启动消息
+message Entrance_manual_operation_msg
+{
+    required Base_info                  base_info=1;
+    required Id_struct                  id_struct=2;
+    required Process_type               process_type=3;
+    required bool                       paused=4;           //是否急停
+}
+
+//流程手动操作消息
+message Process_manual_operation_msg
+{
+    required Base_info                  base_info=1;
+    required string                     license=2;
+    required Step_type                  step_type=3;
+    required Process_operation_type     operate_type=4;
+}
+
+

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 2821 - 0
message/dispatch_control.pb.cc


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 2085 - 0
message/dispatch_control.pb.h


+ 209 - 0
message/dispatch_control.proto

@@ -0,0 +1,209 @@
+syntax = "proto2";
+package message;
+import "message_base.proto";
+
+
+//调度任务的类型
+enum Dispatch_task_type
+{
+    DISPATCH_TASK_TYPE_UNKNOW               = 0;
+
+    DISPATCH_PLAN_STORE                     = 101;  //总指令, 存车
+    DISPATCH_PLAN_PICKUP                    = 102;  //总指令, 取车
+
+
+    //机器手的动作
+    ROBOT_CATCH_CAR_FROM_INLET              = 1;    //机器手去入口抓车(例如:机器手移动到2号入口上方,然后下降到一楼抓车,最后上升到最上方)
+    ROBOT_PUT_CAR_TO_CARRIER                = 2;    //机器手把车放到中跑车上面(例如:机器手下降到中跑车上放车,最后上升到最上方)(通过目标点 指定放到哪一个中跑车上)
+    ROBOT_CATCH_CAR_FROM_CARRIER            = 3;    //机器手去中跑车上抓车(例如:机器手移动到1号中跑车上方,然后下降到中跑车抓车,最后上升到最上方)
+    ROBOT_PUT_CAR_TO_OUTLET                 = 4;    //机器手去出口放车(例如:机器手移动到3号出口上方,然后下降到一楼放车,最后上升到最上方)
+    ROBOT_MOVE                              = 5;    //机器手的自由移动(例如:机器手移动到6号出入口的上方4楼处,给其他设备避让)(不进行抓车和放车的操作)
+
+    //搬运器的动作(升降电梯 中跑车 小跑车 三合一为搬运器)
+    CARRIER_RECEIVE_CAR_FROM_ROBOT          = 11;   //搬运器从机器手上接车(例如:搬运器移动到2号入口的上方,然后等待机器手把车放到中跑车上,小跑车保持松夹杆状态)
+    CARRIER_STORE_CAR_TO_PARKINGSPACE       = 12;   //搬运器把车存到停车位上(例如:小跑车夹车后,搬运器移动到56号停车位,然后小跑车将车存入车位,之后搬运器退回至电梯井)
+    CARRIER_STORE_CAR_TO_PARKINGSPACE_EX    = 122;   //搬运器把车存到停车位上(例如:小跑车夹车后,搬运器移动到56号停车位,然后小跑车将车存入车位,之后搬运器退回至56车位外面即可)
+
+    CARRIER_PICKUP_CAR_FROM_PARKINGSPACE    = 13;   //搬运器从停车位上取车(例如:搬运器移动到56号停车位,然后小跑车将车从车位取出,之后搬运器退回至电梯井)
+    CARRIER_PICKUP_CAR_FROM_PARKINGSPACE_EX = 133;   //搬运器从停车位上取车(例如:搬运器移动到56号停车位,然后小跑车将车从车位取出,之后搬运器退回至56车位外面即可)
+    CARRIER_DELIVER_CAR_TO_ROBOT            = 14;   //搬运器把车交付给机器手(例如:搬运器移动到3号入口的上方,小跑车松夹杆,然后等待机器手把车从中跑车上取走)
+    CARRIER_MOVE                            = 15;   //搬运器的自由移动(可以提前到2楼来准备接车,或者为了避让就退回至电梯井)(小跑车不进行取车和存车)
+
+    //通道口的动作(1楼出入口的动作)
+    PASSAGEWAY_OPEN_OUTSIDE_DOOR            = 21;   //通道口开外侧大门(0~7号出入口都有)
+    PASSAGEWAY_CLOSE_OUTSIDE_DOOR           = 22;   //通道口关外侧大门(0~7号出入口都有)
+    PASSAGEWAY_OPEN_INSIDE_DOOR             = 23;   //通道口开内侧大门(0号和7号出入口特有的指令)
+    PASSAGEWAY_CLOSE_INSIDE_DOOR            = 24;   //通道口关内侧大门(0号和7号出入口特有的指令)
+    PASSAGEWAY_ROTATE_TURNTABLE_TO_CARRIER  = 25;   //通道口旋转转盘到搬运器(对接小跑车)
+    PASSAGEWAY_ROTATE_TURNTABLE_TO_OUTLET   = 26;   //通道口旋转转盘到出口
+
+    //结束指令
+    DISPATCH_FINISH                         = 30;   //整个调度流程完成, 正常完成(之后调度向总控汇报 正常完成任务)
+    DISPATCH_CANCEL                         = 31;   //整个调度流程取消, 异常完成(之后调度向总控汇报 异常完成任务, 并把错误码往上报)
+    DISPATCH_PAUSE                          = 40;   //调度暂停, 可以指定某一个设备暂时 停止动作,直接进入空闲状态(之后再次发送上面的正常指令,可以让其执行新的动作)
+    DISPATCH_RESERVED                       = 50;   //预留
+
+    //存车顺序  (1和15) ->11->2->12
+    //1~6取车顺序  13-> (14和5) ->3->15->4
+    //7取车顺序    13->12
+
+    //3楼存车  (5和15) ->1->15 -> (5和11) ->2->12
+    //3楼取车  (5和15) ->13->14->3-> (15和5) ->4->15
+
+    //例如:机器手和3楼搬运器在2号入口上方, 执行存车指令 4号入口 -> 3楼27号车位.
+    //同时抢占  搬运器和机器手的资源
+    //5和15      机器手去1404  搬运器去1303
+    //1         机器手去1104抓车, 并返回最高点
+    //15        搬运器去1304
+    //5和11     机器手去42    搬运器去27准备接车
+    //2         机器手把车放到中跑车上27
+    //12        搬运器把车存入27号车位
+    //同时释放  搬运器和机器手的资源
+
+    //例如:机器手和3楼搬运器在2号入口上方, 执行取车指令 3楼27号车位 -> 4号出口.
+    //同时抢占  搬运器和机器手的资源
+    //5和15      机器手去42  搬运器去27
+    //13        搬运器去27号车位取车
+    //14        搬运器去27号车位 把车交给机器手
+    //3         机器手去27号 抓车
+    //5和15      机器手去1404  搬运器去1305
+    //4         机器手把车放到1104出口, 并返回最高点
+    //15        搬运器去1304
+    //同时释放  搬运器和机器手的资源
+}
+
+
+
+//调度设备的目标状态, 设备完成 调度控制的任务请求 之后 将设备状态改为这个
+enum Dispatch_device_target_status
+{
+    E_TARGET_STATUS_UNKNOW               	= 0;    //未知
+    E_TARGET_STATUS_IDLE                    = 1;    //空闲
+    E_TARGET_STATUS_BUSY					= 2; 	//工作正忙
+    E_TARGET_STATUS_READY               	= 3;    //准备就绪
+    E_TARGET_STATUS_WAIT               	    = 4;    //等待
+}
+
+//调度设备的任务状态
+enum Dispatch_device_task_status
+{
+        E_TASK_CREATED              = 0;      		//任务创建; 发送方
+
+        E_TASK_ISSUE		        = 1; 			//任务下发; 发送方
+        E_TASK_SIGNED               = 2;      		//已签收; 接收方
+        E_TASK_WORKING              = 3;      		//处理中; 接收方
+        E_TASK_OVER                 = 4;   			//已结束; 接收方
+        E_TASK_STOP		            = 5; 			//任务暂停; 接收方
+
+    	E_TASK_ERROR                = 11;			//任务错误; 接收方
+
+    	E_TASK_CANCEL				= 21;			//任务取消; 发送方
+    	E_TASK_DEAD                 = 22;           //任务死亡; 接收方
+
+    	E_TASK_WITHDRAW		        = 31; 			//任务收回; 发送方
+    	E_TASK_FREE			        = 32; 			//任务释放; 接收方
+
+
+     //发送方 写 E_TASK_CREATED
+     //接收方 收到之后 写 E_TASK_WORKING
+     //接受方每隔1秒 周期性反馈消息
+     //接受方完成任务后, 最后一次发送 E_TASK_OVER
+}
+
+
+
+//调度总规划的请求, 用于启动整个调度算法(调度管理->调度算法)
+message Dispatch_plan_request_msg
+{
+    required Base_info                  base_info=1;                     //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+
+    optional Dispatch_task_type         dispatch_task_type=3;            //调度任务的类型
+    optional int32                      dispatch_source=4;               //调度的起点,源头(暂时不写)(留给以后使用)
+    optional int32                      dispatch_destination=5;          //调度的终点,目的地(一般必须写, 特殊指令可以不写)
+
+    optional Error_manager              error_manager = 6;               //错误码,也是任务的完成结果(如果为0,则表示成功完成任务,非0则任务失败)
+}
+
+//调度总规划的答复(调度算法->调度管理)
+message Dispatch_plan_response_msg
+{
+    required Base_info                  base_info=1;                    //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+
+    optional Dispatch_task_type         dispatch_task_type=3;            //调度任务的类型
+    optional int32                      dispatch_source=4;               //调度的起点,源头(可以不写)
+    optional int32                      dispatch_destination=5;          //调度的终点,目的地(必写,如果不写 任务就不会执行)
+
+    optional Error_manager              error_manager = 6;               //错误码,也是任务的完成结果(如果为0,则表示成功完成任务,非0则任务失败)
+}
+
+//调度控制的任务请求(调度算法->调度管理)
+message Dispatch_control_request_msg
+{
+    required Base_info                  base_info=1;                     //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+
+    required Dispatch_task_type         dispatch_task_type=3;            //调度任务的类型
+    optional Dispatch_device_type       dispatch_device_type=4;          //调度设备的类型
+    optional int32                      dispatch_source=5;               //调度的起点,源头(暂时不写)(留给以后使用)
+    optional int32                      dispatch_destination=6;          //调度的终点,目的地(一般必须写, 特殊指令可以不写)
+
+    optional Error_manager              error_manager = 7;               //错误码,也是任务的完成结果(如果为0,则表示成功完成任务,非0则任务失败)
+
+    optional Dispatch_device_target_status  dispatch_device_target_status = 8;  //调度设备的目标状态
+
+    optional Dispatch_device_task_status    dispatch_device_task_status = 9;//调度设备的任务状态
+}
+
+//调度控制的任务答复(调度管理->调度算法)
+message Dispatch_control_response_msg
+{
+    required Base_info                  base_info=1;                     //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+
+    optional Dispatch_task_type         dispatch_task_type=3;            //调度任务的类型
+    optional Dispatch_device_type       dispatch_device_type=4;          //调度设备
+    optional int32                      dispatch_source=5;               //调度的起点,源头(可以不写)
+    optional int32                      dispatch_destination=6;          //调度的终DISPATCH_FINISH点,目的地(必写,如果不写 任务就不会执行)
+
+    optional Error_manager              error_manager = 7;               //错误码,也是任务的完成结果(如果为0,则表示成功完成任务,非0则任务失败)
+
+    optional Dispatch_device_target_status  dispatch_device_target_status = 8;  //调度设备的目标状态
+    optional Dispatch_device_task_status    dispatch_device_task_status = 9;//调度设备的任务状态
+
+}
+
+
+/*
+        dispatch_source 和 dispatch_destination 的表示含义
+
+        1~165           2楼~12楼的停车位
+
+        1100            0号出口(在一楼)(目前没有)
+        1101~1106       1~6号出入口 (在一楼)
+        1107            7号出口(在一楼)
+        1201~1206       1~6号出入口上方2楼处
+        1301~1306       1~6号出入口上方3楼处
+        1401~1406       1~6号出入口上方4楼处
+
+        2101~2112       左侧电梯井(1楼~12楼)(一号搬运器的待机点)
+        2201~2212       右侧电梯井(1楼~12楼)(二号搬运器的待机点)
+*/
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 7461 - 0
message/dispatch_message.pb.cc


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 5829 - 0
message/dispatch_message.pb.h


+ 348 - 0
message/dispatch_message.proto

@@ -0,0 +1,348 @@
+syntax = "proto2";
+package message;
+import "message_base.proto";
+
+
+
+//终端流程状态, 表示这个出入口到楼上停车位之间的所有设备总状态
+enum Terminal_status
+{
+    E_TERMINAL_UNKNOW               = 0;     //未知
+    E_TERMINAL_READY                = 1;     //准备,待机
+    E_TERMINAL_STORE                = 2;	    //正在存车
+    E_TERMINAL_PICKUP               = 3;	    //正在取车
+
+    E_TERMINAL_FAULT                = 10;     //故障
+}
+
+//通道口属性, 出入口的方向属性, 表示这个通道允许停车或者取车
+enum Passageway_direction
+{
+    E_INLET             =0;         //入口
+    E_OUTLET            =1;         //出口
+    E_BILATERAL         =2;         //双向口
+}
+
+
+
+//调度流程状态
+enum Dispatch_process_status
+{
+    E_DISPATCH_POCESS_UNKNOW                = 0;     //未知
+    E_DISPATCH_POCESS_WAIT                  = 1;     //等待
+    E_DISPATCH_POCESS_WORKING               = 2;     //工作
+    E_DISPATCH_POCESS_OVER                  = 3;     //完成
+
+    E_DISPATCH_POCESS_FAULT                 = 100;     //故障
+}
+
+//调度流程信息
+message Dispatch_process_information
+{
+    optional string                     car_numberPlate=1;					    //车牌号
+    optional string                     command_key=2;                          //指令唯一标识符id
+    optional Dispatch_motion_direction  dispatch_motion_direction=3;            //调度方向, 停车取车
+    optional Id_struct                  id_struct=4;                            //id
+    optional Locate_information         locate_information=5;                   //汽车测量信息, 只有停车时有数据, 取车时没有数据.
+    repeated Parkspace_info             parkspace_info_ex=6;                    //车位编号, 停车位(B方案, 分配3个停车位)
+    optional Car_type                   car_type=7;                             //汽车大小
+
+    optional Dispatch_process_status    dispatch_process_status=8;              //调度流程状态
+    optional int32                      m_wait_number=9;                        //只有等待才有等待编号
+}
+
+//调度模块终端出入口的状态
+message Dispatch_terminal_status_msg
+{
+    required Base_info                  base_info=1;                    //消息类型
+    optional Id_struct                  id_struct=2;                    //id
+    required Terminal_status            terminal_status = 3;            //终端流程状态, 表示这个出入口到楼上停车位之间的所有设备总状态
+    required Passageway_direction       passageway_direction = 4;       //通道口属性, 出入口的方向属性, 表示这个通道允许停车或者取车
+
+    repeated Dispatch_process_information   dispatch_store_process_information_vector = 5;                          //
+    optional string                         dispatch_store_process_information_updata_time=6;                        //
+    repeated Dispatch_process_information   dispatch_pickup_process_information_vector = 7;                         //
+    optional string                         dispatch_pickup_process_information_updata_time=8;                        //
+}
+
+//调度方向, 停车取车, 表示正在执行的动作
+enum Dispatch_motion_direction
+{
+    E_STORE_CAR             =0;         //停车, 出入口 -> 停车位
+    E_PICKUP_CAR            =1;         //取车, 停车位 -> 出入口
+}
+
+
+
+//执行搬运请求(主控->调度管理)
+message Dispatch_request_msg
+{
+    required Base_info                  base_info=1;                            //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+
+    optional Dispatch_motion_direction  dispatch_motion_direction=3;            //调度方向, 停车取车
+    optional Id_struct                  id_struct=4;                              //id
+    optional Locate_information         locate_information=5;                   //汽车测量信息, 只有停车时有数据, 取车时没有数据.
+
+    repeated Parkspace_info             parkspace_info_ex=6;                         //车位编号, 停车位(B方案, 分配3个停车位)
+    optional Car_type                   car_type=7;                             //汽车大小
+}
+
+//搬运动作执行完成后反馈结果(调度管理->主控)
+message Dispatch_response_msg
+{
+    required Base_info                  base_info=1;                    //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+
+    optional Dispatch_motion_direction  dispatch_motion_direction=3;            //调度方向, 停车取车
+    optional Id_struct                  id_struct=4;                              //id
+    optional Locate_information         locate_information=5;                   //汽车测量信息, 只有停车时有数据, 取车时没有数据.
+
+    repeated Parkspace_info             parkspace_info_ex=6;                         //车位编号, 停车位(B方案, 分配3个停车位)
+    optional Car_type                   car_type=7;                             //汽车大小
+
+    optional Error_manager              error_manager = 8;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+//调度管理 的状态
+enum Dispatch_manager_status
+{
+    E_DISPATCH_MANAGER_UNKNOW               = 0;    //未知
+    E_DISPATCH_MANAGER_READY                = 1;    //准备,待机
+    E_DISPATCH_MANAGER_STORE                = 2;    //正在存车
+    E_DISPATCH_MANAGER_PICKUP               = 3;    //正在取车
+
+    E_DISPATCH_MANAGER_FAULT               = 100;    //故障
+}
+
+//设备状态,这个类的总状态,这里指工作任务流程
+	enum Dispatch_device_status
+	{
+	    DISPATCH_DEVICE_UNKNOW               	= 0;    //未知
+    	DISPATCH_DEVICE_READY               	= 1;    //准备,待机
+    	DISPATCH_DEVICE_BUSY					= 2; 	//工作正忙
+
+    	DISPATCH_DEVICE_ONE_LEVEL_OVER		= 3; 	//一级工作完成;
+    	DISPATCH_DEVICE_ONE_LEVEL_WORK		= 4;	//一级工作状态; 就是普通的移动任务
+    	DISPATCH_DEVICE_TWO_LEVEL_OVER		= 5; 	//一级工作完成;
+    	DISPATCH_DEVICE_TWO_LEVEL_WORK		= 6;	//二级工作状态; 就是紧急避让; 插队任务(会在执行一级任务的过程中; 插队并优先执行二级任务)
+    	DISPATCH_DEVICE_THREE_LEVEL_OVER		= 7; 	//一级工作完成;
+    	DISPATCH_DEVICE_THREE_LEVEL_WORK		= 8;	//三级工作任务; 就是锁定硬件资源; 不让插队; (除非急停或者取消任务)
+
+       	DISPATCH_DEVICE_FAULT					= 100;	//故障
+    	DISPATCH_DEVICE_DISCONNECT			= 101; 	//通信故障
+	};
+
+	//调度任务的等级
+	enum Dispatch_task_level
+	{
+//	    DISPATCH_TASK_UNKNOW_LEVEL          = 0;    //无效任务
+		DISPATCH_TASK_ONE_LEVEL             = 1;    //一级任务
+		DISPATCH_TASK_TWO_LEVEL				= 2;	//二级任务
+		DISPATCH_TASK_THREE_LEVEL			= 3;	//三级任务
+	};
+
+	//抓车的夹杆
+	enum Clamp_motion
+	{
+		E_CLAMP_NO_ACTION            	= 0;    //无动作.
+		E_CLAMP_TIGHT               	= 1;    //夹紧夹杆
+		E_CLAMP_LOOSE					= 2;	//松开夹杆
+	};
+
+	//中跑车和平层轨道的对接
+	enum Joint_motion
+	{
+		E_JOINT_NO_ACTION            	= 0;    //无动作.
+		E_JOINT_HOLD_OUT               	= 1;    //伸出对接,之后中跑车可以x轴移动,电梯不能Z轴移动
+		E_JOINT_TAKE_BACK				= 2;	//收回对接,之后中跑车固定在电梯上不能X轴移动,电梯可以Z轴移动
+	};
+
+	//小跑车的位置,是否在中跑车上面
+	enum Small_sports_car_motion
+	{
+		E_SMALL_SPORTS_NO_ACTION		= 0;    //无动作.
+		E_SMALL_SPORTS_CAR_GET_AWAY 	= 1;    //小跑车离开中跑车
+		E_SMALL_SPORTS_CAR_GET_BACK		= 2;	//小跑车返回中跑车
+	};
+
+
+	//指令完成状态, 设备答复指令, 返回任务完成的情况
+	enum Respons_status
+	{
+		RESPONS_WORKING            	= 0;    //任务进行中
+		RESPONS_OVER               	= 1;    //任务完成
+		RESPONS_MINOR_ERROR			= 100;	//一般故障, 可恢复
+		RESPONS_CRITICAL_ERROR		= 101;	//致命故障,不可恢复
+	};
+
+	//设备的硬件设备状态
+	enum Hardware_device_status
+	{
+		DEVICE_UNKNOWN              = 0;    //设备未知
+		DEVICE_READY                = 1;    //设备空闲(可以接受新的指令任务)
+		DEVICE_WORKING				= 2;	//设备工作中
+		DEVICE_EMERGENCY_STOP		= 3;	//设备急停
+		DEVICE_UNSAFETY				= 4;	//设备不安全(暂时不考虑是否处于安全位置)
+		DEVICE_COLLISION			= 5;	//设备发生碰撞
+		DEVICE_FAULT				= 6;	//设备故障
+	};
+
+	//设备的负载状态, 小跑车上面是否有车.
+	enum Load_status
+	{
+		LOAD_UNKNOWN				= 0;	//负载未知
+		HAVE_CAR               		= 1;    //有车
+		NO_CAR            			= 2;    //没车
+	};
+
+	//7号出口 转台方向
+	enum Turntable_direction
+	{
+		TURNTABLE_DIRECTION_UNKNOWN				= 0;	//方向未知,
+		TURNTABLE_DIRECTION_INSIDE 				= 1;    //方向朝里,对接内门的小跑车
+		TURNTABLE_DIRECTION_OUTSIDE  			= 2;    //没车朝外,对接外门的出口
+	};
+
+	//出入口 门的开关状态
+	enum Door_motion
+	{
+		DOOR_UNKNOWN            = 0;    //门的开关状态 未知, 或者工作到一半,正在工作中.
+	    DOOR_OPEN               = 1;    //开门
+		DOOR_CLOSE				= 2;	//关门
+		DOOR_ERROR				= 3;	//
+	};
+
+	//边界判断,是否超界
+	enum Overstep_the_boundary
+	{
+		BOUNDARY_NORMAL			= 0;	//边界 正常
+		BOUNDARY_OVERSTEP       = 1;    //超界
+	};
+
+
+
+
+//抓取器的状态(机器手)
+message Catcher_data
+{
+    required Dispatch_device_type               dispatch_device_type=1;         //调度设备的类型
+    required Dispatch_device_status             dispatch_device_status=2;       //设备总状态, 控制任务流程(长流程)
+
+    required int32                              device_id=3;                    //设备id,
+	optional Hardware_device_status				actual_device_status=4;			//机器人的硬件设备状态(短流程)
+	optional Load_status						actual_load_status=5;	        //机器人的负载状态, 机器人上面是否有车.
+
+    optional int32 								actual_coordinates_id=6;		//机器人真实 空间位置的id.
+	optional float 								actual_x=7;					    //机器人坐标x轴,
+	optional float 								actual_y=8;					    //机器人坐标y轴,
+	optional float 								actual_b=9;					    //机器人坐标b轴, 旋转范围80~280
+	optional float 								actual_z=10;				    //机器人坐标z轴,
+	optional float 								actual_d1=11;				    //机器人坐标d1轴, 机器人抓车杆纵向移动(前轮抓杆)
+	optional float 								actual_d2=12;				    //机器人坐标d2轴, 机器人抓车杆纵向移动(后轮抓杆)
+	optional Clamp_motion						actual_clamp_motion1=13;		//机器人夹车杆. 0=无动作,1=夹紧,2=松开
+	optional Clamp_motion						actual_clamp_motion2=14;		//机器人夹车杆. 0=无动作,1=夹紧,2=松开
+	optional Clamp_motion						actual_clamp_motion3=15;		//机器人夹车杆. 0=无动作,1=夹紧,2=松开
+	optional Clamp_motion						actual_clamp_motion4=16;		//机器人夹车杆. 0=无动作,1=夹紧,2=松开
+
+    optional string                             actual_error_code=17;	        //机器人设备的故障信息位
+    optional string                             actual_warning_code=18;     	//机器人设备的警告信息位
+    optional string							    actual_error_description=19;    //机器人设备的错误描述
+}
+
+//搬运器的状态
+message Carrier_data
+{
+    required Dispatch_device_type               dispatch_device_type=1;         //调度设备的类型
+    required Dispatch_device_status             dispatch_device_status=2;       //设备总状态, 控制任务流程(长流程)
+
+    required int32                              device_id=3;                    //设备id,
+	optional Hardware_device_status				actual_device_status=4;			//搬运器的硬件设备状态(短流程)
+	optional Load_status						actual_load_status=5;	        //搬运器的负载状态, 小跑车上面是否有车.
+
+    optional int32 								actual_coordinates_id=6;	    //搬运器真实 空间位置的id.
+	optional float 								actual_x=7;					    //搬运器坐标x轴, 中跑车控制横向移动
+	optional float 								actual_y=8;					    //搬运器坐标y轴, 小跑车控制纵向移动
+	optional float 								actual_z=9;					    //搬运器坐标z轴, 电梯控制上下移动
+	optional float 								actual_y1=10;				        //搬运器坐标y1轴, 小跑车控制纵向移动(前轮抓杆)
+	optional float 								actual_y2=11;				        //搬运器坐标y2轴, 小跑车控制纵向移动(后轮抓杆)
+	optional Clamp_motion						actual_clamp_motion1=12;		    //小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+	optional Clamp_motion						actual_clamp_motion2=13;		    //小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+	optional Small_sports_car_motion			actual_small_sports_car_motion=14;	//小跑车的位置,是否在中跑车上面, 0=无动作,1=出发到位,2=返回到位
+	optional Joint_motion						actual_joint_motion_x1=15;		    //电梯与X轴的横向轨道对接,0=无动作,1=伸出到位,2=收回到位
+	optional Joint_motion						actual_joint_motion_x2=16;		    //电梯与X轴的横向轨道对接,0=无动作,1=伸出到位,2=收回到位
+
+    optional string                             actual_error_code=17;	        //搬运器设备的故障信息位
+    optional string                             actual_warning_code=18;	        //搬运器设备的警告信息位
+    optional string							    actual_error_description=19;    //搬运器设备的错误描述
+}
+
+//出入口的状态
+message Passageway_data
+{
+    required Dispatch_device_type               dispatch_device_type=1;         //调度设备的类型
+    required Dispatch_device_status             dispatch_device_status=2;       //设备总状态, 控制任务流程(长流程)
+
+    required int32                              device_id=3;                    //设备id,
+    //通道口的设备状态数据,
+	optional Hardware_device_status				actual_device_status=4;			//通道口的硬件设备状态(短流程)
+	optional Load_status						actual_inside_load_status=5;	        //通道口的内部负载状态, 门内地感是否有车.
+	optional Load_status						actual_outside_load_status=6;	        //通道口的外部负载状态, 门外地感是否有车.
+	optional Overstep_the_boundary				actual_front_overstep_the_boundary=7;	//通道口 汽车前边界
+	optional Overstep_the_boundary				actual_back_overstep_the_boundary=8;	//通道口 汽车后边界
+	optional Overstep_the_boundary				actual_height_overstep_the_boundary=9;	//通道口 车辆是否超高
+	optional Load_status						actual_outside_door_sensor=10;	//通道口 的外门处的传感器, 判断是否有车经过外门
+	//通道口的真实状态, 可能是路径中间的坐标
+    optional Door_motion						actual_inside_door_motion=11;	//通道口 内门动作
+	optional Door_motion						actual_outside_door_motion=12;	//通道口 外门动作
+	optional Load_status						actual_turntable_load_status=13;	//通道口 转盘负载状态, 是否有车.
+	optional Turntable_direction				actual_turntable_direction=14;	//通道口 转台方向
+
+    optional string                             actual_error_code=15;	        //通道口设备的故障信息位
+    optional string                             actual_warning_code=16;	        //通道口设备的警告信息位
+    optional string							    actual_error_description=17;    //通道口设备的错误描述
+}
+
+
+//调度管理总管理的状态
+message Dispatch_manager_status_msg
+{
+    required Base_info                  base_info=1;                    //消息类型
+
+    required int32                      dispatch_id=2;                  //调度管理模块 id
+    required Dispatch_manager_status    dispatch_manager_status = 3;    //调度管理模块 状态
+
+    repeated Catcher_data               catcher_data_map = 4;           //机器手的数据
+    repeated Carrier_data               carrier_data_map = 5;           //搬运器的数据
+    repeated Passageway_data            passageway_data_map = 6;           //出入口的数据
+
+}
+
+
+
+
+
+//调度管理的设备详细的数据信息
+message Dispatch_manager_data_msg
+{
+    //后续再加
+}
+
+
+
+

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 2671 - 0
message/log_process.pb.cc


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1754 - 0
message/log_process.pb.h


+ 59 - 0
message/log_process.proto

@@ -0,0 +1,59 @@
+syntax = "proto2";
+package message;
+import "message_base.proto";
+import "parkspace_allocation_message.proto";    //数据库消息
+import "measure_message.proto";                 //测量消息
+import "dispatch_message.proto";                //调度消息
+import "central_control_message.proto";         //手动操作消息
+
+
+//与节点通讯数据,请求反馈数据
+message Node_log
+{
+    oneof   request{
+        Parkspace_allocation_request_msg    alloc_request=1;
+        Parkspace_search_request_msg        search_request=3;
+        Parkspace_release_request_msg       release_request=5;
+        Parkspace_confirm_alloc_request_msg     confirm_request=7;
+        Measure_request_msg                 measure_request=9;
+        Dispatch_request_msg                dispatch_request=11;
+    }
+    oneof   response{
+        Parkspace_allocation_response_msg   alloc_response=2;
+        Parkspace_search_response_msg       search_response=4;
+        Parkspace_release_response_msg      release_response=6;
+        Parkspace_confirm_alloc_response_msg    confirm_response=8;
+        Measure_response_msg                measure_response=10;
+        Dispatch_response_msg               dispatch_response=12;
+    }
+    optional string         description=13;
+}
+
+//手动操作数据
+message Manual_operation_log
+{
+    required    Process_manual_operation_msg        manual_operation=1;
+    optional    string                              description=2;
+}
+
+message Log_data
+{
+    enum Severity
+    {
+        INFO=0;
+        WARNING=1;
+        ERROR=2;
+    }
+    required Severity      log_severity=1;
+    oneof    data               {
+            string          str_log=2;
+            Node_log        node_log=3;
+            Manual_operation_log    manual_operator_log=4;
+    }
+}
+
+message Process_log
+{
+    required Process_type       process_type=1;
+    repeated Log_data           log_data=2;
+}

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 5540 - 0
message/measure_message.pb.cc


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 4015 - 0
message/measure_message.pb.h


+ 187 - 0
message/measure_message.proto

@@ -0,0 +1,187 @@
+syntax = "proto2";
+package message;
+import "message_base.proto";
+
+//雷达管理模块的工作状态
+enum Laser_manager_status
+{
+    LASER_MANAGER_UNKNOW               	= 0;    //未知
+    LASER_MANAGER_READY               	= 1;    //准备,待机
+	LASER_MANAGER_ISSUED_TASK			= 2;	//工作下发任务
+	LASER_MANAGER_WAIT_REPLY			= 3;	//工作等待答复
+	LASER_MANAGER_FAULT					= 4;	//故障
+}
+	
+//子雷达状态
+enum Laser_statu
+{
+	LASER_DISCONNECT	=0;	        //雷达断连
+	LASER_READY			=1;			//雷达正常待机,空闲
+	LASER_BUSY			=2;	        //雷达正在工作,正忙
+	LASER_FAULT			=3;         //雷达错误
+}
+
+//定位管理模块的工作状态
+enum Locate_manager_status
+{
+	LOCATE_MANAGER_UNKNOW               	= 0;    //未知
+	LOCATE_MANAGER_READY               		= 1;    //准备,待机
+	LOCATE_MANAGER_SIFT						= 2;	//sift点云筛选; 将车身和轮胎的点剥离出来
+	LOCATE_MANAGER_CAR						= 3;	//通过车身 计算汽车的定位信息.
+	LOCATE_MANAGER_WHEEL					= 4;	//通过车轮 计算汽车的定位信息.
+	LOCATE_MANAGER_FAULT					= 5;	//故障
+}
+	
+
+//雷达管理的状态
+enum Wanji_manager_status
+{
+	WANJI_MANAGER_UNKNOWN              	= 0;    //未知
+	WANJI_MANAGER_READY               	= 1;    //准备,待机
+	WANJI_MANAGER_BUSY					= 2; 	//工作正忙
+
+	WANJI_MANAGER_ISSUED_SCAN			= 3; 	//下发任务; 获取点云
+	WANJI_MANAGER_WAIT_SCAN				= 4;	//等待任务; 扫描点云
+
+	WANJI_MANAGER_ISSUED_DETECT			= 5; 	//下发任务; 算法预测
+	WANJI_MANAGER_WAIT_DETECT			= 6; 	//等待任务; 算法预测
+
+	WANJI_MANAGER_FAULT					= 10;	//故障
+}
+
+//万集设备身状态
+enum Wanji_lidar_device_status
+{
+	WANJI_LIDAR_DEVICE_UNKNOWN              	= 0;    //未知
+	WANJI_LIDAR_DEVICE_READY	             	= 1;    //正常待机
+	WANJI_LIDAR_DEVICE_DISCONNECT			= 2;	//断连
+
+	WANJI_LIDAR_DEVICE_BUSY					= 3; 	//工作正忙
+
+	WANJI_LIDAR_DEVICE_FAULT					=10;	//故障
+}
+
+//万集区域功能的状态
+enum Region_worker_status
+{
+	REGION_WORKER_UNKNOWN              	= 0;    //未知
+	REGION_WORKER_READY               	= 1;    //准备,待机
+	REGION_WORKER_BUSY					= 2; 	//工作正忙
+
+	REGION_WORKER_FAULT					= 10;	//故障
+}
+
+//定位模块状态
+message Measure_status_msg
+{
+    required Base_info                  base_info=1;                 //消息类型
+    required Id_struct                      id_struct=2;
+
+    required Laser_manager_status       laser_manager_status = 3;       //大疆管理状态
+    repeated Laser_statu                laser_statu_vector = 4;         //大疆雷达设备状态
+    required Locate_manager_status      locate_manager_status = 5;      //大疆定位算法状态
+
+    required Error_manager              error_manager = 6;
+}
+
+
+//定位请求消息
+message Measure_request_msg
+{
+    required Base_info                  base_info=1;        //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+    required Id_struct                      id_struct=3;          //终端id
+}
+
+//定位测量返回消息
+message Measure_response_msg
+{
+    required Base_info                  base_info=1;                         //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+    required Id_struct                      id_struct=3;
+
+    optional Locate_information         locate_information=4;
+    required Error_manager              error_manager = 5;
+}
+
+//地面测量请求消息
+message Ground_detect_request_msg
+{
+    required Base_info                  base_info=1;        //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+    required Id_struct                      id_struct=3;          //终端id
+}
+
+//地面测量反馈消息
+message Ground_detect_response_msg
+{
+    required Base_info                  base_info=1;                     //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+    required Id_struct                      id_struct=3;
+
+    optional Locate_information         locate_information=4;
+    required Error_manager              error_manager = 5;
+}
+
+// 电子围栏状态
+enum Ground_statu
+{
+    Nothing=0;
+    Noise=1;
+    Car_correct=2;
+    Car_border_reached=3;
+}
+
+message Ground_status_msg
+{
+    required Base_info                  base_info=1;                 //消息类型
+    required Id_struct                  id_struct=2;                //终端编号结构体
+
+    required Wanji_manager_status       wanji_manager_status = 3;       //万集管理状态
+    repeated Wanji_lidar_device_status  wanji_lidar_device_status = 4;  //万集设备身状态
+    required Region_worker_status       region_worker_status = 5;       //万集区域功能的状态
+    required Locate_information         locate_information_realtime = 6;//地面雷达的 实时定位信息
+    required Ground_statu               ground_status=7; // 电子围栏状态
+    // 超界状态,为0表示正常,从末尾开始123456位分别代表前、后、左、右、底盘、车高超界
+    // 增加超宽、超轴距、左(逆时针)旋转超界,右(顺时针)旋转超界判断,分别处于7 8 9 10四个位
+    required int32               	border_status=8; 
+
+    required Error_manager              error_manager = 9;
+    repeated Cloud_coordinate           cloud=10;     //点云坐标
+}
+
+
+
+//点云坐标
+message Cloud_coordinate
+{
+    required float                      x=1;
+    required float                      y=2;
+    required float                      z=3;
+}
+//点云类型
+message Cloud_type
+{
+    required int32                      type=1;
+}
+
+//筛选点云; 请求消息
+message Locate_sift_request_msg
+{
+    required Base_info                  base_info=1;            //消息类型
+    required string                     command_key=2;          //指令唯一标识符id
+    required Id_struct					id_struct=3;          //终端id
+    required int32                      lidar_id=4;             //雷达id
+    repeated Cloud_coordinate           cloud_coordinates=5;     //点云坐标
+}
+
+//筛选点云; 答复消息
+message Locate_sift_response_msg
+{
+    required Base_info                  base_info=1;            //消息类型
+    required string                     command_key=2;          //指令唯一标识符id
+    required Id_struct					id_struct=3;          //终端id
+    required int32                      lidar_id=4;             //雷达id
+    repeated Cloud_type                 cloud_type=5;            //点云类型
+    required Error_manager              error_manager = 6;      //错误码
+}

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 4207 - 0
message/message_base.pb.cc


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 3120 - 0
message/message_base.pb.h


+ 311 - 0
message/message_base.proto

@@ -0,0 +1,311 @@
+syntax = "proto2";
+package message;
+
+//消息类型定义;每个在网络上传输的消息必须含有这个属性
+enum Message_type
+{
+    eBase_msg=0x00;
+    eCommand_msg=0x01;                      //指令消息
+
+
+    eLocate_status_msg=0x11;                //定位模块状态消息
+    eLocate_request_msg=0x12;               //定位请求消息
+    eLocate_response_msg=0x13;              //定位反馈消息
+
+    eLocate_sift_request_msg = 0x14;            //预测算法请求消息
+    eLocate_sift_response_msg = 0x15;           //预测算法反馈消息
+
+    eDispatch_status_msg=0x21;                //调度模块硬件状态消息
+    eDispatch_request_msg=0x22;              //请求调度消息
+    eDispatch_response_msg=0x23;             //调度结果反馈消息
+
+    eParkspace_allocation_status_msg=0x31;  //车位分配模块状态消息,包括车位信息
+    eParkspace_allocation_request_msg=0x32; //请求分配车位消息
+    eParkspace_allocation_response_msg=0x33;//分配车位结果反馈消息
+    eParkspace_search_request_msg = 0x34;		//查询车位请求消息
+    eParkspace_search_response_msg = 0x35;		//查询车位反馈消息
+    eParkspace_release_request_msg = 0x36;		//释放车位请求消息
+    eParkspace_release_response_msg = 0x37;		//释放车位反馈消息
+    eParkspace_force_update_request_msg = 0x38;	//手动修改车位消息
+    eParkspace_force_update_response_msg = 0x39;//手动修改车位反馈消息
+    eParkspace_confirm_alloc_request_msg = 0x3A;//确认分配车位请求消息
+    eParkspace_confirm_alloc_response_msg = 0x3B;//确认分配车位反馈消息
+    eParkspace_allocation_data_msg = 0x3C;     //车位分配模块车位数据消息
+    eParkspace_allocation_data_response_msg =0x3D;//车位数据反馈消息
+    eParkspace_manual_search_request_msg = 0x3E;	//手动查询车位请求消息
+    eParkspace_manual_search_response_msg = 0x3F;//手动查询车位反馈消息
+
+    eStore_command_request_msg=0x41;        //终端停车请求消息
+    eStore_command_response_msg=0x42;       //停车请求反馈消息
+    ePickup_command_request_msg=0x43;       //取车请求消息
+    ePickup_command_response_msg=0x44;       //取车请求反馈消息
+
+    eTerminal_status_msg = 0x50;	 //终端状态消息
+
+    eStoring_process_statu_msg=0x90;        //停车指令进度条消息
+    ePicking_process_statu_msg=0x91;        //取车指令进度消息
+
+
+    eCentral_controller_statu_msg=0xa0;     //中控系统状态消息
+
+
+    eEntrance_manual_operation_msg=0xb0;            //针对出入口状态操作的手动消息
+    eProcess_manual_operation_msg=0xb1;             //针对流程的手动消息
+
+    eNotify_request_msg=0xc0;               //取车等候区通知请求
+    eNotify_response_msg=0xc1;              //等候区反馈
+    eNotify_status_msg=0xc2;                //等候区通知节点状态
+
+    eUnNormalized_module_statu_msg = 0xd0; //非标节点状态
+
+    eDispatch_plan_request_msg          = 0xe0;     //调度总规划的请求(用于启动整个调度算法)(调度管理->调度算法)
+    eDispatch_plan_response_msg         = 0xe1;     //调度总规划的答复(调度算法->调度管理)
+    eDispatch_control_request_msg       = 0xe2;     //调度控制的任务请求(调度算法->调度管理)
+    eDispatch_control_response_msg      = 0xe3;     //调度控制的任务答复(调度管理->调度算法)
+    eDispatch_manager_status_msg        = 0xea;     //调度管理的设备状态消息(调度底下所有硬件设备状态的汇总)
+    eDispatch_manager_data_msg          = 0xeb;     //调度管理的设备详细的数据信息
+
+
+    eGround_detect_request_msg=0xf0;        //地面雷达测量请求消息
+    eGround_detect_response_msg=0xf1;       //地面雷达测量反馈消息
+    eGround_status_msg=0xf2;                //地面雷达状态消息
+
+}
+
+//通讯单元
+enum Communicator
+{
+    eEmpty=0x0000;
+    eMain=0x0001;    //主流程
+
+    eTerminor=0x0100;
+    //车位表
+    eParkspace=0x0200;
+    //测量单元
+    eMeasurer=0x0300;
+    //测量单元的服务器
+    eMeasurer_sift_server=0x0301;
+    //调度机构
+    eDispatch_manager=0x0400;
+    //调度机构
+    eDispatch_control=0x0401;
+    //...
+  //取车等候区通知节点
+    eNotify=0x0501;
+
+    //地面测量单元
+	eGround_measurer=0x0f00;
+}
+////base message 用于解析未知类型的消息
+message Base_info
+{
+    required Message_type               msg_type=1[default = eBase_msg];
+    optional int32                      timeout_ms=2[default = 0];
+    required Communicator               sender=3[default = eEmpty];                       //发送者
+    required Communicator               receiver=4[default = eEmpty];                     //接收者
+}
+
+// 事件,停车或者取车
+enum Process_type
+{
+    eStoring=1;
+    ePicking=2;
+}
+
+
+message Base_msg
+{
+    required Base_info                  base_info=1;
+}
+
+//错误等级,用来做故障处理
+enum Error_level
+{
+    NORMAL                = 0;      //    正常,没有错误,默认值0
+
+    NEGLIGIBLE_ERROR      = 1;      //    轻微故障;可忽略的故障,NEGLIGIBLE_ERROR
+
+    MINOR_ERROR           = 2;      //    一般故障,MINOR_ERROR
+
+    MAJOR_ERROR           = 3;      //    严重故障,MAJOR_ERROR
+
+    CRITICAL_ERROR        = 4;      //    致命故障,CRITICAL_ERROR
+
+}
+
+message Error_manager
+{
+    required int32                      error_code = 1[default = 0];
+    optional Error_level                error_level = 2[default = NORMAL];
+    optional string                     error_description = 3[default = ""];
+}
+
+//测量结果结构体
+message Locate_information
+{
+    optional float locate_x = 1[default = 0];				//整车的中心点x值; 四轮的中心
+    optional float locate_y = 2[default = 0];				//整车的中心点y值; 四轮的中心
+    optional float locate_angle = 3[default = 0];			//整车的旋转角; 四轮的旋转角
+    optional float locate_length = 4[default = 0];		    //整车的长度; 用于规避碰撞
+    optional float locate_width = 5[default = 0];			//整车的宽度; 用于规避碰撞
+    optional float locate_height = 6[default = 0];		    //整车的高度; 用于规避碰撞
+    optional float locate_wheel_base = 7[default = 0];	    //整车的轮距; 前后轮的距离; 用于机器人或agv的抓车
+    optional float locate_wheel_width = 8[default = 0];	    //整车的轮距; 左右轮的距离; 用于机器人或agv的抓车
+    optional bool locate_correct = 9[default = false];		    //整车的校准标记位
+
+    optional float locate_front_theta = 10[default = 0];	    //整车的前轮的旋转角
+    
+    optional float uniformed_car_x = 11;        //转角复位后,车辆中心点x
+    optional float uniformed_car_y = 12;        //转角复位后,车辆中心点y
+}
+
+//车辆基本信息
+message Car_info
+{
+    optional float                      car_length=1[default = 0];           //车长
+    optional float                      car_width=2[default = 0];            //车宽
+    optional float                      car_height=3[default = 0];           //车高
+    optional string                     license=4[default = ""];             //车辆凭证号(车牌号+唯一码)
+    optional string                     car_numberPlate = 5[default = ""];   //车牌号
+    optional float                      car_wheel_base = 6[default = 0];	 //整车的轮距; 前后轮的距离; 用于机器人或agv的抓车
+    optional float                      car_wheel_width = 7[default = 0];	 //整车的轮距; 左右轮的距离; 用于机器人或agv的抓车
+}
+
+//车位状态枚举
+enum Parkspace_status
+{
+    eParkspace_status_unknow    = 0;
+    eParkspace_empty            = 1;         //空闲,可分配
+    eParkspace_occupied         = 2;         //被占用,不可分配
+    eParkspace_reserved         = 3;         //被预约,预约车辆可分配
+    eParkspace_locked           = 4;         //临时锁定,不可分配
+    eParkspace_error            = 5;         //车位机械结构或硬件故障
+}
+
+//车位朝向, 0:未知, 1:小号朝前朝南, 也指入口, 2:大号朝后朝北, 也指出口,
+enum Direction
+{
+    eDirection_unknow = 0;
+    eForward = 1;                   //小号朝前朝南, 也指入口
+    eBackward = 2;                  //大号朝后朝北, 也指出口
+}
+
+//车位分配路线(根据中跑车的路线来定)
+enum Parkspace_path
+{
+	UNKNOW_PATH = 0;
+    OPTIMAL_PATH = 1;
+    LEFT_PATH = 2;
+    RIGHT_PATH = 3;
+    TEMPORARY_CACHE_PATH = 4;
+}
+
+//车位类型
+enum Parkspace_type
+{
+    UNKNOW_PARKSPACE_TYPE = 0;
+    MIN_PARKINGSPACE = 1;//小车位
+    MID_PARKINGSPACE = 2;//中车位
+    BIG_PARKINGSPACE = 3;//大车位
+}
+
+//汽车类型
+enum Car_type
+{
+    UNKNOW_CAR_TYPE = 0;
+    MIN_CAR = 1;//小车
+    MID_CAR = 2;//中车
+    BIG_CAR = 3;//大车
+}
+
+//单个车位基本信息与状态信息,车位信息以及车位上的车辆信息
+message Parkspace_info
+{
+    optional int32              parkingspace_index_id = 1;            //车位ID
+    optional Parkspace_type     parkingspace_type = 2;                //车位类型
+    optional int32              parkingspace_unit_id = 3;            //车位单元号
+    optional int32              parkingspace_label_id = 4;            //车位单元内部ID
+    optional int32              parkingspace_room_id = 5;             //同层编号
+    optional Direction          parkingspace_direction = 6;           //前后
+    optional int32              parkingspace_floor_id = 7;            //楼层
+    optional float              parkingspace_width = 8;               //车位宽
+    optional float              parkingspace_height = 9;              //车位高
+    optional Parkspace_status   parkingspace_status = 10;              //车位当前状态
+    optional Car_info           car_info = 11;                        //车辆信息
+    optional string             entry_time = 12;                      //入场时间
+    optional string             leave_time = 13;                      //离场时间
+
+
+    optional Parkspace_path     parkspace_path = 14;            // 车位分配路线
+    optional float              path_estimate_time = 15;        //车位分配路线 time(s)
+    optional Parkspace_status   parkspace_status_target = 16;     //车位目标状态
+
+    optional Car_type           car_type = 17;                        //车辆类型
+
+
+}
+
+/*
+*流程中的步骤类型, 例如:停车流程包含5个步骤 , 分配车位-测量-检验结果-搬运-更新车位表
+*/
+enum Step_type
+{
+    eAlloc_step=0;
+    eMeasure_step=1;
+    eCompare_step=2;
+    eDispatch_step=3;
+    eConfirm_step=4;
+
+    eSearch_step=5;        //查询数据库
+    eWait_step=6;             //等待车辆离开
+    eRelease_step=7;          //释放车位
+
+    eComplete=8;              //完成
+
+    eBackConfirm_step=9;
+    eBack_compare_step=10;
+    eBackMeasure_step=11;
+    eBackAlloc_step=12;
+
+    eBackWait_step=13;
+    eBackDispatch_step=14;
+    eBackSearch_step=15;
+
+    eBackComplete=16;
+}
+//步骤状态,每个步骤有四中可能状态 ,等待中-执行中-完成或者错误  四个状态
+enum Step_statu
+{
+    eWaiting=0;               //完成/空闲
+    eWorking=1;
+    eError=2;
+    eFinished=3;
+}
+
+//调度设备的类型
+enum Dispatch_device_type
+{
+    ROBOT_1                                 = 101;      //一号出口的专用机器手(只能负责1号出口的取车)(目前没有安装,暂时不考虑)
+    ROBOT_2                                 = 102;      //中间的大型机器手   (可以负责1~6号出入口的停车和取车)
+
+    CARRIER_1                               = 200;      //左侧0号电梯井的搬运器(升降电梯 中跑车 小跑车 三合一为搬运器)
+    CARRIER_2                               = 207;      //右侧7号电梯井的搬运器(升降电梯 中跑车 小跑车 三合一为搬运器)
+    CARRIER_3                               = 203;      //中间3楼的搬运器(中跑车 小跑车 二合一为搬运器)(没有电梯, 只能在3楼活动)
+
+    PASSAGEWAY_0                            = 300;      //0号出口(在左侧电梯井, 只能取车)(暂时不存在)
+    PASSAGEWAY_1                            = 301;      //1号出入口
+    PASSAGEWAY_2                            = 302;      //2号出入口
+    PASSAGEWAY_3                            = 303;      //3号出入口
+    PASSAGEWAY_4                            = 304;      //4号出入口
+    PASSAGEWAY_5                            = 305;      //5号出入口
+    PASSAGEWAY_6                            = 306;      //6号出入口
+    PASSAGEWAY_7                            = 307;      //7号出口(在右侧电梯井, 只能取车)
+}
+
+//id结构体
+message Id_struct
+{
+    optional int32              terminal_id = 1;            //终端ID
+    optional int32              unit_id =  2;               //单元号
+}
+

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1664 - 0
message/notify_message.pb.cc


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1230 - 0
message/notify_message.pb.h


+ 28 - 0
message/notify_message.proto

@@ -0,0 +1,28 @@
+syntax = "proto2";
+package message;
+import "message_base.proto";
+import "singlechip_msg.proto";
+message Notify_request_msg
+{
+    required Base_info                  base_info=1;                 //消息类型
+    required string                     command_key=2;
+    required Id_struct					id_struct=3;              //终端id
+    required Car_info                   car_info=4;                  //车辆标识(车牌号)
+}
+
+message Notify_response_msg
+{
+    required Base_info                  base_info=1;                 //消息类型
+    required string                     command_key=2;
+    required Id_struct					id_struct=3;              //终端id
+    required Error_manager              code=4;                     //请求结果码
+}
+
+message Notify_status_msg
+{
+    required Base_info                  base_info=1;                 //消息类型
+    required Id_struct					id_struct=2;
+    required Error_manager          error_manager = 3;
+    optional Singlechip_data	  singlechipData=4; //单片机的数据
+    optional bool		  singlechip_validity = 5;//单片机数据有效性
+}

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 7511 - 0
message/parkspace_allocation_message.pb.cc


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 5268 - 0
message/parkspace_allocation_message.pb.h


+ 170 - 0
message/parkspace_allocation_message.proto

@@ -0,0 +1,170 @@
+syntax = "proto2";
+package message;
+import "message_base.proto";
+
+// 请求
+// 1.分配车位
+// 2.查询车辆位置
+// 3.解锁车位
+// 4.手动操作修改车位状态
+// 5.临时锁定车位
+
+//车辆状态枚举
+enum Vehicle_status
+{
+    eVehicle_unknown        = 0;         //未知状态
+    eVehicle_idle           = 1;         //车辆空闲
+    eVehicle_in_garage      = 2;         //车辆已入库
+    eVehicle_parking        = 3;         //车辆停车中
+    eVehicle_fetching       = 4;         //车辆取车中
+    eVehicle_reserved       = 5;         //已预约未停入
+}
+
+//数据库状态
+enum Database_controller_status
+{
+	    E_UNKNOWN               = 0;    //默认未知
+	    E_READY               	= 1;    //正常待机
+		E_DISCONNECT			= 2;	//断连
+	    E_FAULT					= 3;	//故障
+}
+//车位管理状态
+enum Parkspace_manager_satus
+{
+    eParkspace_manager_unknown      =0;//位置
+    eParkspace_manager_normal       =1;//正常
+    eParkspace_manager_fault        =2;//故障
+};
+
+//1.分配车位请求
+message Parkspace_allocation_request_msg
+{
+    required Base_info                  base_info=1;            //消息类型
+    required string                     command_key=2;           //指令唯一标识符id
+    required Car_info                   car_info=3;
+    required Id_struct					id_struct=4;          //终端id,优化车位分配用
+}
+
+//分配车位反馈
+message Parkspace_allocation_response_msg
+{
+    required Base_info                  base_info=1;            //消息类型
+    required string                     command_key=2;           //指令唯一标识符id
+    required Error_manager              error_manager=3;        //分配成功与否标志
+    repeated Parkspace_info             allocated_parkspace_info_ex = 4;    //分配车位信息
+    optional Car_type                   car_type = 5;//汽车类型
+}
+
+//2.查询车辆位置请求(根据车辆唯一标识码查询)
+message Parkspace_search_request_msg
+{
+    required Base_info                  base_info=1;            //消息类型
+    required string                     command_key=2;           //指令唯一标识符id
+    required Car_info                   car_info=3;              //车辆凭证或号牌
+}
+
+//查询车辆位置反馈
+message Parkspace_search_response_msg
+{
+    required Base_info                  base_info=1;            //消息类型
+    required string                     command_key=2;           //指令唯一标识符id
+    required Error_manager              error_manager=3;        //分配成功与否标志
+    repeated Parkspace_info             query_parkspace_info_ex=4;         //待查询车辆存放位置
+}
+//手动查询车辆位置请求(根据车牌号查询)
+message Parkspace_manual_search_request_msg
+{
+    required Base_info                  base_info=1;            //消息类型
+    required string                     command_key=2;           //指令唯一标识符id
+    required Car_info                   car_info=3;              //车辆凭证或号牌
+}
+
+//手动查询车辆位置反馈
+message Parkspace_manual_search_response_msg
+{
+    required Base_info                  base_info=1;            //消息类型
+    required string                     command_key=2;           //指令唯一标识符id
+    required Error_manager              error_manager=3;        //分配成功与否标志
+    repeated Parkspace_info             query_parkspace_info_ex=4;         //待查询车辆存放位置
+}
+
+//3.释放车位请求
+message Parkspace_release_request_msg
+{
+    required Base_info                  base_info=1;            //消息类型
+    required string                     command_key=2;           //指令唯一标识符id
+    repeated Parkspace_info             release_parkspace_info_ex=3;   //待释放车位信息
+}
+
+//释放车位请求
+message Parkspace_release_response_msg
+{
+    required Base_info                  base_info=1;            //消息类型
+    required string                     command_key=2;           //指令唯一标识符id
+    required Error_manager              error_manager=3;        //分配成功与否标志
+    repeated Parkspace_info             release_parkspace_info_ex=4;   //待释放车位信息
+}
+
+// 4.手动操作修改车位状态
+message Parkspace_force_update_request_msg
+{
+    required Base_info                  base_info=1;            //消息类型
+    required string                     command_key=2;           //指令唯一标识符id
+    repeated Parkspace_info             manual_parkspace_info_ex=3;    //待手动修改车位信息,通过id定位
+}
+
+//手动操作反馈
+message Parkspace_force_update_response_msg
+{
+    required Base_info                  base_info=1;            //消息类型
+    required string                     command_key=2;           //指令唯一标识符id
+    required Error_manager              error_manager=3;        //分配成功与否标志
+    repeated Parkspace_info             manual_parkspace_info_ex=4;    //已修改后的车位信息
+}
+
+// 5.确认分配车位
+message Parkspace_confirm_alloc_request_msg
+{
+    required Base_info                  base_info=1;            //消息类型
+    required string                     command_key=2;           //指令唯一标识符id
+    repeated Parkspace_info             confirm_parkspace_info_ex = 3;    //分配车位信息
+    optional Car_type                   car_type = 4;//汽车类型
+
+}
+//确认分配车位反馈
+message Parkspace_confirm_alloc_response_msg
+{
+    required Base_info                  base_info=1;            //消息类型
+    required string                     command_key=2;           //指令唯一标识符id
+    required Error_manager              error_manager=3;        //分配成功与否标志
+    repeated Parkspace_info             confirm_parkspace_info_ex = 4;    //已修改后的车位信息
+    optional Car_type                   car_type = 5;//汽车类型
+
+}
+
+// 车位心跳状态信息
+message Parkspace_allocation_status_msg
+{
+    required Base_info                      base_info=1;            //消息类型
+    required Error_manager                  error_manager=2;
+    required Database_controller_status     database_controller_status=3;           //数据库的状态
+    required Parkspace_manager_satus        parkspace_manager_satus=4;              //车位管理状态
+	required int32                          unit_id=5;								//单元号
+    required int32                          small_parkspace_remaining_number=6;    //小型车位剩余数量
+    required int32                          medium_parkspace_remaining_number=7;   //中型车位剩余数量
+    required int32                          large_parkspace_remaining_number=8;    //大型车位剩余数量
+    required int32                          total_parkspace_remaining_number=9;    //所有车位剩余数量
+}
+
+//更新车位数据请求
+message Parkspace_refresh_request_msg
+{
+    required Base_info                  base_info=1;            //消息类型
+}
+// 车位数据信息
+message Parkspace_allocation_data_msg
+{
+    required Base_info                  base_info=1;            //消息类型
+    required Error_manager              error_manager=2;
+    repeated Parkspace_info             parkspace_info_ex=3;
+}

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 8882 - 0
message/process_message.pb.cc


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 6626 - 0
message/process_message.pb.h


+ 156 - 0
message/process_message.proto

@@ -0,0 +1,156 @@
+syntax = "proto2";
+package message;
+import "message_base.proto";
+
+//分配车位步骤状态
+message Alloc_space_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    optional Car_info                   car_info=2;         //当前状态附带信息
+    optional string                     description=3;      //状态说明/错误说明
+}
+message Back_alloc_space_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    repeated Parkspace_info             allocated_parkspace_info_ex=2;       //当前状态附带信息
+    optional string                     description=3;      //状态说明/错误说明
+}
+
+//查询车位步骤状态
+message Search_space_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    repeated Parkspace_info             search_parkspace_info_ex=2;       //当前状态附带信息
+    optional string                     description=3;      //状态说明/错误说明
+}
+message Back_search_space_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    optional Car_info                   car_info=2;       //当前状态附带信息
+    optional string                     description=3;      //状态说明/错误说明
+}
+
+//确认占用车位步骤状态
+message Confirm_space_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    repeated Parkspace_info             confirm_parkspace_info_ex=2;       //当前状态附带信息
+    optional string                     description=3;      //状态说明/错误说明
+}
+message Back_confirm_space_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    repeated Parkspace_info             confirm_parkspace_info_ex=2;       //当前状态附带信息
+    optional string                     description=3;      //状态说明/错误说明
+}
+
+//解锁/释放车位步骤状态
+message Release_space_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    repeated Parkspace_info             release_parkspace_info_ex=2;       //当前状态附带信息
+    optional string                     description=3;      //状态说明/错误说明
+}
+message Back_release_space_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    repeated Parkspace_info             release_parkspace_info_ex=2;       //当前状态附带信息
+    optional string                     description=3;      //状态说明/错误说明
+}
+
+//对比节点
+message Compare_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    optional Locate_information         locate_info_wj=2;      //wj定位结果
+    optional Locate_information         locate_info_dj=3;      //dj定位结果
+    optional Locate_information         locate_info_result=4;      //定位结果
+    optional string                     description=5;      //状态说明/错误说明
+}
+message Back_compare_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    optional Locate_information         locate_info_wj=2;      //wj定位结果
+    optional Locate_information         locate_info_dj=3;      //wj定位结果
+    optional Locate_information         locate_info_result=4;      //wj定位结果
+    optional string                     description=5;      //状态说明/错误说明
+}
+//停车调度步骤状态
+message Dispatch_store_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    optional Locate_information         locate_info=2;      //定位结果
+    repeated Parkspace_info             allocated_parkspace_info_ex=3;//目标车位
+    optional string                     description=4;      //状态说明/错误说明
+}
+message Back_dispatch_store_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    optional Locate_information         locate_info=2;      //定位结果
+    repeated Parkspace_info             allocated_parkspace_info_ex=3;//目标车位
+    optional string                     description=4;      //状态说明/错误说明
+}
+
+//取车调度步骤状态
+message Dispatch_pick_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    repeated Parkspace_info             search_parkspace_info_ex=2;//目标车位
+    optional string                     description=3;      //状态说明/错误说明
+}
+message Back_dispatch_pick_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    repeated Parkspace_info             search_parkspace_info_ex=2;       //目标车位
+    optional string                     description=3;      //状态说明/错误说明
+}
+
+//取车等待车辆离开
+message Waitfor_leave_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    optional Car_info                   car_info=2;         //车辆信息
+    optional string                     description=3;      //状态说明/错误说明
+}
+message Back_waitfor_leave_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    optional Car_info                   car_info=2;         //车辆信息
+    optional string                     description=3;      //状态说明/错误说明
+}
+
+//停车流程进度消息
+message Storing_process_statu_msg
+{
+    required Base_info                          base_info=1;
+    required Id_struct							id_struct=2;              //终端id
+    required string                             license=3;
+
+    optional Alloc_space_step_statu             alloc_space_step=4;
+    optional Compare_step_statu                 compare_step=6;
+    optional Dispatch_store_step_statu          dispatch_step=7;
+    optional Confirm_space_step_statu           confirm_space_step=8;
+    optional bool                               completed=9 [default=false];
+    optional Back_confirm_space_step_statu      back_confirm_step=10;
+    optional Back_dispatch_store_step_statu     back_dispatch_step=11;
+    optional Back_compare_step_statu            back_compare_step=12;
+    optional Back_alloc_space_step_statu        back_alloc_space_step=14;
+    optional bool                               back_completed=15 [default=false];
+}
+
+//取车流程进度消息
+message Picking_process_statu_msg
+{
+    required Base_info                          base_info=1;
+    required Id_struct							id_struct=2;              //终端id
+    required string                             license=3;
+    optional Search_space_step_statu            search_space_step=4;
+    optional Dispatch_pick_step_statu           dispatch_step=5;
+    optional Release_space_step_statu           release_space_step=6;
+    optional Waitfor_leave_step_statu           waitfor_leave_step=7;
+    optional bool                               completed=8 [default=false];
+    optional Back_waitfor_leave_step_statu      back_waitfor_leave_step=9;
+    optional Back_dispatch_pick_step_statu      back_dispatch_step=10;
+    optional Back_search_space_step_statu       back_search_space_step_statu=11;
+    optional bool                               back_completed=12 [default=false];
+}

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 3594 - 0
message/singlechip_msg.pb.cc


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 2627 - 0
message/singlechip_msg.pb.h


+ 211 - 0
message/singlechip_msg.proto

@@ -0,0 +1,211 @@
+syntax = "proto2";
+package message;
+import "message_base.proto";
+//连接口
+message InputDi
+{
+	optional int32	Di0 = 1;  //停车超前光电(0正常,1超界故障)
+	optional int32	Di1 = 2;  //停车超后光电(0正常,1超界故障)
+	optional int32	Di2 = 3;  //停车超左光电(0正常,1超界故障)
+	optional int32	Di3 = 4;  //停车超1550光电(0正常,1超界故障)
+	optional int32	Di4 = 5;  //2050高度(0默认,1被触发)
+	optional int32	Di5 = 6;  //1750高度(0默认,1被触发)
+	optional int32	Di6 = 7;  //2050高度(0默认,1被触发)
+	optional int32	Di7 = 8;  //预留
+	optional int32	Di8 = 9;  //停车库门开到位(1表示开到位)	
+	optional int32	Di9 = 10; //停车库门关到位(1表示关到位)
+	optional int32	Di10 = 11;//预留的门故障位(1表示门故障)
+	optional int32	Di11 = 12;//调度完成标志位,是否允许终端放下一辆车进入入口(0调度正忙,1调度允许下一辆车)
+	optional int32	Di12 = 13;//库内光电,判断门内是否有车(0无车,1有车)
+	optional int32	Di13 = 14;//库外地磁 ,判断门外(0无车,1有车)
+	optional int32	Di14 = 15;//重启
+	optional int32	Di15 = 16;//急停
+}
+//连接口
+message OutputDo
+{
+	optional int32	Do0 = 1;	//外门 开门(1)
+	optional int32	Do1 = 2;    //外门 关门(1)
+	optional int32	Do2 = 3;    //备用
+	optional int32	Do3 = 4;	//备用
+	optional int32	Do4 = 5;	//备用
+	optional int32	Do5 = 6;	//备用
+	optional int32	Do6 = 7;	//备用
+	optional int32	Do7 = 8;	//备用
+
+}
+//流程控制
+enum Process_control
+{
+	PROCESS_CONTROL_UNKNOWN			= 0;//未知
+	PROCESS_CONTROL_FULL_AUTO		= 1;//全自动,
+	PROCESS_CONTROL_MANUAL			= 2;//手动
+	PROCESS_CONTROL_AUTO_CLOSE		= 3;//半自动关门
+	PROCESS_CONTROL_AUTO_OPEN		= 4;//半自动开门
+	PROCESS_CONTROL_TO_READY		= 5;//切换到待机
+
+
+	PROCESS_CONTROL_RESET			= 7;//重启
+	PROCESS_CONTROL_STOP			= 8;//急停
+	PROCESS_CONTROL_FAULT			= 9;//故障
+
+	
+	PROCESS_CONTROL_INLET_0		= 10 ;//未知
+	PROCESS_CONTROL_INLET_1		= 11 ;//未知
+	PROCESS_CONTROL_INLET_2		= 12 ;//未知
+	PROCESS_CONTROL_INLET_3		= 13 ;//未知
+	PROCESS_CONTROL_INLET_4		= 14 ;//未知
+	PROCESS_CONTROL_INLET_5		= 15 ;//未知
+	PROCESS_CONTROL_INLET_6		= 16 ;//未知
+	PROCESS_CONTROL_INLET_7		= 17 ;//未知
+	PROCESS_CONTROL_INLET_8		= 18 ;//未知
+	PROCESS_CONTROL_INLET_9		= 19 ;//未知
+	
+	PROCESS_CONTROL_OUTLET_0		= 30 ;//未知
+	PROCESS_CONTROL_OUTLET_1		= 31 ;//未知
+	PROCESS_CONTROL_OUTLET_2		= 32 ;//未知
+	PROCESS_CONTROL_OUTLET_3		= 33 ;//未知
+	PROCESS_CONTROL_OUTLET_4		= 34 ;//未知
+	PROCESS_CONTROL_OUTLET_5		= 35 ;//未知
+	PROCESS_CONTROL_OUTLET_6		= 36 ;//未知
+	PROCESS_CONTROL_OUTLET_7		= 37 ;//未知
+	PROCESS_CONTROL_OUTLET_8		= 38 ;//未知
+	PROCESS_CONTROL_OUTLET_9		= 39 ;//未知
+	
+};
+//终端给单片机
+message terminal_msg
+{
+    optional    int32		        TerminalID = 1;		// 终端号(单片机号)
+    optional    int32   		    DispatchDirection= 2;	// 方向(1入口,2出口)
+    optional    Process_control 	ProcessControl= 3;	 	// 门控
+    optional    OutputDo       	    OutPutDo= 4; 		// 输入口
+
+}
+//超界状态
+enum Over_border_status
+{
+	OVER_BORDER_STATUS_UNKNOWN		= 0 ;//未知
+	OVER_BORDER_STATUS_NORMAL		= 1 ;//正常
+	OVER_BORDER_STATUS_FRONT		= 2 ;//前超界
+	OVER_BORDER_STATUS_BACK			= 3 ;//后超界
+	OVER_BORDER_STATUS_LEFT			= 4 ;//左超界
+	OVER_BORDER_STATUS_RIGHT		= 5 ;//右超界
+};
+//车高状态
+enum Car_height_status	
+{
+	CAR_HEIGHT_STATUS_UNKNOWN		= 0 ;//未知
+	CAR_HEIGHT_STATUS_SMALL 		= 1 ;//小车
+	CAR_HEIGHT_STATUS_MEDIUM 		= 2 ;//中车
+	CAR_HEIGHT_STATUS_LARGE			= 3 ;//大车
+	CAR_HEIGHT_STATUS_HUGE			= 4 ;//巨大车
+	CAR_HEIGHT_STATUS_FAULT			= 5 ;//故障车
+};
+
+//外门的状态
+enum Outside_door_status
+{
+	OUTSIDE_DOOR_STATUS_UNKNOWN		= 0 ;//未知
+	OUTSIDE_DOOR_STATUS_OPEN		= 1 ;//外门开到位
+	OUTSIDE_DOOR_STATUS_CLOSE		= 2 ;//外门关到位
+	OUTSIDE_DOOR_STATUS_RUN			= 3 ;//外门运行中
+	OUTSIDE_DOOR_STATUS_FAULT		= 4 ;//外门故障
+};
+
+//外门的控制
+enum Outside_door_control
+{
+	OUTSIDE_DOOR_CONTROL_UNKNOWN	= 0 ;//未知
+	OUTSIDE_DOOR_CONTROL_OPEN		= 1 ;//外门开
+	OUTSIDE_DOOR_CONTROL_CLOSE		= 2 ;//外门关
+
+};
+//流程状态
+enum Process_status
+{
+	PROCESS_STATUS_UNKNOWN			= 0;//未知
+	PROCESS_STATUS_FULL_AUTO	    = 1;//全自动,
+	PROCESS_STATUS_MANUAL			= 2;//手动
+	PROCESS_STATUS_AUTO_CLOSE		= 3;//半自动关门
+	PROCESS_STATUS_AUTO_OPEN		= 4;//半自动开门
+	PROCESS_STATUS_TO_READY			= 5;//切换到待机
+	
+	PROCESS_STATUS_RESET			= 7;//重启
+	PROCESS_STATUS_STOP				= 8;//急停
+	PROCESS_STATUS_FAULT			= 9;//故障
+	
+	//自动模式的步骤
+	PROCESS_STATUS_INLET_0		= 10 ;//入口待机, 等待门外地感触发。
+	PROCESS_STATUS_INLET_1		= 11 ;//执行开门
+	PROCESS_STATUS_INLET_2		= 12 ;//等待门开到位
+	PROCESS_STATUS_INLET_3		= 13 ;//等待汽车进入
+	PROCESS_STATUS_INLET_4		= 14 ;//停车完成,统计汽车经过门口的车高。
+	PROCESS_STATUS_INLET_5		= 15 ;//等待终端关门,执行关门
+	PROCESS_STATUS_INLET_6		= 16 ;//等待门关到位
+	PROCESS_STATUS_INLET_7		= 17 ;//等待plc调度,或者终端重置
+	PROCESS_STATUS_INLET_8		= 18 ;//未知
+	PROCESS_STATUS_INLET_9		= 19 ;//未知
+
+	PROCESS_STATUS_INLET_10		= 20 ;//入口待机, 等待门外地感触发。
+	PROCESS_STATUS_INLET_11		= 21 ;//执行开门
+	PROCESS_STATUS_INLET_12		= 22 ;//等待门开到位
+	PROCESS_STATUS_INLET_13		= 23 ;//等待汽车进入
+	PROCESS_STATUS_INLET_14		= 24 ;//停车完成,统计汽车经过门口的车高。
+	PROCESS_STATUS_INLET_15		= 25 ;//等待终端关门,执行关门
+	PROCESS_STATUS_INLET_16		= 26 ;//等待门关到位
+	PROCESS_STATUS_INLET_17		= 27 ;//等待plc调度,或者终端重置
+	PROCESS_STATUS_INLET_18		= 28 ;//未知
+	PROCESS_STATUS_INLET_19		= 29 ;//未知
+	
+	PROCESS_STATUS_OUTLET_0		= 30 ;//出口待机,等待终端开门,执行开门
+	PROCESS_STATUS_OUTLET_1		= 31 ;//等待门开到位
+	PROCESS_STATUS_OUTLET_2		= 32 ;//等待门口的光电产生信号,表示汽车正从车库出去。汽车正在离开中。
+	PROCESS_STATUS_OUTLET_3		= 33 ;//汽车离开后,延迟5秒关门,执行关门
+	PROCESS_STATUS_OUTLET_4		= 34 ;//等待门关到位
+	PROCESS_STATUS_OUTLET_5		= 35 ;//等待plc调度,或者终端重置
+	PROCESS_STATUS_OUTLET_6		= 36 ;//未知
+	PROCESS_STATUS_OUTLET_7		= 37 ;//未知
+	PROCESS_STATUS_OUTLET_8		= 38 ;//未知
+	PROCESS_STATUS_OUTLET_9		= 39 ;//未知
+	
+	PROCESS_STATUS_OUTLET_10		= 40 ;//出口待机,等待终端开门,执行开门
+	PROCESS_STATUS_OUTLET_11		= 41 ;//等待门开到位
+	PROCESS_STATUS_OUTLET_12		= 42 ;//等待门口的光电产生信号,表示汽车正从车库出去。汽车正在离开中。
+	PROCESS_STATUS_OUTLET_13		= 43 ;//汽车离开后,延迟5秒关门,执行关门
+	PROCESS_STATUS_OUTLET_14		= 44 ;//等待门关到位
+	PROCESS_STATUS_OUTLET_15		= 45 ;//等待plc调度,或者终端重置
+	PROCESS_STATUS_OUTLET_16		= 46 ;//未知
+	PROCESS_STATUS_OUTLET_17		= 47 ;//未知
+	PROCESS_STATUS_OUTLET_18		= 48 ;//未知
+	PROCESS_STATUS_OUTLET_19		= 49 ;//未知
+};
+//单片机给终端
+message Singlechip_data
+{
+    optional  int32		            TerminalID= 1;	  	// 终端号(单片机号)
+    optional  int32   		        DispatchDirection= 2;	// 方向(1入口,2出口)
+    optional  Process_status	    ProcessStatus=   3;		//流程状态
+    optional  InputDi		        InPutDi = 4; 		// 输入口
+    optional  int32		            ResetFlag = 5;		//重置标志位
+    optional  Process_control	    ProcessControl = 6;		//流程控制
+    optional  int32		            InsideExistenceFlag = 7;	//内部存在标志
+    optional  Over_border_status	OverBorderStatus = 8;	//边界状态
+    optional  Car_height_status	    CarHeightStatusCurrent = 9;	//当前车高状态--斜角对射光电
+    optional  Car_height_status	    CarHeightStatusPassing = 10;	//车高状态--门口经过式光电
+    optional  int32		            StopFlag = 11;		//停车标志位
+    optional  Outside_door_status	OutsideDoorStatus = 12;	//外门状态
+    optional  Outside_door_control	OutsideDoorControl = 13;	//外门控制
+    optional  int32		            DispatchFinishFlag = 14;	//调度完成标志
+    optional  int32		            OutsideExistenceFlag = 15;	//外部存在标志
+}
+//终端状态消息
+message Terminal_status_msg
+{
+	required Base_info	 	    base_info =1; //消息类型
+    required Id_struct			id_struct=2;
+	optional Singlechip_data	singlechipData=3; //单片机的数据
+	optional bool		singlechip_validity = 4;//单片机数据有效性
+}
+
+

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 2063 - 0
message/terminal_message.pb.cc


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1496 - 0
message/terminal_message.pb.h


+ 39 - 0
message/terminal_message.proto

@@ -0,0 +1,39 @@
+syntax = "proto2";
+package message;
+import "message_base.proto";
+
+
+message Store_command_request_msg
+{
+    required Base_info                  base_info=1;                 //消息类型
+    required Id_struct					id_struct=2;              //终端id
+    required Locate_information         locate_information=3;       //终端测量数据,主要需要车高和车宽
+    required Car_info                   car_info=4;                  //车辆标识(车牌号)
+}
+
+
+message Store_command_response_msg
+{
+    required Base_info                  base_info=1;                 //消息类型
+    required Id_struct					id_struct=2;              //终端id
+    required Error_manager              code=3;            //请求结果码
+    optional string                     license=4;
+}
+
+
+message Pickup_command_request_msg
+{
+    required Base_info                  base_info=1;                 //消息类型
+    required Id_struct					id_struct=2;              //终端id
+    required Car_info                    car_info=4;                  //车辆信息
+
+}
+
+
+message Pickup_command_response_msg
+{
+    required Base_info                  base_info=1;                 //消息类型
+    required Id_struct					id_struct=2;              //终端id
+    required Error_manager              code=3;            //请求结果码
+    optional string                     license=4;
+}

+ 24 - 0
proto.sh

@@ -0,0 +1,24 @@
+
+protoc -I=./communication communication.proto --cpp_out=./communication
+#protoc -I=./snap7_communication snap7_communication.proto --cpp_out=./snap7_communication
+#protoc -I=./dispatch dispatch_parameter.proto --cpp_out=./dispatch
+
+
+protoc -I=./message message_base.proto --cpp_out=./message
+protoc -I=./message measure_message.proto --cpp_out=./message
+protoc -I=./message dispatch_message.proto --cpp_out=./message
+protoc -I=./message dispatch_control.proto --cpp_out=./message
+protoc -I=./message parkspace_allocation_message.proto --cpp_out=./message
+
+protoc -I=./message singlechip_msg.proto --cpp_out=./message
+protoc -I=./message notify_message.proto --cpp_out=./message
+
+
+protoc -I=./message central_control_message.proto --cpp_out=./message
+protoc -I=./message log_process.proto --cpp_out=./message
+protoc -I=./message process_message.proto --cpp_out=./message
+protoc -I=./message terminal_message.proto --cpp_out=./message
+protoc -I=./message UnNormalized_module_message.proto --cpp_out=./message
+
+
+

+ 63 - 0
setting/communication.prototxt

@@ -0,0 +1,63 @@
+
+
+communication_parameters
+{
+
+ #  bind_string:"tcp://192.168.1.89:9000"
+ #  connect_string_vector:"tcp://192.168.2.166:9001"
+ # connect_string_vector:"tcp://192.168.2.166:9002"
+
+  # connect_string_vector:"tcp://192.168.2.125:9876"
+  # connect_string_vector:"tcp://192.168.2.166:1234"
+
+  # bind_string:"tcp://192.168.2.166:4444"
+  #      bind_string:"tcp://192.168.3.106:5555"
+
+#    bind_string:"tcp://192.168.2.192:30002"
+
+
+
+ #  bind_string:"tcp://192.168.2.167:30002"
+  # connect_string_vector:"tcp://192.168.2.183:30003"
+ #  connect_string_vector:"tcp://192.168.2.183:30000"
+
+
+ #   connect_string_vector:"tcp://192.168.2.233:30000"
+
+ #   connect_string_vector:"tcp://192.168.2.165:30000"
+ #   bind_string:"tcp://192.168.2.177:30009"
+
+  #  connect_string_vector:"tcp://192.168.2.127:30001"
+
+#    connect_string_vector:"tcp://192.168.2.174:30002"
+
+
+
+ #   bind_string:"tcp://192.168.1.89:30123"
+
+ #   connect_string_vector:"tcp://192.168.1.233:30000"
+#    connect_string_vector:"tcp://192.168.1.233:30008"
+ #   connect_string_vector:"tcp://192.168.1.233:30010"
+ #   connect_string_vector:"tcp://192.168.1.233:30030"
+ #   connect_string_vector:"tcp://192.168.1.233:30031"
+ #   connect_string_vector:"tcp://192.168.1.233:30032"
+
+ #   connect_string_vector:"tcp://192.168.1.180:30009"
+#    connect_string_vector:"tcp://192.168.1.181:30009"
+ #   connect_string_vector:"tcp://192.168.1.182:30009"
+ #   connect_string_vector:"tcp://192.168.1.183:30009"
+ #   connect_string_vector:"tcp://192.168.1.184:30009"
+ #   connect_string_vector:"tcp://192.168.1.185:30009"
+
+ #   connect_string_vector:"tcp://192.168.1.186:30009"
+ #   connect_string_vector:"tcp://192.168.1.187:30009"
+
+#    connect_string_vector:"tcp://192.168.1.245:30009"
+ #   connect_string_vector:"tcp://192.168.1.245:10009"
+
+    connect_string_vector:"tcp://192.168.1.233:30030"
+    connect_string_vector:"tcp://192.168.1.233:30031"
+    connect_string_vector:"tcp://192.168.1.233:30032"
+
+}
+

+ 53 - 0
setting/communication_a.prototxt

@@ -0,0 +1,53 @@
+
+
+communication_parameters
+{
+
+#   bind_string:"tcp://192.168.2.166:9000"
+ #  connect_string_vector:"tcp://192.168.2.166:9001"
+ # connect_string_vector:"tcp://192.168.2.166:9002"
+
+  # connect_string_vector:"tcp://192.168.2.125:9876"
+  # connect_string_vector:"tcp://192.168.2.166:1234"
+
+  # bind_string:"tcp://192.168.2.166:4444"
+  #      bind_string:"tcp://192.168.3.106:5555"
+
+#    bind_string:"tcp://192.168.2.192:30002"
+
+
+
+ #  bind_string:"tcp://192.168.2.167:30002"
+  # connect_string_vector:"tcp://192.168.2.183:30003"
+ #  connect_string_vector:"tcp://192.168.2.183:30000"
+
+
+ #   connect_string_vector:"tcp://192.168.2.233:30000"
+
+ #   connect_string_vector:"tcp://192.168.2.165:30000"
+ #   bind_string:"tcp://192.168.2.177:30009"
+
+  #  connect_string_vector:"tcp://192.168.2.127:30001"
+
+#    connect_string_vector:"tcp://192.168.2.174:30002"
+
+
+bind_string:"tcp://192.168.1.233:30030"
+    connect_string_vector:"tcp://192.168.1.233:30000"
+    connect_string_vector:"tcp://192.168.1.233:30010"
+
+    connect_string_vector:"tcp://192.168.1.180:30009"
+    connect_string_vector:"tcp://192.168.1.181:30009"
+    connect_string_vector:"tcp://192.168.1.182:30009"
+    connect_string_vector:"tcp://192.168.1.183:30009"
+    connect_string_vector:"tcp://192.168.1.184:30009"
+    connect_string_vector:"tcp://192.168.1.185:30009"
+
+    connect_string_vector:"tcp://192.168.1.186:30009"
+    connect_string_vector:"tcp://192.168.1.187:30009"
+
+    connect_string_vector:"tcp://192.168.1.245:30009"
+
+
+}
+

+ 52 - 0
setting/communication_b.prototxt

@@ -0,0 +1,52 @@
+
+
+communication_parameters
+{
+
+#   bind_string:"tcp://192.168.2.166:9000"
+ #  connect_string_vector:"tcp://192.168.2.166:9001"
+ # connect_string_vector:"tcp://192.168.2.166:9002"
+
+  # connect_string_vector:"tcp://192.168.2.125:9876"
+  # connect_string_vector:"tcp://192.168.2.166:1234"
+
+  # bind_string:"tcp://192.168.2.166:4444"
+  #      bind_string:"tcp://192.168.3.106:5555"
+
+#    bind_string:"tcp://192.168.2.192:30002"
+
+
+
+ #  bind_string:"tcp://192.168.2.167:30002"
+  # connect_string_vector:"tcp://192.168.2.183:30003"
+ #  connect_string_vector:"tcp://192.168.2.183:30000"
+
+
+ #   connect_string_vector:"tcp://192.168.2.233:30000"
+
+ #   connect_string_vector:"tcp://192.168.2.165:30000"
+ #   bind_string:"tcp://192.168.2.177:30009"
+
+  #  connect_string_vector:"tcp://192.168.2.127:30001"
+
+#    connect_string_vector:"tcp://192.168.2.174:30002"
+
+bind_string:"tcp://192.168.1.233:30031"
+    connect_string_vector:"tcp://192.168.1.233:30000"
+    connect_string_vector:"tcp://192.168.1.233:30010"
+
+    connect_string_vector:"tcp://192.168.1.180:30009"
+    connect_string_vector:"tcp://192.168.1.181:30009"
+    connect_string_vector:"tcp://192.168.1.182:30009"
+    connect_string_vector:"tcp://192.168.1.183:30009"
+    connect_string_vector:"tcp://192.168.1.184:30009"
+    connect_string_vector:"tcp://192.168.1.185:30009"
+
+    connect_string_vector:"tcp://192.168.1.186:30009"
+    connect_string_vector:"tcp://192.168.1.187:30009"
+
+    connect_string_vector:"tcp://192.168.1.245:30009"
+
+
+}
+

+ 52 - 0
setting/communication_c.prototxt

@@ -0,0 +1,52 @@
+
+
+communication_parameters
+{
+
+#   bind_string:"tcp://192.168.2.166:9000"
+ #  connect_string_vector:"tcp://192.168.2.166:9001"
+ # connect_string_vector:"tcp://192.168.2.166:9002"
+
+  # connect_string_vector:"tcp://192.168.2.125:9876"
+  # connect_string_vector:"tcp://192.168.2.166:1234"
+
+  # bind_string:"tcp://192.168.2.166:4444"
+  #      bind_string:"tcp://192.168.3.106:5555"
+
+#    bind_string:"tcp://192.168.2.192:30002"
+
+
+
+ #  bind_string:"tcp://192.168.2.167:30002"
+  # connect_string_vector:"tcp://192.168.2.183:30003"
+ #  connect_string_vector:"tcp://192.168.2.183:30000"
+
+
+ #   connect_string_vector:"tcp://192.168.2.233:30000"
+
+ #   connect_string_vector:"tcp://192.168.2.165:30000"
+ #   bind_string:"tcp://192.168.2.177:30009"
+
+  #  connect_string_vector:"tcp://192.168.2.127:30001"
+
+#    connect_string_vector:"tcp://192.168.2.174:30002"
+
+bind_string:"tcp://192.168.1.233:30032"
+    connect_string_vector:"tcp://192.168.1.233:30000"
+    connect_string_vector:"tcp://192.168.1.233:30010"
+
+    connect_string_vector:"tcp://192.168.1.180:30009"
+    connect_string_vector:"tcp://192.168.1.181:30009"
+    connect_string_vector:"tcp://192.168.1.182:30009"
+    connect_string_vector:"tcp://192.168.1.183:30009"
+    connect_string_vector:"tcp://192.168.1.184:30009"
+    connect_string_vector:"tcp://192.168.1.185:30009"
+
+    connect_string_vector:"tcp://192.168.1.186:30009"
+    connect_string_vector:"tcp://192.168.1.187:30009"
+
+    connect_string_vector:"tcp://192.168.1.245:30009"
+
+
+}
+

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 3384 - 0
setting/dispatch_coordinates.prototxt


+ 33 - 0
setting/dispatch_device.prototxt

@@ -0,0 +1,33 @@
+
+
+
+catcher_size:1
+catcher_parameters
+{
+    id:1
+    key:102
+}
+
+carrier_size:3
+carrier_parameters
+{
+    id:0
+    key:200
+}
+carrier_parameters
+{
+    id:1
+    key:207
+}
+carrier_parameters
+{
+    id:2
+    key:203
+}
+
+passageway_size:0
+
+
+
+
+

+ 86 - 0
setting/laser.prototxt

@@ -0,0 +1,86 @@
+#1号雷达
+#  0TFDFG700601881  0TFDFCE00502001 0TFDH5L00684HE1  0TFDH5R006RCJ91
+
+
+
+
+laser_parameters
+{
+	type:"Livox"
+	sn:"0TFDFG700601881"
+	frame_num:1000
+    mat_r00:1
+    mat_r01:0
+    mat_r02:0
+    mat_r03:0
+    mat_r10:0
+    mat_r11:1
+    mat_r12:0
+    mat_r13:0
+    mat_r20:0
+    mat_r21:0
+    mat_r22:1
+    mat_r23:0
+}
+
+
+laser_parameters
+{
+	type:"Livox"
+	sn:"0TFDFCE00502001"
+	frame_num:1000
+    mat_r00:1
+    mat_r01:0
+    mat_r02:0
+    mat_r03:0
+    mat_r10:0
+    mat_r11:1
+    mat_r12:0
+    mat_r13:0
+    mat_r20:0
+    mat_r21:0
+    mat_r22:1
+    mat_r23:0
+}
+
+
+
+laser_parameters
+{
+	type:"Livox"
+	sn:"0TFDH5L00684HE1"
+	frame_num:1000
+    mat_r00:1
+    mat_r01:0
+    mat_r02:0
+    mat_r03:0
+    mat_r10:0
+    mat_r11:1
+    mat_r12:0
+    mat_r13:0
+    mat_r20:0
+    mat_r21:0
+    mat_r22:1
+    mat_r23:0
+}
+
+
+
+laser_parameters
+{
+	type:"Livox"
+	sn:"0TFDH5R006RCJ91"
+	frame_num:1000
+    mat_r00:1
+    mat_r01:0
+    mat_r02:0
+    mat_r03:0
+    mat_r10:0
+    mat_r11:1
+    mat_r12:0
+    mat_r13:0
+    mat_r20:0
+    mat_r21:0
+    mat_r22:1
+    mat_r23:0
+}

+ 54 - 0
setting/locate.prototxt

@@ -0,0 +1,54 @@
+area{
+ #   x_min:-1227.5
+ #   x_max:1802.9
+ #   y_min:-2789.8
+ #   y_max:3777.19
+  #  z_min:0
+  #  z_max:1800
+
+        x_min:-1000000
+        x_max:1000000
+        y_min:-1000000
+        y_max:1000000
+        z_min:-1000000
+        z_max:1000000
+}
+
+net_3dcnn_parameter
+{
+    length:0.224
+    width:0.224
+    height:0.096
+    freq:0.025
+    nclass:3
+    weights_file:"./setting/3dcnn_model.pb"
+}
+
+seg_parameter
+{
+    point_size:8192
+    cls_num:2
+    freq:0.020
+    area
+    {
+        x_min:-100000.0
+    	x_max:100000.0
+    	y_min:-100000.0
+    	y_max:100000.0
+    	z_min:-100000.0
+    	z_max:100000.0
+    }
+    graph:"../model_param/seg_model_404500.ckpt.meta"
+    cpkt:"../model_param/seg_model_404500.ckpt"
+}
+
+yolo_parameter
+{
+    cfg:"./setting/yolov3-spot2.cfg"
+    weights:"./setting/yolov3-spot2_12000.weights"
+    min_x:-1227.5
+    max_x:10802.9
+    min_y:-2789.8
+    max_y:3777.19
+    freq:25.
+}

+ 16 - 0
setting/snap7_communication.prototxt

@@ -0,0 +1,16 @@
+
+snap7_communication_parameters
+{
+  #  ip_string:"192.168.0.1"
+ #   ip_string:"192.168.2.134"
+
+ #ip_string:"192.168.0.6"
+
+ #ip_string:"192.168.2.6"
+
+
+
+ #ip_string:"192.168.0.112"
+ ip_string:"192.168.0.1"
+}
+

+ 21 - 0
setting/snap7_communication_a.prototxt

@@ -0,0 +1,21 @@
+
+snap7_communication_parameters
+{
+  #  ip_string:"192.168.0.1"
+ #   ip_string:"192.168.2.134"
+
+ #ip_string:"192.168.0.6"
+
+ #ip_string:"192.168.2.6"
+
+
+
+ #ip_string:"192.168.0.112"
+
+
+
+
+ #ip_string:"192.168.0.1"
+ ip_string:"192.168.0.81"
+}
+

+ 16 - 0
setting/snap7_communication_b.prototxt

@@ -0,0 +1,16 @@
+
+snap7_communication_parameters
+{
+  #  ip_string:"192.168.0.1"
+ #   ip_string:"192.168.2.134"
+
+ #ip_string:"192.168.0.6"
+
+ #ip_string:"192.168.2.6"
+
+
+
+ #ip_string:"192.168.0.112"
+ ip_string:"192.168.0.1"
+}
+

+ 16 - 0
setting/snap7_communication_c.prototxt

@@ -0,0 +1,16 @@
+
+snap7_communication_parameters
+{
+  #  ip_string:"192.168.0.1"
+ #   ip_string:"192.168.2.134"
+
+ #ip_string:"192.168.0.6"
+
+ #ip_string:"192.168.2.6"
+
+
+
+ #ip_string:"192.168.0.112"
+ ip_string:"192.168.0.1"
+}
+

+ 108 - 0
system/system_communication.cpp

@@ -0,0 +1,108 @@
+//
+// Created by huli on 2020/6/28.
+//
+
+#include "system_communication.h"
+//#include "../laser/laser_manager.h"
+//#include "../locate/locate_manager.h"
+#include "../system/system_executor.h"
+
+System_communication::System_communication()
+{
+
+}
+
+System_communication::~System_communication()
+{
+
+}
+
+//初始化 通信 模块。如下三选一
+Error_manager System_communication::communication_init()
+{
+	return Communication_socket_base::communication_init();
+}
+
+//初始化 通信 模块。如下三选一
+Error_manager System_communication::communication_init(int dispatch_id)
+{
+	switch ( dispatch_id )
+	{
+		case 0:
+		{
+			return Communication_socket_base::communication_init_from_protobuf(COMMUNICATION_PARAMETER_PATH_A);
+			break;
+		}
+		case 1:
+		{
+			return Communication_socket_base::communication_init_from_protobuf(COMMUNICATION_PARAMETER_PATH_B);
+			break;
+		}
+		case 2:
+		{
+			return Communication_socket_base::communication_init_from_protobuf(COMMUNICATION_PARAMETER_PATH_C);
+			break;
+		}
+		default:
+		{
+			return Error_manager(Error_code::COMMUNICATION_READ_PROTOBUF_ERROR, Error_level::MINOR_ERROR,
+								 " System_communication::communication_init dispatch_id error ");
+			break;
+		}
+	}
+	return Error_code::SUCCESS;
+}
+
+//检查消息是否有效, 主要检查消息类型和接受者, 判断这条消息是不是给我的.
+Error_manager System_communication::check_msg(Communication_message*  p_msg)
+{
+	return System_executor::get_instance_references().check_msg(p_msg);
+}
+
+//检查执行者的状态, 判断能否处理这条消息, 需要子类重载
+Error_manager System_communication::check_executer(Communication_message*  p_msg)
+{
+	//检查对应模块的状态, 判断是否可以处理这条消息
+	//同时也要判断是否超时, 超时返回 COMMUNICATION_ANALYSIS_TIME_OUT
+	//如果处理器正在忙别的, 那么返回 COMMUNICATION_EXCUTER_IS_BUSY
+//	std::cout << "Communication_socket_base::check_msg  p_buf =  " << p_msg->get_message_buf() << std::endl;
+//	std::cout << "Communication_socket_base::check_msg   size =  " << p_msg->get_message_buf().size() << std::endl;
+
+	Error_manager t_error;
+	if ( p_msg->is_over_time() )
+	{
+		std::cout << "COMMUNICATION_ANALYSIS_TIME_OUT , " << std::endl;
+		//超时:接收方不做处理,发送方会进行超时处理
+		return Error_code::COMMUNICATION_ANALYSIS_TIME_OUT;
+	}
+	else
+	{
+		return System_executor::get_instance_references().check_executer(p_msg);
+	}
+	return Error_code::SUCCESS;
+}
+
+//处理消息, 需要子类重载
+Error_manager System_communication::execute_msg(Communication_message* p_msg)
+{
+	return System_executor::get_instance_references().execute_msg(p_msg);
+}
+
+//定时封装发送消息, 一般为心跳和状态信息, 需要子类重载
+Error_manager System_communication::encapsulate_send_data()
+{
+	Error_manager t_error;
+
+	return System_executor::get_instance_references().encapsulate_send_dispatch_manager_status();
+
+	return Error_code::SUCCESS;
+}
+
+
+
+
+
+
+
+
+

+ 49 - 0
system/system_communication.h

@@ -0,0 +1,49 @@
+//
+// Created by huli on 2020/6/28.
+//
+
+#ifndef NNXX_TESTS_SYSTEM_COMMUNICATION_H
+#define NNXX_TESTS_SYSTEM_COMMUNICATION_H
+
+#include "../tool/singleton.h"
+#include "../communication/communication_socket_base.h"
+
+class System_communication:public Singleton<System_communication>, public Communication_socket_base
+{
+
+// 子类必须把父类设定为友元函数,这样父类才能使用子类的私有构造函数。
+   friend class Singleton<System_communication>;
+private:
+ // 父类的构造函数必须保护,子类的构造函数必须私有。
+   System_communication();
+public:
+    //必须关闭拷贝构造和赋值构造,只能通过 get_instance 函数来进行操作唯一的实例。
+    System_communication(const System_communication& other) = delete;
+    System_communication& operator =(const System_communication& other) = delete;
+    ~System_communication();
+public://API functions
+	//初始化 通信 模块。如下三选一
+	virtual Error_manager communication_init();
+	virtual Error_manager communication_init(int dispatch_id);
+	//检查消息是否有效, 主要检查消息类型和接受者, 判断这条消息是不是给我的.
+	virtual Error_manager check_msg(Communication_message* p_msg);
+	//检查执行者的状态, 判断能否处理这条消息, 需要子类重载
+	virtual Error_manager check_executer(Communication_message* p_msg);
+	//处理消息, 需要子类重载
+	virtual Error_manager execute_msg(Communication_message* p_msg);
+
+	//定时封装发送消息, 一般为心跳和状态信息, 需要子类重载
+	virtual Error_manager encapsulate_send_data();
+
+public://get or set member variable
+
+    
+protected://member variable 
+
+    
+private:
+    
+};
+
+
+#endif //NNXX_TESTS_SYSTEM_COMMUNICATION_H

+ 456 - 0
system/system_executor.cpp

@@ -0,0 +1,456 @@
+//
+// Created by huli on 2020/7/2.
+//
+
+#include "system_executor.h"
+
+
+System_executor::System_executor()
+{
+
+}
+
+System_executor::~System_executor()
+{
+	system_executor_uninit();
+}
+
+//初始化
+Error_manager System_executor::system_executor_init(int threads_size)
+{
+	m_thread_pool.thread_pool_init(threads_size);
+	m_system_executor_status = SYSTEM_EXECUTOR_READY;
+	return Error_code::SUCCESS;
+}
+
+//反初始化
+Error_manager System_executor::system_executor_uninit()
+{
+	m_thread_pool.thread_pool_uninit();
+	m_system_executor_status = SYSTEM_EXECUTOR_UNKNOW;
+	return Error_code::SUCCESS;
+}
+
+//检查消息是否有效, 主要检查消息类型和接受者, 判断这条消息是不是给我的.
+Error_manager System_executor::check_msg(Communication_message* p_msg)
+{
+	if ( p_msg == NULL )
+	{
+		return Error_manager(Error_code::POINTER_IS_NULL, Error_level::MINOR_ERROR,
+							 "  POINTER IS NULL ");
+	}
+	
+
+		//检查消息类型
+		switch ( p_msg->get_message_type() )
+		{
+			case Communication_message::Message_type::eDispatch_request_msg:
+			{
+				message::Dispatch_request_msg t_dispatch_request_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_dispatch_request_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					LOG(INFO) << " t_dispatch_request_msg =  "<< t_dispatch_request_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::eDispatch_response_msg:
+			{
+				message::Dispatch_response_msg t_dispatch_response_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_dispatch_response_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					LOG(INFO) << " t_dispatch_response_msg =  "<< t_dispatch_response_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::eDispatch_status_msg:
+			{
+				message::Dispatch_terminal_status_msg t_dispatch_terminal_status_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_dispatch_terminal_status_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					if ( t_dispatch_terminal_status_msg.id_struct().unit_id() == 0 )
+					{
+						LOG(INFO) << " t_dispatch_terminal_status_msg =  "<< t_dispatch_terminal_status_msg.DebugString() << " --  " << this;
+					}
+				}
+				break;
+			}
+
+//			case Communication_message::Message_type::eParkspace_allocation_status_msg:
+//			{
+//				message::Parkspace_allocation_status_msg t_Parkspace_allocation_status_msg;
+//				//针对消息类型, 对消息进行二次解析
+//				if (t_Parkspace_allocation_status_msg.ParseFromString(p_msg->get_message_buf()))
+//				{
+//					LOG(INFO) << " t_Parkspace_allocation_status_msg =  "<< t_Parkspace_allocation_status_msg.DebugString() << " --  " << this;
+//				}
+//				break;
+//			}
+			case Communication_message::Message_type::eParkspace_allocation_request_msg:
+			{
+				message::Parkspace_allocation_request_msg t_Parkspace_allocation_request_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Parkspace_allocation_request_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					LOG(INFO) << " t_Parkspace_allocation_request_msg =  "<< t_Parkspace_allocation_request_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::eParkspace_allocation_response_msg:
+			{
+				message::Parkspace_allocation_response_msg t_Parkspace_allocation_response_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Parkspace_allocation_response_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					LOG(INFO) << " t_Parkspace_allocation_response_msg =  "<< t_Parkspace_allocation_response_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::eParkspace_search_request_msg:
+			{
+				message::Parkspace_search_request_msg t_Parkspace_search_request_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Parkspace_search_request_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					LOG(INFO) << " t_Parkspace_search_request_msg =  "<< t_Parkspace_search_request_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::eParkspace_search_response_msg:
+			{
+				message::Parkspace_search_response_msg t_Parkspace_search_response_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Parkspace_search_response_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					LOG(INFO) << " t_Parkspace_search_response_msg =  "<< t_Parkspace_search_response_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::eParkspace_release_request_msg:
+			{
+				message::Parkspace_release_request_msg t_Parkspace_release_request_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Parkspace_release_request_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					LOG(INFO) << " t_Parkspace_release_request_msg =  "<< t_Parkspace_release_request_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::eParkspace_release_response_msg:
+			{
+				message::Parkspace_release_response_msg t_Parkspace_release_response_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Parkspace_release_response_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					LOG(INFO) << " t_Parkspace_release_response_msg =  "<< t_Parkspace_release_response_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::eParkspace_force_update_request_msg:
+			{
+				message::Parkspace_force_update_request_msg t_Parkspace_force_update_request_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Parkspace_force_update_request_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					LOG(INFO) << " t_Parkspace_force_update_request_msg =  "<< t_Parkspace_force_update_request_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::eParkspace_force_update_response_msg:
+			{
+				message::Parkspace_force_update_response_msg t_Parkspace_force_update_response_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Parkspace_force_update_response_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					LOG(INFO) << " t_Parkspace_force_update_response_msg =  "<< t_Parkspace_force_update_response_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::eParkspace_confirm_alloc_request_msg:
+			{
+				message::Parkspace_confirm_alloc_request_msg t_Parkspace_confirm_alloc_request_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Parkspace_confirm_alloc_request_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					LOG(INFO) << " t_Parkspace_confirm_alloc_request_msg =  "<< t_Parkspace_confirm_alloc_request_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::eParkspace_confirm_alloc_response_msg:
+			{
+				message::Parkspace_confirm_alloc_response_msg t_Parkspace_confirm_alloc_response_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Parkspace_confirm_alloc_response_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					LOG(INFO) << " t_Parkspace_confirm_alloc_response_msg =  "<< t_Parkspace_confirm_alloc_response_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::eParkspace_refresh_request_msg:
+			{
+				message::Parkspace_refresh_request_msg t_Parkspace_refresh_request_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Parkspace_refresh_request_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+//					LOG(INFO) << " t_Parkspace_refresh_request_msg =  "<< t_Parkspace_refresh_request_msg.DebugString() << " --  " << this;
+					LOG(INFO) << " t_Parkspace_refresh_request_msg =  "<< t_Parkspace_refresh_request_msg.base_info().msg_type() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::eParkspace_allocation_data_response_msg:
+			{
+				message::Parkspace_allocation_data_msg t_Parkspace_allocation_data_response_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Parkspace_allocation_data_response_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+//					LOG(INFO) << " t_Parkspace_allocation_data_response_msg =  "<< t_Parkspace_allocation_data_response_msg.DebugString() << " --  " << this;
+//					LOG(INFO) << " t_Parkspace_allocation_data_response_msg =  "<< t_Parkspace_allocation_data_response_msg.base_info().msg_type() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::eParkspace_manual_search_request_msg:
+			{
+				message::Parkspace_manual_search_request_msg t_Parkspace_manual_search_request_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Parkspace_manual_search_request_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					LOG(INFO) << " t_Parkspace_manual_search_request_msg =  "<< t_Parkspace_manual_search_request_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::eParkspace_manual_search_response_msg:
+			{
+				message::Parkspace_manual_search_response_msg t_Parkspace_manual_search_response_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Parkspace_manual_search_response_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					LOG(INFO) << " t_Parkspace_manual_search_response_msg =  "<< t_Parkspace_manual_search_response_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::eStore_command_request_msg:
+			{
+				message::Store_command_request_msg t_Store_command_request_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Store_command_request_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					LOG(INFO) << " t_Store_command_request_msg =  "<< t_Store_command_request_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::eStore_command_response_msg:
+			{
+				message::Store_command_response_msg t_Store_command_response_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Store_command_response_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					LOG(INFO) << " t_Store_command_response_msg =  "<< t_Store_command_response_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::ePickup_command_request_msg:
+			{
+				message::Pickup_command_request_msg t_Pickup_command_request_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Pickup_command_request_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					LOG(INFO) << " t_Pickup_command_request_msg =  "<< t_Pickup_command_request_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::ePickup_command_response_msg:
+			{
+				message::Pickup_command_response_msg t_Pickup_command_response_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Pickup_command_response_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					LOG(INFO) << " t_Pickup_command_response_msg =  "<< t_Pickup_command_response_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::eEntrance_manual_operation_msg:
+			{
+				message::Entrance_manual_operation_msg t_Entrance_manual_operation_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Entrance_manual_operation_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					LOG(INFO) << " t_Entrance_manual_operation_msg =  "<< t_Entrance_manual_operation_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::eProcess_manual_operation_msg:
+			{
+				message::Process_manual_operation_msg t_Process_manual_operation_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Process_manual_operation_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					LOG(INFO) << " t_Process_manual_operation_msg =  "<< t_Process_manual_operation_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::eNotify_request_msg:
+			{
+				message::Notify_request_msg t_Notify_request_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Notify_request_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					LOG(INFO) << " t_Notify_request_msg =  "<< t_Notify_request_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::eNotify_response_msg:
+			{
+				message::Notify_response_msg t_Notify_response_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Notify_response_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					LOG(INFO) << " t_Notify_response_msg =  "<< t_Notify_response_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::eGround_detect_request_msg:
+			{
+				message::Ground_detect_request_msg t_Ground_detect_request_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Ground_detect_request_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					LOG(INFO) << " t_Ground_detect_request_msg =  "<< t_Ground_detect_request_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::eGround_detect_response_msg:
+			{
+				message::Ground_detect_response_msg t_Ground_detect_response_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Ground_detect_response_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					LOG(INFO) << " t_Ground_detect_response_msg =  "<< t_Ground_detect_response_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::eTerminal_status_msg:
+			{
+				message::Terminal_status_msg t_Terminal_status_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Terminal_status_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					//LOG(INFO) << " t_Terminal_status_msg =  "<< t_Terminal_status_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			case Communication_message::Message_type::eNotify_status_msg:
+			{
+				message::Notify_status_msg t_Notify_status_msg;
+				//针对消息类型, 对消息进行二次解析
+				if (t_Notify_status_msg.ParseFromString(p_msg->get_message_buf()))
+				{
+					LOG(INFO) << " t_Notify_status_msg =  "<< t_Notify_status_msg.DebugString() << " --  " << this;
+				}
+				break;
+			}
+			default :
+				;
+				break;
+		}
+
+	//无效的消息,
+	return Error_manager(Error_code::INVALID_MESSAGE, Error_level::NEGLIGIBLE_ERROR,
+						 " INVALID_MESSAGE error ");
+}
+//检查执行者的状态, 判断能否处理这条消息,
+Error_manager System_executor::check_executer(Communication_message* p_msg)
+{
+	if ( p_msg == NULL )
+	{
+		return Error_manager(Error_code::POINTER_IS_NULL, Error_level::MINOR_ERROR,
+							 "  POINTER IS NULL ");
+	}
+
+	//检查执行线程池
+	Error_manager t_executor_result = System_executor::get_instance_references().check_status();
+	if (t_executor_result.get_error_level() == NEGLIGIBLE_ERROR)//一级故障,轻微故障,
+	{
+		std::cout << "executer_is_busy , " << std::endl;
+		//返回繁忙之后, 通信模块1秒后再次调用check
+		return Error_code::COMMUNICATION_EXCUTER_IS_BUSY;
+	}
+	else if (t_executor_result.get_error_level() > NEGLIGIBLE_ERROR)
+	{
+		return Error_manager(Error_code::SYSTEM_EXECUTOR_STATUS_ERROR, Error_level::MINOR_ERROR,
+							"System_executor::get_instance_references().check_status(); fun error ");
+	}
+
+	return Error_code::SUCCESS;
+}
+
+
+//处理消息的执行函数
+Error_manager System_executor::execute_msg(Communication_message* p_msg)
+{
+	if ( p_msg == NULL )
+	{
+		return Error_manager(Error_code::POINTER_IS_NULL, Error_level::MINOR_ERROR,
+							 "  POINTER IS NULL ");
+	}
+
+
+
+	return Error_code::SUCCESS;
+}
+
+//检查状态
+Error_manager System_executor::check_status()
+{
+	if ( m_system_executor_status == SYSTEM_EXECUTOR_READY )
+	{
+		if ( m_thread_pool.thread_is_full_load() == false )
+		{
+		    return Error_code::SUCCESS;
+		}
+		else
+		{
+		    return Error_manager(Error_code::SYSTEM_EXECUTOR_STATUS_BUSY, Error_level::NEGLIGIBLE_ERROR,
+		    					" System_executor::check_status error ");
+		}
+	}
+	else
+	{
+		return Error_manager(Error_code::SYSTEM_EXECUTOR_STATUS_ERROR, Error_level::MINOR_ERROR,
+							" System_executor::check_status error ");
+	}
+}
+
+//定时发送状态信息
+Error_manager System_executor::encapsulate_send_status()
+{
+	return Error_code::SUCCESS;
+}
+
+//定时发送 调度管理的状态
+Error_manager System_executor::encapsulate_send_dispatch_manager_status()
+{
+return Error_code::SUCCESS;
+}
+
+
+//判断是否为待机,如果已经准备好,则可以执行任务。
+bool System_executor::is_ready()
+{
+	if ( m_system_executor_status == SYSTEM_EXECUTOR_READY && m_thread_pool.thread_is_full_load() == false )
+	{
+	    return true;
+	}
+	else
+	{
+		return false;
+	}
+}
+
+System_executor::System_executor_status System_executor::get_system_executor_status()
+{
+	return m_system_executor_status;
+}
+
+

+ 96 - 0
system/system_executor.h

@@ -0,0 +1,96 @@
+//
+// Created by huli on 2020/7/2.
+//
+
+#ifndef NNXX_TESTS_SYSTEM_EXECUTOR_H
+#define NNXX_TESTS_SYSTEM_EXECUTOR_H
+
+#include "../tool/thread_pool.h"
+#include "../tool/singleton.h"
+#include "../error_code/error_code.h"
+#include "../communication/communication_message.h"
+#include "../system/system_communication.h"
+
+//#include "../locate/locate_manager.h"
+//#include "../locate/locate_manager_task.h"
+
+//#include "../laser/laser_manager.h"
+//#include "../locate/locate_manager.h"
+//#include "../dispatch/dispatch_manager.h"
+
+#include "../message/central_control_message.pb.h"
+#include "../message/dispatch_control.pb.h"
+#include "../message/dispatch_message.pb.h"
+#include "../message/log_process.pb.h"
+#include "../message/measure_message.pb.h"
+#include "../message/message_base.pb.h"
+#include "../message/notify_message.pb.h"
+#include "../message/parkspace_allocation_message.pb.h"
+#include "../message/process_message.pb.h"
+#include "../message/singlechip_msg.pb.h"
+#include "../message/UnNormalized_module_message.pb.h"
+#include "../message/terminal_message.pb.h"
+
+class System_executor:public Singleton<System_executor>
+{
+// 子类必须把父类设定为友元函数,这样父类才能使用子类的私有构造函数。
+   friend class Singleton<System_executor>;
+
+public:
+	//系统执行者的状态
+	enum System_executor_status
+	{//default SYSTEM_EXECUTOR_UNKNOW = 0
+	    SYSTEM_EXECUTOR_UNKNOW				= 0,    //
+		SYSTEM_EXECUTOR_READY				= 1,    //
+
+		SYSTEM_EXECUTOR_FAULT				= 10,    //
+
+	};
+   
+private:
+ // 父类的构造函数必须保护,子类的构造函数必须私有。
+   System_executor();
+public:
+    //必须关闭拷贝构造和赋值构造,只能通过 get_instance 函数来进行操作唯一的实例。
+    System_executor(const System_executor& other) = delete;
+    System_executor& operator =(const System_executor& other) = delete;
+    ~System_executor();
+public://API functions
+	//初始化
+	Error_manager system_executor_init(int threads_size);
+	//反初始化
+	Error_manager system_executor_uninit();
+
+	//检查消息是否有效, 主要检查消息类型和接受者, 判断这条消息是不是给我的.
+	Error_manager check_msg(Communication_message* p_msg);
+	//检查执行者的状态, 判断能否处理这条消息,
+	Error_manager check_executer(Communication_message* p_msg);
+	//处理消息的执行函数
+	Error_manager execute_msg(Communication_message* p_msg);
+
+	//检查状态
+	Error_manager check_status();
+
+	//定时发送状态信息
+	Error_manager encapsulate_send_status();
+	//定时发送 调度管理的状态
+	Error_manager encapsulate_send_dispatch_manager_status();
+
+	//判断是否为待机,如果已经准备好,则可以执行任务。
+	bool is_ready();
+public://get or set member variable
+	System_executor_status get_system_executor_status();
+public:
+
+protected://member variable
+
+	System_executor_status		m_system_executor_status;		//系统执行者的状态
+	
+	Thread_pool 				m_thread_pool;					//执行多任务的线程池
+
+private:
+
+};
+
+
+#endif //NNXX_TESTS_SYSTEM_EXECUTOR_H

+ 193 - 0
task/task_base.cpp

@@ -0,0 +1,193 @@
+//
+// Created by zx on 2019/12/28.
+//
+
+#include "task_base.h"
+#include "../error_code/error_code.h"
+
+Task_Base::Task_Base()
+{
+	static unsigned int t_task_id = 0;
+	m_task_id = t_task_id;
+	t_task_id++;
+
+    m_task_type = UNKNOW_TASK;
+	m_task_statu = TASK_CREATED;
+	mp_tast_receiver = NULL;
+
+	m_task_start_time = std::chrono::system_clock::now();	//获取当前时间
+	m_task_over_time = std::chrono::milliseconds(TASK_OVER_TIME_DEFAULT); //默认10秒
+}
+Task_Base::~Task_Base()
+{
+	mp_tast_receiver = NULL;
+}
+
+
+//初始化任务单,必须初始化之后才可以使用,
+//    input:tast_receiver 接受对象
+//    input:task_over_time 超时时间
+Error_manager Task_Base::task_init(void* p_tast_receiver,
+						std::chrono::milliseconds task_over_time)
+{
+	m_task_statu = TASK_CREATED;
+	m_task_statu_information = "";
+	mp_tast_receiver = p_tast_receiver;
+	m_task_over_time = task_over_time;
+	m_task_error_manager.error_manager_clear_all();
+	return Error_code::SUCCESS;
+}
+
+//初始化任务单,必须初始化之后才可以使用,
+//    input:task_statu 任务状态
+//    input:task_statu_information 状态说明
+//    input:tast_receiver 接受对象
+//    input:task_over_time 超时时间
+Error_manager Task_Base::task_init(Task_statu task_statu,
+				   std::string task_statu_information,
+				   void* p_tast_receiver,
+				   std::chrono::milliseconds task_over_time)
+{
+	m_task_statu = task_statu;
+	m_task_statu_information = task_statu_information;
+	mp_tast_receiver = p_tast_receiver;
+	m_task_over_time = task_over_time;
+	m_task_error_manager.error_manager_clear_all();
+	return Error_code::SUCCESS;
+}
+
+//任务单重置, 相当于重新创建, 会重置时间和错误码.
+Error_manager Task_Base::task_reset()
+{
+	//m_task_id不变	//m_task_type不变 //因为这个是创建的时候就定好的
+	m_task_statu = TASK_CREATED;
+	m_task_statu_information.clear();
+	mp_tast_receiver = NULL;
+
+	m_task_start_time = std::chrono::system_clock::now();	//获取当前时间
+	m_task_over_time = std::chrono::milliseconds(TASK_OVER_TIME_DEFAULT); //默认10秒
+
+	m_task_error_manager.error_manager_clear_all();
+	return Error_code::SUCCESS;
+}
+
+//更新任务单
+//task_statu: 任务状态
+//statu_information:状态说明
+Error_manager Task_Base::update_statu(Task_statu task_statu,std::string statu_information)
+{
+    m_task_statu=task_statu;
+    m_task_statu_information=statu_information;
+    return SUCCESS;
+}
+
+//判断是否超时。返回true表示任务超时,返回false表示任务没有超时
+bool Task_Base::is_over_time()
+{
+	return (std::chrono::system_clock::now() - m_task_start_time) > m_task_over_time;
+}
+
+//判断是否结束, TASK_OVER  TASK_ERROR TASK_DEAD 都算结束
+bool Task_Base::is_task_end()
+{
+	if(m_task_statu == TASK_OVER || m_task_statu == TASK_ERROR || m_task_statu == TASK_DEAD)
+	{
+		return true;
+	}
+	else
+	{
+	    return false;
+	}
+}
+
+
+
+
+//获取 任务单id
+unsigned int  Task_Base::get_task_id()
+{
+	return m_task_id;
+}
+
+//获取任务类型
+Task_Base::Task_type Task_Base::get_task_type()
+{
+    return m_task_type;
+}
+//获取任务单状态
+Task_Base::Task_statu  Task_Base::get_task_statu()
+{
+    return m_task_statu;
+}
+//设置 任务单状态
+void  Task_Base::set_task_statu(Task_statu task_statu)
+{
+	m_task_statu = task_statu;
+}
+
+
+//获取状态说明
+std::string Task_Base::get_task_statu_information()
+{
+    return m_task_statu_information;
+}
+//设置 状态说明
+void Task_Base::set_task_statu_information(std::string task_statu_information)
+{
+	m_task_statu_information = task_statu_information;
+}
+//获取 错误码,返回引用。
+Error_manager& Task_Base::get_task_error_manager()
+{
+	return m_task_error_manager;
+}
+//设置 错误码
+void Task_Base::set_task_error_manager(Error_manager & error_manager)
+{
+	m_task_error_manager = error_manager;
+}
+//比较覆盖错误码
+void Task_Base::compare_and_cover_task_error_manager(Error_manager & error_manager)
+{
+	m_task_error_manager.compare_and_cover_error(error_manager);
+}
+
+
+
+
+
+//获取任务接收方
+void * Task_Base::get_tast_receiver()
+{
+	return mp_tast_receiver;
+}
+//设置任务接收方
+void Task_Base::set_tast_receiver(void * p_tast_receiver)
+{
+	mp_tast_receiver = p_tast_receiver;
+}
+
+
+//获取 任务创建的时间点
+std::chrono::system_clock::time_point Task_Base::get_task_start_time()
+{
+	return m_task_start_time;
+}
+//设置 任务创建的时间点
+void Task_Base::set_task_start_time(std::chrono::system_clock::time_point task_start_time)
+{
+	m_task_start_time = task_start_time;
+}
+//获取 任务超时的时限
+std::chrono::milliseconds	Task_Base::get_task_over_time()
+{
+	return m_task_over_time;
+}
+//设置 任务超时的时限
+void	Task_Base::set_task_over_time(std::chrono::milliseconds task_over_time)
+{
+	m_task_over_time = task_over_time;
+}
+
+
+

+ 163 - 0
task/task_base.h

@@ -0,0 +1,163 @@
+/*
+ * Task_Base 是任务基类,用作不同的模块之间的通信载体。
+ *	每一个模块创建一个任务子类,从Task_Base继承。
+ *	然后任务子类自定义一些数据和读写数据的接口函数。
+ *	然后在任务接受方实现 execute_task(Task_Base* p_laser_task)
+ * */
+
+#ifndef TASK_BASE_H
+#define TASK_BASE_H
+#include <string>
+#include "../error_code/error_code.h"
+#include <chrono>
+#include <atomic>
+
+//任务单基类
+class Task_Base
+{
+
+public:
+
+//任务超时时间默认值10000ms,10秒
+#define TASK_OVER_TIME_DEFAULT				10000
+
+//任务类型
+	enum Task_type
+	{
+		UNKNOW_TASK             =0,				//未知任务单//初始化,默认值
+		LASER_MANGER_SCAN_TASK  =1,             //雷达管理模块的扫描任务,
+		LASER_BASE_SCAN_TASK    =2,             //单个雷达的扫描任务,
+		LOCATE_MANGER_TASK		=3,             //测量任务
+		PLC_TASK                =4,             //上传PLC任务
+
+		WANJI_MANAGER_TASK,						//万集雷达管理任务
+		WANJI_LIDAR_SCAN,						//万集雷达扫描任务
+		WANJI_LIDAR_DETECT,						//万集雷达定位任务
+
+
+	VELODYNE_MANAGER_TASK,						//velodyne雷达管理任务
+	VELODYNE_LIDAR_SCAN,						//velodyne雷达扫描任务
+	VELODYNE_LIDAR_DETECT,						//velodyne雷达定位任务
+
+
+		DISPATCH_MANAGER_TASK,					//调度管理任务
+		CARRIER_TASK,							//搬运器任务
+		CATCHER_TASK,							//抓取器任务
+		PASSAGEWAY_TASK,						//通道口任务
+
+	};
+//任务状态,如果任务故障,任务状态改为TASK_OVER,然后在m_task_error_manager 补充错误码。
+	enum Task_statu
+	{
+		TASK_CREATED            = 0,      		//任务创建, 发送方
+
+		TASK_ISSUE				= 1, 			//任务下发, 发送方
+		TASK_SIGNED             = 2,      		//已签收, 接收方
+		TASK_WORKING            = 3,      		//处理中, 接收方
+		TASK_OVER               = 4,   			//已结束, 接收方
+		TASK_STOP				= 5, 			//任务暂停, 接收方
+
+		TASK_ERROR              = 11,			//任务错误, 接收方
+
+		TASK_CANCEL				= 21,			//任务取消, 发送方
+		TASK_DEAD               = 22,           //任务死亡, 接收方
+
+		TASK_WITHDRAW			= 31, 			//任务收回, 发送方
+		TASK_FREE				= 32, 			//任务释放, 接收方
+
+	};
+protected:
+	//不允许构造基类,只允许子类构造,(多态)
+	Task_Base();
+public:
+    ~Task_Base();
+
+	//初始化任务单,必须初始化之后才可以使用,
+	//    input:tast_receiver 接受对象
+	//    input:task_over_time 超时时间
+	Error_manager task_init(void* p_tast_receiver,
+							std::chrono::milliseconds task_over_time);
+
+	//初始化任务单,必须初始化之后才可以使用,
+	//    input:task_statu 任务状态
+	//    input:task_statu_information 状态说明
+	//    input:tast_receiver 接受对象
+	//    input:task_over_time 超时时间
+	Error_manager task_init(Task_statu task_statu,
+					   std::string task_statu_information,
+					   void* p_tast_receiver,
+					   std::chrono::milliseconds task_over_time);
+
+	//任务单重置, 相当于重新创建, 会重置时间和错误码.
+	Error_manager task_reset();
+
+	//更新任务单
+    //task_statu: 任务状态
+    //statu_information:状态说明
+    Error_manager update_statu(Task_statu task_statu,std::string statu_information="");
+
+    //判断是否超时。返回true表示任务超时,返回false表示任务没有超时
+    bool is_over_time();
+
+	//判断是否结束, TASK_OVER  TASK_ERROR TASK_DEAD 都算结束
+	bool is_task_end();
+
+public:
+
+	//获取 任务单id
+	unsigned int  get_task_id();
+	//设置 任务单id
+//	void  set_task_id(unsigned int task_id) = delete;
+
+    //获取 任务类型
+    Task_type   get_task_type();
+	//设置 任务类型
+//	void   set_task_type(Task_type task_type) = delete;
+    //获取 任务单状态
+    Task_statu  get_task_statu();
+	//设置 任务单状态
+	void  set_task_statu(Task_statu task_statu);
+
+    //获取 状态说明
+    std::string get_task_statu_information();
+	//设置 状态说明
+	void set_task_statu_information(std::string task_statu_information);
+	//获取 错误码,返回引用。
+	Error_manager& get_task_error_manager();
+	//设置 错误码
+	void set_task_error_manager(Error_manager & error_manager);
+	//比较覆盖错误码
+	void compare_and_cover_task_error_manager(Error_manager & error_manager);
+
+	//获取任务接收方
+	void * get_tast_receiver();
+	//设置任务接收方
+	void set_tast_receiver(void * p_tast_receiver);
+	//获取 任务创建的时间点
+	std::chrono::system_clock::time_point get_task_start_time();
+	//设置 任务创建的时间点
+	void set_task_start_time(std::chrono::system_clock::time_point task_start_time);
+	//获取 任务超时的时限
+	std::chrono::milliseconds	get_task_over_time();
+	//设置 任务超时的时限
+	void	set_task_over_time(std::chrono::milliseconds task_over_time);
+
+
+protected:
+	unsigned int				m_task_id;						//任务id, 每次新建任务, 自动+1, 用于多任务的管理
+    Task_type                   m_task_type;					//任务类型,不允许中途修改
+	std::atomic<Task_statu>     m_task_statu;					//任务状态
+    std::string					m_task_statu_information;		//任务状态说明
+    void*						mp_tast_receiver;				//任务接收方,Task_Base并不分配和释放内存。
+    //注:mp_tast_receiver是可选的,可以为NULL。如果为NULL,则需要task_command_manager去找到接收对象。
+
+	std::chrono::system_clock::time_point 	m_task_start_time;	//任务创建的时间点
+	std::chrono::milliseconds	m_task_over_time;				//任务超时的时限
+	//注:std::chrono::system_clock::now();	//获取当前时间
+
+	//错误码,任务故障信息,任务输出
+	Error_manager               m_task_error_manager;
+};
+
+#endif //TASK_BASE_H
+

+ 80 - 0
task/task_base.puml

@@ -0,0 +1,80 @@
+@startuml
+@startuml
+skinparam classAttributeIconSize 0
+
+
+title  Task_Base 任务单基类
+
+
+
+
+enum Task_type
+{
+//任务类型
+	UNKNOW_TASK             =0,				//未知任务单//初始化,默认值
+	LASER_TASK              =1,             //雷达扫描任务,
+    LOCATE_TASK             =2,             //测量任务
+    PLC_TASK                =3,             //上传PLC任务
+}
+
+
+enum Task_statu
+{
+//任务状态,如果任务故障,任务状态改为TASK_OVER,然后在m_task_error_manager 补充错误码。
+    TASK_CREATED            =0,             //创建状态,默认值
+    TASK_SIGNED             =1,             //已签收
+    TASK_WORKING            =2,             //处理中
+    TASK_OVER               =3,             //已结束
+}
+
+
+
+
+class Task_Base
+{
+//任务单基类
+==public:==
+    ~Task_Base();
+..
+    //初始化任务单,初始任务单类型为 UNKONW_TASK
+    virtual Error_manager init();
+..
+    //更新任务单
+    //task_statu: 任务状态
+    //statu_information:状态说明
+    Error_manager update_statu(Task_statu task_statu,std::string statu_information="");
+..
+    //获取任务类型
+    Task_type   get_task_type();
+..
+    //获取任务单状态
+    Task_statu  get_statu();
+..
+    //获取状态说明
+    std::string get_statu_information();
+..
+	//获取 错误码
+	Error_manager& get_task_error_manager();
+..
+	//设置 错误码
+	void set_task_error_manager(Error_manager & error_manager);
+==protected:==
+    Task_Base();
+==protected:==
+    Task_type                   m_task_type;                    //任务类型
+    Task_statu                  m_task_statu;                   //任务状态
+    std::string                 m_task_statu_information;       //任务状态说明
+	//错误码,任务故障信息,任务输出
+	Error_manager               m_task_error_manager;
+}
+
+class Error_manager
+{
+//错误码管理
+}
+Task_Base <-- Error_manager : include
+
+
+Task_Base <-- Task_type : include
+Task_Base <-- Task_statu : include
+@enduml

+ 56 - 0
task/task_command_manager.cpp

@@ -0,0 +1,56 @@
+
+
+
+#include "task_command_manager.h"
+
+
+//对外的接口函数,所有的任务发送方,都必须使用该函数。
+//execute_task在内部解析了Task_Base里面的Task_type,然后转发给具体某个模块的实例对象。
+//input:p_task_base 任务单,基类的指针,指向子类的实例,(多态)
+Error_manager Task_command_manager::execute_task(Task_Base* p_task_base)
+{
+	Error_manager t_error;
+	void * tp_tast_receiver = p_task_base->get_tast_receiver();
+	switch ( p_task_base->get_task_type() )
+	{
+		case Task_Base::Task_type::UNKNOW_TASK:
+			t_error.error_manager_reset(Error_code::TASK_TYPE_IS_UNKNOW, Error_level::MINOR_ERROR,
+								" p_task_base->get_task_type() is  UNKNOW_TASK ");
+	        break;
+		case Task_Base::Task_type::LASER_MANGER_SCAN_TASK:
+			break;
+		case Task_Base::Task_type::LASER_BASE_SCAN_TASK:
+	        break;
+		case Task_Base::Task_type::LOCATE_MANGER_TASK:
+			break;
+		case Task_Base::Task_type::PLC_TASK:
+			break;
+		case Task_Base::Task_type::WANJI_MANAGER_TASK:
+			break;
+	    default:
+			t_error.error_manager_reset(Error_code::TASK_TYPE_IS_UNKNOW, Error_level::MINOR_ERROR,
+										" p_task_base->get_task_type() is  UNKNOW_TASK ");
+	        break;
+	}
+
+	return t_error;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 42 - 0
task/task_command_manager.h

@@ -0,0 +1,42 @@
+/*
+ * task_command_manager 是任务单的总管理,单例模式
+ * 负责管理任务单的派送和转发
+ * 所有的任务发送方都只需要调用 task_command_manager.get_instance_references().execute_task(p_task_base)
+ * 然后task_command_manager去找到对应的接受对象,来调用该对象的接口函数。 例如Laser_base::execute_task
+ * 这样发送方和接收方不直接绑定,双方完全独立。
+ * 没有在实例里面保存对方的回调函数或者对象指针
+ *
+ * */
+
+#ifndef TASK_COMAND_MANAGER_H
+#define TASK_COMAND_MANAGER_H
+#include <string>
+#include "../error_code/error_code.h"
+#include "../task/task_base.h"
+#include "../tool/singleton.h"
+
+
+class Task_command_manager:public Singleton<Task_command_manager>
+{
+// 子类必须把父类设定为友元函数,这样父类才能使用子类的私有构造函数。
+	friend class Singleton<Task_command_manager>;
+public:
+// 必须关闭拷贝构造和赋值构造,只能通过 get_instance 函数来进行操作唯一的实例。
+	Task_command_manager(const Task_command_manager&)=delete;
+	Task_command_manager& operator =(const Task_command_manager&)= delete;
+	~Task_command_manager()=default;
+private:
+// 父类的构造函数必须保护,子类的构造函数必须私有。
+	Task_command_manager()=default;
+
+public:
+	//对外的接口函数,所有的任务发送方,都必须使用该函数。
+	//execute_task在内部解析了Task_Base里面的Task_type,然后转发给具体某个模块的实例对象。
+	//input:p_task_base 任务单,基类的指针,指向子类的实例,(多态)
+	Error_manager execute_task(Task_Base* p_task_base);
+};
+
+
+
+#endif //TASK_COMAND_MANAGER_H
+

+ 12 - 0
task/task_command_manager.puml

@@ -0,0 +1,12 @@
+@startuml
+@startuml
+skinparam classAttributeIconSize 0
+
+
+title  task_command_manager 任务单管理类
+
+
+
+
+
+@enduml

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 51309 - 0
test.txt


+ 33 - 0
tool/TaskQueue/BaseTask.cpp

@@ -0,0 +1,33 @@
+//
+//  BaseTaskQueue.cpp
+//  LibDriveRating-CXX
+//
+//  Created by Melo Yao on 6/9/14.
+//  Copyright (c) 2014 AutoNavi. All rights reserved.
+//
+
+#include "BaseTask.h"
+
+namespace tq {
+    BaseTask::BaseTask():ITask(),_cancelled(false)
+    {
+    }
+    
+    void BaseTask::Cancel()
+    {
+        _cancelled = true;
+    }
+    
+    bool BaseTask::IsCancelled() const
+    {
+        return _cancelled;
+    }
+    
+    void BaseTask::Run()
+    {
+        if (_cancelled) {
+            return;
+        }
+        Main();
+    }
+}

+ 29 - 0
tool/TaskQueue/BaseTask.h

@@ -0,0 +1,29 @@
+//
+//  BaseTaskQueue.h
+//  LibDriveRating-CXX
+//
+//  Created by Melo Yao on 6/9/14.
+//  Copyright (c) 2014 AutoNavi. All rights reserved.
+//
+
+#ifndef __LibDriveRating_CXX__BaseTaskQueue__
+#define __LibDriveRating_CXX__BaseTaskQueue__
+
+#include "TQInterface.h"
+namespace tq
+{
+    class BaseTask : public ITask
+    {
+    private:
+        volatile bool _cancelled;
+    public:
+        BaseTask();
+        void Run();
+        virtual void Cancel();
+        bool IsCancelled() const;
+        
+        virtual void Main() = 0;
+        TaskCategory GetCategory() const {return NoCategory;}
+    };
+}
+#endif /* defined(__LibDriveRating_CXX__BaseTaskQueue__) */

+ 23 - 0
tool/TaskQueue/TQFactory.cpp

@@ -0,0 +1,23 @@
+//
+//  TQFactory.cpp
+//  LibDriveRating-CXX
+//
+//  Created by Melo Yao on 6/10/14.
+//  Copyright (c) 2014 AutoNavi. All rights reserved.
+//
+
+#include "TQFactory.h"
+#include "ThreadTaskQueue.h"
+namespace tq {
+    IQueue* TQFactory::CreateDefaultQueue()
+    {
+        return new ThreadTaskQueue();
+    }
+    
+    void TQFactory::ReleaseQueue(IQueue* queue)
+    {
+        delete queue;
+    }
+    
+    
+}

+ 24 - 0
tool/TaskQueue/TQFactory.h

@@ -0,0 +1,24 @@
+//
+//  TQFactory.h
+//  LibDriveRating-CXX
+//
+//  Created by Melo Yao on 6/10/14.
+//  Copyright (c) 2014 AutoNavi. All rights reserved.
+//
+
+#ifndef __LibDriveRating_CXX__TQFactory__
+#define __LibDriveRating_CXX__TQFactory__
+
+#include "TQInterface.h"
+
+namespace tq {
+    class TQFactory
+    {
+    public:
+        static IQueue* CreateDefaultQueue();
+
+        static void ReleaseQueue(IQueue* queue);
+    };
+}
+
+#endif /* defined(__LibDriveRating_CXX__TQFactory__) */

+ 58 - 0
tool/TaskQueue/TQInterface.h

@@ -0,0 +1,58 @@
+//
+//  TQInterface.h
+//  LibDriveRating-CXX
+//
+//  Created by Melo Yao on 6/9/14.
+//  Copyright (c) 2014 AutoNavi. All rights reserved.
+//
+
+#ifndef __LibDriveRating_CXX__TQInterface__
+#define __LibDriveRating_CXX__TQInterface__
+
+namespace tq {
+    typedef unsigned long TaskCategory;
+
+    const TaskCategory NoCategory = 0;
+
+    class ITask
+    {
+    public:
+        virtual void Run() = 0;
+        virtual void Cancel() = 0;
+        virtual bool IsCancelled() const = 0;
+        virtual TaskCategory GetCategory() const = 0;
+        virtual ~ITask(){}
+    };
+    
+    typedef void (*TaskRecycler)(ITask* task,void* context);
+
+    class IQueue
+    {
+    public:
+        virtual void Start(unsigned int nThreads = 1) = 0;
+
+        virtual void Stop() = 0;
+
+        virtual void AddTask(ITask* task) = 0;
+        
+        virtual void GetTasks(ITask** tasksBuf, unsigned int taskBufSize) const= 0;
+        
+        virtual unsigned int TaskCount() const = 0;
+        
+        virtual void CancelAll() = 0;
+        
+        virtual void WaitForFinish() = 0;
+
+        virtual void Suspend() = 0;
+        
+        virtual void Resume() = 0;
+        
+        virtual void SetTaskRecycler(TaskCategory cat, TaskRecycler recycler,void *context){}
+
+        virtual void ClearTaskRecycler(TaskCategory cat){}
+
+        virtual ~IQueue() {}
+    };
+}
+
+#endif /* defined(__LibDriveRating_CXX__TQInterface__) */

+ 89 - 0
tool/TaskQueue/TaskPool.h

@@ -0,0 +1,89 @@
+#ifndef H_TASK_POOL_H
+#define H_TASK_POOL_H
+#include <list>
+#include "threadpp/threadpp.h"
+#include <cstdlib>
+#include <cstdio>
+namespace tq
+{
+    template <typename TaskType>
+    class TaskPool
+    {
+    public:
+        TaskPool(unsigned capacity = 10);
+        ~TaskPool();
+        TaskType* GetTask(TaskType const& taskPrototype);
+        void RecycleTask(TaskType* task);
+        void Purge();
+    private:
+        threadpp::lock _mutex;
+        std::list<TaskType*> _tasks;
+        unsigned _capacity;
+    };
+
+    template <typename TaskType>
+    TaskType* TaskPool<TaskType>::GetTask(TaskType const& taskPrototype)
+    {
+        _mutex.lock();
+        if(!_tasks.empty())
+        {
+
+            TaskType* taskptr = _tasks.front();
+            _tasks.pop_front();
+            _mutex.unlock();
+            new (taskptr)TaskType(taskPrototype);
+            return taskptr;
+        }
+        else
+        {
+            _mutex.unlock();
+            static int newcount = 0;
+            TaskType* taskptr = new TaskType(taskPrototype);
+            return taskptr;
+        }
+    }
+
+    template <typename TaskType>
+    void TaskPool<TaskType>::RecycleTask(TaskType* task)
+    {
+        (*task).~TaskType();
+        _mutex.lock();
+        if(_tasks.size()<_capacity)
+        {
+            _tasks.push_back(task);
+        }
+        else
+        {
+            free(task);
+        }
+        _mutex.unlock();
+    }
+    
+    template <typename TaskType>
+    void TaskPool<TaskType>::Purge()
+    {
+        _mutex.lock();
+        if(!_tasks.empty())
+        {
+            for(typename std::list<TaskType*>::const_iterator it = _tasks.begin();it!=_tasks.end();++it)
+            {
+                free(*it);
+            }
+            _tasks.clear();
+        }
+        _mutex.unlock();
+    }
+
+    template <typename TaskType>
+    TaskPool<TaskType>::TaskPool(unsigned capacity):
+    _capacity(capacity)
+    {
+    }
+
+    template <typename TaskType>
+    TaskPool<TaskType>::~TaskPool()
+    {
+        this->Purge();
+    }
+}
+#endif

+ 288 - 0
tool/TaskQueue/ThreadTaskQueue.cpp

@@ -0,0 +1,288 @@
+//
+//  ThreadTaskQueue.cpp
+//  LibDriveRating-CXX
+//
+//  Created by Melo Yao on 6/9/14.
+//  Copyright (c) 2014 AutoNavi. All rights reserved.
+//
+
+#include "ThreadTaskQueue.h"
+#include <algorithm>
+#define WAIT_TIMEOUT 5000
+
+using namespace threadpp;
+
+namespace tq{
+    
+    class QueueRunnable
+    {
+        ThreadTaskQueue* queue;
+        ITask* currentTask;
+    protected:
+        static void run_callback(void*);
+        thread* th;
+        
+        QueueRunnable(ThreadTaskQueue* q):queue(q),currentTask(NULL){}
+        void run();
+        void CancelCurrentTask();
+        bool TaskIsRunning() const;
+        friend class ThreadTaskQueue;
+    };
+    
+    void QueueRunnable::run_callback(void *ctx)
+    {
+        ((QueueRunnable*) ctx)->run();
+    }
+    
+    void QueueRunnable::run()
+    {
+        while (queue->IsStarted()) {
+            queue->LockQueue();
+            ITask* task = queue->NextTask();
+            if (task == NULL) {
+                queue->UnlockQueue();
+                continue;
+            }
+            currentTask = task;
+            queue->UnlockQueue();
+            task->Run();
+
+            queue->LockQueue();
+            currentTask = NULL;
+            queue->FinishTask(task);
+            queue->NotifyQueue();
+            queue->UnlockQueue();
+        }
+    }
+    
+    void QueueRunnable::CancelCurrentTask()
+    {
+        queue->LockQueue();
+        if(currentTask)
+        {
+            currentTask->Cancel();
+        }
+        queue->UnlockQueue();
+    }
+    
+    bool QueueRunnable::TaskIsRunning() const
+    {
+        return currentTask != NULL;
+    }
+    
+    ThreadTaskQueue::ThreadTaskQueue():_tasklist(),_started(false),_suspended(false)
+    {
+        
+    }
+    
+    void ThreadTaskQueue::Start(unsigned int nThreads)
+    {
+        _mutex.lock();
+        if (_started) {
+            _mutex.unlock();
+            return;
+        }
+        _started = true;
+        _threads.reserve(nThreads);
+        for (int i = 0; i<nThreads; ++i) {
+            QueueRunnable* runnable = new QueueRunnable(this);
+            runnable->th = new thread(QueueRunnable::run_callback, runnable);
+            _threads.push_back(runnable);
+        }
+        _mutex.unlock();
+    }
+    
+    void ThreadTaskQueue::Stop()
+    {
+        _mutex.lock();
+        if (!_started) {
+            _mutex.unlock();
+            return;
+        }
+        _started = false;
+        for (std::list<ITask*>::iterator it = _tasklist.begin(); it!= _tasklist.end(); ++it) {
+            delete *it;
+        }
+        _tasklist.clear();
+        _mutex.notify_all();
+        std::vector<QueueRunnable*> copy(_threads);
+        _threads.clear();
+        _mutex.unlock();
+        for (std::vector<QueueRunnable*>::iterator it = copy.begin(); it!=copy.end(); ++it) {
+            (*it)->th->join();
+            thread* t = (*it)->th;
+            delete (*it);
+            delete t;
+        }
+    }
+    
+    bool ThreadTaskQueue::IsStarted() const
+    {
+        return _started;
+    }
+
+
+    void ThreadTaskQueue::AddTask(ITask* task)
+    {
+        _mutex.lock();
+        if (_started) {
+            _tasklist.push_back(task);
+            _mutex.notify_all();
+        }
+        _mutex.unlock();
+    }
+    
+    void ThreadTaskQueue::GetTasks(ITask** tasksBuf, unsigned int taskBufSize) const
+    {
+        recursivelock* mutex = const_cast<recursivelock*>(&_mutex);
+        mutex->lock();
+        size_t count = 0;
+        for (std::list<ITask*>::const_iterator it = _tasklist.begin(); it!=_tasklist.end(); ++it) {
+            if (count<taskBufSize) {
+                tasksBuf[count] = *it;
+                count++;
+            }
+            else
+            {
+                break;
+            }
+        }
+        mutex->unlock();
+    }
+    
+    unsigned int ThreadTaskQueue::TaskCount() const
+    {
+        recursivelock* mutex = const_cast<recursivelock*>(&_mutex);
+        mutex->lock();
+        unsigned int count = (unsigned int)_tasklist.size();
+        mutex->unlock();
+        return count;
+    }
+    
+    void ThreadTaskQueue::CancelAll()
+    {
+        _mutex.lock();
+        for (std::vector<QueueRunnable*>::iterator it = _threads.begin(); it!=_threads.end(); ++it) {
+            (*it)->CancelCurrentTask();
+        }
+        for (std::list<ITask*>::const_iterator it = _tasklist.begin(); it!=_tasklist.end(); ++it) {
+            (*it)->Cancel();
+        }
+        _mutex.unlock();
+        
+    }
+    
+    void ThreadTaskQueue::WaitForFinish()
+    {
+        
+        while (true) {
+            _mutex.lock();
+            bool isExecuting = false;
+            for (std::vector<QueueRunnable*>::iterator it = _threads.begin(); it!=_threads.end(); ++it) {
+                if ((*it)->TaskIsRunning()) {
+                    isExecuting = true;
+                    break;
+                }
+            }
+            if (!isExecuting&&_tasklist.size() == 0) {
+                _mutex.unlock();
+                break;
+            }
+            _mutex.wait(100);
+            _mutex.unlock();
+        }
+        
+    }
+    
+    void ThreadTaskQueue::Suspend()
+    {
+        _mutex.lock();
+        _suspended = true;
+        _mutex.unlock();
+    }
+    
+    void ThreadTaskQueue::Resume()
+    {
+        _mutex.lock();
+        _suspended = false;
+        _mutex.notify_all();
+        _mutex.unlock();
+
+    }
+    
+    void ThreadTaskQueue::NotifyQueue()
+    {
+        _mutex.notify_all();
+    }
+    
+    ITask* ThreadTaskQueue::NextTask()
+    {
+        while (_started && (_tasklist.empty()||_suspended)) {
+            _mutex.wait(WAIT_TIMEOUT);//defensive waiting time limit.
+        }
+        ITask* task = NULL;
+        if (_tasklist.size()>0) {
+            task = _tasklist.front();
+            _tasklist.pop_front();
+        }
+        return task;
+    }
+    
+    inline
+    void ThreadTaskQueue::LockQueue()
+    {
+        _mutex.lock();
+    }
+    
+    inline
+    void ThreadTaskQueue::UnlockQueue()
+    {
+        _mutex.unlock();
+    }
+
+    inline
+    void ThreadTaskQueue::FinishTask(ITask* task)
+    {
+        if(task->GetCategory() != NoCategory)
+        {
+            _recyclerMutex.lock();
+            std::map<TaskCategory,RecyclerPair>::iterator it = _recyclers.find(task->GetCategory());
+            if(it!=_recyclers.end())
+            {
+                RecyclerPair pair = it->second;
+                _recyclerMutex.unlock();
+                pair.recycler(task,pair.context);
+                return;
+            }
+            _recyclerMutex.unlock();
+        }
+        //析构任务
+        delete task;
+
+    }
+    
+    void ThreadTaskQueue::SetTaskRecycler(TaskCategory cat, TaskRecycler recycler,void *context)
+    {
+        _recyclerMutex.lock();
+        std::pair<TaskCategory,RecyclerPair> pair(cat, RecyclerPair(recycler,context));
+        _recyclers.insert(pair);
+        _recyclerMutex.unlock();
+    }
+
+    void ThreadTaskQueue::ClearTaskRecycler(TaskCategory cat)
+    {
+        _recyclerMutex.lock();
+        std::map<TaskCategory,RecyclerPair>::iterator it = _recyclers.find(cat);
+        if(it!=_recyclers.end())
+        {
+            _recyclers.erase(it);
+        }
+        _recyclerMutex.unlock();
+    }
+
+    ThreadTaskQueue::~ThreadTaskQueue()
+    {
+        this->Stop();//Defensive stop.
+    }
+    
+}

+ 89 - 0
tool/TaskQueue/ThreadTaskQueue.h

@@ -0,0 +1,89 @@
+//
+//  ThreadTaskQueue.h
+//  LibDriveRating-CXX
+//
+//  Created by Melo Yao on 6/9/14.
+//  Copyright (c) 2014 AutoNavi. All rights reserved.
+//
+
+#ifndef __LibDriveRating_CXX__ThreadTaskQueue__
+#define __LibDriveRating_CXX__ThreadTaskQueue__
+
+#include "TQInterface.h"
+#include "BaseTask.h"
+#include <list>
+#include <map>
+#include <vector>
+#include "threadpp/threadpp.h"
+
+namespace tq
+{
+    class QueueRunnable;
+    
+    class ThreadTaskQueue:public IQueue
+    {
+    public:
+        ThreadTaskQueue();
+        
+        void Start(unsigned int nThreads = 1);
+        
+        void Stop();
+        
+        bool IsStarted() const;
+
+        void AddTask(ITask* task);//Will transfer the ownership of task.
+        
+        void GetTasks(ITask** tasksBuf, unsigned int taskBufSize) const;
+        
+        unsigned int TaskCount() const;
+        
+        void CancelAll();
+        
+        void WaitForFinish() ;
+        
+        void Suspend();
+        
+        void Resume();
+
+        void SetTaskRecycler(TaskCategory cat, TaskRecycler recycler,void *context);
+
+        void ClearTaskRecycler(TaskCategory cat);
+        
+        ~ThreadTaskQueue();
+        
+    protected:
+        
+        void LockQueue();
+        
+        void UnlockQueue();
+        
+        void NotifyQueue();
+        
+        ITask* NextTask();
+
+        void FinishTask(ITask* task);
+        
+        friend class QueueRunnable;
+
+    private:
+        struct RecyclerPair
+        {
+            TaskRecycler recycler;
+            void *context;
+            RecyclerPair(TaskRecycler r,void* c):
+                recycler(r),context(c)
+            {
+            }
+        };
+
+        std::map<TaskCategory,RecyclerPair> _recyclers;
+        std::list<ITask*> _tasklist;
+        std::vector<QueueRunnable*> _threads;
+        threadpp::recursivelock _mutex;
+        threadpp::lock _recyclerMutex;
+        bool _started;
+        bool _suspended;
+    };
+}
+
+#endif /* defined(__LibDriveRating_CXX__ThreadTaskQueue__) */

+ 35 - 0
tool/TaskQueue/threadpp/impl/pthread_lock.h

@@ -0,0 +1,35 @@
+//
+//  pthread_lock.h
+//  threadpp
+//
+//  Created by Melo Yao on 1/15/15.
+//  Copyright (c) 2015 Melo Yao. All rights reserved.
+//
+
+#ifndef __threadpp__pthread_lock__
+#define __threadpp__pthread_lock__
+//extern "C"
+//{
+#include <pthread.h>
+//}
+namespace threadpp
+{
+    class pthread_lock
+    {
+        pthread_mutex_t _mutex;
+        pthread_cond_t _cond;
+        void operator=(const pthread_lock& l){};
+        pthread_lock(const pthread_lock& l){};
+    public:
+        pthread_lock();
+        ~pthread_lock();
+        void lock();
+        void unlock();
+        void wait();
+        void wait(unsigned long millisecs);
+        void notify();
+        void notify_all();
+    };
+}
+#include "pthread_lock.hpp"
+#endif /* defined(__threadpp__pthread_lock__) */

+ 73 - 0
tool/TaskQueue/threadpp/impl/pthread_lock.hpp

@@ -0,0 +1,73 @@
+//
+//  pthread_lock.cpp
+//  threadpp
+//
+//  Created by Melo Yao on 1/15/15.
+//  Copyright (c) 2015 Melo Yao. All rights reserved.
+//
+#ifndef __threadpp__pthread_lock__hpp__
+#define __threadpp__pthread_lock__hpp__
+#include "../threadpp_assert.h"
+#include <errno.h>
+#include <cstring>
+
+#include <sys/time.h>
+
+static inline void timespec_for(struct timespec* t,unsigned long millisecs) {
+    struct timeval tv;
+    gettimeofday(&tv, NULL);
+    t->tv_nsec = tv.tv_usec*1000 + millisecs*1000000;
+    t->tv_sec = tv.tv_sec + (t->tv_nsec/1000000000);
+    t->tv_nsec = t->tv_nsec%1000000000;
+}
+
+namespace threadpp{
+    inline pthread_lock::pthread_lock()
+    {
+        pthread_mutex_init(&_mutex, NULL);
+        pthread_cond_init(&_cond, NULL);
+    }
+    
+    inline pthread_lock::~pthread_lock()
+    {
+        pthread_mutex_destroy(&_mutex);
+        pthread_cond_destroy(&_cond);
+    }
+    
+    inline void pthread_lock::lock()
+    {
+        int code = pthread_mutex_lock(&_mutex);
+        ASSERT(code == 0, "lock failed,error:%s",strerror(code));
+    }
+    
+    inline void pthread_lock::unlock()
+    {
+        int code = pthread_mutex_unlock(&_mutex);
+        ASSERT(code == 0, "unlock failed,error:%s",strerror(code));
+    }
+    
+    inline void pthread_lock::wait()
+    {
+        int code = pthread_cond_wait(&_cond, &_mutex);
+        ASSERT(code == 0 || code == ETIMEDOUT, "wait failed,error:%s",strerror(code));
+    }
+    
+    inline void pthread_lock::wait(unsigned long millisecs)
+    {
+        struct timespec ts;
+        timespec_for(&ts,millisecs);
+        int code = pthread_cond_timedwait(&_cond, &_mutex, &ts);
+        ASSERT(code == 0 || code == ETIMEDOUT, "timed wait failed,error:%s",strerror(code));
+    }
+    
+    inline void pthread_lock::notify()
+    {
+        pthread_cond_signal(&_cond);
+    }
+    
+    inline void pthread_lock::notify_all()
+    {
+        pthread_cond_broadcast(&_cond);
+    }
+}
+#endif

+ 45 - 0
tool/TaskQueue/threadpp/impl/pthread_thread.h

@@ -0,0 +1,45 @@
+//
+//  pthread_thread.h
+//  threadpp
+//
+//  Created by Melo Yao on 1/15/15.
+//  Copyright (c) 2015 Melo Yao. All rights reserved.
+//
+
+#ifndef __threadpp__pthread_thread__
+#define __threadpp__pthread_thread__
+#include <pthread.h>
+namespace threadpp
+{
+    class pthread_thread
+    {
+        struct pthread_context
+        {
+            void(*fp)(void* context);
+            void* context;
+        } _context;
+        
+        pthread_t _thread;
+        pthread_thread(){};
+        void operator=(const pthread_thread& t){};
+        pthread_thread(const pthread_thread& t){};
+        static void* pthread_fp_delegate(void*);
+    public:
+        typedef void (*runnable)(void* ctx);
+        typedef unsigned long long id_type;
+        
+        static id_type null_id();
+        
+        pthread_thread(runnable r,void* t);
+        
+        ~pthread_thread();
+        void join();
+        void detach();
+        bool is_equal(const pthread_thread& t) const;
+        id_type get_id() const;
+        static id_type current_thread_id();
+        static void sleep(unsigned long millisecs);
+    };
+}
+#include "pthread_thread.hpp"
+#endif /* defined(__threadpp__pthread_thread__) */

+ 110 - 0
tool/TaskQueue/threadpp/impl/pthread_thread.hpp

@@ -0,0 +1,110 @@
+//
+//  pthread_thread.cpp
+//  threadpp
+//
+//  Created by Melo Yao on 1/15/15.
+//  Copyright (c) 2015 Melo Yao. All rights reserved.
+//
+
+#ifndef __threadpp__pthread_thread__hpp__
+#define __threadpp__pthread_thread__hpp__
+
+#include <errno.h>
+#include "../threadpp_assert.h"
+#include <cstring>
+#include <cmath>
+#include <unistd.h>
+namespace threadpp
+{
+    inline pthread_thread::id_type pthread_thread::null_id()
+    {
+        return 0;
+    }
+    
+    inline void* pthread_thread::pthread_fp_delegate(void* ctx)
+    {
+        pthread_thread::pthread_context* pctx =static_cast<pthread_thread::pthread_context*>(ctx);
+        pctx->fp(pctx->context);
+        return NULL;
+    }
+    
+    inline pthread_thread::pthread_thread(runnable r,void* t)
+    {
+        _context.fp = r;
+        _context.context = t;
+        int code = pthread_create(&_thread, NULL, pthread_thread::pthread_fp_delegate, &_context);
+        ASSERT(code==0,"create thread failed,error:%s",strerror(code));
+    }
+    
+//    pthread_thread::pthread_thread(runnable r,void* t,float priority)
+//    {
+//        _context.fp = r;
+//        _context.context = t;
+//        pthread_attr_t tattr;
+//        pthread_attr_init(&tattr);
+//        struct sched_param schp;
+//        int policy = SCHED_FIFO;
+//        pthread_attr_getschedpolicy(&tattr, &policy);
+//        pthread_attr_getschedparam(&tattr, &schp);
+//        float pr =fminf(1.0f,fmaxf(0.0f, priority));
+//        schp.sched_priority = sched_get_priority_min(policy) + pr*(sched_get_priority_max(policy) - sched_get_priority_min(policy));
+//        pthread_attr_setschedparam(&tattr, &schp);
+//        int code = pthread_create(&_thread, &tattr, pthread_thread::pthread_fp_delegate, &_context);
+//        ASSERT(code==0,"create thread failed,error:%s",strerror(code));
+//        pthread_attr_destroy(&tattr);
+//    }
+    
+    inline pthread_thread::~pthread_thread()
+    {
+        ASSERT(_thread == 0,"%s","must join or detach a thread before destructing it");
+    }
+    
+    inline void pthread_thread::join()
+    {
+        void* ret = NULL;
+        int code = pthread_join(_thread, &ret);
+        _thread = 0;
+        ASSERT(code==0,"join thread failed,error:%s",strerror(code));
+    }
+    
+    inline void pthread_thread::detach()
+    {
+        int code = pthread_detach(_thread);
+        _thread = 0;
+        ASSERT(code==0,"join thread failed,error:%s",strerror(code));
+
+    }
+    
+    inline bool pthread_thread::is_equal(const pthread_thread& t) const
+    {
+        return pthread_equal(_thread, t._thread);
+    }
+    
+    inline void pthread_thread::sleep(unsigned long millisecs)
+    {
+        usleep((useconds_t)millisecs*1000);
+    }
+    
+    inline pthread_thread::id_type pthread_thread::get_id() const
+    {
+#ifdef __APPLE__
+        __uint64_t tid;
+        return pthread_threadid_np(_thread, &tid);
+        return tid;
+#else
+        return (unsigned long long)(_thread);
+#endif
+    }
+    
+    inline pthread_thread::id_type pthread_thread::current_thread_id()
+    {
+#ifdef __APPLE__
+        __uint64_t tid;
+        pthread_threadid_np(pthread_self(), &tid);
+        return tid;
+#else
+        return (unsigned long long)(pthread_self());
+#endif
+    }
+}
+#endif

+ 33 - 0
tool/TaskQueue/threadpp/impl/std_lock.h

@@ -0,0 +1,33 @@
+//
+//  std_lock.h
+//  threadpp
+//
+//  Created by Melo Yao on 1/15/15.
+//  Copyright (c) 2015 Melo Yao. All rights reserved.
+//
+
+#ifndef __threadpp__std_lock__
+#define __threadpp__std_lock__
+#include <mutex>
+#include <condition_variable>
+namespace threadpp
+{
+    class std_lock
+    {
+        std::mutex _mutex;
+        std::condition_variable_any _cond;
+        void operator=(const std_lock& l){};
+        std_lock(const std_lock& l){};
+    public:
+        std_lock();
+        ~std_lock();
+        void lock();
+        void unlock();
+        void wait();
+        void wait(unsigned long millisecs);
+        void notify();
+        void notify_all();
+    };
+}
+#include "std_lock.hpp"
+#endif /* defined(__threadpp__std_lock__) */

+ 52 - 0
tool/TaskQueue/threadpp/impl/std_lock.hpp

@@ -0,0 +1,52 @@
+//
+//  std_lock.cpp
+//  threadpp
+//
+//  Created by Melo Yao on 1/15/15.
+//  Copyright (c) 2015 Melo Yao. All rights reserved.
+//
+#ifndef __threadpp__std_lock__hpp__
+#define __threadpp__std_lock__hpp__
+#include "../threadpp_assert.h"
+
+namespace threadpp{
+    
+    inline std_lock::std_lock():_mutex(),_cond()
+    {
+    }
+    
+    inline std_lock::~std_lock()
+    {
+    }
+    
+    inline void std_lock::lock()
+    {
+        _mutex.lock();
+    }
+    
+    inline void std_lock::unlock()
+    {
+        _mutex.unlock();
+    }
+    
+    inline void std_lock::wait()
+    {
+        _cond.wait(_mutex);
+    }
+    
+    inline void std_lock::wait(unsigned long millisecs)
+    {
+        _cond.wait_for(_mutex, std::chrono::milliseconds(millisecs));
+    }
+    
+    inline void std_lock::notify()
+    {
+        _cond.notify_one();
+    }
+    
+    inline void std_lock::notify_all()
+    {
+        _cond.notify_all();
+    }
+}
+#endif

+ 40 - 0
tool/TaskQueue/threadpp/impl/std_thread.h

@@ -0,0 +1,40 @@
+//
+//  std_thread.h
+//  threadpp
+//
+//  Created by Melo Yao on 1/15/15.
+//  Copyright (c) 2015 Melo Yao. All rights reserved.
+//
+
+#ifndef __threadpp__std_thread__
+#define __threadpp__std_thread__
+#include <thread>
+
+namespace threadpp
+{
+    class std_thread
+    {
+        std::thread _thread;
+        std_thread(){};
+        void operator=(const std_thread& t){};
+        std_thread(const std_thread& t){};
+    public:
+        typedef unsigned long long id_type;
+        
+        typedef void (*runnable)(void* ctx);
+        
+        static id_type null_id();
+        
+        std_thread(runnable r,void* t);
+        
+        ~std_thread();
+        void join();
+        void detach();
+        bool is_equal(const std_thread& t) const;
+        id_type get_id() const;
+        static id_type current_thread_id();
+        static void sleep(unsigned long millisecs);
+    };
+}
+#include "std_thread.hpp"
+#endif /* defined(__threadpp__std_thread__) */

+ 64 - 0
tool/TaskQueue/threadpp/impl/std_thread.hpp

@@ -0,0 +1,64 @@
+//
+//  std_thread.cpp
+//  threadpp
+//
+//  Created by Melo Yao on 1/15/15.
+//  Copyright (c) 2015 Melo Yao. All rights reserved.
+//
+#ifndef __threadpp__std_thread__hpp__
+#define __threadpp__std_thread__hpp__
+#include <functional>
+#include <algorithm>
+namespace threadpp
+{
+    inline std_thread::id_type std_thread::null_id()
+    {
+        return 0;
+    }
+    
+    inline void* std_fp_delegate(std_thread::runnable r, void* context)
+    {
+        r(context);
+        return nullptr;
+    }
+    
+    inline std_thread::std_thread(runnable r,void* t):_thread(std::bind(std_fp_delegate,r,t))
+    {
+    }
+    
+    inline std_thread::~std_thread()
+    {
+        
+    }
+    
+    inline void std_thread::join()
+    {
+        _thread.join();
+    }
+    
+    inline void std_thread::detach()
+    {
+        _thread.detach();
+    }
+    
+    inline bool std_thread::is_equal(const std_thread& t) const
+    {
+        return _thread.get_id() == t._thread.get_id();
+    }
+    
+    inline std_thread::id_type std_thread::get_id() const
+    {
+        return std::hash<std::thread::id>()(_thread.get_id());
+    }
+    
+    inline void std_thread::sleep(unsigned long millisecs)
+    {
+        std::this_thread::sleep_for(std::chrono::milliseconds(millisecs));
+    }
+    
+    inline std_thread::id_type std_thread::current_thread_id()
+    {
+        return std::hash<std::thread::id>()(std::this_thread::get_id());
+    }
+}
+#endif

+ 37 - 0
tool/TaskQueue/threadpp/impl/win_lock.h

@@ -0,0 +1,37 @@
+//
+//  win_lock.h
+//  threadpp
+//
+//  Created by Melo Yao on 1/15/15.
+//  Copyright (c) 2015 Melo Yao. All rights reserved.
+//
+
+#ifndef __threadpp__win_lock__
+#define __threadpp__win_lock__
+
+#include <windows.h>
+
+namespace threadpp
+{
+    class win_lock
+    {
+        CRITICAL_SECTION _mutex;
+        CONDITION_VARIABLE _cond;
+        volatile unsigned int _owner;
+        volatile unsigned int _count;
+        void operator=(const win_lock& l){};
+        win_lock(const win_lock& l){};
+    public:
+        win_lock();
+        ~win_lock();
+        void lock();
+        void unlock();
+        void wait();
+        void wait(unsigned long millisecs);
+        void notify();
+        void notify_all();
+    };
+}
+
+#include "win_lock.hpp"
+#endif /* defined(__threadpp__win_lock__) */

+ 80 - 0
tool/TaskQueue/threadpp/impl/win_lock.hpp

@@ -0,0 +1,80 @@
+//
+//  win_lock.cpp
+//  threadpp
+//
+//  Created by Melo Yao on 1/15/15.
+//  Copyright (c) 2015 Melo Yao. All rights reserved.
+//
+#ifndef __threadpp__win_lock__hpp__
+#define __threadpp__win_lock__hpp__
+
+#include "win_thread.h"
+#include "../threadpp_assert.h"
+#include "stdio.h"
+namespace threadpp{
+    
+    static inline void test_error(const char* title)
+    {
+        DWORD e = GetLastError();
+        ASSERT(e==0,"%s failed,error:%d",title,e);
+    }
+    
+    inline win_lock::win_lock():_owner(0),_count(0)
+    {
+        SetLastError(0);
+        InitializeCriticalSection(&_mutex);
+        InitializeConditionVariable(&_cond);
+        test_error("init");
+    }
+    
+    inline win_lock::~win_lock()
+    {
+        DeleteCriticalSection(&_mutex);
+    }
+    
+    inline void win_lock::lock()
+    {
+        SetLastError(0);
+        
+        EnterCriticalSection(&_mutex);
+        
+        test_error("lock");
+    }
+    
+    inline void win_lock::unlock()
+    {
+        SetLastError(0);
+        LeaveCriticalSection(&_mutex);
+        test_error("unlock");
+    }
+    
+    inline void win_lock::wait()
+    {
+        SetLastError(0);
+        SleepConditionVariableCS(&_cond,&_mutex,0xFFFFFFFF);
+        test_error("wait");
+    }
+    
+    inline void win_lock::wait(unsigned long millisecs)
+    {
+        SetLastError(0);
+        SleepConditionVariableCS(&_cond,&_mutex,millisecs);
+        DWORD e = GetLastError();
+        ASSERT(e==0||e == ERROR_TIMEOUT,"timed wait failed,error:",e);
+    }
+    
+    inline void win_lock::notify()
+    {
+        SetLastError(0);
+        WakeConditionVariable(&_cond);
+        test_error("notify");
+    }
+    
+    inline void win_lock::notify_all()
+    {
+        SetLastError(0);
+        WakeAllConditionVariable(&_cond);
+        test_error("notify all");
+    }
+}
+#endif

+ 53 - 0
tool/TaskQueue/threadpp/impl/win_thread.h

@@ -0,0 +1,53 @@
+//
+//  win_thread.h
+//  threadpp
+//
+//  Created by Melo Yao on 1/15/15.
+//  Copyright (c) 2015 Melo Yao. All rights reserved.
+//
+
+#ifndef __threadpp__win_thread__
+#define __threadpp__win_thread__
+
+#include <windows.h>
+
+namespace threadpp
+{
+    class win_thread
+    {
+        struct win_context
+        {
+            void(*fp)(void*);
+            void* context;
+        } _context;
+#if NO_CRT
+        typedef DWORD handle_t;
+#else
+		typedef unsigned handle_t;
+#endif
+		static handle_t __stdcall win_fp_delegate(void* context);
+        handle_t _thread_id;
+        HANDLE _handle;
+        win_thread(){};
+        void operator=(const win_thread& t){};
+        win_thread(const win_thread& t){};
+    public:
+        typedef void (*runnable)(void* ctx);
+        typedef unsigned int id_type;
+        
+        static id_type null_id();
+        
+        win_thread(runnable r,void* t);
+        
+        ~win_thread();
+        void join();
+        void detach();
+        bool is_equal(const win_thread& t) const;
+        id_type get_id() const;
+        static id_type current_thread_id();
+        static void sleep(unsigned long millisecs);
+    };
+}
+
+#include "win_thread.hpp"
+#endif /* defined(__threadpp__win_thread__) */

+ 81 - 0
tool/TaskQueue/threadpp/impl/win_thread.hpp

@@ -0,0 +1,81 @@
+//
+//  win_thread.cpp
+//  threadpp
+//
+//  Created by Melo Yao on 1/15/15.
+//  Copyright (c) 2015 Melo Yao. All rights reserved.
+//
+#ifndef __threadpp__win_thread__hpp__
+#define __threadpp__win_thread__hpp__
+
+#include "../threadpp_assert.h"
+#if NO_CRT
+#else
+#include <process.h>
+#endif
+namespace threadpp
+{
+
+    inline win_thread::id_type win_thread::null_id()
+    {
+        return 0;
+    }
+    
+	inline win_thread::handle_t win_thread::win_fp_delegate(void *context)
+    {
+        win_context* wctx = static_cast<win_context*>(context);
+        wctx->fp(wctx->context);
+        return 0;
+    }
+    
+    inline win_thread::win_thread(runnable r,void* t)
+    {
+        _context.fp = r;
+        _context.context = t;
+#if NO_CRT
+		_handle = CreateThread(NULL,NULL,win_thread::win_fp_delegate,&_context,0,&_thread_id);
+#else
+		_handle = (HANDLE)_beginthreadex(NULL,0,win_thread::win_fp_delegate,&_context,0,&_thread_id);
+#endif		
+    }
+    
+    inline win_thread::~win_thread()
+    {
+        ASSERT(_handle == 0,"%s","must join or detach a thread before destructing it");
+    }
+    
+    inline void win_thread::join()
+    {
+        unsigned code = WaitForSingleObject(_handle,0xFFFFFFFF);
+        CloseHandle(_handle);
+        _handle = 0;
+        ASSERT(code == WAIT_OBJECT_0 || code == WAIT_ABANDONED, "failed to join,error:%d",code);
+    }
+    
+    inline void win_thread::detach()
+    {
+		CloseHandle(_handle);
+        _handle = 0;
+    }
+    
+    inline bool win_thread::is_equal(const win_thread& t) const
+    {
+        return _thread_id == t._thread_id;
+    }
+    
+    inline void win_thread::sleep(unsigned long millisecs)
+    {
+		Sleep(millisecs);
+    }
+    
+	inline win_thread::id_type win_thread::get_id() const
+	{
+		return static_cast<unsigned int>(_thread_id);
+	}
+
+	inline win_thread::id_type win_thread::current_thread_id()
+	{
+		return  static_cast<unsigned int>(GetCurrentThreadId());
+	}
+}
+#endif

+ 101 - 0
tool/TaskQueue/threadpp/recursive_lock.h

@@ -0,0 +1,101 @@
+//
+//  recursive_lock.h
+//  threadpp
+//
+//  Created by Melo Yao on 1/16/15.
+//  Copyright (c) 2015 Melo Yao. All rights reserved.
+//
+
+#ifndef threadpp_recursive_lock_h
+#define threadpp_recursive_lock_h
+#include "threadpp_assert.h"
+namespace threadpp
+{
+    template <typename locktype,typename threadtype>
+    class recursive_lock
+    {
+        locktype _lock;
+        volatile typename threadtype::id_type _owner;
+        volatile unsigned int _count;
+    public:
+        recursive_lock();
+        void lock();
+        void unlock();
+        void wait();
+        void wait(unsigned long millisecs);
+        void notify();
+        void notify_all();
+    };
+    
+    template <typename locktype,typename threadtype>
+    recursive_lock<locktype,threadtype>::recursive_lock():_owner(threadtype::null_id()),_count(0)
+    {
+    }
+    
+    template <typename locktype,typename threadtype>
+    void recursive_lock<locktype,threadtype>::lock()
+    {
+        typename threadtype::id_type tid = threadtype::current_thread_id();
+        if(tid == _owner)
+        {
+            _count++;
+        }
+        else
+        {
+            _lock.lock();
+            _owner = tid;
+            _count=1;
+        }
+    }
+    
+    template <typename locktype,typename threadtype>
+    void recursive_lock<locktype,threadtype>::unlock()
+    {
+        typename threadtype::id_type tid = threadtype::current_thread_id();
+        ASSERT(tid == _owner,"%s", "unlock failed,try to unlock not owned mutex");
+        _count--;
+        if (_count == 0) {
+            _owner = threadtype::null_id();
+            _lock.unlock();
+        }
+    }
+    
+    template <typename locktype,typename threadtype>
+    void recursive_lock<locktype,threadtype>::wait()
+    {
+        typename threadtype::id_type owner = _owner;
+        unsigned count = _count;
+        _owner = threadtype::null_id();
+        _count = 0;
+        _lock.wait();
+        _owner = owner;
+        _count = count;
+
+    }
+    
+    template <typename locktype,typename threadtype>
+    void recursive_lock<locktype,threadtype>::wait(unsigned long millisecs)
+    {
+        typename threadtype::id_type owner = _owner;
+        unsigned count = _count;
+        _owner = threadtype::null_id();
+        _count = 0;
+        _lock.wait(millisecs);
+        _owner = owner;
+        _count = count;
+    }
+    
+    template <typename locktype,typename threadtype>
+    void recursive_lock<locktype,threadtype>::notify()
+    {
+        _lock.notify();
+    }
+    
+    template <typename locktype,typename threadtype>
+    void recursive_lock<locktype,threadtype>::notify_all()
+    {
+        _lock.notify_all();
+    }
+}
+
+#endif

+ 40 - 0
tool/TaskQueue/threadpp/threadpp.h

@@ -0,0 +1,40 @@
+//
+//  threadpp.h
+//  threadpp
+//
+//  Created by Melo Yao on 1/15/15.
+//  Copyright (c) 2015 Melo Yao. All rights reserved.
+//
+
+#ifndef threadpp_threadpp_h
+#define threadpp_threadpp_h
+#include "recursive_lock.h"
+#if __posix || __APPLE__ || __linux
+#include "impl/pthread_thread.h"
+#include "impl/pthread_lock.h"
+namespace threadpp
+{
+    typedef pthread_thread thread;
+    typedef pthread_lock lock;
+    typedef recursive_lock<pthread_lock, pthread_thread> recursivelock;
+}
+#elif defined(WIN32)
+#include "impl/win_thread.h"
+#include "impl/win_lock.h"
+namespace threadpp
+{
+    typedef win_thread thread;
+    typedef win_lock lock;
+    typedef recursive_lock<win_lock, win_thread> recursivelock;
+}
+#elif __cplusplus>=201103L
+#include "impl/std_thread.h"
+#include "impl/std_lock.h"
+namespace threadpp
+{
+    typedef std_thread thread;
+    typedef std_lock lock;
+    typedef recursive_lock<std_lock, std_thread> recursivelock;
+}
+#endif
+#endif

+ 33 - 0
tool/TaskQueue/threadpp/threadpp_assert.h

@@ -0,0 +1,33 @@
+//
+//  defines.h
+//  threadpp
+//
+//  Created by Melo Yao on 1/15/15.
+//  Copyright (c) 2015 Melo Yao. All rights reserved.
+//
+
+#ifndef threadpp_assert_h
+#define threadpp_assert_h
+
+//forward VC++ DEBUG symbol.
+#if defined(_DEBUG) && !defined(DEBUG)
+#define DEBUG _DEBUG
+#endif
+
+#if DEBUG //assertions
+#ifdef __cplusplus
+#include <cassert>
+#include <cstdio>
+#else
+#include <assert.h>
+#include <stdio.h>
+#endif
+#define ASSERT0(__cond__) assert(__cond__)
+#define ASSERT(__cond__,__msg__,...) \
+do {if(!(__cond__)){printf(__msg__,__VA_ARGS__);printf("\n");assert(false);}}while(0)
+#else
+#define ASSERT0(__cond__)
+#define ASSERT(__cond__,__msg__,...)
+#endif //assertions
+
+#endif

+ 341 - 0
tool/binary_buf.cpp

@@ -0,0 +1,341 @@
+
+/*
+ * binary_buf是二进制缓存
+ * 这里用字符串,来存储雷达的通信消息的原始数据
+ * Binary_buf 的内容格式:消息类型 + 消息数据
+ *
+ * 例如思科的雷达的消息类型
+ * ready->ready->start->data->data->data->stop->ready->ready
+ *
+ * 提供了 is_equal 系列的函数,来进行判断前面的消息类型
+ * 
+ * 注意了:m_buf是中间可以允许有‘\0’的,不是单纯的字符串格式
+ * 			末尾也不一定是‘\0’
+ */
+
+#include "binary_buf.h"
+
+#include <string>
+#include <string.h>
+
+Binary_buf::Binary_buf()
+{
+	mp_buf = NULL;
+	m_length = 0;
+}
+
+Binary_buf::Binary_buf(const Binary_buf& other)
+{
+	mp_buf = NULL;
+	m_length = 0;
+
+	if ( other.m_length > 0 && other.mp_buf != NULL)
+	{
+		mp_buf = (char*)malloc(other.m_length);
+		memcpy(mp_buf, other.mp_buf, other.m_length);
+		m_length = other.m_length;
+	}
+}
+
+Binary_buf::~Binary_buf()
+{
+	if ( mp_buf )
+	{
+		free(mp_buf);
+		mp_buf = NULL;
+	}
+	m_length = 0;
+
+//	std::cout << "Binary_buf::~Binary_buf()" << std::endl;
+}
+
+
+//使用参数构造,深拷贝,len为0时,使用strlen(buf),不存储结束符'\0'
+Binary_buf::Binary_buf(const char* p_buf, int len)
+{
+	mp_buf = NULL;
+	m_length = 0;
+
+	if ( p_buf != NULL)
+	{
+		if (len <= 0)
+		{
+			len = strlen(p_buf);
+		}
+
+		mp_buf = (char*)malloc(len);
+		memcpy(mp_buf, p_buf, len);
+		m_length = len;
+	}
+}
+
+
+//使用参数构造,深拷贝,len为0时,使用strlen(buf),不存储结束符'\0'
+Binary_buf::Binary_buf(char* p_buf, int len)
+{
+	mp_buf = NULL;
+	m_length = 0;
+
+	if ( p_buf != NULL)
+	{
+		if (len <= 0)
+		{
+			len = strlen(p_buf);
+		}
+
+		mp_buf = (char*)malloc(len);
+		memcpy(mp_buf, p_buf, len);
+		m_length = len;
+	}
+}
+
+//重载=,深拷贝,
+Binary_buf& Binary_buf::operator=(const Binary_buf& other)
+{
+	clear();
+
+	if ( other.m_length > 0 && other.mp_buf != NULL)
+	{
+		mp_buf = (char*)malloc(other.m_length);
+		memcpy(mp_buf, other.mp_buf, other.m_length);
+		m_length = other.m_length;
+	}
+	return *this;
+}
+
+//重载=,深拷贝,使用strlen(buf),不存储结束符'\0'
+Binary_buf& Binary_buf::operator=(const char* p_buf)
+{
+	clear();
+
+	if ( p_buf != NULL)
+	{
+		int len = strlen(p_buf);
+		mp_buf = (char*)malloc(len);
+		memcpy(mp_buf, p_buf, len);
+		m_length = len;
+	}
+	return *this;
+}
+
+//重载+,other追加在this的后面,
+Binary_buf& Binary_buf::operator+(Binary_buf& other)
+{
+	if (other.mp_buf != NULL && other.m_length > 0)
+	{
+		int t_length_total = m_length + other.m_length;
+		char* tp_buf_total = (char*)malloc(t_length_total);
+		memcpy(tp_buf_total, mp_buf, m_length);
+		memcpy(tp_buf_total + m_length, other.mp_buf, other.m_length);
+		free(mp_buf);
+		mp_buf = tp_buf_total;
+		m_length = t_length_total;
+	}
+	return *this;
+}
+
+//重载+,追加在this的后面,使用strlen(buf),不存储结束符'\0'
+Binary_buf& Binary_buf::operator+(const char* p_buf)
+{
+	if (p_buf != NULL )
+	{
+		int t_length_back = strlen(p_buf);
+		int t_length_total = m_length + t_length_back;
+		char* tp_buf_total = (char*)malloc(t_length_total);
+		memcpy(tp_buf_total, mp_buf, m_length);
+		memcpy(tp_buf_total + m_length, p_buf, t_length_back);
+		free(mp_buf);
+		mp_buf = tp_buf_total;
+		m_length = t_length_total;
+	}
+	return *this;
+}
+
+//重载[],允许直接使用数组的形式,直接访问buf的内存。注意,n值必须在0~m_length之间,
+char& Binary_buf::operator[](int n)
+{
+	if (n >= 0 && n < m_length)
+	{
+		return mp_buf[n];
+	}
+	else
+	{
+		throw (n);
+	}
+}
+
+
+//判空
+bool Binary_buf::is_empty()
+{
+	if ( mp_buf != NULL && m_length > 0 )
+	{
+		return false;
+	}
+	else
+	{
+		return true;
+	}
+}
+
+//清空
+void Binary_buf::clear()
+{
+	if ( mp_buf )
+	{
+		free(mp_buf);
+		mp_buf = NULL;
+	}
+	m_length = 0;
+}
+
+
+//比较前面部分的buf是否相等,使用 other.m_length 为标准
+bool Binary_buf::is_equal_front(const Binary_buf& other)
+{
+	if ( other.mp_buf == NULL || other.m_length <= 0 )
+	{
+		if ( mp_buf == NULL || m_length <= 0 )
+		{
+			return true;
+		}
+		else
+		{
+			return false;
+		}
+	}
+	else
+	{
+		if ( mp_buf != NULL && m_length > 0 )
+		{
+			if ( other.m_length > m_length )
+			{
+				return false;
+			}
+			return  (strncmp((const char*)mp_buf, other.mp_buf, other.m_length) == 0);
+		}
+		else
+		{
+			return false;
+		}
+
+	}
+}
+
+//比较前面部分的buf是否相等,len为0时,使用strlen(buf)为标准,不比较结束符'\0'
+bool Binary_buf::is_equal_front(const char* p_buf, int len)
+{
+	if ( p_buf == NULL )
+	{
+		if ( mp_buf == NULL || m_length <= 0 )
+		{
+			return true;
+		}
+		else
+		{
+			return false;
+		}
+	}
+	else
+	{
+		if ( mp_buf != NULL && m_length > 0 )
+		{
+			if ( len == 0 )
+			{
+				len = strlen(p_buf);
+			}
+			if ( len > m_length )
+			{
+				return false;
+			}
+			return  (strncmp((const char*)mp_buf, p_buf, len) == 0);
+		}
+		else
+		{
+			return false;
+		}
+
+	}
+}
+
+//比较的buf是否全部相等,
+bool Binary_buf::is_equal_all(const Binary_buf& other)
+{
+	if ( other.mp_buf == NULL || other.m_length <= 0 )
+	{
+		if ( mp_buf == NULL || m_length <= 0 )
+		{
+			return true;
+		}
+		else
+		{
+			return false;
+		}
+	}
+	else
+	{
+		if ( mp_buf != NULL && m_length > 0 )
+		{
+			if ( other.m_length != m_length )
+			{
+				return false;
+			}
+			return  (strncmp((const char*)mp_buf, other.mp_buf, other.m_length) == 0);
+		}
+		else
+		{
+			return false;
+		}
+
+	}
+}
+//比较的buf是否全部相等,不比较结束符'\0'
+bool Binary_buf::is_equal_all(const char* p_buf)
+{
+	if ( p_buf == NULL )
+	{
+		if ( mp_buf == NULL || m_length <= 0 )
+		{
+			return true;
+		}
+		else
+		{
+			return false;
+		}
+	}
+	else
+	{
+		if ( mp_buf != NULL && m_length > 0 )
+		{
+			int	len = strlen(p_buf);
+			if ( len != m_length )
+			{
+				return false;
+			}
+			return  (strncmp((const char*)mp_buf, p_buf, len) == 0);
+		}
+		else
+		{
+			return false;
+		}
+
+	}
+}
+
+
+
+
+char*	Binary_buf::get_buf()const
+{
+	return mp_buf;
+}
+
+int		Binary_buf::get_length()const
+{
+	return m_length;
+}
+
+
+
+
+

+ 91 - 0
tool/binary_buf.h

@@ -0,0 +1,91 @@
+
+/*
+ * binary_buf是二进制缓存
+ * 这里用字符串,来存储雷达的通信消息的原始数据
+ * Binary_buf 的内容格式:消息类型 + 消息数据
+ *
+ * 例如思科的雷达的消息类型
+ * ready->ready->start->data->data->data->stop->ready->ready
+ *
+ * 提供了 is_equal 系列的函数,来进行判断前面的消息类型
+ *
+ * 注意了:m_buf是中间可以允许有‘\0’的,不是单纯的字符串格式
+ * 			末尾也不一定是‘\0’
+ */
+
+#ifndef LIDARMEASURE_BINARY_BUF_H
+#define LIDARMEASURE_BINARY_BUF_H
+#include <iostream>
+
+
+//雷达消息的类型
+//在通信消息的前面一部分字符串,表示这条消息的类型。
+//在解析消息的时候,先解析前面的消息类型,来判断这条消息的功用
+enum Buf_type
+{
+	//默认值 BUF_UNKNOW = 0
+	BUF_UNKNOW   		=0,	//未知消息
+	BUF_READY  			=1,	//待机消息
+	BUF_START 			=2,	//开始消息
+	BUF_DATA   			=3,	//数据消息
+	BUF_STOP  			=4,	//结束消息
+	BUF_ERROR   		=5,	//错误消息
+};
+
+
+//二进制缓存,
+class Binary_buf
+{
+public:
+	Binary_buf();
+	Binary_buf(const Binary_buf& other);
+	~Binary_buf();
+
+	//使用参数构造,深拷贝,len为0时,使用strlen(buf),不存储结束符'\0'
+	Binary_buf(const char* p_buf, int len = 0);
+	//使用参数构造,深拷贝,len为0时,使用strlen(buf),不存储结束符'\0'
+	Binary_buf(char* p_buf, int len = 0);
+	//重载=,深拷贝,
+	Binary_buf& operator=(const Binary_buf& other);
+	//重载=,深拷贝,使用strlen(buf),不存储结束符'\0'
+	Binary_buf& operator=(const char* p_buf);
+	//重载+,other追加在this的后面,
+	Binary_buf& operator+(Binary_buf& other);
+	//重载+,追加在this的后面,使用strlen(buf),不存储结束符'\0'
+	Binary_buf& operator+(const char* p_buf);
+	//重载[],允许直接使用数组的形式,直接访问buf的内存。注意,n值必须在0~m_length之间,
+	char& operator[](int n);
+
+	//判空
+	bool is_empty();
+	//清空
+	void clear();
+
+	//比较前面部分的buf是否相等,使用 other.m_length 为标准
+	bool is_equal_front(const Binary_buf& other);
+	//比较前面部分的buf是否相等,len为0时,使用strlen(buf)为标准,不比较结束符'\0'
+	bool is_equal_front(const char* p_buf, int len = 0);
+
+	//比较的buf是否全部相等,
+	bool is_equal_all(const Binary_buf& other);
+	//比较的buf是否全部相等,不比较结束符'\0'
+	bool is_equal_all(const char* p_buf);
+
+
+
+public:
+	char* get_buf()const;
+	int	get_length()const;
+
+protected:
+	char*		mp_buf;				//二进制缓存指针
+	int			m_length;			//二进制缓存长度
+
+private:
+
+};
+
+
+
+
+#endif //LIDARMEASURE_BINARY_BUF_H

+ 85 - 0
tool/binary_buf.puml

@@ -0,0 +1,85 @@
+@startuml
+skinparam classAttributeIconSize 0
+
+title  binary_buf是二进制缓存
+
+note left of Binary_buf
+/*
+ * binary_buf是二进制缓存
+ * 这里用字符串,来存储雷达的通信消息的原始数据
+ * Binary_buf 的内容格式:消息类型 + 消息数据
+ *
+ * 例如思科的雷达的消息类型
+ * ready->ready->start->data->data->data->stop->ready->ready
+ *
+ * 提供了 is_equal 系列的函数,来进行判断前面的消息类型
+ *
+ * 注意了:m_buf是中间可以允许有‘\0’的,不是单纯的字符串格式
+ * 			末尾也不一定是‘\0’
+ */
+end note
+
+
+
+enum Buf_type
+{
+//雷达消息的类型
+//在通信消息的前面一部分字符串,表示这条消息的类型。
+//在解析消息的时候,先解析前面的消息类型,来判断这条消息的功用
+	//默认值 BUF_UNKNOW = 0
+	BUF_UNKNOW   		=0,	//未知消息
+	BUF_READY  			=1,	//待机消息
+	BUF_START 			=2,	//开始消息
+	BUF_DATA   			=3,	//数据消息
+	BUF_STOP  			=4,	//结束消息
+	BUF_ERROR   		=5,	//错误消息
+}
+
+
+
+class Binary_buf
+{
+//二进制缓存,
+==public:==
+	Binary_buf();
+	Binary_buf(const Binary_buf& other);
+	~Binary_buf();
+..
+	//使用参数构造,深拷贝,len为0时,使用strlen(buf),不存储结束符'\0'
+	Binary_buf(const char* p_buf, int len = 0);
+	//重载=,深拷贝,
+	Binary_buf& operator=(const Binary_buf& other);
+	//重载=,深拷贝,使用strlen(buf),不存储结束符'\0'
+	Binary_buf& operator=(const char* p_buf);
+	//重载+,other追加在this的后面,
+	Binary_buf& operator+(Binary_buf& other);
+	//重载+,追加在this的后面,使用strlen(buf),不存储结束符'\0'
+	Binary_buf& operator+(const char* p_buf);
+	//重载[],允许直接使用数组的形式,直接访问buf的内存。注意,n值必须在0~m_length之间,
+	char& operator[](int n);
+..
+	//判空
+	bool is_empty();
+	//清空
+	void clear();
+..
+	//比较前面部分的buf是否相等,使用 other.m_length 为标准
+	bool is_equal_front(const Binary_buf& other);
+	//比较前面部分的buf是否相等,len为0时,使用strlen(buf)为标准,不比较结束符'\0'
+	bool is_equal_front(const char* p_buf, int len = 0);
+
+	//比较的buf是否全部相等,
+	bool is_equal_all(const Binary_buf& other);
+	//比较的buf是否全部相等,不比较结束符'\0'
+	bool is_equal_all(const char* p_buf);
+==public:==
+	char* get_buf()const;
+	int	get_length()const;
+==protected:==
+	char*		mp_buf;				//二进制缓存指针
+	int			m_length;			//二进制缓存长度
+==private:==
+}
+
+
+@enduml

+ 319 - 0
tool/common_data.cpp

@@ -0,0 +1,319 @@
+//
+// Created by huli on 2020/9/8.
+//
+
+#include "common_data.h"
+
+void Common_data::copy_data(Car_measure_information& car_measure_information_out, const message::Locate_information& locate_information_in)
+{
+	if ( locate_information_in.has_locate_x() )
+	{
+		car_measure_information_out.car_center_x = locate_information_in.locate_x();
+	}
+	else
+	{
+		car_measure_information_out.car_center_x = 0;
+	}
+	if ( locate_information_in.has_locate_y() )
+	{
+		car_measure_information_out.car_center_y = locate_information_in.locate_y();
+	}
+	else
+	{
+		car_measure_information_out.car_center_y = 0;
+	}
+	if ( locate_information_in.has_locate_angle() )
+	{
+		car_measure_information_out.car_angle = locate_information_in.locate_angle();
+	}
+	else
+	{
+		car_measure_information_out.car_angle = 0;
+	}
+	if ( locate_information_in.has_locate_length() )
+	{
+		car_measure_information_out.car_length = locate_information_in.locate_length();
+	}
+	else
+	{
+		car_measure_information_out.car_length = 0;
+	}
+	if ( locate_information_in.has_locate_width() )
+	{
+		car_measure_information_out.car_width = locate_information_in.locate_width();
+	}
+	else
+	{
+		car_measure_information_out.car_width = 0;
+	}
+	if ( locate_information_in.has_locate_height() )
+	{
+		car_measure_information_out.car_height = locate_information_in.locate_height();
+	}
+	else
+	{
+		car_measure_information_out.car_height = 0;
+	}
+	if ( locate_information_in.has_locate_wheel_base() )
+	{
+		car_measure_information_out.car_wheel_base = locate_information_in.locate_wheel_base();
+	}
+	else
+	{
+		car_measure_information_out.car_wheel_base = 0;
+	}
+	if ( locate_information_in.has_locate_wheel_width() )
+	{
+		car_measure_information_out.car_wheel_width = locate_information_in.locate_wheel_width();
+	}
+	else
+	{
+		car_measure_information_out.car_wheel_width = 0;
+	}
+	if ( locate_information_in.has_locate_front_theta() )
+	{
+		car_measure_information_out.car_front_theta = locate_information_in.locate_front_theta();
+	}
+	else
+	{
+		car_measure_information_out.car_front_theta = 0;
+	}
+	if ( locate_information_in.has_locate_correct() )
+	{
+		car_measure_information_out.correctness = locate_information_in.locate_correct();
+	}
+	else
+	{
+		car_measure_information_out.correctness = false;
+	}
+}
+void Common_data::copy_data(message::Locate_information& locate_information_out, const Car_measure_information& car_measure_information_in)
+{
+	locate_information_out.set_locate_x(car_measure_information_in.car_center_x);
+	locate_information_out.set_locate_y(car_measure_information_in.car_center_y);
+	locate_information_out.set_locate_angle(car_measure_information_in.car_angle);
+	locate_information_out.set_locate_length(car_measure_information_in.car_length);
+	locate_information_out.set_locate_width(car_measure_information_in.car_width);
+	locate_information_out.set_locate_height(car_measure_information_in.car_height);
+	locate_information_out.set_locate_wheel_base(car_measure_information_in.car_wheel_base);
+	locate_information_out.set_locate_wheel_width(car_measure_information_in.car_wheel_width);
+	locate_information_out.set_locate_front_theta(car_measure_information_in.car_front_theta);
+	locate_information_out.set_locate_correct(car_measure_information_in.correctness);
+}
+
+void Common_data::copy_data(Car_information& car_information_out, const message::Car_info& car_info_in)
+{
+	if ( car_info_in.has_license() )
+	{
+		car_information_out.license = car_info_in.license();
+	}
+	else
+	{
+		car_information_out.license.clear();
+	}
+	if ( car_info_in.has_car_length() )
+	{
+		car_information_out.car_length = car_info_in.car_length();
+	}
+	else
+	{
+		car_information_out.car_length = 0;
+	}
+	if ( car_info_in.has_car_width() )
+	{
+		car_information_out.car_width = car_info_in.car_width();
+	}
+	else
+	{
+		car_information_out.car_width = 0;
+	}
+	if ( car_info_in.has_car_height() )
+	{
+		car_information_out.car_height = car_info_in.car_height();
+	}
+	else
+	{
+		car_information_out.car_height = 0;
+	}
+	if ( car_info_in.has_car_wheel_base() )
+	{
+		car_information_out.car_wheel_base = car_info_in.car_wheel_base();
+	}
+	else
+	{
+		car_information_out.car_wheel_base = 0;
+	}
+	if ( car_info_in.has_car_wheel_width() )
+	{
+		car_information_out.car_wheel_width = car_info_in.car_wheel_width();
+	}
+	else
+	{
+		car_information_out.car_wheel_width = 0;
+	}
+}
+void Common_data::copy_data(message::Car_info& car_info_out, const Car_information& car_information_in)
+{
+	car_info_out.set_license(car_information_in.license);
+	car_info_out.set_car_length(car_information_in.car_length);
+	car_info_out.set_car_width(car_information_in.car_width);
+	car_info_out.set_car_height(car_information_in.car_height);
+	car_info_out.set_car_wheel_base(car_information_in.car_wheel_base);
+	car_info_out.set_car_wheel_width(car_information_in.car_wheel_width);
+}
+
+void Common_data::copy_data(Parkspace_information& parkspace_information_out, const message::Parkspace_info& parkspace_info_in)
+{
+
+		parkspace_information_out.parkingspace_index_id = parkspace_info_in.parkingspace_index_id();
+		parkspace_information_out.parkingspace_type = (Common_data::Parkspace_type)parkspace_info_in.parkingspace_type();
+
+		parkspace_information_out.parkingspace_unit_id = parkspace_info_in.parkingspace_unit_id();
+		parkspace_information_out.parkingspace_floor_id = parkspace_info_in.parkingspace_floor_id();
+		parkspace_information_out.parkingspace_room_id = parkspace_info_in.parkingspace_room_id();
+		parkspace_information_out.parkingspace_direction = (Common_data::Direction)parkspace_info_in.parkingspace_direction();
+
+		parkspace_information_out.parkingspace_width = parkspace_info_in.parkingspace_width();
+		parkspace_information_out.parkingspace_height = parkspace_info_in.parkingspace_height();
+		parkspace_information_out.parkingspace_status = (Common_data::Parkspace_status)parkspace_info_in.parkingspace_status();
+
+		copy_data(parkspace_information_out.car_information, (message::Car_info&) parkspace_info_in.car_info());
+		parkspace_information_out.car_entry_time = parkspace_info_in.entry_time();
+		parkspace_information_out.car_leave_time = parkspace_info_in.leave_time();
+
+		parkspace_information_out.parkspace_path = (Common_data::Parkspace_path)parkspace_info_in.parkspace_path();
+		parkspace_information_out.path_estimate_time = parkspace_info_in.path_estimate_time();
+		parkspace_information_out.parkspace_status_target = (Common_data::Parkspace_status)parkspace_info_in.parkspace_status_target();
+
+}
+void Common_data::copy_data(message::Parkspace_info& parkspace_info_out, const Parkspace_information& parkspace_information_in)
+{
+	parkspace_info_out.set_parkingspace_index_id(parkspace_information_in.parkingspace_index_id);
+	parkspace_info_out.set_parkingspace_type((message::Parkspace_type)parkspace_information_in.parkingspace_type);
+	parkspace_info_out.set_parkingspace_unit_id(parkspace_information_in.parkingspace_unit_id);
+	parkspace_info_out.set_parkingspace_room_id(parkspace_information_in.parkingspace_room_id);
+	parkspace_info_out.set_parkingspace_direction((message::Direction)parkspace_information_in.parkingspace_direction);
+	parkspace_info_out.set_parkingspace_floor_id(parkspace_information_in.parkingspace_floor_id);
+	parkspace_info_out.set_parkingspace_width(parkspace_information_in.parkingspace_width);
+	parkspace_info_out.set_parkingspace_height(parkspace_information_in.parkingspace_height);
+	parkspace_info_out.set_parkingspace_status((message::Parkspace_status)parkspace_information_in.parkingspace_status);
+	copy_data(*parkspace_info_out.mutable_car_info(), parkspace_information_in.car_information);
+	parkspace_info_out.set_entry_time(parkspace_information_in.car_entry_time);
+	parkspace_info_out.set_leave_time(parkspace_information_in.car_leave_time);
+	parkspace_info_out.set_parkspace_path((message::Parkspace_path)parkspace_information_in.parkspace_path);
+	parkspace_info_out.set_path_estimate_time(parkspace_information_in.path_estimate_time);
+	parkspace_info_out.set_parkspace_status_target((message::Parkspace_status)parkspace_information_in.parkspace_status_target);
+}
+
+
+
+
+
+
+
+
+
+void Common_data::transform_data(Car_information& car_information_out, const Car_measure_information& car_measure_information_in)
+{
+	car_information_out.license.clear();
+	car_information_out.car_length = car_measure_information_in.car_length;
+	car_information_out.car_width = car_measure_information_in.car_width;
+	car_information_out.car_height = car_measure_information_in.car_height;
+	car_information_out.car_wheel_base = car_measure_information_in.car_wheel_base;
+	car_information_out.car_wheel_width = car_measure_information_in.car_wheel_width;
+}
+void Common_data::transform_data(Car_measure_information& car_measure_information_out, const Car_information& car_informatio_in)
+{
+	car_measure_information_out.car_center_x = 0;
+	car_measure_information_out.car_center_y = 0;
+	car_measure_information_out.car_angle = 0;
+	car_measure_information_out.car_length = car_informatio_in.car_length;
+	car_measure_information_out.car_width = car_informatio_in.car_width;
+	car_measure_information_out.car_height = car_informatio_in.car_height;
+	car_measure_information_out.car_wheel_base = car_informatio_in.car_wheel_base;
+	car_measure_information_out.car_wheel_width = car_informatio_in.car_wheel_width;
+	car_measure_information_out.car_front_theta = 0;
+	car_measure_information_out.correctness = false;
+
+
+}
+
+void Common_data::transform_data(Car_wheel_information& car_wheel_information_out, const Car_measure_information& car_measure_information_in)
+{
+	car_wheel_information_out.car_center_x = car_measure_information_in.car_center_x;
+	car_wheel_information_out.car_center_y = car_measure_information_in.car_center_y;
+	car_wheel_information_out.car_angle = car_measure_information_in.car_angle;
+
+	car_wheel_information_out.car_wheel_base = car_measure_information_in.car_wheel_base;
+	car_wheel_information_out.car_wheel_width = car_measure_information_in.car_wheel_width;
+	car_wheel_information_out.car_front_theta = car_measure_information_in.car_front_theta;
+	car_wheel_information_out.correctness = car_measure_information_in.correctness;
+}
+void Common_data::transform_data(Car_measure_information& car_measure_information_out, const Car_wheel_information& car_wheel_information_in)
+{
+	car_measure_information_out.car_center_x = car_wheel_information_in.car_center_x;
+	car_measure_information_out.car_center_y = car_wheel_information_in.car_center_y;
+	car_measure_information_out.car_angle = car_wheel_information_in.car_angle;
+	car_measure_information_out.car_length = 0;
+	car_measure_information_out.car_width = 0;
+	car_measure_information_out.car_height = 0;
+	car_measure_information_out.car_wheel_base = car_wheel_information_in.car_wheel_base;
+	car_measure_information_out.car_wheel_width = car_wheel_information_in.car_wheel_width;
+	car_measure_information_out.car_front_theta = car_wheel_information_in.car_front_theta;
+	car_measure_information_out.correctness = car_wheel_information_in.correctness;
+}
+
+
+void Common_data::scaling(Car_measure_information& car_measure_information, float rate)
+{
+	car_measure_information.car_center_x *= rate;
+	car_measure_information.car_center_y *= rate;
+	car_measure_information.car_length *= rate;
+	car_measure_information.car_width *= rate;
+	car_measure_information.car_height *= rate;
+	car_measure_information.car_wheel_base *= rate;
+	car_measure_information.car_wheel_width *= rate;
+}
+void Common_data::scaling(Car_information& car_information, float rate)
+{
+	car_information.car_length *= rate;
+	car_information.car_width *= rate;
+	car_information.car_height *= rate;
+	car_information.car_wheel_base *= rate;
+	car_information.car_wheel_width *= rate;
+
+}
+void Common_data::scaling(Parkspace_information& parkspace_information, float rate)
+{
+	parkspace_information.parkingspace_width *= rate;
+	parkspace_information.parkingspace_height *= rate;
+	scaling(parkspace_information.car_information, rate);
+}
+
+bool Common_data::approximate_rate(float a, float b, float rate)
+{
+	if ( a >= b*(1-rate) && a< b*(1+rate))
+	{
+	    return true;
+	}
+	else
+	{
+	    return false;
+	}
+}
+
+bool Common_data::approximate_difference(float a, float b, float difference)
+{
+	if ( a >= (b-difference) && a< (b+difference) )
+	{
+		return true;
+	}
+	else
+	{
+		return false;
+	}
+}
+
+
+
+

+ 0 - 0
tool/common_data.h


Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác