diff --git a/src/ZB.MOM.WW.ScadaBridge.DataConnectionLayer/Adapters/IMxGatewayClient.cs b/src/ZB.MOM.WW.ScadaBridge.DataConnectionLayer/Adapters/IMxGatewayClient.cs index 02140a6b..edb2f9f9 100644 --- a/src/ZB.MOM.WW.ScadaBridge.DataConnectionLayer/Adapters/IMxGatewayClient.cs +++ b/src/ZB.MOM.WW.ScadaBridge.DataConnectionLayer/Adapters/IMxGatewayClient.cs @@ -18,7 +18,7 @@ public record MxReadOutcome(string TagPath, bool Success, object? Value, Quality public record MxWriteOutcome(string TagPath, bool Success, string? Error); /// One node in a Galaxy browse level. -public record MxBrowseChild(string NodeId, string DisplayName, BrowseNodeClass NodeClass, bool HasChildren); +public record MxBrowseChild(string NodeId, string DisplayName, BrowseNodeClass NodeClass, bool HasChildren, string? DataType = null); /// /// Seam over the MxAccess Gateway .NET client + Galaxy repository client. Decouples diff --git a/src/ZB.MOM.WW.ScadaBridge.DataConnectionLayer/Adapters/MxGatewayDataConnection.cs b/src/ZB.MOM.WW.ScadaBridge.DataConnectionLayer/Adapters/MxGatewayDataConnection.cs index aaac3ea2..9f012218 100644 --- a/src/ZB.MOM.WW.ScadaBridge.DataConnectionLayer/Adapters/MxGatewayDataConnection.cs +++ b/src/ZB.MOM.WW.ScadaBridge.DataConnectionLayer/Adapters/MxGatewayDataConnection.cs @@ -267,7 +267,7 @@ public class MxGatewayDataConnection : IDataConnection, IBrowsableDataConnection // and no continuation is ever surfaced (ContinuationToken stays null). var (children, truncated) = await _client.BrowseChildrenAsync(parentNodeId, cancellationToken); var nodes = children - .Select(c => new BrowseNode(c.NodeId, c.DisplayName, c.NodeClass, c.HasChildren)) + .Select(c => new BrowseNode(c.NodeId, c.DisplayName, c.NodeClass, c.HasChildren, DataType: c.DataType)) .ToList(); return new BrowseChildrenResult(nodes, truncated); } diff --git a/src/ZB.MOM.WW.ScadaBridge.DataConnectionLayer/Adapters/RealMxGatewayClient.cs b/src/ZB.MOM.WW.ScadaBridge.DataConnectionLayer/Adapters/RealMxGatewayClient.cs index 66f4f1a6..5a5d2c4e 100644 --- a/src/ZB.MOM.WW.ScadaBridge.DataConnectionLayer/Adapters/RealMxGatewayClient.cs +++ b/src/ZB.MOM.WW.ScadaBridge.DataConnectionLayer/Adapters/RealMxGatewayClient.cs @@ -266,7 +266,8 @@ public sealed class RealMxGatewayClient : IMxGatewayClient attr.FullTagReference, attr.AttributeName, BrowseNodeClass.Variable, - false)); + false, + string.IsNullOrEmpty(attr.DataTypeName) ? null : attr.DataTypeName)); } } diff --git a/tests/ZB.MOM.WW.ScadaBridge.DataConnectionLayer.Tests/Adapters/MxGatewayDataConnectionTests.cs b/tests/ZB.MOM.WW.ScadaBridge.DataConnectionLayer.Tests/Adapters/MxGatewayDataConnectionTests.cs index b8db9d87..981dbec4 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.DataConnectionLayer.Tests/Adapters/MxGatewayDataConnectionTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.DataConnectionLayer.Tests/Adapters/MxGatewayDataConnectionTests.cs @@ -245,6 +245,24 @@ public class MxGatewayDataConnectionTests Assert.Equal(BrowseNodeClass.Variable, result.Children[1].NodeClass); } + [Fact] + public async Task BrowseChildrenAsync_surfaces_attribute_datatype() + { + var fake = new FakeMxGatewayClient + { + BrowseHandler = _ => (new List + { + new("Area1.Pump.Speed", "Speed", BrowseNodeClass.Variable, false, "Double"), + }, false) + }; + var adapter = NewAdapter(fake); + await adapter.ConnectAsync(Details()); + + var result = await adapter.BrowseChildrenAsync(null); + + Assert.Equal("Double", result.Children[0].DataType); + } + [Fact] public async Task BrowseChildrenAsync_throws_when_not_connected() {