How to use the node-opcua-basic-types.decodeByte 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 / schemas / DiagnosticInfo_schema.js View on Github external
decode_debug: function (diagnosticInfo, stream, options) {

        const tracer = options.tracer;

        tracer.trace("start", options.name + "(" + "DiagnosticInfo" + ")", stream.length, stream.length);

        let cursor_before = stream.length;
        const encoding_mask = ec.decodeByte(stream);

        tracer.trace("member", "encodingByte", "0x" + encoding_mask.toString(16), cursor_before, stream.length, "Mask");
        tracer.encoding_byte(encoding_mask,DiagnosticInfo_EncodingByte,cursor_before,stream.length);


        cursor_before = stream.length;

        // read symbolic id
        if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.SymbolicId)) {
            diagnosticInfo.symbolicId = ec.decodeInt32(stream);
            tracer.trace("member", "symbolicId", diagnosticInfo.symbolicId, cursor_before, stream.length, "Int32");
            cursor_before = stream.length;
        }
        // read namespace uri
        if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.NamespaceUri)) {
            diagnosticInfo.namespaceUri = ec.decodeInt32(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;
github node-opcua / node-opcua / packages / node-opcua-data-model / source / diagnostic_info.ts View on Github external
function decode_DiagnosticInfo(diagnosticInfo: DiagnosticInfo, stream: BinaryStream): void {

    const encodingMask = decodeByte(stream);

    // read symbolic id
    if (encodingMask & DiagnosticInfo_EncodingByte.SymbolicId) {
        diagnosticInfo.symbolicId = decodeInt32(stream);
    }
    // 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);
github node-opcua / node-opcua / packages / node-opcua-data-model / schemas / DiagnosticInfo_schema.js View on Github external
decode: function (diagnosticInfo, stream, options) {

        const encoding_mask = ec.decodeByte(stream);

        // read symbolic id
        if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.SymbolicId)) {
            diagnosticInfo.symbolicId = ec.decodeInt32(stream);
        }
        // read namespace uri
        if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.NamespaceUri)) {
            diagnosticInfo.namespaceUri = ec.decodeInt32(stream);
        }
        // read locale
        if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.Locale)) {
            diagnosticInfo.locale = ec.decodeInt32(stream);
        }
        // read localized text
        if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.LocalizedText)) {
            diagnosticInfo.localizedText = ec.decodeInt32(stream);
github node-opcua / node-opcua / packages / node-opcua-packet-analyzer / source / packet_analyzer / packet_analyzer.ts View on Github external
function display_encodeable(value: any, buffer1: Buffer, start: number, end: number) {
        const bufferExtract = buffer1.slice(start, end);
        const stream = new BinaryStream(bufferExtract);
        const nodeId = decodeNodeId(stream);
        const encodingMask = decodeByte(stream); // 1 bin 2: xml
        const length = decodeUInt32(stream);

        display(chalk.green("     ExpandedNodId =") + " " + nodeId);
        display(chalk.green("     encoding mask =") + " " + encodingMask);
        display(chalk.green("            length =") + " " + length);
        analyzePacket(bufferExtract.slice(stream.length), value.encodingDefaultBinary, padding + 2, start + stream.length);

    }
github node-opcua / node-opcua / packages / node-opcua-data-model / source / diagnostic_info.ts View on Github external
function decodeDebug_DiagnosticInfo(diagnosticInfo: DiagnosticInfo, stream: BinaryStream, options: any): void {

    const tracer = options.tracer;

    tracer.trace("start", options.name + "(" + "DiagnosticInfo" + ")", stream.length, stream.length);

    let cursorBefore = stream.length;
    const encodingMask = decodeByte(stream);

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

    cursorBefore = stream.length;

    // read symbolic id
    if (encodingMask & DiagnosticInfo_EncodingByte.SymbolicId) {
        diagnosticInfo.symbolicId = decodeInt32(stream);
        tracer.trace("member", "symbolicId", diagnosticInfo.symbolicId, cursorBefore, stream.length, "Int32");
        cursorBefore = stream.length;
    }
    // read namespace uri
    if (encodingMask & DiagnosticInfo_EncodingByte.NamespaceURI) {
        diagnosticInfo.namespaceURI = decodeInt32(stream);
        tracer.trace("member", "symbolicId", diagnosticInfo.namespaceURI, cursorBefore, stream.length, "Int32");
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-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;