PySide6.QtOpcUa.QOpcUaMonitoringParameters

class QOpcUaMonitoringParameters

QOpcUaMonitoringParameters provides a way to set and retrieve parameters for subscriptions and monitored items. More_

Synopsis

Methods

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description

This class is used in enableMonitoring() requests and as return value for monitoringStatus() in which case it contains the revised values from the server.

Usage

For most use cases, only the publishing interval is required.

QOpcUaMonitoringParameters p(100); // Set a publishing interval of 100ms and share the subscription.
node->enableMonitoring(QOpcUa::NodeAttribute::Value, p);

If an exclusive subscription is required, use the second parameter.

QOpcUaMonitoringParameters p(100, QOpcUaMonitoringParameters::SubscriptionType::Exclusive); // Create a new subscription

To add additional items to an existing subscription, use the third parameter for the next calls to enableMonitoring() .

quint32 subscriptionId = node->monitoringStatus(QOpcUa::NodeAttribute::Value).subscriptionId();
QOpcUaMonitoringParameters p(100, QOpcUaMonitoringParameters::SubscriptionType::Shared, subscriptionId); // Add the monitored item to this subscription

If other parameters are required, they must be set using the setter methods.

class MonitoringMode

This enum is used to set the monitoring mode for a monitored item.

Constant

Description

QOpcUaMonitoringParameters.MonitoringMode.Disabled

Sampling is disabled and no notifications are being generated.

QOpcUaMonitoringParameters.MonitoringMode.Sampling

Sampling is enabled and notifications are generated and queued, but reporting is disabled.

QOpcUaMonitoringParameters.MonitoringMode.Reporting

Sampling is enabled, notifications are generated and queued, reporting is enabled.

class SubscriptionType

This enum is used to determine if the monitored item can be added to a shared subscription or if a new subscription must be created.

Constant

Description

QOpcUaMonitoringParameters.SubscriptionType.Shared

Share subscription with other monitored items with the same interval

QOpcUaMonitoringParameters.SubscriptionType.Exclusive

Request a new subscription for this attribute

class Parameter

(inherits enum.Flag) Enumerates parameters that can be modified at runtime using modifyMonitoring() . Not all values are guaranteed to be supported by all plugins. Lack of support will be reported in the monitoringStatusChanged signal.

Constant

Description

QOpcUaMonitoringParameters.Parameter.PublishingEnabled

QOpcUaMonitoringParameters.Parameter.PublishingInterval

QOpcUaMonitoringParameters.Parameter.LifetimeCount

QOpcUaMonitoringParameters.Parameter.MaxKeepAliveCount

QOpcUaMonitoringParameters.Parameter.MaxNotificationsPerPublish

QOpcUaMonitoringParameters.Parameter.Priority

QOpcUaMonitoringParameters.Parameter.SamplingInterval

QOpcUaMonitoringParameters.Parameter.Filter

QOpcUaMonitoringParameters.Parameter.QueueSize

QOpcUaMonitoringParameters.Parameter.DiscardOldest

QOpcUaMonitoringParameters.Parameter.MonitoringMode

QOpcUaMonitoringParameters.Parameter.TriggeredItemIds

__init__()

The default constructor for QOpcUaMonitoringParameters .

__init__(other)
Parameters:

otherQOpcUaMonitoringParameters

Constructs a QOpcuaMonitoringParameters object from the value of other.

__init__(publishingInterval[, subscriptionType=QOpcUaMonitoringParameters.SubscriptionType.Shared[, subscriptionId=0]])
Parameters:
  • publishingInterval – float

  • subscriptionTypeSubscriptionType

  • subscriptionId – int

This is the constructor which covers most use cases for the Qt OPC UA user. publishingInterval must be supplied, shared and subscriptionId are optional.

clearFilter()

Removes the current filter from the monitoring parameters.

clearFilterResult()

Removes the current filter result from the monitoring parameters.

discardOldest()
Return type:

bool

Returns the discardOldest setting of the monitored item.

failedTriggeredItemsStatus()
Return type:

Dictionary with keys of type .quint32 and values of type QOpcUa.UaStatusCode.

Returns the status codes for all triggered items from setTriggeredItemIds() that could not be successfully added.

filter()
Return type:

object

Returns the current filter.

See also

setFilter()

filterResult()
Return type:

object

Returns the filter result.

This value is empty for an attribute monitoring. In case of an event monitoring, the filter result can be empty if the server did not detect any errors in the filter.

indexRange()
Return type:

str

Returns the index range for the monitored item.

See also

setIndexRange()

isPublishingEnabled()
Return type:

bool

Returns the publishing mode for the subscription.

lifetimeCount()
Return type:

int

Returns the lifetime count of the subscription.

maxKeepAliveCount()
Return type:

int

Returns the maximum keepalive count of the subscription.

maxNotificationsPerPublish()
Return type:

int

Returns the maximum notifications per publish value of the subscription.

monitoredItemId()
Return type:

int

Returns the monitored item id assigned by the server. If the monitored item id is 0, the monitored item could not be successfully created.

monitoringMode()
Return type:

MonitoringMode

Returns the monitoring mode for the monitored item.

priority()
Return type:

int

Returns the priority of the subscription used for the monitored item.

See also

setPriority()

publishingInterval()
Return type:

float

Returns the publishing interval of the subscription. The interval is expressed in milliseconds.

queueSize()
Return type:

int

Returns the queue size of the monitored item.

See also

setQueueSize()

samplingInterval()
Return type:

float

Returns the revised sampling interval of the monitored item. The interval is expressed in milliseconds.

setDiscardOldest(discardOldest)
Parameters:

discardOldest – bool

Set discardOldest as discardOldest setting for the monitored item.

See also

discardOldest()

setFailedTriggeredItemsStatus(status)
Parameters:

status – Dictionary with keys of type .quint32 and values of type QOpcUa.UaStatusCode.

Sets the status codes for all triggered items that could not be successfully added to status. Setting this value as a client has no effect.

setFilter(filter)
Parameters:

filterDataChangeFilter

Sets DataChangeFilter filter as filter for the monitored item. If another data change filter or an event filter is present, it will be replaced.

If the server does not accept the filter, this will be indicated by the status code after the enableMonitoring() request has finished.

See also

filter()

setFilter(eventFilter)
Parameters:

eventFilterEventFilter

Request eventFilter as filter for the monitored item. If another event filter or a data change filter is present, it will be replaced. If the server does not accept the filter, this will be indicated by the status code and the event filter result after the enableMonitoring() request has finished.

See also

filter()

setFilterResult(eventFilterResult)
Parameters:

eventFilterResultQOpcUaEventFilterResult

Sets the event filter result to eventFilterResult.

This method must only be used by the backend, setting an event filter result as a user does not have any effect.

See also

filterResult()

setIndexRange(indexRange)
Parameters:

indexRange – str

Requests indexRange as index range for the monitored item. For details on the index range string, see readAttributeRange() .

See also

indexRange()

setLifetimeCount(lifetimeCount)
Parameters:

lifetimeCount – int

Request lifetimeCount as lifetime count for the subscription.

See also

lifetimeCount()

setMaxKeepAliveCount(maxKeepAliveCount)
Parameters:

maxKeepAliveCount – int

Request maxKeepAliveCount as maximum keepalive count for the subscription.

setMaxNotificationsPerPublish(maxNotificationsPerPublish)
Parameters:

maxNotificationsPerPublish – int

Set maxNotificationsPerPublish as maximum notifications per publish value for the subscription.

setMonitoredItemId(monitoredItemId)
Parameters:

monitoredItemId – int

Sets the monitored item id to monitoredItemId.

Setting this value as a client has no effect.

setMonitoringMode(monitoringMode)
Parameters:

monitoringModeMonitoringMode

Set monitoringMode as monitoring mode for the monitored item.

See also

monitoringMode()

setPriority(priority)
Parameters:

priority – int

Set priority as priority for the subscription.

See also

priority()

setPublishingEnabled(publishingEnabled)
Parameters:

publishingEnabled – bool

Set publishingEnabled as publishing mode for the subscription.

setPublishingInterval(publishingInterval)
Parameters:

publishingInterval – float

Request publishingInterval as publishing interval for the subscription. The interval is expressed in milliseconds.

setQueueSize(queueSize)
Parameters:

queueSize – int

Request queueSize as queue size for the monitored item.

See also

queueSize()

setSamplingInterval(samplingInterval)
Parameters:

samplingInterval – float

Request samplingInterval as sampling interval for the monitored item. The interval is expressed in milliseconds.

setStatusCode(statusCode)
Parameters:

statusCodeUaStatusCode

Set the status code to statusCode.

See also

statusCode()

setSubscriptionId(subscriptionId)
Parameters:

subscriptionId – int

Request the monitored items to be created on a known subscription with subscriptionId.

See also

subscriptionId()

setSubscriptionType(subscriptionType)
Parameters:

subscriptionTypeSubscriptionType

Request shared as subscription type for the subscription.

setTriggeredItemIds(id)
Parameters:

id – .QSetquint32

Adds triggering links to all monitored items in ids as described in OPC UA 1.05, 5.12.1.6.

The values in ids must be the monitored item ids of other monitored item on the same subscription. If the monitoring mode of these items is set to Sampling, their data change notifications will be delivered to the client whenever this monitoring detects a data change.

Any ids that could not be added will not be included in the monitoring status but will instead show up in failedTriggeredItemsStatus() .

Modifying this setting to an empty set will remove all triggering links.

statusCode()
Return type:

UaStatusCode

Returns the status code of the monitored item creation.

See also

setStatusCode()

subscriptionId()
Return type:

int

Returns the assigned subscription id.

subscriptionType()
Return type:

SubscriptionType

Returns the subscription type.

triggeredItemIds()
Return type:

.QSetquint32

Returns the ids of the monitored items triggerd by this monitored item.

class EventFilter

Defines an EventFilter for a monitored item. More_

Synopsis

Methods

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description

An event filter is required for monitoring events on the server. It consists of select clauses and a where clause.

The select clauses are used to specify the data the user wants to receive when an event occurs. It consists of QOpcUaSimpleAttributeOperand simple attribute operands which select attributes of child nodes of an event type, for example the value attribute of the “Message” property of BaseEventType.

The where clause is used to restrict the reported events by matching against certain criteria. Several operators and four different operand types allow filtering based on the values of the attributes of the child nodes of an event type.

Filters can be constructed using the setter or the streaming operator. Streaming a QOpcUaSimpleAttributeOperand into an event filter adds a new select clause to the filter, a QOpcUaContentFilterElement is appended to the where clause. A content filter element can be constructed by streaming operands of the types QOpcUaLiteralOperand , QOpcUaElementOperand , QOpcUaAttributeOperand and QOpcUaSimpleAttributeOperand and an operator into a content filter element. Only the last operator is used, previous operators will be discarded.

The following EventFilter tells the server to report the value of the “Message” field for events that have a “Severity” field with value >= 500:

QOpcUaMonitoringParameters::EventFilter filter;
filter << QOpcUaSimpleAttributeOperand("Message"); // Select clause of the filter

QOpcUaContentFilterElement condition;
condition << QOpcUaContentFilterElement::FilterOperator::GreaterThanOrEqual;
condition << QOpcUaSimpleAttributeOperand("Severity");
condition << QOpcUaLiteralOperand(500, QOpcUa::Types::UInt16);
filter << condition; // Where clause of the filter

For a more complex example with two conditions, see QOpcUaElementOperand .

__init__()
__init__(rhs)
Parameters:

rhsEventFilter

Constructs an event filter from rhs.

__lshift__(whereClauseElement)
Parameters:

whereClauseElementQOpcUaContentFilterElement

Return type:

EventFilter

Adds the content filter element whereClauseElement to the where clause of this event filter.

__lshift__(selectClauseElement)
Parameters:

selectClauseElementQOpcUaSimpleAttributeOperand

Return type:

EventFilter

Adds the simple attribute operand selectClauseElement to the select clause of this content filter element.

__eq__(rhs)
Parameters:

rhsEventFilter

Return type:

bool

Returns true if this event filter has the same value as rhs.

selectClauses()
Return type:

.list of QOpcUaSimpleAttributeOperand

Returns the selected event fields that shall be included when a new event is reported.

selectClausesRef()
Return type:

.list of QOpcUaSimpleAttributeOperand

Returns a reference to the select clauses.

setSelectClauses(selectClauses)
Parameters:

selectClauses – .list of QOpcUaSimpleAttributeOperand

Sets the select clauses to selectClauses.

See also

selectClauses()

setWhereClause(whereClause)
Parameters:

whereClause – .list of QOpcUaContentFilterElement

Sets the where clause to whereClause.

See also

whereClause()

whereClause()
Return type:

.list of QOpcUaContentFilterElement

Returns the content filter used to restrict the reported events to events matching certain criteria.

See also

setWhereClause()

whereClauseRef()
Return type:

.list of QOpcUaContentFilterElement

Returns a reference to the where clause.

See also

whereClause()

class DataChangeFilter

Defines a DataChangeFilter for a monitored item. More_

Synopsis

Methods

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description

This class is used to set up filtering for a DataChange monitored item. It is defined in OPC UA 1.05 part 4, 7.22.2.

class DataChangeTrigger

Enumerates the possible triggers for a DataChangeFilter .

Constant

Description

QOpcUaMonitoringParameters.DataChangeFilter.DataChangeTrigger.Status

Triggers if the value’s status code changes.

QOpcUaMonitoringParameters.DataChangeFilter.DataChangeTrigger.StatusOrValue

Triggers if the value’s status code or the value itself changes.

QOpcUaMonitoringParameters.DataChangeFilter.DataChangeTrigger.StatusOrValueOrTimestamp

Triggers if the value’s status code, the value itself or the source timestamp changes.

class DeadbandType

Enumerates the possible deadband types for a DataChangeFilter .

Constant

Description

QOpcUaMonitoringParameters.DataChangeFilter.DeadbandType.None

No deadband filtering.

QOpcUaMonitoringParameters.DataChangeFilter.DeadbandType.Absolute

A notification is generated if the absolute value of the difference between the last cached value and the current value is greater than the deadband value.

QOpcUaMonitoringParameters.DataChangeFilter.DeadbandType.Percent

Only valid for AnalogItems with an EURange property. A notification is generated if the absolute value of the difference between the last cached value and the current value is greater than value percent of the EURange.

__init__()

Constructs a data change filter with trigger on status, deadband type none and deadbandValue 0.

__init__(rhs)
Parameters:

rhsDataChangeFilter

Constructs a data change filter from rhs.

__init__(trigger, deadbandType, deadbandValue)
Parameters:

Constructs a data change filter with trigger trigger, deadband type deadbandType and deadband value deadbandValue.

deadbandType()
Return type:

DeadbandType

Returns the deadband type.

deadbandValue()
Return type:

float

Returns the deadband value.

__eq__(rhs)
Parameters:

rhsDataChangeFilter

Return type:

bool

Returns true if this data change filter has the same value as rhs.

setDeadbandType(deadbandType)
Parameters:

deadbandTypeDeadbandType

Sets the deadband type to deadbandType.

See also

deadbandType()

setDeadbandValue(deadbandValue)
Parameters:

deadbandValue – float

Sets the deadband value to deadbandValue.

See also

deadbandValue()

setTrigger(trigger)
Parameters:

triggerDataChangeTrigger

Sets the trigger to trigger.

See also

trigger()

trigger()
Return type:

DataChangeTrigger

Returns the trigger.

See also

setTrigger()