Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
case AttributeIds.NodeId: // NodeId
options.value = { dataType: DataType.NodeId, value: this.nodeId };
break;
case AttributeIds.NodeClass: // NodeClass
assert(_.isFinite(this.nodeClass));
options.value = { dataType: DataType.Int32, value: this.nodeClass };
break;
case AttributeIds.BrowseName: // QualifiedName
assert(this.browseName instanceof QualifiedName);
options.value = { dataType: DataType.QualifiedName, value: this.browseName };
break;
case AttributeIds.DisplayName: // LocalizedText
options.value = { dataType: DataType.LocalizedText, value: this.displayName[0] };
break;
case AttributeIds.Description: // LocalizedText
options.value = { dataType: DataType.LocalizedText, value: this.description };
break;
case AttributeIds.WriteMask:
options.value = { dataType: DataType.UInt32, value: this.getWriteMask() };
break;
case AttributeIds.UserWriteMask:
options.value = { dataType: DataType.UInt32, value: this.getUserWriteMask() };
break;
default:
// of Event notifying Objects and ConditionSources. An Event notifying Object represents
// typically an area of Operator responsibility. The definition of such an area configuration is
// outside the scope of this standard. If areas are available they shall be linked together and
// with the included ConditionSources using the HasNotifier and the HasEventSource Reference
// Types. The Server Object shall be the root of this hierarchy.
assert(conditionSourceNode.getEventSourceOfs().length >= 1, "conditionSourceNode must be an event source");
const context = SessionContext.defaultContext;
// set source Node (defined in UABaseEventType)
conditionNode.sourceNode.setValueFromSource(
conditionSourceNode.readAttribute(context, AttributeIds.NodeId).value
);
// set source Name (defined in UABaseEventType)
conditionNode.sourceName.setValueFromSource(
conditionSourceNode.readAttribute(context, AttributeIds.DisplayName).value
);
}
conditionNode.eventType.setValueFromSource({
dataType: DataType.NodeId,
value: conditionType.nodeId
});
// as per spec:
/**
*
* dataType: DataType.NodeId
*
* As per spec OPCUA 1.03 part 9:
* ConditionClassId specifies in which domain this Condition is used. It is the NodeId of the
* corresponding ConditionClassType. See 5.9 for the definition of ConditionClass and a set of
const browseNodeAction = (err: Error | null, cacheNode1?: CacheNode) => {
if (err || !cacheNode1) {
return;
}
for (const reference of cacheNode1.references) {
// those ones come for free
if (!this.has_cache_NodeAttribute(reference.nodeId, AttributeIds.BrowseName)) {
this.set_cache_NodeAttribute(reference.nodeId, AttributeIds.BrowseName, reference.browseName);
}
if (!this.has_cache_NodeAttribute(reference.nodeId, AttributeIds.DisplayName)) {
this.set_cache_NodeAttribute(reference.nodeId, AttributeIds.DisplayName, reference.displayName);
}
if (!this.has_cache_NodeAttribute(reference.nodeId, AttributeIds.NodeClass)) {
this.set_cache_NodeAttribute(reference.nodeId, AttributeIds.NodeClass, reference.nodeClass);
}
}
this._emit_on_crawled(cacheNode1, task.param.userData);
const userData = task.param.userData;
if (userData.onBrowse) {
userData.onBrowse(this, cacheNode1, userData);
}
};
case AttributeIds.NodeId: // NodeId
options.value = {dataType: DataType.NodeId, value: this.nodeId};
break;
case AttributeIds.NodeClass: // NodeClass
assert(_.isFinite(this.nodeClass));
options.value = {dataType: DataType.Int32, value: this.nodeClass};
break;
case AttributeIds.BrowseName: // QualifiedName
assert(this.browseName instanceof QualifiedName);
options.value = {dataType: DataType.QualifiedName, value: this.browseName};
break;
case AttributeIds.DisplayName: // LocalizedText
options.value = {dataType: DataType.LocalizedText, value: this.displayName[0]};
break;
case AttributeIds.Description: // LocalizedText
options.value = {dataType: DataType.LocalizedText, value: this.description};
break;
case AttributeIds.WriteMask:
options.value = {dataType: DataType.UInt32, value: this.getWriteMask()};
break;
case AttributeIds.UserWriteMask:
options.value = {dataType: DataType.UInt32, value: this.getUserWriteMask()};
break;
default:
const browseNodeAction = (err: Error | null, cacheNode1?: CacheNode) => {
if (err || !cacheNode1) {
return;
}
for (const reference of cacheNode1.references) {
// those ones come for free
if (!this.has_cache_NodeAttribute(reference.nodeId, AttributeIds.BrowseName)) {
this.set_cache_NodeAttribute(reference.nodeId, AttributeIds.BrowseName, reference.browseName);
}
if (!this.has_cache_NodeAttribute(reference.nodeId, AttributeIds.DisplayName)) {
this.set_cache_NodeAttribute(reference.nodeId, AttributeIds.DisplayName, reference.displayName);
}
if (!this.has_cache_NodeAttribute(reference.nodeId, AttributeIds.NodeClass)) {
this.set_cache_NodeAttribute(reference.nodeId, AttributeIds.NodeClass, reference.nodeClass);
}
}
this._emit_on_crawled(cacheNode1, task.param.userData);
const userData = task.param.userData;
if (userData.onBrowse) {
userData.onBrowse(this, cacheNode1, userData);
}
};
if (conditionSourceNode.getEventSourceOfs().length === 0) {
errorLog("conditionSourceNode = ", conditionSourceNode.browseName.toString());
errorLog("conditionSourceNode = ", conditionSourceNode.nodeId.toString());
throw new Error("conditionSourceNode must be an event source " + conditionSourceNode.browseName.toString() + conditionSourceNode.nodeId.toString() ) ;
}
}
const context = SessionContext.defaultContext;
// set source Node (defined in UABaseEventType)
conditionNode.sourceNode.setValueFromSource(
conditionSourceNode.readAttribute(context, AttributeIds.NodeId).value
);
// set source Name (defined in UABaseEventType)
conditionNode.sourceName.setValueFromSource(
conditionSourceNode.readAttribute(context, AttributeIds.DisplayName).value
);
}
}
conditionNode.eventType.setValueFromSource({
dataType: DataType.NodeId,
value: conditionType.nodeId
});
// as per spec:
/**
*
* dataType: DataType.NodeId
*
* As per spec OPCUA 1.03 part 9:
* ConditionClassId specifies in which domain this Condition is used. It is the NodeId of the
public set displayName(value: LocalizedText[]) {
this._setDisplayName(value);
/**
* fires when the displayName is changed.
* @event DisplayName_changed
* @param dataValue {DataValue}
*/
this._notifyAttributeChange(AttributeIds.DisplayName);
}
set: function (value) {
this._setDisplayName(value);
/**
* fires when the displayName is changed.
* @event DisplayName_changed
* @param dataValue {DataValue}
*/
this._notifyAttributeChange(AttributeIds.DisplayName);
},
hidden: false,
task2: (callback: ErrorCallback) => {
if (cacheNode.displayName) {
return callback();
}
this._defer_readNode(
cacheNode.nodeId,
AttributeIds.DisplayName,
(err?: Error | null, value?: any) => {
if (err) {
return callback(err);
}
if (!(value instanceof LocalizedText)) {
debugLog(cacheNode.toString());
}
assert(value instanceof LocalizedText);
cacheNode.displayName = value;
setImmediate(callback);
});
},