How to use the node-opcua-basic-types.decodeString function in node-opcua-basic-types

To help you get started, we’ve selected a few node-opcua-basic-types 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-data-model / source / diagnostic_info.ts View on Github external
}
    // read namespace uri
    if (encodingMask & DiagnosticInfo_EncodingByte.NamespaceURI) {
        diagnosticInfo.namespaceURI = decodeInt32(stream);
    }
    // read locale
    if (encodingMask & DiagnosticInfo_EncodingByte.Locale) {
        diagnosticInfo.locale = decodeInt32(stream);
    }
    // read localized text
    if (encodingMask & DiagnosticInfo_EncodingByte.LocalizedText) {
        diagnosticInfo.localizedText = decodeInt32(stream);
    }
    // read additional info
    if (encodingMask & DiagnosticInfo_EncodingByte.AdditionalInfo) {
        diagnosticInfo.additionalInfo = decodeString(stream);
    }
    // read inner status code
    if (encodingMask & DiagnosticInfo_EncodingByte.InnerStatusCode) {
        diagnosticInfo.innerStatusCode = decodeStatusCode(stream);
    }
    // read inner status code
    if (encodingMask & DiagnosticInfo_EncodingByte.InnerDiagnosticInfo) {
        diagnosticInfo.innerDiagnosticInfo = new DiagnosticInfo({});
        if (diagnosticInfo.innerDiagnosticInfo) {
            diagnosticInfo.innerDiagnosticInfo.decode(stream);
        }
    }
}
github node-opcua / node-opcua / packages / node-opcua-data-model / source / localized_text.ts View on Github external
public decodeDebug(stream: BinaryStream, options: any) {

        let cursorBefore;
        const tracer = options.tracer;
        tracer.trace("start", options.name + "(" + "LocalizedText" + ")", stream.length, stream.length);
        cursorBefore = stream.length;

        const encodingMask = decodeByte(stream);
        tracer.trace("member", "encodingByte", "0x" + encodingMask.toString(16), cursorBefore, stream.length, "Mask");
        cursorBefore = stream.length;

        if ((encodingMask & 0x01) === 0x01) {
            this.locale = decodeString(stream);
            tracer.trace("member", "locale", this.locale, cursorBefore, stream.length, "locale");
            cursorBefore = stream.length;
        } else {
            this.locale = null;
        }
        if ((encodingMask & 0x02) === 0x02) {
            this.text = decodeString(stream);
            tracer.trace("member", "text", this.text, cursorBefore, stream.length, "text");
            // cursor_before = stream.length;
        } else {
            this.text = null;
        }
        tracer.trace("end", options.name, stream.length, stream.length);
    }
github node-opcua / node-opcua / packages / node-opcua-secure-channel / source / message_builder.ts View on Github external
super._read_headers(binaryStream);

        assert(binaryStream.length === 12);

        const msgType = this.messageHeader.msgType;

        if (msgType === "HEL" || msgType === "ACK") {

            this.securityPolicy = SecurityPolicy.None;
        } else if (msgType === "ERR") {

            // extract Error StatusCode and additional message
            binaryStream.length = 8;
            const errorCode = decodeStatusCode(binaryStream);
            const message = decodeString(binaryStream);

            /* istanbul ignore next */
            if (doDebug) {
                debugLog(chalk.red.bold(" ERROR RECEIVED FROM SENDER"), chalk.cyan(errorCode.toString()), message);
                debugLog(hexDump(binaryStream.buffer));
            }
            return true;

        } else {

            this.securityHeader = chooseSecurityHeader(msgType);
            this.securityHeader.decode(binaryStream);

            if (msgType === "OPN") {
                const asymmetricAlgorithmSecurityHeader = this.securityHeader as AsymmetricAlgorithmSecurityHeader;
                this.securityPolicy = fromURI(asymmetricAlgorithmSecurityHeader.securityPolicyUri);
github node-opcua / node-opcua / packages / node-opcua-data-model / schemas / DiagnosticInfo_schema.js View on Github external
}
        // read locale
        if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.Locale)) {
            diagnosticInfo.locale = ec.decodeInt32(stream);
            tracer.trace("member", "locale", diagnosticInfo.locale, cursor_before, stream.length, "Int32");
            cursor_before = stream.length;
        }
        // read localized text
        if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.LocalizedText)) {
            diagnosticInfo.localizedText =  ec.decodeInt32(stream);
            tracer.trace("member", "localizedText", diagnosticInfo.localizedText, cursor_before, stream.length, "Int32");
            cursor_before = stream.length;
        }
        // read additional info
        if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.AdditionalInfo)) {
            diagnosticInfo.additionalInfo = ec.decodeString(stream);
            tracer.trace("member", "additionalInfo", diagnosticInfo.additionalInfo, cursor_before, stream.length, "String");
            cursor_before = stream.length;
        }
        // read inner status code
        if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.InnerStatusCode)) {
            diagnosticInfo.innerStatusCode = ec.decodeStatusCode(stream);
            tracer.trace("member", "innerStatusCode", diagnosticInfo.innerStatusCode, cursor_before, stream.length, "StatusCode");
            cursor_before = stream.length;
        }
        // read inner status code
        if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.InnerDiagnosticInfo)) {
            const DiagnosticInfo = require("../_generated_/_auto_generated_DiagnosticInfo").DiagnosticInfo;

            diagnosticInfo.innerDiagnosticInfo = new DiagnosticInfo({});

            diagnosticInfo.innerDiagnosticInfo.decode_debug(stream, options);
github node-opcua / node-opcua / packages / node-opcua-data-model / schemas / LocalizedText_schema.js View on Github external
tracer.trace("start", options.name + "(" + "LocalizedText" + ")", stream.length, stream.length);
        cursor_before = stream.length;

        const encoding_mask = ec.decodeByte(stream);
        tracer.trace("member", "encodingByte", "0x" + encoding_mask.toString(16), cursor_before, stream.length, "Mask");
        cursor_before = stream.length;

        if ((encoding_mask & 0x01) === 0x01) {
            self.locale = ec.decodeString(stream);
            tracer.trace("member", "locale", self.locale, cursor_before, stream.length, "locale");
            cursor_before = stream.length;
        } else {
            self.locale = null;
        }
        if ((encoding_mask & 0x02) === 0x02) {
            self.text = ec.decodeString(stream);
            tracer.trace("member", "text", self.text, cursor_before, stream.length, "text");
            //cursor_before = stream.length;
        } else {
            self.text = null;
        }
        tracer.trace("end", options.name, stream.length, stream.length);
    },
    decode: function (self, stream) {
github node-opcua / node-opcua / packages / node-opcua-data-model / schemas / LocalizedText_schema.js View on Github external
decode: function (self, stream) {

        const encoding_mask = ec.decodeByte(stream);
        if ((encoding_mask & 0x01) === 0x01) {
            self.locale = ec.decodeString(stream);
        } else {
            self.locale = null;
        }
        if ((encoding_mask & 0x02) === 0x02) {
            self.text = ec.decodeString(stream);
        } else {
            self.text = null;
        }
    },
    toString: function () {
github node-opcua / node-opcua / packages / node-opcua-numeric-range / source / numeric_range.ts View on Github external
export function decodeNumericRange(stream: BinaryStream): NumericRange {
  const str = decodeString(stream);
  return new NumericRange(str);
}
github node-opcua / node-opcua / packages / node-opcua-data-model / schemas / LocalizedText_schema.js View on Github external
decode_debug: function (self, stream , options) {

        let cursor_before;
        const tracer = options.tracer;
        tracer.trace("start", options.name + "(" + "LocalizedText" + ")", stream.length, stream.length);
        cursor_before = stream.length;

        const encoding_mask = ec.decodeByte(stream);
        tracer.trace("member", "encodingByte", "0x" + encoding_mask.toString(16), cursor_before, stream.length, "Mask");
        cursor_before = stream.length;

        if ((encoding_mask & 0x01) === 0x01) {
            self.locale = ec.decodeString(stream);
            tracer.trace("member", "locale", self.locale, cursor_before, stream.length, "locale");
            cursor_before = stream.length;
        } else {
            self.locale = null;
        }
        if ((encoding_mask & 0x02) === 0x02) {
            self.text = ec.decodeString(stream);
            tracer.trace("member", "text", self.text, cursor_before, stream.length, "text");
            //cursor_before = stream.length;
        } else {
            self.text = null;
        }
        tracer.trace("end", options.name, stream.length, stream.length);
    },
    decode: function (self, stream) {
github node-opcua / node-opcua / packages / node-opcua-numeric-range / source / numeric_range.ts View on Github external
public decode(stream: BinaryStream) {
    const str = decodeString(stream);

  }
}