设备连接
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SqlSugarCore" Version="5.1.4.215-preview13" />
|
||||
<PackageReference Include="System.IO.Ports" Version="11.0.0-preview.4.26230.115" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
27
Model/Models/SerialPortConfig.cs
Normal file
27
Model/Models/SerialPortConfig.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.IO.Ports;
|
||||
|
||||
namespace Model.Models
|
||||
{
|
||||
/// <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;
|
||||
}
|
||||
}
|
||||
17
Model/Models/TcpConfig.cs
Normal file
17
Model/Models/TcpConfig.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace Model.Models
|
||||
{
|
||||
/// <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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user