PySide6.QtOpcUa.QOpcUaMonitoringParameters¶
- class QOpcUaMonitoringParameters¶
QOpcUaMonitoringParameters提供了一种设置和检索订阅和监控项参数的方法。More_…概要¶
方法¶
def
__init__()def
clearFilter()def
discardOldest()def
filter()def
filterResult()def
indexRange()def
lifetimeCount()def
monitoringMode()def
priority()def
queueSize()def
setFilter()def
setIndexRange()def
setPriority()def
setQueueSize()def
setStatusCode()def
statusCode()def
subscriptionId()
注意
本文档可能包含从C++自动翻译到Python的代码片段。我们始终欢迎对代码片段翻译的贡献。如果您发现翻译问题,您也可以通过在我们的https:/bugreports.qt.io/projects/PYSIDE上创建工单来告知我们。
详细描述¶
此类用于
enableMonitoring()请求,并作为monitoringStatus()的返回值,在这种情况下,它包含来自服务器的修订值。用法¶
对于大多数用例,只需要发布间隔。
QOpcUaMonitoringParameters p(100); // Set a publishing interval of 100ms and share the subscription. node->enableMonitoring(QOpcUa::NodeAttribute::Value, p);
如果需要
exclusive订阅,请使用第二个参数。QOpcUaMonitoringParameters p(100, QOpcUaMonitoringParameters::SubscriptionType::Exclusive); // Create a new subscription
要向现有订阅添加额外项目,请在下次调用
enableMonitoring()时使用第三个参数。quint32 subscriptionId = node->monitoringStatus(QOpcUa::NodeAttribute::Value).subscriptionId(); QOpcUaMonitoringParameters p(100, QOpcUaMonitoringParameters::SubscriptionType::Shared, subscriptionId); // Add the monitored item to this subscription
如果需要其他参数,必须使用setter方法进行设置。
- class MonitoringMode¶
此枚举用于设置被监控项的监控模式。
常量
描述
QOpcUaMonitoringParameters.MonitoringMode.Disabled
采样已禁用,不会生成任何通知。
QOpcUaMonitoringParameters.MonitoringMode.Sampling
启用了采样并生成和排队通知,但禁用了报告。
QOpcUaMonitoringParameters.MonitoringMode.Reporting
采样已启用,生成并排队通知,报告已启用。
- class SubscriptionType¶
此枚举用于确定是否可以将监控项添加到共享订阅中,或者是否必须创建新的订阅。
常量
描述
QOpcUaMonitoringParameters.SubscriptionType.Shared
与其他具有相同间隔的监控项共享订阅
QOpcUaMonitoringParameters.SubscriptionType.Exclusive
为此属性请求一个新的订阅
- class Parameter¶
(继承自
enum.Flag) 枚举可以在运行时使用modifyMonitoring()修改的参数。并非所有插件都保证支持所有值。不支持的情况将在monitoringStatusChanged信号中报告。常量
描述
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__()¶
QOpcUaMonitoringParameters的默认构造函数。- __init__(other)
- Parameters:
从
other的值构造一个QOpcuaMonitoringParameters对象。- __init__(publishingInterval[, subscriptionType=QOpcUaMonitoringParameters.SubscriptionType.Shared[, subscriptionId=0]])
- Parameters:
publishingInterval – 浮点数
subscriptionType –
SubscriptionTypesubscriptionId – int
这是覆盖大多数Qt OPC UA用户使用场景的构造函数。
publishingInterval必须提供,shared和subscriptionId是可选的。- clearFilter()¶
从监控参数中移除当前过滤器。
另请参阅
- clearFilterResult()¶
从监控参数中移除当前的过滤结果。
- discardOldest()¶
- Return type:
布尔
返回被监控项的discardOldest设置。
另请参阅
- failedTriggeredItemsStatus()¶
- Return type:
字典的键类型为 .quint32,值类型为 QOpcUa.UaStatusCode。
返回所有未能成功添加的触发项的状态代码,这些触发项来自
setTriggeredItemIds()。- filter()¶
- Return type:
对象
返回当前的过滤器。
另请参阅
- filterResult()¶
- Return type:
对象
返回过滤结果。
对于属性监控,此值为空。在事件监控的情况下,如果服务器在过滤器中未检测到任何错误,则过滤结果可能为空。
另请参阅
- indexRange()¶
- Return type:
字符串
返回监控项的索引范围。
另请参阅
- isPublishingEnabled()¶
- Return type:
布尔
返回订阅的发布模式。
- lifetimeCount()¶
- Return type:
整数
返回订阅的终身计数。
另请参阅
- maxKeepAliveCount()¶
- Return type:
整数
返回订阅的最大保持活动计数。
- maxNotificationsPerPublish()¶
- Return type:
整数
返回订阅的每次发布的最大通知数。
- monitoredItemId()¶
- Return type:
整数
返回由服务器分配的监控项ID。如果监控项ID为0,则表示无法成功创建监控项。
另请参阅
- monitoringMode()¶
- Return type:
返回被监控项的监控模式。
另请参阅
- priority()¶
- Return type:
整数
返回用于监控项的订阅的优先级。
另请参阅
- publishingInterval()¶
- Return type:
浮点数
返回订阅的发布间隔。该间隔以毫秒表示。
- queueSize()¶
- Return type:
整数
返回监控项的队列大小。
另请参阅
- samplingInterval()¶
- Return type:
浮点数
返回监控项的修订采样间隔。该间隔以毫秒表示。
- setDiscardOldest(discardOldest)¶
- Parameters:
discardOldest – 布尔值
将
discardOldest设置为监控项的discardOldest设置。另请参阅
- setFailedTriggeredItemsStatus(status)¶
- Parameters:
status – 字典,键类型为 .quint32,值类型为 QOpcUa.UaStatusCode。
设置所有无法成功添加到
status的触发项的状态代码。作为客户端设置此值无效。- setFilter(filter)¶
- Parameters:
过滤器 –
DataChangeFilter
将
DataChangeFilterfilter设置为监控项的过滤器。如果存在另一个数据更改过滤器或事件过滤器,它将被替换。如果服务器不接受过滤器,这将在
enableMonitoring()请求完成后通过状态码指示。另请参阅
- setFilter(eventFilter)
- Parameters:
eventFilter –
EventFilter
请求
eventFilter作为监控项的过滤器。如果存在另一个事件过滤器或数据更改过滤器,它将被替换。如果服务器不接受该过滤器,这将在enableMonitoring()请求完成后通过状态码和事件过滤器结果来指示。另请参阅
- setFilterResult(eventFilterResult)¶
- Parameters:
eventFilterResult –
QOpcUaEventFilterResult
将事件过滤器结果设置为
eventFilterResult。此方法只能由后端使用,设置事件过滤结果对用户没有任何影响。
另请参阅
- setIndexRange(indexRange)¶
- Parameters:
indexRange – str
请求
indexRange作为监控项的索引范围。有关索引范围字符串的详细信息,请参阅readAttributeRange()。另请参阅
- setLifetimeCount(lifetimeCount)¶
- Parameters:
lifetimeCount – int
请求
lifetimeCount作为订阅的终身计数。另请参阅
- setMaxKeepAliveCount(maxKeepAliveCount)¶
- Parameters:
maxKeepAliveCount – int
请求
maxKeepAliveCount作为订阅的最大保持活动计数。另请参阅
- setMaxNotificationsPerPublish(maxNotificationsPerPublish)¶
- Parameters:
maxNotificationsPerPublish – int
将
maxNotificationsPerPublish设置为订阅的每次发布的最大通知数。- setMonitoredItemId(monitoredItemId)¶
- Parameters:
monitoredItemId – int
将监控项ID设置为
monitoredItemId。将此值设置为客户端无效。
另请参阅
- setMonitoringMode(monitoringMode)¶
- Parameters:
monitoringMode –
MonitoringMode
将
monitoringMode设置为监控项的监控模式。另请参阅
- setPriority(priority)¶
- Parameters:
priority – int
将
priority设置为订阅的优先级。另请参阅
- setPublishingEnabled(publishingEnabled)¶
- Parameters:
publishingEnabled – 布尔值
将
publishingEnabled设置为订阅的发布模式。- setPublishingInterval(publishingInterval)¶
- Parameters:
publishingInterval – 浮点数
请求
publishingInterval作为订阅的发布间隔。该间隔以毫秒表示。另请参阅
- setQueueSize(queueSize)¶
- Parameters:
queueSize – int
请求
queueSize作为监控项的队列大小。另请参阅
- setSamplingInterval(samplingInterval)¶
- Parameters:
samplingInterval – 浮点数
请求
samplingInterval作为监控项的采样间隔。该间隔以毫秒表示。另请参阅
- setStatusCode(statusCode)¶
- Parameters:
statusCode –
UaStatusCode
将状态码设置为
statusCode。另请参阅
- setSubscriptionId(subscriptionId)¶
- Parameters:
subscriptionId – int
请求在已知订阅上创建监控项,订阅ID为
subscriptionId。另请参阅
- setSubscriptionType(subscriptionType)¶
- Parameters:
subscriptionType –
SubscriptionType
请求
shared作为订阅的订阅类型。另请参阅
- setTriggeredItemIds(id)¶
- Parameters:
id – .QSetquint32
按照OPC UA 1.05, 5.12.1.6的描述,向
ids中的所有监控项添加触发链接。ids中的值必须是同一订阅中其他监控项的监控项ID。如果这些项的监控模式设置为采样,则每当此监控检测到数据更改时,它们的数据更改通知将传递给客户端。任何无法添加的ID将不会包含在监控状态中,而是会显示在
failedTriggeredItemsStatus()中。将此设置修改为空集将移除所有触发链接。
另请参阅
- statusCode()¶
- Return type:
返回受监控项目创建的状态代码。
另请参阅
- subscriptionId()¶
- Return type:
整数
返回分配的订阅ID。
另请参阅
- subscriptionType()¶
- Return type:
返回订阅类型。
- triggeredItemIds()¶
- Return type:
.QSetquint32
返回由此监控项触发的监控项的ID。
- class EventFilter¶
为监控项定义一个
EventFilter。More_…概要¶
方法¶
def
__init__()def
__lshift__()def
__eq__()def
selectClauses()def
setWhereClause()def
whereClause()def
whereClauseRef()
注意
本文档可能包含从C++自动翻译到Python的代码片段。我们始终欢迎对代码片段翻译的贡献。如果您发现翻译问题,您也可以通过在我们的https:/bugreports.qt.io/projects/PYSIDE上创建工单来告知我们。
详细描述¶
需要一个事件过滤器来监控服务器上的事件。它由
select子句和一个where子句组成。select子句用于指定用户在事件发生时希望接收的数据。它由QOpcUaSimpleAttributeOperand简单属性操作数组成,这些操作数选择事件类型的子节点的属性,例如 BaseEventType 的“Message”属性的值属性。where子句用于通过匹配某些条件来限制报告的事件。多个运算符和四种不同的操作数类型允许根据事件类型的子节点属性值进行过滤。过滤器可以使用设置器或流操作符来构建。将
QOpcUaSimpleAttributeOperand流式传输到事件过滤器中会向过滤器添加一个新的select子句,QOpcUaContentFilterElement会被附加到where子句中。内容过滤元素可以通过将QOpcUaLiteralOperand、QOpcUaElementOperand、QOpcUaAttributeOperand和QOpcUaSimpleAttributeOperand类型的操作符流式传输到内容过滤元素中来构建。只有最后一个操作符会被使用,之前的操作符将被丢弃。以下
EventFilter告诉服务器报告那些“Severity”字段值大于等于500的事件的“Message”字段值: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
有关包含两个条件的更复杂示例,请参见
QOpcUaElementOperand。- __init__()¶
- __init__(rhs)
- Parameters:
rhs –
EventFilter
从
rhs构造一个事件过滤器。- __lshift__(whereClauseElement)¶
- Parameters:
whereClauseElement –
QOpcUaContentFilterElement- Return type:
将内容过滤器元素
whereClauseElement添加到此事件过滤器的 where 子句中。- __lshift__(selectClauseElement)
- Parameters:
selectClauseElement –
QOpcUaSimpleAttributeOperand- Return type:
将简单属性操作数
selectClauseElement添加到此内容筛选器元素的 select 子句中。- __eq__(rhs)¶
- Parameters:
rhs –
EventFilter- Return type:
布尔
如果此事件过滤器与
rhs具有相同的值,则返回true。- selectClauses()¶
- Return type:
.list of QOpcUaSimpleAttributeOperand
返回在报告新事件时应包含的选定事件字段。
另请参阅
- selectClausesRef()¶
- Return type:
.list of QOpcUaSimpleAttributeOperand
返回对选择子句的引用。
- setSelectClauses(selectClauses)¶
- Parameters:
selectClauses – QOpcUaSimpleAttributeOperand 的列表
将选择子句设置为
selectClauses。另请参阅
- setWhereClause(whereClause)¶
- Parameters:
whereClause – QOpcUaContentFilterElement 的列表
设置where子句为
whereClause。另请参阅
- whereClause()¶
- Return type:
返回用于将报告的事件限制为符合特定条件的事件的内容过滤器。
另请参阅
- whereClauseRef()¶
- Return type:
返回对where子句的引用。
另请参阅
- class DataChangeFilter¶
为监控项定义一个
DataChangeFilter。More_…概要¶
方法¶
def
__init__()def
deadbandType()def
deadbandValue()def
__eq__()def
setTrigger()def
trigger()
注意
本文档可能包含从C++自动翻译到Python的代码片段。我们始终欢迎对代码片段翻译的贡献。如果您发现翻译问题,您也可以通过在我们的https:/bugreports.qt.io/projects/PYSIDE上创建工单来告知我们。
详细描述¶
此类用于为数据更改监控项设置过滤。它在OPC UA 1.05第4部分7.22.2中定义。
- class DataChangeTrigger¶
枚举了
DataChangeFilter可能的触发器。常量
描述
QOpcUaMonitoringParameters.DataChangeFilter.DataChangeTrigger.Status
如果值的状态码发生变化,则触发。
QOpcUaMonitoringParameters.DataChangeFilter.DataChangeTrigger.StatusOrValue
如果值的状态码或值本身发生变化,则触发。
QOpcUaMonitoringParameters.DataChangeFilter.DataChangeTrigger.StatusOrValueOrTimestamp
如果值的状态码、值本身或源时间戳发生变化,则触发。
- class DeadbandType¶
列举了
DataChangeFilter可能的死区类型。常量
描述
QOpcUaMonitoringParameters.DataChangeFilter.DeadbandType.None
无死区过滤。
QOpcUaMonitoringParameters.DataChangeFilter.DeadbandType.Absolute
如果上次缓存值与当前值之间的差异的绝对值大于死区值,则生成通知。
QOpcUaMonitoringParameters.DataChangeFilter.DeadbandType.Percent
仅对具有EURange属性的AnalogItems有效。如果上次缓存值与当前值之间的差异的绝对值大于EURange的百分比值,则会生成通知。
- __init__()¶
构建一个数据变化过滤器,触发条件为
status,死区类型为none,且deadbandValue为0。- __init__(rhs)
- Parameters:
rhs –
DataChangeFilter
从
rhs构建数据更改过滤器。- __init__(trigger, deadbandType, deadbandValue)
- Parameters:
trigger –
DataChangeTriggerdeadbandType –
DeadbandTypedeadbandValue – 浮点数
使用触发器
trigger、死区类型deadbandType和死区值deadbandValue构建数据变化过滤器。- deadbandType()¶
- Return type:
返回死区类型。
另请参阅
- deadbandValue()¶
- Return type:
浮点数
返回死区值。
另请参阅
- __eq__(rhs)¶
- Parameters:
rhs –
DataChangeFilter- Return type:
布尔
如果此数据更改过滤器与
rhs具有相同的值,则返回true。- setDeadbandType(deadbandType)¶
- Parameters:
deadbandType –
DeadbandType
将死区类型设置为
deadbandType。另请参阅
- setDeadbandValue(deadbandValue)¶
- Parameters:
deadbandValue – 浮点数
将死区值设置为
deadbandValue。另请参阅
- setTrigger(trigger)¶
- Parameters:
触发器 –
DataChangeTrigger
将触发器设置为
trigger。另请参阅
- trigger()¶
- Return type:
返回触发器。
另请参阅