Add cross-platform OPC UA client stack: shared library, CLI tool, and Avalonia UI
Implements Client.Shared (IOpcUaClientService with connection lifecycle, failover, browse, read/write, subscriptions, alarms, history, redundancy), Client.CLI (8 CliFx commands mirroring tools/opcuacli-dotnet), and Client.UI (Avalonia desktop app with tree browser, read/write, subscriptions, alarms, and history tabs). All three target .NET 10 and are covered by 249 unit tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
using Opc.Ua;
|
||||
|
||||
namespace ZB.MOM.WW.LmxOpcUa.Client.Shared.Adapters;
|
||||
|
||||
/// <summary>
|
||||
/// Abstracts OPC UA subscription and monitored item management.
|
||||
/// </summary>
|
||||
internal interface ISubscriptionAdapter : IDisposable
|
||||
{
|
||||
uint SubscriptionId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Adds a data-change monitored item and returns its client handle for tracking.
|
||||
/// </summary>
|
||||
/// <param name="nodeId">The node to monitor.</param>
|
||||
/// <param name="samplingIntervalMs">The sampling interval in milliseconds.</param>
|
||||
/// <param name="onDataChange">Callback when data changes. Receives (nodeIdString, DataValue).</param>
|
||||
/// <param name="ct">Cancellation token.</param>
|
||||
/// <returns>A client handle that can be used to remove the item.</returns>
|
||||
Task<uint> AddDataChangeMonitoredItemAsync(NodeId nodeId, int samplingIntervalMs, Action<string, DataValue> onDataChange, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Removes a previously added monitored item by its client handle.
|
||||
/// </summary>
|
||||
Task RemoveMonitoredItemAsync(uint clientHandle, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Adds an event monitored item with the given event filter.
|
||||
/// </summary>
|
||||
/// <param name="nodeId">The node to monitor for events.</param>
|
||||
/// <param name="samplingIntervalMs">The sampling interval.</param>
|
||||
/// <param name="filter">The event filter defining which fields to select.</param>
|
||||
/// <param name="onEvent">Callback when events arrive. Receives the event field list.</param>
|
||||
/// <param name="ct">Cancellation token.</param>
|
||||
/// <returns>A client handle for the monitored item.</returns>
|
||||
Task<uint> AddEventMonitoredItemAsync(NodeId nodeId, int samplingIntervalMs, EventFilter filter, Action<EventFieldList> onEvent, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Requests a condition refresh for this subscription.
|
||||
/// </summary>
|
||||
Task ConditionRefreshAsync(CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Removes all monitored items and deletes the subscription.
|
||||
/// </summary>
|
||||
Task DeleteAsync(CancellationToken ct = default);
|
||||
}
|
||||
Reference in New Issue
Block a user