etm.wccoa.manager
etm.wccoa.manager — WinCC OA Manager.
Usage:
from etm.wccoa.manager import Manager
with Manager() as mgr:
value = mgr.dp_get("ExampleDP_Arg1.")
mgr.dp_set("ExampleDP_Arg1.", 42)
Package Contents
Classes
Manager
|
WinCC OA Manager (Singleton). |
|---|---|
API
class etm.wccoa.manager.Manager
Bases: etm.wccoa.services.protocols.OaScriptingApi
WinCC OA Manager (Singleton).
Only one instance can exist at a time.
Repeated instantiation returns the same object.
Calling stop() resets the singleton so a new instance can be created,
but it cannot be started again in the same process.
Used as a context manager, with Manager() as manager: calls start() on entry and stop() on exit.
Initialization
start() → None
Connect to WinCC OA and start the manager.
Blocks until the connection to the Event and Data manager is established.
-
Raises:
- RuntimeError – If a manager was already started in this process, even if it has been stopped since.
stop() → None
Stop the manager and disconnect from WinCC OA.
Safe to call more than once and from any thread,
for example from a callback or a threading.Timer to end wait().
wait(timeout: float | None = None) → bool
Block until the manager is stopped.
A manager that only subscribes to data has nothing left to do once the subscription is placed, yet it must stay alive to receive the callbacks. This is what keeps it running:
with Manager() as manager:
manager.dp_connect(on_change, ["ExampleDP_Arg1."])
manager.wait()
The manager is stopped by SIGINT or SIGTERM, or by stop() called from a callback or from another thread.
A signal raises SystemExit here after the manager has been stopped.
-
Parameters:
- timeout – Seconds to wait at most, or None to wait forever.
- Returns: True if the manager was stopped, False if timeout elapsed first.
