How to use the node-opcua-nodeid.NodeId.nullNodeId function in node-opcua-nodeid

To help you get started, we’ve selected a few node-opcua-nodeid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-opcua / node-opcua / packages / node-opcua-address-space / src / alarms_and_conditions / condition.js View on Github external
UAConditionBase.prototype.raiseNewBranchState = function(branch) {
    const self = this;
    self.raiseConditionEvent(branch, true);

    if (branch.getBranchId() !== NodeId.nullNodeId && !branch.getRetain()) {
        //xx console.log(" Deleting not longer needed branch ", branch.getBranchId().toString());
        // branch can be deleted
        self.deleteBranch(branch);
    }
};
github node-opcua / node-opcua / packages / node-opcua-address-space / src / alarms_and_conditions / condition.js View on Github external
conditionNode.eventType.setValueFromSource({
        dataType: DataType.NodeId,
        value: conditionType.nodeId
    });

    data = data || {};
    // install initial branch ID (null NodeId);
    /**
     * dataType is DataType.NodeId
     * @property branchId
     * @type {UAVariableType}
     *
     */
    conditionNode.branchId.setValueFromSource({
        dataType: DataType.NodeId,
        value: NodeId.nullNodeId
    });

    // install 'Comment' condition variable
    /**
     * dataType is DataType.LocalizedText
     * @property comment
     * @type {UAVariableType}
     *
     */
    _install_condition_variable_type(conditionNode.comment);

    // install 'Quality' condition variable
    /**
     * dataType is DataType.StatusCode
     * @property quality
     * @type {UAVariableType}
github node-opcua / node-opcua / packages / node-opcua-address-space / src / alarms_and_conditions / condition.js View on Github external
function ConditionSnapshot(condition, branchId) {
    const self = this;
    EventEmitter.call(this);
    if (condition && branchId) {
        assert(branchId instanceof NodeId);
        //xx self.branchId = branchId;
        self.condition = condition;
        self.eventData = new EventData(condition);
        // a nodeId/Variant map
        _record_condition_state(self, condition);

        if (branchId === NodeId.nullNodeId) {
            _installOnChangeEventHandlers(self, condition, "");
        }

        self._set_var("branchId", DataType.NodeId, branchId);
    }
}
util.inherits(ConditionSnapshot, EventEmitter);
github node-opcua / node-opcua / packages / node-opcua-server-configuration / source / server / install_CertificateAlarm.ts View on Github external
export function installCertificateExpirationAlarm(addressSpace: AddressSpace) {

    debugLog("installCertificateExpirationAlarm");

    const server = addressSpace.rootFolder.objects.server;

    const namespace = addressSpace.getOwnNamespace();

    const certificateExpirationAlarmType = addressSpace.findEventType("CertificateExpirationAlarmType");

    const options = {
        browseName: "ServerCertificateAlarm",
        conditionSource: null,
        eventSourceOf: server,
        inputNode: NodeId.nullNodeId,
        normalState: NodeId.nullNodeId
    };
    const data = {};
    const alarm = UACertificateExpirationAlarm.instantiate(namespace, options, data);
    // const alarm = namespace.instantiateOffNormalAlarm({) as UACertificateExpirationAlarm;
    alarm.currentBranch().setRetain(true);
    alarm.activeState.setValue(true);
}
github node-opcua / node-opcua / packages / node-opcua-server-configuration / source / server / install_CertificateAlarm.ts View on Github external
export function installCertificateExpirationAlarm(addressSpace: AddressSpace) {

    debugLog("installCertificateExpirationAlarm");

    const server = addressSpace.rootFolder.objects.server;

    const namespace = addressSpace.getOwnNamespace();

    const certificateExpirationAlarmType = addressSpace.findEventType("CertificateExpirationAlarmType");

    const options = {
        browseName: "ServerCertificateAlarm",
        conditionSource: null,
        eventSourceOf: server,
        inputNode: NodeId.nullNodeId,
        normalState: NodeId.nullNodeId
    };
    const data = {};
    const alarm = UACertificateExpirationAlarm.instantiate(namespace, options, data);
    // const alarm = namespace.instantiateOffNormalAlarm({) as UACertificateExpirationAlarm;
    alarm.currentBranch().setRetain(true);
    alarm.activeState.setValue(true);
}
github node-opcua / node-opcua / packages / node-opcua-server / source / server_subscription.ts View on Github external
constructor(options: SubscriptionOptions) {

    super();

    options = options || {};

    Subscription.registry.register(this);

    this.sessionId = options.sessionId || NodeId.nullNodeId;
    assert(this.sessionId instanceof NodeId, "expecting a sessionId NodeId");

    this.publishEngine = options.publishEngine;
    _assert_valid_publish_engine(this.publishEngine);

    this.id = options.id || INVALID_ID;

    this.priority = options.priority || 0;

    this.publishingInterval = _adjust_publishing_interval(options.publishingInterval);

    this.maxKeepAliveCount = _adjust_maxKeepAliveCount(options.maxKeepAliveCount); // , this.publishingInterval);

    this.resetKeepAliveCounter();

    this.lifeTimeCount = _adjust_lifeTimeCount(
github node-opcua / node-opcua / packages / node-opcua-server / source / server_engine.ts View on Github external
assert(request.hasOwnProperty("requestedMaxKeepAliveCount"));  // Counter
    assert(request.hasOwnProperty("maxNotificationsPerPublish"));  // Counter
    assert(request.hasOwnProperty("publishingEnabled"));           // Boolean
    assert(request.hasOwnProperty("priority"));                    // Byte

    const subscription = new Subscription({
      id: _get_next_subscriptionId(),
      lifeTimeCount: request.requestedLifetimeCount,
      maxKeepAliveCount: request.requestedMaxKeepAliveCount,
      maxNotificationsPerPublish: request.maxNotificationsPerPublish,
      priority: request.priority || 0,
      publishEngine: session.publishEngine, //
      publishingEnabled: request.publishingEnabled,
      publishingInterval: request.requestedPublishingInterval,
      // -------------------
      sessionId: NodeId.nullNodeId
    });

    // add subscriptionDiagnostics
    this._exposeSubscriptionDiagnostics(subscription);

    assert(subscription.publishEngine === session.publishEngine);
    session.publishEngine.add_subscription(subscription);

    const engine = this;
    subscription.once("terminated", function (this: Subscription) {
      engine._unexposeSubscriptionDiagnostics(this);
    });

    return subscription;
  }
github node-opcua / node-opcua / packages / node-opcua-address-space / src / alarms_and_conditions / alarm_condition.js View on Github external
if (isActive) {
        alarm.currentBranch().setActiveState(true);
        alarm.currentBranch().setAckedState(false);
        alarm.raiseNewCondition(newConditionInfo);
    } else {

        if (alarm.currentBranch().getAckedState() === false) {
            // prior state need acknowledgement
            // note : TODO : timestamp of branch and new state of current branch must be identical

            if (alarm.currentBranch().getRetain()) {

                // we need to create a new branch so the previous state could be acknowledged
                const newBranch = alarm.createBranch();
                assert(newBranch.getBranchId() !== NodeId.nullNodeId);
                // also raised a new Event for the new branch as branchId has changed
                alarm.raiseNewBranchState(newBranch);

            }
        }

        alarm.currentBranch().setActiveState(false);
        alarm.currentBranch().setAckedState(true);

        alarm.raiseNewCondition(newConditionInfo);
    }
};
github node-opcua / node-opcua / packages / node-opcua-address-space / src / alarms_and_conditions / condition.js View on Github external
*    to specify all individual ConditionClassType NodeIds. The OfType operator cannot be applied.
     *    BaseConditionClassType is used as class whenever a Condition cannot be assigned to a
     *    more concrete class.
     *
     *                         BaseConditionClassType
     *                                   |
     *                      +---------------------------+----------------------------+
     *                     |                           |                             |
     *            ProcessConditionClassType  MaintenanceConditionClassType  SystemConditionClassType
     *
     *  @property conditionName
     *  @type {UAVariable}
     */
    const baseConditionClassType = addressSpace.findObjectType("ProcessConditionClassType");
    //assert(baseConditionClassType,"Expecting BaseConditionClassType to be in addressSpace");
    let conditionClassId = baseConditionClassType ? baseConditionClassType.nodeId : NodeId.nullNodeId;
    let conditionClassName = baseConditionClassType ? baseConditionClassType.displayName[0] : "";
    if (options.conditionClass) {
        if (_.isString(options.conditionClass)) {
            options.conditionClass = addressSpace.findObjectType(options.conditionClass);
        }
        const conditionClassNode = addressSpace._coerceNode(options.conditionClass);
        if (!conditionClassNode) {
            throw new Error("cannot find condition class " + options.conditionClass.toString());
        }
        conditionClassId = conditionClassNode.nodeId;
        conditionClassName = conditionClassNode.displayName[0];
    }
    conditionNode.conditionClassId.setValueFromSource({
        dataType: DataType.NodeId,
        value: conditionClassId
    });
github node-opcua / node-opcua / packages / node-opcua-address-space / src / alarms_and_conditions / condition_snapshot.ts View on Github external
public isCurrentBranch(): boolean {
        return this._get_var("branchId") === NodeId.nullNodeId;
    }