Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const encodingMask = decodeByte(stream);
if ((encodingMask & 0x01) === 0x01) {
this.locale = decodeString(stream);
} else {
this.locale = null;
}
if ((encodingMask & 0x02) === 0x02) {
this.text = decodeString(stream);
} else {
this.text = null;
}
}
}
// not an extension object registerClassDefinition("LocalizedText", LocalizedText);
registerSpecialVariantEncoder(LocalizedText);
export type LocalizedTextLike = LocalizedTextOptions | LocalizedText | string;
function getLocalizeText_EncodingByte(localizedText: LocalizedText): number {
let encodingMask = 0;
if (localizedText.locale) {
encodingMask |= 0x01;
}
if (localizedText.text) {
encodingMask |= 0x02;
}
return encodingMask;
}
const emptyLocalizedText = new LocalizedText({});
}
}
if (v1.arrayType === VariantArrayType.Array) {
return __check_same_array(v1.value, v2.value);
} else if (v1.arrayType === VariantArrayType.Matrix) {
if (!__check_same_array(v1.dimensions, v2.dimensions)) {
return false;
}
return __check_same_array(v1.value, v2.value);
}
return false;
}
// ---------------------------------------------------------------------------------------------------------
registerSpecialVariantEncoder(Variant);
export interface VariantOptionsT extends VariantOptions {
dataType: DT;
arrayType?: VariantArrayType | string;
value: T;
dimensions?: number[] | null;
}
export interface VariantT extends Variant {
value: T;
dataType: DT;
}
export declare type VariantByteString = VariantT;
export declare type VariantDouble = VariantT;
value.encode(stream);
}
}
export function decodeDiagnosticInfo(stream: BinaryStream): DiagnosticInfo {
const value = new DiagnosticInfo({});
value.decode(stream);
return value;
}
// Note:
// the SymbolicId, NamespaceURI, LocalizedText and Locale fields are indexes in a string table which is returned
// in the response header. Only the index of the corresponding string in the string table is encoded. An index
// of −1 indicates that there is no value for the string.
//
registerSpecialVariantEncoder(DiagnosticInfo);
const assert = require("node-opcua-assert").assert;
const _ = require("underscore");
const DataValue = exports.DataValue = require("../_generated_/_auto_generated_DataValue").DataValue;
const DataType = require("node-opcua-variant").DataType;
const VariantArrayType = require("node-opcua-variant").VariantArrayType;
const TimestampsToReturn = require("../schemas/TimestampsToReturn_enum").TimestampsToReturn;
const registerSpecialVariantEncoder = require("node-opcua-factory").registerSpecialVariantEncoder;
registerSpecialVariantEncoder(exports.DataValue);
const getCurrentClock = require("node-opcua-date-time").getCurrentClock;
const Variant = require("node-opcua-variant").Variant;
const sameVariant = require("node-opcua-variant/src/variant_tools").sameVariant;
function w(n){
return ("0000"+n).substr(-3);
}
DataValue.prototype.toString = function () {
function toMicroNanoPico(picoseconds) {
//xx picoseconds = 123456789;
return ""
+ w((picoseconds / 1000000 )>>0)
if (!value) {
return null;
} else if (value instanceof QualifiedName) {
return value;
} else if (_.isString(value)) {
return stringToQualifiedName(value);
} else {
assert(value.hasOwnProperty("namespaceIndex"));
assert(value.hasOwnProperty("name"));
return new exports.QualifiedName(value);
}
}
exports.coerceQualifyName = coerceQualifyName;
const factory = require("node-opcua-factory");
factory.registerSpecialVariantEncoder(exports.QualifiedName);
"use strict";
exports.DiagnosticInfo = require("../_generated_/_auto_generated_DiagnosticInfo").DiagnosticInfo;
const factory = require("node-opcua-factory");
factory.registerSpecialVariantEncoder(exports.DiagnosticInfo);
}
public clone() {
return new DataValue({
serverPicoseconds: this.serverPicoseconds,
serverTimestamp: this.serverTimestamp,
sourcePicoseconds: this.sourcePicoseconds,
sourceTimestamp: this.sourceTimestamp,
statusCode: this.statusCode,
value: this.value ? this.value.clone() : undefined
});
}
}
DataValue.prototype.schema = DataValue.schema;
registerSpecialVariantEncoder(DataValue);
export type DataValueLike = DataValueOptions | DataValue;
function w(n: number): string {
return ("0000" + n).substr(-3);
}
function _partial_clone(dataValue: DataValue): DataValue {
const cloneDataValue = new DataValue();
cloneDataValue.value = dataValue.value;
cloneDataValue.statusCode = dataValue.statusCode;
return cloneDataValue;
}
export function apply_timestamps(
dataValue: DataValue,
}
Variant.coerce = _coerceVariant;
/**
* @method clone
* deep clone a variant
*
* @return {exports.Variant}
*/
Variant.prototype.clone = function () {
return new this.constructor(this);
};
const factory = require("node-opcua-factory");
factory.registerSpecialVariantEncoder(Variant);
export function coerceQualifiedName(value: any): QualifiedName | null {
if (!value) {
return null;
} else if (value instanceof QualifiedName) {
return value;
} else if (_.isString(value)) {
return stringToQualifiedName(value);
} else {
assert(value.hasOwnProperty("namespaceIndex"));
assert(value.hasOwnProperty("name"));
return new exports.QualifiedName(value);
}
}
registerSpecialVariantEncoder(QualifiedName);
export function encodeQualifiedName(value: QualifiedName, stream: OutputBinaryStream): void {
value.encode(stream);
}
export function decodeQualifiedName(stream: BinaryStream): QualifiedName {
const value = new QualifiedName({});
value.decode(stream);
return value;
}
}
if (typeof value === "string") {
return new LocalizedText({locale: null, text: value});
}
if (value instanceof LocalizedText) {
return value;
}
assert(value.hasOwnProperty("locale"));
assert(value.hasOwnProperty("text"));
return new LocalizedText(value);
}
LocalizedText.coerce = coerceLocalizedText;
exports.coerceLocalizedText = coerceLocalizedText;
const factory = require("node-opcua-factory");
factory.registerSpecialVariantEncoder(exports.LocalizedText);