Pārlūkot izejas kodu

修改车位管理,适应新数据库节点。封装通信类,实现模拟终端节点,灌注停取指令。

yct 3 gadi atpakaļ
vecāks
revīzija
adadcfda3a
39 mainītis faili ar 26510 papildinājumiem un 697 dzēšanām
  1. 6 0
      chutian_modules.sln
  2. 18 0
      communicate_module/App.config
  3. 21 0
      communicate_module/Program.cs
  4. 36 0
      communicate_module/Properties/AssemblyInfo.cs
  5. 106 0
      communicate_module/communicate_module.csproj
  6. 467 0
      communicate_module/communication/Communicator.cs
  7. 74 0
      communicate_module/communication/GroundDIsplayCommuncator.cs
  8. 361 0
      communicate_module/communication/TerminalSimul.cs
  9. 3987 0
      communicate_module/message/MeasureMessage.cs
  10. 3522 0
      communicate_module/message/MessageBase.cs
  11. 4336 0
      communicate_module/message/ParkspaceAllocationMessage.cs
  12. 7190 0
      communicate_module/message/ProcessMessage.cs
  13. 1250 0
      communicate_module/message/TerminalMessage.cs
  14. 209 0
      communicate_module/message/dispatch_control.proto
  15. 316 0
      communicate_module/message/dispatch_message.proto
  16. 189 0
      communicate_module/message/measure_message.proto
  17. 290 0
      communicate_module/message/message_base.proto
  18. 153 0
      communicate_module/message/parkspace_allocation_message.proto
  19. 183 0
      communicate_module/message/process_message.proto
  20. 36 0
      communicate_module/message/terminal_message.proto
  21. 9 0
      communicate_module/packages.config
  22. 5 0
      communicate_module/proto.bat
  23. BIN
      communicate_module/x64/libnanomsg.so
  24. BIN
      communicate_module/x64/nanomsg.dll
  25. BIN
      communicate_module/x86/libnanomsg.so
  26. BIN
      communicate_module/x86/nanomsg.dll
  27. 1 1
      parkspace_manager/App.config
  28. 15 0
      parkspace_manager/FormParkSpaceStatus.Designer.cs
  29. 69 53
      parkspace_manager/FormParkSpaceStatus.cs
  30. 10 4
      parkspace_manager/FormStatusSelect.Designer.cs
  31. 13 0
      parkspace_manager/FormStatusSelect.cs
  32. 27 9
      parkspace_manager/communication/Communicator.cs
  33. 1502 267
      parkspace_manager/message/MessageBase.cs
  34. 1863 291
      parkspace_manager/message/ParkspaceAllocationMessage.cs
  35. 177 45
      parkspace_manager/message/message_base.proto
  36. 58 21
      parkspace_manager/message/parkspace_allocation_message.proto
  37. 2 2
      parkspace_manager/packages.config
  38. 4 4
      parkspace_manager/parkspace_manager.csproj
  39. 5 0
      parkspace_manager/proto.bat

+ 6 - 0
chutian_modules.sln

@@ -5,6 +5,8 @@ VisualStudioVersion = 15.0.27428.2043
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "parkspace_manager", "parkspace_manager\parkspace_manager.csproj", "{B4FF8229-BC04-4D00-833F-1C250AAF2470}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "communicate_module", "communicate_module\communicate_module.csproj", "{480BEED1-2511-4EF1-A154-5CA2A2465B89}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
 		{B4FF8229-BC04-4D00-833F-1C250AAF2470}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{B4FF8229-BC04-4D00-833F-1C250AAF2470}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{B4FF8229-BC04-4D00-833F-1C250AAF2470}.Release|Any CPU.Build.0 = Release|Any CPU
+		{480BEED1-2511-4EF1-A154-5CA2A2465B89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{480BEED1-2511-4EF1-A154-5CA2A2465B89}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{480BEED1-2511-4EF1-A154-5CA2A2465B89}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{480BEED1-2511-4EF1-A154-5CA2A2465B89}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 18 - 0
communicate_module/App.config

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+    <startup> 
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
+    </startup>
+  <runtime>
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
+</configuration>

+ 21 - 0
communicate_module/Program.cs

@@ -0,0 +1,21 @@
+using communicate_module.communication;
+using Communication;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace communicate_module
+{
+    class Program
+    {
+        static void Main(string[] args)
+        {
+            TerminalSimul.GetInstance().Init();
+            TerminalSimul.GetInstance().Bind("tcp://192.168.2.154:15000");
+            TerminalSimul.GetInstance().Connect("tcp://192.168.2.127:30000");
+            TerminalSimul.GetInstance().CreateSimulThread();
+        }
+    }
+}

+ 36 - 0
communicate_module/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("communicate_module")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("communicate_module")]
+[assembly: AssemblyCopyright("Copyright ©  2021")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("480beed1-2511-4ef1-a154-5ca2a2465b89")]
+
+// 程序集的版本信息由下列四个值组成: 
+//
+//      主版本
+//      次版本
+//      生成号
+//      修订号
+//
+// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
+// 方法是按如下所示使用“*”: :
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 106 - 0
communicate_module/communicate_module.csproj

@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{480BEED1-2511-4EF1-A154-5CA2A2465B89}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <RootNamespace>communicate_module</RootNamespace>
+    <AssemblyName>communicate_module</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Google.Protobuf, Version=3.17.3.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
+      <HintPath>..\packages\Google.Protobuf.3.17.3\lib\net45\Google.Protobuf.dll</HintPath>
+    </Reference>
+    <Reference Include="NNanomsg, Version=0.5.2.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\NNanomsg.0.5.2\lib\net40\NNanomsg.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Buffers.4.5.1\lib\netstandard1.1\System.Buffers.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Core" />
+    <Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Memory.4.5.4\lib\netstandard1.1\System.Memory.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="communication\Communicator.cs" />
+    <Compile Include="communication\GroundDIsplayCommuncator.cs" />
+    <Compile Include="communication\TerminalSimul.cs" />
+    <Compile Include="message\MeasureMessage.cs" />
+    <Compile Include="message\MessageBase.cs" />
+    <Compile Include="message\ParkspaceAllocationMessage.cs" />
+    <Compile Include="message\ProcessMessage.cs" />
+    <Compile Include="message\TerminalMessage.cs" />
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+    <None Include="message\dispatch_control.proto" />
+    <None Include="message\dispatch_message.proto" />
+    <None Include="message\measure_message.proto" />
+    <None Include="message\message_base.proto" />
+    <None Include="message\parkspace_allocation_message.proto" />
+    <None Include="message\process_message.proto" />
+    <None Include="message\terminal_message.proto" />
+    <None Include="packages.config" />
+    <None Include="proto.bat" />
+    <None Include="x64\libnanomsg.so">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="x86\libnanomsg.so">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="x64\nanomsg.dll">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="x86\nanomsg.dll">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Import Project="..\packages\Google.Protobuf.Tools.3.17.2\build\Google.Protobuf.Tools.targets" Condition="Exists('..\packages\Google.Protobuf.Tools.3.17.2\build\Google.Protobuf.Tools.targets')" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('..\packages\Google.Protobuf.Tools.3.17.2\build\Google.Protobuf.Tools.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Google.Protobuf.Tools.3.17.2\build\Google.Protobuf.Tools.targets'))" />
+  </Target>
+</Project>

+ 467 - 0
communicate_module/communication/Communicator.cs

@@ -0,0 +1,467 @@
+using NNanomsg;
+using NNanomsg.Protocols;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using Google.Protobuf;
+using Message;
+
+namespace Communication
+{
+    class MsgStamped
+    {
+        public DateTime receive_time;
+        public ByteString msg;
+        public Base_info header;
+
+        public MsgStamped()
+        {
+            receive_time = DateTime.Now;
+            msg = ByteString.Empty;
+        }
+
+        public MsgStamped(byte[] bytes)
+        {
+            receive_time = DateTime.Now;
+            msg = ByteString.CopyFrom(bytes);
+        }
+
+        public MsgStamped(ByteString msg)
+        {
+            receive_time = DateTime.Now;
+            this.msg = msg;
+        }
+
+        public MsgStamped(ByteString msg, Base_info header)
+        {
+            receive_time = DateTime.Now;
+            this.msg = msg;
+            this.header = header;
+            if(this.header.TimeoutMs <= 0)
+            {
+                this.header.TimeoutMs = 5000;
+            }
+        }
+    }
+
+    enum CommunicatorStatus
+    {
+        COMMUNICATION_UNKNOW = 0,           //通信状态 未知
+        COMMUNICATION_READY = 1,            //通信状态 正常
+
+        COMMUNICATION_FAULT = 3,         //通信状态 错误
+    }
+
+    enum CheckExecuterReturn
+    {
+        MSG_TIMEOUT = 0, // 消息超时
+        EXECUTER_READY = 1, // 执行器就绪
+        EXECUTER_BUSY = 2, // 执行器正忙
+        EXECUTER_FAULT = 3, // 执行器错误
+    }
+
+    class Communicator
+    {
+        /// <summary>
+        /// 实例退出标记
+        /// </summary>
+        public bool mb_exit;
+        /// <summary>
+        /// 初始化标记
+        /// </summary>
+        public bool mb_initialized;
+        /// <summary>
+        /// 消息超时时间
+        /// </summary>
+        public int m_timeout_milli = 2000;
+        /// <summary>
+        /// 通信类当前状态
+        /// </summary>
+        public CommunicatorStatus m_status;
+
+        /// <summary>
+        /// 单例锁对象
+        /// </summary>
+        protected readonly static object lockObj = new object();
+        /// <summary>
+        /// 单例
+        /// </summary>
+        protected static Communicator instance = null;
+        /// <summary>
+        /// 接收解析锁
+        /// </summary>
+        protected object m_receive_lock;
+        /// <summary>
+        /// 发送锁
+        /// </summary>
+        protected object m_send_lock;
+        /// <summary>
+        /// 发送队列
+        /// </summary>
+        protected Queue<MsgStamped> m_send_queue;
+        /// <summary>
+        /// 接收队列
+        /// </summary>
+        protected Queue<MsgStamped> m_receive_queue;
+        /// <summary>
+        /// 发送线程
+        /// </summary>
+        protected Thread m_thread_send;
+        /// <summary>
+        /// 接收线程
+        /// </summary>
+        protected Thread m_thread_receive;
+        /// <summary>
+        /// 解析接收string到protobuf消息
+        /// </summary>
+        protected Thread m_thread_decode_receive;
+        /// <summary>
+        /// nanomsg 通信句柄
+        /// </summary>
+        protected BusSocket m_socket;
+        /// <summary>
+        /// nnxx生成id队列
+        /// </summary>
+        protected Queue<NanomsgEndpoint> nanomsgEndpoints_queue;
+
+        /// <summary>
+        /// 构造函数
+        /// </summary>
+        /// <param name="server_ip"></param>
+        /// <param name="server_port"></param>
+        protected Communicator()
+        {
+            mb_exit = false;
+            mb_initialized = false;
+            m_receive_lock = new object();
+            m_send_lock = new object();
+            m_receive_queue = new Queue<MsgStamped>();
+            m_send_queue = new Queue<MsgStamped>();
+            nanomsgEndpoints_queue = new Queue<NanomsgEndpoint>();
+            m_status = CommunicatorStatus.COMMUNICATION_UNKNOW;
+        }
+
+        /// <summary>
+        /// 析构函数
+        /// </summary>
+        ~Communicator()
+        {
+            mb_exit = true;
+            if (m_thread_send != null)
+            {
+                m_thread_send.Join();
+            }
+            if (m_thread_receive != null)
+            {
+                m_thread_receive.Join();
+            }
+            if (m_thread_decode_receive != null)
+            {
+                m_thread_decode_receive.Join();
+            }
+        }
+
+        /// <summary>
+        /// 单例访问
+        /// </summary>
+        public static Communicator GetInstance()
+        {
+            if (instance == null)
+            {
+                lock (lockObj)
+                {
+                    if (instance == null)
+                    {
+                        instance = new Communicator();
+                    }
+                }
+            }
+            return instance;
+        }
+
+        /// <summary>
+        /// 初始化
+        /// </summary>
+        /// <returns></returns>
+        public bool Init()
+        {
+            try
+            {
+                if (!mb_initialized)
+                {
+                    mb_exit = false;
+                    mb_initialized = true;
+                    m_socket = new BusSocket();
+                    m_thread_receive = new Thread(new ParameterizedThreadStart(Receive_thread_function));
+                    m_thread_send = new Thread(new ParameterizedThreadStart(Send_thread_function));
+                    m_thread_decode_receive = new Thread(new ParameterizedThreadStart(Decode_thread_function));
+                    m_thread_receive.Start(this);
+                    m_thread_send.Start(this);
+                    m_thread_decode_receive.Start(this);
+                    m_status = CommunicatorStatus.COMMUNICATION_READY;
+                    return true;
+                }
+                else
+                {
+                    return false;
+                }
+            }
+            catch (Exception ex) { Console.WriteLine(ex.StackTrace); return false; }
+        }
+
+        /// <summary>
+        /// 反初始化
+        /// </summary>
+        /// <returns></returns>
+        public bool Uninit()
+        {
+            m_status = CommunicatorStatus.COMMUNICATION_UNKNOW;
+            mb_exit = true;
+            if (m_thread_receive != null)
+                m_thread_receive.Join();
+            if (m_thread_send != null)
+                m_thread_send.Join();
+            if (m_thread_decode_receive != null)
+                m_thread_decode_receive.Join();
+            if(m_socket!=null)
+            {
+                while(nanomsgEndpoints_queue.Count>0)
+                {
+                    NanomsgEndpoint nnep = nanomsgEndpoints_queue.Dequeue();
+                    m_socket.Shutdown(nnep);
+                }
+                m_socket.Dispose();
+            }
+            mb_initialized = false;
+            return true;
+        }
+
+        /// <summary>
+        /// 连接
+        /// </summary>
+        /// <param name="server_address"></param>
+        /// <returns></returns>
+        public bool Connect(string server_address)
+        {
+            if (m_socket == null)
+                return false;
+            NanomsgEndpoint end_point = m_socket.Connect(server_address);
+            return true;
+        }
+
+        /// <summary>
+        /// 绑定本地端口监听
+        /// </summary>
+        /// <param name="self_address"></param>
+        /// <returns></returns>
+        public bool Bind(string self_address)
+        {
+            if (m_socket == null)
+                return false;
+            NanomsgEndpoint end_point = m_socket.Bind(self_address);
+            return true;
+        }
+
+        /// <summary>
+        /// 发送消息
+        /// </summary>
+        /// <returns></returns>
+        public bool Send_msg(ByteString bs)
+        {
+            lock(m_send_lock)
+            {
+                m_send_queue.Enqueue(new MsgStamped(bs));
+            }
+            return true;
+        }
+
+        /// <summary>
+        /// 检查消息
+        /// </summary>
+        /// <param name="header"></param>
+        /// <returns></returns>
+        public virtual bool CheckMsg(Base_info header)
+        {
+            if (header.HasMsgType && header.HasSender && header.HasTimeoutMs
+                && header.MsgType == Message_type.EBaseMsg && header.Sender == Message.Communicator.EMain)
+                return true;
+            else
+                return false;
+        }
+
+        /// <summary>
+        /// 检查执行器状态
+        /// </summary>
+        /// <param name="header"></param>
+        /// <param name="receiveTime"></param>
+        /// <returns></returns>
+        public virtual CheckExecuterReturn CheckExecuter(Base_info header, DateTime receiveTime)
+        {
+            if ((DateTime.Now - receiveTime).Milliseconds > header.TimeoutMs)
+                return CheckExecuterReturn.MSG_TIMEOUT;
+            else
+                return CheckExecuterReturn.EXECUTER_READY;
+        }
+
+        /// <summary>
+        /// 执行消息
+        /// </summary>
+        /// <param name="msgStamped"></param>
+        /// <returns></returns>
+        public virtual bool ExecuteMsg(MsgStamped msgStamped)
+        {
+
+            return true;
+        }
+        
+        /// <summary>
+        /// 接收线程函数
+        /// </summary>
+        /// <param name="handle"></param>
+        private static void Receive_thread_function(object handle)
+        {
+            if (handle == null)
+                return;
+            Communicator comm = (Communicator)handle;
+            while (!comm.mb_exit)
+            {
+                try
+                {
+                    if (!comm.mb_initialized || comm.m_socket == null)
+                        continue;
+                    byte[] data = comm.m_socket.ReceiveImmediate();
+                    if (data != null && data.Length > 0 && comm.m_receive_queue != null)
+                    {
+                        // 解析头
+                        Base_msg base_msg = Base_msg.Parser.ParseFrom(data);
+                        //Console.WriteLine(base_msg.ToString());
+                        if (!comm.CheckMsg(base_msg.BaseInfo))
+                            continue;
+                        lock (comm.m_receive_lock)
+                        {
+                            comm.m_receive_queue.Enqueue(new MsgStamped(ByteString.CopyFrom(data), base_msg.BaseInfo));
+                        }
+                    }
+                }
+                catch (Exception ex) { Console.WriteLine(ex.StackTrace); }
+                Thread.Sleep(1);
+            }
+            Console.WriteLine("receive thread exit");
+        }
+
+        /// <summary>
+        /// 发送线程函数
+        /// </summary>
+        /// <param name="handle"></param>
+        private static void Send_thread_function(object handle)
+        {
+            if (handle == null)
+                return;
+            Communicator comm = (Communicator)handle;
+            while (!comm.mb_exit)
+            {
+                try
+                {
+                    if (!comm.mb_initialized || comm.m_socket == null)
+                        continue;
+                    lock (comm.m_send_lock)
+                    {
+                        if(comm.m_send_queue.Count > 0)
+                        {
+                            MsgStamped msg_stamped = comm.m_send_queue.Dequeue();
+                            comm.m_socket.Send(msg_stamped.msg.ToByteArray());
+                        }
+                    }
+                    //Console.WriteLine("msg sent");
+                }
+                catch (Exception ex) { Console.WriteLine(ex.StackTrace); }
+                Thread.Sleep(1);
+            }
+            Console.WriteLine("send thread exit");
+        }
+
+        /// <summary>
+        /// 解析线程函数
+        /// </summary>
+        /// <param name="handle"></param>
+        private static void Decode_thread_function(object handle)
+        {
+            if (handle == null)
+                return;
+            Communicator comm = (Communicator)handle;
+            while (!comm.mb_exit)
+            {
+                try
+                {
+                    DateTime current_time = DateTime.Now;
+
+                    if (!comm.mb_initialized)
+                        continue;
+                    MsgStamped msg_stamped = null;
+                    lock (comm.m_receive_lock)
+                    {
+                        if (comm.m_receive_queue.Count > 0)
+                        {
+                            msg_stamped = comm.m_receive_queue.Dequeue();
+                        }
+                        else
+                        {
+                            continue;
+                        }
+                        CheckExecuterReturn ret = comm.CheckExecuter(msg_stamped.header, msg_stamped.receive_time);
+                        if (ret == CheckExecuterReturn.MSG_TIMEOUT)
+                        {
+                            continue;
+                        }else if(ret == CheckExecuterReturn.EXECUTER_BUSY || ret == CheckExecuterReturn.EXECUTER_FAULT)
+                        {
+                            comm.m_receive_queue.Enqueue(msg_stamped);
+                        }else if(ret == CheckExecuterReturn.EXECUTER_READY)
+                        {
+                            comm.ExecuteMsg(msg_stamped);
+                        }
+                    }
+
+                    // 解析
+                    //comm.Decode_msg(msg_stamped.msg);
+                    //Console.WriteLine("msg parsed");
+                }
+                catch (Exception ex) { Console.WriteLine(ex.StackTrace); }
+                Thread.Sleep(1);
+            }
+            Console.WriteLine("decode thread exit");
+        }
+
+        ///// <summary>
+        ///// 解析string到protobuf消息
+        ///// </summary>
+        //private void Decode_msg(ByteString msg)
+        //{
+        //    if (msg == null)
+        //        return;
+        //    Base_msg base_msg = Base_msg.Parser.ParseFrom(msg);
+        //    switch(base_msg.BaseInfo.MsgType)
+        //    {
+        //        case Message_type.EParkspaceAllocationStatusMsg:
+        //            Parkspace_allocation_status_msg parkspace_status_msg = Parkspace_allocation_status_msg.Parser.ParseFrom(msg);
+        //            break;
+        //        case Message_type.EParkspaceForceUpdateResponseMsg:
+        //            Console.WriteLine("update response");
+        //            Parkspace_force_update_response_msg parkspace_force_update_msg = Parkspace_force_update_response_msg.Parser.ParseFrom(msg);
+        //            Console.WriteLine(parkspace_force_update_msg.ToString());
+        //            break;
+        //        case Message_type.EGroundStatusMsg:
+        //            Console.WriteLine("get ground status.....");
+        //            Ground_status_msg ground_status_msg = Ground_status_msg.Parser.ParseFrom(msg);
+        //            Console.WriteLine(ground_status_msg.ToString());
+        //            break;
+        //        default:
+        //            Console.WriteLine("unrecognized message received");
+        //            break;
+        //    }
+        //}
+
+    }
+}

+ 74 - 0
communicate_module/communication/GroundDIsplayCommuncator.cs

@@ -0,0 +1,74 @@
+using Message;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Communication
+{
+    class GroundDIsplayCommuncator : Communication.Communicator
+    {
+        protected GroundDIsplayCommuncator():base()
+        {
+        }
+
+        /// <summary>
+        /// 单例访问
+        /// </summary>
+        public new static Communicator GetInstance()
+        {
+            if (instance == null)
+            {
+                lock (lockObj)
+                {
+                    if (instance == null)
+                    {
+                        instance = new GroundDIsplayCommuncator();
+                    }
+                }
+            }
+            return instance;
+        }
+
+        /// <summary>
+        /// 检查消息
+        /// </summary>
+        /// <param name="header"></param>
+        /// <returns></returns>
+        public override bool CheckMsg(Base_info header)
+        {
+            if (header.HasMsgType && header.HasSender && header.HasTimeoutMs
+                && header.MsgType == Message_type.EGroundStatusMsg && header.Sender == Message.Communicator.EGroundMeasurer)
+                return true;
+            else
+                return false;
+        }
+
+        /// <summary>
+        /// 检查执行器状态
+        /// </summary>
+        /// <param name="header"></param>
+        /// <param name="receiveTime"></param>
+        /// <returns></returns>
+        public override CheckExecuterReturn CheckExecuter(Base_info header, DateTime receiveTime)
+        {
+            if ((DateTime.Now - receiveTime).Milliseconds > header.TimeoutMs)
+                return CheckExecuterReturn.MSG_TIMEOUT;
+            else
+                return CheckExecuterReturn.EXECUTER_READY;
+        }
+
+        /// <summary>
+        /// 执行消息
+        /// </summary>
+        /// <param name="msgStamped"></param>
+        /// <returns></returns>
+        public override bool ExecuteMsg(MsgStamped msgStamped)
+        {
+            Ground_status_msg msg = Ground_status_msg.Parser.ParseFrom(msgStamped.msg);
+            Console.WriteLine(Ground_status_msg.Parser.ParseJson(msg.ToString()));
+            return true;
+        }
+    }
+}

+ 361 - 0
communicate_module/communication/TerminalSimul.cs

@@ -0,0 +1,361 @@
+using Communication;
+using Google.Protobuf;
+using Message;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace communicate_module.communication
+{
+    class TerminalSimul : Communication.Communicator
+    {
+        protected TerminalSimul() : base()
+        {
+            map_lock = new object();
+            license_status_map = new Dictionary<string, CAR_STATUS>();
+            for (int i = 0; i < 10; i++)
+            {
+                string str = String.Format("鄂A{0:D5}", i);
+                license_status_map.Add(str, CAR_STATUS.eCAR_IDEL);
+                //Console.WriteLine(str);
+            }
+
+            park_terminal_status_map = new Dictionary<int, int>();
+            for (int i = 0; i < 6; i++)
+            {
+                park_terminal_status_map.Add(i, 0);
+            }
+
+            fetch_terminal_status_map = new Dictionary<int, int>();
+            for (int i = 0; i < 6; i++)
+            {
+                fetch_terminal_status_map.Add(i, 0);
+            }
+
+            park_license_map = new Dictionary<int, string>();
+            fetch_license_map = new Dictionary<int, string>();
+        }
+
+        /// <summary>
+        /// 单例访问
+        /// </summary>
+        public new static TerminalSimul GetInstance()
+        {
+            if (instance == null)
+            {
+                lock (lockObj)
+                {
+                    if (instance == null)
+                    {
+                        instance = new TerminalSimul();
+                    }
+                }
+            }
+            return (TerminalSimul)instance;
+        }
+
+        /// <summary>
+        /// 检查消息
+        /// </summary>
+        /// <param name="header"></param>
+        /// <returns></returns>
+        public override bool CheckMsg(Base_info header)
+        {
+            if (header.HasMsgType && header.HasSender
+                && ((header.MsgType == Message_type.EStoreCommandResponseMsg && header.Sender == Message.Communicator.EMain)
+                    || (header.MsgType == Message_type.EPickupCommandResponseMsg && header.Sender == Message.Communicator.EMain)
+                    || (header.MsgType == Message_type.EStoringProcessStatuMsg && header.Sender == Message.Communicator.EMain)
+                    || (header.MsgType == Message_type.EPickingProcessStatuMsg && header.Sender == Message.Communicator.EMain)
+                    )
+                )
+                return true;
+            else
+                return false;
+        }
+
+        /// <summary>
+        /// 检查执行器状态
+        /// </summary>
+        /// <param name="header"></param>
+        /// <param name="receiveTime"></param>
+        /// <returns></returns>
+        public override CheckExecuterReturn CheckExecuter(Base_info header, DateTime receiveTime)
+        {
+            if ((DateTime.Now - receiveTime).Milliseconds > header.TimeoutMs)
+                return CheckExecuterReturn.MSG_TIMEOUT;
+            else
+                return CheckExecuterReturn.EXECUTER_READY;
+        }
+
+        /// <summary>
+        /// 执行消息
+        /// </summary>
+        /// <param name="msgStamped"></param>
+        /// <returns></returns>
+        public override bool ExecuteMsg(MsgStamped msgStamped)
+        {
+            if (msgStamped == null || msgStamped.header==null)
+                return false;
+
+            switch(msgStamped.header.MsgType)
+            {
+                case Message_type.EStoreCommandResponseMsg:
+                    Store_command_response_msg store_Command_Response_Msg = Store_command_response_msg.Parser.ParseFrom(msgStamped.msg);
+                    Console.WriteLine("停车终端 " + store_Command_Response_Msg.TerminalId + " 签收, " + (store_Command_Response_Msg.Code.ErrorCode == 0?"成功":"失败"));
+                    break;
+                case Message_type.EPickupCommandResponseMsg:
+                    Pickup_command_response_msg pickup_Command_Response_Msg = Pickup_command_response_msg.Parser.ParseFrom(msgStamped.msg);
+                    Console.WriteLine("取车终端 " + pickup_Command_Response_Msg.TerminalId + " 签收, " + (pickup_Command_Response_Msg.Code.ErrorCode == 0 ? "成功" : "失败"));
+                    break;
+                case Message_type.EStoringProcessStatuMsg:
+                    Storing_process_statu_msg storing_Process_Statu_Msg = Storing_process_statu_msg.Parser.ParseFrom(msgStamped.msg);
+                    if (storing_Process_Statu_Msg.Completed || storing_Process_Statu_Msg.BackCompleted)
+                    {
+                        bool forward = storing_Process_Statu_Msg.Completed;
+                        lock (map_lock)
+                        {
+                            if (park_license_map.ContainsKey(storing_Process_Statu_Msg.TerminalId))
+                            {
+                                string lic = park_license_map[storing_Process_Statu_Msg.TerminalId];
+                                if (license_status_map.ContainsKey(lic))
+                                {
+                                    string whether_success = "";
+                                    if (forward)
+                                    {
+                                        // 车辆状态修改
+                                        license_status_map[lic] = CAR_STATUS.eCAR_PARKED;
+                                        whether_success = "成功";
+                                    }
+                                    else
+                                    {
+                                        license_status_map[lic] = CAR_STATUS.eCAR_IDEL;
+                                        whether_success = "失败";
+                                    }
+                                    // 停车流程结束,删除记录
+                                    park_license_map.Remove(storing_Process_Statu_Msg.TerminalId);
+                                    // 停车终端复位
+                                    park_terminal_status_map[storing_Process_Statu_Msg.TerminalId] = 0;
+                                    Console.WriteLine("停车 " + lic + " 完成, " + whether_success);
+                                }
+                            }
+                            else
+                            {
+                                //Console.WriteLine("未找到与反馈对应停车流程???");
+                            }
+                        }
+                    }
+                    break;
+                case Message_type.EPickingProcessStatuMsg:
+                    Picking_process_statu_msg picking_Process_Statu_Msg = Picking_process_statu_msg.Parser.ParseFrom(msgStamped.msg);
+                    if (picking_Process_Statu_Msg.Completed || picking_Process_Statu_Msg.BackCompleted)
+                    {
+                        bool forward = picking_Process_Statu_Msg.Completed;
+                        lock (map_lock)
+                        {
+                            if (fetch_license_map.ContainsKey(picking_Process_Statu_Msg.TerminalId))
+                            {
+                                string lic = fetch_license_map[picking_Process_Statu_Msg.TerminalId];
+                                if (license_status_map.ContainsKey(lic))
+                                {
+                                    string whether_success = "";
+                                    if (forward)
+                                    {
+                                        license_status_map[lic] = CAR_STATUS.eCAR_IDEL;
+                                        whether_success = "成功";
+                                    }
+                                    else
+                                    {
+                                        license_status_map[lic] = CAR_STATUS.eCAR_PARKED;
+                                        whether_success = "失败";
+                                    }
+                                    fetch_license_map.Remove(picking_Process_Statu_Msg.TerminalId);
+                                    fetch_terminal_status_map[picking_Process_Statu_Msg.TerminalId] = 0;
+                                    Console.WriteLine("取车 " + lic + " 完成, " + whether_success);
+                                }
+                            }
+                            else
+                            {
+                                //Console.WriteLine("未找到与反馈对应取车流程???");
+                            }
+                        }
+                    }
+                    break;
+            }
+            return true;
+        }
+
+        /// <summary>
+        /// 模拟终端与主控发送消息
+        /// </summary>
+        public void CreateSimulThread()
+        {
+            Task.Factory.StartNew(()=> {
+                Random rnd = new Random();
+                while(!mb_exit)
+                {
+                    int act = rnd.Next(1, 4);
+                    lock (map_lock) {
+                        switch (act)
+                        {
+                            // 停车
+                            case 1:
+                                // 找一辆空闲车发送停车指令
+                                string park_lic = "";
+                                KeyValuePair<string, CAR_STATUS> t_park_lic_pair;
+                                for (int i = 0; i < license_status_map.Count; i++)
+                                {
+                                    t_park_lic_pair = license_status_map.ElementAt(i);
+                                    if (t_park_lic_pair.Value == CAR_STATUS.eCAR_IDEL)
+                                    {
+                                        park_lic = t_park_lic_pair.Key;
+                                        break;
+                                    }
+                                }
+                                if(park_lic != "")
+                                {
+                                    Store_command_request_msg t_store_req = new Store_command_request_msg();
+                                    t_store_req.BaseInfo = new Base_info();
+                                    t_store_req.BaseInfo.MsgType = Message_type.EStoreCommandRequestMsg;
+                                    t_store_req.BaseInfo.TimeoutMs = 5000;
+                                    t_store_req.BaseInfo.Sender = Message.Communicator.ETerminor;
+                                    t_store_req.BaseInfo.Receiver = Message.Communicator.EMain;
+                                    // 寻找空闲终端
+                                    int termId = GetParkTerminalId();
+                                    if(termId>=0)
+                                    {
+                                        t_store_req.TerminalId = termId;
+                                        t_store_req.LocateInformation = new Locate_information();
+                                        t_store_req.LocateInformation.LocateX = 0.01f;
+                                        t_store_req.LocateInformation.LocateY = 0.01f;
+                                        t_store_req.LocateInformation.LocateAngle = 90.5f;
+                                        t_store_req.LocateInformation.LocateLength = 0f;
+                                        t_store_req.LocateInformation.LocateWidth = 0f;
+                                        t_store_req.LocateInformation.LocateHeight = 0f;
+                                        t_store_req.LocateInformation.LocateWheelBase = 2.64f;
+                                        t_store_req.LocateInformation.LocateWheelWidth = 1.65f;
+                                        t_store_req.LocateInformation.LocateCorrect = true;
+                                        t_store_req.LocateInformation.LocateFrontTheta = 0f;
+                                        t_store_req.CarInfo = new Car_info();
+                                        t_store_req.CarInfo.License = park_lic;
+                                        t_store_req.CarInfo.CarHeight = 1.7f;
+                                        t_store_req.CarInfo.CarWheelWidth = t_store_req.LocateInformation.LocateWheelWidth;
+                                        t_store_req.CarInfo.CarWheelBase = t_store_req.LocateInformation.LocateWheelBase;
+                                        // 发送停车指令
+                                        Console.WriteLine("停车 "+park_lic);
+                                        Send_msg(t_store_req.ToByteString());
+                                        license_status_map[park_lic] = CAR_STATUS.eCAR_PARKING;
+                                        park_license_map.Add(termId, park_lic);
+                                    }
+                                }
+                                break;
+                            // 取车
+                            case 2:
+                                // 找一辆占用车发送取车指令
+                                string fetch_lic = "";
+                                KeyValuePair<string, CAR_STATUS> t_fetch_lic_pair;
+                                for (int i = 0; i < license_status_map.Count; i++)
+                                {
+                                    t_fetch_lic_pair = license_status_map.ElementAt(i);
+                                    if (t_fetch_lic_pair.Value == CAR_STATUS.eCAR_PARKED)
+                                    {
+                                        fetch_lic = t_fetch_lic_pair.Key;
+                                        break;
+                                    }
+                                }
+                                if(fetch_lic!="")
+                                {
+                                    Pickup_command_request_msg pick_req = new Pickup_command_request_msg();
+                                    pick_req.BaseInfo = new Base_info();
+                                    pick_req.BaseInfo.MsgType = Message_type.EPickupCommandRequestMsg;
+                                    pick_req.BaseInfo.TimeoutMs = 5000;
+                                    pick_req.BaseInfo.Sender = Message.Communicator.ETerminor;
+                                    pick_req.BaseInfo.Receiver = Message.Communicator.EMain;
+                                    // 寻找空闲终端
+                                    int termId = GetFetchTerminalId();
+                                    if(termId >=0)
+                                    {
+                                        pick_req.TerminalId = termId;
+                                        pick_req.CarInfo = new Car_info();
+                                        pick_req.CarInfo.License = fetch_lic;
+                                        // 发送取车指令
+                                        Console.WriteLine("取车 " + fetch_lic);
+                                        Send_msg(pick_req.ToByteString());
+                                        license_status_map[fetch_lic] = CAR_STATUS.eCAR_FETCHING;
+                                        fetch_license_map.Add(termId, fetch_lic);
+                                    }
+                                }
+                                break;
+                            // 不处理
+                            case 3:
+                                break;
+                        }
+                        
+                    }
+                    Thread.Sleep(2000);
+                }
+            });
+        }
+
+        protected int GetParkTerminalId()
+        {
+            int termId = -1;
+            KeyValuePair<int, int> t_res;
+            for (int i = 0; i < park_terminal_status_map.Count; i++)
+            {
+                t_res = park_terminal_status_map.ElementAt(i);
+                // 停取终端同时空闲
+                if (t_res.Value == 0)
+                {
+                    termId = t_res.Key;
+                    break;
+                }
+            }
+            if(termId>=0)
+                park_terminal_status_map[termId] = 1;
+            return termId;
+        }
+
+        protected int GetFetchTerminalId()
+        {
+            int termId = -1;
+            KeyValuePair<int, int> t_res;
+            for (int i = 0; i < fetch_terminal_status_map.Count; i++)
+            {
+                t_res = fetch_terminal_status_map.ElementAt(i);
+                if (t_res.Value == 0)
+                {
+                    termId = t_res.Key;
+                    break;
+                }
+            }
+            if (termId >= 0)
+                fetch_terminal_status_map[termId] = 1;
+            return termId;
+        }
+
+        public enum CAR_STATUS
+        {
+            eCAR_IDEL,
+            eCAR_PARKED,
+            eCAR_PARKING,
+            eCAR_FETCHING,
+        }
+
+        protected object map_lock;
+        // 车辆状态表
+        protected Dictionary<string, CAR_STATUS> license_status_map;
+        // 记录停车终端当前号牌
+        protected Dictionary<int, string> park_license_map;
+        // 记录取车终端当前号牌
+        protected Dictionary<int, string> fetch_license_map;
+
+
+        // 0空闲,非零占用
+        protected Dictionary<int, int> park_terminal_status_map;
+        // 0空闲,非零占用
+        protected Dictionary<int, int> fetch_terminal_status_map;
+    }
+}

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 3987 - 0
communicate_module/message/MeasureMessage.cs


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 3522 - 0
communicate_module/message/MessageBase.cs


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 4336 - 0
communicate_module/message/ParkspaceAllocationMessage.cs


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 7190 - 0
communicate_module/message/ProcessMessage.cs


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1250 - 0
communicate_module/message/TerminalMessage.cs


+ 209 - 0
communicate_module/message/dispatch_control.proto

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

+ 316 - 0
communicate_module/message/dispatch_message.proto

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

+ 189 - 0
communicate_module/message/measure_message.proto

@@ -0,0 +1,189 @@
+syntax = "proto2";
+package message;
+import "message_base.proto";
+
+//雷达管理模块的工作状态
+enum Laser_manager_status
+{
+    LASER_MANAGER_UNKNOW               	= 0;    //未知
+    LASER_MANAGER_READY               	= 1;    //准备,待机
+	LASER_MANAGER_ISSUED_TASK			= 2;	//工作下发任务
+	LASER_MANAGER_WAIT_REPLY			= 3;	//工作等待答复
+	LASER_MANAGER_FAULT					= 4;	//故障
+}
+	
+//子雷达状态
+enum Laser_statu
+{
+	LASER_DISCONNECT	=0;	        //雷达断连
+	LASER_READY			=1;			//雷达正常待机,空闲
+	LASER_BUSY			=2;	        //雷达正在工作,正忙
+	LASER_FAULT			=3;         //雷达错误
+}
+
+//定位管理模块的工作状态
+enum Locate_manager_status
+{
+	LOCATE_MANAGER_UNKNOW               	= 0;    //未知
+	LOCATE_MANAGER_READY               		= 1;    //准备,待机
+	LOCATE_MANAGER_SIFT						= 2;	//sift点云筛选; 将车身和轮胎的点剥离出来
+	LOCATE_MANAGER_CAR						= 3;	//通过车身 计算汽车的定位信息.
+	LOCATE_MANAGER_WHEEL					= 4;	//通过车轮 计算汽车的定位信息.
+	LOCATE_MANAGER_FAULT					= 5;	//故障
+}
+	
+
+//雷达管理的状态
+enum Wanji_manager_status
+{
+	WANJI_MANAGER_UNKNOWN              	= 0;    //未知
+	WANJI_MANAGER_READY               	= 1;    //准备,待机
+	WANJI_MANAGER_BUSY					= 2; 	//工作正忙
+
+	WANJI_MANAGER_ISSUED_SCAN			= 3; 	//下发任务; 获取点云
+	WANJI_MANAGER_WAIT_SCAN				= 4;	//等待任务; 扫描点云
+
+	WANJI_MANAGER_ISSUED_DETECT			= 5; 	//下发任务; 算法预测
+	WANJI_MANAGER_WAIT_DETECT			= 6; 	//等待任务; 算法预测
+
+	WANJI_MANAGER_FAULT					= 10;	//故障
+}
+
+//万集设备身状态
+enum Wanji_lidar_device_status
+{
+	WANJI_LIDAR_DEVICE_UNKNOWN              	= 0;    //未知
+	WANJI_LIDAR_DEVICE_READY	             	= 1;    //正常待机
+	WANJI_LIDAR_DEVICE_DISCONNECT			= 2;	//断连
+
+	WANJI_LIDAR_DEVICE_BUSY					= 3; 	//工作正忙
+
+	WANJI_LIDAR_DEVICE_FAULT					=10;	//故障
+}
+
+//万集区域功能的状态
+enum Region_worker_status
+{
+	REGION_WORKER_UNKNOWN              	= 0;    //未知
+	REGION_WORKER_READY               	= 1;    //准备,待机
+	REGION_WORKER_BUSY					= 2; 	//工作正忙
+
+	REGION_WORKER_FAULT					= 10;	//故障
+}
+
+//定位模块状态
+message Measure_status_msg
+{
+    required Base_info                  base_info=1;                 //消息类型
+    required int32                      terminal_id=2;
+
+    required Laser_manager_status       laser_manager_status = 3;       //大疆管理状态
+    repeated Laser_statu                laser_statu_vector = 4;         //大疆雷达设备状态
+    required Locate_manager_status      locate_manager_status = 5;      //大疆定位算法状态
+
+    required Wanji_manager_status       wanji_manager_status = 6;       //万集管理状态
+    repeated Wanji_lidar_device_status  wanji_lidar_device_status = 7;  //万集设备身状态
+    repeated Region_worker_status       region_worker_status = 8;       //万集区域功能的状态
+    repeated Locate_information         locate_information_realtime = 9;//地面雷达的 实时定位信息
+
+    required Error_manager              error_manager = 10;
+}
+
+
+//定位请求消息
+message Measure_request_msg
+{
+    required Base_info                  base_info=1;        //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+    required int32                      terminal_id=3;          //终端id
+}
+
+//定位测量返回消息
+message Measure_response_msg
+{
+    required Base_info                  base_info=1;                         //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+    required int32                      terminal_id=3;
+
+    optional Locate_information         locate_information=4;
+    required Error_manager              error_manager = 5;
+}
+
+//地面测量请求消息
+message Ground_detect_request_msg
+{
+    required Base_info                  base_info=1;        //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+    required int32                      terminal_id=3;          //终端id
+}
+
+//地面测量反馈消息
+message Ground_detect_response_msg
+{
+    required Base_info                  base_info=1;                     //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+    required int32                      terminal_id=3;
+
+    optional Locate_information         locate_information=4;
+    required Error_manager              error_manager = 5;
+}
+
+// 电子围栏状态
+enum Ground_statu
+{
+    Nothing=0;
+    Noise=1;
+    Car_correct=2;
+    Car_left_out=3;
+    Car_right_out=4;
+    Car_top_out=5;
+    Car_bottom_out=6;
+}
+
+message Ground_status_msg
+{
+    required Base_info                  base_info=1;                 //消息类型
+    required int32                      terminal_id=2;
+
+    required Wanji_manager_status       wanji_manager_status = 3;       //万集管理状态
+    repeated Wanji_lidar_device_status  wanji_lidar_device_status = 4;  //万集设备身状态
+    required Region_worker_status       region_worker_status = 5;       //万集区域功能的状态
+    required Locate_information         locate_information_realtime = 6;//地面雷达的 实时定位信息
+    required Ground_statu               ground_status=7; // 电子围栏状态
+
+    required Error_manager              error_manager = 8;
+}
+
+//点云坐标
+message Cloud_coordinate
+{
+    required float                      x=1;
+    required float                      y=2;
+    required float                      z=3;
+}
+//点云类型
+message Cloud_type
+{
+    required int32                      type=1;
+}
+
+//筛选点云; 请求消息
+message Locate_sift_request_msg
+{
+    required Base_info                  base_info=1;            //消息类型
+    required string                     command_key=2;          //指令唯一标识符id
+    required int32                      terminal_id=3;          //终端id
+    required int32                      lidar_id=4;             //雷达id
+    repeated Cloud_coordinate           cloud_coordinates=5;     //点云坐标
+}
+
+//筛选点云; 答复消息
+message Locate_sift_response_msg
+{
+    required Base_info                  base_info=1;            //消息类型
+    required string                     command_key=2;          //指令唯一标识符id
+    required int32                      terminal_id=3;          //终端id
+    required int32                      lidar_id=4;             //雷达id
+    repeated Cloud_type                 cloud_type=5;            //点云类型
+    required Error_manager              error_manager = 6;      //错误码
+}

+ 290 - 0
communicate_module/message/message_base.proto

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

+ 153 - 0
communicate_module/message/parkspace_allocation_message.proto

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

+ 183 - 0
communicate_module/message/process_message.proto

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

+ 36 - 0
communicate_module/message/terminal_message.proto

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

+ 9 - 0
communicate_module/packages.config

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="Google.Protobuf" version="3.17.3" targetFramework="net45" />
+  <package id="Google.Protobuf.Tools" version="3.17.2" targetFramework="net45" />
+  <package id="NNanomsg" version="0.5.2" targetFramework="net45" />
+  <package id="System.Buffers" version="4.5.1" targetFramework="net45" />
+  <package id="System.Memory" version="4.5.4" targetFramework="net45" />
+  <package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net45" />
+</packages>

+ 5 - 0
communicate_module/proto.bat

@@ -0,0 +1,5 @@
+..\packages\Google.Protobuf.Tools.3.17.2\tools\windows_x64\protoc.exe --proto_path=.\message\ message_base.proto --csharp_out=.\message
+..\packages\Google.Protobuf.Tools.3.17.2\tools\windows_x64\protoc.exe --proto_path=.\message\ parkspace_allocation_message.proto --csharp_out=.\message
+..\packages\Google.Protobuf.Tools.3.17.2\tools\windows_x64\protoc.exe --proto_path=.\message\ measure_message.proto --csharp_out=.\message
+..\packages\Google.Protobuf.Tools.3.17.2\tools\windows_x64\protoc.exe --proto_path=.\message\ terminal_message.proto --csharp_out=.\message
+..\packages\Google.Protobuf.Tools.3.17.2\tools\windows_x64\protoc.exe --proto_path=.\message\ process_message.proto --csharp_out=.\message

BIN
communicate_module/x64/libnanomsg.so


BIN
communicate_module/x64/nanomsg.dll


BIN
communicate_module/x86/libnanomsg.so


BIN
communicate_module/x86/nanomsg.dll


+ 1 - 1
parkspace_manager/App.config

@@ -5,6 +5,6 @@
     </startup>
   <appSettings>
     <!--日志写入地址配置文件-->
-    <add key="LogAddress" value="c:\\c#workspace\\LogDemo\\LoggerTest" />
+    <add key="LogAddress" value="E:\\yct\\chutian_modules\\LogDemo\\LoggerTest" />
   </appSettings>
 </configuration>

+ 15 - 0
parkspace_manager/FormParkSpaceStatus.Designer.cs

@@ -36,6 +36,7 @@
             this.btn_reserved = new System.Windows.Forms.Button();
             this.btn_occupied = new System.Windows.Forms.Button();
             this.btn_empty = new System.Windows.Forms.Button();
+            this.btn_clear = new System.Windows.Forms.Button();
             this.parkspaceStatusSamplePanel.SuspendLayout();
             this.SuspendLayout();
             // 
@@ -49,6 +50,7 @@
             // 
             // parkspaceStatusSamplePanel
             // 
+            this.parkspaceStatusSamplePanel.Controls.Add(this.btn_clear);
             this.parkspaceStatusSamplePanel.Controls.Add(this.btn_unknown);
             this.parkspaceStatusSamplePanel.Controls.Add(this.btn_error);
             this.parkspaceStatusSamplePanel.Controls.Add(this.btn_locked);
@@ -121,6 +123,18 @@
             this.btn_empty.Text = "空闲";
             this.btn_empty.UseVisualStyleBackColor = false;
             // 
+            // btn_clear
+            // 
+            this.btn_clear.BackColor = System.Drawing.Color.Orange;
+            this.btn_clear.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.btn_clear.Location = new System.Drawing.Point(1187, 22);
+            this.btn_clear.Name = "btn_clear";
+            this.btn_clear.Size = new System.Drawing.Size(133, 33);
+            this.btn_clear.TabIndex = 6;
+            this.btn_clear.Text = "一键清除";
+            this.btn_clear.UseVisualStyleBackColor = false;
+            this.btn_clear.Click += new System.EventHandler(this.btn_clear_Click);
+            // 
             // FormParkSpaceStatus
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
@@ -147,5 +161,6 @@
         private System.Windows.Forms.Button btn_locked;
         private System.Windows.Forms.Button btn_error;
         private System.Windows.Forms.Button btn_unknown;
+        private System.Windows.Forms.Button btn_clear;
     }
 }

+ 69 - 53
parkspace_manager/FormParkSpaceStatus.cs

@@ -16,8 +16,8 @@ namespace parkspace_manager
 {
     public partial class FormParkSpaceStatus : Form
     {
-        public static int s_spacesInRow = 15;
-        public static int s_floors = 11;
+        public static int s_spacesInRow = 18;
+        public static int s_floors = 13;
         public static int s_rows = 1;
         public static bool s_isClosing;
         private static object s_map_update_lock;
@@ -28,47 +28,31 @@ namespace parkspace_manager
         /// </summary>
         private Dictionary<int, Parkspace_info> m_idPssMap;
         /// <summary>
-        /// 提示信息管理器
-        /// </summary>
-        private ToolTip m_toolTip_parkspace_info;
-        ///// <summary>
-        ///// 按钮与对应提示信息映射
-        ///// </summary>
-        //private Dictionary<Button, ToolTip> m_btnToolTipMap;
-        /// <summary>
         /// 强制更新反馈消息队列,用于处理同时收到多个反馈消息的情况
         /// </summary>
         private Queue<Parkspace_force_update_response_msg> m_parkspace_force_update_response_queue;
         /// <summary>
         /// 当前所有车位状态,由界面更新线程主动更新
         /// </summary>
-        Parkspace_allocation_status_msg m_parkspace_status;
+        Parkspace_allocation_data_msg m_parkspace_status;
         Thread m_update_display_thread;
 
         public FormParkSpaceStatus()
         {
-            m_parkspace_status = new Parkspace_allocation_status_msg();
+            m_parkspace_status = new Parkspace_allocation_data_msg();
             s_map_update_lock = new object();
             s_parkspace_force_update_queue_lock = new object();
             s_parkspace_status_lock = new object();
             m_parkspace_force_update_response_queue = new Queue<Parkspace_force_update_response_msg>();
             m_idPssMap = new Dictionary<int, Parkspace_info>();
-
-            m_toolTip_parkspace_info = new ToolTip();
-            // 设置显示样式
-            m_toolTip_parkspace_info.AutoPopDelay = 20000;//提示信息的可见时间
-            m_toolTip_parkspace_info.InitialDelay = 500;//事件触发多久后出现提示
-            m_toolTip_parkspace_info.ReshowDelay = 500;//指针从一个控件移向另一个控件时,经过多久才会显示下一个提示框
-            m_toolTip_parkspace_info.ShowAlways = false;//是否显示提示框
-
-            //m_btnToolTipMap = new Dictionary<Button, ToolTip>();
             s_isClosing = false;
 
             InitializeComponent();
 
             Communicator.Instance.Init();
-            Communicator.Instance.Bind("tcp://192.168.2.144:20000");
-            Communicator.Instance.Connect("tcp://192.168.2.125:20000");
+            Communicator.Instance.Bind("tcp://192.168.2.154:12333");
+            Communicator.Instance.Connect("tcp://192.168.2.127:30008");
+            Communicator.Instance.Connect("tcp://192.168.2.127:30000");
             Communicator.Instance.SetParkspaceForceUpdateResponseDelegate(ParkspaceForceUpdateResponseCallback);
 
             // 库位显示
@@ -114,7 +98,7 @@ namespace parkspace_manager
                 bool get_status_result = Communicator.Instance.Get_parkspace_status(ref m_parkspace_status);
                 lock (s_parkspace_status_lock)
                 {
-                    if (get_status_result && (m_parkspace_status == null || m_parkspace_status.ParkspaceInfo == null))
+                    if (get_status_result && (m_parkspace_status == null || m_parkspace_status.ParkspaceInfoEx == null))
                     {
                         get_status_result = false;
                     }
@@ -131,7 +115,7 @@ namespace parkspace_manager
                 {
                     lock (s_parkspace_status_lock)
                     {
-                        psList = m_parkspace_status.ParkspaceInfo.ToList();
+                        psList = m_parkspace_status.ParkspaceInfoEx.ToList();
                     }
                 }
                 if (psList == null || psList.Count <= 0)
@@ -149,14 +133,14 @@ namespace parkspace_manager
                             m_idPssMap.Clear();
                             for (int i = 0; i < psList.Count; i++)
                             {
-                                m_idPssMap.Add(psList[i].ParkspaceId, psList[i]);
+                                m_idPssMap.Add(psList[i].ParkingspaceIndexId, psList[i]);
                             }
                         }
                         else
                         {
                             for (int i = 0; i < psList.Count; i++)
                             {
-                                m_idPssMap[psList[i].ParkspaceId] = psList[i];
+                                m_idPssMap[psList[i].ParkingspaceIndexId] = psList[i];
                             }
                         }
                     }
@@ -211,8 +195,8 @@ namespace parkspace_manager
                                     {
                                         try
                                         {
-                                            btn.Text = "车位" + psList[j].ParkspaceId;
-                                            btn.BackColor = GetPSColor(psList[j].ParkspaceStatus);
+                                            btn.Text = "车位" + psList[j].ParkingspaceIndexId;
+                                            btn.BackColor = GetPSColor(psList[j].ParkingspaceStatus);
                                             temp.Controls.Add(btn);
                                         }
                                         catch { Log.WriteLog(LogType.process, LogFile.WARNING, "实时更新单一库位异常"); }
@@ -250,7 +234,7 @@ namespace parkspace_manager
                                             if (m_idPssMap.ContainsKey(index))
                                             {
                                                 //Console.WriteLine("index:" + index+", status:"+ idPssMap[index].spaceStatus);
-                                                space.BackColor = GetPSColor(m_idPssMap[index].ParkspaceStatus);
+                                                space.BackColor = GetPSColor(m_idPssMap[index].ParkingspaceStatus);
                                             }
                                             else if (result)
                                             {
@@ -296,28 +280,26 @@ namespace parkspace_manager
         {
             Button btn = (Button)sender;
             // 创建the ToolTip 
-            if (m_toolTip_parkspace_info == null)
-            {
-                m_toolTip_parkspace_info = new ToolTip();
-                // 设置显示样式
-                m_toolTip_parkspace_info.AutoPopDelay = 20000;//提示信息的可见时间
-                m_toolTip_parkspace_info.InitialDelay = 500;//事件触发多久后出现提示
-                m_toolTip_parkspace_info.ReshowDelay = 500;//指针从一个控件移向另一个控件时,经过多久才会显示下一个提示框
-                m_toolTip_parkspace_info.ShowAlways = false;//是否显示提示框
-            }
+            ToolTip toolTip_parkspace_info = new ToolTip();
+
+            // 设置显示样式
+            toolTip_parkspace_info.AutoPopDelay = 20000;//提示信息的可见时间
+            toolTip_parkspace_info.InitialDelay = 500;//事件触发多久后出现提示
+            toolTip_parkspace_info.ReshowDelay = 1000;//指针从一个控件移向另一个控件时,经过多久才会显示下一个提示框
+            toolTip_parkspace_info.ShowAlways = false;//是否显示提示框
 
             // 获取车位信息,处理后显示
             int parkspaceID = GetParkspaceIdFromButton(btn);
             Parkspace_info space_info = null;
             lock (s_parkspace_status_lock)
             {
-                if (parkspaceID <= 0 || m_parkspace_status == null || m_parkspace_status.ParkspaceInfo == null)
+                if (parkspaceID <= 0 || m_parkspace_status == null || m_parkspace_status.ParkspaceInfoEx == null)
                     return;
-                for (int i = 0; i < m_parkspace_status.ParkspaceInfo.Count; i++)
+                for (int i = 0; i < m_parkspace_status.ParkspaceInfoEx.Count; i++)
                 {
-                    if (m_parkspace_status.ParkspaceInfo[i].ParkspaceId == parkspaceID)
+                    if (m_parkspace_status.ParkspaceInfoEx[i].ParkingspaceIndexId == parkspaceID)
                     {
-                        space_info = m_parkspace_status.ParkspaceInfo[i];
+                        space_info = m_parkspace_status.ParkspaceInfoEx[i];
                         break;
                     }
                 }
@@ -325,7 +307,7 @@ namespace parkspace_manager
             if (space_info == null)
                 return;
             //  设置伴随的对象
-            m_toolTip_parkspace_info.SetToolTip(btn, space_info.ToString().Replace(",", "\n"));//设置提示按钮和提示内容
+            toolTip_parkspace_info.SetToolTip(btn, space_info.ToString().Replace(",", "\n"));//设置提示按钮和提示内容
         }
 
         /// <summary>
@@ -337,17 +319,24 @@ namespace parkspace_manager
             int parkspaceID = GetParkspaceIdFromButton(btn);
             lock(s_parkspace_status_lock)
             {
-                if (parkspaceID <= 0 || m_parkspace_status == null || m_parkspace_status.ParkspaceInfo == null)
+                if (parkspaceID <= 0 || m_parkspace_status == null || m_parkspace_status.ParkspaceInfoEx == null)
                     return;
             }
+            SendAndReceive(status, parkspaceID);
+        }
 
+        /// <summary>
+        /// 发送后接收对应反馈消息
+        /// </summary>
+        private void SendAndReceive(Parkspace_status status, int parkspaceID)
+        {
             // 遍历强制更新反馈队列,清除对应车位已存在的反馈消息,即将非对应车位的消息放回队列
             lock (s_parkspace_force_update_queue_lock)
             {
                 for (int i = 0; i < m_parkspace_force_update_response_queue.Count; i++)
                 {
                     Parkspace_force_update_response_msg response = m_parkspace_force_update_response_queue.Dequeue();
-                    if (response.UpdateSpaceInfo != null && response.UpdateSpaceInfo.ParkspaceId != parkspaceID)
+                    if (response.ManualParkspaceInfoEx != null && response.ManualParkspaceInfoEx.Count > 0 && response.ManualParkspaceInfoEx[0].ParkingspaceIndexId != parkspaceID)
                     {
                         m_parkspace_force_update_response_queue.Enqueue(response);
                     }
@@ -357,12 +346,25 @@ namespace parkspace_manager
             Parkspace_info space_info = null;
             lock (s_parkspace_status_lock)
             {
-                for (int i = 0; i < m_parkspace_status.ParkspaceInfo.Count; i++)
+                //用于清除所有车位状态的特殊指令
+                if (parkspaceID == 9999)
                 {
-                    if (m_parkspace_status.ParkspaceInfo[i].ParkspaceId == parkspaceID)
+                    space_info = new Parkspace_info();
+                    if (m_parkspace_status.ParkspaceInfoEx.Count() > 0)
                     {
-                        space_info = m_parkspace_status.ParkspaceInfo[i];
-                        break;
+                        space_info = m_parkspace_status.ParkspaceInfoEx[0];
+                    }
+                    space_info.ParkingspaceIndexId = 9999;
+                }
+                else
+                {
+                    for (int i = 0; i < m_parkspace_status.ParkspaceInfoEx.Count; i++)
+                    {
+                        if (m_parkspace_status.ParkspaceInfoEx[i].ParkingspaceIndexId == parkspaceID)
+                        {
+                            space_info = m_parkspace_status.ParkspaceInfoEx[i];
+                            break;
+                        }
                     }
                 }
             }
@@ -370,7 +372,7 @@ namespace parkspace_manager
             string commandKey = startTime.ToString("yyyy-MM-dd_HH:mm:ss:ffff");
             try
             {
-                space_info.ParkspaceStatus = status;
+                space_info.ParkingspaceStatus = status;
                 Parkspace_force_update_request_msg parkspace_force_update_request_msg = new Parkspace_force_update_request_msg();
                 Base_info base_Info = new Base_info();
                 base_Info.MsgType = Message_type.EParkspaceForceUpdateRequestMsg;
@@ -379,7 +381,7 @@ namespace parkspace_manager
                 base_Info.Receiver = Message.Communicator.EParkspace;
                 parkspace_force_update_request_msg.BaseInfo = base_Info;
                 parkspace_force_update_request_msg.CommandKey = commandKey;
-                parkspace_force_update_request_msg.UpdateSpaceInfo = space_info;
+                parkspace_force_update_request_msg.ManualParkspaceInfoEx.Add(space_info);
                 Communicator.Instance.Send_msg(parkspace_force_update_request_msg.ToByteString());
             }
             catch (Exception ex) { Console.WriteLine(ex.StackTrace); }
@@ -393,7 +395,7 @@ namespace parkspace_manager
                     for (int i = 0; i < m_parkspace_force_update_response_queue.Count; i++)
                     {
                         Parkspace_force_update_response_msg response = m_parkspace_force_update_response_queue.Dequeue();
-                        if (response.UpdateSpaceInfo != null && response.CommandKey == commandKey && response.UpdateSpaceInfo.ParkspaceId == parkspaceID)
+                        if (response.ManualParkspaceInfoEx != null && response.ManualParkspaceInfoEx.Count > 0 && response.CommandKey == commandKey && response.ManualParkspaceInfoEx[0].ParkingspaceIndexId== parkspaceID)
                         {
                             get_result = true;
                             if (response.ErrorManager != null)
@@ -416,6 +418,10 @@ namespace parkspace_manager
                     break;
                 Thread.Sleep(50);
             }
+            if (!get_result && space_info != null)
+            {
+                MessageBox.Show("force update get response timeout: " + space_info.ToString());
+            }
         }
 
         /// <summary>
@@ -480,5 +486,15 @@ namespace parkspace_manager
             ////}
             //Communicator.Instance.Uninit();
         }
+
+        /// <summary>
+        /// 一键清除所有号牌,车位全部设置空闲,调试用
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void btn_clear_Click(object sender, EventArgs e)
+        {
+            SendAndReceive(Parkspace_status.EParkspaceEmpty, 9999);
+        }
     }
 }

+ 10 - 4
parkspace_manager/FormStatusSelect.Designer.cs

@@ -36,8 +36,9 @@
             // btn_confirm
             // 
             this.btn_confirm.Location = new System.Drawing.Point(13, 126);
+            this.btn_confirm.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btn_confirm.Name = "btn_confirm";
-            this.btn_confirm.Size = new System.Drawing.Size(88, 37);
+            this.btn_confirm.Size = new System.Drawing.Size(88, 38);
             this.btn_confirm.TabIndex = 0;
             this.btn_confirm.Text = "确定";
             this.btn_confirm.UseVisualStyleBackColor = true;
@@ -45,9 +46,10 @@
             // 
             // btn_cancel
             // 
-            this.btn_cancel.Location = new System.Drawing.Point(122, 125);
+            this.btn_cancel.Location = new System.Drawing.Point(125, 126);
+            this.btn_cancel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btn_cancel.Name = "btn_cancel";
-            this.btn_cancel.Size = new System.Drawing.Size(88, 37);
+            this.btn_cancel.Size = new System.Drawing.Size(88, 38);
             this.btn_cancel.TabIndex = 1;
             this.btn_cancel.Text = "取消";
             this.btn_cancel.UseVisualStyleBackColor = true;
@@ -65,18 +67,22 @@
             "锁定",
             "故障"});
             this.listBox_status.Location = new System.Drawing.Point(25, 12);
+            this.listBox_status.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.listBox_status.Name = "listBox_status";
             this.listBox_status.Size = new System.Drawing.Size(169, 104);
             this.listBox_status.TabIndex = 2;
+            this.listBox_status.SelectedIndexChanged += new System.EventHandler(this.listBox_status_SelectedIndexChanged);
             // 
             // FormStatusSelect
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(228, 181);
+            this.ClientSize = new System.Drawing.Size(231, 175);
             this.Controls.Add(this.listBox_status);
             this.Controls.Add(this.btn_cancel);
             this.Controls.Add(this.btn_confirm);
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
+            this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.Name = "FormStatusSelect";
             this.ShowInTaskbar = false;
             this.Text = "FormStatusSelect";

+ 13 - 0
parkspace_manager/FormStatusSelect.cs

@@ -101,5 +101,18 @@ namespace parkspace_manager
         {
             Close();
         }
+
+        private void listBox_status_SelectedIndexChanged(object sender, EventArgs e)
+        {
+            Task.Factory.StartNew(() => {
+                this.Invoke(new Action(() => {
+                    Index2status(listBox_status.SelectedIndex);
+                    m_set_status_callback?.Invoke(m_selected_status, m_linked_btn);
+                    Close();
+                }));
+            });
+            btn_confirm.Enabled = false;
+            btn_cancel.Enabled = false;
+        }
     }
 }

+ 27 - 9
parkspace_manager/communication/Communicator.cs

@@ -14,7 +14,7 @@ namespace parkspace_manager
     class Communicator
     {
         // 各类消息委托,收到对应消息即调用对应委托/回调
-        public delegate void parkspaceStatusDelegate(Parkspace_allocation_status_msg parkspace_status);
+        public delegate void parkspaceStatusDelegate(Parkspace_allocation_data_msg parkspace_status);
         public delegate void parkspaceForceUpdateResponseDelegate(Parkspace_force_update_response_msg response);
         // 对应委托/回调句柄
         private parkspaceStatusDelegate m_parkspaceStatusCallback;
@@ -56,7 +56,7 @@ namespace parkspace_manager
         /// <summary>
         /// 车位消息队列
         /// </summary>
-        private Parkspace_allocation_status_msg m_parkspace_current_status;
+        private Parkspace_allocation_data_msg m_parkspace_current_status;
         /// <summary>
         /// 当前时间
         /// </summary>
@@ -112,7 +112,7 @@ namespace parkspace_manager
             m_parkspace_status_access_lock = new object();
             m_receive_queue = new Queue<ByteString>();
             m_send_queue = new Queue<ByteString>();
-            m_parkspace_current_status = new Parkspace_allocation_status_msg();
+            m_parkspace_current_status = new Parkspace_allocation_data_msg();
             nanomsgEndpoints_queue = new Queue<NanomsgEndpoint>();
         }
 
@@ -176,6 +176,21 @@ namespace parkspace_manager
                     m_thread_decode_receive.Start(this);
                     // 设置车位状态回调
                     SetParkspaceStatusDelegate(ParkspaceStatusUpdate);
+
+                    // 设置车位刷新线程
+                    Task.Factory.StartNew(()=> {
+                        while (!mb_exit)
+                        {
+                            Parkspace_refresh_request_msg t_refresh_req = new Parkspace_refresh_request_msg();
+                            t_refresh_req.BaseInfo = new Base_info();
+                            t_refresh_req.BaseInfo.MsgType = Message_type.EParkspaceAllocationDataMsg;
+                            t_refresh_req.BaseInfo.TimeoutMs = 5000;
+                            t_refresh_req.BaseInfo.Sender = Message.Communicator.EEmpty;
+                            t_refresh_req.BaseInfo.Receiver = Message.Communicator.EParkspace;
+                            Send_msg(t_refresh_req.ToByteString());
+                            Thread.Sleep(1000 * 5);
+                        }
+                    });
                     return true;
                 }
                 else
@@ -222,6 +237,7 @@ namespace parkspace_manager
             if (m_socket == null)
                 return false;
             NanomsgEndpoint end_point = m_socket.Connect(server_address);
+            nanomsgEndpoints_queue.Enqueue(end_point);
             return true;
         }
 
@@ -235,6 +251,7 @@ namespace parkspace_manager
             if (m_socket == null)
                 return false;
             NanomsgEndpoint end_point = m_socket.Bind(self_address);
+            nanomsgEndpoints_queue.Enqueue(end_point);
             return true;
         }
 
@@ -242,7 +259,7 @@ namespace parkspace_manager
         /// 车位更新回调内部定义
         /// </summary>
         /// <param name="parkspace_status"></param>
-        private void ParkspaceStatusUpdate(Parkspace_allocation_status_msg parkspace_status)
+        private void ParkspaceStatusUpdate(Parkspace_allocation_data_msg parkspace_status)
         {
             lock (m_parkspace_status_access_lock)
             {
@@ -255,11 +272,11 @@ namespace parkspace_manager
         /// <summary>
         /// 获取当前车位状态
         /// </summary>
-        public bool Get_parkspace_status(ref Parkspace_allocation_status_msg msg)
+        public bool Get_parkspace_status(ref Parkspace_allocation_data_msg msg)
         {
             lock (m_parkspace_status_access_lock)
             {
-                msg = new Parkspace_allocation_status_msg();
+                msg = new Parkspace_allocation_data_msg();
                 msg.MergeFrom(m_parkspace_current_status);
             }
             if ((DateTime.Now - m_last_parkspace_status_time).Milliseconds > m_timeout_milli)
@@ -393,10 +410,11 @@ namespace parkspace_manager
             if (msg == null)
                 return;
             Base_msg base_msg = Base_msg.Parser.ParseFrom(msg);
+            //Console.WriteLine(base_msg.ToString());
             switch(base_msg.BaseInfo.MsgType)
             {
-                case Message_type.EParkspaceAllocationStatusMsg:
-                    Parkspace_allocation_status_msg parkspace_status_msg = Parkspace_allocation_status_msg.Parser.ParseFrom(msg);
+                case Message_type.EParkspaceAllocationDataMsg:
+                    Parkspace_allocation_data_msg parkspace_status_msg = Parkspace_allocation_data_msg.Parser.ParseFrom(msg);
                     m_parkspaceStatusCallback?.Invoke(parkspace_status_msg);
                     break;
                 case Message_type.EParkspaceForceUpdateResponseMsg:
@@ -406,7 +424,7 @@ namespace parkspace_manager
                     m_parkspaceForceUpdateResponseCallback?.Invoke(parkspace_force_update_msg);
                     break;
                 default:
-                    Console.WriteLine("unrecognized message received");
+                    //Console.WriteLine("unrecognized message received");
                     break;
             }
         }

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1502 - 267
parkspace_manager/message/MessageBase.cs


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1863 - 291
parkspace_manager/message/ParkspaceAllocationMessage.cs


+ 177 - 45
parkspace_manager/message/message_base.proto

@@ -12,6 +12,8 @@ enum Message_type
     eLocate_request_msg=0x12;               //定位请求消息
     eLocate_response_msg=0x13;              //定位反馈消息
 
+    eLocate_sift_request_msg = 0x14;            //预测算法请求消息
+    eLocate_sift_response_msg = 0x15;           //预测算法反馈消息
 
     eDispatch_status_msg=0x21;                //调度模块硬件状态消息
     eDispatch_request_msg=0x22;              //请求调度消息
@@ -28,7 +30,8 @@ enum Message_type
     eParkspace_force_update_response_msg = 0x39;//手动修改车位反馈消息
     eParkspace_confirm_alloc_request_msg = 0x3A;//确认分配车位请求消息
     eParkspace_confirm_alloc_response_msg = 0x3B;//确认分配车位反馈消息
-
+    eParkspace_allocation_data_msg = 0x3C;     //车位分配模块车位数据消息
+    eParkspace_allocation_data_response_msg =0x3D;//车位数据反馈消息
 
     eStore_command_request_msg=0x41;        //终端停车请求消息
     eStore_command_response_msg=0x42;       //停车请求反馈消息
@@ -37,9 +40,27 @@ enum Message_type
 
 
 
-    eStoring_process_statu_msg=0x90;        //停车进度条消息
-    ePicking_process_statu_msg=0x91;        //取车进度消息
+    eStoring_process_statu_msg=0x90;        //停车指令进度条消息
+    ePicking_process_statu_msg=0x91;        //取车指令进度消息
+
+
+    eCentral_controller_statu_msg=0xa0;     //中控系统状态消息
+
+
+    eEntrance_manual_operation_msg=0xb0;            //针对出入口状态操作的手动消息
+    eProcess_manual_operation_msg=0xb1;             //针对流程的手动消息
 
+    eDispatch_plan_request_msg          = 0xe0;     //调度总规划的请求(用于启动整个调度算法)(调度管理->调度算法)
+    eDispatch_plan_response_msg         = 0xe1;     //调度总规划的答复(调度算法->调度管理)
+    eDispatch_control_request_msg       = 0xe2;     //调度控制的任务请求(调度算法->调度管理)
+    eDispatch_control_response_msg      = 0xe3;     //调度控制的任务答复(调度管理->调度算法)
+    eDispatch_manager_status_msg        = 0xea;     //调度管理的设备状态消息(调度底下所有硬件设备状态的汇总)
+    eDispatch_manager_data_msg          = 0xeb;     //调度管理的设备详细的数据信息
+
+
+    eGround_detect_request_msg=0xf0;        //地面雷达测量请求消息
+    eGround_detect_response_msg=0xf1;       //地面雷达测量反馈消息
+    eGround_status_msg=0xf2;                //地面雷达状态消息
 
 }
 
@@ -54,28 +75,35 @@ enum Communicator
     eParkspace=0x0200;
     //测量单元
     eMeasurer=0x0300;
+    //测量单元的服务器
+    eMeasurer_sift_server=0x0301;
+    //调度机构
+    eDispatch_manager=0x0400;
     //调度机构
-    eDispatch=0x0400;
+    eDispatch_control=0x0401;
     //...
 
 
+    //地面测量单元
+	eGround_measurer=0x0f00;
 }
 ////base message 用于解析未知类型的消息
 message Base_info
 {
-    required Message_type               msg_type=1;
-    optional int32                      timeout_ms=2;
-    required Communicator               sender=3;                       //发送者
-    required Communicator               receiver=4;                     //接收者
+    required Message_type               msg_type=1[default = eBase_msg];
+    optional int32                      timeout_ms=2[default = 0];
+    required Communicator               sender=3[default = eEmpty];                       //发送者
+    required Communicator               receiver=4[default = eEmpty];                     //接收者
 }
 
 // 事件,停车或者取车
-enum Event
+enum Process_type
 {
     eStoring=1;
     ePicking=2;
 }
 
+
 message Base_msg
 {
     required Base_info                  base_info=1;
@@ -98,61 +126,165 @@ enum Error_level
 
 message Error_manager
 {
-    required int32                      error_code = 1;
-    optional Error_level                error_level = 2;
-    optional string                     error_description = 3;
+    required int32                      error_code = 1[default = 0];
+    optional Error_level                error_level = 2[default = NORMAL];
+    optional string                     error_description = 3[default = ""];
 }
 
 //测量结果结构体
 message Locate_information
-{    
-    optional float locate_x = 1;				//整车的中心点x值; 四轮的中心
-    optional float locate_y = 2;				//整车的中心点y值; 四轮的中心
-    optional float locate_angle = 3;			//整车的旋转角; 四轮的旋转角
-    optional float locate_length = 4;		    //整车的长度; 用于规避碰撞
-    optional float locate_width = 5;			//整车的宽度; 用于规避碰撞
-    optional float locate_height = 6;		    //整车的高度; 用于规避碰撞
-    optional float locate_wheel_base = 7;	    //整车的轮距; 前后轮的距离; 用于机器人或agv的抓车
-    optional float locate_wheel_width = 8;	    //整车的轮距; 左右轮的距离; 用于机器人或agv的抓车
-    optional bool locate_correct = 9;		    //整车的校准标记位
+{
+    optional float locate_x = 1[default = 0];				//整车的中心点x值; 四轮的中心
+    optional float locate_y = 2[default = 0];				//整车的中心点y值; 四轮的中心
+    optional float locate_angle = 3[default = 0];			//整车的旋转角; 四轮的旋转角
+    optional float locate_length = 4[default = 0];		    //整车的长度; 用于规避碰撞
+    optional float locate_width = 5[default = 0];			//整车的宽度; 用于规避碰撞
+    optional float locate_height = 6[default = 0];		    //整车的高度; 用于规避碰撞
+    optional float locate_wheel_base = 7[default = 0];	    //整车的轮距; 前后轮的距离; 用于机器人或agv的抓车
+    optional float locate_wheel_width = 8[default = 0];	    //整车的轮距; 左右轮的距离; 用于机器人或agv的抓车
+    optional bool locate_correct = 9[default = false];		    //整车的校准标记位
+
+    optional float locate_front_theta = 10[default = 0];	    //整车的前轮的旋转角
 }
 
+//车辆基本信息
 message Car_info
 {
-    optional float                      car_length=1;           //车长
-    optional float                      car_width=2;            //车宽
-    optional float                      car_height=3;           //车高
-    optional string                     license=4;              //车辆凭证号
+    optional float                      car_length=1[default = 0];           //车长
+    optional float                      car_width=2[default = 0];            //车宽
+    optional float                      car_height=3[default = 0];           //车高
+    optional string                     license=4[default = ""];              //车辆凭证号
+    optional float                      car_wheel_base = 5[default = 0];	    //整车的轮距; 前后轮的距离; 用于机器人或agv的抓车
+    optional float                      car_wheel_width = 6[default = 0];	//整车的轮距; 左右轮的距离; 用于机器人或agv的抓车
 }
 
 //车位状态枚举
 enum Parkspace_status
 {
-    eParkspace_empty            = 0;         //空闲,可分配
-    eParkspace_occupied         = 1;         //被占用,不可分配
-    eParkspace_reserved        = 2;         //被预约,预约车辆可分配
-    eParkspace_locked           = 3;         //临时锁定,不可分配
-    eParkspace_error            = 4;         //车位机械结构或硬件故障   
+    eParkspace_status_unknow    = 0;
+    eParkspace_empty            = 1;         //空闲,可分配
+    eParkspace_occupied         = 2;         //被占用,不可分配
+    eParkspace_reserved         = 3;         //被预约,预约车辆可分配
+    eParkspace_locked           = 4;         //临时锁定,不可分配
+    eParkspace_error            = 5;         //车位机械结构或硬件故障
 }
 
+//车位朝向, 小号朝前朝南, 大号朝后朝北
 enum Direction
 {
-    eForward = 1;
-    eBackward = 2;
+    eDirection_unknow = 0;
+    eForward = 1;                   //小号朝前朝南
+    eBackward = 2;                  //大号朝后朝北
+}
+
+//车位分配路线(根据中跑车的路线来定)
+enum Parkspace_path
+{
+	UNKNOW_PATH = 0;
+    OPTIMAL_PATH = 1;
+    LEFT_PATH = 2;
+    RIGHT_PATH = 3;
+    TEMPORARY_CACHE_PATH = 4;
+}
+
+//车位类型
+enum Parkspace_type
+{
+    UNKNOW_PARKSPACE_TYPE = 0;
+    MIN_PARKINGSPACE = 1;//小车位
+    MID_PARKINGSPACE = 2;//中车位
+    BIG_PARKINGSPACE = 3;//大车位
+}
+
+//汽车类型
+enum Car_type
+{
+    UNKNOW_CAR_TYPE = 0;
+    MIN_CAR = 1;//小车
+    MID_CAR = 2;//中车
+    BIG_CAR = 3;//大车
 }
 
-//单个车位基本信息与状态信息
+//单个车位基本信息与状态信息,车位信息以及车位上的车辆信息
 message Parkspace_info
 {
-    optional int32              parkspace_id=1;         //车位编号
-    optional int32              index=2;                //同层编号
-    optional Direction          direction=3;            //前后
-    optional int32              floor=4;                //楼层
-    optional float              length=5;               //车位长
-    optional float              width=6;                //车位宽
-    optional float              height=7;               //车位高
-    optional Parkspace_status   parkspace_status=8;     //车位当前状态
-    optional Car_info           car_info=9;              //当前车位存入车辆的凭证号
-    optional string             entry_time=10;          //入场时间
-    optional string             leave_time=11;          //离场时间
+    optional int32              parkingspace_index_id = 1;            //车位ID
+    optional Parkspace_type     parkingspace_type = 2;                //车位类型
+    optional int32              parkingspace_unit_id = 3;            //车位单元号
+    optional int32              parkingspace_label_id = 4;            //车位单元内部ID
+    optional int32              parkingspace_room_id = 5;             //同层编号
+    optional Direction          parkingspace_direction = 6;           //前后
+    optional int32              parkingspace_floor_id = 7;            //楼层
+    optional float              parkingspace_width = 8;               //车位宽
+    optional float              parkingspace_height = 9;              //车位高
+    optional Parkspace_status   parkingspace_status = 10;              //车位当前状态
+    optional Car_info           car_info = 11;                        //车辆信息
+    optional string             entry_time = 12;                      //入场时间
+    optional string             leave_time = 13;                      //离场时间
+
+
+    optional Parkspace_path     parkspace_path = 14;            // 车位分配路线
+    optional float              path_estimate_time = 15;        //车位分配路线 time(s)
+    optional Parkspace_status   parkspace_status_target = 16;     //车位目标状态
+
+    optional Car_type           car_type = 17;                        //车辆类型
+
+
 }
+
+/*
+*流程中的步骤类型, 例如:停车流程包含5个步骤 , 分配车位-测量-检验结果-搬运-更新车位表
+*/
+enum Step_type
+{
+    eAlloc_step=0;
+    eMeasure_step=1;
+    eCompare_step=2;
+    eDispatch_step=3;
+    eConfirm_step=4;
+
+    eSearch_step=5;        //查询数据库
+    eWait_step=6;             //等待车辆离开
+    eRelease_step=7;          //释放车位
+
+    eComplete=8;              //完成
+
+    eBackConfirm_step=9;
+    eBack_compare_step=10;
+    eBackMeasure_step=11;
+    eBackAlloc_step=12;
+
+    eBackWait_step=13;
+    eBackDispatch_step=14;
+    eBackSearch_step=15;
+
+    eBackComplete=16;
+}
+//步骤状态,每个步骤有四中可能状态 ,等待中-执行中-完成或者错误  四个状态
+enum Step_statu
+{
+    eWaiting=0;               //完成/空闲
+    eWorking=1;
+    eError=2;
+    eFinished=3;
+}
+
+//调度设备的类型
+enum Dispatch_device_type
+{
+    ROBOT_1                                 = 101;      //一号出口的专用机器手(只能负责1号出口的取车)(目前没有安装,暂时不考虑)
+    ROBOT_2                                 = 102;      //中间的大型机器手   (可以负责1~6号出入口的停车和取车)
+
+    CARRIER_1                               = 200;      //左侧0号电梯井的搬运器(升降电梯 中跑车 小跑车 三合一为搬运器)
+    CARRIER_2                               = 207;      //右侧7号电梯井的搬运器(升降电梯 中跑车 小跑车 三合一为搬运器)
+    CARRIER_3                               = 203;      //中间3楼的搬运器(中跑车 小跑车 二合一为搬运器)(没有电梯, 只能在3楼活动)
+
+    PASSAGEWAY_0                            = 300;      //0号出口(在左侧电梯井, 只能取车)(暂时不存在)
+    PASSAGEWAY_1                            = 301;      //1号出入口
+    PASSAGEWAY_2                            = 302;      //2号出入口
+    PASSAGEWAY_3                            = 303;      //3号出入口
+    PASSAGEWAY_4                            = 304;      //4号出入口
+    PASSAGEWAY_5                            = 305;      //5号出入口
+    PASSAGEWAY_6                            = 306;      //6号出入口
+    PASSAGEWAY_7                            = 307;      //7号出口(在右侧电梯井, 只能取车)
+}

+ 58 - 21
parkspace_manager/message/parkspace_allocation_message.proto

@@ -12,14 +12,30 @@ import "message_base.proto";
 //车辆状态枚举
 enum Vehicle_status
 {
-    eVehicle_idle           = 0;         //车辆空闲
-    eVehicle_in_garage      = 1;         //车辆已入库
-    eVehicle_parking        = 2;         //车辆停车中
-    eVehicle_fetching       = 3;         //车辆取车中
-    eVehicle_reserved       = 4;         //已预约未停入
-    eVehicle_unknown        = 5;         //未知状态
+    eVehicle_unknown        = 0;         //未知状态
+    eVehicle_idle           = 1;         //车辆空闲
+    eVehicle_in_garage      = 2;         //车辆已入库
+    eVehicle_parking        = 3;         //车辆停车中
+    eVehicle_fetching       = 4;         //车辆取车中
+    eVehicle_reserved       = 5;         //已预约未停入
 }
 
+//数据库状态
+enum Database_controller_status
+{
+	    E_UNKNOWN               = 0;    //默认未知
+	    E_READY               	= 1;    //正常待机
+		E_DISCONNECT			= 2;	//断连
+	    E_FAULT					= 3;	//故障
+}
+//车位管理状态
+enum Parkspace_manager_satus
+{
+    eParkspace_manager_unknown      =0;//位置
+    eParkspace_manager_normal       =1;//正常
+    eParkspace_manager_fault        =2;//故障
+};
+
 //1.分配车位请求
 message Parkspace_allocation_request_msg
 {
@@ -35,7 +51,8 @@ message Parkspace_allocation_response_msg
     required Base_info                  base_info=1;            //消息类型
     required string                     command_key=2;           //指令唯一标识符id
     required Error_manager              error_manager=3;        //分配成功与否标志
-    required Parkspace_info             allocated_space_info=4; //分配车位信息
+    repeated Parkspace_info             allocated_parkspace_info_ex = 4;    //分配车位信息
+    optional Car_type                   car_type = 5;//汽车类型
 }
 
 //2.查询车辆位置请求
@@ -52,24 +69,24 @@ message Parkspace_search_response_msg
     required Base_info                  base_info=1;            //消息类型
     required string                     command_key=2;           //指令唯一标识符id
     required Error_manager              error_manager=3;        //分配成功与否标志
-    optional Parkspace_info             car_position=4;         //待查询车辆存放位置
+    repeated Parkspace_info             query_parkspace_info_ex=4;         //待查询车辆存放位置
 }
 
-//3.解锁车位请求
+//3.释放车位请求
 message Parkspace_release_request_msg
 {
     required Base_info                  base_info=1;            //消息类型
     required string                     command_key=2;           //指令唯一标识符id
-    required Parkspace_info             release_space_info=3;   //待释放车位信息
+    repeated Parkspace_info             release_parkspace_info_ex=3;   //待释放车位信息
 }
 
-//解锁车位反馈
+//释放车位请求
 message Parkspace_release_response_msg
 {
     required Base_info                  base_info=1;            //消息类型
     required string                     command_key=2;           //指令唯一标识符id
     required Error_manager              error_manager=3;        //分配成功与否标志
-    required Parkspace_info             release_space_info=4;   //待释放车位信息
+    repeated Parkspace_info             release_parkspace_info_ex=4;   //待释放车位信息
 }
 
 // 4.手动操作修改车位状态
@@ -77,7 +94,7 @@ message Parkspace_force_update_request_msg
 {
     required Base_info                  base_info=1;            //消息类型
     required string                     command_key=2;           //指令唯一标识符id
-    required Parkspace_info             update_space_info=3;    //待手动修改车位信息,通过id定位
+    repeated Parkspace_info             manual_parkspace_info_ex=3;    //待手动修改车位信息,通过id定位
 }
 
 //手动操作反馈
@@ -86,31 +103,51 @@ message Parkspace_force_update_response_msg
     required Base_info                  base_info=1;            //消息类型
     required string                     command_key=2;           //指令唯一标识符id
     required Error_manager              error_manager=3;        //分配成功与否标志
-    required Parkspace_info             update_space_info=4;    //已修改后的车位信息
+    repeated Parkspace_info             manual_parkspace_info_ex=4;    //已修改后的车位信息
 }
 
-// 5.临时锁定车位
+// 5.确认分配车位
 message Parkspace_confirm_alloc_request_msg
 {
     required Base_info                  base_info=1;            //消息类型
     required string                     command_key=2;           //指令唯一标识符id
-    required Parkspace_info             confirm_space_info=3;    //已修改后的车位信息
-}
+    repeated Parkspace_info             confirm_parkspace_info_ex = 3;    //分配车位信息
+    optional Car_type                   car_type = 4;//汽车类型
 
+}
+//确认分配车位反馈
 message Parkspace_confirm_alloc_response_msg
 {
     required Base_info                  base_info=1;            //消息类型
     required string                     command_key=2;           //指令唯一标识符id
     required Error_manager              error_manager=3;        //分配成功与否标志
-    required Parkspace_info             confirm_alloc_space_info=4;    //已修改后的车位信息
+    repeated Parkspace_info             confirm_parkspace_info_ex = 4;    //已修改后的车位信息
+    optional Car_type                   car_type = 5;//汽车类型
+
 }
 
 // 车位心跳状态信息
 message Parkspace_allocation_status_msg
+{
+    required Base_info                      base_info=1;            //消息类型
+    required Error_manager                  error_manager=2;
+    required Database_controller_status     database_controller_status=3;           //数据库的状态
+    required Parkspace_manager_satus        parkspace_manager_satus=4;              //车位管理状态
+    required int32                          small_parkspace_remaining_number=5;    //小型车位剩余数量
+    required int32                          medium_parkspace_remaining_number=6;   //中型车位剩余数量
+    required int32                          large_parkspace_remaining_number=7;    //大型车位剩余数量
+    required int32                          total_parkspace_remaining_number=8;    //所有车位剩余数量
+}
+
+//更新车位数据请求
+message Parkspace_refresh_request_msg
+{
+    required Base_info                  base_info=1;            //消息类型
+}
+// 车位数据信息
+message Parkspace_allocation_data_msg
 {
     required Base_info                  base_info=1;            //消息类型
     required Error_manager              error_manager=2;
-    repeated Parkspace_info             parkspace_info=3;       //车位状态
+    repeated Parkspace_info             parkspace_info_ex=3;
 }
-
-

+ 2 - 2
parkspace_manager/packages.config

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
-  <package id="Google.Protobuf" version="3.12.4" targetFramework="net45" />
+  <package id="Google.Protobuf" version="3.17.3" targetFramework="net45" />
   <package id="Google.Protobuf.Tools" version="3.12.4" targetFramework="net45" />
   <package id="NNanomsg" version="0.5.2" targetFramework="net45" />
   <package id="System.Buffers" version="4.4.0" targetFramework="net45" />
-  <package id="System.Memory" version="4.5.2" targetFramework="net45" />
+  <package id="System.Memory" version="4.5.3" targetFramework="net45" />
   <package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net45" />
 </packages>

+ 4 - 4
parkspace_manager/parkspace_manager.csproj

@@ -37,8 +37,8 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>sdk\mysql\db.dll</HintPath>
     </Reference>
-    <Reference Include="Google.Protobuf, Version=3.12.4.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
-      <HintPath>..\packages\Google.Protobuf.3.12.4\lib\net45\Google.Protobuf.dll</HintPath>
+    <Reference Include="Google.Protobuf, Version=3.17.3.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
+      <HintPath>..\packages\Google.Protobuf.3.17.3\lib\net45\Google.Protobuf.dll</HintPath>
     </Reference>
     <Reference Include="MySql.Data, Version=6.7.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
@@ -53,8 +53,8 @@
     </Reference>
     <Reference Include="System.Configuration" />
     <Reference Include="System.Core" />
-    <Reference Include="System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
-      <HintPath>..\packages\System.Memory.4.5.2\lib\netstandard1.1\System.Memory.dll</HintPath>
+    <Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Memory.4.5.3\lib\netstandard1.1\System.Memory.dll</HintPath>
     </Reference>
     <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
       <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>

+ 5 - 0
parkspace_manager/proto.bat

@@ -0,0 +1,5 @@
+..\packages\Google.Protobuf.Tools.3.17.2\tools\windows_x64\protoc.exe --proto_path=.\message\ message_base.proto --csharp_out=.\message
+..\packages\Google.Protobuf.Tools.3.17.2\tools\windows_x64\protoc.exe --proto_path=.\message\ parkspace_allocation_message.proto --csharp_out=.\message
+..\packages\Google.Protobuf.Tools.3.17.2\tools\windows_x64\protoc.exe --proto_path=.\message\ measure_message.proto --csharp_out=.\message
+..\packages\Google.Protobuf.Tools.3.17.2\tools\windows_x64\protoc.exe --proto_path=.\message\ terminal_message.proto --csharp_out=.\message
+..\packages\Google.Protobuf.Tools.3.17.2\tools\windows_x64\protoc.exe --proto_path=.\message\ process_message.proto --csharp_out=.\message