feat(s7): byte-buffer codec dispatch + Int64/UInt64/LReal scalar read+write

This commit is contained in:
Joseph Doherty
2026-06-17 05:38:18 -04:00
parent 06b858eb02
commit 286be5df88
7 changed files with 453 additions and 128 deletions
@@ -13,56 +13,7 @@ namespace ZB.MOM.WW.OtOpcUa.Driver.S7.Tests;
[Trait("Category", "Unit")]
public sealed class S7DiscoveryAndSubscribeTests
{
private sealed class RecordingAddressSpaceBuilder : IAddressSpaceBuilder
{
public readonly List<string> Folders = new();
public readonly List<(string Name, DriverAttributeInfo Attr)> Variables = new();
/// <summary>Adds a folder to the address space.</summary>
/// <param name="browseName">The browse name of the folder.</param>
/// <param name="displayName">The display name of the folder.</param>
/// <returns>This builder instance for method chaining.</returns>
public IAddressSpaceBuilder Folder(string browseName, string displayName)
{
Folders.Add(browseName);
return this;
}
/// <summary>Adds a variable to the address space.</summary>
/// <param name="browseName">The browse name of the variable.</param>
/// <param name="displayName">The display name of the variable.</param>
/// <param name="attributeInfo">The attribute information for the variable.</param>
/// <returns>A handle to the created variable.</returns>
public IVariableHandle Variable(string browseName, string displayName, DriverAttributeInfo attributeInfo)
{
Variables.Add((browseName, attributeInfo));
return new StubHandle();
}
/// <summary>Adds a property to a variable.</summary>
/// <param name="browseName">The browse name of the property.</param>
/// <param name="dataType">The data type of the property.</param>
/// <param name="value">The initial value of the property.</param>
public void AddProperty(string browseName, DriverDataType dataType, object? value) { }
/// <summary>Attaches an alarm condition to a variable.</summary>
/// <param name="sourceVariable">The variable to attach the alarm to.</param>
/// <param name="alarmName">The name of the alarm.</param>
/// <param name="alarmInfo">The alarm information.</param>
public void AttachAlarmCondition(IVariableHandle sourceVariable, string alarmName, DriverAttributeInfo alarmInfo) { }
private sealed class StubHandle : IVariableHandle
{
/// <summary>Gets the full reference of the variable.</summary>
public string FullReference => "stub";
/// <summary>Marks this variable as an alarm condition.</summary>
/// <param name="info">The alarm condition information.</param>
/// <returns>An alarm condition sink.</returns>
public IAlarmConditionSink MarkAsAlarmCondition(AlarmConditionInfo info)
=> throw new NotImplementedException("S7 driver never calls this — no alarm surfacing");
}
}
// RecordingAddressSpaceBuilder lives in S7TestBuilders.cs — shared across the S7 test suite.
/// <summary>Verifies that DiscoverAsync projects every configured tag into the address space.</summary>
[Fact]