/// <summary> /// Fetches the event categories for the specified event type. /// </summary> private void LoadTypes(Opc.Ua.Client.Session client, IServerInternal server, NamespaceMapper mapper, NodeId parentId) { List <ReferenceDescription> references = null; // find references to subtypes. try { references = BrowseSubTypes(client, parentId); } catch (Exception e) { Utils.Trace("Could not browse subtypes of {0}. {1}", parentId, e.Message); return; } for (int ii = 0; ii < references.Count; ii++) { ReferenceDescription reference = references[ii]; // ignore absolute references. if (reference.NodeId == null || reference.NodeId.IsAbsolute) { continue; } // recursively browse until a non-UA node is found. if (reference.NodeId.NamespaceIndex == 0) { LoadTypes(client, server, mapper, (NodeId)reference.NodeId); continue; } // map the node id and browse name to local indexes. NodeId targetId = mapper.ToLocalId((NodeId)reference.NodeId); reference.NodeId = targetId; reference.BrowseName = mapper.ToLocalName(reference.BrowseName); // add non-UA node to the table. TypeNodes[targetId] = reference; server.TypeTree.AddSubtype(targetId, parentId); } }
/// <summary> /// Fetches the event categories for the specified event type. /// </summary> private void LoadTypes(Opc.Ua.Client.Session client, IServerInternal server, NamespaceMapper mapper, NodeId parentId) { List<ReferenceDescription> references = null; // find references to subtypes. try { references = BrowseSubTypes(client, parentId); } catch (Exception e) { Utils.Trace("Could not browse subtypes of {0}. {1}", parentId, e.Message); return; } for (int ii = 0; ii < references.Count; ii++) { ReferenceDescription reference = references[ii]; // ignore absolute references. if (reference.NodeId == null || reference.NodeId.IsAbsolute) { continue; } // recursively browse until a non-UA node is found. if (reference.NodeId.NamespaceIndex == 0) { LoadTypes(client, server, mapper, (NodeId)reference.NodeId); continue; } // map the node id and browse name to local indexes. NodeId targetId = mapper.ToLocalId((NodeId)reference.NodeId); reference.NodeId = targetId; reference.BrowseName = mapper.ToLocalName(reference.BrowseName); // add non-UA node to the table. TypeNodes[targetId] = reference; server.TypeTree.AddSubtype(targetId, parentId); } }