QOpcUaMonitoringParameters Class

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

头: #include <QOpcUaMonitoringParameters>
qmake: QT += opcua

公共类型

class DataChangeFilter
class EventFilter
enum class MonitoringMode { Disabled, Sampling, Reporting }
enum class 参数 { PublishingEnabled, PublishingInterval, LifetimeCount, MaxKeepAliveCount, MaxNotificationsPerPublish, …, MonitoringMode }
flags 参数
enum class SubscriptionType { Shared, Exclusive }

公共函数

  QOpcUaMonitoringParameters (const QOpcUaMonitoringParameters & other )
  QOpcUaMonitoringParameters (double publishingInterval , QOpcUaMonitoringParameters::SubscriptionType shared = SubscriptionType::Shared, quint32 subscriptionId = 0)
  QOpcUaMonitoringParameters ()
QOpcUaMonitoringParameters & operator= (const QOpcUaMonitoringParameters & other )
  ~QOpcUaMonitoringParameters ()
void clearFilter ()
void clearFilterResult ()
bool discardOldest () const
QVariant filter () const
QVariant filterResult () const
QString indexRange () const
bool isPublishingEnabled () const
quint32 lifetimeCount () const
quint32 maxKeepAliveCount () const
quint32 maxNotificationsPerPublish () const
quint32 monitoredItemId () const
QOpcUaMonitoringParameters::MonitoringMode monitoringMode () const
quint8 priority () const
double publishingInterval () const
quint32 queueSize () const
double samplingInterval () const
void setDiscardOldest (bool discardOldest )
void setFilter (const QOpcUaMonitoringParameters::DataChangeFilter & filter )
void setFilter (const QOpcUaMonitoringParameters::EventFilter & eventFilter )
void setFilterResult (const QOpcUaEventFilterResult & eventFilterResult )
void setIndexRange (const QString & indexRange )
void setLifetimeCount (quint32 lifetimeCount )
void setMaxKeepAliveCount (quint32 maxKeepAliveCount )
void setMaxNotificationsPerPublish (quint32 maxNotificationsPerPublish )
void setMonitoredItemId (quint32 monitoredItemId )
void setMonitoringMode (QOpcUaMonitoringParameters::MonitoringMode monitoringMode )
void setPriority (quint8 priority )
void setPublishingEnabled (bool publishingEnabled )
void setPublishingInterval (double publishingInterval )
void setQueueSize (quint32 queueSize )
void setSamplingInterval (double samplingInterval )
void setStatusCode (QOpcUa::UaStatusCode statusCode )
void setSubscriptionId (quint32 subscriptionId )
void setSubscriptionType (QOpcUaMonitoringParameters::SubscriptionType shared )
QOpcUa::UaStatusCode statusCode () const
quint32 subscriptionId () const
QOpcUaMonitoringParameters::SubscriptionType subscriptionType () const

详细描述

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

用法

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 QOpcUaNode::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.

后端支持

Not all parameters in this class are supported by all backends.

参数 Open62541 插件 UACpp plugin
PublishingInterval X X
SamplingInterval X X
LifetimeCount X X
MaxKeepAliveCount X X
优先级 X X
IndexRange X X
Shared X X
SubscriptionId X X
PublishingEnabled X X
Filter X X
QueueSize X X
DiscardOldest X X
MonitoringMode X X
IndexRange X X
MaxNotificationsPerPublish X X

成员类型文档编制

enum class QOpcUaMonitoringParameters:: MonitoringMode

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

常量 描述
QOpcUaMonitoringParameters::MonitoringMode::Disabled 0 Sampling is disabled and no notifications are being generated.
QOpcUaMonitoringParameters::MonitoringMode::Sampling 1 Sampling is enabled and notifications are generated and queued, but reporting is disabled.
QOpcUaMonitoringParameters::MonitoringMode::Reporting 2 Sampling is enabled, notifications are generated and queued, reporting is enabled.

enum class QOpcUaMonitoringParameters:: 参数
flags QOpcUaMonitoringParameters:: 参数

Enumerates parameters that can be modified at runtime using QOpcUaNode::modifyMonitoring (). Not all values are guaranteed to be supported by all plugins. Lack of support will be reported in the QOpcUaNode::monitoringStatusChanged 信号。

常量
QOpcUaMonitoringParameters::Parameter::PublishingEnabled (1 << 0)
QOpcUaMonitoringParameters::Parameter::PublishingInterval (1 << 1)
QOpcUaMonitoringParameters::Parameter::LifetimeCount (1 << 2)
QOpcUaMonitoringParameters::Parameter::MaxKeepAliveCount (1 << 3)
QOpcUaMonitoringParameters::Parameter::MaxNotificationsPerPublish (1 << 4)
QOpcUaMonitoringParameters::Parameter::Priority (1 << 5)
QOpcUaMonitoringParameters::Parameter::SamplingInterval (1 << 6)
QOpcUaMonitoringParameters::Parameter::Filter (1 << 7)
QOpcUaMonitoringParameters::Parameter::QueueSize (1 << 8)
QOpcUaMonitoringParameters::Parameter::DiscardOldest (1 << 9)
QOpcUaMonitoringParameters::Parameter::MonitoringMode (1 << 10)

The Parameters type is a typedef for QFlags <Parameter>. It stores an OR combination of Parameter values.

enum class QOpcUaMonitoringParameters:: 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.

常量 描述
QOpcUaMonitoringParameters::SubscriptionType::Shared 0 Share subscription with other monitored items with the same interval
QOpcUaMonitoringParameters::SubscriptionType::Exclusive 1 Request a new subscription for this attribute

成员函数文档编制

QOpcUaMonitoringParameters:: QOpcUaMonitoringParameters (const QOpcUaMonitoringParameters & other )

Constructs a QOpcuaMonitoringParameters object from the value of other .

QOpcUaMonitoringParameters:: QOpcUaMonitoringParameters ( double publishingInterval , QOpcUaMonitoringParameters::SubscriptionType shared = SubscriptionType::Shared, quint32 subscriptionId = 0)

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

QOpcUaMonitoringParameters:: QOpcUaMonitoringParameters ()

The default constructor for QOpcUaMonitoringParameters.

QOpcUaMonitoringParameters &QOpcUaMonitoringParameters:: operator= (const QOpcUaMonitoringParameters & other )

Assigns the value of other 到此对象。

QOpcUaMonitoringParameters:: ~QOpcUaMonitoringParameters ()

The destructor for QOpcUaMonitoringParameters .

void QOpcUaMonitoringParameters:: clearFilter ()

Removes the current filter from the monitoring parameters.

另请参阅 filter () 和 setFilter ().

void QOpcUaMonitoringParameters:: clearFilterResult ()

Removes the current filter result from the monitoring parameters.

另请参阅 filterResult () 和 setFilterResult ().

bool QOpcUaMonitoringParameters:: discardOldest () const

Returns the discardOldest setting of the monitored item.

另请参阅 setDiscardOldest ().

QVariant QOpcUaMonitoringParameters:: filter () const

Returns the current filter.

另请参阅 setFilter ().

QVariant QOpcUaMonitoringParameters:: filterResult () const

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.

另请参阅 setFilterResult ().

QString QOpcUaMonitoringParameters:: indexRange () const

Returns the index range for the monitored item.

另请参阅 setIndexRange ().

bool QOpcUaMonitoringParameters:: isPublishingEnabled () const

Returns the publishing mode for the subscription.

quint32 QOpcUaMonitoringParameters:: lifetimeCount () const

Returns the lifetime count of the subscription.

另请参阅 setLifetimeCount ().

quint32 QOpcUaMonitoringParameters:: maxKeepAliveCount () const

Returns the maximum keepalive count of the subscription.

另请参阅 setMaxKeepAliveCount ().

quint32 QOpcUaMonitoringParameters:: maxNotificationsPerPublish () const

Returns the maximum notifications per publish value of the subscription.

另请参阅 setMaxNotificationsPerPublish ().

quint32 QOpcUaMonitoringParameters:: monitoredItemId () const

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

另请参阅 setMonitoredItemId ().

QOpcUaMonitoringParameters::MonitoringMode QOpcUaMonitoringParameters:: monitoringMode () const

Returns the monitoring mode for the monitored item.

另请参阅 setMonitoringMode ().

quint8 QOpcUaMonitoringParameters:: priority () const

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

另请参阅 setPriority ().

double QOpcUaMonitoringParameters:: publishingInterval () const

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

另请参阅 setPublishingInterval ().

quint32 QOpcUaMonitoringParameters:: queueSize () const

Returns the queue size of the monitored item.

另请参阅 setQueueSize ().

double QOpcUaMonitoringParameters:: samplingInterval () const

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

另请参阅 setSamplingInterval ().

void QOpcUaMonitoringParameters:: setDiscardOldest ( bool discardOldest )

Set discardOldest as discardOldest setting for the monitored item.

另请参阅 discardOldest ().

void QOpcUaMonitoringParameters:: setFilter (const QOpcUaMonitoringParameters::DataChangeFilter & filter )

设置 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 QOpcUaNode::enableMonitoring () request has finished.

另请参阅 filter ().

void QOpcUaMonitoringParameters:: setFilter (const QOpcUaMonitoringParameters::EventFilter & eventFilter )

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 QOpcUaNode::enableMonitoring () request has finished.

另请参阅 filter ().

void QOpcUaMonitoringParameters:: setFilterResult (const QOpcUaEventFilterResult & eventFilterResult )

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.

另请参阅 filterResult ().

void QOpcUaMonitoringParameters:: setIndexRange (const QString & indexRange )

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

另请参阅 indexRange ().

void QOpcUaMonitoringParameters:: setLifetimeCount ( quint32 lifetimeCount )

Request lifetimeCount as lifetime count for the subscription.

另请参阅 lifetimeCount ().

void QOpcUaMonitoringParameters:: setMaxKeepAliveCount ( quint32 maxKeepAliveCount )

Request maxKeepAliveCount as maximum keepalive count for the subscription.

另请参阅 maxKeepAliveCount ().

void QOpcUaMonitoringParameters:: setMaxNotificationsPerPublish ( quint32 maxNotificationsPerPublish )

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

另请参阅 maxNotificationsPerPublish ().

void QOpcUaMonitoringParameters:: setMonitoredItemId ( quint32 monitoredItemId )

Sets the monitored item id to monitoredItemId .

Setting this value as a client has no effect.

另请参阅 monitoredItemId ().

void QOpcUaMonitoringParameters:: setMonitoringMode ( QOpcUaMonitoringParameters::MonitoringMode monitoringMode )

Set monitoringMode as monitoring mode for the monitored item.

另请参阅 monitoringMode ().

void QOpcUaMonitoringParameters:: setPriority ( quint8 priority )

Set priority as priority for the subscription.

另请参阅 priority ().

void QOpcUaMonitoringParameters:: setPublishingEnabled ( bool publishingEnabled )

Set publishingEnabled as publishing mode for the subscription.

另请参阅 isPublishingEnabled ().

void QOpcUaMonitoringParameters:: setPublishingInterval ( double publishingInterval )

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

另请参阅 publishingInterval ().

void QOpcUaMonitoringParameters:: setQueueSize ( quint32 queueSize )

Request queueSize as queue size for the monitored item.

另请参阅 queueSize ().

void QOpcUaMonitoringParameters:: setSamplingInterval ( double samplingInterval )

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

另请参阅 samplingInterval ().

void QOpcUaMonitoringParameters:: setStatusCode ( QOpcUa::UaStatusCode statusCode )

Set the status code to statusCode .

另请参阅 statusCode ().

void QOpcUaMonitoringParameters:: setSubscriptionId ( quint32 subscriptionId )

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

另请参阅 subscriptionId ().

void QOpcUaMonitoringParameters:: setSubscriptionType ( QOpcUaMonitoringParameters::SubscriptionType shared )

Request shared as subscription type for the subscription.

另请参阅 subscriptionType ().

QOpcUa::UaStatusCode QOpcUaMonitoringParameters:: statusCode () const

Returns the status code of the monitored item creation.

另请参阅 setStatusCode ().

quint32 QOpcUaMonitoringParameters:: subscriptionId () const

Returns the assigned subscription id.

另请参阅 setSubscriptionId ().

QOpcUaMonitoringParameters::SubscriptionType QOpcUaMonitoringParameters:: subscriptionType () const

Returns the subscription type.

另请参阅 setSubscriptionType ().