OPC UA服务器-字符串节点ID创建

时间:2018-06-23 08:30:32

标签: c# opc opc-ua

项目参考: https://github.com/OPCFoundation/UA-.NETStandard

我正在尝试创建一个包含某些方法的OPC UA服务器,并且需要为每个要公开的方法创建一个NodeId。 使用Integer标识符是可行的,但是使用String标识符,我无法使用OPC UA客户端调用该方法。

尝试使用第3部分客户端仍然无法正常工作,但是错误缺少NodeId,这似乎是预期的数字节点ID。

我不确定这是一个错误还是只是逃避了我。有人可以澄清我的疑问吗?

谢谢

使用(Prj:Opc.Ua.Core,文件:Node.cs)创建的NodeId整数:

    #region public NodeId(uint value, ushort namespaceIndex)
    /// <summary>
    /// Initializes a guid node identifier with a namespace index.
    /// </summary>
    /// <remarks>
    /// Creates a new NodeId that will use a numeric (unsigned int) for its Id, but also
    /// specifies which namespace this node should belong to.
    /// </remarks>
    /// <param name="value">The new (numeric) Id for the node being created</param>
    /// <param name="namespaceIndex">The index of the namespace that this node should belong to</param>
    /// <seealso cref="SetNamespaceIndex"/>
    public NodeId(uint value, ushort namespaceIndex)
    {
        m_namespaceIndex = namespaceIndex;
        m_identifierType = IdType.Numeric;
        m_identifier = value;
    }

    #endregion

使用(Prj:Opc.Ua.Core,文件:Node.cs)创建的NodeId字符串:

     #region public NodeId(string value, ushort namespaceIndex)
    /// <summary>
    /// Initializes a string node identifier with a namespace index.
    /// </summary>
    /// <remarks>
    /// Creates a new NodeId that will use a string for its Id, but also
    /// specifies if the Id is a URI, and which namespace this node belongs to.
    /// </remarks>
    /// <param name="value">The new (string) Id for the node being created</param>
    /// <param name="namespaceIndex">The index of the namespace that this node belongs to</param>
    public NodeId(string value, ushort namespaceIndex)
    {
        m_namespaceIndex = namespaceIndex;
        m_identifierType = IdType.String;
        m_identifier     = value;
    }

    #endregion

示例客户端返回此错误:

Here the error trying to call the method with String NodeId

0 个答案:

没有答案