How to use the node-opcua-data-model.AttributeIds.BrowseName 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-client-dynamic-extension-object / source / client_dynamic_extension_object.ts View on Github external
if (result1.references && result1.references.length > 1) {
        // we have more than one possible Encoding .... only keep "Default Binary"
        result1.references = result1.references.filter((r: ReferenceDescription) =>
            r.browseName.toString() === "Default Binary");
    }

    /* istanbul ignore next */
    if (!(result1.references && result1.references.length === 1)) {

        const nodeClass = await session.read({
            attributeId: AttributeIds.NodeClass,
            nodeId: dataTypeNodeId
        });
        const browseName = await session.read({
            attributeId: AttributeIds.BrowseName,
            nodeId: dataTypeNodeId
        });

        // tslint:disable:no-console
        console.log("node-id    :", dataTypeNodeId.toString());
        console.log("nodeClass  :", NodeClass[nodeClass.value.value]);
        console.log("browseName :", browseName.value.value.toString());
        console.log(result1.toString());
        throw new Error("getDataTypeDefinition invalid HasEncoding reference");
    }

    const encodingReference = result1.references![0]!;
    assert(encodingReference.browseName.toString() === "Default Binary");

    // Xx console.log("Has Encoding ", encodingReference.browseName.toString(), encodingReference.nodeId.toString());
github node-opcua / node-opcua / packages / node-opcua-client-crawler / source / node_crawler.ts View on Github external
const browseNodeAction = (err: Error | null, cacheNode1?: CacheNode) => {
            if (err || !cacheNode1) {
                return;
            }
            for (const reference of cacheNode1.references) {
                // those ones come for free
                if (!this.has_cache_NodeAttribute(reference.nodeId, AttributeIds.BrowseName)) {
                    this.set_cache_NodeAttribute(reference.nodeId, AttributeIds.BrowseName, reference.browseName);
                }
                if (!this.has_cache_NodeAttribute(reference.nodeId, AttributeIds.DisplayName)) {
                    this.set_cache_NodeAttribute(reference.nodeId, AttributeIds.DisplayName, reference.displayName);
                }
                if (!this.has_cache_NodeAttribute(reference.nodeId, AttributeIds.NodeClass)) {
                    this.set_cache_NodeAttribute(reference.nodeId, AttributeIds.NodeClass, reference.nodeClass);
                }
            }
            this._emit_on_crawled(cacheNode1, task.param.userData);
            const userData = task.param.userData;
            if (userData.onBrowse) {
                userData.onBrowse(this, cacheNode1, userData);
            }
        };
github node-opcua / node-opcua / packages / node-opcua-client-proxy / source / object_explorer.ts View on Github external
function convertNodeIdToDataTypeAsync(
    session: IBasicSession,
    dataTypeId: NodeId,
    callback: Callback
) {

    const nodeToRead = {
        attributeId: AttributeIds.BrowseName,
        nodeId: dataTypeId,
    };

    session.read(nodeToRead, (err: Error | null, dataValue?: DataValue) => {

        // istanbul ignore next
        if (err) {
             setImmediate(() => {
                callback(err);
            });
             return;
        }

        dataValue = dataValue!;

        let dataType: DataType;
github node-opcua / node-opcua / packages / node-opcua-address-space / src / base_node.ts View on Github external
assert(!context || context instanceof SessionContext);
        const options: any = {};
        options.statusCode = StatusCodes.Good;

        switch (attributeId) {

            case AttributeIds.NodeId:  // NodeId
                options.value = { dataType: DataType.NodeId, value: this.nodeId };
                break;

            case AttributeIds.NodeClass: // NodeClass
                assert(_.isFinite(this.nodeClass));
                options.value = { dataType: DataType.Int32, value: this.nodeClass };
                break;

            case AttributeIds.BrowseName: // QualifiedName
                assert(this.browseName instanceof QualifiedName);
                options.value = { dataType: DataType.QualifiedName, value: this.browseName };
                break;

            case AttributeIds.DisplayName: // LocalizedText
                options.value = { dataType: DataType.LocalizedText, value: this.displayName[0] };
                break;

            case AttributeIds.Description: // LocalizedText
                options.value = { dataType: DataType.LocalizedText, value: this.description };
                break;

            case AttributeIds.WriteMask:
                options.value = { dataType: DataType.UInt32, value: this.getWriteMask() };
                break;
github node-opcua / node-opcua / packages / node-opcua-client-crawler / src / node_crawler.js View on Github external
function browse_node_action(err, cacheNode) {
        if (!err) {
            for (let i = 0; i < cacheNode.references.length; i++) {

                const reference = cacheNode.references[i];
                // those ones come for free
                if (!self.has_cache_NodeAttribute(reference.nodeId, AttributeIds.BrowseName)) {
                    self.set_cache_NodeAttribute(reference.nodeId, AttributeIds.BrowseName, reference.browseName);
                }
                if (!self.has_cache_NodeAttribute(reference.nodeId, AttributeIds.DisplayName)) {
                    self.set_cache_NodeAttribute(reference.nodeId, AttributeIds.DisplayName, reference.displayName);
                }
                if (!self.has_cache_NodeAttribute(reference.nodeId, AttributeIds.NodeClass)) {
                    self.set_cache_NodeAttribute(reference.nodeId, AttributeIds.NodeClass, reference.nodeClass);
                }
            }
            self._emit_on_crawled(cacheNode, task.params.userData);
            const userData = task.params.userData;
            if (userData.onBrowse) {
                userData.onBrowse(self, cacheNode, userData);
            }

        }
github node-opcua / node-opcua / packages / node-opcua-client-crawler / source / node_crawler.ts View on Github external
task1: (callback: ErrorCallback) => {
                this._defer_readNode(
                    cacheNode.nodeId,
                    AttributeIds.BrowseName,

                    (err: Error | null, value?: any) => {
                        if (err) {
                            return callback(err);
                        }
                        assert(value instanceof QualifiedName);
                        cacheNode.browseName = value;
                        setImmediate(callback);
                    });
            },
github node-opcua / node-opcua / packages / node-opcua-client-crawler / source / node_crawler.ts View on Github external
task1: (callback: ErrorCallback) => {
                    if (cacheNode.browseName !== pendingBrowseName) {
                        return callback();
                    }
                    this._defer_readNode(
                        cacheNode.nodeId,
                        AttributeIds.BrowseName,
                        (err?: Error | null, browseName?: any) => {
                            cacheNode.browseName = browseName;
                            callback();
                        });
                },
github node-opcua / node-opcua / packages / node-opcua-client / source / alarms_and_conditions / client_alarm_tools_dump_event.ts View on Github external
async function getBrowseName(_session: IBasicSession, nodeId: NodeId): Promise {
        const dataValue = await _session.read({
            attributeId: AttributeIds.BrowseName,
            nodeId
        });
        if (dataValue.statusCode === StatusCodes.Good) {
            const browseName = dataValue.value.value.name!;
            return browseName;
        } else {
            return "???";
        }
    }
    function w(str: string, l: number): string {
github node-opcua / node-opcua / packages / node-opcua-client-proxy / src / proxy.js View on Github external
function getObject(proxyManager, nodeId, options, callback) {

    const session = proxyManager.session;

    nodeId = coerceNodeId(nodeId);

    if (nodeId.isEmpty()) {
        return setImmediate(function() {
            callback(new Error(" Invalid empty node in getObject"));
        });
    }

    const nodesToRead = [
        {
            nodeId: nodeId,
            attributeId: AttributeIds.BrowseName
        },
        {
            nodeId: nodeId,
            attributeId: AttributeIds.Description
        },
        {
            nodeId: nodeId,
            attributeId: AttributeIds.NodeClass
        }
    ];

    function read_accessLevels(clientObject, callback) {
        const nodesToRead = [
            {
                nodeId: nodeId,
                attributeId: AttributeIds.Value
github node-opcua / node-opcua / packages / node-opcua-client-crawler / src / node_crawler.js View on Github external
function (callback) {
            self._defer_readNode(cacheNode.nodeId, AttributeIds.BrowseName, function (err, value) {
                if (err) {
                    return callback(err);
                }
                assert(value instanceof QualifiedName);
                cacheNode.browseName = value;
                setImmediate(callback);
            });
        },
        function (callback) {