How to use the node-opcua-data-model.BrowseDirection.Forward function in node-opcua-data-model

To help you get started, we’ve selected a few node-opcua-data-model examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-opcua / node-opcua / packages / node-opcua-address-space / src / nodeset_to_xml.ts View on Github external
{
            const r = node.findReferencesEx("HasSubtype", BrowseDirection.Inverse);
            if (r && r.length) {
                const subTypeOf = Reference.resolveReferenceNode(addressSpace, r[0])! as BaseNode;
                assert(r.length === 1);
                if (subTypeOf.nodeId.namespace === node.nodeId.namespace) {
                    // only output node if it is on the same namespace
                    if (!xw.visitedNode[_hash(subTypeOf)]) {
                        subTypeOf.dumpXML(xw);
                    }
                }
            }
        }
    } else {

        const r = node.findReferencesEx("Aggregates", BrowseDirection.Forward);
        for (const reference of r) {
            const nodeChild = Reference.resolveReferenceNode(addressSpace, reference) as BaseNode;
            assert(nodeChild instanceof BaseNode);
            if (nodeChild.nodeId.namespace === node.nodeId.namespace) {
                if (!xw.visitedNode[_hash(nodeChild)]) {
                    console.log(node.nodeId.toString(), " dumping child ", nodeChild.browseName.toString(), nodeChild.nodeId.toString());
                    nodeChild.dumpXML(xw);
                }
            }
        }
    }
}
github node-opcua / node-opcua / packages / node-opcua-address-space / src / address_space.js View on Github external
AddressSpace.prototype.browseSingleNode = function (nodeId, browseDescription, session) {
    const addressSpace = this;
    // create default browseDescription
    browseDescription = browseDescription || {};
    browseDescription.browseDirection = browseDescription.browseDirection || BrowseDirection.Forward;

    assert(browseDescription.browseDirection);

    //xx console.log(util.inspect(browseDescription,{colors:true,depth:5}));
    browseDescription = browseDescription || {};

    if (typeof nodeId === "string") {
        const node = addressSpace.findNode(addressSpace.resolveNodeId(nodeId));
        if (node) {
            nodeId = node.nodeId;
        }
    }

    const browseResult = {
        statusCode: StatusCodes.Good,
        continuationPoint: null,
github node-opcua / node-opcua / packages / node-opcua-client-proxy / source / object_explorer.ts View on Github external
referenceTypeId: makeRefId("HasTypeDefinition"),
            resultMask
        },
        // FromState
        {
            // BrowseDescription
            browseDirection: BrowseDirection.Forward,
            includeSubtypes: true,
            nodeId,
            referenceTypeId: makeRefId("FromState"),
            resultMask
        },
        // ToState
        {
            // BrowseDescription
            browseDirection: BrowseDirection.Forward,
            includeSubtypes: true,
            nodeId,
            referenceTypeId: makeRefId("ToState"),
            resultMask
        },
        // (for folders ) Organizes
        {
            // BrowseDescription
            browseDirection: BrowseDirection.Forward,
            includeSubtypes: true,
            nodeId,
            referenceTypeId: makeRefId("Organizes"),
            resultMask
        }
    ];
    session.browse(nodesToBrowse, (err: Error | null, browseResults?: BrowseResult[]) => {
github node-opcua / node-opcua / packages / node-opcua-address-space / src / base_node.js View on Github external
BaseNode.prototype.findReferencesEx = function (strReference, browseDirection) {

    browseDirection = browseDirection  !== undefined ? browseDirection : BrowseDirection.Forward;
    assert(_is_valid_BrowseDirection(browseDirection));
    assert(browseDirection !== BrowseDirection.Both);

    let referenceType = null;
    if (typeof strReference === "string") {
        //xx strReference = strReference.browseName.toString();
        referenceType = this.addressSpace.findReferenceType(strReference);
        if (!referenceType) {
            throw new Error("Cannot resolve referenceType : " + strReference);
        }
    } else {
        referenceType = strReference;
    }

    if (!referenceType) {
        // note: when loading nodeset2.xml files, reference type may not exit yet
github node-opcua / node-opcua / packages / node-opcua-address-space / src / base_node.js View on Github external
BaseNode.prototype._clone_children_references = function (newParent, optionalFilter, extraInfo) {

    const self = this;
    assert(newParent instanceof BaseNode);
    // find all reference that derives from the Aggregates
    const aggregatesRef = self.findReferencesEx("Aggregates", BrowseDirection.Forward);
    _clone_collection_new(newParent, aggregatesRef, optionalFilter, extraInfo);

};
BaseNode.prototype._clone_non_hierarchical_references = function (newParent, optionalFilter, extraInfo) {
github node-opcua / node-opcua / packages / node-opcua-client-proxy / source / object_explorer.ts View on Github external
obj: any,
    callback: ErrorCallback
) {

    const session = proxyManager.session;

    //   0   Object
    //   1   Variable
    //   2   Method
    const nodeId = obj.nodeId;
    const nodesToBrowse = [

        // Components (except Methods)
        {
            // BrowseDescription
            browseDirection: BrowseDirection.Forward,
            includeSubtypes: true,
            nodeClassMask: makeNodeClassMask("Object | Variable"), // we don't want Method here
            nodeId,
            referenceTypeId: makeRefId("HasComponent"),
            resultMask,
        },
        // Properties
        {
            // BrowseDescription
            browseDirection: BrowseDirection.Forward,
            includeSubtypes: true,
            // nodeClassMask: makeNodeClassMask("Variable"),
            nodeId,
            referenceTypeId: makeRefId("HasProperty"),
            resultMask
        },
github node-opcua / node-opcua / packages / node-opcua-address-space / src / base_node.ts View on Github external
function _is_valid_BrowseDirection(browseDirection: any) {
    return browseDirection === BrowseDirection.Forward ||
        browseDirection === BrowseDirection.Inverse ||
        browseDirection === BrowseDirection.Both
        ;
}
github node-opcua / node-opcua / packages / node-opcua-client / src / client_session.js View on Github external
function coerceBrowseDescription(data) {
    if (typeof data === "string" || data instanceof NodeId) {
        return coerceBrowseDescription({
            nodeId: data,
            includeSubtypes: true,
            browseDirection: BrowseDirection.Forward,
            nodeClassMask: 0,
            resultMask: 63,
            referenceTypeId: "HierarchicalReferences"
        });
    } else {
        data.nodeId = resolveNodeId(data.nodeId);
        data.referenceTypeId = data.referenceTypeId ? resolveNodeId(data.referenceTypeId) : null;
        return new browse_service.BrowseDescription(data);
    }
}
github node-opcua / node-opcua / packages / node-opcua-address-space / src / base_node.js View on Github external
function _is_valid_BrowseDirection(browseDirection) {
    return browseDirection === BrowseDirection.Forward ||
        browseDirection === BrowseDirection.Inverse ||
        browseDirection === BrowseDirection.Both
        ;
}