dynamic attributes with external devices
|
|
---|---|
ReynaldYeah, 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. ReynaldYes, it helps a lot. 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:
Is this the good way to do this? Best wishes. |
|
|
---|---|
JCM 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,…) 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. |
|
|
---|---|
Hi Reynald, I put my code in the DynAttr::read_LongDynAttr(Tango::Attribute &attr) method to set the attribute value but it is called only if another client accesses the attribute. The atkpanel does not display the updated value ;( Is this normal? Also, the DynAttr::add_dynamic_attributes() method is not executed by init_device(). The 'init' command is not enough, i have to stop my DS and restart it if changed the list of attributes ;( Is this normal? thank you so much |
|
|
---|---|
JCM The code in DynAttr::read_LongDynAttr(Tango::Attribute &attr) is called only when any client tries to read one of your created dynamic attributes. This method can be called regularly as well if your dynamic attributes are polled. JCM Do you mean the value of your attribute? Or do you mean the atkpanel does not display the newly created dynamic attributes. atkpanel does not listen to interface change events, so it is not notified when new attributes are created. If you create new attributes, you need to restart atkpanel to see the current device interface with the newly created attributes. Can you please share the code of your DynAttr::read_LongDynAttr(Tango::Attribute &attr) method so we can understand what you actually asked the device server to do? JCM Yes, this is normal. DynAttr::add_dynamic_attributes() is invoked by DynAttrClass::device_factory() method, which is called when the device are created. If you change the list of attributes for one device, the right approach is to do a "restart device" (available from the right-click menu on your device on jive, there is a DevRestart command on the admin device to do that too). If you change the list of attributes for many devices from your device server, you should restart the server (there is a RestartServer command on the admin device or you can simply restart the device server from astor). Hoping this helps, Reynald
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. |
|
|
---|---|
JCM Reynald thanks, i try. JCM Reynald i mean the value of my attributes. extract of my DynAttr::read_LongDynAttr(Tango::Attribute &attr) method
JCM Reynald Thanks |
|
|
---|---|
Maybe your problem comes from the fact that you have declared in POGO you would push events by code for these attributes and you actually don't push events. So atkpanel subscribes to events for these attributes and simply waits for these events to update the displayed values. But if the device server does not push any event, atkpanel will never receive any update. To identify if atkpanel is actually listening to events on your attribute or doing some remote polling of the attribute, you can have a look at the ATK Diagnostic window (available from atkpanel's View menu and then "Diagnostic…" menu item). If you see Event enabled set to true for your attributes, this means that atkpanel will not remotely poll these attributes and simply wait for events to come. This is probably what happens in your case?
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. |
|
|
---|---|
I precise i have not declared in POGO i you would push events by code for these attributes. In my code i subscribe to events and a callback method is triggered when the events are received (push model). In the ATK Diagnostic window, i see Event enabled set to true for all my attributes. |
|
|
---|---|
Are your attributes polled in your device server?
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. |
|
|
---|---|
YES on my attributes, with jive, i set polling and absolute value on Change event. See also the ATK diagnostic window. |