Browse Source

添加注释

yc_t 7 years ago
parent
commit
cfaadf6140

+ 62 - 0
PlugIn1/PlugIn1.csproj

@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.30703</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{7E03B425-DF7A-4CB0-B6BD-B1E22F4A24A1}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>PlugIn1</RootNamespace>
+    <AssemblyName>PlugIn1</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <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' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Sandcastle.Core">
+      <HintPath>$(SHFBROOT)\Sandcastle.Core.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="SandcastleBuilder.Utils">
+      <HintPath>$(SHFBROOT)\SandcastleBuilder.Utils.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.ComponentModel.Composition" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Windows.Forms" />
+    <Reference Include="System.Xml" />
+    <Reference Include="System.Xml.Linq" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="PlugIn1PlugIn.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 142 - 0
PlugIn1/PlugIn1PlugIn.cs

@@ -0,0 +1,142 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using System.Xml.XPath;
+
+using SandcastleBuilder.Utils;
+using SandcastleBuilder.Utils.BuildComponent;
+using SandcastleBuilder.Utils.BuildEngine;
+
+// Search for "TODO" to find changes that you need to make to this plug-in template.
+
+namespace PlugIn1
+{
+    /// <summary>
+    /// TODO: Set your plug-in's unique ID and description in the export attribute below.
+    /// </summary>
+    /// <remarks>The <c>HelpFileBuilderPlugInExportAttribute</c> is used to export your plug-in so that the help
+    /// file builder finds it and can make use of it.  The example below shows the basic usage for a common
+    /// plug-in.  Set the additional attribute values as needed:
+    ///
+    /// <list type="bullet">
+    ///     <item>
+    ///         <term>IsConfigurable</term>
+    ///         <description>Set this to true if your plug-in contains configurable settings.  The
+    /// <c>ConfigurePlugIn</c> method will be called to let the user change the settings.</description>
+    ///     </item>
+    ///     <item>
+    ///         <term>RunsInPartialBuild</term>
+    ///         <description>Set this to true if your plug-in should run in partial builds used to generate
+    /// reflection data for the API Filter editor dialog or namespace comments used for the Namespace Comments
+    /// editor dialog.  Typically, this is left set to false.</description>
+    ///     </item>
+    /// </list>
+    /// 
+    /// Plug-ins are singletons in nature.  The composition container will create instances as needed and will
+    /// dispose of them when the container is disposed of.</remarks>
+    [HelpFileBuilderPlugInExport("PlugIn1", Version = AssemblyInfo.ProductVersion,
+      Copyright = AssemblyInfo.Copyright, Description = "PlugIn1 plug-in")]
+    public sealed class PlugIn1PlugIn : IPlugIn
+    {
+        #region Private data members
+        //=====================================================================
+
+        private List<ExecutionPoint> executionPoints;
+
+        private BuildProcess builder;
+        #endregion
+
+        #region IPlugIn implementation
+        //=====================================================================
+
+        /// <summary>
+        /// This read-only property returns a collection of execution points that define when the plug-in should
+        /// be invoked during the build process.
+        /// </summary>
+        public IEnumerable<ExecutionPoint> ExecutionPoints
+        {
+            get
+            {
+                if (executionPoints == null)
+                    executionPoints = new List<ExecutionPoint>
+                    {
+                        // TODO: Modify this to set your execution points
+                        new ExecutionPoint(BuildStep.ValidatingDocumentationSources, ExecutionBehaviors.Before),
+                        new ExecutionPoint(BuildStep.GenerateReflectionInfo, ExecutionBehaviors.Before)
+                    };
+
+                return executionPoints;
+            }
+        }
+
+        /// <summary>
+        /// This method is used by the Sandcastle Help File Builder to let the plug-in perform its own
+        /// configuration.
+        /// </summary>
+        /// <param name="project">A reference to the active project</param>
+        /// <param name="currentConfig">The current configuration XML fragment</param>
+        /// <returns>A string containing the new configuration XML fragment</returns>
+        /// <remarks>The configuration data will be stored in the help file builder project</remarks>
+        public string ConfigurePlugIn(SandcastleProject project, string currentConfig)
+        {
+            // TODO: Add and invoke a configuration dialog if you need one.  You will also need to set the
+            // IsConfigurable property to true on the class's export attribute.
+            MessageBox.Show("This plug-in has no configurable settings", "Build Process Plug-In",
+                MessageBoxButtons.OK, MessageBoxIcon.Information);
+
+            return currentConfig;
+        }
+
+        /// <summary>
+        /// This method is used to initialize the plug-in at the start of the build process
+        /// </summary>
+        /// <param name="buildProcess">A reference to the current build process</param>
+        /// <param name="configuration">The configuration data that the plug-in should use to initialize itself</param>
+        public void Initialize(BuildProcess buildProcess, XPathNavigator configuration)
+        {
+            builder = buildProcess;
+
+            var metadata = (HelpFileBuilderPlugInExportAttribute)this.GetType().GetCustomAttributes(
+                typeof(HelpFileBuilderPlugInExportAttribute), false).First();
+
+            builder.ReportProgress("{0} Version {1}\r\n{2}", metadata.Id, metadata.Version, metadata.Copyright);
+
+            // TODO: Add your initialization code here such as reading the configuration data
+        }
+
+        /// <summary>
+        /// This method is used to execute the plug-in during the build process
+        /// </summary>
+        /// <param name="context">The current execution context</param>
+        public void Execute(ExecutionContext context)
+        {
+            // TODO: Add your execution code here
+            builder.ReportProgress("In PlugIn1PlugIn Execute() method");
+        }
+        #endregion
+
+        #region IDisposable implementation
+        //=====================================================================
+
+        // TODO: If the plug-in hasn't got any disposable resources, this finalizer can be removed
+        /// <summary>
+        /// This handles garbage collection to ensure proper disposal of the plug-in if not done explicitly
+        /// with <see cref="Dispose()"/>.
+        /// </summary>
+        ~PlugIn1PlugIn()
+        {
+            this.Dispose();
+        }
+
+        /// <summary>
+        /// This implements the Dispose() interface to properly dispose of the plug-in object
+        /// </summary>
+        public void Dispose()
+        {
+            // TODO: Dispose of any resources here if necessary
+            GC.SuppressFinalize(this);
+        }
+        #endregion
+    }
+}

+ 38 - 0
PlugIn1/Properties/AssemblyInfo.cs

@@ -0,0 +1,38 @@
+using System;
+using System.Reflection;
+using System.Resources;
+using System.Runtime.InteropServices;
+
+// General assembly information
+[assembly: AssemblyProduct("PlugIn1")]
+[assembly: AssemblyTitle("PlugIn1")]
+[assembly: AssemblyDescription("A plug-in for use with the Sandcastle Help File Builder")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyCopyright(AssemblyInfo.Copyright)]
+[assembly: AssemblyCulture("")]
+#if DEBUG
+[assembly: AssemblyConfiguration("Debug")]
+#else
+[assembly: AssemblyConfiguration("Release")]
+#endif
+
+[assembly: ComVisible(false)]
+
+[assembly: CLSCompliant(true)]
+
+// Resources contained within the assembly are English
+[assembly: NeutralResourcesLanguageAttribute("en")]
+
+[assembly: AssemblyVersion(AssemblyInfo.ProductVersion)]
+[assembly: AssemblyFileVersion(AssemblyInfo.ProductVersion)]
+[assembly: AssemblyInformationalVersion(AssemblyInfo.ProductVersion)]
+
+// This defines constants that can be used here and in the custom presentation style export attribute
+internal static partial class AssemblyInfo
+{
+    // Product version
+    public const string ProductVersion = "1.0.0.0";
+
+    // Assembly copyright information
+    public const string Copyright = "Copyright \xA9 2018, Microsoft, All Rights Reserved.";
+}

+ 14 - 0
parkMonitor.sln

@@ -5,6 +5,8 @@ VisualStudioVersion = 15.0.27130.2026
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "parkMonitor", "parkMonitor\parkMonitor.csproj", "{DD3DCAB1-41A7-4EED-ADEE-9E4BBCE6B4C0}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlugIn1", "PlugIn1\PlugIn1.csproj", "{7E03B425-DF7A-4CB0-B6BD-B1E22F4A24A1}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -27,6 +29,18 @@ Global
 		{DD3DCAB1-41A7-4EED-ADEE-9E4BBCE6B4C0}.Release|x64.Build.0 = Release|Any CPU
 		{DD3DCAB1-41A7-4EED-ADEE-9E4BBCE6B4C0}.Release|x86.ActiveCfg = Release|Any CPU
 		{DD3DCAB1-41A7-4EED-ADEE-9E4BBCE6B4C0}.Release|x86.Build.0 = Release|Any CPU
+		{7E03B425-DF7A-4CB0-B6BD-B1E22F4A24A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{7E03B425-DF7A-4CB0-B6BD-B1E22F4A24A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{7E03B425-DF7A-4CB0-B6BD-B1E22F4A24A1}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{7E03B425-DF7A-4CB0-B6BD-B1E22F4A24A1}.Debug|x64.Build.0 = Debug|Any CPU
+		{7E03B425-DF7A-4CB0-B6BD-B1E22F4A24A1}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{7E03B425-DF7A-4CB0-B6BD-B1E22F4A24A1}.Debug|x86.Build.0 = Debug|Any CPU
+		{7E03B425-DF7A-4CB0-B6BD-B1E22F4A24A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{7E03B425-DF7A-4CB0-B6BD-B1E22F4A24A1}.Release|Any CPU.Build.0 = Release|Any CPU
+		{7E03B425-DF7A-4CB0-B6BD-B1E22F4A24A1}.Release|x64.ActiveCfg = Release|Any CPU
+		{7E03B425-DF7A-4CB0-B6BD-B1E22F4A24A1}.Release|x64.Build.0 = Release|Any CPU
+		{7E03B425-DF7A-4CB0-B6BD-B1E22F4A24A1}.Release|x86.ActiveCfg = Release|Any CPU
+		{7E03B425-DF7A-4CB0-B6BD-B1E22F4A24A1}.Release|x86.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 38 - 13
parkMonitor/entity/AbstractMessage.cs

@@ -3,11 +3,16 @@ using System.Collections.Generic;
 
 namespace parkMonitor.entity
 {
+    /// <summary>
+    /// 抽象消息类
+    /// </summary>
     public abstract class AbstractMessage
     {
     }
 
-    //web
+    /// <summary>
+    /// 用户指令类
+    /// </summary>
     public class MessageUTF8 : AbstractMessage, ICloneable
     {
         public char cmd { set; get; }
@@ -41,7 +46,9 @@ namespace parkMonitor.entity
     }
 
     //********************************************* plc ************************************************
-    //plc component
+    /// <summary>
+    /// plc节点类
+    /// </summary>
     public class PLCNode : AbstractMessage
     {
         public string Address { get; set; }
@@ -76,7 +83,9 @@ namespace parkMonitor.entity
 
     }
 
-    //plc list
+    /// <summary>
+    /// plc消息类
+    /// </summary>
     public class PLCMessage : AbstractMessage, ICloneable
     {
         public List<PLCNode> extendedPlcList { get; set; }
@@ -110,13 +119,17 @@ namespace parkMonitor.entity
     }
 
     //******************************************* NumMachine *********************************************
-    //NumMachine status
+    /// <summary>
+    /// 号牌机状态枚举
+    /// </summary>
     public enum EnumNumberMachineStatus
     {
         Offline, Normal
     }
 
-    //NumMachine component
+    /// <summary>
+    /// 号牌机节点类
+    /// </summary>
     public class NumberMachineNode : ICloneable
     {
         public string ip { get; set; }
@@ -163,7 +176,9 @@ namespace parkMonitor.entity
         }
     }
 
-    //NumMachine list+aModel
+    /// <summary>
+    /// 号牌机消息类
+    /// </summary>
     public class NumberMachineMessage : AbstractMessage
     {
         public List<NumberMachineNode> data { get; set; }
@@ -192,7 +207,9 @@ namespace parkMonitor.entity
     }
 
     //********************************************** laser ************************************************
-    //laser component
+    /// <summary>
+    /// 激光消息类
+    /// </summary>
     public class LaserMessage : AbstractMessage, ICloneable
     {
         public int id { get; set; }
@@ -224,7 +241,9 @@ namespace parkMonitor.entity
         }
     }
 
-    //Data component
+    /// <summary>
+    /// 激光数据类
+    /// </summary>
     public class Data : ICloneable
     {
         public int centerX { get; set; }
@@ -253,6 +272,9 @@ namespace parkMonitor.entity
     }
 
     //********************************************** command **********************************************
+    /// <summary>
+    /// 命令类,由队列线程处理号牌与指令后产生
+    /// </summary>
     public class Command : AbstractMessage, ICloneable
     {
         public char commandType { get; set; }
@@ -299,13 +321,16 @@ namespace parkMonitor.entity
         }
     }
 
+    /// <summary>
+    /// 控制信息类,核心在不同阶段发至plc
+    /// 1: 停车startLaser--park_command_address
+    /// 2: 停车激光的6个数据,startRobot,车位信息4个
+    /// 3:停车完成,归零--park_completed_address
+    /// 4:取车startRobot,车位信息4个
+    /// 5: 取车完成,归零-fetch_completed_address
+    /// </summary>
     public class ControlMessage : AbstractMessage
     {
-        //1: 停车startLaser--park_command_address
-        //2: 停车激光的6个数据,startRobot,车位信息4个
-        //3:停车完成,归零--park_completed_address
-        //4:取车startRobot,车位信息4个
-        //5: 取车完成,归零-fetch_completed_address
         public int status { get; set; }
         public int laserID { get; set; }//激光地址
         public string parkingSpaceID { get; set; }

+ 3 - 0
parkMonitor/entity/EquipmentSimpleFactory.cs

@@ -10,6 +10,9 @@ using parkMonitor.server;
 
 namespace parkMonitor.entity
 {
+    /// <summary>
+    /// 设备工厂类
+    /// </summary>
     class EquipmentSimpleFactory
     {
 		public static readonly EquipmentSimpleFactory ins = new EquipmentSimpleFactory();

BIN
parkMonitor/resource/inlineRes/plcAddrr.csv


+ 15 - 0
parkMonitor/server/CoreThread/AbstractCmd.cs

@@ -14,6 +14,9 @@ using parkMonitor.DBLocation;
 
 namespace parkMonitor.server.CoreThread
 {
+    /// <summary>
+    /// 核心对命令处理父类
+    /// </summary>
     public abstract class AbstractCmd
     {
         public static bool isClosing { get; set; }
@@ -118,6 +121,9 @@ namespace parkMonitor.server.CoreThread
         }
     }
 
+    /// <summary>
+    /// 停车命令处理类
+    /// </summary>
     public class StopCmd : AbstractCmd
     {
         /// <summary>
@@ -538,6 +544,9 @@ namespace parkMonitor.server.CoreThread
         }
     }
 
+    /// <summary>
+    /// 取车命令处理类
+    /// </summary>
     public class FetchCmd : AbstractCmd
     {
         public override void executeCmd(Command queueCmd)
@@ -662,6 +671,9 @@ namespace parkMonitor.server.CoreThread
         }
     }
 
+    /// <summary>
+    /// 异常命令处理类
+    /// </summary>
     public class ExceptionCmd : AbstractCmd
     {
         public override void executeCmd(Command queueCmd)
@@ -681,6 +693,9 @@ namespace parkMonitor.server.CoreThread
         }
     }
 
+    /// <summary>
+    /// 简单命令工厂
+    /// </summary>
     public class SimpleCMDFactory
     {
         public AbstractCmd createCmd(Command queueCmd)

+ 12 - 3
parkMonitor/server/CoreThread/QueuingThread.cs

@@ -11,10 +11,12 @@ using System.Configuration;
 using parkMonitor.tools;
 using parkMonitor.server.uiLogServer;
 
-/*  需要utf8+numNode, 阻塞队列   */
 namespace parkMonitor.server.CoreThread
 {
-    class QueuingThread : IEquipments
+    /// <summary>
+    /// 队列线程,处理号牌与停取车指令业务逻辑
+    /// </summary>
+    public class QueuingThread : IEquipments
     {
         Queue<NumberMachineNode> LicenseQueue = new Queue<NumberMachineNode>();
         Queue<Command> StoreCmdQueue = new Queue<Command>();
@@ -28,6 +30,9 @@ namespace parkMonitor.server.CoreThread
         NumberMachineNode license;
         MessageUTF8 webMsg;
 
+        /// <summary>
+        /// 队列构造函数
+        /// </summary>
         public QueuingThread()
         {
             webHandle = EquipmentSimpleFactory.ins.FindEquipment(EquipmentName.Web);
@@ -103,7 +108,6 @@ namespace parkMonitor.server.CoreThread
         private void Run()
         {
             NumberMachineNode temp = null;
-            Command cmd = null;
             while (!isClosing)
             {
                 lock (LicenseQueue)
@@ -148,6 +152,11 @@ namespace parkMonitor.server.CoreThread
             }
         }
 
+        /// <summary>
+        /// 号牌节点有效性验证
+        /// </summary>
+        /// <param name="node"></param>
+        /// <returns></returns>
         private bool NumMachineNodeValidation(NumberMachineNode node)
         {
             return (node != null && node.ip != null && node.ip != "" && node.ip != "used") ? true : false;

+ 109 - 118
parkMonitor/server/NumMachine/NumMachine.cs

@@ -20,39 +20,16 @@ using parkMonitor.server.uiLogServer;
 using System.Configuration;
 using parkMonitor.LOG;
 
-/*
- * try { 
-                FormModbus form = new FormModbus();
-                form.Start();
-                //form.Show();
-                Thread run = new Thread(form.Run);
-                run.Start();
-            }catch(Exception ex)
-            {
-
-                Debug.WriteLine("error");
-            }
-     */
-
 namespace parkMonitor.server
 {
-    /*
-     * 号牌机通信类
-     * 
-     * 初始化
-     * NumMachineLinker nml = new NumMachineLinker();
-     * nml.Start();
-     * 
-     * 读号牌
-     * nml.getMessage();
-     * nml.aModel.ip="";
-     * 
-     * 结束
-     * nml.Stop();
-     * 
-     * */
+    /// <summary>
+    /// 号牌机通信类
+    /// </summary>
     public partial class NumMachineLinker : Form, IEquipments
     {
+        /// <summary>
+        /// 刷新时间间隔与个数
+        /// </summary>
         public const int REFRESHINGTIME = 500, FILTERINGNUMBER = 8;
 
         ///<summary>通过设备句柄访问pic;链接时add,系统关闭时remove</summary>
@@ -83,9 +60,14 @@ namespace parkMonitor.server
         VzClientSDK.VZLPRC_PLATE_INFO_CALLBACK m_PlateResultCB = null;
         private const int MSG_PLATE_INFO = 0x901;
         private const int MSG_DEVICE_INFO = 0x902;
-        //private string m_sAppPath;
+        /// <summary>
+        /// 用于消息传递机制
+        /// </summary>
         public IntPtr hwndMain;
 
+        /// <summary>
+        /// 号牌机类构造函数
+        /// </summary>
         public NumMachineLinker()
         {
             Control.CheckForIllegalCrossThreadCalls = false;
@@ -100,9 +82,14 @@ namespace parkMonitor.server
             hwndMain = this.Handle;
             //m_sAppPath = System.IO.Directory.GetCurrentDirectory();
         }
-
-        public delegate void SetDateTime();////定义时钟委托
-        public delegate void Begin_Read();//实时采集
+        /// <summary>
+        /// 定义时钟委托
+        /// </summary>
+        public delegate void SetDateTime();
+        /// <summary>
+        /// 实时采集
+        /// </summary>
+        public delegate void Begin_Read();
 
         private void FormSiemens_Load(object sender, EventArgs e)
         {
@@ -253,6 +240,92 @@ namespace parkMonitor.server
 
         }
 
+        ///<summary>信息自动处理</summary>
+        protected override void DefWndProc(ref Message m)
+        {
+            IntPtr intptr;
+            VzClientSDK.VZ_LPR_MSG_PLATE_INFO plateInfo;
+            VzClientSDK.VZ_LPR_DEVICE_INFO deviceInfo;
+
+            int handle = 0;
+
+            switch (m.Msg)
+            {
+                case MSG_PLATE_INFO:
+
+                    intptr = (IntPtr)m.WParam.ToInt32();
+                    handle = m.LParam.ToInt32();
+                    if (intptr != null)
+                    {
+                        //根据句柄获取设备IP
+                        string strIP = Get_IP(handle);
+                        plateInfo = (VzClientSDK.VZ_LPR_MSG_PLATE_INFO)Marshal.PtrToStructure(intptr, typeof(VzClientSDK.VZ_LPR_MSG_PLATE_INFO));
+                        SetDetail(plateInfo, strIP);
+
+                        Marshal.FreeHGlobal(intptr);
+                    }
+
+                    break;
+
+                case MSG_DEVICE_INFO:
+                    intptr = (IntPtr)m.WParam.ToInt32();
+                    if (intptr != null)
+                    {
+                        deviceInfo = (VzClientSDK.VZ_LPR_DEVICE_INFO)Marshal.PtrToStructure(intptr, typeof(VzClientSDK.VZ_LPR_DEVICE_INFO));
+                        DeviceLink(deviceInfo.device_ip, deviceInfo.serial_no);
+                        Marshal.FreeHGlobal(intptr);
+
+                    }
+                    break;
+
+                default:
+                    base.DefWndProc(ref m);
+                    break;
+            }
+        }
+
+        ///<summary>ip+port字符串转ipe</summary>
+        private void GetIpEndPoint(string ipp, out IPEndPoint ipe)
+        {
+            IPAddress myIP = IPAddress.Parse(ipp.Remove(ipp.LastIndexOf(':')) + "");
+            string myPort = ipp.Substring(ipp.IndexOf(':') + 1);
+            ipe = new IPEndPoint(myIP, int.Parse(myPort));
+        }
+
+        ///<summary>与设备连接,启动更新设备状态线程,输出视频</summary>
+        private void DeviceLink(string pStrDev, string serialNO)
+        {
+            IPEndPoint ipe;
+            GetIpEndPoint(pStrDev, out ipe);
+            string ip = ipe.Address.ToString();
+            if (ipHandleMap.ContainsKey(ip))
+            {
+                //MessageBox.Show("设备已分配句柄");
+                return;
+            }
+            int handle = 0;
+            //找到设备,加入list
+            NumberMachineNode node = new NumberMachineNode(ip, 0, "", "", 1);
+            nmMsg.data.Add(node);
+            handle = VzClientSDK.VzLPRClient_Open(ip, (ushort)80, "admin", "admin");
+            Task.Factory.StartNew(() =>
+            {
+                UpdateStatus(node);
+            });
+            if (handle == 0)
+            {
+                return;
+            }
+
+            VzClientSDK.VzLPRClient_SetVideoEncodeType(handle, 0);
+            //将句柄加入
+            ipHandleMap.Add(ip, handle);
+            //MessageBox.Show("摄像头打开成功");
+            handleCallbackMap.Add(handle, null);
+            //链接句柄到新PictureBox
+            VideoOutput(handle);
+        }
+
         ///<summary>视频输出</summary>
         private void VideoOutput(int handle)
         {
@@ -359,49 +432,6 @@ namespace parkMonitor.server
             return 0;
         }
 
-        ///<summary>信息自动处理</summary>
-        protected override void DefWndProc(ref Message m)
-        {
-            IntPtr intptr;
-            VzClientSDK.VZ_LPR_MSG_PLATE_INFO plateInfo;
-            VzClientSDK.VZ_LPR_DEVICE_INFO deviceInfo;
-
-            int handle = 0;
-
-            switch (m.Msg)
-            {
-                case MSG_PLATE_INFO:
-
-                    intptr = (IntPtr)m.WParam.ToInt32();
-                    handle = m.LParam.ToInt32();
-                    if (intptr != null)
-                    {
-                        //根据句柄获取设备IP
-                        string strIP = Get_IP(handle);
-                        plateInfo = (VzClientSDK.VZ_LPR_MSG_PLATE_INFO)Marshal.PtrToStructure(intptr, typeof(VzClientSDK.VZ_LPR_MSG_PLATE_INFO));
-                        SetDetail(plateInfo, strIP);
-
-                        Marshal.FreeHGlobal(intptr);
-                    }
-
-                    break;
-
-                case MSG_DEVICE_INFO:
-                    intptr = (IntPtr)m.WParam.ToInt32();
-                    if (intptr != null)
-                    {
-                        deviceInfo = (VzClientSDK.VZ_LPR_DEVICE_INFO)Marshal.PtrToStructure(intptr, typeof(VzClientSDK.VZ_LPR_DEVICE_INFO));
-                        DeviceLink(deviceInfo.device_ip, deviceInfo.serial_no);
-                        Marshal.FreeHGlobal(intptr);
-
-                    }
-                    break;
-
-                default:
-                    base.DefWndProc(ref m);
-                    break;
-            }
-        }
 
         ///<summary>记录车牌,时间,状态信息;刷新本地entity,并且入buffer</summary>
         private void SetDetail(VzClientSDK.VZ_LPR_MSG_PLATE_INFO plateInformation, string strIP)
@@ -511,48 +541,6 @@ namespace parkMonitor.server
             }
         }
 
-        ///<summary>ip+port字符串转ipe</summary>
-        private void GetIpEndPoint(string ipp, out IPEndPoint ipe)
-        {
-            IPAddress myIP = IPAddress.Parse(ipp.Remove(ipp.LastIndexOf(':')) + "");
-            string myPort = ipp.Substring(ipp.IndexOf(':') + 1);
-            ipe = new IPEndPoint(myIP, int.Parse(myPort));
-        }
-
-        ///<summary>与设备连接,启动更新设备状态线程,输出视频</summary>
-        private void DeviceLink(string pStrDev, string serialNO)
-        {
-            IPEndPoint ipe;
-            GetIpEndPoint(pStrDev, out ipe);
-            string ip = ipe.Address.ToString();
-            if (ipHandleMap.ContainsKey(ip))
-            {
-                //MessageBox.Show("设备已分配句柄");
-                return;
-            }
-            int handle = 0;
-            //找到设备,加入list
-            NumberMachineNode node = new NumberMachineNode(ip, 0, "", "", 1);
-            nmMsg.data.Add(node);
-            handle = VzClientSDK.VzLPRClient_Open(ip, (ushort)80, "admin", "admin");
-            Task.Factory.StartNew(() =>
-            {
-                UpdateStatus(node);
-            });
-            if (handle == 0)
-            {
-                return;
-            }
-
-            VzClientSDK.VzLPRClient_SetVideoEncodeType(handle, 0);
-            //将句柄加入
-            ipHandleMap.Add(ip, handle);
-            //MessageBox.Show("摄像头打开成功");
-            handleCallbackMap.Add(handle,null);
-            //链接句柄到新PictureBox
-            VideoOutput(handle);
-        }
-
         ///<summary>创建新pic并记录在picNameMap</summary>
         private bool CreatePic(int index, out PictureBox pb)
         {
@@ -775,6 +763,9 @@ namespace parkMonitor.server
 
         }
     }
+    /// <summary>
+    /// 消息发送api
+    /// </summary>
     public class Win32API
     {
         [DllImport("User32.dll", EntryPoint = "FindWindow")]

+ 17 - 19
parkMonitor/server/PLCLinker/PLCLinker.cs

@@ -19,25 +19,9 @@ using parkMonitor.server.uiLogServer;
 
 namespace parkMonitor.server
 {
-    /*
-     * PLC通信类
-     * 
-     * 初始化:
-     * PLCLinker plc = new PLCLinker();
-     * plc.Start();
-     * 
-     * 读PLC:
-     * PLCMessage ps = plc.getMessage();
-     * 
-     * 写PLC
-     * PLCNode pn = new PLCNode("addr","value");
-     * plc.setMessage(pn);
-     * plc.setMessage(ps);
-     * 
-     * 结束
-     * plc.Stop();
-     * 
-     * */
+    /// <summary>
+    /// PLC通信类
+    /// </summary>
     public class PLCLinker : IEquipments
     {
         private Boolean isConnection = false;
@@ -85,6 +69,9 @@ namespace parkMonitor.server
 
         private int cx, cy, aa;
 
+        /// <summary>
+        /// plc构造函数
+        /// </summary>
         public PLCLinker()
         {
             try
@@ -476,6 +463,10 @@ namespace parkMonitor.server
             }
         }
         //***************公有方法****************
+        /// <summary>
+        /// 获取plc数据与激光数据
+        /// </summary>
+        /// <returns>返回plc消息实例</returns>
         public AbstractMessage GetMessage()
         {
             try
@@ -494,6 +485,10 @@ namespace parkMonitor.server
             }
         }
 
+        /// <summary>
+        /// 传入信息写入plc
+        /// </summary>
+        /// <param name="message">plc消息则传入plc,控制消息则根据指令编号分别处理</param>
         public void SetMessage(AbstractMessage message)
         {
             if (message.GetType().Equals(typeof(PLCMessage)))
@@ -684,6 +679,9 @@ namespace parkMonitor.server
             LinkStart();
         }
 
+        /// <summary>
+        /// 系统停止
+        /// </summary>
         public void Stop()
         {
             exceptionBreak = false; isClosing = true;

+ 3 - 0
parkMonitor/server/WebThread/CentralForWebSocketServer.cs

@@ -13,6 +13,9 @@ using parkMonitor.server.uiLogServer;
 
 namespace parkMonitor.server.WebThread
 {
+    /// <summary>
+    /// web线程类,接收用户指令
+    /// </summary>
     public class CentralForWeb : IEquipments
     {
         public MultiSocketThread multiSocketThread { set; get; }