Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
alarmNode.setHighLimit(options.highLimit);
}
if (options.hasOwnProperty("lowLimit")) {
alarmNode.setLowLimit(options.lowLimit);
}
if (options.hasOwnProperty("lowLowLimit")) {
alarmNode.setLowLowLimit(options.lowLowLimit);
}
/*
* The InputNode Property provides the NodeId of the Variable the Value of which is used as
* primary input in the calculation of the Alarm state. If this Variable is not in the AddressSpace,
* a Null NodeId shall be provided. In some systems, an Alarm may be calculated based on
* multiple Variables Values; it is up to the system to determine which Variable’s NodeId is used.
*/
assert(alarmNode.inputNode.nodeClass === NodeClass.Variable);
alarmNode.inputNode.setValueFromSource({ dataType: "NodeId", value: inputNode.nodeId });
// install inputNode monitoring for change
alarmNode._installInputNodeMonitoring(options.inputNode);
alarmNode._watchLimits();
return alarmNode;
}
assert(_.isArray(options.arrayDimensions) || options.arrayDimensions === null);
// -----------------------------------------------------
options.minimumSamplingInterval = +options.minimumSamplingInterval || 0;
let references = options.references || ([] as AddReferenceOpts[]);
references = ([] as AddReferenceOpts[]).concat(references, [
{
isForward: true,
nodeId: typeDefinition,
referenceType: "HasTypeDefinition"
}
]);
assert(!options.nodeClass || options.nodeClass === NodeClass.Variable);
options.nodeClass = NodeClass.Variable;
options.references = references;
const variable = this.createNode(options) as UAVariable;
assert(variable instanceof UAVariable);
return variable;
}
assert(monitoredItemCreateRequest instanceof MonitoredItemCreateRequest);
function handle_error(statusCode) {
return new subscription_service.MonitoredItemCreateResult({statusCode: statusCode});
}
const itemToMonitor = monitoredItemCreateRequest.itemToMonitor;
const node = addressSpace.findNode(itemToMonitor.nodeId);
if (!node) {
return handle_error(StatusCodes.BadNodeIdUnknown);
}
if (itemToMonitor.attributeId === AttributeIds.Value && !(node.nodeClass === NodeClass.Variable)) {
// AttributeIds.Value is only valid for monitoring value of UAVariables.
return handle_error(StatusCodes.BadAttributeIdInvalid);
}
if (itemToMonitor.attributeId === AttributeIds.INVALID) {
return handle_error(StatusCodes.BadAttributeIdInvalid);
}
if (!itemToMonitor.indexRange.isValid()) {
return handle_error(StatusCodes.BadIndexRangeInvalid);
}
// check dataEncoding applies only on Values
if (itemToMonitor.dataEncoding.name && itemToMonitor.attributeId !== AttributeIds.Value) {
return handle_error(StatusCodes.BadDataEncodingInvalid);
if (this._nodeid_index.hasOwnProperty(indexName)) {
throw new Error("nodeId " + node.nodeId.displayText() + " already registered " + node.nodeId.toString());
}
this._nodeid_index[indexName] = node;
if (node.nodeClass === NodeClass.ObjectType) {
_registerObjectType(this, node);
} else if (node.nodeClass === NodeClass.VariableType) {
_registerVariableType(this, node);
} else if (node.nodeClass === NodeClass.ReferenceType) {
_registerReferenceType(this, node);
} else if (node.nodeClass === NodeClass.DataType) {
_registerDataType(this, node);
} else if (node.nodeClass === NodeClass.Object) {
} else if (node.nodeClass === NodeClass.Variable) {
} else if (node.nodeClass === NodeClass.Method) {
} else if (node.nodeClass === NodeClass.View) {
} else {
console.log("Invalid class Name", node.nodeClass);
throw new Error("Invalid class name specified");
}
};
task5: (callback: ErrorCallback) => {
if (cacheNode.nodeClass !== NodeClass.Variable) {
return callback();
}
this._defer_readNode(cacheNode.nodeId, AttributeIds.MinimumSamplingInterval, (err, value) => {
cacheNode.minimumSamplingInterval = value;
callback();
});
},
constructor(proxyManager: UAProxyManager, nodeId: NodeId, reference: ReferenceDescription) {
super(proxyManager, nodeId, NodeClass.Variable);
}
}
function _getTypeDef(node: BaseNode) {
if (node.nodeClass === NodeClass.Object || node.nodeClass === NodeClass.Variable) {
return node.typeDefinitionObj.nodeId;
}
return null;
}
const task = async (addressSpace2: AddressSpace) => {
data.variant.value = data.postponedExtensionObject;
assert(data.nodeId, "expecting a nodeid");
const node = addressSpace.findNode(data.nodeId)!;
if (node.nodeClass === NodeClass.Variable) {
const v = node as UAVariable;
v.setValueFromSource(data.variant);
}
if (node.nodeClass === NodeClass.VariableType) {
const v = node as UAVariableType;
v.value.value = data.variant.value;
}
};
postTasks.push(task);
this: UAVariableType | UAVariable,
options: ToStringOption
) {
assert(options);
const _private = BaseNode_getPrivate(this);
if (this.dataType) {
const addressSpace = this.addressSpace;
const d = addressSpace.findNode(this.dataType);
const n = d ? "(" + d.browseName.toString() + ")" : " (???)";
options.add(options.padding + chalk.yellow(" dataType : ") + this.dataType + " " + n);
}
if (this.nodeClass === NodeClass.Variable) {
if (this._dataValue) {
options.add(options.padding + chalk.yellow(" value : ") + "\n" +
options.indent(this._dataValue.toString(), options.padding + " | "));
}
}
if (this.accessLevel) {
options.add(options.padding + chalk.yellow(" accessLevel : ") + " " +
accessLevelFlagToString(this.accessLevel));
}
if (this.userAccessLevel) {
options.add(options.padding + chalk.yellow(" userAccessLevel : ") + " " +
accessLevelFlagToString(this.userAccessLevel));
}
if (this.hasOwnProperty("valueRank")) {
options.add(options.padding + chalk.yellow(" valueRank : ") + " " +