PdCom
5.3
Process data communication client
|
The PdCom library provides a flexible C++ API for non-realtime exchange of process data and is part of the EtherLab project. Python bindings are also available.
The library relies heavily on C++'s subclassing where virtual methods are reimplemented to communicate with the implementation.
The library is absolutely free of system calls, most notably read()
, write()
and flush()
. These are pure virtual methods that must be implemented to send and receive data from the server process.
The library does not provide authentication itself, but provides methods to support its implementation. The server performs authentication negotiation using to the SASL standard.
Other than libexpat, the library has no other dependencies.
Due to the fact that the library does not require system calls, it can easily be used on platforms other than Linux.
A POSIX implementation for the abstract read(), write() and flush() is provided, also a default (network implementation unaware) TLS provider. The SimpleLoginManager is an easy-to-use wrapper for the Cyrus SASL library.
The PdCom library is released under the terms and conditions of the GNU Lesser General Public License (LGPL), version 3 or (at your option) any later version.
The library provides an abstraction layer for process data communication protocols together with implementations for these protocols. The protocols currently implemented are:
Other protocols can be easily added.
The basic approach to using the library is to subclass PdCom::Process and reimplement at least read(), write() and flush(). Then initiate the (network) communication channel to the server. Whenever data arrives from the server, call asyncData() which in turn calls read() to fetch the data.
Whenever data needs to be transferred to the server, the library calls write() excessively. The communication channel buffer only needs to be send upon reception of flush().
Process provices methods to obtain information about the process as well as discovering the variable tree.
To be able to receive variable values or change parameters, you need to subclass and instantiate an instance PdCom::Subscriber and reimplement its pure virtual methods.
Have a look at the class documentation to get more information. An example is located in the example directory.
The default POSIX Process implementation is called PdCom::PosixProcess, the TLS-enabled Process is called PdCom::SecureProcess. They can be used in case no framework (e.g. Qt) is available. PdCom::SimpleLoginManager makes authentification with SASL a lot easier.
One important thing: Make sure that every PdCom::Subscriber instance lives longer than its Subscriptions. When a Subscription is destructed (or moved from), the Subscriber will be accessed. So, do not delete a Subscriber until every Subscription has gone.
CMake modules are provided, too. Use the following to link your application against pdcom:
There is a Qt-based widget library named QtPdWidgets, providing process data visualisation and control widgets, that is based on PdCom.