Attribute update
|
|
---|---|
Hello, I am new to the Tango world. I would like to create a basic device driver, a device driver with a double attribute and with a boolean attribute (button). I have followed the steps of the documentation ( https://tango-controls.readthedocs.io/en/latest/getting-started/development/cpp/cpp-quick-start.html ), adding the corresponding attributes –> But the attributes do not update their values (using TaurusForm gui) –> Even using a PyTango client it is not possible to see the assigned value. Does anyone see a mistake in the procedure I have followed? Thanks in advance, Adrián. |
|
|
---|---|
Hello, could you show the code of the attributes read and write callback functions ? Perhaps there is a problem in the attribute value update. Sonia |
|
|
---|---|
Hi, This part of the documentation is indeed not enough explicit. You need to add some code in the files generated by Pogo to assign the value you want to the different attributes and add your business logic. Here is an example for some attribute code in C++: https://tango-controls.readthedocs.io/en/latest/getting-started/development/cpp/first-device-class.html#the-three-attributes What programming language are you using for your Device Class Implementation? C++, Java, Python? Kind regards, 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. |
|
|
---|---|
Reynald Hi Reynald, I checked this example and the code generated by Pogo is quite similar: I am using C++ for the Device Class. Thanks, Adrián. |
|
|
---|---|
smi03Hi Sonia, I attach the code: Thanks, Adrián. |
|
|
---|---|
Hi, If you want the Counter read value to be updated with the Counter write value when the Counter attribute is written, you should add the following lines in the PROTECTED REGION section in AdriTangoClass::write_counter(Tango::WAttribute &attr):
You can also set *attr_counter_read to the value you want by code just before calling attr.set_value(attr_counter_read); For instance, if you want to increment the value of the Counter, every time the Attribute is read on the device:
It is important to put your business code inside the PROTECTED REGIONS because POGO won't overwrite/erase these parts of code when you regenerate some code with POGO (because you added a new command or attribute for instance). 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. |
|
|
---|---|
Reynald Hi Reynald, Thanks for your help. Now it works! But I still do not understand how the boolean attribute works. I click on the checkbox of the "button" attribute, but "write_button()" method is not executed. This is the code for the "button" (boolean) attribute:
I would like to execute some action, like write the value of another attribute or increase the value of counter, every time I push the button checkbox. Thanks, Adrián. |