DevEnum atttribute enum labels

Hi,

I am trying to get the device attribute's enum labels list. At the moment I am using the DeviceProxy object to query the device for the attribute configuration, however I wanted to know if there is a way to get them through the device object.

So far I have tried using:
self.get_device_attr()
and
self.get_attribute_config()
however none of the returned objects have the property enum_labels.

Kind regards,
Katleho
Edited 6 years ago
Hi Katleho,

Sorry for answering in C++, but since PyTango is based on the Tango C++ library, this might still help you.
In C++, in a device server, you can get the enum labels from a MultiAttrProp object, using Attribute::get_properties(MultiAttrProp<T>&) method.

Here is a sample code:
Tango::MultiAttrProp<Tango::DevEnum> multi_attr_prop;
get_device_attr()->get_attr_by_name("Color").get_properties(multi_attr_prop);
cout << "Labels for Color DevEnum attribute:" << endl;
for(string l:multi_attr_prop.enum_labels)
{
    cout << "- " << l << endl;
}

Maybe the pyTango experts could guide you better after this hint smile
Hoping this helps,
Reynald

PS: Special thanks to Emmanuel Taurel for his help on this topic.
Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new.
 
Register or login to create to post a reply.