The low-level API allows adding a C++ class via the add_class() method, and the high-level API requires using run() which does not support this feature.
Could you please confirm for me that it is indeed impossible to have a multi-class python server that loads both HL python class and C++ class (shared lib)?
And in case of impossibility, could you tell me if it is planned that this functionality be added?
I think it might be possible to mix C++ classes with high-level API devices. You will have to use the tango.Util class directly. This is a singleton, so if we use add_class before calling tango.server.run, then it should see all the classes. The tango.server.run function is adding the Python classes internally.
Based on the example here:
(note: the example above has a typo on line 5 - it should be “util =”, not “py =”.)
import sys
import tango
from tango.server import run
from IRMirror import IRMirror
from PLC import PLC
if __name__ == '__main__':
util = tango.Util(sys.argv)
util.add_class('SerialLine', 'SerialLine', language="c++")
# run device server with SerialLine, PLC and IRMirror:
run([PLC, IRMirror])
There is also a dict form that can be passed to run for more complicated settings, but this still doesn’t allow a C++ class to be specified. It may be useful to extend the dict-form to suit your use case.
Please let me know if the suggested code works or fails.