Browse Source

修改流程状态消息格式,增加三四级故障处理

zx 4 years ago
parent
commit
ddb7cbdb5c

+ 3 - 24
CMakeLists.txt

@@ -21,6 +21,7 @@ include_directories(
         ./lidar_locate
         ./parkspace
         ./dispatch
+        ./solve_exception
 )
 link_directories("/usr/local/lib")
 
@@ -34,6 +35,7 @@ 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}/solve_exception exception_solve_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 )
@@ -55,6 +57,7 @@ add_executable(process
         ${SYSTEM_SRC}
         ${PARKSPACE_SRC}
         ${DISPATCH_SRC}
+        ${exception_solve_src}
         )
 
 target_link_libraries(process
@@ -66,29 +69,6 @@ target_link_libraries(process
         ${GLOG_LIBRARIES}
         )
 
-#
-#add_executable(locate_client
-#        ./test/Locate_client.cpp
-#        ./error_code/error_code.cpp
-#        ${locate_src}
-#        ${robot_src}
-#        ${message_src}
-#        ${TOOL_SRC}
-#        ${TASK_QUEUE_SRC}
-#        ${COMMUNICATION_SRC}
-#        ${SYSTEM_SRC}
-#        ${PARKSPACE_SRC}
-#        ${DISPATCH_SRC}
-#        )
-#target_link_libraries(locate_client
-#        nnxx
-#        nanomsg
-#        ${PROTOBUF_LIBRARIES}
-#        /usr/local/lib/libglog.a
-#        /usr/local/lib/libgflags.a
-#        )
-
-
 add_executable(terminal
         ./test/terminal_client.cpp
         ./test/store_terminal.cpp
@@ -102,7 +82,6 @@ add_executable(terminal
         ${TOOL_SRC}
         ${TASK_QUEUE_SRC}
         ${COMMUNICATION_SRC}
-        ${SYSTEM_SRC}
         ${PARKSPACE_SRC}
         ${DISPATCH_SRC}
         )

+ 2 - 0
communication/communication_message.h

@@ -52,6 +52,8 @@ public:
 
         eStoring_process_statu_msg=0x90,      //停车进度条消息
         ePicking_process_statu_msg=0x91,        //取车进度消息
+
+        eCentral_controller_statu_msg=0xa0,     //中控状态消息
 	};
 
 //通讯单元

+ 10 - 5
dispatch/dispatch_communicator.cpp

@@ -8,7 +8,7 @@
 Dispatch_communicator::~Dispatch_communicator(){}
 
 Error_manager Dispatch_communicator::dispatch_request(message::Dispatch_request_msg& request,
-        message::Dispatch_response_msg& result)
+        message::Dispatch_response_msg& result,Thread_condition& cancel_condition)
 {
 
     /*
@@ -72,18 +72,23 @@ Error_manager Dispatch_communicator::dispatch_request(message::Dispatch_request_
         else
         {
             //未查询到记录,任务已经被提前取消,记录被删除
-            return Error_manager(Task_CANCEL,MINOR_ERROR,"dispatch request canceled");
+            return Error_manager(TASK_CANCEL,MINOR_ERROR,"dispatch request canceled");
         }
 
         auto end_time=std::chrono::system_clock::now();
         auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time);
         time=1000.0*double(duration.count()) * std::chrono::microseconds::period::num / std::chrono::microseconds::period::den;
         std::this_thread::yield();
-        usleep(1000);
-    }while(time<double(timeout));
+        if(time>double(timeout))
+        {
+            m_response_table.erase(request.command_key());
+            return Error_manager(RESPONSE_TIMEOUT,MINOR_ERROR,"dispatch request timeout");
+        }
+    }while(cancel_condition.wait_for_ex(std::chrono::milliseconds(1))==false);
 
     m_response_table.erase(request.command_key());
-    return Error_manager(RESPONSE_TIMEOUT,MINOR_ERROR,"dispatch request timeout");
+    return Error_manager(TASK_CANCEL,MINOR_ERROR,"dispatch request task canceled");
+
 }
 /*
  * 提前取消请求

+ 2 - 1
dispatch/dispatch_communicator.h

@@ -16,7 +16,8 @@ class Dispatch_communicator :public Singleton<Dispatch_communicator>, public Com
     friend Singleton<Dispatch_communicator>;
 public:
     virtual ~Dispatch_communicator();
-    Error_manager dispatch_request(message::Dispatch_request_msg& request,message::Dispatch_response_msg& result);
+    Error_manager dispatch_request(message::Dispatch_request_msg& request,
+            message::Dispatch_response_msg& result,Thread_condition& cancel_condition);
     /*
      * 提前取消请求
      */

+ 1 - 1
error_code/error_code.h

@@ -57,7 +57,7 @@ enum Error_code
 	INVALID_MESSAGE					= 0x00000011, //无效的消息,
     RESPONSE_TIMEOUT                = 0x00000012,
     PAUSE                           = 0x00000013,   //急停
-    Task_CANCEL                     = 0x00000014,   //任务取消
+    TASK_CANCEL                     = 0x00000014,   //任务取消
 
     POINTER_IS_NULL                 = 0x00000101,//空指针
     PARAMETER_ERROR                 = 0x00000102,//参数错误,传入参数不符合规范时,

+ 10 - 5
lidar_locate/Locate_communicator.cpp

@@ -38,7 +38,8 @@ Error_manager Locate_communicator::encapsulate_msg(Communication_message* messag
 
 }
 
-Error_manager Locate_communicator::locate_request(message::Measure_request_msg& request,message::Measure_response_msg& result)
+Error_manager Locate_communicator::locate_request(message::Measure_request_msg& request,
+        message::Measure_response_msg& result,Thread_condition& cancel_condition)
 {
     /*
      * 检查request合法性,以及模块状态
@@ -101,17 +102,21 @@ Error_manager Locate_communicator::locate_request(message::Measure_request_msg&
         else
         {
              //未查询到记录,任务已经被提前取消,记录被删除
-             return Error_manager(LOCATER_MSG_REQUEST_CANCELED,MINOR_ERROR,"measure request canceled");
+             return Error_manager(TASK_CANCEL,MINOR_ERROR,"measure request canceled");
         }
 
         auto end_time=std::chrono::system_clock::now();
         auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time);
         time=1000.0*double(duration.count()) * std::chrono::microseconds::period::num / std::chrono::microseconds::period::den;
         std::this_thread::yield();
-        usleep(1000);
-    }while(time<double(timeout));
+        if(time>double(timeout))
+        {
+            m_response_table.erase(request.command_key());
+            return Error_manager(RESPONSE_TIMEOUT,MINOR_ERROR,"measure request timeout");
+        }
+    }while(cancel_condition.wait_for_ex(std::chrono::milliseconds(1))==false);
     m_response_table.erase(request.command_key());
-    return Error_manager(RESPONSE_TIMEOUT,MINOR_ERROR,"measure request timeout");
+    return Error_manager(TASK_CANCEL,MINOR_ERROR,"measure request timeout");
 }
 
 //检查消息是否可以被解析, 需要子类重载

+ 2 - 1
lidar_locate/Locate_communicator.h

@@ -24,7 +24,8 @@ class Locate_communicator: public Singleton<Locate_communicator>, public Communi
     friend Singleton<Locate_communicator>;
 public:
     virtual ~Locate_communicator();
-    Error_manager locate_request(message::Measure_request_msg& request,message::Measure_response_msg& result);
+    Error_manager locate_request(message::Measure_request_msg& request,
+            message::Measure_response_msg& result,Thread_condition& cancel_condition);
     /*
      * 提前取消请求
      */

+ 577 - 0
message/central_control_message.pb.cc

@@ -0,0 +1,577 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: central_control_message.proto
+
+#include "central_control_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 Central_controller_statu_msgDefaultTypeInternal {
+ public:
+  ::google::protobuf::internal::ExplicitlyConstructed<Central_controller_statu_msg>
+      _instance;
+} _Central_controller_statu_msg_default_instance_;
+}  // namespace message
+namespace protobuf_central_5fcontrol_5fmessage_2eproto {
+void InitDefaultsCentral_controller_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();
+  {
+    void* ptr = &::message::_Central_controller_statu_msg_default_instance_;
+    new (ptr) ::message::Central_controller_statu_msg();
+    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
+  }
+  ::message::Central_controller_statu_msg::InitAsDefaultInstance();
+}
+
+void InitDefaultsCentral_controller_statu_msg() {
+  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+  ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsCentral_controller_statu_msgImpl);
+}
+
+::google::protobuf::Metadata file_level_metadata[1];
+const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[1];
+
+const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Central_controller_statu_msg, _has_bits_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Central_controller_statu_msg, _internal_metadata_),
+  ~0u,  // no _extensions_
+  ~0u,  // no _oneof_case_
+  ~0u,  // no _weak_field_map_
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Central_controller_statu_msg, base_info_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Central_controller_statu_msg, paused_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Central_controller_statu_msg, entrance_statu_vector_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Central_controller_statu_msg, export_statu_vector_),
+  0,
+  1,
+  ~0u,
+  ~0u,
+};
+static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+  { 0, 9, sizeof(::message::Central_controller_statu_msg)},
+};
+
+static ::google::protobuf::Message const * const file_default_instances[] = {
+  reinterpret_cast<const ::google::protobuf::Message*>(&::message::_Central_controller_statu_msg_default_instance_),
+};
+
+void protobuf_AssignDescriptors() {
+  AddDescriptors();
+  ::google::protobuf::MessageFactory* factory = NULL;
+  AssignDescriptors(
+      "central_control_message.proto", schemas, file_default_instances, TableStruct::offsets, factory,
+      file_level_metadata, file_level_enum_descriptors, NULL);
+}
+
+void protobuf_AssignDescriptorsOnce() {
+  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+  ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
+}
+
+void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
+void protobuf_RegisterTypes(const ::std::string&) {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 1);
+}
+
+void AddDescriptorsImpl() {
+  InitDefaults();
+  static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+      "\n\035central_control_message.proto\022\007message"
+      "\032\022message_base.proto\"\303\001\n\034Central_control"
+      "ler_statu_msg\022%\n\tbase_info\030\001 \002(\0132\022.messa"
+      "ge.Base_info\022\016\n\006paused\030\002 \002(\010\0226\n\025entrance"
+      "_statu_vector\030\003 \003(\0162\027.message.Entrance_s"
+      "tatu\0224\n\023export_statu_vector\030\004 \003(\0162\027.mess"
+      "age.Entrance_statu*+\n\016Entrance_statu\022\013\n\007"
+      "eEnable\020\000\022\014\n\010eDisable\020\001"
+  };
+  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
+      descriptor, 303);
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
+    "central_control_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_central_5fcontrol_5fmessage_2eproto
+namespace message {
+const ::google::protobuf::EnumDescriptor* Entrance_statu_descriptor() {
+  protobuf_central_5fcontrol_5fmessage_2eproto::protobuf_AssignDescriptorsOnce();
+  return protobuf_central_5fcontrol_5fmessage_2eproto::file_level_enum_descriptors[0];
+}
+bool Entrance_statu_IsValid(int value) {
+  switch (value) {
+    case 0:
+    case 1:
+      return true;
+    default:
+      return false;
+  }
+}
+
+
+// ===================================================================
+
+void Central_controller_statu_msg::InitAsDefaultInstance() {
+  ::message::_Central_controller_statu_msg_default_instance_._instance.get_mutable()->base_info_ = const_cast< ::message::Base_info*>(
+      ::message::Base_info::internal_default_instance());
+}
+void Central_controller_statu_msg::clear_base_info() {
+  if (base_info_ != NULL) base_info_->Clear();
+  clear_has_base_info();
+}
+#if !defined(_MSC_VER) || _MSC_VER >= 1900
+const int Central_controller_statu_msg::kBaseInfoFieldNumber;
+const int Central_controller_statu_msg::kPausedFieldNumber;
+const int Central_controller_statu_msg::kEntranceStatuVectorFieldNumber;
+const int Central_controller_statu_msg::kExportStatuVectorFieldNumber;
+#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900
+
+Central_controller_statu_msg::Central_controller_statu_msg()
+  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
+  if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+    ::protobuf_central_5fcontrol_5fmessage_2eproto::InitDefaultsCentral_controller_statu_msg();
+  }
+  SharedCtor();
+  // @@protoc_insertion_point(constructor:message.Central_controller_statu_msg)
+}
+Central_controller_statu_msg::Central_controller_statu_msg(const Central_controller_statu_msg& from)
+  : ::google::protobuf::Message(),
+      _internal_metadata_(NULL),
+      _has_bits_(from._has_bits_),
+      _cached_size_(0),
+      entrance_statu_vector_(from.entrance_statu_vector_),
+      export_statu_vector_(from.export_statu_vector_) {
+  _internal_metadata_.MergeFrom(from._internal_metadata_);
+  if (from.has_base_info()) {
+    base_info_ = new ::message::Base_info(*from.base_info_);
+  } else {
+    base_info_ = NULL;
+  }
+  paused_ = from.paused_;
+  // @@protoc_insertion_point(copy_constructor:message.Central_controller_statu_msg)
+}
+
+void Central_controller_statu_msg::SharedCtor() {
+  _cached_size_ = 0;
+  ::memset(&base_info_, 0, static_cast<size_t>(
+      reinterpret_cast<char*>(&paused_) -
+      reinterpret_cast<char*>(&base_info_)) + sizeof(paused_));
+}
+
+Central_controller_statu_msg::~Central_controller_statu_msg() {
+  // @@protoc_insertion_point(destructor:message.Central_controller_statu_msg)
+  SharedDtor();
+}
+
+void Central_controller_statu_msg::SharedDtor() {
+  if (this != internal_default_instance()) delete base_info_;
+}
+
+void Central_controller_statu_msg::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* Central_controller_statu_msg::descriptor() {
+  ::protobuf_central_5fcontrol_5fmessage_2eproto::protobuf_AssignDescriptorsOnce();
+  return ::protobuf_central_5fcontrol_5fmessage_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+}
+
+const Central_controller_statu_msg& Central_controller_statu_msg::default_instance() {
+  ::protobuf_central_5fcontrol_5fmessage_2eproto::InitDefaultsCentral_controller_statu_msg();
+  return *internal_default_instance();
+}
+
+Central_controller_statu_msg* Central_controller_statu_msg::New(::google::protobuf::Arena* arena) const {
+  Central_controller_statu_msg* n = new Central_controller_statu_msg;
+  if (arena != NULL) {
+    arena->Own(n);
+  }
+  return n;
+}
+
+void Central_controller_statu_msg::Clear() {
+// @@protoc_insertion_point(message_clear_start:message.Central_controller_statu_msg)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  // Prevent compiler warnings about cached_has_bits being unused
+  (void) cached_has_bits;
+
+  entrance_statu_vector_.Clear();
+  export_statu_vector_.Clear();
+  cached_has_bits = _has_bits_[0];
+  if (cached_has_bits & 0x00000001u) {
+    GOOGLE_DCHECK(base_info_ != NULL);
+    base_info_->Clear();
+  }
+  paused_ = false;
+  _has_bits_.Clear();
+  _internal_metadata_.Clear();
+}
+
+bool Central_controller_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.Central_controller_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 bool paused = 2;
+      case 2: {
+        if (static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) {
+          set_has_paused();
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
+                 input, &paused_)));
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      // repeated .message.Entrance_statu entrance_statu_vector = 3;
+      case 3: {
+        if (static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(24u /* 24 & 0xFF */)) {
+          int value;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          if (::message::Entrance_statu_IsValid(value)) {
+            add_entrance_statu_vector(static_cast< ::message::Entrance_statu >(value));
+          } else {
+            mutable_unknown_fields()->AddVarint(
+                3, static_cast< ::google::protobuf::uint64>(value));
+          }
+        } else if (
+            static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
+          DO_((::google::protobuf::internal::WireFormat::ReadPackedEnumPreserveUnknowns(
+                 input,
+                 3,
+                 ::message::Entrance_statu_IsValid,
+                 mutable_unknown_fields(),
+                 this->mutable_entrance_statu_vector())));
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      // repeated .message.Entrance_statu export_statu_vector = 4;
+      case 4: {
+        if (static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(32u /* 32 & 0xFF */)) {
+          int value;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          if (::message::Entrance_statu_IsValid(value)) {
+            add_export_statu_vector(static_cast< ::message::Entrance_statu >(value));
+          } else {
+            mutable_unknown_fields()->AddVarint(
+                4, static_cast< ::google::protobuf::uint64>(value));
+          }
+        } else if (
+            static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) {
+          DO_((::google::protobuf::internal::WireFormat::ReadPackedEnumPreserveUnknowns(
+                 input,
+                 4,
+                 ::message::Entrance_statu_IsValid,
+                 mutable_unknown_fields(),
+                 this->mutable_export_statu_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:message.Central_controller_statu_msg)
+  return true;
+failure:
+  // @@protoc_insertion_point(parse_failure:message.Central_controller_statu_msg)
+  return false;
+#undef DO_
+}
+
+void Central_controller_statu_msg::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // @@protoc_insertion_point(serialize_start:message.Central_controller_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 & 0x00000001u) {
+    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
+      1, *this->base_info_, output);
+  }
+
+  // required bool paused = 2;
+  if (cached_has_bits & 0x00000002u) {
+    ::google::protobuf::internal::WireFormatLite::WriteBool(2, this->paused(), output);
+  }
+
+  // repeated .message.Entrance_statu entrance_statu_vector = 3;
+  for (int i = 0, n = this->entrance_statu_vector_size(); i < n; i++) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      3, this->entrance_statu_vector(i), output);
+  }
+
+  // repeated .message.Entrance_statu export_statu_vector = 4;
+  for (int i = 0, n = this->export_statu_vector_size(); i < n; i++) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      4, this->export_statu_vector(i), output);
+  }
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        _internal_metadata_.unknown_fields(), output);
+  }
+  // @@protoc_insertion_point(serialize_end:message.Central_controller_statu_msg)
+}
+
+::google::protobuf::uint8* Central_controller_statu_msg::InternalSerializeWithCachedSizesToArray(
+    bool deterministic, ::google::protobuf::uint8* target) const {
+  (void)deterministic; // Unused
+  // @@protoc_insertion_point(serialize_to_array_start:message.Central_controller_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 & 0x00000001u) {
+    target = ::google::protobuf::internal::WireFormatLite::
+      InternalWriteMessageToArray(
+        1, *this->base_info_, deterministic, target);
+  }
+
+  // required bool paused = 2;
+  if (cached_has_bits & 0x00000002u) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(2, this->paused(), target);
+  }
+
+  // repeated .message.Entrance_statu entrance_statu_vector = 3;
+  target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+    3, this->entrance_statu_vector_, target);
+
+  // repeated .message.Entrance_statu export_statu_vector = 4;
+  target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+    4, this->export_statu_vector_, 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.Central_controller_statu_msg)
+  return target;
+}
+
+size_t Central_controller_statu_msg::RequiredFieldsByteSizeFallback() const {
+// @@protoc_insertion_point(required_fields_byte_size_fallback_start:message.Central_controller_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_paused()) {
+    // required bool paused = 2;
+    total_size += 1 + 1;
+  }
+
+  return total_size;
+}
+size_t Central_controller_statu_msg::ByteSizeLong() const {
+// @@protoc_insertion_point(message_byte_size_start:message.Central_controller_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] & 0x00000003) ^ 0x00000003) == 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 bool paused = 2;
+    total_size += 1 + 1;
+
+  } else {
+    total_size += RequiredFieldsByteSizeFallback();
+  }
+  // repeated .message.Entrance_statu entrance_statu_vector = 3;
+  {
+    size_t data_size = 0;
+    unsigned int count = static_cast<unsigned int>(this->entrance_statu_vector_size());for (unsigned int i = 0; i < count; i++) {
+      data_size += ::google::protobuf::internal::WireFormatLite::EnumSize(
+        this->entrance_statu_vector(static_cast<int>(i)));
+    }
+    total_size += (1UL * count) + data_size;
+  }
+
+  // repeated .message.Entrance_statu export_statu_vector = 4;
+  {
+    size_t data_size = 0;
+    unsigned int count = static_cast<unsigned int>(this->export_statu_vector_size());for (unsigned int i = 0; i < count; i++) {
+      data_size += ::google::protobuf::internal::WireFormatLite::EnumSize(
+        this->export_statu_vector(static_cast<int>(i)));
+    }
+    total_size += (1UL * count) + data_size;
+  }
+
+  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 Central_controller_statu_msg::MergeFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_merge_from_start:message.Central_controller_statu_msg)
+  GOOGLE_DCHECK_NE(&from, this);
+  const Central_controller_statu_msg* source =
+      ::google::protobuf::internal::DynamicCastToGenerated<const Central_controller_statu_msg>(
+          &from);
+  if (source == NULL) {
+  // @@protoc_insertion_point(generalized_merge_from_cast_fail:message.Central_controller_statu_msg)
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+  // @@protoc_insertion_point(generalized_merge_from_cast_success:message.Central_controller_statu_msg)
+    MergeFrom(*source);
+  }
+}
+
+void Central_controller_statu_msg::MergeFrom(const Central_controller_statu_msg& from) {
+// @@protoc_insertion_point(class_specific_merge_from_start:message.Central_controller_statu_msg)
+  GOOGLE_DCHECK_NE(&from, this);
+  _internal_metadata_.MergeFrom(from._internal_metadata_);
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  entrance_statu_vector_.MergeFrom(from.entrance_statu_vector_);
+  export_statu_vector_.MergeFrom(from.export_statu_vector_);
+  cached_has_bits = from._has_bits_[0];
+  if (cached_has_bits & 3u) {
+    if (cached_has_bits & 0x00000001u) {
+      mutable_base_info()->::message::Base_info::MergeFrom(from.base_info());
+    }
+    if (cached_has_bits & 0x00000002u) {
+      paused_ = from.paused_;
+    }
+    _has_bits_[0] |= cached_has_bits;
+  }
+}
+
+void Central_controller_statu_msg::CopyFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_copy_from_start:message.Central_controller_statu_msg)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void Central_controller_statu_msg::CopyFrom(const Central_controller_statu_msg& from) {
+// @@protoc_insertion_point(class_specific_copy_from_start:message.Central_controller_statu_msg)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool Central_controller_statu_msg::IsInitialized() const {
+  if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
+  if (has_base_info()) {
+    if (!this->base_info_->IsInitialized()) return false;
+  }
+  return true;
+}
+
+void Central_controller_statu_msg::Swap(Central_controller_statu_msg* other) {
+  if (other == this) return;
+  InternalSwap(other);
+}
+void Central_controller_statu_msg::InternalSwap(Central_controller_statu_msg* other) {
+  using std::swap;
+  entrance_statu_vector_.InternalSwap(&other->entrance_statu_vector_);
+  export_statu_vector_.InternalSwap(&other->export_statu_vector_);
+  swap(base_info_, other->base_info_);
+  swap(paused_, other->paused_);
+  swap(_has_bits_[0], other->_has_bits_[0]);
+  _internal_metadata_.Swap(&other->_internal_metadata_);
+  swap(_cached_size_, other->_cached_size_);
+}
+
+::google::protobuf::Metadata Central_controller_statu_msg::GetMetadata() const {
+  protobuf_central_5fcontrol_5fmessage_2eproto::protobuf_AssignDescriptorsOnce();
+  return ::protobuf_central_5fcontrol_5fmessage_2eproto::file_level_metadata[kIndexInFileMessages];
+}
+
+
+// @@protoc_insertion_point(namespace_scope)
+}  // namespace message
+
+// @@protoc_insertion_point(global_scope)

+ 397 - 0
message/central_control_message.pb.h

@@ -0,0 +1,397 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: central_control_message.proto
+
+#ifndef PROTOBUF_central_5fcontrol_5fmessage_2eproto__INCLUDED
+#define PROTOBUF_central_5fcontrol_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/generated_enum_reflection.h>
+#include <google/protobuf/unknown_field_set.h>
+#include "message_base.pb.h"
+// @@protoc_insertion_point(includes)
+
+namespace protobuf_central_5fcontrol_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 InitDefaultsCentral_controller_statu_msgImpl();
+void InitDefaultsCentral_controller_statu_msg();
+inline void InitDefaults() {
+  InitDefaultsCentral_controller_statu_msg();
+}
+}  // namespace protobuf_central_5fcontrol_5fmessage_2eproto
+namespace message {
+class Central_controller_statu_msg;
+class Central_controller_statu_msgDefaultTypeInternal;
+extern Central_controller_statu_msgDefaultTypeInternal _Central_controller_statu_msg_default_instance_;
+}  // namespace message
+namespace message {
+
+enum Entrance_statu {
+  eEnable = 0,
+  eDisable = 1
+};
+bool Entrance_statu_IsValid(int value);
+const Entrance_statu Entrance_statu_MIN = eEnable;
+const Entrance_statu Entrance_statu_MAX = eDisable;
+const int Entrance_statu_ARRAYSIZE = Entrance_statu_MAX + 1;
+
+const ::google::protobuf::EnumDescriptor* Entrance_statu_descriptor();
+inline const ::std::string& Entrance_statu_Name(Entrance_statu value) {
+  return ::google::protobuf::internal::NameOfEnum(
+    Entrance_statu_descriptor(), value);
+}
+inline bool Entrance_statu_Parse(
+    const ::std::string& name, Entrance_statu* value) {
+  return ::google::protobuf::internal::ParseNamedEnum<Entrance_statu>(
+    Entrance_statu_descriptor(), name, value);
+}
+// ===================================================================
+
+class Central_controller_statu_msg : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:message.Central_controller_statu_msg) */ {
+ public:
+  Central_controller_statu_msg();
+  virtual ~Central_controller_statu_msg();
+
+  Central_controller_statu_msg(const Central_controller_statu_msg& from);
+
+  inline Central_controller_statu_msg& operator=(const Central_controller_statu_msg& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  #if LANG_CXX11
+  Central_controller_statu_msg(Central_controller_statu_msg&& from) noexcept
+    : Central_controller_statu_msg() {
+    *this = ::std::move(from);
+  }
+
+  inline Central_controller_statu_msg& operator=(Central_controller_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 Central_controller_statu_msg& default_instance();
+
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
+  static inline const Central_controller_statu_msg* internal_default_instance() {
+    return reinterpret_cast<const Central_controller_statu_msg*>(
+               &_Central_controller_statu_msg_default_instance_);
+  }
+  static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+    0;
+
+  void Swap(Central_controller_statu_msg* other);
+  friend void swap(Central_controller_statu_msg& a, Central_controller_statu_msg& b) {
+    a.Swap(&b);
+  }
+
+  // implements Message ----------------------------------------------
+
+  inline Central_controller_statu_msg* New() const PROTOBUF_FINAL { return New(NULL); }
+
+  Central_controller_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 Central_controller_statu_msg& from);
+  void MergeFrom(const Central_controller_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(Central_controller_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 -------------------------------------------------------
+
+  // repeated .message.Entrance_statu entrance_statu_vector = 3;
+  int entrance_statu_vector_size() const;
+  void clear_entrance_statu_vector();
+  static const int kEntranceStatuVectorFieldNumber = 3;
+  ::message::Entrance_statu entrance_statu_vector(int index) const;
+  void set_entrance_statu_vector(int index, ::message::Entrance_statu value);
+  void add_entrance_statu_vector(::message::Entrance_statu value);
+  const ::google::protobuf::RepeatedField<int>& entrance_statu_vector() const;
+  ::google::protobuf::RepeatedField<int>* mutable_entrance_statu_vector();
+
+  // repeated .message.Entrance_statu export_statu_vector = 4;
+  int export_statu_vector_size() const;
+  void clear_export_statu_vector();
+  static const int kExportStatuVectorFieldNumber = 4;
+  ::message::Entrance_statu export_statu_vector(int index) const;
+  void set_export_statu_vector(int index, ::message::Entrance_statu value);
+  void add_export_statu_vector(::message::Entrance_statu value);
+  const ::google::protobuf::RepeatedField<int>& export_statu_vector() const;
+  ::google::protobuf::RepeatedField<int>* mutable_export_statu_vector();
+
+  // 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 bool paused = 2;
+  bool has_paused() const;
+  void clear_paused();
+  static const int kPausedFieldNumber = 2;
+  bool paused() const;
+  void set_paused(bool value);
+
+  // @@protoc_insertion_point(class_scope:message.Central_controller_statu_msg)
+ private:
+  void set_has_base_info();
+  void clear_has_base_info();
+  void set_has_paused();
+  void clear_has_paused();
+
+  // 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::RepeatedField<int> entrance_statu_vector_;
+  ::google::protobuf::RepeatedField<int> export_statu_vector_;
+  ::message::Base_info* base_info_;
+  bool paused_;
+  friend struct ::protobuf_central_5fcontrol_5fmessage_2eproto::TableStruct;
+  friend void ::protobuf_central_5fcontrol_5fmessage_2eproto::InitDefaultsCentral_controller_statu_msgImpl();
+};
+// ===================================================================
+
+
+// ===================================================================
+
+#ifdef __GNUC__
+  #pragma GCC diagnostic push
+  #pragma GCC diagnostic ignored "-Wstrict-aliasing"
+#endif  // __GNUC__
+// Central_controller_statu_msg
+
+// required .message.Base_info base_info = 1;
+inline bool Central_controller_statu_msg::has_base_info() const {
+  return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void Central_controller_statu_msg::set_has_base_info() {
+  _has_bits_[0] |= 0x00000001u;
+}
+inline void Central_controller_statu_msg::clear_has_base_info() {
+  _has_bits_[0] &= ~0x00000001u;
+}
+inline const ::message::Base_info& Central_controller_statu_msg::base_info() const {
+  const ::message::Base_info* p = base_info_;
+  // @@protoc_insertion_point(field_get:message.Central_controller_statu_msg.base_info)
+  return p != NULL ? *p : *reinterpret_cast<const ::message::Base_info*>(
+      &::message::_Base_info_default_instance_);
+}
+inline ::message::Base_info* Central_controller_statu_msg::release_base_info() {
+  // @@protoc_insertion_point(field_release:message.Central_controller_statu_msg.base_info)
+  clear_has_base_info();
+  ::message::Base_info* temp = base_info_;
+  base_info_ = NULL;
+  return temp;
+}
+inline ::message::Base_info* Central_controller_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.Central_controller_statu_msg.base_info)
+  return base_info_;
+}
+inline void Central_controller_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.Central_controller_statu_msg.base_info)
+}
+
+// required bool paused = 2;
+inline bool Central_controller_statu_msg::has_paused() const {
+  return (_has_bits_[0] & 0x00000002u) != 0;
+}
+inline void Central_controller_statu_msg::set_has_paused() {
+  _has_bits_[0] |= 0x00000002u;
+}
+inline void Central_controller_statu_msg::clear_has_paused() {
+  _has_bits_[0] &= ~0x00000002u;
+}
+inline void Central_controller_statu_msg::clear_paused() {
+  paused_ = false;
+  clear_has_paused();
+}
+inline bool Central_controller_statu_msg::paused() const {
+  // @@protoc_insertion_point(field_get:message.Central_controller_statu_msg.paused)
+  return paused_;
+}
+inline void Central_controller_statu_msg::set_paused(bool value) {
+  set_has_paused();
+  paused_ = value;
+  // @@protoc_insertion_point(field_set:message.Central_controller_statu_msg.paused)
+}
+
+// repeated .message.Entrance_statu entrance_statu_vector = 3;
+inline int Central_controller_statu_msg::entrance_statu_vector_size() const {
+  return entrance_statu_vector_.size();
+}
+inline void Central_controller_statu_msg::clear_entrance_statu_vector() {
+  entrance_statu_vector_.Clear();
+}
+inline ::message::Entrance_statu Central_controller_statu_msg::entrance_statu_vector(int index) const {
+  // @@protoc_insertion_point(field_get:message.Central_controller_statu_msg.entrance_statu_vector)
+  return static_cast< ::message::Entrance_statu >(entrance_statu_vector_.Get(index));
+}
+inline void Central_controller_statu_msg::set_entrance_statu_vector(int index, ::message::Entrance_statu value) {
+  assert(::message::Entrance_statu_IsValid(value));
+  entrance_statu_vector_.Set(index, value);
+  // @@protoc_insertion_point(field_set:message.Central_controller_statu_msg.entrance_statu_vector)
+}
+inline void Central_controller_statu_msg::add_entrance_statu_vector(::message::Entrance_statu value) {
+  assert(::message::Entrance_statu_IsValid(value));
+  entrance_statu_vector_.Add(value);
+  // @@protoc_insertion_point(field_add:message.Central_controller_statu_msg.entrance_statu_vector)
+}
+inline const ::google::protobuf::RepeatedField<int>&
+Central_controller_statu_msg::entrance_statu_vector() const {
+  // @@protoc_insertion_point(field_list:message.Central_controller_statu_msg.entrance_statu_vector)
+  return entrance_statu_vector_;
+}
+inline ::google::protobuf::RepeatedField<int>*
+Central_controller_statu_msg::mutable_entrance_statu_vector() {
+  // @@protoc_insertion_point(field_mutable_list:message.Central_controller_statu_msg.entrance_statu_vector)
+  return &entrance_statu_vector_;
+}
+
+// repeated .message.Entrance_statu export_statu_vector = 4;
+inline int Central_controller_statu_msg::export_statu_vector_size() const {
+  return export_statu_vector_.size();
+}
+inline void Central_controller_statu_msg::clear_export_statu_vector() {
+  export_statu_vector_.Clear();
+}
+inline ::message::Entrance_statu Central_controller_statu_msg::export_statu_vector(int index) const {
+  // @@protoc_insertion_point(field_get:message.Central_controller_statu_msg.export_statu_vector)
+  return static_cast< ::message::Entrance_statu >(export_statu_vector_.Get(index));
+}
+inline void Central_controller_statu_msg::set_export_statu_vector(int index, ::message::Entrance_statu value) {
+  assert(::message::Entrance_statu_IsValid(value));
+  export_statu_vector_.Set(index, value);
+  // @@protoc_insertion_point(field_set:message.Central_controller_statu_msg.export_statu_vector)
+}
+inline void Central_controller_statu_msg::add_export_statu_vector(::message::Entrance_statu value) {
+  assert(::message::Entrance_statu_IsValid(value));
+  export_statu_vector_.Add(value);
+  // @@protoc_insertion_point(field_add:message.Central_controller_statu_msg.export_statu_vector)
+}
+inline const ::google::protobuf::RepeatedField<int>&
+Central_controller_statu_msg::export_statu_vector() const {
+  // @@protoc_insertion_point(field_list:message.Central_controller_statu_msg.export_statu_vector)
+  return export_statu_vector_;
+}
+inline ::google::protobuf::RepeatedField<int>*
+Central_controller_statu_msg::mutable_export_statu_vector() {
+  // @@protoc_insertion_point(field_mutable_list:message.Central_controller_statu_msg.export_statu_vector)
+  return &export_statu_vector_;
+}
+
+#ifdef __GNUC__
+  #pragma GCC diagnostic pop
+#endif  // __GNUC__
+
+// @@protoc_insertion_point(namespace_scope)
+
+}  // namespace message
+
+namespace google {
+namespace protobuf {
+
+template <> struct is_proto_enum< ::message::Entrance_statu> : ::google::protobuf::internal::true_type {};
+template <>
+inline const EnumDescriptor* GetEnumDescriptor< ::message::Entrance_statu>() {
+  return ::message::Entrance_statu_descriptor();
+}
+
+}  // namespace protobuf
+}  // namespace google
+
+// @@protoc_insertion_point(global_scope)
+
+#endif  // PROTOBUF_central_5fcontrol_5fmessage_2eproto__INCLUDED

+ 20 - 0
message/central_control_message.proto

@@ -0,0 +1,20 @@
+syntax = "proto2";
+package message;
+import "message_base.proto";
+
+//出入口状态
+enum Entrance_statu
+{
+    eEnable=0;                          //出入口关闭
+    eDisable=1;                         //出入口开放
+}
+
+//中控状态消息
+message Central_controller_statu_msg
+{
+    required Base_info                  base_info=1;                 //消息类型
+    required bool                       paused=2;
+    repeated Entrance_statu             entrance_statu_vector=3;    //入口状态(关闭或者开放)
+    repeated Entrance_statu             export_statu_vector=4;      //出口状态
+}
+

+ 15 - 13
message/message_base.pb.cc

@@ -342,7 +342,7 @@ void AddDescriptorsImpl() {
       "\016\n\006height\030\007 \001(\002\0223\n\020parkspace_status\030\010 \001("
       "\0162\031.message.Parkspace_status\022#\n\010car_info"
       "\030\t \001(\0132\021.message.Car_info\022\022\n\nentry_time\030"
-      "\n \001(\t\022\022\n\nleave_time\030\013 \001(\t*\276\006\n\014Message_ty"
+      "\n \001(\t\022\022\n\nleave_time\030\013 \001(\t*\342\006\n\014Message_ty"
       "pe\022\r\n\teBase_msg\020\000\022\020\n\014eCommand_msg\020\001\022\026\n\022e"
       "Locate_status_msg\020\021\022\027\n\023eLocate_request_m"
       "sg\020\022\022\030\n\024eLocate_response_msg\020\023\022\030\n\024eDispa"
@@ -363,20 +363,21 @@ void AddDescriptorsImpl() {
       "msg\020B\022\037\n\033ePickup_command_request_msg\020C\022 "
       "\n\034ePickup_command_response_msg\020D\022\037\n\032eSto"
       "ring_process_statu_msg\020\220\001\022\037\n\032ePicking_pr"
-      "ocess_statu_msg\020\221\001*f\n\014Communicator\022\n\n\006eE"
-      "mpty\020\000\022\t\n\005eMain\020\001\022\016\n\teTerminor\020\200\002\022\017\n\nePa"
-      "rkspace\020\200\004\022\016\n\teMeasurer\020\200\006\022\016\n\teDispatch\020"
-      "\200\010*#\n\005Event\022\014\n\010eStoring\020\001\022\014\n\010ePicking\020\002*"
-      "e\n\013Error_level\022\n\n\006NORMAL\020\000\022\024\n\020NEGLIGIBLE"
-      "_ERROR\020\001\022\017\n\013MINOR_ERROR\020\002\022\017\n\013MAJOR_ERROR"
-      "\020\003\022\022\n\016CRITICAL_ERROR\020\004*q\n\020Parkspace_stat"
-      "us\022\024\n\020eParkspace_empty\020\000\022\027\n\023eParkspace_o"
-      "ccupied\020\001\022\030\n\024eParkspace_reserverd\020\002\022\024\n\020e"
-      "Parkspace_error\020\003*(\n\tDirection\022\014\n\010eForwa"
-      "rd\020\001\022\r\n\teBackward\020\002"
+      "ocess_statu_msg\020\221\001\022\"\n\035eCentral_controlle"
+      "r_statu_msg\020\240\001*f\n\014Communicator\022\n\n\006eEmpty"
+      "\020\000\022\t\n\005eMain\020\001\022\016\n\teTerminor\020\200\002\022\017\n\neParksp"
+      "ace\020\200\004\022\016\n\teMeasurer\020\200\006\022\016\n\teDispatch\020\200\010*#"
+      "\n\005Event\022\014\n\010eStoring\020\001\022\014\n\010ePicking\020\002*e\n\013E"
+      "rror_level\022\n\n\006NORMAL\020\000\022\024\n\020NEGLIGIBLE_ERR"
+      "OR\020\001\022\017\n\013MINOR_ERROR\020\002\022\017\n\013MAJOR_ERROR\020\003\022\022"
+      "\n\016CRITICAL_ERROR\020\004*q\n\020Parkspace_status\022\024"
+      "\n\020eParkspace_empty\020\000\022\027\n\023eParkspace_occup"
+      "ied\020\001\022\030\n\024eParkspace_reserverd\020\002\022\024\n\020ePark"
+      "space_error\020\003*(\n\tDirection\022\014\n\010eForward\020\001"
+      "\022\r\n\teBackward\020\002"
   };
   ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
-      descriptor, 2179);
+      descriptor, 2215);
   ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
     "message_base.proto", &protobuf_RegisterTypes);
 }
@@ -424,6 +425,7 @@ bool Message_type_IsValid(int value) {
     case 68:
     case 144:
     case 145:
+    case 160:
       return true;
     default:
       return false;

+ 3 - 2
message/message_base.pb.h

@@ -111,11 +111,12 @@ enum Message_type {
   ePickup_command_request_msg = 67,
   ePickup_command_response_msg = 68,
   eStoring_process_statu_msg = 144,
-  ePicking_process_statu_msg = 145
+  ePicking_process_statu_msg = 145,
+  eCentral_controller_statu_msg = 160
 };
 bool Message_type_IsValid(int value);
 const Message_type Message_type_MIN = eBase_msg;
-const Message_type Message_type_MAX = ePicking_process_statu_msg;
+const Message_type Message_type_MAX = eCentral_controller_statu_msg;
 const int Message_type_ARRAYSIZE = Message_type_MAX + 1;
 
 const ::google::protobuf::EnumDescriptor* Message_type_descriptor();

+ 5 - 2
message/message_base.proto

@@ -37,8 +37,11 @@ enum Message_type
 
 
 
-    eStoring_process_statu_msg=0x90;        //停车进度条消息
-    ePicking_process_statu_msg=0x91;        //取车进度消息
+    eStoring_process_statu_msg=0x90;        //停车指令进度条消息
+    ePicking_process_statu_msg=0x91;        //取车指令进度消息
+
+
+    eCentral_controller_statu_msg=0xa0;     //中控系统状态消息
 
 
 }

File diff suppressed because it is too large
+ 5762 - 863
message/process_message.pb.cc


File diff suppressed because it is too large
+ 4785 - 1007
message/process_message.pb.h


+ 101 - 24
message/process_message.proto

@@ -10,26 +10,45 @@ enum Step_statu
     eComplete=3;
 }
 
+
 //分配车位步骤状态
 message Alloc_space_step_statu
 {
-    required Step_statu                 step_statu=1;       //状态
+    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];       //状态
+    optional Parkspace_info             space_info=2;       //当前状态附带信息
+    optional string                     description=3;      //状态说明/错误说明
+}
 
 //查询车位步骤状态
 message Search_space_step_statu
 {
-    required Step_statu                 step_statu=1;       //状态
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
     optional Parkspace_info             space_info=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
 {
-    required Step_statu                 step_statu=1;       //状态
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    optional Parkspace_info             space_info=2;       //当前状态附带信息
+    optional string                     description=3;      //状态说明/错误说明
+}
+message Back_confirm_space_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
     optional Parkspace_info             space_info=2;       //当前状态附带信息
     optional string                     description=3;      //状态说明/错误说明
 }
@@ -37,7 +56,13 @@ message Confirm_space_step_statu
 //解锁/释放车位步骤状态
 message Release_space_step_statu
 {
-    required Step_statu                 step_statu=1;       //状态
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    optional Parkspace_info             space_info=2;       //当前状态附带信息
+    optional string                     description=3;      //状态说明/错误说明
+}
+message Back_release_space_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
     optional Parkspace_info             space_info=2;       //当前状态附带信息
     optional string                     description=3;      //状态说明/错误说明
 }
@@ -45,15 +70,43 @@ message Release_space_step_statu
 //测量步骤状态
 message Measure_step_statu
 {
-    required Step_statu                 step_statu=1;       //状态
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
     optional Locate_information         locate_info=2;      //定位结果
     optional string                     description=3;      //状态说明/错误说明
 }
-
+message Back_measure_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    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;      //wj定位结果
+    optional Locate_information         locate_info_result=4;      //wj定位结果
+    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
 {
-    required Step_statu                 step_statu=1;       //状态
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    optional Locate_information         locate_info=2;      //定位结果
+    optional Parkspace_info             space_info=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;      //定位结果
     optional Parkspace_info             space_info=3;       //目标车位
     optional string                     description=4;      //状态说明/错误说明
@@ -62,7 +115,13 @@ message Dispatch_store_step_statu
 //取车调度步骤状态
 message Dispatch_pick_step_statu
 {
-    required Step_statu                 step_statu=1;       //状态
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    optional Parkspace_info             space_info=2;       //目标车位
+    optional string                     description=3;      //状态说明/错误说明
+}
+message Back_dispatch_pick_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
     optional Parkspace_info             space_info=2;       //目标车位
     optional string                     description=3;      //状态说明/错误说明
 }
@@ -70,7 +129,13 @@ message Dispatch_pick_step_statu
 //取车等待车辆离开
 message Waitfor_leave_step_statu
 {
-    required Step_statu                 step_statu=1;       //状态
+    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;      //状态说明/错误说明
 }
@@ -78,24 +143,36 @@ message Waitfor_leave_step_statu
 //停车流程进度消息
 message Storing_process_statu_msg
 {
-    required Base_info                  base_info=1;
-    required int32                      terminal_id=2;              //终端id
-    required string                     license=3;
-    required Alloc_space_step_statu     alloc_space_step=4;
-    required Measure_step_statu         measure_step=5;
-    required Dispatch_store_step_statu  dispatch_step=6;
-    required Confirm_space_step_statu   confirm_space_step=7;
-    optional Release_space_step_statu   failed_release_space_step=8;
+    required Base_info                          base_info=1;
+    required int32                              terminal_id=2;              //终端id
+    required string                             license=3;
+
+    optional Alloc_space_step_statu             alloc_space_step=4;
+    optional Measure_step_statu                 measure_step=5;
+    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_measure_step_statu            back_measure_step=13;
+    optional Back_alloc_space_step_statu        back_alloc_space_step=14;
+    optional bool                               back_completed=15;
 }
 
 //取车流程进度消息
 message Picking_process_statu_msg
 {
-    required Base_info                  base_info=1;
-    required int32                      terminal_id=2;              //终端id
-    required string                     license=3;
-    required Search_space_step_statu    search_space_step=4;
-    required Dispatch_pick_step_statu   dispatch_step=5;
-    required Release_space_step_statu   release_space_step=6;
-    required Waitfor_leave_step_statu   waitfor_leave=7;
+    required Base_info                          base_info=1;
+    required int32                              terminal_id=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_release_space_step_statu      back_release_space_step=10;
+    optional Back_search_space_step_statu       back_search_space_step_statu=11;
 }

+ 34 - 20
parkspace/Parkspace_communicator.cpp

@@ -9,7 +9,8 @@ Parkspace_communicator::~Parkspace_communicator(){}
 /*
  * 请求分配车位
  */
-Error_manager Parkspace_communicator::alloc_request(message::Parkspace_allocation_request_msg& request,message::Parkspace_allocation_response_msg& result)
+Error_manager Parkspace_communicator::alloc_request(message::Parkspace_allocation_request_msg& request,
+        message::Parkspace_allocation_response_msg& result,Thread_condition& cancel_condition)
 {
     /*
      * 检查request合法性,以及模块状态
@@ -71,18 +72,21 @@ Error_manager Parkspace_communicator::alloc_request(message::Parkspace_allocatio
         else
         {
             //未查询到记录,任务已经被提前取消,记录被删除
-            return Error_manager(PARKSPACE_ALLOC_REQUEST_CANCELED,MINOR_ERROR,"分配车位请求提前取消!!!");
+            return Error_manager(TASK_CANCEL,MINOR_ERROR,"分配车位请求提前取消!!!");
         }
 
         auto end_time=std::chrono::system_clock::now();
         auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time);
         time=1000.0*double(duration.count()) * std::chrono::microseconds::period::num / std::chrono::microseconds::period::den;
-        std::this_thread::yield();
-        usleep(1000);
-    }while(time<double(timeout));
+        if(time>double(timeout))
+        {
+            m_alloc_table.erase(request.command_key());
+            return Error_manager(RESPONSE_TIMEOUT,MINOR_ERROR,"parkspace alloc request timeout");
+        }
+    }while(cancel_condition.wait_for_ex(std::chrono::milliseconds(1))==false);
     //超时,删除记录,返回错误
     m_alloc_table.erase(request.command_key());
-    return Error_manager(RESPONSE_TIMEOUT,MINOR_ERROR,"parkspace alloc request timeout");
+    return Error_manager(TASK_CANCEL,MINOR_ERROR,"parkspace alloc request timeout");
 
 }
 
@@ -90,7 +94,7 @@ Error_manager Parkspace_communicator::alloc_request(message::Parkspace_allocatio
  * 查询车辆所在位置请求
  */
 Error_manager Parkspace_communicator::search_request(message::Parkspace_search_request_msg& request,
-        message::Parkspace_search_response_msg& result)
+        message::Parkspace_search_response_msg& result,Thread_condition& cancel_condition)
 {
     /*
      * 检查request合法性,以及模块状态
@@ -162,19 +166,22 @@ Error_manager Parkspace_communicator::search_request(message::Parkspace_search_r
         auto end_time=std::chrono::system_clock::now();
         auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time);
         time=1000.0*double(duration.count()) * std::chrono::microseconds::period::num / std::chrono::microseconds::period::den;
-        std::this_thread::yield();
-        usleep(1000);
-    }while(time<double(timeout));
+        if(time>double(timeout))
+        {
+            m_search_table.erase(request.command_key());
+            return Error_manager(RESPONSE_TIMEOUT,MINOR_ERROR,"parkspace search request timeout");
+        }
+    }while(cancel_condition.wait_for_ex(std::chrono::milliseconds(1))==false);
     //超时,删除记录,返回错误
     m_search_table.erase(request.command_key());
-    return Error_manager(RESPONSE_TIMEOUT,MINOR_ERROR,"parkspace search request timeout");
+    return Error_manager(TASK_CANCEL,MINOR_ERROR,"parkspace search request canceled");
 }
 
 /*
  * 释放车位请求(停车失败或者取车完成时调用)
  */
 Error_manager Parkspace_communicator::release_request(message::Parkspace_release_request_msg& request,
-        message::Parkspace_release_response_msg& result)
+        message::Parkspace_release_response_msg& result,Thread_condition& cancel_condition)
 {
     /*
     * 检查request合法性,以及模块状态
@@ -242,19 +249,22 @@ Error_manager Parkspace_communicator::release_request(message::Parkspace_release
         auto end_time=std::chrono::system_clock::now();
         auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time);
         time=1000.0*double(duration.count()) * std::chrono::microseconds::period::num / std::chrono::microseconds::period::den;
-        std::this_thread::yield();
-        usleep(1000);
-    }while(time<double(timeout));
+        if(time>double(timeout))
+        {
+            m_release_table.erase(request.command_key());
+            return Error_manager(RESPONSE_TIMEOUT,MINOR_ERROR,"parkspace release request timeout");
+        }
+    }while(cancel_condition.wait_for_ex(std::chrono::milliseconds(1))==false);
     //超时,删除记录,返回错误
     m_release_table.erase(request.command_key());
-    return Error_manager(RESPONSE_TIMEOUT,MINOR_ERROR,"parkspace release request timeout");
+    return Error_manager(TASK_CANCEL,MINOR_ERROR,"parkspace release request canceled");
 }
 
 /*
      * 确认占用车位消息
      */
 Error_manager Parkspace_communicator::confirm_request(message::Parkspace_confirm_alloc_request_msg& request,
-        message::Parkspace_confirm_alloc_response_msg& result)
+        message::Parkspace_confirm_alloc_response_msg& result,Thread_condition& cancel_condition)
 {
     /*
     * 检查request合法性,以及模块状态
@@ -320,11 +330,15 @@ Error_manager Parkspace_communicator::confirm_request(message::Parkspace_confirm
         auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time);
         time=1000.0*double(duration.count()) * std::chrono::microseconds::period::num / std::chrono::microseconds::period::den;
         std::this_thread::yield();
-        usleep(1000);
-    }while(time<double(timeout));
+        if(time>double(timeout))
+        {
+            m_confirm_table.erase(request.command_key());
+            return Error_manager(RESPONSE_TIMEOUT,MINOR_ERROR,"parkspace confirm request timeout");
+        }
+    }while(cancel_condition.wait_for_ex(std::chrono::milliseconds(1))==false);
     //超时,删除记录,返回错误
     m_confirm_table.erase(request.command_key());
-    return Error_manager(RESPONSE_TIMEOUT,MINOR_ERROR,"parkspace confirm request timeout");
+    return Error_manager(TASK_CANCEL,MINOR_ERROR,"parkspace confirm request canceled");
 }
 
 Error_manager Parkspace_communicator::check_statu()

+ 8 - 4
parkspace/Parkspace_communicator.h

@@ -19,22 +19,26 @@ public:
     /*
      * 请求分配车位
      */
-    Error_manager alloc_request(message::Parkspace_allocation_request_msg& request,message::Parkspace_allocation_response_msg& result);
+    Error_manager alloc_request(message::Parkspace_allocation_request_msg& request,
+            message::Parkspace_allocation_response_msg& result,Thread_condition& cancel_condition);
 
     /*
      * 查询车辆所在位置请求
      */
-    Error_manager search_request(message::Parkspace_search_request_msg& request,message::Parkspace_search_response_msg& response);
+    Error_manager search_request(message::Parkspace_search_request_msg& request,
+            message::Parkspace_search_response_msg& response,Thread_condition& cancel_condition);
 
     /*
      * 释放车位请求(停车失败或者取车完成时调用)
      */
-    Error_manager release_request(message::Parkspace_release_request_msg& request,message::Parkspace_release_response_msg& response);
+    Error_manager release_request(message::Parkspace_release_request_msg& request,
+            message::Parkspace_release_response_msg& response,Thread_condition& cancel_condition);
 
     /*
      * 确认占用车位消息
      */
-    Error_manager confirm_request(message::Parkspace_confirm_alloc_request_msg& request,message::Parkspace_confirm_alloc_response_msg& response);
+    Error_manager confirm_request(message::Parkspace_confirm_alloc_request_msg& request,
+            message::Parkspace_confirm_alloc_response_msg& response,Thread_condition& cancel_condition);
 
     Error_manager check_statu();
 

+ 1 - 0
proto.sh

@@ -4,6 +4,7 @@ protoc -I=./message parkspace_allocation_message.proto --cpp_out=./message
 protoc -I=./message terminal_message.proto --cpp_out=./message
 protoc -I=./message process_message.proto --cpp_out=./message
 protoc -I=./message dispatch_message.proto --cpp_out=./message
+protoc -I=./message central_control_message.proto --cpp_out=./message
 
 
 protoc -I=./system system_setting.proto --cpp_out=./system

+ 128 - 0
solve_exception/exception_solver.cpp

@@ -0,0 +1,128 @@
+//
+// Created by zx on 2020/8/20.
+//
+
+#include "exception_solver.h"
+#include "command_manager.h"
+
+Exception_solver::Exception_solver() {
+
+}
+Exception_solver::~Exception_solver() {
+
+}
+
+Error_manager Exception_solver::add_task_cancel_condition(std::string license,tq::BaseTask* task)
+{
+    if(m_ptask_map.find(license)==true || task== nullptr)
+    {
+        return Error_manager(ERROR,MINOR_ERROR,"任务标识已存在,或者标识地址为null");
+    }
+    m_ptask_map[license]=task;
+    return SUCCESS;
+}
+
+Error_manager Exception_solver::delete_task_cancel_condition(std::string license)
+{
+    if(m_ptask_map.find(license)==true)
+    {
+        m_ptask_map.erase(license);
+        return SUCCESS;
+    }
+    return Error_manager(ERROR,MINOR_ERROR,"任务取消标志不存在");
+}
+
+Error_manager Exception_solver::encapsulate_msg(Communication_message* message)
+{
+    Error_manager code;
+    //记录请求
+    switch (message->get_message_type())
+    {
+        default:
+            code= Communication_socket_base::encapsulate_msg(message);
+
+            break;
+    }
+    return code;
+}
+Error_manager Exception_solver::execute_msg(Communication_message* p_msg)
+{
+    if(p_msg== nullptr)
+        return Error_manager(POINTER_IS_NULL,CRITICAL_ERROR,"dispatch response msg pointer is null");
+
+
+    //测量response消息
+    switch (p_msg->get_message_type())
+    {
+        default:break;
+    }
+    return SUCCESS;
+}
+/*
+ * 检测消息是否可被处理
+ */
+Error_manager Exception_solver::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::eDispatch_response_msg
+          ||p_msg->get_message_type() == Communication_message::Message_type::eDispatch_status_msg)
+         && p_msg->get_receiver() == Communication_message::Communicator::eMain )
+    {
+        return Error_code::SUCCESS;
+    }
+    else
+    {
+        //认为接受人
+        return Error_code::INVALID_MESSAGE;
+    }*/
+}
+/*
+ * 心跳发送函数,重载
+ */
+Error_manager Exception_solver::encapsulate_send_data()
+{
+    return SUCCESS;
+}
+//检查消息是否可以被解析, 需要重载
+Error_manager Exception_solver::check_executer(Communication_message* p_msg)
+{
+    return SUCCESS;
+}
+
+
+/*
+     * 处理故障
+     */
+Error_manager Exception_solver::solve_exception(Error_manager code,tq::BaseTask* task)
+{
+    if(code.get_error_level()==CRITICAL_ERROR)
+    {
+        //系统急停
+        Command_manager::get_instance_pointer()->pause_system();
+        return SUCCESS;
+    }
+    if(code.get_error_level()==MAJOR_ERROR)
+    {
+        task->Cancel();
+        //关闭出入口
+        if(task->GetCategory()==message::eStoring) {
+            StoreProcessTask* pstoring=(StoreProcessTask*)task;
+            Command_manager::get_instance_pointer()->enable_entrance(pstoring->terminal_id(),false);
+        }
+        if(task->GetCategory()==message::ePicking) {
+            PickupProcessTask* pPicking=(PickupProcessTask*)task;
+            Command_manager::get_instance_pointer()->enable_export(pPicking->terminal_id(),false);
+        }
+
+        return SUCCESS;
+    }
+
+    switch(code.get_error_code())
+    {
+        case ERROR:
+        {
+            break;
+        }
+    }
+}

+ 58 - 0
solve_exception/exception_solver.h

@@ -0,0 +1,58 @@
+//
+// Created by zx on 2020/8/20.
+//
+
+#ifndef NNXX_TESTS_ERROR_HANDLING_H
+#define NNXX_TESTS_ERROR_HANDLING_H
+#include "communication_socket_base.h"
+#include "singleton.h"
+#include "dispatch_message.pb.h"
+#include "error_code.h"
+#include "thread_safe_map.h"
+#include "StoreProcessTask.h"
+#include "PickupProcessTask.h"
+
+class Exception_solver :public Singleton<Exception_solver>, public Communication_socket_base
+{
+    friend Singleton<Exception_solver>;
+public:
+    virtual ~Exception_solver();
+    /*
+     * 添加流程的任务取消标志位
+     * license:车牌号,作为流程任务的唯一标识
+     */
+    Error_manager add_task_cancel_condition(std::string license,tq::BaseTask* task);
+    /*
+     * 删除流程的任务取消标志位
+     * license:车牌号,作为流程任务的唯一标识
+     */
+    Error_manager delete_task_cancel_condition(std::string license);
+
+    /*
+     * 处理故障
+     */
+    Error_manager solve_exception(Error_manager code,tq::BaseTask* task);
+
+protected:
+    Exception_solver();
+
+    virtual Error_manager encapsulate_msg(Communication_message* message);
+    virtual Error_manager execute_msg(Communication_message* p_msg);
+    /*
+     * 检测消息是否可被处理
+     */
+    virtual Error_manager check_msg(Communication_message* p_msg);
+    /*
+     * 心跳发送函数,重载
+     */
+    virtual Error_manager encapsulate_send_data();
+    //检查消息是否可以被解析, 需要重载
+    virtual Error_manager check_executer(Communication_message* p_msg);
+
+private:
+    thread_safe_map<std::string,tq::BaseTask*>                  m_ptask_map;
+
+};
+
+
+#endif //NNXX_TESTS_ERROR_HANDLING_H

+ 45 - 25
system/PickupProcessTask.cpp

@@ -8,6 +8,7 @@
 #include "process_message.pb.h"
 #include "command_manager.h"
 #include "system_communicator.h"
+#include "exception_solver.h"
 #include "uniq_key.h"
 
 PickupProcessTask::PickupProcessTask(unsigned int terminal_id)
@@ -17,6 +18,7 @@ PickupProcessTask::PickupProcessTask(unsigned int terminal_id)
 }
 PickupProcessTask::~PickupProcessTask()
 {
+    Exception_solver::get_instance_pointer()->delete_task_cancel_condition(m_car_info.license());
     //退出线程
     m_publish_exit_condition.set_pass_ever(true);
     if(m_publish_statu_thread!= nullptr)
@@ -32,8 +34,21 @@ PickupProcessTask::~PickupProcessTask()
 Error_manager PickupProcessTask::init_task(message::Car_info car_info)
 {
     reset_recv_msg();
-
     m_car_info=car_info;
+    //添加当前流程的任务取消标志位到异常处理模块
+    m_cancel_condition.reset(false, false, false);
+    Error_manager code=Exception_solver::get_instance_pointer()->add_task_cancel_condition(car_info.license(),this);
+    if(code!=SUCCESS)
+        return code;
+
+    //设置状态消息,基本信息
+    message::Base_info base_info;
+    base_info.set_msg_type(message::ePicking_process_statu_msg);
+    base_info.set_sender(message::eMain);
+    base_info.set_receiver(message::eEmpty);
+    m_process_msg.mutable_base_info()->CopyFrom(base_info);
+    m_process_msg.set_terminal_id(m_terminor_id);
+    m_process_msg.set_license(m_car_info.license());
 
     m_step_statu=eSearch_step;
     ///创建状态发布线程
@@ -47,6 +62,15 @@ Error_manager PickupProcessTask::init_task(message::Car_info car_info)
 
 }
 
+/*
+     * 取消任务
+     */
+void PickupProcessTask::Cancel()
+{
+    m_cancel_condition.set_pass_ever(true);
+    tq::BaseTask::Cancel();
+}
+
 void PickupProcessTask::reset_recv_msg()
 {
     m_search_request_msg=message::Parkspace_search_request_msg();
@@ -55,8 +79,6 @@ void PickupProcessTask::reset_recv_msg()
     m_dispatch_response_msg=message::Dispatch_response_msg();
 }
 
-
-
 /*
  * 查询车位
  */
@@ -91,7 +113,8 @@ Error_manager PickupProcessTask::search_space()
     request.mutable_base_info()->CopyFrom(base_info);
     request.mutable_car_info()->CopyFrom(m_car_info);
 
-    code = Parkspace_communicator::get_instance_pointer()->search_request(request,m_search_response_msg);
+    code = Parkspace_communicator::get_instance_pointer()->search_request(request,
+            m_search_response_msg,m_cancel_condition);
     m_step_statu=ePicking_step::eDispatch_step;
     return code;
 }
@@ -145,8 +168,14 @@ void PickupProcessTask::Main()
                 m_step_statu=ePicking_step::eComplete;
             }
         }
-        if(m_step_statu==eComplete)
+        if(m_step_statu==eComplete) {
+            //至少发送一次流程完成状态
+            if(updata_step_statu_msg()==SUCCESS)
+            {
+                System_communicator::get_instance_pointer()->post_process_statu(m_process_msg);
+            }
             break;
+        }
         if(m_step_statu==ePicking_step::eBackWait_step)
         {
             code=back_wait_for_leave_step();
@@ -205,7 +234,7 @@ void PickupProcessTask::Main()
     {
         //正常结束
         usleep(1000*1000);
-        LOG(WARNING)<<"车结束,"<<"车牌号:"<<m_car_info.license()
+        LOG(WARNING)<<"车结束,"<<"车牌号:"<<m_car_info.license()
                  <<",--------------  终端:"<<m_terminor_id<<"  --------------";
     }
 
@@ -246,7 +275,7 @@ Error_manager PickupProcessTask::dispatch_step()
 
 
     message::Dispatch_response_msg response;
-    code=Dispatch_communicator::get_instance_pointer()->dispatch_request(request,response);
+    code=Dispatch_communicator::get_instance_pointer()->dispatch_request(request,response,m_cancel_condition);
     if(code!=SUCCESS)
         return code;
 
@@ -263,7 +292,7 @@ Error_manager PickupProcessTask::dispatch_step()
 Error_manager PickupProcessTask::back_dispatch_step()
 {
     /*
-     * 关门,调度将车从出口抓回去
+     * 关门,搬运将车从出口抓回去
      */
     return SUCCESS;
 }
@@ -317,7 +346,7 @@ Error_manager PickupProcessTask::release_space_step()
 
 
     message::Parkspace_release_response_msg release_response;
-    code=Parkspace_communicator::get_instance_pointer()->release_request(request,release_response);
+    code=Parkspace_communicator::get_instance_pointer()->release_request(request,release_response,m_cancel_condition);
     if(code!=SUCCESS)
         return code;
 
@@ -348,10 +377,9 @@ void PickupProcessTask::publish_step_status()
          */
         if(System_communicator::get_instance_pointer())
         {
-            message::Picking_process_statu_msg msg;
-            if(create_step_statu_msg(msg)==SUCCESS)
+            if(updata_step_statu_msg()==SUCCESS)
             {
-                System_communicator::get_instance_pointer()->post_entrance_statu(msg);
+                System_communicator::get_instance_pointer()->post_process_statu(m_process_msg);
             }
 
         }
@@ -362,16 +390,8 @@ void PickupProcessTask::publish_step_status()
 /*
      * 根据当前流程状态,生成状态消息
      */
-Error_manager PickupProcessTask::create_step_statu_msg(message::Picking_process_statu_msg& msg)
+Error_manager PickupProcessTask::updata_step_statu_msg()
 {
-    message::Base_info base_info;
-    base_info.set_msg_type(message::ePicking_process_statu_msg);
-    base_info.set_sender(message::eMain);
-    base_info.set_receiver(message::eEmpty);
-    msg.mutable_base_info()->CopyFrom(base_info);
-    msg.set_terminal_id(m_terminor_id);
-    msg.set_license(m_car_info.license());
-
     message::Search_space_step_statu            search_step_statu;
     message::Dispatch_pick_step_statu           dispatch_step_statu;
     message::Waitfor_leave_step_statu           wait_step_statu;
@@ -437,10 +457,10 @@ Error_manager PickupProcessTask::create_step_statu_msg(message::Picking_process_
         default:
             break;
     }
-    msg.mutable_search_space_step()->CopyFrom(search_step_statu);
-    msg.mutable_dispatch_step()->CopyFrom(dispatch_step_statu);
-    msg.mutable_waitfor_leave()->CopyFrom(wait_step_statu);
-    msg.mutable_release_space_step()->CopyFrom(release_step_statu);
+    m_process_msg.mutable_search_space_step()->CopyFrom(search_step_statu);
+    m_process_msg.mutable_dispatch_step()->CopyFrom(dispatch_step_statu);
+    m_process_msg.mutable_waitfor_leave_step()->CopyFrom(wait_step_statu);
+    m_process_msg.mutable_release_space_step()->CopyFrom(release_step_statu);
 
     return SUCCESS;
 }

+ 8 - 3
system/PickupProcessTask.h

@@ -27,12 +27,14 @@ class PickupProcessTask :public tq::BaseTask{
 public:
     PickupProcessTask(unsigned int terminal_id);
     virtual  ~PickupProcessTask();
+    unsigned int terminal_id(){return m_terminor_id;}
     Error_manager init_task(message::Car_info car_info);
 
+    virtual tq::TaskCategory GetCategory() const{ return message::ePicking;}
     /*
-     * 检查当前任务是否处于空闲准备状态
+     * 取消任务
      */
-    bool is_ready();
+    virtual void Cancel();
 
     /*
      * 查询车位
@@ -81,9 +83,10 @@ protected:
     /*
      * 根据当前流程状态,生成状态消息
      */
-    Error_manager create_step_statu_msg(message::Picking_process_statu_msg& msg);
+    Error_manager updata_step_statu_msg();
 
     void reset_recv_msg();
+
 protected:
     unsigned int                m_terminor_id;
     message::Car_info           m_car_info;          //当前流程的车辆信息
@@ -99,7 +102,9 @@ private:
     message::Dispatch_response_msg                          m_dispatch_response_msg;
 
     ePicking_step                                           m_step_statu;
+    Thread_condition                                        m_cancel_condition;
 
+    message::Picking_process_statu_msg                      m_process_msg;
 
 };
 

+ 150 - 88
system/StoreProcessTask.cpp

@@ -9,6 +9,7 @@
 #include "process_message.pb.h"
 #include "command_manager.h"
 #include "system_communicator.h"
+#include "exception_solver.h"
 #include "uniq_key.h"
 
 StoreProcessTask::StoreProcessTask(unsigned int terminor_id)
@@ -19,6 +20,7 @@ StoreProcessTask::StoreProcessTask(unsigned int terminor_id)
 
 StoreProcessTask::~StoreProcessTask()
 {
+    Exception_solver::get_instance_pointer()->delete_task_cancel_condition(m_car_info.license());
     //退出线程
     m_publish_exit_condition.set_pass_ever(true);
     if(m_publish_statu_thread!= nullptr)
@@ -39,6 +41,21 @@ Error_manager StoreProcessTask::init_task(message::Locate_information locate_inf
     m_car_info=car_info;
     m_locate_info=locate_info;
 
+    //添加当前流程的任务取消标志位到异常处理模块
+    m_cancel_condition.reset(false, false, false);
+    Error_manager code=Exception_solver::get_instance_pointer()->add_task_cancel_condition(car_info.license(),this);
+    if(code!=SUCCESS)
+        return code;
+
+    //初始化进度状态消息基本信息
+    message::Base_info base_info;
+    base_info.set_msg_type(message::eStoring_process_statu_msg);
+    base_info.set_sender(message::eMain);
+    base_info.set_receiver(message::eEmpty);
+    m_process_msg.mutable_base_info()->CopyFrom(base_info);
+    m_process_msg.set_terminal_id(m_terminor_id);
+    m_process_msg.set_license(m_car_info.license());
+
     m_step_statu=eAlloc_step;
     ///创建状态发布线程
     if(m_publish_statu_thread== nullptr)
@@ -47,11 +64,19 @@ Error_manager StoreProcessTask::init_task(message::Locate_information locate_inf
         m_publish_statu_thread=new std::thread(publish_thread_func,this);
     }
 
-
     return SUCCESS;
 
 }
 
+/*
+     * 取消任务
+     */
+void StoreProcessTask::Cancel()
+{
+    m_cancel_condition.set_pass_ever(true);
+    tq::BaseTask::Cancel();
+}
+
 Error_manager StoreProcessTask::locate_step() {
     Error_manager code;
     //检查测量模块状态
@@ -69,7 +94,8 @@ Error_manager StoreProcessTask::locate_step() {
     m_measure_request_msg.set_command_key(create_key());
     m_measure_request_msg.set_terminal_id(m_terminor_id);
 
-    code=Locate_communicator::get_instance_pointer()->locate_request(m_measure_request_msg,m_measure_response_msg);
+    code=Locate_communicator::get_instance_pointer()->locate_request(m_measure_request_msg,
+            m_measure_response_msg,m_cancel_condition);
     if(code!=SUCCESS)
         return code;
 
@@ -128,7 +154,8 @@ Error_manager StoreProcessTask::dispatch_step()
     m_dispatch_request_msg.set_dispatch_motion_direction(message::E_STORE_CAR);
     m_dispatch_request_msg.set_parkspace_id(m_parcspace_alloc_response_msg.allocated_space_info().parkspace_id());
 
-    code=Dispatch_communicator::get_instance_pointer()->dispatch_request(m_dispatch_request_msg,m_dispatch_response_msg);
+    code=Dispatch_communicator::get_instance_pointer()->dispatch_request(m_dispatch_request_msg,
+            m_dispatch_response_msg,m_cancel_condition);
     if(code!=SUCCESS)
         return code;
 
@@ -185,7 +212,8 @@ Error_manager StoreProcessTask::alloc_space()
     m_alloc_request_msg.set_command_key(create_key());
     m_alloc_request_msg.set_terminal_id(m_terminor_id);
 
-    code=Parkspace_communicator::get_instance_pointer()->alloc_request(m_alloc_request_msg,m_parcspace_alloc_response_msg);
+    code=Parkspace_communicator::get_instance_pointer()->alloc_request(m_alloc_request_msg,
+            m_parcspace_alloc_response_msg,m_cancel_condition);
 
     if(code!=SUCCESS)
     {
@@ -234,7 +262,7 @@ Error_manager StoreProcessTask::confirm_space_step()
     request.set_command_key(create_key());
 
     message::Parkspace_confirm_alloc_response_msg confirm_response;
-    code=Parkspace_communicator::get_instance_pointer()->confirm_request(request,confirm_response);
+    code=Parkspace_communicator::get_instance_pointer()->confirm_request(request,confirm_response,m_cancel_condition);
     if(code!=SUCCESS)
         return code;
 
@@ -290,7 +318,7 @@ Error_manager StoreProcessTask::back_alloc_space_step()
     request.set_command_key(create_key());
 
     message::Parkspace_release_response_msg release_response;
-    code=Parkspace_communicator::get_instance_pointer()->release_request(request,release_response);
+    code=Parkspace_communicator::get_instance_pointer()->release_request(request,release_response,m_cancel_condition);
     if(code!=SUCCESS)
         return code;
 
@@ -316,8 +344,7 @@ void StoreProcessTask::Main()
      */
     Error_manager code;
     //开始执行停车指令
-    //第一步测量
-    while(1)
+    while(m_cancel_condition.wait_for_millisecond(1)==false)
     {
         //第一步,测量
         if (m_step_statu == eStoring_step::eMeasure_step)
@@ -334,7 +361,7 @@ void StoreProcessTask::Main()
         {
             //开始调度
             code = dispatch_step();
-            usleep(1000 * 1000 * (rand() % 3));
+            usleep(1000 * 1000 * (rand() % 13));
 
             LOG_IF(ERROR, code != SUCCESS) << "调度失败:" << code.get_error_description();
             m_step_statu = (code != SUCCESS) ? eStoring_step::eBackDispatch_step : eStoring_step::eConfirm_step;
@@ -343,6 +370,7 @@ void StoreProcessTask::Main()
         if (m_step_statu == eStoring_step::eConfirm_step)
         {
             code = confirm_space_step();
+            usleep(1000 * 1000);
             LOG_IF(ERROR, code != SUCCESS) << "终端号:" << m_terminor_id << "停车流程:" << code.get_error_description() <<
                                            " 车位id :"
                                            << m_parcspace_alloc_response_msg.allocated_space_info().parkspace_id()
@@ -360,6 +388,11 @@ void StoreProcessTask::Main()
         //第四步,完成,退出循环
         if (m_step_statu == eStoring_step::eComplete)
         {
+            //流程结束前,保证至少发送一次流程完成状态
+            if(updata_step_statu_msg()==SUCCESS)
+            {
+                System_communicator::get_instance_pointer()->post_process_statu(m_process_msg);
+            }
             break;
         }
         //回退confirm  ------------------------------------华丽的分割线------------------------------------------
@@ -410,8 +443,14 @@ void StoreProcessTask::Main()
     }
 
     /*
-     * 跳出循环后,判断状态,是否正常结束, 循环跳出状态只有可能是 eBackComplete(异常结束),eComplete(正常结束)
+     * 跳出循环后,判断状态,是否正常结束, 循环跳出状态只有可能是 eBackComplete(异常结束),eComplete(正常结束),任务取消状态
      */
+    if(m_cancel_condition.wait_for_millisecond(1)==true) {
+        LOG(ERROR) << "停车任务被强制取消,车牌号:" << m_car_info.license()
+                   << ",  终端号:" << m_terminor_id;
+        return ;
+    }
+
     if(m_step_statu==eStoring_step::eBackComplete)
     {
         //异常结束
@@ -422,11 +461,10 @@ void StoreProcessTask::Main()
     if(m_step_statu==eStoring_step::eComplete)
     {
         //正常结束
-        usleep(1000*2000);
+        usleep(1000*1000);
         LOG(INFO)<<"停车结束,"<<"车牌号:"<<m_car_info.license()
             <<",--------------  终端:"<<m_terminor_id<<"  --------------";
     }
-
 }
 
 /*
@@ -449,114 +487,138 @@ void StoreProcessTask::publish_step_status()
          */
         if(System_communicator::get_instance_pointer())
         {
-            message::Storing_process_statu_msg msg;
-            if(create_step_statu_msg(msg)==SUCCESS)
+            if(updata_step_statu_msg()==SUCCESS)
             {
-                System_communicator::get_instance_pointer()->post_entrance_statu(msg);
+                System_communicator::get_instance_pointer()->post_process_statu(m_process_msg);
             }
-
         }
-
     }
 }
 
 /*
      * 根据当前流程状态,生成状态消息
      */
-Error_manager StoreProcessTask::create_step_statu_msg(message::Storing_process_statu_msg& msg)
+Error_manager StoreProcessTask::updata_step_statu_msg()
 {
-    message::Base_info base_info;
-    base_info.set_msg_type(message::eStoring_process_statu_msg);
-    base_info.set_sender(message::eMain);
-    base_info.set_receiver(message::eEmpty);
-    msg.mutable_base_info()->CopyFrom(base_info);
-    msg.set_terminal_id(m_terminor_id);
-    msg.set_license(m_car_info.license());
-
-    message::Alloc_space_step_statu             alloc_step_statu;
-    message::Measure_step_statu                 measure_step_statu;
-    message::Dispatch_store_step_statu          dispatch_step_statu;
-    message::Confirm_space_step_statu           confirm_step_statu;
-    message::Release_space_step_statu           release_step_statu;
-    alloc_step_statu.set_step_statu(message::eWaiting);
-    measure_step_statu.set_step_statu(message::eWaiting);
-    dispatch_step_statu.set_step_statu(message::eWaiting);
-    confirm_step_statu.set_step_statu(message::eWaiting);
-    release_step_statu.set_step_statu(message::eWaiting);
-
     switch (m_step_statu) {
-        case eAlloc_step: {
-            alloc_step_statu.set_step_statu(message::eWorking);
-            if(m_step_statu==eAlloc_step)
-                break;
+        case eStoring_step::eAlloc_step: {
+                message::Alloc_space_step_statu alloc_step_statu;
+                alloc_step_statu.set_step_statu(message::eWorking);
+                m_process_msg.mutable_alloc_space_step()->CopyFrom(alloc_step_statu);
+            break;
         }
-        case eMeasure_step: {
-            alloc_step_statu.mutable_car_info()->CopyFrom(m_car_info);
-            alloc_step_statu.set_step_statu(message::eComplete);
-            measure_step_statu.set_step_statu(message::eWorking);
-            measure_step_statu.mutable_locate_info()->CopyFrom(m_locate_info);
-            if(m_step_statu==eMeasure_step)
-                break;
+        case eStoring_step::eMeasure_step: {
+
+                message::Measure_step_statu measure_step_statu;
+                measure_step_statu.set_step_statu(message::eWorking);
+                measure_step_statu.mutable_locate_info()->CopyFrom(m_locate_info);
+                m_process_msg.mutable_measure_step()->CopyFrom(measure_step_statu);
+            if(m_process_msg.has_alloc_space_step())
+            {
+                m_process_msg.mutable_alloc_space_step()->set_step_statu(message::eComplete);
+            }
+           break;
+        }
+        case eStoring_step::eCompare_step:{
+            message::Compare_step_statu     compare_step;
+            compare_step.mutable_locate_info_wj()->CopyFrom(m_locate_info);
+            compare_step.mutable_locate_info_dj()->CopyFrom(m_measure_response_msg.locate_information());
+            compare_step.mutable_locate_info_result()->CopyFrom(m_compare_location_data);
+            compare_step.set_step_statu(message::eWorking);
+            m_process_msg.mutable_compare_step()->CopyFrom(compare_step);
+            if(m_process_msg.has_measure_step())
+                m_process_msg.mutable_measure_step()->set_step_statu(message::eComplete);
+            break;
         }
-        case eDispatch_step: {
-            measure_step_statu.set_step_statu(message::eComplete);
+        case eStoring_step::eDispatch_step: {
+            message::Dispatch_store_step_statu          dispatch_step_statu;
             dispatch_step_statu.set_step_statu(message::eWorking);
             dispatch_step_statu.mutable_locate_info()->CopyFrom(m_locate_info);
             dispatch_step_statu.mutable_space_info()->CopyFrom(m_parcspace_alloc_response_msg.allocated_space_info());
-            if(m_step_statu==eDispatch_step)
-                break;
+            m_process_msg.mutable_dispatch_step()->CopyFrom(dispatch_step_statu);
+            if(m_process_msg.has_compare_step())
+                m_process_msg.mutable_compare_step()->set_step_statu(message::eComplete);
+            break;
         }
-        case eConfirm_step: {
-            dispatch_step_statu.set_step_statu(message::eComplete);
+        case eStoring_step::eConfirm_step: {
+            message::Confirm_space_step_statu           confirm_step_statu;
             confirm_step_statu.set_step_statu(message::eWorking);
-            confirm_step_statu.mutable_space_info()->CopyFrom(
-                    m_parcspace_alloc_response_msg.allocated_space_info());
-            if(m_step_statu==eConfirm_step)
-                break;
+            confirm_step_statu.mutable_space_info()->CopyFrom(m_parcspace_alloc_response_msg.allocated_space_info());
+            m_process_msg.mutable_confirm_space_step()->CopyFrom(confirm_step_statu);
+            if(m_process_msg.has_dispatch_step())
+                m_process_msg.mutable_dispatch_step()->set_step_statu(message::eComplete);
+            break;
         }
-        case eComplete: {
-            confirm_step_statu.set_step_statu(message::eComplete);
-            if(m_step_statu==eComplete)
-                break;
+        case eStoring_step::eComplete: {
+            m_process_msg.set_completed(true);
+            break;
         }
-        case eBackConfirm_step: {
-            confirm_step_statu.set_step_statu(message::eError);
-            if(m_step_statu==eBackConfirm_step)
-                break;
+        case eStoring_step::eBackConfirm_step: {
+                message::Back_confirm_space_step_statu back_confirm_step_statu;
+                back_confirm_step_statu.set_step_statu(message::eWaiting);
+                if (m_process_msg.has_confirm_space_step())
+                    m_process_msg.mutable_confirm_space_step()->set_step_statu(message::eError);
+
+            break;
         }
-        case eBackDispatch_step: {
-            dispatch_step_statu.set_step_statu(message::eError);
-            if(m_step_statu==eBackDispatch_step)
-                break;
+        case eStoring_step::eBackDispatch_step: {
+            message::Back_dispatch_store_step_statu   back_dispatch_step_statu;
+            back_dispatch_step_statu.set_step_statu(message::eWorking);
+            back_dispatch_step_statu.mutable_space_info()->CopyFrom(m_parcspace_alloc_response_msg.allocated_space_info());
+            back_dispatch_step_statu.mutable_locate_info()->CopyFrom(m_compare_location_data);
+            m_process_msg.mutable_back_dispatch_step()->CopyFrom(back_dispatch_step_statu);
+            if(m_process_msg.has_back_confirm_step())
+                m_process_msg.mutable_back_confirm_step()->set_step_statu(message::eComplete);
+            else
+                m_process_msg.mutable_dispatch_step()->set_step_statu(message::eError);
+            break;
         }
-        case eBackMeasure_step: {
-            measure_step_statu.set_step_statu(message::eError);
-            if(m_step_statu==eBackMeasure_step)
-                break;
+        case eStoring_step::eBack_compare_step:{
+            message::Back_compare_step_statu    back_compare_step_statu;
+            back_compare_step_statu.set_step_statu(message::eWorking);
+            back_compare_step_statu.mutable_locate_info_wj()->CopyFrom(m_locate_info);
+            back_compare_step_statu.mutable_locate_info_dj()->CopyFrom(m_measure_response_msg.locate_information());
+            back_compare_step_statu.mutable_locate_info_result()->CopyFrom(m_compare_location_data);
+            m_process_msg.mutable_compare_step()->CopyFrom(back_compare_step_statu);
+            if(m_process_msg.has_back_dispatch_step())
+                m_process_msg.mutable_back_dispatch_step()->set_step_statu(message::eComplete);
+            else
+                m_process_msg.mutable_compare_step()->set_step_statu(message::eError);
+            break;
         }
-        case eBackAlloc_step: {
-            alloc_step_statu.set_step_statu(message::eError);
-            release_step_statu.set_step_statu(message::eWorking);
-            if(m_step_statu==eBackAlloc_step)
-                break;
+        case eStoring_step::eBackMeasure_step: {
+            message::Back_measure_step_statu        back_measure_step_statu;
+            back_measure_step_statu.set_step_statu(message::eWorking);
+            m_process_msg.mutable_back_measure_step()->CopyFrom(back_measure_step_statu);
+            if(m_process_msg.has_back_compare_step())
+                m_process_msg.mutable_back_compare_step()->set_step_statu(message::eComplete);
+            else
+                m_process_msg.mutable_measure_step()->set_step_statu(message::eError);
+            break;
         }
-        case eBackComplete: {
-            release_step_statu.set_step_statu(message::eComplete);
-            if(m_step_statu==eBackComplete)
-                break;
+        case eStoring_step::eBackAlloc_step: {
+            message::Back_alloc_space_step_statu    back_alloc_step_statu;
+            back_alloc_step_statu.set_step_statu(message::eWorking);
+            back_alloc_step_statu.mutable_space_info()->CopyFrom(m_parcspace_alloc_response_msg.allocated_space_info());
+            m_process_msg.mutable_back_alloc_space_step()->CopyFrom(back_alloc_step_statu);
+            if(m_process_msg.has_back_measure_step())
+                m_process_msg.mutable_back_measure_step()->set_step_statu(message::eComplete);
+            else
+                m_process_msg.mutable_alloc_space_step()->set_step_statu(message::eError);
+            break;
+        }
+        case eStoring_step::eBackComplete: {
+            m_process_msg.set_back_completed(true);
+            break;
         }
         default:
             break;
     }
-    msg.mutable_alloc_space_step()->CopyFrom(alloc_step_statu);
-    msg.mutable_measure_step()->CopyFrom(measure_step_statu);
-    msg.mutable_dispatch_step()->CopyFrom(dispatch_step_statu);
-    msg.mutable_confirm_space_step()->CopyFrom(confirm_step_statu);
-    msg.mutable_failed_release_space_step()->CopyFrom(release_step_statu);
 
     return SUCCESS;
 }
 
+
 /*
      * 初始化 接收到的消息
      */

+ 18 - 4
system/StoreProcessTask.h

@@ -16,12 +16,14 @@ class StoreProcessTask :public tq::BaseTask{
     {
         eAlloc_step=0,
         eMeasure_step,
+        eCompare_step,
         eDispatch_step,
         eConfirm_step,
         eComplete,
 
         eBackConfirm_step,
         eBackDispatch_step,
+        eBack_compare_step,
         eBackMeasure_step,
         eBackAlloc_step,
         eBackComplete
@@ -29,6 +31,7 @@ class StoreProcessTask :public tq::BaseTask{
 public:
     StoreProcessTask(unsigned int command_id);
     virtual  ~StoreProcessTask();
+    unsigned int terminal_id(){return m_terminor_id;}
     Error_manager init_task(message::Locate_information locate_info,message::Car_info car_info);
 
     /*
@@ -41,6 +44,15 @@ public:
      */
     Error_manager back_alloc_space_step();
 
+    /*
+     * 取消任务
+     */
+    virtual void Cancel();
+    /*
+     * 获取任务类型
+     */
+    virtual tq::TaskCategory GetCategory() const{ return message::eStoring;}
+
 protected:
     virtual void Main();
 
@@ -63,7 +75,6 @@ protected:
      */
     Error_manager back_dispatch_step();
 
-
     /*
      * 车位占用确认
      */
@@ -74,7 +85,6 @@ protected:
      */
     void reset_msg();
 
-
     /*
      * 发布进度
      */
@@ -83,7 +93,7 @@ protected:
     /*
      * 根据当前流程状态,生成状态消息
      */
-    Error_manager create_step_statu_msg(message::Storing_process_statu_msg& msg);
+    Error_manager updata_step_statu_msg();
 
 protected:
     unsigned int                m_terminor_id;
@@ -93,6 +103,7 @@ protected:
     //保存请求
     message::Parkspace_allocation_request_msg       m_alloc_request_msg;
     message::Measure_request_msg                    m_measure_request_msg;
+    message::Locate_information                     m_compare_location_data;
     message::Dispatch_request_msg                   m_dispatch_request_msg;
     message::Parkspace_confirm_alloc_request_msg    m_confirm_request_msg;
 
@@ -106,7 +117,10 @@ private:
     std::thread*                    m_publish_statu_thread;             //广播状态线程
     Thread_condition				m_publish_exit_condition;			//发送的条件变量
 
-    eStoring_step                   m_step_statu;
+    eStoring_step                            m_step_statu;
+    message::Storing_process_statu_msg      m_process_msg;
+
+    Thread_condition                m_cancel_condition;                 //取消任务标志位
 
 };
 

+ 150 - 25
system/command_manager.cpp

@@ -12,6 +12,7 @@
 
 Command_manager::Command_manager()
     :m_thread_queue_process(nullptr)
+    ,m_system_paused(false)
 {
 
 }
@@ -37,6 +38,13 @@ Error_manager Command_manager::init(setting::System_setting system_setting) {
     if (system_setting.entrance_num() < 0 || system_setting.export_num() < 0) {
         return Error_manager(ERROR, MAJOR_ERROR, "系统配置出入口数量错误");
     }
+    //初始化出入口状态为 Enable
+    m_input_entrance_statu.resize(system_setting.entrance_num());
+    for(int i=0;i<system_setting.entrance_num();++i)
+        m_input_entrance_statu[i]=Enable;
+    m_output_entrance_statu.resize(system_setting.export_num());
+    for(int i=0;i<system_setting.export_num();++i)
+        m_output_entrance_statu[i]=Enable;
 
     //创建线程池
     if (m_thread_queue_process == nullptr) {
@@ -124,6 +132,7 @@ Error_manager Command_manager::init(setting::System_setting system_setting) {
             return Error_manager(ERROR,MAJOR_ERROR,"取车出口通讯节点初始化超时");
         }
     }
+    m_system_setting=system_setting;
 
     return SUCCESS;
 
@@ -134,9 +143,45 @@ Error_manager Command_manager::init(setting::System_setting system_setting) {
 
 Error_manager Command_manager::execute_store_command(message::Store_command_request_msg& request,message::Store_command_response_msg& response)
 {
+    message::Base_info base_info;
+    base_info.set_msg_type(message::eStore_command_response_msg);
+    base_info.set_sender(message::eMain);
+    base_info.set_receiver(message::eTerminor);
+    response.mutable_base_info()->CopyFrom(base_info);
+
+    message::Error_manager error_msg;
+    error_msg.set_error_code(0);
+
     if (m_thread_queue_process == nullptr) {
+        error_msg.set_error_code(ERROR);
+        error_msg.set_error_description("bug,线程池未初始化");
+        response.mutable_code()->CopyFrom(error_msg);
         return Error_manager(ERROR, CRITICAL_ERROR, "线程池未初始化,bug");
     }
+
+    if(m_system_paused==true)
+    {
+        error_msg.set_error_code(PAUSE);
+        error_msg.set_error_description("急停");
+        response.mutable_code()->CopyFrom(error_msg);
+        return Error_manager(PAUSE, CRITICAL_ERROR, "急停");
+    }
+
+    //判断入口是否开放
+    if(request.terminal_id()<0 || request.terminal_id()>=m_system_setting.entrance_num())
+    {
+        error_msg.set_error_code(ERROR);
+        error_msg.set_error_description("terminal_id 参数设置错误");
+        response.mutable_code()->CopyFrom(error_msg);
+        return Error_manager(ERROR, CRITICAL_ERROR, "terminal id 设置错误");
+    }
+    if(m_input_entrance_statu[request.terminal_id()]!=Enable) {
+        error_msg.set_error_code(ERROR);
+        error_msg.set_error_description("入口已关闭 Disable");
+        response.mutable_code()->CopyFrom(error_msg);
+        return Error_manager(ERROR, CRITICAL_ERROR, "中控入口已停止使用");
+    }
+
     if (request.base_info().msg_type() == message::eStore_command_request_msg
         && request.base_info().receiver() == message::eMain
         && request.base_info().sender() == message::eTerminor)
@@ -155,15 +200,8 @@ Error_manager Command_manager::execute_store_command(message::Store_command_requ
                         /*
                          * 检查消息完毕,开始处理
                          */
-                        message::Base_info base_info;
-                        base_info.set_msg_type(message::eStore_command_response_msg);
-                        base_info.set_sender(message::eMain);
-                        base_info.set_receiver(message::eTerminor);
-                        response.mutable_base_info()->CopyFrom(base_info);
-                        response.set_terminal_id(request.terminal_id());
 
-                        message::Error_manager error_msg;
-                        error_msg.set_error_code(0);
+                        response.set_terminal_id(request.terminal_id());
 
                         /*
                         * 检查各个节点是否正常
@@ -193,8 +231,6 @@ Error_manager Command_manager::execute_store_command(message::Store_command_requ
                             return dispatch_code;
                         }
 
-
-
                         LOG(INFO) << "收到停车,车牌:"<< request.car_info().license() <<
                                   ",终端:" << request.terminal_id()<<"............................";
                         tq::BaseTask *ptask = new StoreProcessTask(request.terminal_id());
@@ -224,8 +260,7 @@ Error_manager Command_manager::execute_store_command(message::Store_command_requ
             }
 
         }
-
-        return Error_manager(FAILED, MINOR_ERROR, "创建停车流程失败......");
+        return Error_manager(FAILED, MINOR_ERROR, "创建停车流程失败...指令缺少必要信息...");
     } else {
         return Error_manager(INVALID_MESSAGE, MAJOR_ERROR, "停车请求基本信息错误");
     }
@@ -238,25 +273,54 @@ Error_manager Command_manager::execute_store_command(message::Store_command_requ
 Error_manager Command_manager::execute_pickup_command(message::Pickup_command_request_msg& request,message::Pickup_command_response_msg& response)
 {
 
-    if(m_thread_queue_process==nullptr)
+    message::Base_info base_info;
+    base_info.set_msg_type(message::ePickup_command_response_msg);
+    base_info.set_sender(message::eMain);
+    base_info.set_receiver(message::eTerminor);
+    response.mutable_base_info()->CopyFrom(base_info);
+
+    message::Error_manager error_msg;
+    error_msg.set_error_code(0);
+
+    if (m_thread_queue_process == nullptr) {
+        error_msg.set_error_code(ERROR);
+        error_msg.set_error_description("bug,线程池未初始化");
+        response.mutable_code()->CopyFrom(error_msg);
+        return Error_manager(ERROR, CRITICAL_ERROR, "线程池未初始化,bug");
+    }
+
+    if(m_system_paused==true)
     {
-        return Error_manager(ERROR,CRITICAL_ERROR,"线程池未初始化,bug");
+        error_msg.set_error_code(PAUSE);
+        error_msg.set_error_description("急停");
+        response.mutable_code()->CopyFrom(error_msg);
+        return Error_manager(PAUSE, CRITICAL_ERROR, "急停");
+    }
+
+
+    //判断出口是否开放
+    if(request.terminal_id()<0 || request.terminal_id()>=m_system_setting.export_num())
+    {
+        error_msg.set_error_code(ERROR);
+        error_msg.set_error_description("出口 id 设置错误");
+        response.mutable_code()->CopyFrom(error_msg);
+        return Error_manager(ERROR, CRITICAL_ERROR, "出口 id 设置错误");
+    }
+    if(m_output_entrance_statu[request.terminal_id()]!=Enable)
+    {
+        error_msg.set_error_code(ERROR);
+        error_msg.set_error_description("中控出口已停止使用");
+        response.mutable_code()->CopyFrom(error_msg);
+        return Error_manager(ERROR, CRITICAL_ERROR, "中控出口已停止使用");
     }
+
     if(request.base_info().msg_type()==message::ePickup_command_request_msg
        &&request.base_info().receiver()==message::eMain
        &&request.base_info().sender()==message::eTerminor
        &&request.has_car_info()) {
 
-        message::Base_info baseInfo;
-        baseInfo.set_msg_type(message::ePickup_command_response_msg);
-        baseInfo.set_sender(message::eMain);
-        baseInfo.set_receiver(message::eTerminor);
-        response.mutable_base_info()->CopyFrom(baseInfo);
         response.set_terminal_id(request.terminal_id());
 
-        message::Error_manager error_msg;
-        error_msg.set_error_code(0);
-
         /*
         * 检查各个节点是否正常
         */
@@ -280,9 +344,6 @@ Error_manager Command_manager::execute_pickup_command(message::Pickup_command_re
 
         //一切正常,接受指令
         Error_manager code;
-
-
-
         LOG(WARNING)<<"收到取车-----------------------------"<<request.car_info().license();
         tq::BaseTask* ptask=new PickupProcessTask(request.terminal_id());
         PickupProcessTask* pPick_task=(PickupProcessTask*)ptask;
@@ -311,3 +372,67 @@ Error_manager Command_manager::execute_pickup_command(message::Pickup_command_re
         return Error_manager(INVALID_MESSAGE,MAJOR_ERROR,"停车请求信息错误");
     }
 }
+
+/*
+    * 控制入口 开放或者关闭
+    */
+Error_manager Command_manager::enable_entrance(int terminal_id,bool enable)
+{
+    if(terminal_id<0 || terminal_id>m_system_setting.entrance_num())
+        return Error_manager(ERROR,MINOR_ERROR,"xxxx");
+    m_input_entrance_statu[terminal_id]=(enable?Enable:Disable);
+    return SUCCESS;
+}
+
+/*
+ * 控制出口 开放或者关闭
+ */
+Error_manager Command_manager::enable_export(int terminal_id,bool enable)
+{
+    if(terminal_id<0 || terminal_id>m_system_setting.export_num())
+        return Error_manager(ERROR,MINOR_ERROR,"xxxx");
+    m_output_entrance_statu[terminal_id]=(enable?Enable:Disable);
+}
+
+/*
+     * pause,系统急停
+     */
+void Command_manager::pause_system()
+{
+    m_system_paused=true;
+}
+
+void Command_manager::publish_statu_function(Command_manager* commander)
+{
+    if(commander== nullptr)
+        return ;
+    commander->publish_statu();
+}
+void Command_manager::publish_statu()
+{
+    while(m_publish_exit_condition.wait_for_millisecond(50)==false)
+    {
+        message::Central_controller_statu_msg msg;
+        message::Base_info baseInfo;
+        baseInfo.set_msg_type(message::eCentral_controller_statu_msg);
+        baseInfo.set_sender(message::eMain);
+        baseInfo.set_receiver(message::eEmpty);
+        msg.mutable_base_info()->CopyFrom(baseInfo);
+        msg.set_paused(m_system_paused);
+        for(int i=0;i<m_system_setting.entrance_num();++i)
+        {
+            message::Entrance_statu entrance_statu;
+            entrance_statu=(m_input_entrance_statu[i]==Enable)?message::eEnable:message::eDisable;
+            msg.add_entrance_statu_vector(entrance_statu);
+        }
+
+        for(int i=0;i<m_system_setting.export_num();++i)
+        {
+            message::Entrance_statu entrance_statu;
+            entrance_statu=(m_output_entrance_statu[i]==Enable)?message::eEnable:message::eDisable;
+            msg.add_export_statu_vector(entrance_statu);
+        }
+
+        System_communicator::get_instance_pointer()->post_central_statu(msg);
+    }
+}

+ 34 - 7
system/command_manager.h

@@ -15,12 +15,18 @@
 #include "singleton.h"
 #include "TaskQueue/TQFactory.h"
 #include "TaskQueue/BaseTask.h"
-#include "process_message.pb.h"
+#include "central_control_message.pb.h"
+
 #include "thread_safe_map.h"
 #include "system_setting.pb.h"
 
 class Command_manager :public Singleton<Command_manager>{
     friend Singleton<Command_manager>;
+    enum Entrance_statu
+    {
+        Enable=0,
+        Disable
+    };
 public:
     ~Command_manager();
 
@@ -39,18 +45,39 @@ public:
      */
     Error_manager execute_pickup_command(message::Pickup_command_request_msg& request,message::Pickup_command_response_msg& response);
 
+    /*
+     * 控制入口 开放或者关闭
+     */
+    Error_manager enable_entrance(int terminal_id,bool enable);
+
+    /*
+     * 控制出口 开放或者关闭
+     */
+    Error_manager enable_export(int terminal_id,bool enable);
+
+    /*
+     * pause,系统急停,急停状态下不允许自动流程的指令执行,允许管理员手动指令执行
+     */
+    void pause_system();
+
 private:
     Command_manager();
 
+    static void publish_statu_function(Command_manager* commander);
+    void publish_statu();
+
 protected:
+    tq::IQueue*                         m_thread_queue_process;         //指令流程线程池
 
-    /*
-     * 停取车终端 map,key值为终端编号,value为终端指令执行器task,可放入线程池执行流程
-     */
-    thread_safe_map<int,tq::BaseTask*>                              m_store_command_task_map;
-    thread_safe_map<int,tq::BaseTask*>                              m_pick_command_task_map;
+    bool                                m_system_paused;
+    std::vector<Entrance_statu>         m_input_entrance_statu;     //入口状态(关闭/开放)
+    std::vector<Entrance_statu>         m_output_entrance_statu;    //出口状态(关闭/开放)
+
+    setting::System_setting             m_system_setting;
+
+    std::thread*                        m_publish_statu_thread;             //广播状态线程
+    Thread_condition				    m_publish_exit_condition;			//发送的条件变量
 
-    tq::IQueue*                     m_thread_queue_process;         //指令流程线程池
 };
 
 

+ 9 - 2
system/system_communicator.cpp

@@ -22,20 +22,27 @@ Error_manager System_communicator::encapsulate_send_data()
 }
 
 //发送停车流程进度
-Error_manager System_communicator::post_entrance_statu(message::Storing_process_statu_msg& msg)
+Error_manager System_communicator::post_process_statu(message::Storing_process_statu_msg& msg)
 {
     Communication_message message;
     message.reset(msg.base_info(),msg.SerializeAsString());
     return encapsulate_msg(&message);
 }
 //发送取车流程进度
-Error_manager System_communicator::post_entrance_statu(message::Picking_process_statu_msg& msg)
+Error_manager System_communicator::post_process_statu(message::Picking_process_statu_msg& msg)
 {
     Communication_message message;
     message.reset(msg.base_info(),msg.SerializeAsString());
     return encapsulate_msg(&message);
 }
 
+//发送中控状态消息
+Error_manager System_communicator::post_central_statu(message::Central_controller_statu_msg& msg)
+{
+    Communication_message message;
+    message.reset(msg.base_info(),msg.SerializeAsString());
+    return encapsulate_msg(&message);
+}
 
 /*
  * 发送消息函数

+ 7 - 3
system/system_communicator.h

@@ -6,6 +6,7 @@
 #define NNXX_TESTS_SYSTEM_COMMUNICATION_H
 
 #include <process_message.pb.h>
+#include <central_control_message.pb.h>
 #include "../tool/singleton.h"
 #include "../communication/communication_socket_base.h"
 #include "terminal_message.pb.h"
@@ -25,11 +26,14 @@ public:
     System_communicator(const System_communicator& other) = delete;
     System_communicator& operator =(const System_communicator& other) = delete;
 
-    Error_manager post_entrance_statu(message::Storing_process_statu_msg& msg);
-    Error_manager post_entrance_statu(message::Picking_process_statu_msg& msg);
+    /*
+     * 发送中控状态消息, 出入口状态消息
+     */
+    Error_manager post_process_statu(message::Storing_process_statu_msg& msg);
+    Error_manager post_process_statu(message::Picking_process_statu_msg& msg);
+    Error_manager post_central_statu(message::Central_controller_statu_msg& msg);
     ~System_communicator();
 
-    Error_manager wait_for_measure_msg(std::string license);
 protected:
     //重载函数
     virtual Error_manager encapsulate_msg(Communication_message* message);

+ 1 - 1
tool/TaskQueue/BaseTask.h

@@ -19,7 +19,7 @@ namespace tq
     public:
         BaseTask();
         void Run();
-        void Cancel();
+        virtual void Cancel();
         bool IsCancelled() const;
         
         virtual void Main() = 0;