reading tango version of a server

From Astor/Stater it is possible to get the tango library version of servers.
How can it be done in client program?
Thanks
Hi Claudio

In java API the code is quite simple: on a DeviceProxy on admin device a method getTangoVersion() exists.
In C++ it seems that the same method exists named get_tango_lib_version()

It is easy since Tango 9.
The command ZmqEventSubscriptionChange on admin device, with "info" as input argument, returns a DevVarLongStringArray.
In long array[0], you can find the library number multiplied by 100 (i.e. 933 for Tango-9.3.3)

Before Tango 9, it is more tricky. It is mix between IDL and if commands are implemented or not.

Pascal
Hi Tango dancers!

I was trying it with PyTango:


In [1]: import tango

In [2]: print(tango.utils.info())
PyTango 9.3.6 (9, 3, 6)
PyTango compiled with:
Python : 3.10.6
Numpy : 1.23.3
Tango : 9.3.5
Boost : 1.74.0

PyTango runtime is:
Python : 3.10.6
Numpy : 1.23.4
Tango : 9.3.6

PyTango running on:
uname_result(system='Linux', node='pt222', release='5.10.0-21-amd64', version='#1 SMP Debian 5.10.162-1 (2023-01-21)', machine='x86_64')
In [3]: d = tango.DeviceProxy("motor/motctrl01/1")

In [4]: d.get_tango_lib_version()
Out[4]: 902

In [5]: adm = tango.DeviceProxy(d.adm_name())

In [7]: adm.EventSubscriptionChange([d.name(), "state", "foo", "foo"])
Out[7]: 936


My server runs with Tango 9.3.6. Why do I get a different value between the get_tango_lib_version() and the cmd_out of the EventSubscriptionChange() command. Which one should I use?

Cheers!
Hi Zbigniew

For the DeviceProxy.get_tango_lib_version() method, PyTango is just passing the call to cppTango. I see that the cppTango method is doing a check based on the IDL version and the list of commands on the admin device. Interesting, that 902 was chosen as the number for IDLv5.
https://gitlab.com/tango-controls/cppTango/-/blob/9.3.6/cppapi/client/devapi_base.cpp#L10267

It looks like the EventSubscriptionChange command, is using Util::get_tango_lib_release() which calls _convert_tango_lib_release(). That method actually used the right macros for the version number.
https://gitlab.com/tango-controls/cppTango/-/blob/9.3.6/cppapi/server/utils.cpp#L3287-3293

Maybe the cppTango devs can update the DeviceProxy.get_tango_lib_version() method to make an additional call to EventSubscriptionChange, if available? You could create and issue on the cppTango gitlab repo for that.

(I was surprised to see that EventSubscriptionChange() returns the version number!)

/Anton
Many thanks Anton for your investigation and answer. For the moment we use EventSubscriptionChange() command. We will create an issue in cppTango project.
 
Register or login to create to post a reply.