How to use the node-opcua-service-browse.BrowseResult function in node-opcua-service-browse

To help you get started, we’ve selected a few node-opcua-service-browse 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 / address_space.js View on Github external
if (typeof nodeId === "string") {
        const node = addressSpace.findNode(addressSpace.resolveNodeId(nodeId));
        if (node) {
            nodeId = node.nodeId;
        }
    }

    const browseResult = {
        statusCode: StatusCodes.Good,
        continuationPoint: null,
        references: null
    };
    if (browseDescription.browseDirection === BrowseDirection.Invalid) {
        browseResult.statusCode = StatusCodes.BadBrowseDirectionInvalid;
        return new BrowseResult(browseResult);
    }

    // check if referenceTypeId is correct
    if (browseDescription.referenceTypeId instanceof NodeId) {
        if (browseDescription.referenceTypeId.value === 0) {
            browseDescription.referenceTypeId = null;
        } else {
            const rf = addressSpace.findNode(browseDescription.referenceTypeId);
            if (!rf || !(rf instanceof ReferenceType)) {
                browseResult.statusCode = StatusCodes.BadReferenceTypeIdInvalid;
                return new BrowseResult(browseResult);
            }
        }
    }

    const obj = addressSpace.findNode(nodeId);
github node-opcua / node-opcua / packages / node-opcua-address-space / src / address_space.ts View on Github external
public browseSingleNode(
        nodeId: NodeIdLike,
        browseDescription: BrowseDescription,
        context?: SessionContext
    ): BrowseResult {

        const browseResult: BrowseResultOptions = {
            continuationPoint: undefined,
            references: null,
            statusCode: StatusCodes.Good
        };

        if (!browseDescription || browseDescription.browseDirection === BrowseDirection.Invalid) {
            browseResult.statusCode = StatusCodes.BadBrowseDirectionInvalid;
            return new BrowseResult(browseResult);
        }

        browseDescription.browseDirection =
            adjustBrowseDirection(browseDescription.browseDirection, BrowseDirection.Forward);

        /* istanbul ignore next */
        if (typeof nodeId === "number") {
            throw new Error("Not Implemented");
        }

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