dynamic attribute with same name but different type

4 views
Skip to first unread message

Jan Meyer

unread,
Nov 23, 2016, 5:11:02 AM11/23/16
to ta...@esrf.fr
Dear all,

this is a question of the category best practice. I wrote a DS for the
GalilDMC controllers. This devices come with digital and analogue
IO-ports. The exact types and numbers depend on the ordered device
configuration.

The DS consists of three DS subclasses: GalilDMCControl, GalilDMCMotor
and GalilDMCPort. Control provides the connection to the controller.
Motor provides all possible kinds of motor axes (servo, stepper, ...).
They are chosen via a property and bring a lot of dynamic attributes,
needed for this exact motor type.

Now I implemented the Port DS in the same style: One DS wich has the
dynamic attribute Value. The type of the port is chosen via a property,
the type of the attribute changes accordingly. This works, but only as
long as you use the same port type for all Tango devices of that class.
As soon as you add a digital input to some existing outputs you will
receive the following error on start up:

Tango exception
Severity = ERROR
Error reason = API_AttrNotFound
Desc : Device p11/register/eh.6.i.09 -> Attribute Value already exists
for your device class but with other definition
(data type, data format or data write type)
Origin : Device_Impl::add_attribute

Received a CORBA_Exception
Exiting

Now this makes kind of sense. An attribute definition in the data base
is unique. I simply haven't thought about this before. But how to
rewrite the server now? Is there a more elegant way then to make it four
servers, one for each type?

Best,
Jan


--
---------------------------------------------
Jan Meyer
Beamline Support P11

Deutsches Elektronen-Synchrotron
Notkestr. 85
47c / L136
22607 Hamburg
Germany

phone: +49-40-8998-5773
e-mail: jan....@desy.de
--------------------------------------------
message-footer.txt

Teresa Nunez

unread,
Nov 23, 2016, 6:32:47 AM11/23/16
to ta...@esrf.fr
Hello Jan,
I would simply use always the same type for the
Tango Attribute (whatever
it covers all the types you need without casting significant digits).
If for some reason you
want to have it in you client with the specific type of the Port, just
cast it in you client
based on the value of a property. I think this is the easiest way.

Regards,
Teresa
message-footer.txt
Reply all
Reply to author
Forward
0 new messages