MonitoredItem¶
Canonical path: o6.subscription.MonitoredItem
Root shortcut: o6.MonitoredItem
MonitoredItem
¶
One monitored item inside a Subscription.
Created by Client.monitor(...), or by
Server.createDataChangeMonitoredItem(...) and its event counterparts for a
server-local item, rather than directly. An item is falsy once deleted, and
every operation on a deleted item raises RuntimeError.
Awaiting the item resolves it, which is what lets await client.monitor(...)
return an item whose id the server has already assigned.
Attributes¶
DataChangeCallback
class-attribute
instance-attribute
¶
EventCallback
class-attribute
instance-attribute
¶
CreatedCallback
class-attribute
instance-attribute
¶
DeletedCallback
class-attribute
instance-attribute
¶
itemToMonitor
property
¶
What is being monitored: node, attribute, index range, and encoding.
A copy, so the item's own state cannot be mutated behind the client's back.
params
property
¶
The sampling parameters in force, as revised by the server.
A copy, so the item's own state cannot be mutated behind the client's back.
Functions¶
__init__
¶
Create an item handle. Use Client.monitor or the server's
createDataChangeMonitoredItem family instead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subscription
|
Subscription | None
|
The client subscription this item belongs to. |
None
|
server
|
Server | None
|
The server that owns the item, for a server-side item. |
None
|
monitoredItemId
|
int | None
|
An existing server-assigned item id to wrap. |
None
|
delete
¶
Delete this monitored item on the server.
Deleting an item that is already gone logs a warning instead of raising, so cleanup paths can run unconditionally.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
The owning client or server has been garbage-collected. |
StatusCodeError
|
The DeleteMonitoredItems service call failed. |
modify
¶
Change this item's sampling parameters on the server.
Omitted arguments keep their current value. The server may revise the
sampling interval and queue size, and the revised values are stored back,
so params reports what was
actually granted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
samplingInterval
|
float | None
|
Requested sampling interval in milliseconds. |
None
|
queueSize
|
int | None
|
Requested notification queue depth. |
None
|
discardOldest
|
bool | None
|
Drop the oldest queued notification when the queue is full, rather than the newest. |
None
|
filter
|
DataChangeFilter | EventFilter | str | None
|
A |
None
|
Raises:
| Type | Description |
|---|---|
TypeError
|
The filter kind does not match the item kind, or a string filter was passed for a data-change item. |
RuntimeError
|
The item has been deleted. |
StatusCodeError
|
The ModifyMonitoredItems service call failed. |
setMonitoringMode
¶
Set whether this item samples and reports.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mode
|
MonitoringMode
|
|
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
The item has been deleted. |
StatusCodeError
|
The SetMonitoringMode service call failed. |
setTriggering
¶
Link other items so they report whenever this item reports.
A triggering link lets a rarely-changing item pull others along: the
linked items report together with this one even while they are only
SAMPLING.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
linksToAdd
|
list[MonitoredItem] | None
|
Items to start reporting alongside this one. |
None
|
linksToRemove
|
list[MonitoredItem] | None
|
Items to unlink. |
None
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
The item has been deleted. |
StatusCodeError
|
The SetTriggering service call failed, or the server rejected one of the links. |