mirror of
https://github.com/FreeOpcUa/opcua-asyncio
synced 2025-10-29 17:07:18 +08:00
docs
This commit is contained in:
committed by
oroulet
parent
ca635d0bba
commit
b005e09d73
@@ -437,7 +437,10 @@ class UaClient:
|
||||
self._subscription_callbacks[response.Parameters.SubscriptionId] = callback
|
||||
self.logger.info("create_subscription success SubscriptionId %s", response.Parameters.SubscriptionId)
|
||||
if not self._publish_task or self._publish_task.done():
|
||||
# Start the publish cycle if it is not yet running
|
||||
# Start the publish loop if it is not yet running
|
||||
# The current strategy is to have only one open publish request per UaClient. This might not be enough
|
||||
# in high latency networks or in case many subscriptions are created. A Set of Tasks of `_publish_loop`
|
||||
# could be used if necessary.
|
||||
self._publish_task = self.loop.create_task(self._publish_loop())
|
||||
return response.Parameters
|
||||
|
||||
@@ -474,7 +477,7 @@ class UaClient:
|
||||
|
||||
async def _publish_loop(self):
|
||||
"""
|
||||
Start publish cycle that sends a publish request and waits for the publish response in an endless loop.
|
||||
Start a loop that sends a publish requests and waits for the publish responses.
|
||||
Forward the `PublishResult` to the matching `Subscription` by callback.
|
||||
"""
|
||||
ack = None
|
||||
|
||||
@@ -152,13 +152,14 @@ class Subscription:
|
||||
attr=ua.AttributeIds.Value,
|
||||
queuesize=0) -> Union[int, List[Union[int, ua.StatusCode]]]:
|
||||
"""
|
||||
Subscribe for data change events for one ore multiple nodes.
|
||||
Subscribe to data change events of one or multiple nodes.
|
||||
The default attribute used for the subscription is `Value`.
|
||||
Return value is a handle which can be used to modify/cancel the subscription.
|
||||
The handle is either an integer value for single Nodes. If the subscription failes an `UaStatusCodeError`
|
||||
will be raises.
|
||||
If multiple Nodes were supplied a List of integers or ua.StatusCode objects is returned. StatusCode objects
|
||||
are returned to indicate that the subscription has failed (no exception will be raises in this case).
|
||||
The handle is an integer value for single Nodes. If the creation of the subscription fails an
|
||||
`UaStatusCodeError` is raised.
|
||||
If multiple Nodes are supplied, a List of integers or ua.StatusCode objects is returned. A list of
|
||||
StatusCode objects are returned to indicate that the subscription has failed (no exception will be
|
||||
raised in this case).
|
||||
If more control is necessary the `create_monitored_items` method can be used directly.
|
||||
|
||||
:param nodes: One Node or an Iterable of Nodes
|
||||
|
||||
Reference in New Issue
Block a user