Files
lmxopcua/src/ZB.MOM.WW.OtOpcUa.Driver.AbLegacy/IAbLegacyTagRuntime.cs
T
2026-04-25 23:36:01 -04:00

41 lines
1.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
namespace ZB.MOM.WW.OtOpcUa.Driver.AbLegacy;
/// <summary>
/// Wire-layer abstraction over a single PCCC tag. Mirrors <c>IAbCipTagRuntime</c>'s shape so
/// the same test-fake pattern applies; the only meaningful difference is the protocol layer
/// underneath (<c>ab_pccc</c> vs <c>ab_eip</c>).
/// </summary>
public interface IAbLegacyTagRuntime : IDisposable
{
Task InitializeAsync(CancellationToken cancellationToken);
Task ReadAsync(CancellationToken cancellationToken);
Task WriteAsync(CancellationToken cancellationToken);
int GetStatus();
object? DecodeValue(AbLegacyDataType type, int? bitIndex);
void EncodeValue(AbLegacyDataType type, int? bitIndex, object? value);
/// <summary>
/// PR 7 — decode element <paramref name="elementIndex"/> of an N-element contiguous
/// block read. Implementations call the same per-element accessors used by
/// <see cref="DecodeValue"/> at offset <c>elementIndex × elementBytes</c>. Default
/// implementation throws so existing fakes that don't override remain explicit.
/// </summary>
object? DecodeArrayElement(AbLegacyDataType type, int elementIndex)
=> throw new NotSupportedException(
"Array decoding requires an IAbLegacyTagRuntime that overrides DecodeArrayElement.");
}
public interface IAbLegacyTagFactory
{
IAbLegacyTagRuntime Create(AbLegacyTagCreateParams createParams);
}
public sealed record AbLegacyTagCreateParams(
string Gateway,
int Port,
string CipPath,
string LibplctagPlcAttribute,
string TagName,
TimeSpan Timeout,
int ElementCount = 1);