How to use the node-opcua-service-subscription.MonitoringMode.Invalid function in node-opcua-service-subscription

To help you get started, we’ve selected a few node-opcua-service-subscription 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-server / source / monitored_item.ts View on Github external
public setMonitoringMode(monitoringMode: MonitoringMode) {

    assert(monitoringMode !== MonitoringMode.Invalid);

    if (monitoringMode === this.monitoringMode) {
      // nothing to do
      return;
    }

    const old_monitoringMode = this.monitoringMode;

    this.monitoringMode = monitoringMode;

    if (this.monitoringMode === MonitoringMode.Disabled) {

      this._stop_sampling();

      // OPCUA 1.03 part 4 : $5.12.4
      // setting the mode to DISABLED causes all queued Notifications to be deleted
github node-opcua / node-opcua / packages / node-opcua-server / source / server_subscription.ts View on Github external
private _createMonitoredItemStep3(
    monitoredItem: MonitoredItem,
    monitoredItemCreateRequest: MonitoredItemCreateRequest
  ): void {

    assert(monitoredItem.monitoringMode === MonitoringMode.Invalid);
    assert(_.isFunction(monitoredItem.samplingFunc));
    const monitoringMode = monitoredItemCreateRequest.monitoringMode; // Disabled, Sampling, Reporting
    monitoredItem.setMonitoringMode(monitoringMode);
  }
github node-opcua / node-opcua / packages / node-opcua-server / source / monitored_item.ts View on Github external
options.itemToMonitor = options.itemToMonitor || defaultItemToMonitor;

    this._samplingId = undefined;

    this.filter = null;
    this._set_parameters(options);

    this.monitoredItemId = options.monitoredItemId; // ( known as serverHandle)

    this.queue = [];
    this.overflow = false;

    this.oldDataValue = new DataValue({ statusCode: StatusCodes.BadDataUnavailable }); // unset initially

    // user has to call setMonitoringMode
    this.monitoringMode = MonitoringMode.Invalid;

    this.timestampsToReturn = options.timestampsToReturn || TimestampsToReturn.Neither;

    this.itemToMonitor = options.itemToMonitor;

    this._node = null;
    this._semantic_version = 0;

    if (doDebug) {
      debugLog("Monitoring ", options.itemToMonitor.toString());
    }

    this._on_node_disposed_listener = null;

    MonitoredItem.registry.register(this);
  }
github node-opcua / node-opcua / packages / node-opcua-server / source / monitored_item.ts View on Github external
this._stop_sampling();

      // OPCUA 1.03 part 4 : $5.12.4
      // setting the mode to DISABLED causes all queued Notifications to be deleted
      this.queue = [];
      this.overflow = false;
    } else {
      assert(this.monitoringMode === MonitoringMode.Sampling || this.monitoringMode === MonitoringMode.Reporting);

      // OPCUA 1.03 part 4 : $5.12.1.3
      // When a MonitoredItem is enabled (i.e. when the MonitoringMode is changed from DISABLED to
      // SAMPLING or REPORTING) or it is created in the enabled state, the Server shall report the first
      // sample as soon as possible and the time of this sample becomes the starting point for the next
      // sampling interval.
      const recordInitialValue = (old_monitoringMode === MonitoringMode.Invalid ||
        old_monitoringMode === MonitoringMode.Disabled);

      this._start_sampling(recordInitialValue);

    }
  }