设备连接

This commit is contained in:
hsc
2026-06-11 17:25:59 +08:00
parent a9ee9e974e
commit a62b6cbc8f
15 changed files with 144 additions and 35 deletions

View File

@@ -1,27 +0,0 @@
using System.IO.Ports;
namespace DeviceCommand.Base
{
/// <summary>
/// 串口通信参数DeviceCommand 内部纯数据类,供设备类构造函数使用)。
/// 与 UIShare.UIViewModel.SerialPortConfigVM 字段一一对应,
/// StopBits / Parity 在此处使用 System.IO.Ports 强类型枚举,
/// 由 DeviceManager 从字符串解析后填入。
/// </summary>
public class SerialPortConfig
{
public string PortName { get; set; } = "COM1";
public int BaudRate { get; set; } = 9600;
public int DataBits { get; set; } = 8;
public StopBits StopBits { get; set; } = StopBits.One;
public Parity Parity { get; set; } = Parity.None;
public int ReadTimeout { get; set; } = 3000;
public int WriteTimeout { get; set; } = 3000;
}
}

View File

@@ -1,4 +1,5 @@
using System;
using Model.Models;
using System;
using System.IO.Ports;
using System.Text;
using System.Threading;

View File

@@ -1,4 +1,5 @@
using System;
using Model.Models;
using System;
using System.IO;
using System.Net.Sockets;
using System.Text;

View File

@@ -1,17 +0,0 @@
namespace DeviceCommand.Base
{
/// <summary>
/// TCP 通信参数DeviceCommand 内部纯数据类,供设备类构造函数使用)。
/// 与 UIShare.UIViewModel.TcpConfigVM 字段一一对应,由 DeviceManager 在实例化时填充。
/// </summary>
public class TcpConfig
{
public string IPAddress { get; set; } = "127.0.0.1";
public int Port { get; set; } = 502;
public int SendTimeout { get; set; } = 3000;
public int ReceiveTimeout { get; set; } = 3000;
}
}

View File

@@ -13,6 +13,7 @@
<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj" />
<ProjectReference Include="..\Model\Model.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,5 +1,6 @@
using Common.Attributes;
using DeviceCommand.Base;
using Model.Models;
using System;
using System.Globalization;
using System.Threading;

View File

@@ -1,5 +1,6 @@
using Common.Attributes;
using DeviceCommand.Base;
using Model.Models;
using System;
using System.Globalization;
using System.Threading;

View File

@@ -1,5 +1,6 @@
using Common.Attributes;
using DeviceCommand.Base;
using Model.Models;
using System;
using System.ComponentModel;
using System.Globalization;

View File

@@ -1,5 +1,6 @@
using Common.Attributes;
using DeviceCommand.Base;
using Model.Models;
using System;
using System.Globalization;
using System.Threading;

View File

@@ -1,5 +1,6 @@
using Common.Attributes;
using DeviceCommand.Base;
using Model.Models;
using System;
using System.Globalization;
using System.Threading;

View File

@@ -1,5 +1,6 @@
using Common.Attributes;
using DeviceCommand.Base;
using Model.Models;
using System;
using System.Globalization;
using System.Threading;