PdCom
5.3
Process data communication client
|
Most of the PdCom5 C++ classes are also available as Python classes. The translation is done with the help of pybind11.
Methods directly available on module level
Returns true when PdCom5 was built with SASL support.
Returns the full version code of the C++ library, including the hash of the commit and a trailing plus sign in case of uncommitted changes during the build. Example: "5.1.0.8.gea62937+".
The following classes are available in the pdcom5.PdComWrapper
module:
Process
Variable
Subscription
Subscriber
Transmission
The following exceptions (from the pdcom5.PdComWrapper
module) can be raised:
Exception
(aka PdCom::Exception
from C++), base class for all derived exceptionsInternalError
InvalidArgument
InvalidSubscription
NotConnected
ProcessGoneAway
ProtocolError
To catch them, you'll have to import them (from pdcom5.PdComWrapper import Exception as PdComException
).
Many callbacks from the PdCom5 C++ library are implemented as virtual functions. So, some classes need to be derived from. This also applies to the python classes from the pdcom5.PdComWrapper
module. Please note that the signature of the overridden virtual functions must be an exact match, so please don't do things like **kwargs
. Raising an Exception is allowed and encouraged.
The following member functions are available to the library user:
In addition, the properties name
and version
are available.
Both member functions of Variable
return a Future. The Future can take two callbacks, which receive the result resp. an exception. The first parameter of the PollFuture callback, of type VariablePollResult
, has a value
attribute.
Properties (readonly):
empty
path
name
shape
A datetime.timedelta
instance can be converted to a Transmission. For event and poll mode, please use the static properties event_mode
and poll_mode
.
The Subscriber class needs to be derived from, as shown above. Its constructor takes a Transmission instance as parameter. This transmission instance is later available as property.
The Subscription class has three overloaded constructors:
str
)Furthermore, it has a cancel()
member and the following properties:
variable
(can be None
)value
(NumPy Array)state
(See the State
enum)The State
static class member is an enum with the following values:
Pending
Active
Invalid
Properties:
name
application_name
received_bytes
sent_bytes
connected_time
(datetime.timedelta instance)Make sure that the function signature of the python class is right (especially the return type).