Files
lmxopcua/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip/IAbCipTemplateReader.cs
T
Joseph Doherty be421a4cb0 fix(abcip): native browse paging/pacing/template lease (#572); differential equal-refusal + budget isolation (#575)
#572: listing continues at max(instance in page)+1 (no ascending-order assumption, no-progress guard kept);
browsePageDelayMs (default 5 ms) paces pages; DiscoverAsync reads templates through one batch reader
(IAbCipTemplateReaderFactory.CreateBatch) holding one lease.
#575: differential harness reports a same-status template refusal as an equal refusal; offline test pins the
open-attempt budget without relying on the abort ending the phase.

Claude-Session: https://claude.ai/code/session_01Ef2ozxS7QPanGT8uoATbTe
2026-10-07 22:59:42 -04:00

42 lines
2.1 KiB
C#

namespace ZB.MOM.WW.OtOpcUa.Driver.AbCip;
/// <summary>
/// Reads the raw Template Object (class 0x6C) blob for a given UDT template instance id
/// off a Logix controller. The default production implementation (see
/// <see cref="LibplctagTemplateReader"/>) uses libplctag's <c>@udt/{id}</c> pseudo-tag.
/// Tests swap in a fake via <see cref="IAbCipTemplateReaderFactory"/>.
/// </summary>
public interface IAbCipTemplateReader : IDisposable
{
/// <summary>
/// Read the raw template bytes for <paramref name="templateInstanceId"/>. Returns the
/// full blob the Read Template service produced — the managed <see cref="CipTemplateObjectDecoder"/>
/// parses it into an <see cref="AbCipUdtShape"/>.
/// </summary>
/// <param name="deviceParams">The device connection parameters.</param>
/// <param name="templateInstanceId">The template instance ID to read.</param>
/// <param name="cancellationToken">Token to cancel the operation.</param>
/// <returns>The raw Template Object blob bytes.</returns>
Task<byte[]> ReadAsync(
AbCipTagCreateParams deviceParams,
uint templateInstanceId,
CancellationToken cancellationToken);
}
/// <summary>Factory for <see cref="IAbCipTemplateReader"/>.</summary>
public interface IAbCipTemplateReaderFactory
{
/// <summary>Creates a new template reader instance.</summary>
/// <returns>A new <see cref="IAbCipTemplateReader"/> instance.</returns>
IAbCipTemplateReader Create();
/// <summary>
/// Creates a reader meant to serve MANY <see cref="IAbCipTemplateReader.ReadAsync"/> calls: the native
/// reader then holds one device lease from its first read until it is disposed, so a caller fetching
/// N templates opens one connection rather than one per template. Dispose it when the batch ends.
/// The default is <see cref="Create"/> (a transport whose reader has no per-read connection cost).
/// </summary>
/// <returns>A new <see cref="IAbCipTemplateReader"/> instance.</returns>
IAbCipTemplateReader CreateBatch() => Create();
}