Commit d0bf436c 张东亮

与斯坦德AGV通讯功能添加

1 个父辈 c7fcfbca
正在显示 62 个修改的文件 包含 2856 行增加70 行删除
......@@ -12,6 +12,12 @@
<!--二维码参数文件所在路径,文件名与二维码类型名一样-->
<add key="CodeParamPath" value="Conifg\" />
<add key="CodeCount" value="3" />
<!--斯坦德AGV配置-->
<add key="STD_IP" value="127.0.0.1" />
<add key="LStation" value="1" />
<add key="RStation" value="2" />
<add key="ShelfInAGV" value="3" />
<add key="ShelfOutAGV" value="4" />
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......@@ -34,6 +40,16 @@
<conversionPattern value="%m%n" />
</layout>
</appender>
<appender name="standrobot" type="log4net.Appender.RollingFileAppender">
<file value="logs/standrobot/standrobot.log" />
<param name="Encoding" value="UTF-8" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%m%n" />
</layout>
</appender>
<logger name="RollingLogFileAppender">
<level value="ALL" />
<appender-ref ref="RollingLogFileAppender" />
......@@ -46,6 +62,10 @@
<level value="ALL" />
<appender-ref ref="RollingLogFileAppender" />
</logger>
<logger name="standrobot">
<level value="info" />
<appender-ref ref="standrobot" />
</logger>
<!--<root>
<level value="Info" />
<appender-ref ref="RollingLogFileAppender" />
......
......@@ -38,23 +38,21 @@
<ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Asa.PrintLabel, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\PrintLabel\PrintLabel\bin\Debug\Asa.PrintLabel.dll</HintPath>
<Reference Include="Asa.PrintLabel">
<HintPath>..\dll\Asa.PrintLabel.dll</HintPath>
</Reference>
<Reference Include="CodeLibrary, Version=1.0.7703.30209, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\GeneralClassLibrary\CodeLibraryProject\CodeLibrary\bin\Debug\CodeLibrary.dll</HintPath>
<Reference Include="CodeLibrary">
<HintPath>..\dll\CodeLibrary.dll</HintPath>
</Reference>
<Reference Include="ConfigHelper">
<HintPath>..\..\ConfigHelper\ConfigHelper\bin\Debug\ConfigHelper.dll</HintPath>
<HintPath>..\dll\ConfigHelper.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath>
</Reference>
<Reference Include="Neotel.Rmaxis">
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\Neotel.Rmaxis.dll</HintPath>
<HintPath>..\dll\Neotel.Rmaxis.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
......@@ -188,6 +186,10 @@
<Project>{bb23296c-aa1d-45c6-9fa6-5a37b2abfe9b}</Project>
<Name>DeviceLibrary</Name>
</ProjectReference>
<ProjectReference Include="..\DL.StandardRobots\DL.StandardRobots.csproj">
<Project>{F85A7412-B5B3-4291-A448-A10564602E1A}</Project>
<Name>DL.StandardRobots</Name>
</ProjectReference>
<ProjectReference Include="..\LoadCVSLibrary\LoadCSVLibrary.csproj">
<Project>{064bebf5-8faa-4ea2-a5f3-a06e6e7d9251}</Project>
<Name>LoadCSVLibrary</Name>
......
......@@ -29,6 +29,7 @@ namespace AutoScanAndLabel
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.设备操作ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.启用调试模式ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
......@@ -36,6 +37,10 @@ namespace AutoScanAndLabel
this.二维码识别调试ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.退出ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.语言toolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.简体中文ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.日本语ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.englishToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.关于ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
......@@ -52,10 +57,6 @@ namespace AutoScanAndLabel
this.listView1 = new System.Windows.Forms.ListView();
this.btn_stop = new System.Windows.Forms.Button();
this.btn_run = new System.Windows.Forms.Button();
this.语言toolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.简体中文ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.日本语ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.englishToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
......@@ -120,6 +121,41 @@ namespace AutoScanAndLabel
this.退出ToolStripMenuItem.Text = "退出";
this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click);
//
// 语言toolStripMenuItem
//
this.语言toolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.简体中文ToolStripMenuItem,
this.日本语ToolStripMenuItem,
this.englishToolStripMenuItem});
this.语言toolStripMenuItem.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F);
this.语言toolStripMenuItem.Name = "语言toolStripMenuItem";
this.语言toolStripMenuItem.Size = new System.Drawing.Size(54, 25);
this.语言toolStripMenuItem.Text = "语言";
//
// 简体中文ToolStripMenuItem
//
this.简体中文ToolStripMenuItem.Name = "简体中文ToolStripMenuItem";
this.简体中文ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
this.简体中文ToolStripMenuItem.Tag = "not";
this.简体中文ToolStripMenuItem.Text = "简体中文";
this.简体中文ToolStripMenuItem.Click += new System.EventHandler(this.简体中文ToolStripMenuItem_Click);
//
// 日本语ToolStripMenuItem
//
this.日本语ToolStripMenuItem.Name = "日本语ToolStripMenuItem";
this.日本语ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
this.日本语ToolStripMenuItem.Tag = "not";
this.日本语ToolStripMenuItem.Text = "日本語";
this.日本语ToolStripMenuItem.Click += new System.EventHandler(this.日本语ToolStripMenuItem_Click);
//
// englishToolStripMenuItem
//
this.englishToolStripMenuItem.Name = "englishToolStripMenuItem";
this.englishToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
this.englishToolStripMenuItem.Tag = "not";
this.englishToolStripMenuItem.Text = "English";
this.englishToolStripMenuItem.Click += new System.EventHandler(this.englishToolStripMenuItem_Click);
//
// 关于ToolStripMenuItem
//
this.关于ToolStripMenuItem.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F);
......@@ -307,41 +343,6 @@ namespace AutoScanAndLabel
this.btn_run.UseVisualStyleBackColor = true;
this.btn_run.Click += new System.EventHandler(this.btn_run_Click);
//
// 语言toolStripMenuItem
//
this.语言toolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.简体中文ToolStripMenuItem,
this.日本语ToolStripMenuItem,
this.englishToolStripMenuItem});
this.语言toolStripMenuItem.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F);
this.语言toolStripMenuItem.Name = "语言toolStripMenuItem";
this.语言toolStripMenuItem.Size = new System.Drawing.Size(54, 25);
this.语言toolStripMenuItem.Text = "语言";
//
// 简体中文ToolStripMenuItem
//
this.简体中文ToolStripMenuItem.Name = "简体中文ToolStripMenuItem";
this.简体中文ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.简体中文ToolStripMenuItem.Tag = "not";
this.简体中文ToolStripMenuItem.Text = "简体中文";
this.简体中文ToolStripMenuItem.Click += new System.EventHandler(this.简体中文ToolStripMenuItem_Click);
//
// 日本语ToolStripMenuItem
//
this.日本语ToolStripMenuItem.Name = "日本语ToolStripMenuItem";
this.日本语ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.日本语ToolStripMenuItem.Tag = "not";
this.日本语ToolStripMenuItem.Text = "日本語";
this.日本语ToolStripMenuItem.Click += new System.EventHandler(this.日本语ToolStripMenuItem_Click);
//
// englishToolStripMenuItem
//
this.englishToolStripMenuItem.Name = "englishToolStripMenuItem";
this.englishToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.englishToolStripMenuItem.Tag = "not";
this.englishToolStripMenuItem.Text = "English";
this.englishToolStripMenuItem.Click += new System.EventHandler(this.englishToolStripMenuItem_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
......@@ -354,6 +355,7 @@ namespace AutoScanAndLabel
this.Controls.Add(this.tabControl1);
this.Controls.Add(this.menuStrip1);
this.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
......
using DeviceLibrary;
using DL.StandardRobot;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
......@@ -15,12 +16,55 @@ namespace AutoScanAndLabel.UC
{
public partial class AgvControl : UserControl
{
public string serverIp = "";
public AgvControl()
{
InitializeComponent();
serverIp = ConfigAppSettings.GetValue(Setting_Init.STD_IP);
AGVManager.Connect(serverIp);
load();
groupBox2.Text = $"AGV状态[{serverIp}]";
AGVManager.Register(MissionStateChanged);
endit(false);
}
~AgvControl()
{
AGVManager.UnRegister(MissionStateChanged);
AGVManager.Close();
}
private void load()
{
txtEnterId.Text=ConfigAppSettings.GetValue(Setting_Init.ShelfInAGV);
txtLeaveId.Text = ConfigAppSettings.GetValue(Setting_Init.ShelfOutAGV);
txtMoveLSTId.Text = ConfigAppSettings.GetValue(Setting_Init.LStation);
txtMoveRSTId.Text = ConfigAppSettings.GetValue(Setting_Init.RStation);
}
private void save()
{
ConfigAppSettings.SaveValue(Setting_Init.ShelfInAGV, txtEnterId.Text);
ConfigAppSettings.SaveValue(Setting_Init.ShelfOutAGV, txtLeaveId.Text);
ConfigAppSettings.SaveValue(Setting_Init.LStation, $"{txtMoveLSTId.Text}");
ConfigAppSettings.SaveValue(Setting_Init.RStation, $"{txtMoveRSTId.Text}");
}
private void MissionStateChanged(MissionState state)
{
if (!this.IsHandleCreated) return;
this.Invoke(new Action(() =>
{
try
{
lblCurMissionId.Text = $"当前任务编号:{state.MissionId}";
lblCurRunMissionId.Text = $"运行任务编号:{state.RunMissionId}";
lblMissionRunstate.Text = $"任务运行状态:{state.MissionRunState}";
lblMissionResult.Text = $"任务运行结果:{state.MissionResult}";
}
catch
{
}
}));
}
private void button_rightneedempty_Click(object sender, EventArgs e)
{
if (!RobotManage.isRunning)
......@@ -122,5 +166,24 @@ namespace AutoScanAndLabel.UC
else
MessageBox.Show("当前有料串不能请求进入料串");
}
private void btnSave_Click(object sender, EventArgs e)
{
save();
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
endit(checkBox1.Checked);
}
void endit(bool maul)
{
groupBox3.Enabled = maul;
}
private void button1_Click(object sender, EventArgs e)
{
int.TryParse(txtMissionId.Text,out int val);
AGVManager.AddMission(val);
}
}
}
......@@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="backgroundWorker1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
\ No newline at end of file
......@@ -33,9 +33,8 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath>
<Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
......@@ -44,6 +43,7 @@
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
......
......@@ -53,5 +53,11 @@ namespace OnlineStore.Common
public static string CodeParamPath = "CodeParamPath";
public static string QRCodeCount = "QRCodeCount";
public static string STD_IP = "STD_IP";
public static string LStation = "LStation";
public static string RStation = "RStation";
public static string ShelfInAGV = "ShelfInAGV";
public static string ShelfOutAGV = "ShelfOutAGV";
}
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.12" targetFramework="net461" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net461" />
</packages>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
namespace DL.Com
{
public class ComHelper
{
static UdpClient broadcastClient; //广播客户端
static IPEndPoint broadcastEndPoint; //广播远程节点
static byte[] broadcastBuffer; //远程返回数据
/// <summary>
/// 自动获取IP地址,未连接前使用,必须在同一网段
/// </summary>
/// <param name="localIP">本地IP地址</param>
/// <returns></returns>
public static bool AutoIP(string localIP,out string ip)
{
ip = "";
try
{
IPEndPoint local = new IPEndPoint(IPAddress.Parse(localIP), 55654);
broadcastClient = new UdpClient(local);
broadcastBuffer = null;
Thread tTemp = new Thread(new ThreadStart(GetIP));
tTemp.Start();
broadcastEndPoint = new IPEndPoint(IPAddress.Parse("255.255.255.255"), 1024);
byte[] dgram = new byte[] { 0x05, 0x00, 0x07, 0x00, 0x00, 0xC1, 0x59 };
broadcastClient.Send(dgram, dgram.Length, broadcastEndPoint);
Thread.Sleep(1000);
tTemp.Abort();
broadcastClient.Close();
//ErrInfo = "无法访问";
if (broadcastBuffer == null) return false;
if (broadcastBuffer[0] != 0x3B) return false;
byte[] buff = new byte[broadcastBuffer[7]];
Array.Copy(broadcastBuffer, 9, buff, 0, buff.Length);
ip = buff[buff.Length - 12] + "." + buff[buff.Length - 11] + "." + buff[buff.Length - 10] + "." + buff[buff.Length - 9];
//ErrInfo = "OK";
return true;
}
catch (Exception ex)
{
return false;
}
}
/// <summary>
/// 获取目标IP地址
/// </summary>
static void GetIP()
{
broadcastBuffer = broadcastClient.Receive(ref broadcastEndPoint);
}
}
}
<?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>{F85A7412-B5B3-4291-A448-A10564602E1A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DL.StandardRobot</RootNamespace>
<AssemblyName>DL.StandardRobot</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</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="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<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="Robots\StandardRobot.cs" />
<Compile Include="CommHelper.cs" />
<Compile Include="HttpHelper.cs" />
<Compile Include="JsonHelper.cs" />
<Compile Include="LogUtil.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Protocol\Modbus\CoilRegister.cs" />
<Compile Include="Protocol\Modbus\DataFrame.cs" />
<Compile Include="Protocol\Modbus\DiscreteInputRegister.cs" />
<Compile Include="Protocol\Modbus\HoldingRegister.cs" />
<Compile Include="Protocol\Modbus\InputRegister.cs" />
<Compile Include="Protocol\Modbus\Register.cs" />
<Compile Include="StringHelper.cs" />
<Compile Include="TCP\ModbusTCPMaster.cs" />
<Compile Include="TCP\TcpClient.cs" />
<Compile Include="TCP\TcpServer.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Protocol\Modbus\_system~.ini" />
<None Include="Protocol\_system~.ini" />
<None Include="TCP\_system~.ini" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj">
<Project>{43CDD09E-FCF3-4960-A01D-3BBFE9933122}</Project>
<Name>Common</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DL.Utils
{
public class HttpHelper
{
/// <summary>
/// 检查IP是否合法
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
public static bool CheckIP(string ip,string name="")
{
//IP合法
string pattern = @"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$";
bool rtn = System.Text.RegularExpressions.Regex.IsMatch(ip, pattern);
if (!rtn)
{
LogUtil.Error($"【{name}】非法的IP地址:" + ip);
return false;
}
return true;
}
/// <summary>
/// Ping指定IP
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
public static bool PingIP(string ip)
{
//Ping服务端
try
{
System.Net.NetworkInformation.Ping ping = new System.Net.NetworkInformation.Ping();
System.Net.NetworkInformation.PingReply result = ping.Send(ip, 2000);
ping.Dispose();
if (result.Status != System.Net.NetworkInformation.IPStatus.Success)
{
return false;
}
return true;
}
catch (Exception ex)
{
LogUtil.Error($"PingIP{ip}:", ex);
return false;
}
}
}
}
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json;
namespace DL.Utils
{
/// <summary>
/// Json帮助类
/// </summary>
public class JsonHelper
{
/// <summary>
/// 将对象序列化为JSON格式
/// </summary>
/// <param name="o">对象</param>
/// <returns>json字符串</returns>
public static string SerializeObject(object o)
{
string json = JsonConvert.SerializeObject(o);
return json;
}
/// <summary>
/// 解析JSON字符串生成对象实体
/// </summary>
/// <typeparam name="T">对象类型</typeparam>
/// <param name="json">json字符串(eg.{"ID":"112","Name":"石子儿"})</param>
/// <returns>对象实体</returns>
public static T DeserializeJsonToObject<T>(string json) where T : class
{
JsonSerializer serializer = new JsonSerializer();
StringReader sr = new StringReader(json);
object o = serializer.Deserialize(new JsonTextReader(sr), typeof(T));
T t = o as T;
return t;
}
/// <summary>
/// 解析JSON数组生成对象实体集合
/// </summary>
/// <typeparam name="T">对象类型</typeparam>
/// <param name="json">json数组字符串(eg.[{"ID":"112","Name":"石子儿"}])</param>
/// <returns>对象实体集合</returns>
public static List<T> DeserializeJsonToList<T>(string json) where T : class
{
JsonSerializer serializer = new JsonSerializer();
StringReader sr = new StringReader(json);
object o = serializer.Deserialize(new JsonTextReader(sr), typeof(List<T>));
List<T> list = o as List<T>;
return list;
}
/// <summary>
/// 反序列化JSON到给定的匿名对象.
/// </summary>
/// <typeparam name="T">匿名对象类型</typeparam>
/// <param name="json">json字符串</param>
/// <param name="anonymousTypeObject">匿名对象</param>
/// <returns>匿名对象</returns>
public static T DeserializeAnonymousType<T>(string json, T anonymousTypeObject)
{
T t = JsonConvert.DeserializeAnonymousType(json, anonymousTypeObject);
return t;
}
}
///// <summary>
///// 与服务器通信用对象
///// </summary>
//public class Operation
//{
// private string _cid = "";
// public string cid
// {
// get { return _cid; }
// set { _cid = value; }
// }
// public int seq { get; set; }
// public int op { get; set; }
// public int status { get; set; }
// private string _error = "";
// public string error
// {
// get { return _error; }
// set { _error = value; }
// }
// private Dictionary<string, string> _data = new Dictionary<string,string>();
// public Dictionary<string, string> data {
// get { return _data; }
// set { _data = value; }
// }
//}
}
using log4net;
using System;
using System.Reflection;
using System.Drawing;
using log4net.Repository;
using log4net.Config;
using System.IO;
using System.Text;
using System.Collections.Generic;
namespace DL.Utils
{
public class LogUtil
{
static Dictionary<string, ILog> LogMap = new Dictionary<string, ILog>();
public delegate void ShowMsg(string msg);
public static event ShowMsg ShowDebug;
public static event ShowMsg ShowInfo;
public static event ShowMsg ShowWarn;
public static event ShowMsg ShowError;
static readonly ILog defaultLog = LogManager.GetLogger("standrobot");
public static void Init()
{
XmlConfigurator.Configure(new FileInfo("log4net.config"));
LogMap.Add("AIOBOX", defaultLog);
}
public static void AddLogMap(string key, ILog log)
{
LogMap.Add(key, log);
}
#region Main log
public static void Debug(string msg, ILog log = null)
{
ShowDebug?.Invoke(msg);
if (log == null)
defaultLog.Debug(msg);
else
log.Debug(msg);
}
public static void Info(string msg, ILog log = null)
{
ShowInfo?.Invoke(msg);
if (log == null)
defaultLog.Info(msg);
else
log.Info(msg);
}
public static void Info(string msg, string logName)
{
ShowInfo?.Invoke(msg);
if (string.IsNullOrEmpty(logName))
defaultLog.Info(msg);
else if (LogMap.ContainsKey(logName) && LogMap[logName] != null)
LogMap[logName].Info(msg);
}
public static void Warn(string msg, ILog log = null)
{
ShowWarn?.Invoke(msg);
if (log == null)
defaultLog.Warn(msg);
else
log.Warn(msg);
}
public static void Error(string msg, Exception exception, ILog log)
{
StringBuilder sb = new StringBuilder(msg + "\r\n");
if (log == null)
{
if (exception == null)
defaultLog.Error(msg);
else
{
defaultLog.Error(msg, exception);
sb.Append(exception.StackTrace);
}
}
else
{
if (exception == null)
log.Error(msg);
else
{
log.Error(msg, exception);
sb.Append(exception.StackTrace);
}
}
ShowError?.Invoke(sb.ToString());
}
public static void Error(string msg, ILog log, Exception exception)
{
StringBuilder sb = new StringBuilder(msg + "\r\n");
if (log == null)
{
if (exception == null)
defaultLog.Error(msg);
else
{
defaultLog.Error(msg, exception);
sb.Append(exception.StackTrace);
}
}
else
{
if (exception == null)
log.Error(msg);
else
{
log.Error(msg, exception);
sb.Append(exception.StackTrace);
}
}
ShowError?.Invoke(sb.ToString());
}
public static void Error(string msg, ILog log)
{
StringBuilder sb = new StringBuilder(msg + "\r\n");
if (log == null)
{
defaultLog.Error(msg);
}
else
{
log.Error(msg);
}
ShowError?.Invoke(sb.ToString());
}
public static void Error(string msg, Exception exception)
{
StringBuilder sb = new StringBuilder(msg + "\r\n");
if (exception == null)
defaultLog.Error(msg);
else
{
defaultLog.Error(msg, exception);
sb.Append(exception.StackTrace);
}
ShowError?.Invoke(sb.ToString());
}
public static void Error(string msg)
{
defaultLog.Error(msg);
ShowError?.Invoke(msg);
}
#endregion
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("DL.StandardRobot")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DL.StandardRobot")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("f85a7412-b5b3-4291-a448-a10564602e1a")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DL.Com.Protocol.Modbus
{
/// <summary>
/// 线圈寄存器:可读可写。
/// 支持的功能码:
/// 0x01:读线圈
/// 0x05:写线圈
/// 0x0F:写多个线圈
/// </summary>
public class CoilRegister : Register
{
public CoilRegister() : base()
{
FunctionCodes.Add(RegisterFunction.Read, 0x01);
FunctionCodes.Add(RegisterFunction.WriteSingle, 0x05);
FunctionCodes.Add(RegisterFunction.WriteMultiple, 0x0F);
}
/// <summary>
/// PLC地址
/// </summary>
public new string PLCAddress
{
get { return $"0{FrameStruct.PDU.Data.Addr.GetIntValue()}"; }
}
/// <summary>
/// 解析写单个线圈
/// </summary>
/// <returns>写入成功</returns>
protected override bool ParseWriteSingle(byte[] respoonse)
{
if (GetResponseResult(respoonse, out byte[] data))
{
//数据部分,发送与接收一致
byte[] senddata = FrameStruct.PDU.Data.ToBytes();
if (data != null && data.Length != senddata.Length)
return false;
for (int i = 0; i < senddata.Length; i++)
{
if (senddata[i] != data[i])
{
return false;
}
}
return true;
}
return false;
}
/// <summary>
/// 解析写多个线圈
/// </summary>
/// <returns>写入成功/returns>
protected override bool ParseWriteMultiple(byte[] response)
{
if (GetResponseResult(response, out byte[] data))
{
byte[] senddata = FrameStruct.PDU.Data.AddrValueToBytes();
if (data != null && data.Length != senddata.Length)
return false;
for (int i = 0; i < senddata.Length; i++)
{
if (senddata[i] != data[i])
{
return false;
}
}
return true;
}
return false;
}
protected override void SetParamPDU(CmdByte cmd)
{
if (cmd.Function.Equals(RegisterFunction.WriteSingle))
{
SetPDU(cmd.Function, cmd.StartAddr, cmd.Count.Equals(new Byte2 { ByteH = 0x00, ByteL = 0x00 }) ? cmd.Count : new Byte2 { ByteH = 0xFF, ByteL = 0x00 }, cmd.ByteLength, cmd.ValuesOfMultiple);
}
else if (cmd.Function.Equals(RegisterFunction.WriteMultiple))
{
SetPDU(cmd.Function, cmd.StartAddr, cmd.Count, cmd.ByteLength, cmd.ValuesOfMultiple);
}
else
{
SetPDU(RegisterFunction.Read, cmd.StartAddr, cmd.Count);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DL.Com.Protocol.Modbus
{
/// <summary>
/// 离散输入寄存器
/// 功能码0x02
/// </summary>
public class DiscreteInputRegister:Register
{
/// <summary>
/// 离散输入寄存器
/// 功能码0x02
/// </summary>
public DiscreteInputRegister() :base()
{
FunctionCodes.Add(RegisterFunction.Read, 0x02);
}
/// <summary>
/// PLC地址
/// </summary>
public new string PLCAddress
{
get { return $"1{FrameStruct.PDU.Data.Addr.GetIntValue()}"; }
}
protected override bool ParseWriteMultiple(byte[] response)
{
throw new NotImplementedException();
}
protected override bool ParseWriteSingle(byte[] response)
{
throw new NotImplementedException();
}
protected override void SetParamPDU(CmdByte cmdByte)
{
SetPDU(RegisterFunction.Read, cmdByte.StartAddr, cmdByte.Count);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DL.Com.Protocol.Modbus
{
/// <summary>
/// 保持寄存器
/// 0x03
/// </summary>
public class HoldingRegister : Register
{
public HoldingRegister() : base()
{
FunctionCodes.Add(RegisterFunction.Read, 0x03);
FunctionCodes.Add(RegisterFunction.WriteSingle, 0x06);
FunctionCodes.Add(RegisterFunction.WriteMultiple, 0x10);
}
/// <summary>
/// PLC地址
/// </summary>
public new string PLCAddress
{
get { return $"4{FrameStruct.PDU.Data.Addr.GetIntValue()}"; }
}
public override byte[] GetRequestBytes(RegisterFunction func, ushort startAddr, ushort countOrValue,byte equipAddr=1, ushort[] ValuesOfMultiple = null)
{
CmdByte cmdByte = new CmdByte();
cmdByte.StartAddr = Byte2.GetStru2Byte(startAddr);
cmdByte.Function = func;
cmdByte.Count = Byte2.GetStru2Byte(countOrValue);
if (func.Equals(RegisterFunction.WriteMultiple))
{
if (ValuesOfMultiple == null)
return null;
List<byte> values = new List<byte>();
foreach (var item in ValuesOfMultiple)
{
values.AddRange(Byte2.GetStru2Byte(item).ToBytes());
}
cmdByte.ByteLength = (byte)(countOrValue * 2);
cmdByte.ValuesOfMultiple = values.ToArray();
}
SetMBAP(_serialnum, equipAddr);
SetParamPDU(cmdByte);
return DataFrame;
}
protected override void SetParamPDU(CmdByte cmdByte)
{
if (cmdByte.Function.Equals(RegisterFunction.WriteSingle))
{
SetPDU(cmdByte.Function, cmdByte.StartAddr, cmdByte.Count, cmdByte.ByteLength, cmdByte.ValuesOfMultiple);
}
else if (cmdByte.Function.Equals(RegisterFunction.WriteMultiple))
{
SetPDU(cmdByte.Function, cmdByte.StartAddr, cmdByte.Count, cmdByte.ByteLength, cmdByte.ValuesOfMultiple);
}
else
SetPDU(RegisterFunction.Read, cmdByte.StartAddr, cmdByte.Count);
}
protected override bool ParseWriteSingle(byte[] response)
{
if (GetResponseResult(response, out byte[] data))
{
//数据部分,发送与接收一致
byte[] senddata = FrameStruct.PDU.Data.ToBytes();
if (data != null && data.Length != senddata.Length)
return false;
for (int i = 0; i < senddata.Length; i++)
{
if (senddata[i] != data[i])
{
return false;
}
}
return true;
}
return false;
}
protected override bool ParseWriteMultiple(byte[] response)
{
if (GetResponseResult(response, out byte[] data))
{
byte[] senddata = FrameStruct.PDU.Data.AddrValueToBytes();
if (data != null && data.Length != senddata.Length)
return false;
for (int i = 0; i < senddata.Length; i++)
{
if (senddata[i] != data[i])
{
return false;
}
}
return true;
}
return false;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DL.Com.Protocol.Modbus
{
/// <summary>
/// 输入寄存器
/// 支持的功能码0x04
/// </summary>
public class InputRegister : Register
{
public InputRegister() : base()
{
FunctionCodes.Add(RegisterFunction.Read, 0x04);
}
/// <summary>
/// PLC地址
/// </summary>
public new string PLCAddress
{
get { return $"3{FrameStruct.PDU.Data.Addr.GetIntValue()}"; }
}
protected override bool ParseWriteMultiple(byte[] response)
{
throw new NotImplementedException();
}
protected override bool ParseWriteSingle(byte[] response)
{
throw new NotImplementedException();
}
protected override void SetParamPDU(CmdByte cmdByte)
{
SetPDU(RegisterFunction.Read, cmdByte.StartAddr, cmdByte.Count);
}
}
}
using DL.Com.Protocol.Modbus;
using DL.Utils;
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace DL.StandardRobot
{
/// <summary>
/// 斯坦德机器人类
/// </summary>
public class StandardRobot
{
public delegate void MissionStateChangedEventHandler(MissionState state);
/// <summary>
/// 任务态变化事件
/// </summary>
public event MissionStateChangedEventHandler MissionSateChanged;
/// <summary>
/// 设备地址
/// </summary>
private byte equipAddr = 1;
private Com.TCP.ModbusTCPMaster _client; //客户端
private bool _loop;
private MissionState missionState = new MissionState();
private const int SEND_SLEEP = 500; //每条命令发送的间隔
private const int PORT = 502; //端口
private Thread tSend; //发送命令处理
/// <summary>
/// 斯坦德机器人类
/// </summary>
/// <param name="logName"></param>
public StandardRobot()
{
_client = new Com.TCP.ModbusTCPMaster();
_client.ReceiveData += _client_ReceiveData;
}
MissionState preState = new MissionState();
/// <summary>
/// 收到的数据解析
/// </summary>
/// <param name="ip"></param>
/// <param name="port"></param>
/// <param name="requestInfo"></param>
/// <param name="data"></param>
private void _client_ReceiveData(string ip, int port, Com.TCP.RequestInfo requestInfo, byte[] data)
{
try
{
if (requestInfo.FunCode == 4)
{
if (data.Length >= 240)
{
preState.RunMissionId = GetUInt32(new byte[] { data[196], data[195], data[194], data[193] });
preState.MissionRunState = (MissionRunState)GetUInt16(data[198], data[197]);
preState.MissionResult = (MissionResult)GetUInt16(data[200], data[199]);
if (!missionState.Equals(preState))
{
missionState.RunMissionId = preState.RunMissionId;
missionState.MissionRunState = preState.MissionRunState;
missionState.MissionResult = preState.MissionResult;
MissionSateChanged?.Invoke(missionState);
}
}
}
}
catch (Exception ex)
{
LogUtil.Error($"ReceiveData:[{requestInfo}][{data}]", ex);
}
}
uint GetUInt32(byte[] data)
{
return (uint)(((data[0] & 0xff) << 24) | ((data[1] & 0xff) << 16) | ((data[2] & 0xff) << 8) | (data[3] & 0xff));
}
int GetInt32(byte[] data)
{
return (int)((data[0] << 24) | ((data[1] & 0xff) << 16) | ((data[2] & 0xff) << 8) | (data[3] & 0xff));
}
ushort GetUInt16(byte H, byte L)
{
return (ushort)(((H & 0xff) << 8) | (L & 0xff));
}
/// <summary>
/// IP地址
/// </summary>
public string IP { set; get; } = "192.168.1.100";
/// <summary>
/// 输入主动上传
/// </summary>
public bool Upload { set; get; } = false;
/// <summary>
/// 连接
/// </summary>
/// <returns></returns>
public bool Connect()
{
_loop = true;
bool rtn = Utils.HttpHelper.CheckIP(IP);
if (!rtn) return false;
_client.Connect(IP, PORT);
tSend = new Thread(new ThreadStart(Send)) { Name = "Send" };
tSend.IsBackground = true;
tSend.Start();
_client.AddRequest(GetInputRegister());
return true;
}
/// <summary>
/// 关闭连接
/// </summary>
public void Close()
{
_loop = false;
try
{
if (_client != null)
{
_client.Close();
}
}
finally
{
_client = null;
}
}
public MissionState GetMissionState()
{
return missionState;
}
/// <summary>
/// 创建任务,功能码16
/// </summary>
/// <returns></returns>
public bool AddMission(int id)
{
try
{
Com.TCP.RequestInfo request = new Com.TCP.RequestInfo();
request.StartAddr = 40097;//起始地址
request.FunCode = 16;//功能码
request.EquipAddr = equipAddr;
request.CountOrValue = 2; //个数
Byte4 byte4 = GetStru2Byte(id);
request.Values = new int[] {(int)GetUInt16(byte4.ByteH1, byte4.ByteH2), (int)GetUInt16(byte4.ByteL1, byte4.ByteL2) };
_client.AddRequest(request);
missionState.MissionId = (uint)id;
MissionSateChanged?.Invoke(missionState);
return true;
}
catch (Exception ex)
{
LogUtil.Error($"AddMission missionId:{id}", ex);
return false;
}
}
static Byte4 GetStru2Byte(int val)
{
return new Byte4
{
ByteH1 = (byte)((val >> 24) & 0xff),
ByteH2 = (byte)((val >> 16) & 0xff),
ByteL1 = (byte)((val >> 8) & 0xff),
ByteL2 = (byte)((val & 0xff))
};
}
/// <summary>
/// 发送命令线程
/// </summary>
private void Send()
{
while (_loop)
{
Com.TCP.RequestInfo request = GetInputRegister();
_client.AddRequest(request);
Thread.Sleep(SEND_SLEEP);
}
}
/// <summary>
/// 读取输入,功能码为04,读输入寄存器
/// </summary>
/// <returns></returns>
private Com.TCP.RequestInfo GetInputRegister()
{
Com.TCP.RequestInfo request = new Com.TCP.RequestInfo();
request.StartAddr = 30001;//起始地址
//功能码
request.FunCode = 4;
request.EquipAddr = equipAddr;
request.CountOrValue = 120; //个数
return request;
}
}
public class MissionState
{
public uint MissionId { get; set; }
public uint RunMissionId { get; set; }
public MissionResult MissionResult { get; set; }
public MissionRunState MissionRunState { get; set; }
public override bool Equals(object obj)
{
MissionState state = obj as MissionState;
if (state == null) return false;
if (this.RunMissionId.Equals(state.RunMissionId)
&& this.MissionResult.Equals(state.MissionResult) && this.MissionRunState.Equals(state.MissionRunState))
return true;
return false;
}
}
/// <summary>
/// Mission执行结果
/// </summary>
public enum MissionResult
{
无效状态,
任务执行成功,
任务取消,
任务执行出错
}
/// <summary>
/// 任务运行状态
/// </summary>
public enum MissionRunState
{
无效状态,
任务在队列中但没有启动 = 2,
正在执行,
暂停执行,
执行结束,
正在取消
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DL.Utils
{
public class StringHelper
{
/// <summary>
/// 字节转十六进制字符串
/// </summary>
/// <param name="buff"></param>
/// <returns></returns>
public static string ToHexString(byte[] buff)
{
StringBuilder sb = new StringBuilder("");
if (buff == null || buff.Length<1) return sb.ToString();
for (int i = 0; i < buff.Length; i++)
{
sb.Append(buff[i].ToString("X2"));
sb.Append(" ");
}
sb.Remove(sb.Length - 1, 1);
return sb.ToString();
}
public static string ToBinaryString(byte[] data)
{
StringBuilder stringBuilder = new StringBuilder("");
if (data == null || data.Length < 1) return stringBuilder.ToString();
stringBuilder.Append("【");
foreach (var item in data)
{
stringBuilder.Append(Convert.ToString(item, 2).PadLeft(8, '0'));
stringBuilder.Append(" ");
}
stringBuilder.Remove(stringBuilder.Length - 1, 1);
stringBuilder.Append("】");
return stringBuilder.ToString();
}
public static string ToHexString(byte data)
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("【");
stringBuilder.Append(data.ToString("x2"));
stringBuilder.Append("】");
return stringBuilder.ToString();
}
public static byte[] StrToHexByte(string hexString)
{
hexString = hexString.Replace(" ", "");
if ((hexString.Length % 2) != 0)
hexString += " ";
byte[] returnBytes = new byte[hexString.Length / 2];
for (int i = 0; i < returnBytes.Length; i++)
{
returnBytes[i]=Convert.ToByte(hexString.Substring(i*2,2),16);
}
return returnBytes;
}
/// <summary>
/// 获取类的属性名及其值
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="t"></param>
/// <returns></returns>
public static string GetPropertiesStr<T>(T t)
{
StringBuilder sb = new StringBuilder("");
if (t == null)
{
return sb.ToString();
}
System.Reflection.PropertyInfo[] properties = t.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
if (properties.Length <= 0)
{
return sb.ToString();
}
sb.Append("{");
foreach (System.Reflection.PropertyInfo property in properties)
{
string name = property.Name;
object value = property.GetValue(t, null);
if (property.PropertyType.IsValueType || property.PropertyType.Name.StartsWith("String"))
{
sb.Append($"{name}:{value},");
}
else if(property.PropertyType.IsGenericType)
{
var listVal = property.GetValue(t, null) as IEnumerable<object>;
if (listVal == null) continue;
sb.Append("[");
foreach (var item1 in listVal)
{
sb.Append(GetPropertiesStr(item1));
}
sb.Append("]");
}
else if(property.PropertyType.IsArray)
{
var listVal = property.GetValue(t, null) as IEnumerable<object>;
if (listVal == null) continue;
sb.Append("[");
foreach (var item1 in listVal)
{
sb.Append(GetPropertiesStr(item1));
}
sb.Append("]");
}
else
{
sb.Append(GetPropertiesStr(value));
}
}
sb.Append("}");
return sb.ToString();
}
}
}
using DL.Utils;
using log4net;
using System;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Text;
using System.Threading;
namespace DL.Com.TCP
{
public class TcpClient
{
public delegate void HandleMessage(string message, byte[] data);
private Socket m_clientSocket = null;
private byte[] m_receiveBuffer = new byte[1024];
private HandleMessage onReceived;
public int TimeOutTime = 2;
public string IP { get; set; }
public int Port { get; set; }
public TcpClient()
{
}
/// <summary>
/// 当前连接状态
/// </summary>
public bool IsConnected()
{
if (m_clientSocket == null)
{
return false;
}
return m_clientSocket.Connected;
//if (m_clientSocket.Connected)
//{
// return true;
//}
#region remarks
/********************************************************************************************
* 当Socket.Conneted为false时, 如果您需要确定连接的当前状态,请进行非阻塞、零字节的 Send 调用。
* 如果该调用成功返回或引发 WAEWOULDBLOCK 错误代码 (10035),则该套接字仍然处于连接状态;
* 否则,该套接字不再处于连接状态。
* Depending on http://msdn.microsoft.com/zh-cn/library/system.net.sockets.socket.connected.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-2
********************************************************************************************/
#endregion
try
{
#region 过程
// This is how you can determine whether a socket is still connected.
bool connectState = true;
bool blockingState = m_clientSocket.Blocking;
try
{
byte[] tmp = new byte[1];
m_clientSocket.Blocking = false;
m_clientSocket.Send(tmp, 0, 0);
//Console.WriteLine("Connected!");
connectState = true; //若Send错误会跳去执行catch体,而不会执行其try体里其之后的代码
}
catch (SocketException e)
{
// 10035 == WSAEWOULDBLOCK
if (e.NativeErrorCode.Equals(10035))
{
connectState = true;
}
else
{
connectState = false;
}
}
finally
{
if (m_clientSocket != null && m_clientSocket.Connected)
{
m_clientSocket.Blocking = blockingState;
}
}
//Console.WriteLine("Connected: {0}", client.Connected);
return connectState;
#endregion
}
catch (Exception ex)
{
//Log.Error("IsConnected 出错", log, ex);
return false;
}
}
/// <summary>
/// 连接服务器
/// </summary>
public bool Connect(string serverIP, int serverPort, HandleMessage HandleMessage)
{
IP=serverIP;
Port=serverPort;
m_clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
if (TimeOutTime <= 0)
{
IPEndPoint remoteEndPoint = new IPEndPoint(IPAddress.Parse(serverIP), serverPort);
m_clientSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
try
{
if (!m_clientSocket.Connected)
{
m_clientSocket.Connect(remoteEndPoint);
}
if (m_clientSocket.Connected)
{
m_clientSocket.BeginReceive(m_receiveBuffer, 0, m_receiveBuffer.Length, 0, new AsyncCallback(ReceiveCallBack), null);
onReceived = HandleMessage;
LogUtil.Info("Connect to " + serverIP + ":" + serverPort + " success!");
return true;
}
else
{
LogUtil.Info("Connect to " + serverIP + ":" + serverPort + " fail!");
}
}
catch (Exception ex)
{
LogUtil.Error("Connect to " + serverIP + ":" + serverPort + " fail!", ex);
//m_clientSocket = null;
}
}
else
{
m_clientSocket.ReceiveTimeout = TimeOutTime;
m_clientSocket.SendTimeout = TimeOutTime;
IAsyncResult connResult = m_clientSocket.BeginConnect(serverIP, serverPort, null, null);
connResult.AsyncWaitHandle.WaitOne(this.TimeOutTime, true); //等待2秒
if (!connResult.IsCompleted || (!m_clientSocket.Connected))
{
LogUtil.Info("Connect to " + serverIP + ":" + serverPort + " fail!");
m_clientSocket.Close();
//处理连接不成功的动作
return false;
}
else
{
//处理连接成功的动作
m_clientSocket.BeginReceive(m_receiveBuffer, 0, m_receiveBuffer.Length, 0, new AsyncCallback(ReceiveCallBack), null);
onReceived = HandleMessage;
LogUtil.Info("Connect to " + serverIP + ":" + serverPort + " success!");
return true;
}
}
return false;
}
/// <summary>
/// 断开连接
/// </summary>
public void Close()
{
try
{
if (m_clientSocket != null && m_clientSocket.Connected)
{
m_clientSocket.Shutdown(SocketShutdown.Both);
//Thread.Sleep(300);
//m_clientSocket.Disconnect(true);
//Thread.Sleep(300);
m_clientSocket.Close();
//m_clientSocket = null;
LogUtil.Info("Socket closed!");
}
else
{
LogUtil.Error("No socket is running!");
}
}
catch (Exception ex)
{
LogUtil.Error("close error", ex);
}
}
/// <summary>
/// 发送信息
/// </summary>
public void Send(string strSendData)
{
byte[] sendBuffer = new byte[1024];
sendBuffer = Encoding.UTF8.GetBytes(strSendData);
if (m_clientSocket != null && m_clientSocket.Connected)
{
m_clientSocket.Send(sendBuffer);
LogUtil.Debug("Send >> " + strSendData);
}
}
public bool Send(byte[] bytes)
{
if (m_clientSocket != null && m_clientSocket.Connected)
{
m_clientSocket.Send(bytes);
LogUtil.Debug("Send >> " + StringHelper.ToHexString(bytes));
return true;
}
return false;
}
private void ReceiveCallBack(IAsyncResult ar)
{
try
{
if (m_clientSocket != null && m_clientSocket.Connected)
{
int REnd = m_clientSocket.EndReceive(ar);
string strReceiveData = Encoding.Default.GetString(m_receiveBuffer, 0, REnd);
byte[] tmp = new byte[REnd];
Array.Copy(m_receiveBuffer, tmp, REnd);
onReceived(strReceiveData, tmp);
Thread.Sleep(100);
m_clientSocket.BeginReceive(m_receiveBuffer, 0, m_receiveBuffer.Length, 0, new AsyncCallback(ReceiveCallBack), null);
}
}
catch (Exception ex)
{
LogUtil.Error("socket received error", ex);
}
}
}
}

using DL.Utils;
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace DL.Com
{
public class UdpServer
{
static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod()?.DeclaringType);
private Thread m_serverThread;
private Socket udpServer;
public delegate void ReviceMsg(EndPoint address, string Msg);
/// <summary>
/// 接受到数据事件
/// </summary>
public event ReviceMsg ReviceMsgEvent;
private bool isRun = true;
private int serverPort;
private void logLocalIp()
{
string[] addresses = GetLocalAddresses();
string iplist = "本机IP:[";
if (addresses.Length > 0)
{
for (int i = 0; i < addresses.Length; i++)
{
if (addresses.Length != 0)
{
iplist = iplist + " " + addresses[i];
}
}
}
LogUtil.Info(iplist + "]",log);
}
public UdpServer(int m_serverPort)
{
serverPort = m_serverPort;
}
/// <summary>
/// 开始服务
/// </summary>
public bool Start()
{
try
{
IPEndPoint ipep = new IPEndPoint(IPAddress.Any, serverPort);//定义一网络端点
udpServer = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);//定义一个Socket
udpServer.Bind(ipep);//Socket与本地的一个终结点相关联
m_serverThread = new Thread(new ThreadStart(ReceiveData));
m_serverThread.Start();
logLocalIp();
isRun = true;
return true;
}
catch (Exception ex)
{
LogUtil.Error("启动udpserver出错" ,log,ex);
}
return false;
}
/// <summary>
/// 停止服务
/// </summary>
public bool Stop()
{
try
{
isRun = false;
m_serverThread.Interrupt(); // 线程终止
udpServer.Close(); // Socket Close
return true;
}
catch (Exception ex)
{
LogUtil.Error("Stop Udpserver出错",log,ex);
}
return false;
}
private StringBuilder sb = new StringBuilder(); //这个是用来保存:接收到了的,但是还没有结束的消息
private int receiveBufferSize = 1024;
/// <summary>
/// 结束符
/// </summary>
public string terminateString = "\r";
private void ReceiveData()
{
try
{
IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0);//定义要发送的计算机的地址
EndPoint Remote = (EndPoint)(sender);//
while (true)
{
byte[] buffer = new byte[receiveBufferSize];
int receivedSize = udpServer.ReceiveFrom(buffer, ref Remote);
if (receivedSize > 0)
{
string rawMsg = Encoding.ASCII.GetString(buffer, 0, receivedSize);
int rnFixLength = terminateString.Length; //这个是指消息结束符的长度,此处为\r\n
for (int i = 0; i < rawMsg.Length;) //遍历接收到的整个buffer文本
{
if (i <= rawMsg.Length - rnFixLength)
{
if (rawMsg.Substring(i, rnFixLength) != terminateString)//非消息结束符,则加入sb
{
sb.Append(rawMsg[i]);
i++;
}
else
{
this.ReviceMsgEvent.Invoke(Remote, sb.ToString());//找到了消息结束符,触发消息接收完成事件
sb = new StringBuilder();
i += rnFixLength;
}
}
else
{
sb.Append(rawMsg[i]);
i++;
}
}
}
Thread.Sleep(500);
}
}
catch (Exception ex)
{
LogUtil.Error("启动udpserver出错:" ,log,ex);
}
}
/// <summary>
/// 获取本机地址列表
/// </summary>
public string[] GetLocalAddresses()
{
// 获取主机名
string strHostName = Dns.GetHostName();
// 根据主机名进行查找
IPHostEntry iphostentry = Dns.GetHostEntry(strHostName);
string[] retval = new string[iphostentry.AddressList.Length];
int i = 0;
foreach (IPAddress ipaddress in iphostentry.AddressList)
{
if (ipaddress.AddressFamily != AddressFamily.InterNetworkV6)
{
retval[i] = ipaddress.ToString();
i++;
}
}
return retval;
}
public bool IsOnline(string addr = "")
{
return isRun;
}
public string GetAddr()
{
return $"{string.Join(",",GetLocalAddresses())}:{serverPort}";
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DL.StandardRobot;
using static DL.StandardRobot.StandardRobot;
namespace DeviceLibrary
{
public class AGVManager
{
static StandardRobot robot = new StandardRobot();
public static void Connect(string ip)
{
robot.IP = ip;
robot.Connect();
}
public static void Close()
{
robot.Close();
}
public static MissionState GetMissionState()
{
return robot.GetMissionState();
}
public static void Register(MissionStateChangedEventHandler changedEventHandler)
{
robot.MissionSateChanged += changedEventHandler;
}
public static void UnRegister(MissionStateChangedEventHandler changedEventHandler)
{
robot.MissionSateChanged -= changedEventHandler;
}
public static void AddMission(int id)
{
robot.AddMission(id);
}
public static bool IsConnected()
{
return false;
}
}
}
......@@ -33,35 +33,37 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Asa.PrintLabel">
<HintPath>..\..\PrintLabel\PrintLabel\bin\Debug\Asa.PrintLabel.dll</HintPath>
<HintPath>..\dll\Asa.PrintLabel.dll</HintPath>
</Reference>
<Reference Include="CodeLibrary">
<HintPath>..\..\GeneralClassLibrary\CodeLibraryProject\CodeLibrary\bin\Debug\CodeLibrary.dll</HintPath>
<HintPath>..\dll\CodeLibrary.dll</HintPath>
</Reference>
<Reference Include="ConfigHelper">
<HintPath>..\..\ConfigHelper\ConfigHelper\bin\Debug\ConfigHelper.dll</HintPath>
<HintPath>..\dll\ConfigHelper.dll</HintPath>
</Reference>
<Reference Include="halcondotnet">
<HintPath>..\..\RC1271-DUOStore\dll\halcondotnet.dll</HintPath>
<HintPath>..\dll\halcondotnet.dll</HintPath>
</Reference>
<Reference Include="HuichuanLibrary">
<HintPath>..\..\HuichuanLibrary\HuichuanLibrary\bin\Debug\HuichuanLibrary.dll</HintPath>
<HintPath>..\dll\HuichuanLibrary.dll</HintPath>
</Reference>
<Reference Include="log4net">
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath>
<Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="Neotel.Rmaxis">
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\Neotel.Rmaxis.dll</HintPath>
<HintPath>..\dll\Neotel.Rmaxis.dll</HintPath>
</Reference>
<Reference Include="SdkApi.Core">
<HintPath>..\..\LinkOS-PC-Samples-ZSDK_DevDemos_.NET\Source\Sdk\SdkApi.Core.dll</HintPath>
<HintPath>..\dll\SdkApi.Core.dll</HintPath>
</Reference>
<Reference Include="SdkApi.Desktop">
<HintPath>..\..\LinkOS-PC-Samples-ZSDK_DevDemos_.NET\Source\Sdk\SdkApi.Desktop.dll</HintPath>
<HintPath>..\dll\SdkApi.Desktop.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
......@@ -90,7 +92,7 @@
<Compile Include="AutoScanAndLabel\RobotManage.cs" />
<Compile Include="AutoScanAndLabel\IRobot.cs" />
<Compile Include="AutoScanAndLabel\MainMachine.cs" />
<Compile Include="Class1.cs" />
<Compile Include="AGVManager.cs" />
<Compile Include="DeviceLibrary\ElectricGripper.cs" />
<Compile Include="DeviceLibrary\IAxisManager.cs" />
<Compile Include="DeviceLibrary\AxisManager.cs" />
......@@ -126,6 +128,10 @@
<Project>{43cdd09e-fcf3-4960-a01d-3bbfe9933122}</Project>
<Name>Common</Name>
</ProjectReference>
<ProjectReference Include="..\DL.StandardRobots\DL.StandardRobots.csproj">
<Project>{f85a7412-b5b3-4291-a448-a10564602e1a}</Project>
<Name>DL.StandardRobots</Name>
</ProjectReference>
<ProjectReference Include="..\LoadCVSLibrary\LoadCSVLibrary.csproj">
<Project>{064bebf5-8faa-4ea2-a5f3-a06e6e7d9251}</Project>
<Name>LoadCSVLibrary</Name>
......
......@@ -97,7 +97,7 @@ namespace DeviceLibrary
LogUtil.error("加载HIK相机出错:" + ex.ToString());
}
}
string[] names = Camera._cam.Name;
string[] names = Camera._cam?.Name;
if (names != null)
......
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.12" targetFramework="net472" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net461" requireReinstallation="true" />
</packages>
\ No newline at end of file
......@@ -33,12 +33,13 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath>
<Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
......@@ -64,6 +65,9 @@
<Name>Common</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</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.
......
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.12" targetFramework="net461" />
</packages>
\ No newline at end of file

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30907.101
# Visual Studio Version 17
VisualStudioVersion = 17.3.32811.315
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadCSVLibrary", "LoadCVSLibrary\LoadCSVLibrary.csproj", "{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}"
EndProject
......@@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoScanAndLabel", "AutoSca
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceLibrary", "DeviceLibrary\DeviceLibrary.csproj", "{BB23296C-AA1D-45C6-9FA6-5A37B2ABFE9B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DL.StandardRobots", "DL.StandardRobots\DL.StandardRobots.csproj", "{F85A7412-B5B3-4291-A448-A10564602E1A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -33,6 +35,10 @@ Global
{BB23296C-AA1D-45C6-9FA6-5A37B2ABFE9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BB23296C-AA1D-45C6-9FA6-5A37B2ABFE9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BB23296C-AA1D-45C6-9FA6-5A37B2ABFE9B}.Release|Any CPU.Build.0 = Release|Any CPU
{F85A7412-B5B3-4291-A448-A10564602E1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F85A7412-B5B3-4291-A448-A10564602E1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F85A7412-B5B3-4291-A448-A10564602E1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F85A7412-B5B3-4291-A448-A10564602E1A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
\ No newline at end of file
namespace Test
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.button3 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(113, 47);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(98, 41);
this.button1.TabIndex = 0;
this.button1.Text = "连接";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(113, 117);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(98, 41);
this.button2.TabIndex = 1;
this.button2.Text = "关闭";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(373, 47);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(345, 264);
this.textBox1.TabIndex = 2;
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(84, 217);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(100, 21);
this.textBox2.TabIndex = 3;
this.textBox2.Text = "0";
//
// button3
//
this.button3.Location = new System.Drawing.Point(84, 255);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(98, 41);
this.button3.TabIndex = 4;
this.button3.Text = "发送";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(13, 217);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(65, 12);
this.label1.TabIndex = 5;
this.label1.Text = "任务编号:";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.label1);
this.Controls.Add(this.button3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Label label1;
}
}
using DeviceLibrary;
using DL.StandardRobot;
using DL.Utils;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void MissionStateChanged(MissionState state)
{
textBox1.Invoke(new Action(() =>
{
{
textBox1.Text = JsonHelper.SerializeObject(state);
}
})) ;
}
private void button1_Click(object sender, EventArgs e)
{
AGVManager.Connect("127.0.0.1");
AGVManager.Register(MissionStateChanged);
}
private void button2_Click(object sender, EventArgs e)
{
AGVManager.UnRegister(MissionStateChanged);
AGVManager.Close();
}
private void button3_Click(object sender, EventArgs e)
{
int.TryParse(textBox2.Text,out int value);
AGVManager.AddMission(value);
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DeviceLibrary
namespace Test
{
public class Class1
internal static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Test")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("bac72c6b-699f-48bc-b212-916cfcc3ed13")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Test.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Test.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Test.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
<?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>{BAC72C6B-699F-48BC-B212-916CFCC3ED13}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Test</RootNamespace>
<AssemblyName>Test</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</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="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DeviceLibrary\DeviceLibrary.csproj">
<Project>{BB23296C-AA1D-45C6-9FA6-5A37B2ABFE9B}</Project>
<Name>DeviceLibrary</Name>
</ProjectReference>
<ProjectReference Include="..\DL.StandardRobots\DL.StandardRobots.csproj">
<Project>{f85a7412-b5b3-4291-a448-a10564602e1a}</Project>
<Name>DL.StandardRobots</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
<?xml version="1.0"?>
<doc>
<assembly>
<name>ConfigHelper</name>
</assembly>
<members>
<member name="F:ConfigHelper.AdvanceConfigEdit.CustomEditor">
<summary>
自定义编辑器
</summary>
</member>
<member name="F:ConfigHelper.AdvanceConfigEdit.components">
<summary>
必需的设计器变量。
</summary>
</member>
<member name="M:ConfigHelper.AdvanceConfigEdit.Dispose(System.Boolean)">
<summary>
清理所有正在使用的资源。
</summary>
<param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
</member>
<member name="M:ConfigHelper.AdvanceConfigEdit.InitializeComponent">
<summary>
设计器支持所需的方法 - 不要修改
使用代码编辑器修改此方法的内容。
</summary>
</member>
<member name="M:ConfigHelper.AdvanceConfigForm.AddCustomEditor``1(System.String)">
<summary>
添加自定义编辑器
</summary>
<typeparam name="T"></typeparam>
<param name="name"></param>
</member>
<member name="M:ConfigHelper.AdvanceConfigForm.ShowEditDialog(System.Windows.Forms.IWin32Window,System.Boolean)">
<summary>
显示配置界面,2秒内调用约6次后显示
</summary>
<param name="owner"></param>
<param name="TopMost"></param>
</member>
<member name="F:ConfigHelper.AdvanceConfigForm.components">
<summary>
Required designer variable.
</summary>
</member>
<member name="M:ConfigHelper.AdvanceConfigForm.Dispose(System.Boolean)">
<summary>
Clean up any resources being used.
</summary>
<param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
</member>
<member name="M:ConfigHelper.AdvanceConfigForm.InitializeComponent">
<summary>
Required method for Designer support - do not modify
the contents of this method with the code editor.
</summary>
</member>
<member name="T:ConfigHelper.Config">
<summary>
自定义配置存取
</summary>
</member>
<member name="F:ConfigHelper.Config.hasChange">
<summary>
指示配置文件是否存在变化
</summary>
</member>
<member name="P:ConfigHelper.Config.SaveToAppdata">
<summary>
将设置保存至appdata目录
</summary>
</member>
<member name="M:ConfigHelper.Config.ReloadConfig">
<summary>
重载配置
</summary>
</member>
<member name="M:ConfigHelper.Config.SetComment(System.String,System.String)">
<summary>
设置备注
</summary>
<param name="key"></param>
<param name="Comment"></param>
</member>
<member name="M:ConfigHelper.Config.Get(System.String)">
<summary>
读取配置
</summary>
<param name="key"></param>
<returns></returns>
</member>
<member name="M:ConfigHelper.Config.Get(System.Object)">
<summary>
读取配置
</summary>
<param name="key">传入一个枚举值</param>
<returns></returns>
</member>
<member name="M:ConfigHelper.Config.Get``1(System.Object,``0)">
<summary>
读取配置
</summary>
<typeparam name="T">返回类型</typeparam>
<param name="key">传入一个枚举值</param>
<param name="defaultvalue">失败默认值</param>
<returns></returns>
</member>
<member name="M:ConfigHelper.Config.Get``1(System.String,``0)">
<summary>
读取配置
</summary>
<typeparam name="T">返回类型</typeparam>
<param name="key">key</param>
<param name="defaultvalue">失败默认值</param>
<returns></returns>
</member>
<member name="M:ConfigHelper.Config.Set(System.String,System.String)">
<summary>
设置配置
</summary>
<param name="key"></param>
<param name="value"></param>
</member>
<member name="M:ConfigHelper.Config.Set(System.Object,System.String)">
<summary>
设置配置
</summary>
<param name="key">配置枚举值</param>
<param name="value"></param>
</member>
<member name="M:ConfigHelper.Config.Set``1(System.Object,``0)">
<summary>
设置配置
</summary>
<param name="key">配置枚举值</param>
<param name="value"></param>
</member>
<member name="M:ConfigHelper.Config.Set``1(System.String,``0)">
<summary>
设置配置
</summary>
<typeparam name="T">值类型</typeparam>
<param name="key"></param>
<param name="value"></param>
</member>
<member name="M:ConfigHelper.Config.SaveChangeDebounce">
<summary>
保存设置
</summary>
</member>
<member name="M:ConfigHelper.Config.SaveChange">
<summary>
保存设置
</summary>
</member>
<member name="M:ConfigHelper.Config.PropertyBind(System.Object,System.Object,System.String,System.String,System.String)">
<summary>
绑定UI属性
</summary>
<param name="key">配置key</param>
<param name="uiobj">ui对象</param>
<param name="Property">绑定属性</param>
<param name="SaveEvent">绑定事件(object s, EventArgs x),可以为空</param>
<param name="defaultvalue">默认值</param>
</member>
<member name="M:ConfigHelper.Config.PropertyBind``1(System.Object,System.Object,System.String,System.String,``0)">
<summary>
绑定UI属性
</summary>
<param name="key">配置key</param>
<param name="uiobj">ui对象</param>
<param name="Property">绑定属性</param>
<param name="SaveEvent">绑定事件(object s, EventArgs x),可以为空</param>
<param name="defaultvalue">默认值</param>
</member>
<member name="M:ConfigHelper.Config.LoadMyConfig(System.Type)">
<summary>
转换自定义配置类
</summary>
<param name="ConfigClassType"></param>
<returns>加载到的配置Key数量</returns>
</member>
<member name="T:ConfigHelper.ICustEditor">
<summary>
自定义编辑器接口
</summary>
</member>
<member name="M:ConfigHelper.ICustEditor.ValueEdit(System.Object)">
<summary>
自己的编辑方法或界面
</summary>
<param name="value">传入的值</param>
<returns>传出的值</returns>
</member>
<member name="T:ConfigHelper.MyConfig`1">
<summary>
自动化我的配置
</summary>
</member>
<member name="F:ConfigHelper.MyConfig`1.Key">
<summary>
配置的Key
</summary>
</member>
<member name="P:ConfigHelper.MyConfig`1.Val">
<summary>
配置的值
</summary>
</member>
<member name="M:ConfigHelper.MyConfig`1.ToString">
<summary>
获取配置数据的文本
</summary>
<returns></returns>
</member>
<member name="M:ConfigHelper.MyConfig`1.op_Implicit(ConfigHelper.MyConfig{`0})~`0">
<summary>
隐式转换
</summary>
<param name="m1"></param>
</member>
<member name="M:ConfigHelper.MyConfig`1.op_Implicit(`0)~ConfigHelper.MyConfig{`0}">
<summary>
隐式转换
</summary>
<param name="v1"></param>
</member>
<member name="T:ConfigHelper.MyConfigComment">
<summary>
自定义配置描述
</summary>
</member>
<member name="M:ConfigHelper.MyConfigComment.#ctor(System.String)">
<summary>
配置的说明
</summary>
<param name="comment"></param>
</member>
</members>
</doc>
此文件类型无法预览
此文件的差异被折叠, 点击展开。
此文件类型无法预览
<?xml version="1.0"?>
<doc>
<assembly>
<name>Neotel.Rmaxis</name>
</assembly>
<members>
<member name="T:Neotel.Rmaxis">
<summary>
增广智能电动夹爪(RM-C控制器)
</summary>
</member>
<member name="M:Neotel.Rmaxis.#ctor(System.String)">
<summary>
增广智能电动夹爪(RM-C控制器)
</summary>
<param name="logName">日志名</param>
</member>
<member name="P:Neotel.Rmaxis.IsPortOpen">
<summary>
串口是否连接
</summary>
</member>
<member name="P:Neotel.Rmaxis.IsMoving">
<summary>
轴是否在运动
</summary>
</member>
<member name="P:Neotel.Rmaxis.IsReached">
<summary>
轴是否到达运动目标
</summary>
</member>
<member name="P:Neotel.Rmaxis.IsPushEmpty">
<summary>
轴是否推空(可以在Push完成后检测是否推压/夹持为空)
</summary>
</member>
<member name="P:Neotel.Rmaxis.ErrorCode">
<summary>
错误代码
</summary>
</member>
<member name="M:Neotel.Rmaxis.OpenPort(System.String,System.UInt16)">
<summary>
打开串口
</summary>
<param name="portName">串口名</param>
<param name="axisNo">轴号</param>
<returns></returns>
</member>
<member name="M:Neotel.Rmaxis.ClosePort">
<summary>
关闭串口
</summary>
</member>
<member name="M:Neotel.Rmaxis.ResetError">
<summary>
重置控制器错误
</summary>
</member>
<member name="M:Neotel.Rmaxis.StopAxis">
<summary>
停止轴运动
</summary>
</member>
<member name="M:Neotel.Rmaxis.GetVersion">
<summary>
控制器版本号
</summary>
<returns></returns>
</member>
<member name="M:Neotel.Rmaxis.GetTorque">
<summary>
获取当前设置的出力值
</summary>
<returns>出力,%</returns>
</member>
<member name="M:Neotel.Rmaxis.GetVelocity">
<summary>
获取当前电机速度
</summary>
<returns>速度,mm/s</returns>
</member>
<member name="M:Neotel.Rmaxis.GetPosition">
<summary>
获取当前位置
</summary>
<returns>位置,mm</returns>
</member>
<member name="M:Neotel.Rmaxis.GoHome">
<summary>
回原点
</summary>
</member>
<member name="M:Neotel.Rmaxis.Push(System.Single,System.Single,System.Single)">
<summary>
推压运动
</summary>
<param name="force">出力,%</param>
<param name="distance">距离,mm</param>
<param name="velocity">速度,mm/s</param>
</member>
<member name="M:Neotel.Rmaxis.MoveAbsolute(System.Single,System.Single,System.Single,System.Single,System.Single)">
<summary>
绝对运动
</summary>
<param name="position">位置,mm</param>
<param name="velocity">速度,mm/s</param>
<param name="acceleration">加速度,mm/s^2</param>
<param name="deacceleration">减速度,mm/s^2</param>
<param name="band">定位范围,mm</param>
</member>
<member name="M:Neotel.Rmaxis.MoveTo(System.Single)">
<summary>
直接运动到指定位置
</summary>
<param name="position">位置,mm</param>
</member>
<member name="M:Neotel.Rmaxis.MoveConfig(System.Single,System.Single,System.Single)">
<summary>
直接运动的参数
</summary>
<param name="velocity">速度,mm/s</param>
<param name="acceleration">加速度,mm/s^2</param>
<param name="deacceleration">减速度,mm/s^2</param>
</member>
<member name="M:Neotel.Rmaxis.GoHomeWait(System.Int32)">
<summary>
回原点,并等到到位
</summary>
<param name="timeout">超时时间,ms</param>
<returns></returns>
</member>
<member name="M:Neotel.Rmaxis.PushWait(System.Single,System.Single,System.Single,System.Int32)">
<summary>
推压运动,并等到到位
</summary>
<param name="force">出力,%</param>
<param name="distance">距离,mm</param>
<param name="velocity">速度,mm/s</param>
<param name="timeout">超时时间,ms</param>
<returns></returns>
</member>
<member name="M:Neotel.Rmaxis.MoveAbsoluteWait(System.Single,System.Single,System.Single,System.Single,System.Single,System.Int32)">
<summary>
绝对运动,并等到到位
</summary>
<param name="position">位置,mm</param>
<param name="velocity">速度,mm/s</param>
<param name="acceleration">加速度,mm/s^2</param>
<param name="deacceleration">减速度,mm/s^2</param>
<param name="band">定位范围,mm</param>
<param name="timeout">超时时间,ms</param>
<returns></returns>
</member>
<member name="M:Neotel.Rmaxis.MoveToWait(System.Single,System.Int32)">
<summary>
直接运动到指定位置,并等到到位
</summary>
<param name="position">位置,mm</param>
<param name="timeout">超时时间,ms</param>
<returns></returns>
</member>
</members>
</doc>
此文件类型无法预览
此文件的差异太大,无法显示。
此文件类型无法预览
此文件太大,无法显示。
此文件类型无法预览
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!