Exemplo n.º 1
0
    // Copy to stack object
    // =============================================================================================
    Status NodeId::toSdk(OpcUa_NodeId *destination) const
    {
        Status ret;

        UaNodeId uaNodeId;
        ret = toSdk(uaNodeId);

        if (ret.isGood())
            uaNodeId.copyTo(destination);

        return ret;
    }
Exemplo n.º 2
0
 // Fill out the NodeId with information from an UaNodeId instance
 // =============================================================================================
 Status NodeId::fromSdk(const UaNodeId& uaNodeId)
 {
     OpcUa_NodeId sdkNodeId;
     uaNodeId.copyTo(&sdkNodeId);
     return fromSdk(sdkNodeId);
 }
Exemplo n.º 3
0
 // Fill out the NodeId with information from an UaNodeId instance
 // =============================================================================================
 Status NodeId::fromSdk(const UaNodeId& uaNodeId, const string& nameSpaceUri)
 {
     OpcUa_NodeId sdkNodeId;
     uaNodeId.copyTo(&sdkNodeId);
     return fromSdk(sdkNodeId, nameSpaceUri);
 }
Exemplo n.º 4
0
    // Convert a uaf::NodeId to a OpcUa_NodeId
    // =============================================================================================
    Status NamespaceArray::fillOpcUaNodeId(
            const NodeId& nodeId,
            OpcUa_NodeId& opcUaNodeId) const
    {
        Status ret;

        // we need to get a valid namespace index
        NameSpaceIndex nameSpaceIndex;

        // check if the browse name has a namespace URI for which we can find an index
        if (nodeId.hasNameSpaceUri())
        {

            if (findNamespaceIndex(nodeId.nameSpaceUri(), nameSpaceIndex))
                ret = statuscodes::Good;
            else
                ret = UnknownNamespaceUriError(
                        nodeId.nameSpaceUri(),
                        nameSpaceMap_,
                        toString(nameSpaceMap_));
        }
        else if (nodeId.hasNameSpaceIndex())
        {
            // OK we don't have a namespace URI but we do have a namespace index
            nameSpaceIndex = nodeId.nameSpaceIndex();
            ret = statuscodes::Good;
        }
        else
        {
            // we have no possible means to get the namespace index
            ret = NoNamespaceIndexOrUriGivenError();
        }


        // if the namespace index was found, update the OpcUa_NodeId
        if (ret.isGood())
        {
            UaNodeId uaNodeId;
            // update the NodeId identifier
            if (nodeId.identifier().type == nodeididentifiertypes::Identifier_Numeric)
            {
                uaNodeId.setNodeId(nodeId.identifier().idNumeric, nameSpaceIndex);
                uaNodeId.copyTo(&opcUaNodeId);
            }
            else if (nodeId.identifier().type == nodeididentifiertypes::Identifier_String)
            {
                uaNodeId.setNodeId(UaString(nodeId.identifier().idString.c_str()), nameSpaceIndex);
                uaNodeId.copyTo(&opcUaNodeId);
            }
            else if (nodeId.identifier().type == nodeididentifiertypes::Identifier_Guid)
            {
                UaGuid uaGuid;
                nodeId.identifier().idGuid.toSdk(uaGuid);
                uaNodeId.setNodeId(uaGuid, nameSpaceIndex);
                uaNodeId.copyTo(&opcUaNodeId);
            }
            else if (nodeId.identifier().type == nodeididentifiertypes::Identifier_Opaque)
            {
                UaByteString uaByteString;
                nodeId.identifier().idOpaque.toSdk(uaByteString);
                uaNodeId.setNodeId(uaByteString, nameSpaceIndex);
                uaNodeId.copyTo(&opcUaNodeId);
            }
            else
            {
                ret = UnsupportedNodeIdIdentifierTypeError();
            }
        }

        return ret;
    }