Exemple #1
0
    // Convert a uaf::QualifiedName to a OpcUa_QualifiedName
    // =============================================================================================
    Status NamespaceArray::fillOpcUaQualifiedName(
            const QualifiedName& qualifiedName,
            OpcUa_QualifiedName& opcUaQualifiedName) const
    {
        Status ret;

        // check if the browse name has a namespace URI for which we can find an index
        if (qualifiedName.hasNameSpaceUri())
        {
            // we need to get a valid namespace index
            NameSpaceIndex nameSpaceIndex;

            if (findNamespaceIndex(qualifiedName.nameSpaceUri(), nameSpaceIndex))
            {
                // copy the contents from the qualified name to the SDK object
                // (except the namespaceUri because that's not relevant for the SDK object anyway)
                QualifiedName(qualifiedName.name(), nameSpaceIndex).toSdk(&opcUaQualifiedName);
                ret = statuscodes::Good;
            }
            else
            {
                ret = UnknownNamespaceUriError();
            }
        }
        else if (qualifiedName.hasNameSpaceIndex())
        {
            // OK we don't have a namespace URI but we do have a namespace index
            qualifiedName.toSdk(&opcUaQualifiedName);
            ret = statuscodes::Good;
        }
        else
        {
            // we have no possible means to get the namespace index
            ret = NoNamespaceIndexOrUriGivenError();
        }

        return ret;
    }