Skip to content

Forwarded dynamic attributes implementation

Jairo Moldes requested to merge github/fork/jairomoldes/fwd-dyn-attr into tango-9-lts

Hi,

Using branch "tango-9-lts" of github cppTango I noticed that tango doesn't seem to properly manage the creation of forwarded attributes when they are dynamically created. In my opinion, there are 3 different scenarios in which forwarded attributes can be created:

1.- Static creation. This is what pogo does, for example. This seems to already be properly managed. 2.- Dynamic creation with root_attribute specified in constructor. In this case the root attribute used will be the one passed in the constructor (tango DB value, if defined, should be always ignored). 3.- Dynamic creation without root_attribute specified in constructor. In this case the root attribute will be the one defined in tango DB.

In cases 2 and 3 if root attribute is not correctly defined then the device will got to Alarm state and status will give a clue of what is wrong: all dynamic attributes will be created, but the ones with incorrect root attribute definition will throw an exception when read or written.

You can easily test the all above options using the attached TestFwd device server (ziped in "TestFwd.zip"). You will have to play with their root attribute definition (for example using jive) in order to reproduce all cases mentioned above. IT assumes that "sys/tg_test/1/double_scalar" is available. It defines 3 forwarded attributes:

  • TestFwdAttr: this is a static attribute defined using pogo (it can be used for testing case 1 above).
  • TestFwdDyn1: this is a dynamic attribute with root attribute defined in the constructor (it can be used for testing case 2 above).
  • TestFwdDyn2: this is a dynamic attribute with root attribute not defined in the constructor (it can be used for testing case 3 above).

The patch seems to work fine in my case. I propose to merge it into tango-9-lts and master or use it as a first approach for developing a better patch (I'm far from a tango core expert, so I may have introduced other bugs while trying to solve this issue).

NOTE that it also fixes a bug I found when the dynamic forwarded attributes are created (this is the patch for "multiattribute.cpp" file): it looks like the write value is not correctly initialized and you can randomly get a coredump when reading them (you may need to restart the server several times to reproduce the error).

Regards, Jairo Moldes

TestFwd.zip

Merge request reports