refactor(driver-ablegacy): extract AbLegacyDriverOptions to .Contracts
Move AbLegacyDriverOptions, AbLegacyDataType enum, and AbLegacyPlcFamilyProfile (including AbLegacyPlcFamily enum) to a new Driver.AbLegacy.Contracts sibling project. All three files are zero-dep after splitting AbLegacyDataTypeExtensions (which uses DriverDataType from Core.Abstractions) into a new file that stays in the runtime driver. Drop the doc-comment <see cref="AbLegacyAddress.TryParse"/> reference and replace with <c>AbLegacyAddress.TryParse</c> per the approved decision. The PlcFamilies using directive is retained in the contracts project since both namespaces live there. The runtime Driver.AbLegacy project gains a ProjectReference to .Contracts; the .slnx is updated accordingly.
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
using ZB.MOM.WW.OtOpcUa.Driver.AbLegacy.PlcFamilies;
|
||||
|
||||
namespace ZB.MOM.WW.OtOpcUa.Driver.AbLegacy;
|
||||
|
||||
/// <summary>
|
||||
/// AB Legacy (PCCC) driver configuration. One instance supports N devices (SLC 500 /
|
||||
/// MicroLogix / PLC-5 / LogixPccc). Per plan decision #41 AbLegacy ships separately from
|
||||
/// AbCip because PCCC's file-based addressing (<c>N7:0</c>) and Logix's symbolic addressing
|
||||
/// (<c>Motor1.Speed</c>) pull the abstraction in different directions.
|
||||
/// </summary>
|
||||
public sealed class AbLegacyDriverOptions
|
||||
{
|
||||
/// <summary>Gets or sets the list of PCCC devices to connect to.</summary>
|
||||
public IReadOnlyList<AbLegacyDeviceOptions> Devices { get; init; } = [];
|
||||
|
||||
/// <summary>Gets or sets the list of PCCC tag definitions.</summary>
|
||||
public IReadOnlyList<AbLegacyTagDefinition> Tags { get; init; } = [];
|
||||
|
||||
/// <summary>Gets or sets the probe (connectivity check) options.</summary>
|
||||
public AbLegacyProbeOptions Probe { get; init; } = new();
|
||||
|
||||
/// <summary>Gets or sets the default timeout for read/write operations.</summary>
|
||||
public TimeSpan Timeout { get; init; } = TimeSpan.FromSeconds(2);
|
||||
}
|
||||
|
||||
public sealed record AbLegacyDeviceOptions(
|
||||
string HostAddress,
|
||||
AbLegacyPlcFamily PlcFamily = AbLegacyPlcFamily.Slc500,
|
||||
string? DeviceName = null);
|
||||
|
||||
/// <summary>
|
||||
/// One PCCC-backed OPC UA variable. <paramref name="Address"/> is the canonical PCCC
|
||||
/// file-address string that parses via <c>AbLegacyAddress.TryParse</c>.
|
||||
/// </summary>
|
||||
public sealed record AbLegacyTagDefinition(
|
||||
string Name,
|
||||
string DeviceHostAddress,
|
||||
string Address,
|
||||
AbLegacyDataType DataType,
|
||||
bool Writable = true,
|
||||
bool WriteIdempotent = false);
|
||||
|
||||
public sealed class AbLegacyProbeOptions
|
||||
{
|
||||
/// <summary>Gets or sets a value indicating whether connectivity probing is enabled.</summary>
|
||||
public bool Enabled { get; init; } = true;
|
||||
|
||||
/// <summary>Gets or sets the interval between probe attempts.</summary>
|
||||
public TimeSpan Interval { get; init; } = TimeSpan.FromSeconds(5);
|
||||
|
||||
/// <summary>Gets or sets the timeout for each probe operation.</summary>
|
||||
public TimeSpan Timeout { get; init; } = TimeSpan.FromSeconds(2);
|
||||
|
||||
/// <summary>Gets or sets the probe address (defaults to <c>S:0</c> — status file, first word).</summary>
|
||||
public string? ProbeAddress { get; init; } = "S:0";
|
||||
}
|
||||
Reference in New Issue
Block a user