feat(cli): read --attribute reads one node attribute (e.g. Historizing, AccessLevel) (#921)

This commit is contained in:
Joseph Doherty
2026-11-28 09:28:59 -05:00
parent 05f431f5d8
commit a2a1104f20
7 changed files with 106 additions and 3 deletions
@@ -76,6 +76,14 @@ internal sealed class DefaultSessionAdapter : ISessionAdapter
return ValidateReadResult(response.ResponseHeader, response.Results, nodeId);
}
/// <inheritdoc />
public async Task<DataValue> ReadAttributeAsync(NodeId nodeId, uint attributeId, CancellationToken ct)
{
ArrayOf<ReadValueId> nodes = [new ReadValueId { NodeId = nodeId, AttributeId = attributeId }];
var response = await _session.ReadAsync(null, 0, TimestampsToReturn.Both, nodes, ct);
return ValidateReadResult(response.ResponseHeader, response.Results, nodeId);
}
internal static DataValue ValidateReadResult(ResponseHeader? header, ArrayOf<DataValue> results, NodeId nodeId)
{
var serviceStatus = header?.ServiceResult.Code ?? StatusCodes.BadUnexpectedError;