In a device server, I create a dynamic attribute that I would like to be polled. However, despite setting the polling period in code, the attribute is not marked as polled in Jive upon creation: I need to manually check the Polled checkbox under Polling menu, and manually specify the polling interval. With the exception of polling, the attribute is created normally, and behaves as expected.
Code:
class DynamicScalarAttribute : public Tango::Attr { ... };
void Controller::add_dynamic_scalar_attribute(string attribute_name)
{
DynamicScalarAttribute *attribute = new DynamicScalarAttribute(attribute_name);
Tango::UserDefaultAttrProp properties;
properties.set_event_rel_change("10"); // Can be seen in Jive normally.
attribute->set_default_properties(properties);
attribute->set_polling_period(2500); // Not seen in Jive: the attribute will not be marked as polled at all.
attribute->set_disp_level(Tango::OPERATOR);
add_attribute(attribute);
}
void Controller::add_dynamic_attributes()
{
/*----- PROTECTED REGION ID(PLCController::add_dynamic_attributes) ENABLED START -----*/
add_dynamic_scalar_attribute("attribute1");
/*----- PROTECTED REGION END -----*/ // PLCController::add_dynamic_attributes
}
I noticed that when adding a normal (non-dynamic) polled attribute in Pogo, Tango will generate effectively the same code:
polledattribute->set_polling_period(3000);
polledattribute->set_change_event(true, false);
att_list.push_back(polledattribute);
The only difference is that add_attribute() is not called explicitly, and that set_change_event() is called, though I don’t understand why as events are not being pushed manually from the code. Still, even calling set_change_event() for my dynamic attribute doesn’t change the result. Of course, Tango doesn’t create the attribute inside add_dynamic_attributes(), but if I try to create the dynamic attribute in e.g. init_device(), the attribute is not created at all.
Any ideas how to get this to work?