How to use node-opcua-service-filter - 7 common examples

To help you get started, we’ve selected a few node-opcua-service-filter 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 / src / monitored_item.js View on Github external
MonitoredItem.prototype._on_opcua_event = function (eventData) {

    const self = this;

    assert(!self.filter || self.filter instanceof EventFilter);

    const selectClauses = self.filter ? self.filter.selectClauses : [];
    const eventFields = extractEventFields(selectClauses, eventData);

    // istanbul ignore next
    if (doDebug) {
        console.log(" RECEIVED INTERNAL EVENT THAT WE ARE MONITORING");
        console.log(self.filter ? self.filter.toString() : "no filter");
        eventFields.forEach(function (e) {
            console.log(e.toString());
        });
    }

    self._enqueue_event(eventFields);
};
github node-opcua / node-opcua / packages / node-opcua-server / source / monitored_item.ts View on Github external
// Release 1.04 8 OPC Unified Architecture, Part 9
    // 4.5 Condition state synchronization
    // To ensure a Client is always informed, the three special EventTypes
    // (RefreshEndEventType, RefreshStartEventType and RefreshRequiredEventType)
    // ignore the Event content filtering associated with a Subscription and will always be
    // delivered to the Client.

    if (!this.filter || !(this.filter instanceof EventFilter)) {
      throw new Error("Internal Error");
    }

    const selectClauses = this.filter.selectClauses
      ? this.filter.selectClauses
      : ([] as SimpleAttributeOperand[]);

    const eventFields = extractEventFields(selectClauses, eventData);

    // istanbul ignore next
    if (doDebug) {
      console.log(" RECEIVED INTERNAL EVENT THAT WE ARE MONITORING");
      console.log(this.filter ? this.filter.toString() : "no filter");
      eventFields.forEach((e: any) => {
        console.log(e.toString());
      });
    }

    this._enqueue_event(eventFields);
  }
github node-opcua / node-opcua / packages / node-opcua-client / source / alarms_and_conditions / client_alarm_tools_acknowledge_all_conditions.ts View on Github external
publishingEnabled: true,
        requestedLifetimeCount: 1000,
        requestedMaxKeepAliveCount: 100,
        requestedPublishingInterval: 100,
    };

    const subscription = await session.createSubscription2(request);

    const itemToMonitor: ReadValueIdOptions = {
        attributeId: AttributeIds.EventNotifier,
        nodeId: resolveNodeId("Server"), // i=2253
    };

    const fields = await extractConditionFields(session, "AcknowledgeableConditionType");

    const eventFilter = constructEventFilter(fields, [resolveNodeId("AcknowledgeableConditionType")]);

    const monitoringParameters: MonitoringParametersOptions = {
        discardOldest: false,
        filter: eventFilter,
        queueSize: 100,
        samplingInterval: 0,
    };

    const event_monitoringItem =
        await subscription.monitor(itemToMonitor, monitoringParameters, TimestampsToReturn.Both);

    const acknowledgeableConditions: EventStuff[] = [];

    let refreshStartEventHasBeenReceived = false;
    let RefreshEndEventHasBeenReceived = false;
github node-opcua / node-opcua / packages / node-opcua-client / source / alarms_and_conditions / client_alarm_tools.ts View on Github external
publishingEnabled: true,
        requestedLifetimeCount: 10000,
        requestedMaxKeepAliveCount: 1000,
        requestedPublishingInterval: 10,
    };
    const subscription = await session.createSubscription2(request);
    _sessionPriv.$subscriptionforAlarmList = subscription;

    const itemToMonitor: ReadValueIdOptions = {
        attributeId: AttributeIds.EventNotifier,
        nodeId: resolveNodeId("Server"), // i=2253
    };

    const fields = await extractConditionFields(session, "AlarmConditionType");

    const eventFilter = constructEventFilter(fields, [resolveNodeId("AcknowledgeableConditionType")]);

    const monitoringParameters: MonitoringParametersOptions = {
        discardOldest: false,
        filter: eventFilter,
        queueSize: 10000,
        samplingInterval: 0,
    };

    // now create a event monitored Item
    const event_monitoringItem = ClientMonitoredItem.create(subscription, itemToMonitor, monitoringParameters, TimestampsToReturn.Both);

    const RefreshStartEventType = resolveNodeId("RefreshStartEventType").toString();
    const RefreshEndEventType = resolveNodeId("RefreshEndEventType").toString();

    event_monitoringItem.on("changed", (eventFields: Variant[]) => {
        const pojo = fieldsToJson(fields, eventFields) as EventStuff;
github node-opcua / node-opcua / packages / node-opcua-server / src / server_subscription.js View on Github external
const StatusCodes = require("node-opcua-status-code").StatusCodes;
const Enum = require("node-opcua-enum").Enum;
const assert = require("node-opcua-assert").assert;
const NodeClass = require("node-opcua-data-model").NodeClass;
const _ = require("underscore");

const AttributeIds = require("node-opcua-data-model").AttributeIds;

const SequenceNumberGenerator = require("node-opcua-secure-channel").SequenceNumberGenerator;

const EventEmitter = require("events").EventEmitter;
const util = require("util");

const SessionContext = require("node-opcua-address-space").SessionContext;

const EventFilter = require("node-opcua-service-filter").EventFilter;
const DataChangeFilter = require("node-opcua-service-subscription").DataChangeFilter;
const AggregateFilter = require("node-opcua-service-subscription").AggregateFilter;

const UAVariable = require("node-opcua-address-space").UAVariable;
const validateFilter = require("./validate_filter").validateFilter;
const isValidDataEncoding = require("node-opcua-data-model").isValidDataEncoding;


const debugLog = require("node-opcua-debug").make_debugLog(__filename);
const doDebug = require("node-opcua-debug").checkDebugFlag(__filename);


const SubscriptionState = new Enum([
    "CLOSED",   // The Subscription has not yet been created or has terminated.
    "CREATING", // The Subscription is being created
    "NORMAL",   // The Subscription is cyclically checking for Notifications from its MonitoredItems.
github node-opcua / node-opcua / packages / node-opcua-server / src / monitored_item.js View on Github external
const Variant = require("node-opcua-variant").Variant;
const StatusCodes = require("node-opcua-status-code").StatusCodes;
const NodeClass = require("node-opcua-data-model").NodeClass;

const AttributeIds = require("node-opcua-data-model").AttributeIds;
const BaseNode = require("node-opcua-address-space").BaseNode;

const sameDataValue = require("node-opcua-data-value").sameDataValue;
const sameVariant = require("node-opcua-variant").sameVariant;
const isValidVariant = require("node-opcua-variant").isValidVariant;

const MonitoringMode = subscription_service.MonitoringMode;
const MonitoringParameters = subscription_service.MonitoringParameters;
const MonitoredItemModifyResult = subscription_service.MonitoredItemModifyResult;
const TimestampsToReturn = read_service.TimestampsToReturn;
const EventFilter = require("node-opcua-service-filter").EventFilter;
const apply_timestamps = require("node-opcua-data-value").apply_timestamps;

const UAVariable = require("node-opcua-address-space").UAVariable;

const defaultItemToMonitor = {indexRange: null, attributeId: read_service.AttributeIds.Value};

const SessionContext = require("node-opcua-address-space").SessionContext;
const NumericRange = require("node-opcua-numeric-range").NumericRange;



const debugLog = require("node-opcua-debug").make_debugLog(__filename);
const doDebug = require("node-opcua-debug").checkDebugFlag(__filename);

function _adjust_sampling_interval(samplingInterval,node_minimumSamplingInterval) {
github node-opcua / node-opcua / packages / node-opcua-address-space / src / address_space_add_event_type.js View on Github external
const NodeId = require("node-opcua-nodeid").NodeId;
const sameNodeId = require("node-opcua-nodeid").sameNodeId;
const lowerFirstLetter = require("node-opcua-utils").lowerFirstLetter;

const doDebug = false;


const BaseNode = require("./base_node").BaseNode;
const UAVariable = require("./ua_variable").UAVariable;
const UAMethod = require("./ua_method").UAMethod;
const UAObjectType = require("./ua_object_type").UAObjectType;

const constructBrowsePathFromQualifiedName = require("node-opcua-service-translate-browse-path").constructBrowsePathFromQualifiedName;


const SimpleAttributeOperand = require("node-opcua-service-filter").SimpleAttributeOperand;

const AttributeIds = require("node-opcua-data-model").AttributeIds;
const context = require("./session_context").SessionContext.defaultContext;
const DataValue = require("node-opcua-data-value").DataValue;

const Namespace = require("./namespace").Namespace;

/**
 * @class EventData
 * @param eventTypeNode {BaseNode}
 * @constructor
 */
function EventData(eventTypeNode) {
    this.__nodes = {};
    this.$eventDataSource = eventTypeNode;
    assert(eventTypeNode instanceof BaseNode);

node-opcua-service-filter

pure nodejs OPCUA SDK - module service-filter

MIT
Latest version published 7 days ago

Package Health Score

83 / 100
Full package analysis