コード例 #1
0
ファイル: UAModelContext.cs プロジェクト: yuriik83/OPC-UA-OOI
 /// <summary>
 /// Exports the node identifier.
 /// </summary>
 /// <param name="nodeId">The node identifier as the string.</param>
 /// <param name="defaultValue">The default value.</param>
 /// <param name="traceEvent">An <see cref="Action" /> delegate is used to trace event as the <see cref="TraceMessage" />.</param>
 /// <returns>The identifier an object of <see cref="System.Xml.XmlQualifiedName" /> or null if <paramref name="nodeId" /> has default value.</returns>
 internal XmlQualifiedName ExportBrowseName(string nodeId, NodeId defaultValue, Action<TraceMessage> traceEvent)
 {
     NodeId _id = ImportNodeId(nodeId, true, traceEvent);
       if (_id == defaultValue)
     return null;
       return m_AddressSpaceContext.ExportBrowseName(_id, traceEvent);
 }
コード例 #2
0
 internal UANodeContext UTTryGetUANodeContext(NodeId nodeId)
 {
     return TryGetUANodeContext(nodeId, x => { });
 }
コード例 #3
0
 private UANodeContext TryGetUANodeContext(NodeId nodeId, Action<TraceMessage> traceEvent)
 {
     UANodeContext _ret;
       if (!m_NodesDictionary.TryGetValue(nodeId.ToString(), out _ret))
       {
     traceEvent(TraceMessage.BuildErrorTraceMessage(BuildError.NodeIdNotDefined, String.Format("References to node with NodeId: {0} is omitted during the import.", nodeId)));
     return null;
       }
       if (_ret.UANode == null)
       {
     traceEvent(TraceMessage.BuildErrorTraceMessage(BuildError.NodeIdNotDefined, String.Format("NodeId: {0} is omitted during the import.", nodeId)));
     return null;
       }
       return _ret;
 }
コード例 #4
0
 internal UANodeContext GetOrCreateNodeContext(NodeId nodeId, UAModelContext modelContext, Action<TraceMessage> traceEvent)
 {
     UANodeContext _ret;
       string _idKey = nodeId.ToString();
       if (!m_NodesDictionary.TryGetValue(_idKey, out _ret))
       {
     _ret = new UANodeContext(this, modelContext, nodeId);
     m_NodesDictionary.Add(_idKey, _ret);
       }
       return _ret;
 }
コード例 #5
0
 /// <summary>
 /// Search the address space to find the node <paramref name="nodeId" /> and returns <see cref="XmlQualifiedName" />
 /// encapsulating the <see cref="UANode.BrowseName" /> of this node if exist. Returns<c>null</c> otherwise.
 /// </summary>
 /// <param name="nodeId">The identifier of the node to find.</param>
 /// <param name="traceEvent">Encapsulates an action used to trace events.</param>
 /// <returns>An instance of <see cref="XmlQualifiedName" /> representing the <see cref="UANode.BrowseName" /> of the node indexed by <paramref name="nodeId" /></returns>
 internal XmlQualifiedName ExportBrowseName(NodeId nodeId, Action<TraceMessage> traceEvent)
 {
     UANodeContext _context = TryGetUANodeContext(nodeId, traceEvent);
       if (_context == null)
     return null;
       return _context.ExportNodeBrowseName();
 }
コード例 #6
0
 private bool IsDefault(NodeId node)
 {
     NodeId _default = NodeId.Null;
       switch (ReferenceKind)
       {
     case ReferenceKindEnum.HasComponent:
       _default = ReferenceTypeIds.HasComponent;
       break;
     case ReferenceKindEnum.HasTypeDefinition:
       _default = ReferenceTypeIds.HasTypeDefinition;
       break;
     case ReferenceKindEnum.HasSubtype:
       _default = ReferenceTypeIds.HasSubtype;
       break;
     case ReferenceKindEnum.HasProperty:
       _default = ReferenceTypeIds.HasProperty;
       break;
     default:
       break;
       }
       return _default == node;
 }
コード例 #7
0
ファイル: UAModelContext.cs プロジェクト: yuriik83/OPC-UA-OOI
 internal NodeId ImportNodeId(string nodeId, bool lookupAlias, Action<TraceMessage> traceEvent)
 {
     if (String.IsNullOrEmpty(nodeId))
     return NodeId.Null;
       // lookup alias.
       if (lookupAlias)
     nodeId = LookupAlias(nodeId);
       // parse the string.
       NodeId _nodeId = NodeId.Parse(nodeId);
       if (_nodeId.NamespaceIndex > 0)
       {
     ushort namespaceIndex = ImportNamespaceIndex(_nodeId.NamespaceIndex);
     _nodeId = new NodeId(_nodeId.IdentifierPart, namespaceIndex);
       }
       return _nodeId;
 }