QOpcUaMonitoringParameters provides a way to set and retrieve parameters for subscriptions and monitored items. 更多...
头: | #include <QOpcUaMonitoringParameters> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS OpcUa)
target_link_libraries(mytarget PRIVATE Qt6::OpcUa) |
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 () | |
QOpcUaMonitoringParameters (double publishingInterval , QOpcUaMonitoringParameters::SubscriptionType shared = SubscriptionType::Shared, quint32 subscriptionId = 0) | |
QOpcUaMonitoringParameters (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 |
QOpcUaMonitoringParameters & | operator= (const QOpcUaMonitoringParameters & other ) |
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 |
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. |
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.
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 |
The default constructor for QOpcUaMonitoringParameters.
This is the constructor which covers most use cases for the Qt OPC UA user. publishingInterval must be supplied, shared and subscriptionId are optional.
Constructs a QOpcuaMonitoringParameters object from the value of other .
The destructor for QOpcUaMonitoringParameters .
Removes the current filter from the monitoring parameters.
另请参阅 filter () 和 setFilter ().
Removes the current filter result from the monitoring parameters.
另请参阅 filterResult () 和 setFilterResult ().
Returns the discardOldest setting of the monitored item.
另请参阅 setDiscardOldest ().
Returns the current filter.
另请参阅 setFilter ().
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 ().
Returns the index range for the monitored item.
另请参阅 setIndexRange ().
Returns the publishing mode for the subscription.
Returns the lifetime count of the subscription.
另请参阅 setLifetimeCount ().
Returns the maximum keepalive count of the subscription.
另请参阅 setMaxKeepAliveCount ().
Returns the maximum notifications per publish value of the subscription.
另请参阅 setMaxNotificationsPerPublish ().
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 ().
Returns the monitoring mode for the monitored item.
另请参阅 setMonitoringMode ().
Returns the priority of the subscription used for the monitored item.
另请参阅 setPriority ().
Returns the publishing interval of the subscription. The interval is expressed in milliseconds.
另请参阅 setPublishingInterval ().
Returns the queue size of the monitored item.
另请参阅 setQueueSize ().
Returns the revised sampling interval of the monitored item. The interval is expressed in milliseconds.
另请参阅 setSamplingInterval ().
Set discardOldest as discardOldest setting for the monitored item.
另请参阅 discardOldest ().
设置 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 ().
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 ().
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 ().
Requests indexRange as index range for the monitored item. For details on the index range string, see QOpcUaNode::readAttributeRange ().
另请参阅 indexRange ().
Request lifetimeCount as lifetime count for the subscription.
另请参阅 lifetimeCount ().
Request maxKeepAliveCount as maximum keepalive count for the subscription.
另请参阅 maxKeepAliveCount ().
Set maxNotificationsPerPublish as maximum notifications per publish value for the subscription.
另请参阅 maxNotificationsPerPublish ().
Sets the monitored item id to monitoredItemId .
Setting this value as a client has no effect.
另请参阅 monitoredItemId ().
Set monitoringMode as monitoring mode for the monitored item.
另请参阅 monitoringMode ().
Set priority as priority for the subscription.
另请参阅 priority ().
Set publishingEnabled as publishing mode for the subscription.
另请参阅 isPublishingEnabled ().
Request publishingInterval as publishing interval for the subscription. The interval is expressed in milliseconds.
另请参阅 publishingInterval ().
Request queueSize as queue size for the monitored item.
另请参阅 queueSize ().
Request samplingInterval as sampling interval for the monitored item. The interval is expressed in milliseconds.
另请参阅 samplingInterval ().
Set the status code to statusCode .
另请参阅 statusCode ().
Request the monitored items to be created on a known subscription with subscriptionId .
另请参阅 subscriptionId ().
Request shared as subscription type for the subscription.
另请参阅 subscriptionType ().
Returns the status code of the monitored item creation.
另请参阅 setStatusCode ().
Returns the assigned subscription id.
另请参阅 setSubscriptionId ().
Returns the subscription type.
另请参阅 setSubscriptionType ().
Assigns the value of other 到此对象。