将Feature/XP.Common和Feature/XP.Hardware分支合并至Develop/XP.forHardwareAndCommon,完善XPapp注册和相关硬件类库通用类库功能。

This commit is contained in:
QI Mingxuan
2026-04-16 17:31:13 +08:00
parent 6ec4c3ddaa
commit 2bd6e566c3
581 changed files with 74600 additions and 222 deletions
+69
View File
@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace XP.Hardware.PLC.Configs
{
/// <summary>
/// PLC 类型枚举 | PLC Type Enumeration
/// </summary>
public enum PlcType
{
/// <summary>
/// S7-200Smart 系列 | S7-200Smart series
/// </summary>
S200Smart,
/// <summary>
/// S7-300 系列 | S7-300 series
/// </summary>
S300,
/// <summary>
/// S7-400 系列 | S7-400 series
/// </summary>
S400,
/// <summary>
/// S7-1200 系列 | S7-1200 series
/// </summary>
S1200,
/// <summary>
/// S7-1500 系列 | S7-1500 series
/// </summary>
S1500
}
public class PlcConfig
{
// 连接配置
public string IpAddress { get; set; } = "127.0.0.1";
public int Port { get; set; } = 502;
public short Rack { get; set; } = 0;
public short Slot { get; set; } = 1;
/// <summary>
/// PLC 型号类型 | PLC model type
/// </summary>
public PlcType PlcType { get; set; } = PlcType.S1200;
// 读取配置 | Read configuration
public string ReadDbBlock { get; set; } = "DB1";
public int ReadStartAddress { get; set; } = 0;
public int ReadLength { get; set; } = 100; // 字节长度
/// <summary>
/// 批量读取周期(ms| Bulk read interval (ms)
/// </summary>
public int BulkReadIntervalMs { get; set; } = 100;
// 超时与重试
public int ConnectTimeoutMs { get; set; } = 3000;
public int ReadTimeoutMs { get; set; } = 3000;
public int WriteTimeoutMs { get; set; } = 3000;
public bool bReConnect { get; set; } = false;
}
}