How to use the node-opcua-basic-types.decodeStatusCode 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 localized text
    if (encodingMask & DiagnosticInfo_EncodingByte.LocalizedText) {
        diagnosticInfo.localizedText = decodeInt32(stream);
        tracer.trace("member", "localizedText", diagnosticInfo.localizedText, cursorBefore, stream.length, "Int32");
        cursorBefore = stream.length;
    }
    // read additional info
    if (encodingMask & DiagnosticInfo_EncodingByte.AdditionalInfo) {
        diagnosticInfo.additionalInfo = decodeString(stream);
        tracer.trace("member", "additionalInfo", diagnosticInfo.additionalInfo, cursorBefore, stream.length, "String");
        cursorBefore = stream.length;
    }
    // read inner status code
    if (encodingMask & DiagnosticInfo_EncodingByte.InnerStatusCode) {
        diagnosticInfo.innerStatusCode = decodeStatusCode(stream);
        tracer.trace("member", "innerStatusCode",
          diagnosticInfo.innerStatusCode, cursorBefore, stream.length, "StatusCode");
        cursorBefore = stream.length;
    }
    // read inner status code
    if (encodingMask & DiagnosticInfo_EncodingByte.InnerDiagnosticInfo) {
        diagnosticInfo.innerDiagnosticInfo = new DiagnosticInfo({});
        if (diagnosticInfo.innerDiagnosticInfo) {
            diagnosticInfo.innerDiagnosticInfo.decodeDebug(stream, options);
        }
        tracer.trace("member", "innerDiagnosticInfo",
          diagnosticInfo.innerDiagnosticInfo, cursorBefore, stream.length, "DiagnosticInfo");
    }

    tracer.trace("end", options.name, stream.length, stream.length);
github node-opcua / node-opcua / packages / node-opcua-data-value / source / datavalue.ts View on Github external
let cur = stream.length;
  const encodingMask = decodeUInt8(stream);
  assert(encodingMask <= 0x3F);

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

  if (encodingMask & DataValueEncodingByte.Value) {
    dataValue.value = new Variant();
    dataValue.value.decodeDebug(stream, options);
  }
  // read statusCode
  cur = stream.length;
  if (encodingMask & DataValueEncodingByte.StatusCode) {
    dataValue.statusCode = decodeStatusCode(stream);
    tracer.trace("member", "statusCode", dataValue.statusCode, cur, stream.length, "StatusCode");
  }
  // read sourceTimestamp
  cur = stream.length;
  if (encodingMask & DataValueEncodingByte.SourceTimestamp) {
    dataValue.sourceTimestamp = decodeHighAccuracyDateTime(stream);
    dataValue.sourcePicoseconds = (dataValue.sourceTimestamp as DateWithPicoseconds).picoseconds;
    tracer.trace("member", "sourceTimestamp", dataValue.sourceTimestamp, cur, stream.length, "DateTime");
  }
  // read sourcePicoseconds
  cur = stream.length;
  dataValue.sourcePicoseconds = 0;
  if (encodingMask & DataValueEncodingByte.SourcePicoseconds) {
    const tenPico = decodeUInt16(stream);
    dataValue.sourcePicoseconds += tenPico * 10;
    tracer.trace("member", "sourcePicoseconds", dataValue.sourcePicoseconds, cur, stream.length, "UInt16");
github node-opcua / node-opcua / packages / node-opcua-data-value / schemas / DataValue_schema.js View on Github external
decode: function(dataValue,stream,options) {

        const encoding_mask = ec.decodeUInt8(stream);

        if( check_flag(encoding_mask,DataValueEncodingByte.Value)) {
            //xx var Variant =
            // re("./variant").Variant;
            dataValue.value = new Variant(null);
            dataValue.value.decode(stream,options);
        }
        // read statusCode
        if (check_flag(encoding_mask,DataValueEncodingByte.StatusCode)) {
            dataValue.statusCode  = ec.decodeStatusCode(stream);
        } else {
            dataValue.statusCode = StatusCodes.Good;
        }

        dataValue.sourcePicoseconds = 0;
        // read sourceTimestamp
        if (check_flag(encoding_mask,DataValueEncodingByte.SourceTimestamp)) {
            dataValue.sourceTimestamp  = ec.decodeHighAccuracyDateTime(stream);
            dataValue.sourcePicoseconds += dataValue.sourceTimestamp.picoseconds;
        }
        // read sourcePicoseconds
        if (check_flag(encoding_mask,DataValueEncodingByte.SourcePicoseconds)) {
            dataValue.sourcePicoseconds  += ec.decodeUInt16(stream) * 10 ;
        }
        // read serverTimestamp
        dataValue.serverPicoseconds = 0;
github node-opcua / node-opcua / packages / node-opcua-data-value / schemas / DataValue_schema.js View on Github external
const encoding_mask = ec.decodeUInt8(stream);
        assert(encoding_mask<=0x3F);

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

        if( check_flag(encoding_mask,DataValueEncodingByte.Value)) {
            //xx var Variant = require("./variant").Variant;
            dataValue.value = new Variant();
            dataValue.value.decode_debug(stream,options);
            //xx if (tracer) { tracer.trace("member","statusCode", dataValue.value,cur,stream.length,"Variant"); }
        }
        // read statusCode
        cur = stream.length;
        if (check_flag(encoding_mask,DataValueEncodingByte.StatusCode)) {
            dataValue.statusCode  = ec.decodeStatusCode(stream);
            tracer.trace("member","statusCode", dataValue.statusCode,cur,stream.length,"StatusCode");
        }
        // read sourceTimestamp
        cur = stream.length;
        if (check_flag(encoding_mask,DataValueEncodingByte.SourceTimestamp)) {
            dataValue.sourceTimestamp  = ec.decodeHighAccuracyDateTime(stream);
            dataValue.sourcePicoseconds= dataValue.sourceTimestamp.picoseconds;
            tracer.trace("member","sourceTimestamp", dataValue.sourceTimestamp,cur,stream.length,"DateTime");
        }
        // read sourcePicoseconds
        cur = stream.length;
        dataValue.sourcePicoseconds = 0;
        if (check_flag(encoding_mask,DataValueEncodingByte.SourcePicoseconds)) {
            const tenPico = ec.decodeUInt16(stream);
            dataValue.sourcePicoseconds  += tenPico * 10;
            tracer.trace("member","sourcePicoseconds", dataValue.sourcePicoseconds,cur,stream.length,"UInt16");
github node-opcua / node-opcua / packages / node-opcua-data-model / source / diagnostic_info.ts View on Github external
}
    // 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 / schemas / DiagnosticInfo_schema.js View on Github external
}
        // 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);
            tracer.trace("member", "innerDiagnosticInfo", diagnosticInfo.innerDiagnosticInfo, cursor_before, stream.length, "DiagnosticInfo");
        }

        tracer.trace("end", options.name, stream.length, stream.length);

    },
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);
        }
        // read localized text
        if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.LocalizedText)) {
            diagnosticInfo.localizedText = ec.decodeInt32(stream);
        }
        // read additional info
        if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.AdditionalInfo)) {
            diagnosticInfo.additionalInfo = ec.decodeString(stream);
        }
        // read inner status code
        if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.InnerStatusCode)) {
            diagnosticInfo.innerStatusCode = ec.decodeStatusCode(stream);
        }
        // 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(stream, options);
        }
    }
};
github node-opcua / node-opcua / packages / node-opcua-data-value / source / datavalue.ts View on Github external
function decodeDataValueInternal(dataValue: DataValue, stream: BinaryStream) {

  const encodingMask = decodeUInt8(stream);
  if (encodingMask & DataValueEncodingByte.Value) {
    dataValue.value = new Variant();
    dataValue.value.decode(stream);
  }
  // read statusCode
  if (encodingMask & DataValueEncodingByte.StatusCode) {
    dataValue.statusCode = decodeStatusCode(stream);
  } else {
    dataValue.statusCode = StatusCodes.Good;
  }

  dataValue.sourcePicoseconds = 0;
  // read sourceTimestamp
  if (encodingMask & DataValueEncodingByte.SourceTimestamp) {
    dataValue.sourceTimestamp = decodeHighAccuracyDateTime(stream);
    dataValue.sourcePicoseconds += (dataValue.sourceTimestamp as DateWithPicoseconds).picoseconds | 0;
  }
  // read sourcePicoseconds
  if (encodingMask & DataValueEncodingByte.SourcePicoseconds) {
    dataValue.sourcePicoseconds += decodeUInt16(stream) * 10;
  }
  // read serverTimestamp
  dataValue.serverPicoseconds = 0;