How to use the node-opcua-nodeid.NodeIdType.STRING 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
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),
                //     encodingByte, encodingByte & 0x3f);

                throw new Error(" encoding_byte = " + encodingByte.toString(16));
            }
            namespace = stream.readUInt16();
github node-opcua / node-opcua / packages / node-opcua-basic-types / source / nodeid.ts View on Github external
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) {
        encodingByte = encodingByte | EnumNodeIdEncoding.String;
    } else if (nodeId.identifierType === NodeIdType.BYTESTRING) {
        encodingByte = encodingByte | EnumNodeIdEncoding.ByteString;
    } else if (nodeId.identifierType === NodeIdType.GUID) {
        encodingByte = encodingByte | EnumNodeIdEncoding.Guid;
    }

    if (nodeId.hasOwnProperty("namespaceUri") && (nodeId as ExpandedNodeId).namespaceUri) {
        encodingByte = encodingByte | EnumNodeIdEncoding.NamespaceUriFlag;
    }
    if (nodeId.hasOwnProperty("serverIndex") && (nodeId as ExpandedNodeId).serverIndex) {
        encodingByte = encodingByte | EnumNodeIdEncoding.ServerIndexFlag;
    }
    return encodingByte;
}