How to use the node-opcua-nodeid.ExpandedNodeId.fromNodeId function in node-opcua-nodeid

To help you get started, we’ve selected a few node-opcua-nodeid 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 / resolve_dynamic_extension_object.ts View on Github external
function resolveDynamicExtensionObjectV(
    opaque: OpaqueStructure,
    extraDataType: ExtraDataTypeManager
): ExtensionObject {

    try {
        const namespaceUri = extraDataType.namespaceArray[opaque.nodeId.namespace];
        const expandedNodeId = ExpandedNodeId.fromNodeId(opaque.nodeId, namespaceUri);

        const typeDictionary = extraDataType.getTypeDictionaryForNamespace(opaque.nodeId.namespace);

        const Constructor = extraDataType.getExtensionObjectConstructorFromBinaryEncoding(opaque.nodeId);
        const object = new Constructor();
        const stream = new BinaryStream(opaque.buffer);
        object.decode(stream);
        return object;
    } catch (err) {
        // tslint:disable-next-line:no-console
        console.log("resolveDynamicExtensionObjectV err = ", err);
        return opaque;
    }
}
github node-opcua / node-opcua / packages / node-opcua-client-dynamic-extension-object / source / client_dynamic_extension_object.ts View on Github external
const binaryEncodingNodeIds = results2.map((br: BrowseResult) => {
        const defaultBin = br.references!.filter((r: ReferenceDescription) => r.browseName.toString() === "Default Binary");

        /* istanbul ignore next */
        if (defaultBin.length < 1) {
            return ExpandedNodeId;
        }
        return ExpandedNodeId.fromNodeId(defaultBin[0].nodeId, namespaces[defaultBin[0].nodeId.namespace]);
    });
github node-opcua / node-opcua / packages / node-opcua-address-space / src / ua_data_type.ts View on Github external
public get binaryEncodingNodeId() {

        const _cache = BaseNode._getCache(this);
        if (!_cache.binaryEncodingNodeId) {
            const encoding = this.getEncodingNode("Default Binary");
            if (encoding) {
                const namespaceUri = this.addressSpace.getNamespaceUri(encoding.nodeId.namespace);
                _cache.binaryEncodingNodeId = ExpandedNodeId.fromNodeId(encoding.nodeId, namespaceUri);
            } else {
                _cache.binaryEncodingNodeId = null;
            }
        }
        return _cache.binaryEncodingNodeId;
    }
github node-opcua / node-opcua / packages / node-opcua-address-space / src / ua_data_type.ts View on Github external
public get xmlEncodingNodeId(): NodeId {
        const _cache = BaseNode._getCache(this);
        if (!_cache.xmlEncodingNodeId) {
            const encoding = this.getEncodingNode("Default Xml");
            if (encoding) {
                const namespaceUri = this.addressSpace.getNamespaceUri(encoding.nodeId.namespace);
                _cache.xmlEncodingNodeId = ExpandedNodeId.fromNodeId(encoding.nodeId, namespaceUri);
            } else {
                _cache.xmlEncodingNodeId = null;
            }
        }
        return _cache.xmlEncodingNodeId;
    }