Polling period set within device during startup sometimes read back as negative number
When looking into polling from PyTango, I notice an interesting feature (?) of cppTango. Scenario:
- polling is disabled for an attribute.
- In `init_device`, call `poll_attribute("double_scalar", 1000)`.
- Read it back in `init_device` with `get_attribute_poll_period("double_scalar")`. This will return `-1000`, instead of `1000`.
Is that on purpose? A client checking this value sees `1000`.
If the polling was already enabled, and then we change it to something else we read the positive value back from within the device.
Same thing for commands.
cppTango 10.1.1.
Example change to TangoTest.cpp:
```diff
diff --git a/TangoTest.cpp b/TangoTest.cpp
index 7cb1393..44dd11d 100644
--- a/TangoTest.cpp
+++ b/TangoTest.cpp
@@ -954,6 +954,26 @@ void TangoTest::init_device()
generic_blob_rw_has_value = false;
+ std::cout << "is_attribute_polled double_scalar " << is_attribute_polled("double_scalar") << std::endl;
+ std::cout << "get_attribute_poll_period double_scalar " << get_attribute_poll_period("double_scalar") << std::endl;
+
+ std::cout << "enabling polling with period 1000 " << std::endl;
+ poll_attribute("double_scalar", 1000);
+
+ std::cout << "is_attribute_polled double_scalar " << is_attribute_polled("double_scalar") << std::endl;
+ std::cout << "get_attribute_poll_period double_scalar " << get_attribute_poll_period("double_scalar") << std::endl;
+
+ std::cout << "enabling polling with period 2000 " << std::endl;
+ poll_attribute("double_scalar", 2000);
+
+ std::cout << "is_attribute_polled double_scalar " << is_attribute_polled("double_scalar") << std::endl;
+ std::cout << "get_attribute_poll_period double_scalar " << get_attribute_poll_period("double_scalar") << std::endl;
+
+ std::cout << "stopping polling " << std::endl;
+ stop_poll_attribute("double_scalar");
+ std::cout << "is_attribute_polled double_scalar " << is_attribute_polled("double_scalar") << std::endl;
+ std::cout << "get_attribute_poll_period double_scalar " << get_attribute_poll_period("double_scalar") << std::endl;
+
set_state(Tango::RUNNING);
/*----- PROTECTED REGION END -----*/ // TangoTest::init_device
```
Output:
```
$ TangoTest test2
is_attribute_polled double_scalar 0
get_attribute_poll_period double_scalar 0
enabling polling with period 1000
is_attribute_polled double_scalar 1
get_attribute_poll_period double_scalar -1000
enabling polling with period 2000
is_attribute_polled double_scalar 1
get_attribute_poll_period double_scalar 2000
stopping polling
is_attribute_polled double_scalar 0
get_attribute_poll_period double_scalar 0
Ready to accept request
Ready to accept request
```
@bourtemb Replied:
> For the negative values. I noticed that some time ago. I think it's on purpose. It's negative during the startup phase I think (or before the first polling loop) I don't remember well.
> Another topic for our future Polling SIG meeting
When I set the period for the first time from a command (so after startup), then it doesn't return a negative value, so this agrees with the comment above.
issue