Opc.Ua.Com.Server.ComDaBrowseCache.CreateBrowseElement C# (CSharp) Method

CreateBrowseElement() private method

Creates the browse element.
private CreateBrowseElement ( Session session, NodeId nodeId ) : BrowseElement
session Opc.Ua.Client.Session The session.
nodeId NodeId The node id.
return BrowseElement
        private BrowseElement CreateBrowseElement(Session session, NodeId nodeId)
        {
            TraceState("CreateBrowseElement", nodeId);
            BrowseElement element = new BrowseElement();

            element.NodeId = nodeId;
            element.ItemId = m_mapper.GetLocalItemId(nodeId);

            // browse the server for the children.
            BrowseDescriptionCollection nodesToBrowse = new BrowseDescriptionCollection();
            int index = PrepareBrowseElementBrowseRequest(nodeId, nodesToBrowse);

            // browse all elements at once.
            BrowseResultCollection results = Browse(session, nodesToBrowse);

            // update the element with the children found.
            if (!UpdateBrowseElement(element, nodesToBrowse, results, index))
            {
                return null;
            }

            // read the properties from the server.
            ReadValueIdCollection nodesToRead = new ReadValueIdCollection();
            index = PrepareBrowseElementReadRequest(nodeId, element.ReferencesByName, nodesToRead, NodeClass.Unspecified, true);

            DataValueCollection values = Read(session, nodesToRead);

            // update the browse element with the property values.
            if (!UpdateBrowseElement(session.TypeTree, element, nodesToRead, values, NodeClass.Unspecified, true, index))
            {
                return null;
            }

            return element;
        }