feat(dcl): bounded recursive OPC UA address-space search adapter (T15)
This commit is contained in:
@@ -17,7 +17,7 @@ namespace ZB.MOM.WW.ScadaBridge.DataConnectionLayer.Adapters;
|
||||
/// - Read/Write → Read/Write service calls
|
||||
/// - Quality → OPC UA StatusCode mapping
|
||||
/// </summary>
|
||||
public class OpcUaDataConnection : IDataConnection, IBrowsableDataConnection, IAlarmSubscribableConnection
|
||||
public class OpcUaDataConnection : IDataConnection, IBrowsableDataConnection, IAlarmSubscribableConnection, IAddressSpaceSearchable
|
||||
{
|
||||
private readonly IOpcUaClientFactory _clientFactory;
|
||||
private readonly ILogger<OpcUaDataConnection> _logger;
|
||||
@@ -302,6 +302,19 @@ public class OpcUaDataConnection : IDataConnection, IBrowsableDataConnection, IA
|
||||
CancellationToken cancellationToken = default)
|
||||
=> _client!.BrowseChildrenAsync(parentNodeId, continuationToken, cancellationToken);
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<AddressSpaceSearchResult> SearchAddressSpaceAsync(
|
||||
string query, int maxDepth, int maxResults, CancellationToken cancellationToken = default)
|
||||
{
|
||||
// Guard connection state with the typed ConnectionNotConnectedException so
|
||||
// the site-side handler can map it uniformly (mirrors BrowseChildrenAsync,
|
||||
// whose underlying client throws the same type when the session is down).
|
||||
if (_client == null || !_client.IsConnected)
|
||||
throw new ConnectionNotConnectedException("OPC UA client is not connected.");
|
||||
|
||||
return _client.SearchAddressSpaceAsync(query, maxDepth, maxResults, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<bool> WriteBatchAndWaitAsync(
|
||||
IDictionary<string, object?> values, string flagPath, object? flagValue,
|
||||
|
||||
Reference in New Issue
Block a user