Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// TODO
data.time = data.time || { dataType: DataType.DateTime, value: nowUTC};
// receivedTime (UtcTime)
// TODO
data.receiveTime = data.receiveTime || { dataType: DataType.DateTime, value: nowUTC};
// localTime (UtcTime)
// TODO
data.localTime = data.localTime || { dataType: DataType.DateTime, value: nowUTC};
// message (LocalizedText)
data.message = data.message || { dataType: DataType.LocalizedText, value: { text: "" } };
// severity (UInt16)
data.severity = data.severity || { dataType: DataType.UInt16, value: 0 };
//xx // reminder : event type cannot be instantiated directly !
//xx assert(eventTypeNode.isAbstract);
const baseObjectType = addressSpace.findObjectType("BaseObjectType"); // i=58
assert(baseObjectType, "BaseObjectType must be defined in the address space");
const visitedProperties = [];
function _process_var(self,prefix,node) {
const lowerName =prefix + lowerFirstLetter(node.browseName.name);
// istanbul ignore next
if (doDebug) { console.log(" "+lowerName.toString()); }
visitedProperties[lowerName] = node;
if (data.hasOwnProperty(lowerName)) {
// TODO
data.time = data.time || { dataType: DataType.DateTime, value: nowUTC };
// receivedTime (UtcTime)
// TODO
data.receiveTime = data.receiveTime || { dataType: DataType.DateTime, value: nowUTC };
// localTime (UtcTime)
// TODO
data.localTime = data.localTime || { dataType: DataType.DateTime, value: nowUTC };
// message (LocalizedText)
data.message = data.message || { dataType: DataType.LocalizedText, value: { text: "" } };
// severity (UInt16)
data.severity = data.severity || { dataType: DataType.UInt16, value: 0 };
// xx // reminder : event type cannot be instantiated directly !
// xx assert(eventTypeNode.isAbstract);
const baseObjectType = addressSpace.findObjectType("BaseObjectType"); // i=58
/* istanbul ignore next */
if (!baseObjectType) {
throw new Error("BaseObjectType must be defined in the address space");
}
const visitedProperties: { [key: string]: any } = {};
function _process_var(
self: BaseNode,
prefix: string,
node: BaseNode
DataType.String, "String", function () {
return engine.serverCapabilities.serverProfileArray;
});
bindStandardArray(VariableIds.Server_ServerCapabilities_LocaleIdArray,
DataType.String, "LocaleId", function () {
return engine.serverCapabilities.localeIdArray;
});
bindStandardScalar(VariableIds.Server_ServerCapabilities_MinSupportedSampleRate,
DataType.Double, function () {
return engine.serverCapabilities.minSupportedSampleRate;
});
bindStandardScalar(VariableIds.Server_ServerCapabilities_MaxBrowseContinuationPoints,
DataType.UInt16, function () {
return engine.serverCapabilities.maxBrowseContinuationPoints;
});
bindStandardScalar(VariableIds.Server_ServerCapabilities_MaxQueryContinuationPoints,
DataType.UInt16, function () {
return engine.serverCapabilities.maxQueryContinuationPoints;
});
bindStandardScalar(VariableIds.Server_ServerCapabilities_MaxHistoryContinuationPoints,
DataType.UInt16, function () {
return engine.serverCapabilities.maxHistoryContinuationPoints;
});
// added by DI : Server-specific period of time in milliseconds until the Server will revoke a lock.
//TODO bindStandardScalar(VariableIds.Server_ServerCapabilities_MaxInactiveLockTime,
}
}
function tearDown_Timer() {
delete_Timer();
values_to_change = [];
}
const intervalVariable = namespace.addVariable({
componentOf: simulation,
browseName: "Interval",
description: { locale: "en", text: "The rate (in msec) of change for all Simulated items." },
nodeId: "s=Scalar_Simulation_Interval",
dataType: "UInt16",
value: new Variant({
dataType: DataType.UInt16,
arrayType: VariantArrayType.Scalar,
value: interval
})
});
intervalVariable.on("value_changed", function(dataValue/*,indexRange*/) {
const variant = dataValue.value;
assert(variant instanceof Variant);
assert(ec.isValidUInt16(variant.value) && " value must be valid for dataType");
interval = variant.value;
install_Timer();
});
const enabledVariable = namespace.addVariable({
componentOf: simulation,
public setLastSeverity(severity: UInt16): void {
severity = +severity;
return this._set_var("lastSeverity", DataType.UInt16, severity);
}
return true;
}
switch (dataType) {
case DataType.Double:
return array instanceof Float64Array;
case DataType.Float:
return array instanceof Float32Array;
case DataType.Int32:
return array instanceof Int32Array;
case DataType.Int16:
return array instanceof Int16Array;
case DataType.SByte:
return array instanceof Int8Array;
case DataType.UInt32:
return array instanceof Uint32Array;
case DataType.UInt16:
return array instanceof Uint16Array;
case DataType.Byte:
return array instanceof Uint8Array || array instanceof Buffer;
}
return false;
}
ConditionSnapshot.prototype.setLastSeverity = function(severity) {
const self = this;
severity = +severity;
return self._set_var("lastSeverity", DataType.UInt16, severity);
};
/**
UAConditionBase.prototype._assert_valid = function() {
const self = this;
assert(self.receiveTime.readValue().value.dataType === DataType.DateTime);
assert(self.receiveTime.readValue().value.value instanceof Date);
assert(self.localTime.readValue().value.dataType === DataType.ExtensionObject);
assert(self.message.readValue().value.dataType === DataType.LocalizedText);
assert(self.severity.readValue().value.dataType === DataType.UInt16);
assert(self.time.readValue().value.dataType === DataType.DateTime);
assert(self.time.readValue().value.value instanceof Date);
assert(self.quality.readValue().value.dataType === DataType.StatusCode);
assert(self.enabledState.readValue().value.dataType === DataType.LocalizedText);
assert(self.branchId.readValue().value.dataType === DataType.NodeId);
};
ConditionSnapshot.prototype.getLastSeverity = function() {
const self = this;
const value = self._get_var("lastSeverity", DataType.UInt16);
return +value;
};
return true;
}
switch (dataType) {
case DataType.Double:
return array instanceof Float64Array;
case DataType.Float:
return array instanceof Float32Array;
case DataType.Int32:
return array instanceof Int32Array;
case DataType.Int16:
return array instanceof Int16Array;
case DataType.SByte:
return array instanceof Int8Array;
case DataType.UInt32:
return array instanceof Uint32Array;
case DataType.UInt16:
return array instanceof Uint16Array;
case DataType.Byte:
return array instanceof Uint8Array || array instanceof Buffer;
}
return false;
}