/// <summary> /// Search cached query for all active nodeId of all servers in topology. /// Add new nodes to station topology. /// </summary> /// <param name="fullQuery">A cached query</param> /// <param name="topologyStations">List of stations in topology</param> private async Task AddNewNodes(RDXCachedAggregatedQuery fullQuery, List <string> topologyStations) { List <string> opcUaServers = fullQuery.GetActiveServerList(); foreach (string opcUaServer in opcUaServers) { ContosoOpcUaServer topologyNode = _topology[opcUaServer.ToLower()] as ContosoOpcUaServer; if (topologyNode != null) { List <string> topologyNodeIdList = topologyNode.NodeList.Select(x => x.NodeId).ToList(); List <string> activeNodeIdList = fullQuery.GetActiveNodeIdList(opcUaServer); var newNodeIdList = activeNodeIdList.Except(topologyNodeIdList, StringComparer.InvariantCultureIgnoreCase); if (newNodeIdList.Count() > 0) { RDXOpcUaQueries opcUaQueries = new RDXOpcUaQueries(CancellationToken.None); foreach (string newNodeId in newNodeIdList) { RDXTrace.TraceInformation("RDX Worker adding node {0} to server {1}", newNodeId, opcUaServer); string symbolicName = await opcUaQueries.QueryDisplayName(DateTime.UtcNow, opcUaServer, newNodeId); topologyNode.AddOpcServerNode( newNodeId, symbolicName, null, ContosoOpcNodeOpCode.Avg, null, true, null, null, null, null, null, null, null ); } } } } }