I have a technical question that I hope you can answer.
Let us assume I have a python class (e.g. DriverHelper) that is interfacing with a C++ library (a sort of device driver) that is interfacing directly with a hardware device.
The python class sort of hooks into the functionality of the device. I now want to create a python Tango device that wraps around some of the functionality of this python class, with Tango-specific attributes and commands etc.
Is it possible, inside my Tango device, to instantiate an object of the DriverHelper class and pass on attribute values/commands to it, whilst making sure that the state of the DriverHelper persists with the Tango device? It seems that on different Tango command calls, the state of the object DriverHelper is not being kept.
Thanks. It may be my problem is implementation then. There’s a lot of code so I’ll try to put in salient parts.
In my Tango device server, when I start the device, I can run a command like:
def init_device(self):
self.debug_stream("In init_device()")
self.get_device_properties(self.get_device_class())
#----- PROTECTED REGION ID(TPM_DS.init_device) ENABLED START -----#
self.info_stream("Starting device initialization...")
self.set_state(PyTango.DevState.INIT)
self.tpm_instance = TPM(ip="127.0.0.1", port=10000)
self.info_stream("Device has been initialized.")
#----- PROTECTED REGION END -----# // TPM_DS.init_device
TPM is a python helper class (not a Tango device server). I can see the device server passes this command successfully and the communication (tpm_instance) is established.
Later on, a Tango client calls a command in my device e.g.
“Device” is an enumerated type, and Filepath is an XML file the helper class requires. The helper class method tpm_instance.loadFirmwareBlocking() is indeed called. However the attributes of tpm_instance (set internally when previously starting up the object during INIT) seem to be of another instance of tpm_instance i.e. the original tpm_instance object seems to have not persisted.