Exemplo n.º 1
0
 bool operator<(NodeId const& o) const {
     return code() < o.code();
 }
Exemplo n.º 2
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;
    }
Exemplo n.º 3
0
 bool operator==(NodeId const& o) const {
     return code() == o.code();
 }
Exemplo n.º 4
0
void TreeView::selectItem(NodeId id)
{
	QModelIndex index = model->findByNodeId(id.getId());
	if (index.isValid())
		selectItem(index);
}