How to use the node-opcua-nodeid.NodeId 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-basic-types / source / nodeid.ts View on Github external
default:
            if (encodingByte !== EnumNodeIdEncoding.Guid) {
                /*jslint bitwise: true */
                // console.log(" encoding_byte = 0x" + encodingByte.toString(16),
                //     " bin=", ("0000000000000000" + encodingByte.toString(2)).substr(-16),
                //     encodingByte, encodingByte & 0x3f);

                throw new Error(" encoding_byte = " + encodingByte.toString(16));
            }
            namespace = stream.readUInt16();
            value = decodeGuid(stream);
            nodeIdType = NodeIdType.GUID;
            assert(isValidGuid(value));
            break;
    }
    return new NodeId(nodeIdType, value, namespace);
}
github node-opcua / node-opcua / packages / node-opcua-basic-types / src / nodeid.js View on Github external
value = decodeByteString(stream);
            nodeIdType = NodeIdType.BYTESTRING;
            break;
        default:
            if (encoding_byte !== EnumNodeIdEncoding.Guid.value) {
                /*jslint bitwise: true */
                console.log(" encoding_byte = 0x" + encoding_byte.toString(16)," bin=", ("0000000000000000"+encoding_byte.toString(2)).substr(-16), encoding_byte, encoding_byte & 0x3f);
                throw new Error(" encoding_byte = " + encoding_byte.toString(16));
            }
            namespace = stream.readUInt16();
            value = decodeGuid(stream);
            nodeIdType = NodeIdType.GUID;
            assert(isValidGuid(value));
            break;
    }
    return new NodeId(nodeIdType, value, namespace);
};
github node-opcua / node-opcua / packages / node-opcua-address-space / src / namespace.ts View on Github external
function __combineNodeId(parentNodeId: NodeId, name: string) {
    let nodeId = null;
    if (parentNodeId.identifierType === NodeId.NodeIdType.STRING) {
        const childName = parentNodeId.value + NamespaceOptions.nodeIdNameSeparator + name.toString();
        nodeId = new NodeId(NodeId.NodeIdType.STRING, childName, parentNodeId.namespace);
    }
    return nodeId;
}
github node-opcua / node-opcua / packages / node-opcua-address-space / src / namespace.js View on Github external
function _adjust_options(self, options) {
    const ns = self.addressSpace.getNamespaceIndex(self.namespaceUri);
    if (!options.nodeId) {
        const id = self._getNextAvailableId();
        options.nodeId = new NodeId(NodeId.NodeIdType.NUMERIC, id, ns);
    }
    options.nodeId = NodeId.coerce(options.nodeId);
    if (typeof options.browseName === "string") {
        options.browseName = new QualifiedName({
            name: options.browseName,
            namespaceIndex: ns
        });
    }
    return options;
}