How to use the node-opcua-nodeid.NodeIdType.NUMERIC 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
encodingByte &= 0x3f; // 1 to 5

    switch (encodingByte) {
        case EnumNodeIdEncoding.TwoBytes:
            value = stream.readUInt8();
            nodeIdType = NodeIdType.NUMERIC;
            break;
        case EnumNodeIdEncoding.FourBytes:
            namespace = stream.readUInt8();
            value = stream.readUInt16();
            nodeIdType = NodeIdType.NUMERIC;
            break;
        case EnumNodeIdEncoding.Numeric:
            namespace = stream.readUInt16();
            value = stream.readUInt32();
            nodeIdType = NodeIdType.NUMERIC;
            break;
        case EnumNodeIdEncoding.String:
            namespace = stream.readUInt16();
            value = decodeString(stream);
            nodeIdType = NodeIdType.STRING;
            break;
        case EnumNodeIdEncoding.ByteString:
            namespace = stream.readUInt16();
            value = decodeByteString(stream);
            nodeIdType = NodeIdType.BYTESTRING;
            break;
        default:
            if (encodingByte !== EnumNodeIdEncoding.Guid) {
                /*jslint bitwise: true */
                // console.log(" encoding_byte = 0x" + encodingByte.toString(16),
                //     " bin=", ("0000000000000000" + encodingByte.toString(2)).substr(-16),
github node-opcua / node-opcua / packages / node-opcua-server / src / server_session.js View on Github external
ServerSession.prototype.registerNode = function(nodeId) {

    assert(nodeId instanceof NodeId);
    const session = this;

    if (nodeId.namespace === 0 && nodeId.identifierType === NodeIdType.NUMERIC) {
        return nodeId;
    }

    const key = nodeId.toString();

    const registeredNode = session._registeredNodes[key];
    if (registeredNode) {
        // already registered
        return registeredNode;
    }

    const node = session.addressSpace.findNode(nodeId);
    if (!node) {
        return nodeId;
    }
github node-opcua / node-opcua / packages / node-opcua-server / source / server_session.ts View on Github external
public registerNode(nodeId: NodeId) {
        assert(nodeId instanceof NodeId);
        const session = this;

        if (nodeId.namespace === 0 && nodeId.identifierType === NodeIdType.NUMERIC) {
            return nodeId;
        }

        const key = nodeId.toString();

        const registeredNode = session._registeredNodes[key];
        if (registeredNode) {
            // already registered
            return registeredNode;
        }

        const node = session.addressSpace.findNode(nodeId);
        if (!node) {
            return nodeId;
        }
github node-opcua / node-opcua / packages / node-opcua-basic-types / source / nodeid.ts View on Github external
function nodeID_encodingByte(nodeId: NodeId): number {
    if (!nodeId) {
        return 0;
    }
    assert(nodeId.hasOwnProperty("identifierType"));

    let encodingByte = 0;

    if (nodeId.identifierType === NodeIdType.NUMERIC) {
        if (isUInt8(nodeId.value as number) &&
            !nodeId.namespace &&
            !(nodeId as ExpandedNodeId).namespaceUri &&
            !(nodeId as ExpandedNodeId).serverIndex) {
            encodingByte = encodingByte | EnumNodeIdEncoding.TwoBytes;
        } else if (
            isUInt16(nodeId.value as number) &&
            isUInt8(nodeId.namespace) &&
            !(nodeId as ExpandedNodeId).namespaceUri &&
            !(nodeId as ExpandedNodeId).serverIndex
        ) {
            encodingByte = encodingByte | EnumNodeIdEncoding.FourBytes;
        } else {
            encodingByte = encodingByte | EnumNodeIdEncoding.Numeric;
        }
    } else if (nodeId.identifierType === NodeIdType.STRING) {