How to use the node-opcua-service-translate-browse-path.constructBrowsePathFromQualifiedName function in node-opcua-service-translate-browse-path

To help you get started, we’ve selected a few node-opcua-service-translate-browse-path 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 / source / helpers / check_event_clause.ts View on Github external
if (!eventTypeNode || !(eventTypeNode.nodeClass === NodeClass.ObjectType)) {
        // xx console.log("eventTypeNode = ",selectClause.typeDefinitionId.toString());
        // xx console.log("eventTypeNode = ",eventTypeNode);
        // istanbul ignore next
        if (eventTypeNode) {
            console.log(eventTypeNode.toString());
        }
    }

    // istanbul ignore next
    if (eventTypeNode.nodeClass !== NodeClass.ObjectType) {
        throw new Error("Expecting a ObjectType");
    }

    // navigate to the innerNode specified by the browsePath [ QualifiedName]
    const browsePath = constructBrowsePathFromQualifiedName(eventTypeNode, selectClause.browsePath);
    const browsePathResult = addressSpace.browsePath(browsePath);
    return browsePathResult.statusCode;

}
github node-opcua / node-opcua / packages / node-opcua-address-space / src / event_data.ts View on Github external
public resolveSelectClause(selectClause: SimpleAttributeOperand) {
        const self = this;
        assert(selectClause instanceof SimpleAttributeOperand);
        const addressSpace = self.$eventDataSource.addressSpace;

        if (selectClause.browsePath!.length === 0 && selectClause.attributeId === AttributeIds.NodeId) {
            assert(!"Cannot use resolveSelectClause on this selectClause as it has no browsePath");
        }
        // navigate to the innerNode specified by the browsePath [ QualifiedName]
        const browsePath = constructBrowsePathFromQualifiedName(self.$eventDataSource, selectClause.browsePath);

        // xx console.log(self.$eventDataSource.browseName.toString());
        // xx console.log("xx browse Path", browsePath.toString());

        const browsePathResult = addressSpace.browsePath(browsePath);

        // xx console.log(" br",
        //    self.$eventDataSource.nodeId.toString(),
        //    selectClause.browsePath.toString(),
        //    browsePathResult.targets[0] ? browsePathResult.targets[0].targetId.toString() : "!!!NOT FOUND!!!"é)

        if (browsePathResult.statusCode !== StatusCodes.Good) {
            return null;
        }
        if (!browsePathResult.targets) {
            return null;
github node-opcua / node-opcua / packages / node-opcua-address-space / src / address_space_add_event_type.js View on Github external
EventData.prototype.resolveSelectClause = function(selectClause) {
    const self = this;
    assert(selectClause instanceof SimpleAttributeOperand);
    const addressSpace = self.$eventDataSource.addressSpace;

    if (selectClause.browsePath.length === 0 && selectClause.attributeId === AttributeIds.NodeId) {
        assert(!"Cannot use resolveSelectClause on this selectClause as it has no browsePath");
    }
    // navigate to the innerNode specified by the browsePath [ QualifiedName]
    const browsePath = constructBrowsePathFromQualifiedName(self.$eventDataSource, selectClause.browsePath);

    //xx console.log(self.$eventDataSource.browseName.toString());
    //xx console.log("xxxxxxxxxxxxx browse Pathx", browsePath.toString());

    const browsePathResult = addressSpace.browsePath(browsePath);

    //xx console.log(" br",self.$eventDataSource.nodeId.toString(),selectClause.browsePath.toString(),browsePathResult.targets[0] ? browsePathResult.targets[0].targetId.toString() : "!!!NOT FOUNF!!!".cyan)

    if (browsePathResult.statusCode !== StatusCodes.Good) {
        return null;
    }
    // istanbul ignore next
    if (browsePathResult.targets.length !== 1) {
        //xx console.log("selectClause ",selectClause.toString());
        //xx console.log("browsePathResult ",browsePathResult.toString());
        //xx throw new Error("browsePathResult.targets.length !== 1"  + browsePathResult.targets.length);