feat(infra): add IOpcUaBridge interface and OpcUaBridge with OPC UA reconnection

This commit is contained in:
Joseph Doherty
2026-03-19 11:20:25 -04:00
parent 1b27b89ca0
commit 1d498b94b4
2 changed files with 331 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
namespace LmxFakeProxy.Bridge;
public record OpcUaReadResult(object? Value, DateTime SourceTimestamp, uint StatusCode);
public interface IOpcUaBridge : IAsyncDisposable
{
bool IsConnected { get; }
Task ConnectAsync(CancellationToken cancellationToken = default);
Task<OpcUaReadResult> ReadAsync(string nodeId, CancellationToken cancellationToken = default);
Task<uint> WriteAsync(string nodeId, object? value, CancellationToken cancellationToken = default);
Task<string> AddMonitoredItemsAsync(
IEnumerable<string> nodeIds,
int samplingIntervalMs,
Action<string, object?, DateTime, uint> onValueChanged,
CancellationToken cancellationToken = default);
Task RemoveMonitoredItemsAsync(string handle, CancellationToken cancellationToken = default);
event Action? Disconnected;
event Action? Reconnected;
}