Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(options: AddReferenceOpts | Reference) {
assert(options.referenceType instanceof NodeId);
assert(options.nodeId instanceof NodeId);
this.referenceType = coerceNodeId(options.referenceType);
this.isForward = (options.isForward === undefined ) ? true : !!options.isForward;
this.nodeId = _localCoerceToNodeID(options.nodeId);
// optional to speed up when AddReferenceOpts is in fact a Reference !
this._referenceType = (options as any)._referenceType;
this.node = (options as any).node;
assert(is_valid_reference(this));
}
if (conditionSourceNode) {
conditionNode.sourceNode.setValueFromSource({
dataType: DataType.NodeId,
value: conditionSourceNode.nodeId
});
// conditionSourceNode node must be registered as a EventSource of an other node.
// As per spec OPCUA 1.03 part 9 page 54:
// HasNotifier and HasEventSource References are used to expose the hierarchical organization
// 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.
if (!sameNodeId(conditionSourceNode.nodeId, coerceNodeId("ns=0;i=2253"))) { // server object
/* istanbul ignore next */
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(
type: "NodeId", defaultValue: function() {
return coerceNodeId("ns=" + 3 + ";g=00000000-0000-0000-0000-000000000023");
}
},
const assert = require("node-opcua-assert").assert;
const EventEmitter = require("events").EventEmitter;
const util = require("util");
const coerceNodeId = require("node-opcua-nodeid").coerceNodeId;
const VariableIds = require("node-opcua-constants").VariableIds;
const serverStatus_State_Id = coerceNodeId(VariableIds.Server_ServerStatus_State);
const ServerState = require("node-opcua-common").ServerState;
const StatusCodes = require("node-opcua-status-code").StatusCodes;
const debugLog = require("node-opcua-debug").make_debugLog(__filename);
const doDebug = require("node-opcua-debug").checkDebugFlag(__filename);
function ClientSessionKeepAliveManager(session) {
const self = this;
self.session = session;
self.timerId = 0;
}
util.inherits(ClientSessionKeepAliveManager, EventEmitter);
/**
* @method ping_server
*
function getEncodingBinaryId(schema: StructuredTypeSchema): NodeId {
const className = schema.name;
const encodingBinarylId = (ObjectIds as any)[className + "_Encoding_DefaultBinary"];
return coerceNodeId(encodingBinarylId);
}
function getEncodingXmlId(schema: StructuredTypeSchema): NodeId {
const className = schema.name;
const encodingXmlId = (ObjectIds as any)[className + "_Encoding_DefaultXml"];
return coerceNodeId(encodingXmlId);
}
function getObject(proxyManager, nodeId, options, callback) {
const session = proxyManager.session;
nodeId = coerceNodeId(nodeId);
if (nodeId.isEmpty()) {
return setImmediate(function() {
callback(new Error(" Invalid empty node in getObject"));
});
}
const nodesToRead = [
{
nodeId: nodeId,
attributeId: AttributeIds.BrowseName
},
{
nodeId: nodeId,
attributeId: AttributeIds.Description
},
function prepareDataType(dataType) {
return coerceNodeId(dataType);
}