Ver código fonte

流程中增加WJ测量结果,增加雷达与plc状态消息发送到界面.

zx 5 anos atrás
pai
commit
ce90541537

+ 15 - 14
laser/Laser.cpp

@@ -1,4 +1,5 @@
 #include "Laser.h"
+#include "../tool/MeasureTopicPublisher.h"
 
 CBinaryData::CBinaryData()
 	:m_buf(0)
@@ -381,18 +382,18 @@ void Laser_base::threadPublish(Laser_base *laser)
 
 void Laser_base::PublishMsg()
 {
-    /*globalmsg::msg msg;
-    msg.set_msg_type(globalmsg::eLaser);
-
-    globalmsg::laserStatus status;
-    if(GetStatu()==eLaser_ready) status=globalmsg::eLaserConnected;
-    else if(GetStatu()==eLaser_disconnect) status=globalmsg::eLaserDisconnected;
-    else if(GetStatu()==eLaser_busy) status=globalmsg::eLaserBusy;
-    else  status=globalmsg::eLaserUnknown;
-
-    msg.mutable_laser_msg()->set_id(m_id);
-    msg.mutable_laser_msg()->set_laser_status(status);
-    msg.mutable_laser_msg()->set_queue_data_count(m_queue_laser_data.size());
-    msg.mutable_laser_msg()->set_cloud_count(m_points_count);
-    MeasureTopicPublisher::GetInstance()->Publish(msg.SerializeAsString());*/
+    laser_message::laserMsg msg;
+
+    laser_message::laserStatus status;
+    if(GetStatu()==eLaser_ready) status=laser_message::eLaserConnected;
+    else if(GetStatu()==eLaser_disconnect) status=laser_message::eLaserDisconnected;
+    else if(GetStatu()==eLaser_busy) status=laser_message::eLaserBusy;
+    else  status=laser_message::eLaserUnknown;
+
+    msg.set_id(m_id);
+    msg.set_laser_status(status);
+    msg.set_queue_data_count(m_queue_laser_data.size());
+    msg.set_cloud_count(m_points_count);
+    MeasureTopicPublisher::GetInstance()->Publish(msg.SerializeAsString());
+
 }

+ 1 - 0
laser/Laser.h

@@ -6,6 +6,7 @@
 #include <glog/logging.h>
 #include "../tool/StdCondition.h"
 #include "laser_parameter.pb.h"
+#include "laser_message.pb.h"
 #include "../error_code/error_code.h"
 #include "laser_task_command.h"
 

+ 518 - 0
laser/laser_message.pb.cc

@@ -0,0 +1,518 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: laser_message.proto
+
+#include "laser_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 laser_message {
+class laserMsgDefaultTypeInternal {
+ public:
+  ::google::protobuf::internal::ExplicitlyConstructed<laserMsg>
+      _instance;
+} _laserMsg_default_instance_;
+}  // namespace laser_message
+namespace protobuf_laser_5fmessage_2eproto {
+void InitDefaultslaserMsgImpl() {
+  GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
+  ::google::protobuf::internal::InitProtobufDefaultsForceUnique();
+#else
+  ::google::protobuf::internal::InitProtobufDefaults();
+#endif  // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
+  {
+    void* ptr = &::laser_message::_laserMsg_default_instance_;
+    new (ptr) ::laser_message::laserMsg();
+    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
+  }
+  ::laser_message::laserMsg::InitAsDefaultInstance();
+}
+
+void InitDefaultslaserMsg() {
+  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+  ::google::protobuf::GoogleOnceInit(&once, &InitDefaultslaserMsgImpl);
+}
+
+::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(::laser_message::laserMsg, _has_bits_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::laser_message::laserMsg, _internal_metadata_),
+  ~0u,  // no _extensions_
+  ~0u,  // no _oneof_case_
+  ~0u,  // no _weak_field_map_
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::laser_message::laserMsg, laser_status_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::laser_message::laserMsg, queue_data_count_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::laser_message::laserMsg, cloud_count_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::laser_message::laserMsg, id_),
+  0,
+  1,
+  2,
+  3,
+};
+static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+  { 0, 9, sizeof(::laser_message::laserMsg)},
+};
+
+static ::google::protobuf::Message const * const file_default_instances[] = {
+  reinterpret_cast<const ::google::protobuf::Message*>(&::laser_message::_laserMsg_default_instance_),
+};
+
+void protobuf_AssignDescriptors() {
+  AddDescriptors();
+  ::google::protobuf::MessageFactory* factory = NULL;
+  AssignDescriptors(
+      "laser_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\023laser_message.proto\022\rlaser_message\"w\n\010"
+      "laserMsg\0220\n\014laser_status\030\001 \001(\0162\032.laser_m"
+      "essage.laserStatus\022\030\n\020queue_data_count\030\002"
+      " \001(\005\022\023\n\013cloud_count\030\003 \001(\005\022\n\n\002id\030\004 \002(\005*]\n"
+      "\013laserStatus\022\023\n\017eLaserConnected\020\000\022\026\n\022eLa"
+      "serDisconnected\020\001\022\016\n\neLaserBusy\020\002\022\021\n\reLa"
+      "serUnknown\020\003"
+  };
+  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
+      descriptor, 252);
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
+    "laser_message.proto", &protobuf_RegisterTypes);
+}
+
+void AddDescriptors() {
+  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+  ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
+}
+// Force AddDescriptors() to be called at dynamic initialization time.
+struct StaticDescriptorInitializer {
+  StaticDescriptorInitializer() {
+    AddDescriptors();
+  }
+} static_descriptor_initializer;
+}  // namespace protobuf_laser_5fmessage_2eproto
+namespace laser_message {
+const ::google::protobuf::EnumDescriptor* laserStatus_descriptor() {
+  protobuf_laser_5fmessage_2eproto::protobuf_AssignDescriptorsOnce();
+  return protobuf_laser_5fmessage_2eproto::file_level_enum_descriptors[0];
+}
+bool laserStatus_IsValid(int value) {
+  switch (value) {
+    case 0:
+    case 1:
+    case 2:
+    case 3:
+      return true;
+    default:
+      return false;
+  }
+}
+
+
+// ===================================================================
+
+void laserMsg::InitAsDefaultInstance() {
+}
+#if !defined(_MSC_VER) || _MSC_VER >= 1900
+const int laserMsg::kLaserStatusFieldNumber;
+const int laserMsg::kQueueDataCountFieldNumber;
+const int laserMsg::kCloudCountFieldNumber;
+const int laserMsg::kIdFieldNumber;
+#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900
+
+laserMsg::laserMsg()
+  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
+  if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+    ::protobuf_laser_5fmessage_2eproto::InitDefaultslaserMsg();
+  }
+  SharedCtor();
+  // @@protoc_insertion_point(constructor:laser_message.laserMsg)
+}
+laserMsg::laserMsg(const laserMsg& from)
+  : ::google::protobuf::Message(),
+      _internal_metadata_(NULL),
+      _has_bits_(from._has_bits_),
+      _cached_size_(0) {
+  _internal_metadata_.MergeFrom(from._internal_metadata_);
+  ::memcpy(&laser_status_, &from.laser_status_,
+    static_cast<size_t>(reinterpret_cast<char*>(&id_) -
+    reinterpret_cast<char*>(&laser_status_)) + sizeof(id_));
+  // @@protoc_insertion_point(copy_constructor:laser_message.laserMsg)
+}
+
+void laserMsg::SharedCtor() {
+  _cached_size_ = 0;
+  ::memset(&laser_status_, 0, static_cast<size_t>(
+      reinterpret_cast<char*>(&id_) -
+      reinterpret_cast<char*>(&laser_status_)) + sizeof(id_));
+}
+
+laserMsg::~laserMsg() {
+  // @@protoc_insertion_point(destructor:laser_message.laserMsg)
+  SharedDtor();
+}
+
+void laserMsg::SharedDtor() {
+}
+
+void laserMsg::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* laserMsg::descriptor() {
+  ::protobuf_laser_5fmessage_2eproto::protobuf_AssignDescriptorsOnce();
+  return ::protobuf_laser_5fmessage_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+}
+
+const laserMsg& laserMsg::default_instance() {
+  ::protobuf_laser_5fmessage_2eproto::InitDefaultslaserMsg();
+  return *internal_default_instance();
+}
+
+laserMsg* laserMsg::New(::google::protobuf::Arena* arena) const {
+  laserMsg* n = new laserMsg;
+  if (arena != NULL) {
+    arena->Own(n);
+  }
+  return n;
+}
+
+void laserMsg::Clear() {
+// @@protoc_insertion_point(message_clear_start:laser_message.laserMsg)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  // Prevent compiler warnings about cached_has_bits being unused
+  (void) cached_has_bits;
+
+  cached_has_bits = _has_bits_[0];
+  if (cached_has_bits & 15u) {
+    ::memset(&laser_status_, 0, static_cast<size_t>(
+        reinterpret_cast<char*>(&id_) -
+        reinterpret_cast<char*>(&laser_status_)) + sizeof(id_));
+  }
+  _has_bits_.Clear();
+  _internal_metadata_.Clear();
+}
+
+bool laserMsg::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:laser_message.laserMsg)
+  for (;;) {
+    ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+    tag = p.first;
+    if (!p.second) goto handle_unusual;
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // optional .laser_message.laserStatus laser_status = 1;
+      case 1: {
+        if (static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) {
+          int value;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          if (::laser_message::laserStatus_IsValid(value)) {
+            set_laser_status(static_cast< ::laser_message::laserStatus >(value));
+          } else {
+            mutable_unknown_fields()->AddVarint(
+                1, static_cast< ::google::protobuf::uint64>(value));
+          }
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      // optional int32 queue_data_count = 2;
+      case 2: {
+        if (static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) {
+          set_has_queue_data_count();
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &queue_data_count_)));
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      // optional int32 cloud_count = 3;
+      case 3: {
+        if (static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(24u /* 24 & 0xFF */)) {
+          set_has_cloud_count();
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &cloud_count_)));
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      // required int32 id = 4;
+      case 4: {
+        if (static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(32u /* 32 & 0xFF */)) {
+          set_has_id();
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &id_)));
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      default: {
+      handle_unusual:
+        if (tag == 0) {
+          goto success;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, _internal_metadata_.mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+success:
+  // @@protoc_insertion_point(parse_success:laser_message.laserMsg)
+  return true;
+failure:
+  // @@protoc_insertion_point(parse_failure:laser_message.laserMsg)
+  return false;
+#undef DO_
+}
+
+void laserMsg::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // @@protoc_insertion_point(serialize_start:laser_message.laserMsg)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  cached_has_bits = _has_bits_[0];
+  // optional .laser_message.laserStatus laser_status = 1;
+  if (cached_has_bits & 0x00000001u) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      1, this->laser_status(), output);
+  }
+
+  // optional int32 queue_data_count = 2;
+  if (cached_has_bits & 0x00000002u) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->queue_data_count(), output);
+  }
+
+  // optional int32 cloud_count = 3;
+  if (cached_has_bits & 0x00000004u) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->cloud_count(), output);
+  }
+
+  // required int32 id = 4;
+  if (cached_has_bits & 0x00000008u) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(4, this->id(), output);
+  }
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        _internal_metadata_.unknown_fields(), output);
+  }
+  // @@protoc_insertion_point(serialize_end:laser_message.laserMsg)
+}
+
+::google::protobuf::uint8* laserMsg::InternalSerializeWithCachedSizesToArray(
+    bool deterministic, ::google::protobuf::uint8* target) const {
+  (void)deterministic; // Unused
+  // @@protoc_insertion_point(serialize_to_array_start:laser_message.laserMsg)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  cached_has_bits = _has_bits_[0];
+  // optional .laser_message.laserStatus laser_status = 1;
+  if (cached_has_bits & 0x00000001u) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+      1, this->laser_status(), target);
+  }
+
+  // optional int32 queue_data_count = 2;
+  if (cached_has_bits & 0x00000002u) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->queue_data_count(), target);
+  }
+
+  // optional int32 cloud_count = 3;
+  if (cached_has_bits & 0x00000004u) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(3, this->cloud_count(), target);
+  }
+
+  // required int32 id = 4;
+  if (cached_has_bits & 0x00000008u) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(4, this->id(), target);
+  }
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        _internal_metadata_.unknown_fields(), target);
+  }
+  // @@protoc_insertion_point(serialize_to_array_end:laser_message.laserMsg)
+  return target;
+}
+
+size_t laserMsg::ByteSizeLong() const {
+// @@protoc_insertion_point(message_byte_size_start:laser_message.laserMsg)
+  size_t total_size = 0;
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        _internal_metadata_.unknown_fields());
+  }
+  // required int32 id = 4;
+  if (has_id()) {
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::Int32Size(
+        this->id());
+  }
+  if (_has_bits_[0 / 32] & 7u) {
+    // optional .laser_message.laserStatus laser_status = 1;
+    if (has_laser_status()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::EnumSize(this->laser_status());
+    }
+
+    // optional int32 queue_data_count = 2;
+    if (has_queue_data_count()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+          this->queue_data_count());
+    }
+
+    // optional int32 cloud_count = 3;
+    if (has_cloud_count()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+          this->cloud_count());
+    }
+
+  }
+  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 laserMsg::MergeFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_merge_from_start:laser_message.laserMsg)
+  GOOGLE_DCHECK_NE(&from, this);
+  const laserMsg* source =
+      ::google::protobuf::internal::DynamicCastToGenerated<const laserMsg>(
+          &from);
+  if (source == NULL) {
+  // @@protoc_insertion_point(generalized_merge_from_cast_fail:laser_message.laserMsg)
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+  // @@protoc_insertion_point(generalized_merge_from_cast_success:laser_message.laserMsg)
+    MergeFrom(*source);
+  }
+}
+
+void laserMsg::MergeFrom(const laserMsg& from) {
+// @@protoc_insertion_point(class_specific_merge_from_start:laser_message.laserMsg)
+  GOOGLE_DCHECK_NE(&from, this);
+  _internal_metadata_.MergeFrom(from._internal_metadata_);
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  cached_has_bits = from._has_bits_[0];
+  if (cached_has_bits & 15u) {
+    if (cached_has_bits & 0x00000001u) {
+      laser_status_ = from.laser_status_;
+    }
+    if (cached_has_bits & 0x00000002u) {
+      queue_data_count_ = from.queue_data_count_;
+    }
+    if (cached_has_bits & 0x00000004u) {
+      cloud_count_ = from.cloud_count_;
+    }
+    if (cached_has_bits & 0x00000008u) {
+      id_ = from.id_;
+    }
+    _has_bits_[0] |= cached_has_bits;
+  }
+}
+
+void laserMsg::CopyFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_copy_from_start:laser_message.laserMsg)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void laserMsg::CopyFrom(const laserMsg& from) {
+// @@protoc_insertion_point(class_specific_copy_from_start:laser_message.laserMsg)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool laserMsg::IsInitialized() const {
+  if ((_has_bits_[0] & 0x00000008) != 0x00000008) return false;
+  return true;
+}
+
+void laserMsg::Swap(laserMsg* other) {
+  if (other == this) return;
+  InternalSwap(other);
+}
+void laserMsg::InternalSwap(laserMsg* other) {
+  using std::swap;
+  swap(laser_status_, other->laser_status_);
+  swap(queue_data_count_, other->queue_data_count_);
+  swap(cloud_count_, other->cloud_count_);
+  swap(id_, other->id_);
+  swap(_has_bits_[0], other->_has_bits_[0]);
+  _internal_metadata_.Swap(&other->_internal_metadata_);
+  swap(_cached_size_, other->_cached_size_);
+}
+
+::google::protobuf::Metadata laserMsg::GetMetadata() const {
+  protobuf_laser_5fmessage_2eproto::protobuf_AssignDescriptorsOnce();
+  return ::protobuf_laser_5fmessage_2eproto::file_level_metadata[kIndexInFileMessages];
+}
+
+
+// @@protoc_insertion_point(namespace_scope)
+}  // namespace laser_message
+
+// @@protoc_insertion_point(global_scope)

+ 350 - 0
laser/laser_message.pb.h

@@ -0,0 +1,350 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: laser_message.proto
+
+#ifndef PROTOBUF_laser_5fmessage_2eproto__INCLUDED
+#define PROTOBUF_laser_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>
+// @@protoc_insertion_point(includes)
+
+namespace protobuf_laser_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 InitDefaultslaserMsgImpl();
+void InitDefaultslaserMsg();
+inline void InitDefaults() {
+  InitDefaultslaserMsg();
+}
+}  // namespace protobuf_laser_5fmessage_2eproto
+namespace laser_message {
+class laserMsg;
+class laserMsgDefaultTypeInternal;
+extern laserMsgDefaultTypeInternal _laserMsg_default_instance_;
+}  // namespace laser_message
+namespace laser_message {
+
+enum laserStatus {
+  eLaserConnected = 0,
+  eLaserDisconnected = 1,
+  eLaserBusy = 2,
+  eLaserUnknown = 3
+};
+bool laserStatus_IsValid(int value);
+const laserStatus laserStatus_MIN = eLaserConnected;
+const laserStatus laserStatus_MAX = eLaserUnknown;
+const int laserStatus_ARRAYSIZE = laserStatus_MAX + 1;
+
+const ::google::protobuf::EnumDescriptor* laserStatus_descriptor();
+inline const ::std::string& laserStatus_Name(laserStatus value) {
+  return ::google::protobuf::internal::NameOfEnum(
+    laserStatus_descriptor(), value);
+}
+inline bool laserStatus_Parse(
+    const ::std::string& name, laserStatus* value) {
+  return ::google::protobuf::internal::ParseNamedEnum<laserStatus>(
+    laserStatus_descriptor(), name, value);
+}
+// ===================================================================
+
+class laserMsg : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:laser_message.laserMsg) */ {
+ public:
+  laserMsg();
+  virtual ~laserMsg();
+
+  laserMsg(const laserMsg& from);
+
+  inline laserMsg& operator=(const laserMsg& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  #if LANG_CXX11
+  laserMsg(laserMsg&& from) noexcept
+    : laserMsg() {
+    *this = ::std::move(from);
+  }
+
+  inline laserMsg& operator=(laserMsg&& 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 laserMsg& default_instance();
+
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
+  static inline const laserMsg* internal_default_instance() {
+    return reinterpret_cast<const laserMsg*>(
+               &_laserMsg_default_instance_);
+  }
+  static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+    0;
+
+  void Swap(laserMsg* other);
+  friend void swap(laserMsg& a, laserMsg& b) {
+    a.Swap(&b);
+  }
+
+  // implements Message ----------------------------------------------
+
+  inline laserMsg* New() const PROTOBUF_FINAL { return New(NULL); }
+
+  laserMsg* 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 laserMsg& from);
+  void MergeFrom(const laserMsg& 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(laserMsg* other);
+  private:
+  inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
+    return NULL;
+  }
+  inline void* MaybeArenaPtr() const {
+    return NULL;
+  }
+  public:
+
+  ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
+
+  // nested types ----------------------------------------------------
+
+  // accessors -------------------------------------------------------
+
+  // optional .laser_message.laserStatus laser_status = 1;
+  bool has_laser_status() const;
+  void clear_laser_status();
+  static const int kLaserStatusFieldNumber = 1;
+  ::laser_message::laserStatus laser_status() const;
+  void set_laser_status(::laser_message::laserStatus value);
+
+  // optional int32 queue_data_count = 2;
+  bool has_queue_data_count() const;
+  void clear_queue_data_count();
+  static const int kQueueDataCountFieldNumber = 2;
+  ::google::protobuf::int32 queue_data_count() const;
+  void set_queue_data_count(::google::protobuf::int32 value);
+
+  // optional int32 cloud_count = 3;
+  bool has_cloud_count() const;
+  void clear_cloud_count();
+  static const int kCloudCountFieldNumber = 3;
+  ::google::protobuf::int32 cloud_count() const;
+  void set_cloud_count(::google::protobuf::int32 value);
+
+  // required int32 id = 4;
+  bool has_id() const;
+  void clear_id();
+  static const int kIdFieldNumber = 4;
+  ::google::protobuf::int32 id() const;
+  void set_id(::google::protobuf::int32 value);
+
+  // @@protoc_insertion_point(class_scope:laser_message.laserMsg)
+ private:
+  void set_has_laser_status();
+  void clear_has_laser_status();
+  void set_has_queue_data_count();
+  void clear_has_queue_data_count();
+  void set_has_cloud_count();
+  void clear_has_cloud_count();
+  void set_has_id();
+  void clear_has_id();
+
+  ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
+  ::google::protobuf::internal::HasBits<1> _has_bits_;
+  mutable int _cached_size_;
+  int laser_status_;
+  ::google::protobuf::int32 queue_data_count_;
+  ::google::protobuf::int32 cloud_count_;
+  ::google::protobuf::int32 id_;
+  friend struct ::protobuf_laser_5fmessage_2eproto::TableStruct;
+  friend void ::protobuf_laser_5fmessage_2eproto::InitDefaultslaserMsgImpl();
+};
+// ===================================================================
+
+
+// ===================================================================
+
+#ifdef __GNUC__
+  #pragma GCC diagnostic push
+  #pragma GCC diagnostic ignored "-Wstrict-aliasing"
+#endif  // __GNUC__
+// laserMsg
+
+// optional .laser_message.laserStatus laser_status = 1;
+inline bool laserMsg::has_laser_status() const {
+  return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void laserMsg::set_has_laser_status() {
+  _has_bits_[0] |= 0x00000001u;
+}
+inline void laserMsg::clear_has_laser_status() {
+  _has_bits_[0] &= ~0x00000001u;
+}
+inline void laserMsg::clear_laser_status() {
+  laser_status_ = 0;
+  clear_has_laser_status();
+}
+inline ::laser_message::laserStatus laserMsg::laser_status() const {
+  // @@protoc_insertion_point(field_get:laser_message.laserMsg.laser_status)
+  return static_cast< ::laser_message::laserStatus >(laser_status_);
+}
+inline void laserMsg::set_laser_status(::laser_message::laserStatus value) {
+  assert(::laser_message::laserStatus_IsValid(value));
+  set_has_laser_status();
+  laser_status_ = value;
+  // @@protoc_insertion_point(field_set:laser_message.laserMsg.laser_status)
+}
+
+// optional int32 queue_data_count = 2;
+inline bool laserMsg::has_queue_data_count() const {
+  return (_has_bits_[0] & 0x00000002u) != 0;
+}
+inline void laserMsg::set_has_queue_data_count() {
+  _has_bits_[0] |= 0x00000002u;
+}
+inline void laserMsg::clear_has_queue_data_count() {
+  _has_bits_[0] &= ~0x00000002u;
+}
+inline void laserMsg::clear_queue_data_count() {
+  queue_data_count_ = 0;
+  clear_has_queue_data_count();
+}
+inline ::google::protobuf::int32 laserMsg::queue_data_count() const {
+  // @@protoc_insertion_point(field_get:laser_message.laserMsg.queue_data_count)
+  return queue_data_count_;
+}
+inline void laserMsg::set_queue_data_count(::google::protobuf::int32 value) {
+  set_has_queue_data_count();
+  queue_data_count_ = value;
+  // @@protoc_insertion_point(field_set:laser_message.laserMsg.queue_data_count)
+}
+
+// optional int32 cloud_count = 3;
+inline bool laserMsg::has_cloud_count() const {
+  return (_has_bits_[0] & 0x00000004u) != 0;
+}
+inline void laserMsg::set_has_cloud_count() {
+  _has_bits_[0] |= 0x00000004u;
+}
+inline void laserMsg::clear_has_cloud_count() {
+  _has_bits_[0] &= ~0x00000004u;
+}
+inline void laserMsg::clear_cloud_count() {
+  cloud_count_ = 0;
+  clear_has_cloud_count();
+}
+inline ::google::protobuf::int32 laserMsg::cloud_count() const {
+  // @@protoc_insertion_point(field_get:laser_message.laserMsg.cloud_count)
+  return cloud_count_;
+}
+inline void laserMsg::set_cloud_count(::google::protobuf::int32 value) {
+  set_has_cloud_count();
+  cloud_count_ = value;
+  // @@protoc_insertion_point(field_set:laser_message.laserMsg.cloud_count)
+}
+
+// required int32 id = 4;
+inline bool laserMsg::has_id() const {
+  return (_has_bits_[0] & 0x00000008u) != 0;
+}
+inline void laserMsg::set_has_id() {
+  _has_bits_[0] |= 0x00000008u;
+}
+inline void laserMsg::clear_has_id() {
+  _has_bits_[0] &= ~0x00000008u;
+}
+inline void laserMsg::clear_id() {
+  id_ = 0;
+  clear_has_id();
+}
+inline ::google::protobuf::int32 laserMsg::id() const {
+  // @@protoc_insertion_point(field_get:laser_message.laserMsg.id)
+  return id_;
+}
+inline void laserMsg::set_id(::google::protobuf::int32 value) {
+  set_has_id();
+  id_ = value;
+  // @@protoc_insertion_point(field_set:laser_message.laserMsg.id)
+}
+
+#ifdef __GNUC__
+  #pragma GCC diagnostic pop
+#endif  // __GNUC__
+
+// @@protoc_insertion_point(namespace_scope)
+
+}  // namespace laser_message
+
+namespace google {
+namespace protobuf {
+
+template <> struct is_proto_enum< ::laser_message::laserStatus> : ::google::protobuf::internal::true_type {};
+template <>
+inline const EnumDescriptor* GetEnumDescriptor< ::laser_message::laserStatus>() {
+  return ::laser_message::laserStatus_descriptor();
+}
+
+}  // namespace protobuf
+}  // namespace google
+
+// @@protoc_insertion_point(global_scope)
+
+#endif  // PROTOBUF_laser_5fmessage_2eproto__INCLUDED

+ 17 - 0
laser/laser_message.proto

@@ -0,0 +1,17 @@
+syntax = "proto2";
+package laser_message;
+
+enum laserStatus
+{
+    eLaserConnected=0;
+    eLaserDisconnected=1;
+    eLaserBusy=2;
+    eLaserUnknown=3;
+}
+message laserMsg
+{
+    optional laserStatus laser_status=1;
+    optional int32 queue_data_count=2;
+    optional int32 cloud_count=3;
+    required int32 id=4;
+}

+ 43 - 19
plc/plc_communicator.cpp

@@ -6,7 +6,8 @@ Plc_Communicator::Plc_Communicator(plc_module::plc_connection_params connection_
                                                                              mb_plc_is_connected(false),
                                                                              mb_plc_is_updating(false),
                                                                              mp_plc_owner(0),
-                                                                             m_plc_thread(0)
+                                                                             m_plc_thread(0),
+                                                                             m_plc_message_thread(0)
 {
     m_plc_ip_str = connection_params.ip();
     m_plc_port = connection_params.port();
@@ -24,6 +25,7 @@ Plc_Communicator::Plc_Communicator(plc_module::plc_connection_params connection_
     m_plc_current_error = connect();
     m_plc_cond_exit.Notify(false);
     m_plc_thread = new std::thread(plc_update_thread, this);
+    m_plc_message_thread=new std::thread(plc_publish_message, this);
     mb_plc_initialized = true;
 }
 
@@ -37,6 +39,14 @@ Plc_Communicator::~Plc_Communicator()
         delete m_plc_thread;
         m_plc_thread = 0;
     }
+
+    if (m_plc_message_thread)
+    {
+        if (m_plc_message_thread->joinable())
+            m_plc_message_thread->join();
+        delete m_plc_message_thread;
+        m_plc_message_thread = 0;
+    }
     disconnect();
 }
 
@@ -177,11 +187,12 @@ Error_manager Plc_Communicator::write_result_to_plc(struct measure_result result
         result_info_temp[PLC_LASER_LENGTH_ADDR - PLC_LASER_STATUS_ADDR] = uint16_t(result.length + 0.5f);
         result_info_temp[PLC_LASER_WIDTH_ADDR - PLC_LASER_STATUS_ADDR] = uint16_t(result.width + 0.5f);
         result_info_temp[PLC_LASER_HEIGHT_ADDR - PLC_LASER_STATUS_ADDR] = uint16_t(result.height + 0.5f);
-        result_info_temp[PLC_LASER_CORRECTNESS_ADDR - PLC_LASER_STATUS_ADDR] = uint16_t(0);
+        result_info_temp[PLC_LASER_CORRECTNESS_ADDR - PLC_LASER_STATUS_ADDR] = uint16_t(1);
         result_info_temp[PLC_LASER_WHEELBASE_ADDR - PLC_LASER_STATUS_ADDR] = uint16_t(result.wheel_base + 0.5f);
     }else{
         m_plc_region_status[result.terminal_id-1].current_status = 4;
         result_info_temp[PLC_LASER_STATUS_ADDR - PLC_LASER_STATUS_ADDR] = uint16_t(4);
+        result_info_temp[PLC_LASER_CORRECTNESS_ADDR - PLC_LASER_STATUS_ADDR] = uint16_t(0);
     }
     if(!m_plc_wrapper.is_connected()){
         return Error_manager(Error_code::PLC_CONNECTION_FAILED);
@@ -198,13 +209,42 @@ Error_manager Plc_Communicator::write_result_to_plc(struct measure_result result
             return Error_manager(Error_code::SUCCESS);
     }
 }
+/*
+ *
+ */
+
+void Plc_Communicator::plc_publish_message(Plc_Communicator* plc)
+{
+    if(plc==0)
+    {
+        LOG(ERROR)<<"";
+    }
+    while(plc->m_plc_cond_exit.WaitFor(100)==false) {
+        plc_message::plcMsg msg;
+        for(int i=0;i<PLC_SIGNAL_BEGIN_OFFSET;++i)
+        {
+            msg.add_plc_values(0);
+        }
+        for (int i = 0; i < plc->m_plc_data.size(); ++i) {
+            msg.add_plc_values(plc->m_plc_data[i]);
+        }
+        plc_message::plcStatus status;
+        if (plc->mb_plc_is_connected)
+            status = plc_message::ePLCConnected;
+        else
+            status = plc_message::ePLCDisconnected;
+        msg.set_plc_status(status);
+        MeasureTopicPublisher::GetInstance()->Publish(msg.SerializeAsString());
+    }
+
+}
 
 // ××××××××××× 更新线程静态函数 ×××××××××××
 void Plc_Communicator::plc_update_thread(Plc_Communicator *plc_communicator)
 {
     if (plc_communicator == 0)
         return;
-    while (!plc_communicator->m_plc_cond_exit.WaitFor(1))
+    while (!plc_communicator->m_plc_cond_exit.WaitFor(100))
     {
         // std::cout<<" thread 000 "<<std::endl;
         plc_communicator->m_plc_mutex.lock();
@@ -225,30 +265,14 @@ void Plc_Communicator::plc_update_thread(Plc_Communicator *plc_communicator)
             // 读取所有数据,更新本地并发布消息到UI
             int plc_length_temp = PLC_REGION_NUM * PLC_SIGNAL_NUM_PER_REGION;
             uint16_t plc_data_temp[plc_length_temp];
-            plc_module::Plc_msg plc_msg;
             int rc = plc_communicator->m_plc_wrapper.read_registers(PLC_SIGNAL_BEGIN_OFFSET, plc_length_temp, plc_data_temp);
             if(rc == -2){
                 std::cout<<"find plc disconnected while read. try to reconnect."<<std::endl;
                 plc_communicator->mb_plc_is_connected = false;
-                plc_msg.set_status(plc_module::PLC_STATUS::ePLCDisconnected);
-                MeasureTopicPublisher* publisher = MeasureTopicPublisher::GetInstance();
-                if(publisher!=0)
-                    publisher->Publish(plc_msg.SerializeAsString());
-                // plc_communicator->connect();
                 continue;
             }
             else if (rc == 0)
             {
-                plc_msg.set_status(plc_module::PLC_STATUS::ePLCConnected);
-                for (size_t i = 0; i < plc_length_temp; i++)
-                {
-                    plc_msg.add_plc_values(plc_data_temp[i]);
-                }
-                MeasureTopicPublisher* publisher = MeasureTopicPublisher::GetInstance();
-                // std::cout<<"publisher: "<<plc_msg.SerializeAsString()<<std::endl;
-                if(publisher!=0)
-                    publisher->Publish(plc_msg.SerializeAsString());
-
                 plc_communicator->m_plc_mutex.lock();
                 int terminal_id_temp = 0;
                 for (size_t i = 0; i < plc_length_temp; i++)

+ 4 - 0
plc/plc_communicator.h

@@ -24,6 +24,7 @@
 #include "../tool/StdCondition.h"
 #include "../tool/MeasureTopicPublisher.h"
 #include "plc_module.pb.h"
+#include "plc_message.pb.h"
 
 #include <google/protobuf/io/coded_stream.h>
 #include <google/protobuf/io/zero_copy_stream_impl.h>
@@ -96,6 +97,7 @@ private:
     // 读写线程函数
     Error_manager ReadProtoParam(std::string path);
     static void plc_update_thread(Plc_Communicator* plc_communicator);
+    static void plc_publish_message(Plc_Communicator* plc);
     Error_manager write_result_to_plc(struct measure_result result);
     // 连接函数
     Error_manager connect();
@@ -108,8 +110,10 @@ private:
     void*               mp_plc_owner;            // 回调函数所有者句柄
     Command_Callback    m_plc_callback;         // 回调函数
 
+    std::thread*        m_plc_message_thread;           // plc
     std::thread*        m_plc_thread;           // plc更新线程句柄
     StdCondition        m_plc_cond_exit;        // plc更新线程退出条件控制变量
+
     std::mutex          m_plc_mutex;            // plc更新互斥锁,锁住与wrapper相关的所有操作
     modbus::CLibmodbusWrapper   m_plc_wrapper;  // plc连接与读写封装实例
 

+ 432 - 0
plc/plc_message.pb.cc

@@ -0,0 +1,432 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: plc_message.proto
+
+#include "plc_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 plc_message {
+class plcMsgDefaultTypeInternal {
+ public:
+  ::google::protobuf::internal::ExplicitlyConstructed<plcMsg>
+      _instance;
+} _plcMsg_default_instance_;
+}  // namespace plc_message
+namespace protobuf_plc_5fmessage_2eproto {
+void InitDefaultsplcMsgImpl() {
+  GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
+  ::google::protobuf::internal::InitProtobufDefaultsForceUnique();
+#else
+  ::google::protobuf::internal::InitProtobufDefaults();
+#endif  // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
+  {
+    void* ptr = &::plc_message::_plcMsg_default_instance_;
+    new (ptr) ::plc_message::plcMsg();
+    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
+  }
+  ::plc_message::plcMsg::InitAsDefaultInstance();
+}
+
+void InitDefaultsplcMsg() {
+  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+  ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsplcMsgImpl);
+}
+
+::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(::plc_message::plcMsg, _has_bits_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::plc_message::plcMsg, _internal_metadata_),
+  ~0u,  // no _extensions_
+  ~0u,  // no _oneof_case_
+  ~0u,  // no _weak_field_map_
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::plc_message::plcMsg, plc_status_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::plc_message::plcMsg, plc_values_),
+  0,
+  ~0u,
+};
+static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
+  { 0, 7, sizeof(::plc_message::plcMsg)},
+};
+
+static ::google::protobuf::Message const * const file_default_instances[] = {
+  reinterpret_cast<const ::google::protobuf::Message*>(&::plc_message::_plcMsg_default_instance_),
+};
+
+void protobuf_AssignDescriptors() {
+  AddDescriptors();
+  ::google::protobuf::MessageFactory* factory = NULL;
+  AssignDescriptors(
+      "plc_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\021plc_message.proto\022\013plc_message\"H\n\006plcM"
+      "sg\022*\n\nplc_status\030\001 \001(\0162\026.plc_message.plc"
+      "Status\022\022\n\nplc_values\030\002 \003(\005*V\n\tplcStatus\022"
+      "\021\n\rePLCConnected\020\000\022\024\n\020ePLCDisconnected\020\001"
+      "\022\017\n\013ePLCRefused\020\002\022\017\n\013ePLCUnknown\020\003"
+  };
+  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
+      descriptor, 194);
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
+    "plc_message.proto", &protobuf_RegisterTypes);
+}
+
+void AddDescriptors() {
+  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
+  ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
+}
+// Force AddDescriptors() to be called at dynamic initialization time.
+struct StaticDescriptorInitializer {
+  StaticDescriptorInitializer() {
+    AddDescriptors();
+  }
+} static_descriptor_initializer;
+}  // namespace protobuf_plc_5fmessage_2eproto
+namespace plc_message {
+const ::google::protobuf::EnumDescriptor* plcStatus_descriptor() {
+  protobuf_plc_5fmessage_2eproto::protobuf_AssignDescriptorsOnce();
+  return protobuf_plc_5fmessage_2eproto::file_level_enum_descriptors[0];
+}
+bool plcStatus_IsValid(int value) {
+  switch (value) {
+    case 0:
+    case 1:
+    case 2:
+    case 3:
+      return true;
+    default:
+      return false;
+  }
+}
+
+
+// ===================================================================
+
+void plcMsg::InitAsDefaultInstance() {
+}
+#if !defined(_MSC_VER) || _MSC_VER >= 1900
+const int plcMsg::kPlcStatusFieldNumber;
+const int plcMsg::kPlcValuesFieldNumber;
+#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900
+
+plcMsg::plcMsg()
+  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
+  if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
+    ::protobuf_plc_5fmessage_2eproto::InitDefaultsplcMsg();
+  }
+  SharedCtor();
+  // @@protoc_insertion_point(constructor:plc_message.plcMsg)
+}
+plcMsg::plcMsg(const plcMsg& from)
+  : ::google::protobuf::Message(),
+      _internal_metadata_(NULL),
+      _has_bits_(from._has_bits_),
+      _cached_size_(0),
+      plc_values_(from.plc_values_) {
+  _internal_metadata_.MergeFrom(from._internal_metadata_);
+  plc_status_ = from.plc_status_;
+  // @@protoc_insertion_point(copy_constructor:plc_message.plcMsg)
+}
+
+void plcMsg::SharedCtor() {
+  _cached_size_ = 0;
+  plc_status_ = 0;
+}
+
+plcMsg::~plcMsg() {
+  // @@protoc_insertion_point(destructor:plc_message.plcMsg)
+  SharedDtor();
+}
+
+void plcMsg::SharedDtor() {
+}
+
+void plcMsg::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* plcMsg::descriptor() {
+  ::protobuf_plc_5fmessage_2eproto::protobuf_AssignDescriptorsOnce();
+  return ::protobuf_plc_5fmessage_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
+}
+
+const plcMsg& plcMsg::default_instance() {
+  ::protobuf_plc_5fmessage_2eproto::InitDefaultsplcMsg();
+  return *internal_default_instance();
+}
+
+plcMsg* plcMsg::New(::google::protobuf::Arena* arena) const {
+  plcMsg* n = new plcMsg;
+  if (arena != NULL) {
+    arena->Own(n);
+  }
+  return n;
+}
+
+void plcMsg::Clear() {
+// @@protoc_insertion_point(message_clear_start:plc_message.plcMsg)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  // Prevent compiler warnings about cached_has_bits being unused
+  (void) cached_has_bits;
+
+  plc_values_.Clear();
+  plc_status_ = 0;
+  _has_bits_.Clear();
+  _internal_metadata_.Clear();
+}
+
+bool plcMsg::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:plc_message.plcMsg)
+  for (;;) {
+    ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+    tag = p.first;
+    if (!p.second) goto handle_unusual;
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // optional .plc_message.plcStatus plc_status = 1;
+      case 1: {
+        if (static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) {
+          int value;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          if (::plc_message::plcStatus_IsValid(value)) {
+            set_plc_status(static_cast< ::plc_message::plcStatus >(value));
+          } else {
+            mutable_unknown_fields()->AddVarint(
+                1, static_cast< ::google::protobuf::uint64>(value));
+          }
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      // repeated int32 plc_values = 2;
+      case 2: {
+        if (static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) {
+          DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 1, 16u, input, this->mutable_plc_values())));
+        } else if (
+            static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, this->mutable_plc_values())));
+        } 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:plc_message.plcMsg)
+  return true;
+failure:
+  // @@protoc_insertion_point(parse_failure:plc_message.plcMsg)
+  return false;
+#undef DO_
+}
+
+void plcMsg::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // @@protoc_insertion_point(serialize_start:plc_message.plcMsg)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  cached_has_bits = _has_bits_[0];
+  // optional .plc_message.plcStatus plc_status = 1;
+  if (cached_has_bits & 0x00000001u) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      1, this->plc_status(), output);
+  }
+
+  // repeated int32 plc_values = 2;
+  for (int i = 0, n = this->plc_values_size(); i < n; i++) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(
+      2, this->plc_values(i), output);
+  }
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        _internal_metadata_.unknown_fields(), output);
+  }
+  // @@protoc_insertion_point(serialize_end:plc_message.plcMsg)
+}
+
+::google::protobuf::uint8* plcMsg::InternalSerializeWithCachedSizesToArray(
+    bool deterministic, ::google::protobuf::uint8* target) const {
+  (void)deterministic; // Unused
+  // @@protoc_insertion_point(serialize_to_array_start:plc_message.plcMsg)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  cached_has_bits = _has_bits_[0];
+  // optional .plc_message.plcStatus plc_status = 1;
+  if (cached_has_bits & 0x00000001u) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+      1, this->plc_status(), target);
+  }
+
+  // repeated int32 plc_values = 2;
+  target = ::google::protobuf::internal::WireFormatLite::
+    WriteInt32ToArray(2, this->plc_values_, 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:plc_message.plcMsg)
+  return target;
+}
+
+size_t plcMsg::ByteSizeLong() const {
+// @@protoc_insertion_point(message_byte_size_start:plc_message.plcMsg)
+  size_t total_size = 0;
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        _internal_metadata_.unknown_fields());
+  }
+  // repeated int32 plc_values = 2;
+  {
+    size_t data_size = ::google::protobuf::internal::WireFormatLite::
+      Int32Size(this->plc_values_);
+    total_size += 1 *
+                  ::google::protobuf::internal::FromIntSize(this->plc_values_size());
+    total_size += data_size;
+  }
+
+  // optional .plc_message.plcStatus plc_status = 1;
+  if (has_plc_status()) {
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::EnumSize(this->plc_status());
+  }
+
+  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 plcMsg::MergeFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_merge_from_start:plc_message.plcMsg)
+  GOOGLE_DCHECK_NE(&from, this);
+  const plcMsg* source =
+      ::google::protobuf::internal::DynamicCastToGenerated<const plcMsg>(
+          &from);
+  if (source == NULL) {
+  // @@protoc_insertion_point(generalized_merge_from_cast_fail:plc_message.plcMsg)
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+  // @@protoc_insertion_point(generalized_merge_from_cast_success:plc_message.plcMsg)
+    MergeFrom(*source);
+  }
+}
+
+void plcMsg::MergeFrom(const plcMsg& from) {
+// @@protoc_insertion_point(class_specific_merge_from_start:plc_message.plcMsg)
+  GOOGLE_DCHECK_NE(&from, this);
+  _internal_metadata_.MergeFrom(from._internal_metadata_);
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  plc_values_.MergeFrom(from.plc_values_);
+  if (from.has_plc_status()) {
+    set_plc_status(from.plc_status());
+  }
+}
+
+void plcMsg::CopyFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_copy_from_start:plc_message.plcMsg)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void plcMsg::CopyFrom(const plcMsg& from) {
+// @@protoc_insertion_point(class_specific_copy_from_start:plc_message.plcMsg)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool plcMsg::IsInitialized() const {
+  return true;
+}
+
+void plcMsg::Swap(plcMsg* other) {
+  if (other == this) return;
+  InternalSwap(other);
+}
+void plcMsg::InternalSwap(plcMsg* other) {
+  using std::swap;
+  plc_values_.InternalSwap(&other->plc_values_);
+  swap(plc_status_, other->plc_status_);
+  swap(_has_bits_[0], other->_has_bits_[0]);
+  _internal_metadata_.Swap(&other->_internal_metadata_);
+  swap(_cached_size_, other->_cached_size_);
+}
+
+::google::protobuf::Metadata plcMsg::GetMetadata() const {
+  protobuf_plc_5fmessage_2eproto::protobuf_AssignDescriptorsOnce();
+  return ::protobuf_plc_5fmessage_2eproto::file_level_metadata[kIndexInFileMessages];
+}
+
+
+// @@protoc_insertion_point(namespace_scope)
+}  // namespace plc_message
+
+// @@protoc_insertion_point(global_scope)

+ 291 - 0
plc/plc_message.pb.h

@@ -0,0 +1,291 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: plc_message.proto
+
+#ifndef PROTOBUF_plc_5fmessage_2eproto__INCLUDED
+#define PROTOBUF_plc_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>
+// @@protoc_insertion_point(includes)
+
+namespace protobuf_plc_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 InitDefaultsplcMsgImpl();
+void InitDefaultsplcMsg();
+inline void InitDefaults() {
+  InitDefaultsplcMsg();
+}
+}  // namespace protobuf_plc_5fmessage_2eproto
+namespace plc_message {
+class plcMsg;
+class plcMsgDefaultTypeInternal;
+extern plcMsgDefaultTypeInternal _plcMsg_default_instance_;
+}  // namespace plc_message
+namespace plc_message {
+
+enum plcStatus {
+  ePLCConnected = 0,
+  ePLCDisconnected = 1,
+  ePLCRefused = 2,
+  ePLCUnknown = 3
+};
+bool plcStatus_IsValid(int value);
+const plcStatus plcStatus_MIN = ePLCConnected;
+const plcStatus plcStatus_MAX = ePLCUnknown;
+const int plcStatus_ARRAYSIZE = plcStatus_MAX + 1;
+
+const ::google::protobuf::EnumDescriptor* plcStatus_descriptor();
+inline const ::std::string& plcStatus_Name(plcStatus value) {
+  return ::google::protobuf::internal::NameOfEnum(
+    plcStatus_descriptor(), value);
+}
+inline bool plcStatus_Parse(
+    const ::std::string& name, plcStatus* value) {
+  return ::google::protobuf::internal::ParseNamedEnum<plcStatus>(
+    plcStatus_descriptor(), name, value);
+}
+// ===================================================================
+
+class plcMsg : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:plc_message.plcMsg) */ {
+ public:
+  plcMsg();
+  virtual ~plcMsg();
+
+  plcMsg(const plcMsg& from);
+
+  inline plcMsg& operator=(const plcMsg& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  #if LANG_CXX11
+  plcMsg(plcMsg&& from) noexcept
+    : plcMsg() {
+    *this = ::std::move(from);
+  }
+
+  inline plcMsg& operator=(plcMsg&& 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 plcMsg& default_instance();
+
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
+  static inline const plcMsg* internal_default_instance() {
+    return reinterpret_cast<const plcMsg*>(
+               &_plcMsg_default_instance_);
+  }
+  static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+    0;
+
+  void Swap(plcMsg* other);
+  friend void swap(plcMsg& a, plcMsg& b) {
+    a.Swap(&b);
+  }
+
+  // implements Message ----------------------------------------------
+
+  inline plcMsg* New() const PROTOBUF_FINAL { return New(NULL); }
+
+  plcMsg* 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 plcMsg& from);
+  void MergeFrom(const plcMsg& 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(plcMsg* 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 int32 plc_values = 2;
+  int plc_values_size() const;
+  void clear_plc_values();
+  static const int kPlcValuesFieldNumber = 2;
+  ::google::protobuf::int32 plc_values(int index) const;
+  void set_plc_values(int index, ::google::protobuf::int32 value);
+  void add_plc_values(::google::protobuf::int32 value);
+  const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >&
+      plc_values() const;
+  ::google::protobuf::RepeatedField< ::google::protobuf::int32 >*
+      mutable_plc_values();
+
+  // optional .plc_message.plcStatus plc_status = 1;
+  bool has_plc_status() const;
+  void clear_plc_status();
+  static const int kPlcStatusFieldNumber = 1;
+  ::plc_message::plcStatus plc_status() const;
+  void set_plc_status(::plc_message::plcStatus value);
+
+  // @@protoc_insertion_point(class_scope:plc_message.plcMsg)
+ private:
+  void set_has_plc_status();
+  void clear_has_plc_status();
+
+  ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
+  ::google::protobuf::internal::HasBits<1> _has_bits_;
+  mutable int _cached_size_;
+  ::google::protobuf::RepeatedField< ::google::protobuf::int32 > plc_values_;
+  int plc_status_;
+  friend struct ::protobuf_plc_5fmessage_2eproto::TableStruct;
+  friend void ::protobuf_plc_5fmessage_2eproto::InitDefaultsplcMsgImpl();
+};
+// ===================================================================
+
+
+// ===================================================================
+
+#ifdef __GNUC__
+  #pragma GCC diagnostic push
+  #pragma GCC diagnostic ignored "-Wstrict-aliasing"
+#endif  // __GNUC__
+// plcMsg
+
+// optional .plc_message.plcStatus plc_status = 1;
+inline bool plcMsg::has_plc_status() const {
+  return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void plcMsg::set_has_plc_status() {
+  _has_bits_[0] |= 0x00000001u;
+}
+inline void plcMsg::clear_has_plc_status() {
+  _has_bits_[0] &= ~0x00000001u;
+}
+inline void plcMsg::clear_plc_status() {
+  plc_status_ = 0;
+  clear_has_plc_status();
+}
+inline ::plc_message::plcStatus plcMsg::plc_status() const {
+  // @@protoc_insertion_point(field_get:plc_message.plcMsg.plc_status)
+  return static_cast< ::plc_message::plcStatus >(plc_status_);
+}
+inline void plcMsg::set_plc_status(::plc_message::plcStatus value) {
+  assert(::plc_message::plcStatus_IsValid(value));
+  set_has_plc_status();
+  plc_status_ = value;
+  // @@protoc_insertion_point(field_set:plc_message.plcMsg.plc_status)
+}
+
+// repeated int32 plc_values = 2;
+inline int plcMsg::plc_values_size() const {
+  return plc_values_.size();
+}
+inline void plcMsg::clear_plc_values() {
+  plc_values_.Clear();
+}
+inline ::google::protobuf::int32 plcMsg::plc_values(int index) const {
+  // @@protoc_insertion_point(field_get:plc_message.plcMsg.plc_values)
+  return plc_values_.Get(index);
+}
+inline void plcMsg::set_plc_values(int index, ::google::protobuf::int32 value) {
+  plc_values_.Set(index, value);
+  // @@protoc_insertion_point(field_set:plc_message.plcMsg.plc_values)
+}
+inline void plcMsg::add_plc_values(::google::protobuf::int32 value) {
+  plc_values_.Add(value);
+  // @@protoc_insertion_point(field_add:plc_message.plcMsg.plc_values)
+}
+inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >&
+plcMsg::plc_values() const {
+  // @@protoc_insertion_point(field_list:plc_message.plcMsg.plc_values)
+  return plc_values_;
+}
+inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >*
+plcMsg::mutable_plc_values() {
+  // @@protoc_insertion_point(field_mutable_list:plc_message.plcMsg.plc_values)
+  return &plc_values_;
+}
+
+#ifdef __GNUC__
+  #pragma GCC diagnostic pop
+#endif  // __GNUC__
+
+// @@protoc_insertion_point(namespace_scope)
+
+}  // namespace plc_message
+
+namespace google {
+namespace protobuf {
+
+template <> struct is_proto_enum< ::plc_message::plcStatus> : ::google::protobuf::internal::true_type {};
+template <>
+inline const EnumDescriptor* GetEnumDescriptor< ::plc_message::plcStatus>() {
+  return ::plc_message::plcStatus_descriptor();
+}
+
+}  // namespace protobuf
+}  // namespace google
+
+// @@protoc_insertion_point(global_scope)
+
+#endif  // PROTOBUF_plc_5fmessage_2eproto__INCLUDED

+ 16 - 0
plc/plc_message.proto

@@ -0,0 +1,16 @@
+syntax = "proto2";
+package plc_message;
+
+enum plcStatus
+{
+    ePLCConnected=0;
+    ePLCDisconnected=1;
+    ePLCRefused=2;
+    ePLCUnknown=3;
+}
+
+message plcMsg
+{
+    optional plcStatus plc_status=1;
+    repeated int32 plc_values=2;
+}

+ 1 - 0
system_manager/System_Manager.cpp

@@ -75,6 +75,7 @@ System_Manager::~System_Manager()
 //2,根据配置创建雷达,plc,locater,terminal
 Error_manager System_Manager::init()
 {
+    MeasureTopicPublisher::GetInstance();
     Error_manager code;
     //读laser配置
     Laser_proto::Laser_parameter_all laser_parameters;

+ 33 - 0
terminor/MeasureRequest.cpp

@@ -0,0 +1,33 @@
+//
+// Created by zx on 2019/12/17.
+//
+
+#include "MeasureRequest.h"
+#include <nnxx/message.h>
+#include <nnxx/message_control.h>
+#include <nnxx/socket.h>
+#include <nnxx/reqrep.h>
+#include <nnxx/timeout.h>
+#include <nnxx/error.h>
+MeasureRequest::MeasureRequest(std::string connectStr)
+{
+    m_connect_str=connectStr;
+}
+bool MeasureRequest::Request(std::string cmd,std::string& response)
+{
+    nnxx::socket sock{ nnxx::SP, nnxx::REQ };
+    sock.connect(m_connect_str);
+    sock.send(cmd);
+    nnxx::message message;
+    try { nnxx::with_recv_timeout _ { sock, std::chrono::milliseconds(1000) };
+        message=sock.recv();
+    }
+    catch (const nnxx::timeout_error &) {
+        return false;
+    }
+    catch (const std::exception &) {
+        return false;
+    }
+    response=nnxx::to_string(message);
+    return true;
+}

+ 25 - 0
terminor/MeasureRequest.h

@@ -0,0 +1,25 @@
+//
+// Created by zx on 2019/12/17.
+//
+
+#ifndef LIDARMEASURE_MEASUREREQUEST_H
+#define LIDARMEASURE_MEASUREREQUEST_H
+#include <nnxx/message.h>
+#include <nnxx/message_control.h>
+#include <nnxx/socket.h>
+#include <nnxx/pubsub.h>
+#include <nnxx/timeout.h>
+#include <nnxx/error.h>
+#include <string>
+
+class MeasureRequest {
+public:
+    MeasureRequest(std::string connectStr);
+    bool Request(std::string cmd,std::string& response);
+
+protected:
+    std::string m_connect_str;
+};
+
+
+#endif //LIDARMEASURE_MEASUREREQUEST_H

+ 33 - 6
terminor/terminal_command_executor.cpp

@@ -3,6 +3,9 @@
 #include <chrono>
 #include <pcl/filters/passthrough.h>
 #include "../tool/pathcreator.h"
+///增加获取wj电子围栏模块头文件
+#include "terminor_msg.pb.h"
+#include "MeasureRequest.h"
 
 //////以下两个函数用于测试,读取指定点云
 bool string2point(std::string str,pcl::PointXYZ& point)
@@ -178,6 +181,14 @@ void Terminor_Command_Executor::thread_command_working(Terminor_Command_Executor
     }
     //执行指令,阻塞直到指令执行完成或者异常结束
     Error_manager code=terminor->scanning_measuring();
+    switch(code.get_error_code())
+    {
+        case SUCCESS:break;
+        case TERMINOR_LASER_TIMEOUT:
+        {
+            //雷达扫描超时,代表雷达故障,此时需要重置雷达模块
+        }
+    }
     if(code!=SUCCESS)
     {
         LOG(ERROR)<<"Command execute failed : "<<code.to_string();
@@ -329,7 +340,7 @@ Error_manager Terminor_Command_Executor::scanning_measuring()
             //扫描超时,点云中没有点,则返回错误
             if(scan_cloud->size()==0)
             {
-                return Error_manager(TERMINOR_LASER_TIMEOUT,NORMAL,"laser scanning timeout");
+                return Error_manager(TERMINOR_LASER_TIMEOUT,MAJOR_ERROR,"laser scanning timeout");
             }
 
 
@@ -374,12 +385,30 @@ Error_manager Terminor_Command_Executor::scanning_measuring()
     locate_task->set_save_path(project_path);
     m_terminor_statu=TERMINOR_MEASURING;
     code=mp_locater->execute_task(locate_task);
+    //获取测量结果
+    m_measure_information=locate_task->get_locate_information();
     if(code!=SUCCESS)
     {
-        //对于失败情况作分别处理
+        m_measure_information.locate_correct=false;
+        //对于失败情况,获取wj电子围栏结果
+        MeasureRequest requst("tcp://127.0.0.1:9000");
+        std::string response;
+        char cmd[255] = {0};
+        sprintf(cmd, "Terminal%d", m_terminor_parameter.id());
+        if (requst.Request(cmd, response)) {
+            Terminal::wj_locate_information wj_infomation;
+            wj_infomation.ParseFromString(response);
+            m_measure_information.locate_theta = wj_infomation.c();
+            m_measure_information.locate_correct = wj_infomation.correctness();
+            m_measure_information.locate_width = wj_infomation.width();
+            m_measure_information.locate_x = wj_infomation.x();
+            m_measure_information.locate_y = wj_infomation.y();
+            m_measure_information.locate_wheel_base = wj_infomation.wheel_base();
+            LOG(INFO) << "locate from WJ-defence :\n" << wj_infomation.DebugString();
+            if(wj_infomation.correctness())
+                code=SUCCESS;
+        }
     }
-    //获取测量结果
-    m_measure_information=locate_task->get_locate_information();
     //释放locate task
     if(locate_task!=NULL)
     {
@@ -387,7 +416,5 @@ Error_manager Terminor_Command_Executor::scanning_measuring()
         locate_task=NULL;
     }
 
-
-
     return code;
 }

Diferenças do arquivo suprimidas por serem muito extensas
+ 1091 - 0
terminor/terminor_msg.pb.cc


+ 796 - 0
terminor/terminor_msg.pb.h

@@ -0,0 +1,796 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: terminor_msg.proto
+
+#ifndef PROTOBUF_terminor_5fmsg_2eproto__INCLUDED
+#define PROTOBUF_terminor_5fmsg_2eproto__INCLUDED
+
+#include <string>
+
+#include <google/protobuf/stubs/common.h>
+
+#if GOOGLE_PROTOBUF_VERSION < 3005000
+#error This file was generated by a newer version of protoc which is
+#error incompatible with your Protocol Buffer headers.  Please update
+#error your headers.
+#endif
+#if 3005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#error This file was generated by an older version of protoc which is
+#error incompatible with your Protocol Buffer headers.  Please
+#error regenerate this file with a newer version of protoc.
+#endif
+
+#include <google/protobuf/io/coded_stream.h>
+#include <google/protobuf/arena.h>
+#include <google/protobuf/arenastring.h>
+#include <google/protobuf/generated_message_table_driven.h>
+#include <google/protobuf/generated_message_util.h>
+#include <google/protobuf/metadata.h>
+#include <google/protobuf/message.h>
+#include <google/protobuf/repeated_field.h>  // IWYU pragma: export
+#include <google/protobuf/extension_set.h>  // IWYU pragma: export
+#include <google/protobuf/unknown_field_set.h>
+// @@protoc_insertion_point(includes)
+
+namespace protobuf_terminor_5fmsg_2eproto {
+// Internal implementation detail -- do not use these members.
+struct TableStruct {
+  static const ::google::protobuf::internal::ParseTableField entries[];
+  static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
+  static const ::google::protobuf::internal::ParseTable schema[2];
+  static const ::google::protobuf::internal::FieldMetadata field_metadata[];
+  static const ::google::protobuf::internal::SerializationTable serialization_table[];
+  static const ::google::protobuf::uint32 offsets[];
+};
+void AddDescriptors();
+void InitDefaultswj_locate_informationImpl();
+void InitDefaultswj_locate_information();
+void InitDefaultsTerminal_messageImpl();
+void InitDefaultsTerminal_message();
+inline void InitDefaults() {
+  InitDefaultswj_locate_information();
+  InitDefaultsTerminal_message();
+}
+}  // namespace protobuf_terminor_5fmsg_2eproto
+namespace Terminal {
+class Terminal_message;
+class Terminal_messageDefaultTypeInternal;
+extern Terminal_messageDefaultTypeInternal _Terminal_message_default_instance_;
+class wj_locate_information;
+class wj_locate_informationDefaultTypeInternal;
+extern wj_locate_informationDefaultTypeInternal _wj_locate_information_default_instance_;
+}  // namespace Terminal
+namespace Terminal {
+
+// ===================================================================
+
+class wj_locate_information : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:Terminal.wj_locate_information) */ {
+ public:
+  wj_locate_information();
+  virtual ~wj_locate_information();
+
+  wj_locate_information(const wj_locate_information& from);
+
+  inline wj_locate_information& operator=(const wj_locate_information& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  #if LANG_CXX11
+  wj_locate_information(wj_locate_information&& from) noexcept
+    : wj_locate_information() {
+    *this = ::std::move(from);
+  }
+
+  inline wj_locate_information& operator=(wj_locate_information&& 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 wj_locate_information& default_instance();
+
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
+  static inline const wj_locate_information* internal_default_instance() {
+    return reinterpret_cast<const wj_locate_information*>(
+               &_wj_locate_information_default_instance_);
+  }
+  static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+    0;
+
+  void Swap(wj_locate_information* other);
+  friend void swap(wj_locate_information& a, wj_locate_information& b) {
+    a.Swap(&b);
+  }
+
+  // implements Message ----------------------------------------------
+
+  inline wj_locate_information* New() const PROTOBUF_FINAL { return New(NULL); }
+
+  wj_locate_information* 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 wj_locate_information& from);
+  void MergeFrom(const wj_locate_information& 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(wj_locate_information* other);
+  private:
+  inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
+    return NULL;
+  }
+  inline void* MaybeArenaPtr() const {
+    return NULL;
+  }
+  public:
+
+  ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
+
+  // nested types ----------------------------------------------------
+
+  // accessors -------------------------------------------------------
+
+  // required string time = 1 [default = ""];
+  bool has_time() const;
+  void clear_time();
+  static const int kTimeFieldNumber = 1;
+  const ::std::string& time() const;
+  void set_time(const ::std::string& value);
+  #if LANG_CXX11
+  void set_time(::std::string&& value);
+  #endif
+  void set_time(const char* value);
+  void set_time(const char* value, size_t size);
+  ::std::string* mutable_time();
+  ::std::string* release_time();
+  void set_allocated_time(::std::string* time);
+
+  // optional string error = 12 [default = ""];
+  bool has_error() const;
+  void clear_error();
+  static const int kErrorFieldNumber = 12;
+  const ::std::string& error() const;
+  void set_error(const ::std::string& value);
+  #if LANG_CXX11
+  void set_error(::std::string&& value);
+  #endif
+  void set_error(const char* value);
+  void set_error(const char* value, size_t size);
+  ::std::string* mutable_error();
+  ::std::string* release_error();
+  void set_allocated_error(::std::string* error);
+
+  // required bool correctness = 2;
+  bool has_correctness() const;
+  void clear_correctness();
+  static const int kCorrectnessFieldNumber = 2;
+  bool correctness() const;
+  void set_correctness(bool value);
+
+  // optional int32 park_space_id = 3;
+  bool has_park_space_id() const;
+  void clear_park_space_id();
+  static const int kParkSpaceIdFieldNumber = 3;
+  ::google::protobuf::int32 park_space_id() const;
+  void set_park_space_id(::google::protobuf::int32 value);
+
+  // optional double x = 5;
+  bool has_x() const;
+  void clear_x();
+  static const int kXFieldNumber = 5;
+  double x() const;
+  void set_x(double value);
+
+  // optional double y = 6;
+  bool has_y() const;
+  void clear_y();
+  static const int kYFieldNumber = 6;
+  double y() const;
+  void set_y(double value);
+
+  // optional double c = 7;
+  bool has_c() const;
+  void clear_c();
+  static const int kCFieldNumber = 7;
+  double c() const;
+  void set_c(double value);
+
+  // optional double wheel_base = 8;
+  bool has_wheel_base() const;
+  void clear_wheel_base();
+  static const int kWheelBaseFieldNumber = 8;
+  double wheel_base() const;
+  void set_wheel_base(double value);
+
+  // optional double length = 9;
+  bool has_length() const;
+  void clear_length();
+  static const int kLengthFieldNumber = 9;
+  double length() const;
+  void set_length(double value);
+
+  // optional double width = 10;
+  bool has_width() const;
+  void clear_width();
+  static const int kWidthFieldNumber = 10;
+  double width() const;
+  void set_width(double value);
+
+  // optional double height = 11;
+  bool has_height() const;
+  void clear_height();
+  static const int kHeightFieldNumber = 11;
+  double height() const;
+  void set_height(double value);
+
+  // optional int32 laser_ids = 4;
+  bool has_laser_ids() const;
+  void clear_laser_ids();
+  static const int kLaserIdsFieldNumber = 4;
+  ::google::protobuf::int32 laser_ids() const;
+  void set_laser_ids(::google::protobuf::int32 value);
+
+  // @@protoc_insertion_point(class_scope:Terminal.wj_locate_information)
+ private:
+  void set_has_time();
+  void clear_has_time();
+  void set_has_correctness();
+  void clear_has_correctness();
+  void set_has_park_space_id();
+  void clear_has_park_space_id();
+  void set_has_laser_ids();
+  void clear_has_laser_ids();
+  void set_has_x();
+  void clear_has_x();
+  void set_has_y();
+  void clear_has_y();
+  void set_has_c();
+  void clear_has_c();
+  void set_has_wheel_base();
+  void clear_has_wheel_base();
+  void set_has_length();
+  void clear_has_length();
+  void set_has_width();
+  void clear_has_width();
+  void set_has_height();
+  void clear_has_height();
+  void set_has_error();
+  void clear_has_error();
+
+  // helper for ByteSizeLong()
+  size_t RequiredFieldsByteSizeFallback() const;
+
+  ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
+  ::google::protobuf::internal::HasBits<1> _has_bits_;
+  mutable int _cached_size_;
+  ::google::protobuf::internal::ArenaStringPtr time_;
+  ::google::protobuf::internal::ArenaStringPtr error_;
+  bool correctness_;
+  ::google::protobuf::int32 park_space_id_;
+  double x_;
+  double y_;
+  double c_;
+  double wheel_base_;
+  double length_;
+  double width_;
+  double height_;
+  ::google::protobuf::int32 laser_ids_;
+  friend struct ::protobuf_terminor_5fmsg_2eproto::TableStruct;
+  friend void ::protobuf_terminor_5fmsg_2eproto::InitDefaultswj_locate_informationImpl();
+};
+// -------------------------------------------------------------------
+
+class Terminal_message : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:Terminal.Terminal_message) */ {
+ public:
+  Terminal_message();
+  virtual ~Terminal_message();
+
+  Terminal_message(const Terminal_message& from);
+
+  inline Terminal_message& operator=(const Terminal_message& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  #if LANG_CXX11
+  Terminal_message(Terminal_message&& from) noexcept
+    : Terminal_message() {
+    *this = ::std::move(from);
+  }
+
+  inline Terminal_message& operator=(Terminal_message&& from) noexcept {
+    if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
+      if (this != &from) InternalSwap(&from);
+    } else {
+      CopyFrom(from);
+    }
+    return *this;
+  }
+  #endif
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _internal_metadata_.unknown_fields();
+  }
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return _internal_metadata_.mutable_unknown_fields();
+  }
+
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const Terminal_message& default_instance();
+
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
+  static inline const Terminal_message* internal_default_instance() {
+    return reinterpret_cast<const Terminal_message*>(
+               &_Terminal_message_default_instance_);
+  }
+  static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+    1;
+
+  void Swap(Terminal_message* other);
+  friend void swap(Terminal_message& a, Terminal_message& b) {
+    a.Swap(&b);
+  }
+
+  // implements Message ----------------------------------------------
+
+  inline Terminal_message* New() const PROTOBUF_FINAL { return New(NULL); }
+
+  Terminal_message* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+  void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+  void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+  void CopyFrom(const Terminal_message& from);
+  void MergeFrom(const Terminal_message& from);
+  void Clear() PROTOBUF_FINAL;
+  bool IsInitialized() const PROTOBUF_FINAL;
+
+  size_t ByteSizeLong() const PROTOBUF_FINAL;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
+  ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
+      bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+  int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const PROTOBUF_FINAL;
+  void InternalSwap(Terminal_message* other);
+  private:
+  inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
+    return NULL;
+  }
+  inline void* MaybeArenaPtr() const {
+    return NULL;
+  }
+  public:
+
+  ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
+
+  // nested types ----------------------------------------------------
+
+  // accessors -------------------------------------------------------
+
+  // @@protoc_insertion_point(class_scope:Terminal.Terminal_message)
+ private:
+
+  ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
+  ::google::protobuf::internal::HasBits<1> _has_bits_;
+  mutable int _cached_size_;
+  friend struct ::protobuf_terminor_5fmsg_2eproto::TableStruct;
+  friend void ::protobuf_terminor_5fmsg_2eproto::InitDefaultsTerminal_messageImpl();
+};
+// ===================================================================
+
+
+// ===================================================================
+
+#ifdef __GNUC__
+  #pragma GCC diagnostic push
+  #pragma GCC diagnostic ignored "-Wstrict-aliasing"
+#endif  // __GNUC__
+// wj_locate_information
+
+// required string time = 1 [default = ""];
+inline bool wj_locate_information::has_time() const {
+  return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void wj_locate_information::set_has_time() {
+  _has_bits_[0] |= 0x00000001u;
+}
+inline void wj_locate_information::clear_has_time() {
+  _has_bits_[0] &= ~0x00000001u;
+}
+inline void wj_locate_information::clear_time() {
+  time_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  clear_has_time();
+}
+inline const ::std::string& wj_locate_information::time() const {
+  // @@protoc_insertion_point(field_get:Terminal.wj_locate_information.time)
+  return time_.GetNoArena();
+}
+inline void wj_locate_information::set_time(const ::std::string& value) {
+  set_has_time();
+  time_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+  // @@protoc_insertion_point(field_set:Terminal.wj_locate_information.time)
+}
+#if LANG_CXX11
+inline void wj_locate_information::set_time(::std::string&& value) {
+  set_has_time();
+  time_.SetNoArena(
+    &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+  // @@protoc_insertion_point(field_set_rvalue:Terminal.wj_locate_information.time)
+}
+#endif
+inline void wj_locate_information::set_time(const char* value) {
+  GOOGLE_DCHECK(value != NULL);
+  set_has_time();
+  time_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+  // @@protoc_insertion_point(field_set_char:Terminal.wj_locate_information.time)
+}
+inline void wj_locate_information::set_time(const char* value, size_t size) {
+  set_has_time();
+  time_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+      ::std::string(reinterpret_cast<const char*>(value), size));
+  // @@protoc_insertion_point(field_set_pointer:Terminal.wj_locate_information.time)
+}
+inline ::std::string* wj_locate_information::mutable_time() {
+  set_has_time();
+  // @@protoc_insertion_point(field_mutable:Terminal.wj_locate_information.time)
+  return time_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+inline ::std::string* wj_locate_information::release_time() {
+  // @@protoc_insertion_point(field_release:Terminal.wj_locate_information.time)
+  clear_has_time();
+  return time_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+inline void wj_locate_information::set_allocated_time(::std::string* time) {
+  if (time != NULL) {
+    set_has_time();
+  } else {
+    clear_has_time();
+  }
+  time_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), time);
+  // @@protoc_insertion_point(field_set_allocated:Terminal.wj_locate_information.time)
+}
+
+// required bool correctness = 2;
+inline bool wj_locate_information::has_correctness() const {
+  return (_has_bits_[0] & 0x00000004u) != 0;
+}
+inline void wj_locate_information::set_has_correctness() {
+  _has_bits_[0] |= 0x00000004u;
+}
+inline void wj_locate_information::clear_has_correctness() {
+  _has_bits_[0] &= ~0x00000004u;
+}
+inline void wj_locate_information::clear_correctness() {
+  correctness_ = false;
+  clear_has_correctness();
+}
+inline bool wj_locate_information::correctness() const {
+  // @@protoc_insertion_point(field_get:Terminal.wj_locate_information.correctness)
+  return correctness_;
+}
+inline void wj_locate_information::set_correctness(bool value) {
+  set_has_correctness();
+  correctness_ = value;
+  // @@protoc_insertion_point(field_set:Terminal.wj_locate_information.correctness)
+}
+
+// optional int32 park_space_id = 3;
+inline bool wj_locate_information::has_park_space_id() const {
+  return (_has_bits_[0] & 0x00000008u) != 0;
+}
+inline void wj_locate_information::set_has_park_space_id() {
+  _has_bits_[0] |= 0x00000008u;
+}
+inline void wj_locate_information::clear_has_park_space_id() {
+  _has_bits_[0] &= ~0x00000008u;
+}
+inline void wj_locate_information::clear_park_space_id() {
+  park_space_id_ = 0;
+  clear_has_park_space_id();
+}
+inline ::google::protobuf::int32 wj_locate_information::park_space_id() const {
+  // @@protoc_insertion_point(field_get:Terminal.wj_locate_information.park_space_id)
+  return park_space_id_;
+}
+inline void wj_locate_information::set_park_space_id(::google::protobuf::int32 value) {
+  set_has_park_space_id();
+  park_space_id_ = value;
+  // @@protoc_insertion_point(field_set:Terminal.wj_locate_information.park_space_id)
+}
+
+// optional int32 laser_ids = 4;
+inline bool wj_locate_information::has_laser_ids() const {
+  return (_has_bits_[0] & 0x00000800u) != 0;
+}
+inline void wj_locate_information::set_has_laser_ids() {
+  _has_bits_[0] |= 0x00000800u;
+}
+inline void wj_locate_information::clear_has_laser_ids() {
+  _has_bits_[0] &= ~0x00000800u;
+}
+inline void wj_locate_information::clear_laser_ids() {
+  laser_ids_ = 0;
+  clear_has_laser_ids();
+}
+inline ::google::protobuf::int32 wj_locate_information::laser_ids() const {
+  // @@protoc_insertion_point(field_get:Terminal.wj_locate_information.laser_ids)
+  return laser_ids_;
+}
+inline void wj_locate_information::set_laser_ids(::google::protobuf::int32 value) {
+  set_has_laser_ids();
+  laser_ids_ = value;
+  // @@protoc_insertion_point(field_set:Terminal.wj_locate_information.laser_ids)
+}
+
+// optional double x = 5;
+inline bool wj_locate_information::has_x() const {
+  return (_has_bits_[0] & 0x00000010u) != 0;
+}
+inline void wj_locate_information::set_has_x() {
+  _has_bits_[0] |= 0x00000010u;
+}
+inline void wj_locate_information::clear_has_x() {
+  _has_bits_[0] &= ~0x00000010u;
+}
+inline void wj_locate_information::clear_x() {
+  x_ = 0;
+  clear_has_x();
+}
+inline double wj_locate_information::x() const {
+  // @@protoc_insertion_point(field_get:Terminal.wj_locate_information.x)
+  return x_;
+}
+inline void wj_locate_information::set_x(double value) {
+  set_has_x();
+  x_ = value;
+  // @@protoc_insertion_point(field_set:Terminal.wj_locate_information.x)
+}
+
+// optional double y = 6;
+inline bool wj_locate_information::has_y() const {
+  return (_has_bits_[0] & 0x00000020u) != 0;
+}
+inline void wj_locate_information::set_has_y() {
+  _has_bits_[0] |= 0x00000020u;
+}
+inline void wj_locate_information::clear_has_y() {
+  _has_bits_[0] &= ~0x00000020u;
+}
+inline void wj_locate_information::clear_y() {
+  y_ = 0;
+  clear_has_y();
+}
+inline double wj_locate_information::y() const {
+  // @@protoc_insertion_point(field_get:Terminal.wj_locate_information.y)
+  return y_;
+}
+inline void wj_locate_information::set_y(double value) {
+  set_has_y();
+  y_ = value;
+  // @@protoc_insertion_point(field_set:Terminal.wj_locate_information.y)
+}
+
+// optional double c = 7;
+inline bool wj_locate_information::has_c() const {
+  return (_has_bits_[0] & 0x00000040u) != 0;
+}
+inline void wj_locate_information::set_has_c() {
+  _has_bits_[0] |= 0x00000040u;
+}
+inline void wj_locate_information::clear_has_c() {
+  _has_bits_[0] &= ~0x00000040u;
+}
+inline void wj_locate_information::clear_c() {
+  c_ = 0;
+  clear_has_c();
+}
+inline double wj_locate_information::c() const {
+  // @@protoc_insertion_point(field_get:Terminal.wj_locate_information.c)
+  return c_;
+}
+inline void wj_locate_information::set_c(double value) {
+  set_has_c();
+  c_ = value;
+  // @@protoc_insertion_point(field_set:Terminal.wj_locate_information.c)
+}
+
+// optional double wheel_base = 8;
+inline bool wj_locate_information::has_wheel_base() const {
+  return (_has_bits_[0] & 0x00000080u) != 0;
+}
+inline void wj_locate_information::set_has_wheel_base() {
+  _has_bits_[0] |= 0x00000080u;
+}
+inline void wj_locate_information::clear_has_wheel_base() {
+  _has_bits_[0] &= ~0x00000080u;
+}
+inline void wj_locate_information::clear_wheel_base() {
+  wheel_base_ = 0;
+  clear_has_wheel_base();
+}
+inline double wj_locate_information::wheel_base() const {
+  // @@protoc_insertion_point(field_get:Terminal.wj_locate_information.wheel_base)
+  return wheel_base_;
+}
+inline void wj_locate_information::set_wheel_base(double value) {
+  set_has_wheel_base();
+  wheel_base_ = value;
+  // @@protoc_insertion_point(field_set:Terminal.wj_locate_information.wheel_base)
+}
+
+// optional double length = 9;
+inline bool wj_locate_information::has_length() const {
+  return (_has_bits_[0] & 0x00000100u) != 0;
+}
+inline void wj_locate_information::set_has_length() {
+  _has_bits_[0] |= 0x00000100u;
+}
+inline void wj_locate_information::clear_has_length() {
+  _has_bits_[0] &= ~0x00000100u;
+}
+inline void wj_locate_information::clear_length() {
+  length_ = 0;
+  clear_has_length();
+}
+inline double wj_locate_information::length() const {
+  // @@protoc_insertion_point(field_get:Terminal.wj_locate_information.length)
+  return length_;
+}
+inline void wj_locate_information::set_length(double value) {
+  set_has_length();
+  length_ = value;
+  // @@protoc_insertion_point(field_set:Terminal.wj_locate_information.length)
+}
+
+// optional double width = 10;
+inline bool wj_locate_information::has_width() const {
+  return (_has_bits_[0] & 0x00000200u) != 0;
+}
+inline void wj_locate_information::set_has_width() {
+  _has_bits_[0] |= 0x00000200u;
+}
+inline void wj_locate_information::clear_has_width() {
+  _has_bits_[0] &= ~0x00000200u;
+}
+inline void wj_locate_information::clear_width() {
+  width_ = 0;
+  clear_has_width();
+}
+inline double wj_locate_information::width() const {
+  // @@protoc_insertion_point(field_get:Terminal.wj_locate_information.width)
+  return width_;
+}
+inline void wj_locate_information::set_width(double value) {
+  set_has_width();
+  width_ = value;
+  // @@protoc_insertion_point(field_set:Terminal.wj_locate_information.width)
+}
+
+// optional double height = 11;
+inline bool wj_locate_information::has_height() const {
+  return (_has_bits_[0] & 0x00000400u) != 0;
+}
+inline void wj_locate_information::set_has_height() {
+  _has_bits_[0] |= 0x00000400u;
+}
+inline void wj_locate_information::clear_has_height() {
+  _has_bits_[0] &= ~0x00000400u;
+}
+inline void wj_locate_information::clear_height() {
+  height_ = 0;
+  clear_has_height();
+}
+inline double wj_locate_information::height() const {
+  // @@protoc_insertion_point(field_get:Terminal.wj_locate_information.height)
+  return height_;
+}
+inline void wj_locate_information::set_height(double value) {
+  set_has_height();
+  height_ = value;
+  // @@protoc_insertion_point(field_set:Terminal.wj_locate_information.height)
+}
+
+// optional string error = 12 [default = ""];
+inline bool wj_locate_information::has_error() const {
+  return (_has_bits_[0] & 0x00000002u) != 0;
+}
+inline void wj_locate_information::set_has_error() {
+  _has_bits_[0] |= 0x00000002u;
+}
+inline void wj_locate_information::clear_has_error() {
+  _has_bits_[0] &= ~0x00000002u;
+}
+inline void wj_locate_information::clear_error() {
+  error_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  clear_has_error();
+}
+inline const ::std::string& wj_locate_information::error() const {
+  // @@protoc_insertion_point(field_get:Terminal.wj_locate_information.error)
+  return error_.GetNoArena();
+}
+inline void wj_locate_information::set_error(const ::std::string& value) {
+  set_has_error();
+  error_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+  // @@protoc_insertion_point(field_set:Terminal.wj_locate_information.error)
+}
+#if LANG_CXX11
+inline void wj_locate_information::set_error(::std::string&& value) {
+  set_has_error();
+  error_.SetNoArena(
+    &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+  // @@protoc_insertion_point(field_set_rvalue:Terminal.wj_locate_information.error)
+}
+#endif
+inline void wj_locate_information::set_error(const char* value) {
+  GOOGLE_DCHECK(value != NULL);
+  set_has_error();
+  error_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+  // @@protoc_insertion_point(field_set_char:Terminal.wj_locate_information.error)
+}
+inline void wj_locate_information::set_error(const char* value, size_t size) {
+  set_has_error();
+  error_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+      ::std::string(reinterpret_cast<const char*>(value), size));
+  // @@protoc_insertion_point(field_set_pointer:Terminal.wj_locate_information.error)
+}
+inline ::std::string* wj_locate_information::mutable_error() {
+  set_has_error();
+  // @@protoc_insertion_point(field_mutable:Terminal.wj_locate_information.error)
+  return error_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+inline ::std::string* wj_locate_information::release_error() {
+  // @@protoc_insertion_point(field_release:Terminal.wj_locate_information.error)
+  clear_has_error();
+  return error_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+inline void wj_locate_information::set_allocated_error(::std::string* error) {
+  if (error != NULL) {
+    set_has_error();
+  } else {
+    clear_has_error();
+  }
+  error_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), error);
+  // @@protoc_insertion_point(field_set_allocated:Terminal.wj_locate_information.error)
+}
+
+// -------------------------------------------------------------------
+
+// Terminal_message
+
+#ifdef __GNUC__
+  #pragma GCC diagnostic pop
+#endif  // __GNUC__
+// -------------------------------------------------------------------
+
+
+// @@protoc_insertion_point(namespace_scope)
+
+}  // namespace Terminal
+
+// @@protoc_insertion_point(global_scope)
+
+#endif  // PROTOBUF_terminor_5fmsg_2eproto__INCLUDED

+ 17 - 0
terminor/terminor_msg.proto

@@ -1,6 +1,23 @@
 syntax="proto2";
 package Terminal;
 
+message wj_locate_information
+{
+    required string time=1 [default=""];
+    required bool correctness=2;
+    optional int32 park_space_id=3;
+    optional int32 laser_ids=4;
+
+    optional double x=5;
+    optional double y=6;
+    optional double c=7;
+    optional double wheel_base=8;
+    optional double length=9;
+    optional double width=10;
+    optional double height=11;
+    optional string error=12 [default=""];
+}
+
 message Terminal_message
 {