dynamic attributes with external devices

Reynald
At first sight, I don't expect any issue with the behavior you described.
You just have to know how you will deal with errors.
If D/E/F is not reachable for a while, you will receive error events. You have to think about how you will deal with these errors.
Yeah, I discovered this following the links to issue on this topic yesterday, thank you for this precision, it will be useful to be conscious of awaited problems with this solution.

Reynald
It looks like what you want is getting the history of the last A/B/C/bufferSize values of D/E/F/externalAttribute.
You know you could also get that by reading D/E/F/externalAttribute history from D/E/F polling buffer history if D/E/F/externalAttribute is polled.
You can tune the poll ring depth property to configure the size of the polling buffer history.
You will get a timestamp associated with each value in the polling buffer history.

If you subscribe to change events, you will receive events only when the values will change (depending on your event settings).
You just have to configure the system for what you want to achieve.

If you keep the idea of creating A/B/C/Buffer attribute, you could initialize it by reading D/E/F/externalAttribute polling buffer history. That way, if A/B/C is restarted, it will retrieve the history and fill up the buffer immediately with the latest values. In this case, depending on how the polling buffer is filled, the polling buffer history might contain consecutive values having the same values.
Yes, it helps a lot. smile
I'm not sure adjusting the buffer size to big values will be possible without performance tradeoffs on libera hardware, which is why I though about a 2d device with independant buffer.
But perhaps this solution is possible, we will keep this in mind to check.
- Philippe
Hi,

to resume about dynamic attributes use, the way i understand it allows to get a set of unknown values through device properties during 'Init' command.
Following this way, I should be able, in a device server, to :

1. use a 'dynAttrList' property containing for example the list "A/B/C/attr1, A/B/C/attr2, D/E/F/attr1"

2. with this property, create 3 dynamic attributes to store last value of respectively A/B/C/attr1, A/B/C/attr2, and D/E/F/attr1
Then I would use following method to create these dynamic attributes:

void DynAttr :: add_dynamic_attributes()
{
    for (unsigned int i = 0; i <dynAttrList.size (); i = i + 1)
    {
        // convert dynAttrList [i] to local attribute named attr
        // attr[0] = A_B_C_attr1
        // attr[1] = A_B_C_attr2
        // attr[2] = D_E_F_attr1
        // …
        add_LongDynAttr_dynamic_attribute (attr[i]);
}

Is this the good way to do this?

Best wishes.
JCM
Is this the good way to do this?

Yes, you are on the right track! This will create some Tango::DevLong dynamic attributes with the names you gave (A_B_C_attr1, A_B_C_attr2, D_E_F_attr1,…) smile

Then you will have to put some smart code into DynAttr::read_LongDynAttr(Tango::Attribute &attr) method to set the attribute value for the corresponding attribute name that you can get with attr.get_name() method.
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.