If you configure the TangoTest 'ushort_scalar' attribute to react to change events:
It can be configure with absolute or relative changes (to 1) with polling period to 3 s.
You receive the change events + some periodic events (at the same frecuency of the polling period).
Name = sys/tg_test/1 ; event type = change ; has_value = True ; time = 2016-06-15 08:20:49 Name = sys/tg_test/1 ; event type = change ; has_value = True ; time = 2016-06-15 08:20:50 Name = sys/tg_test/1 ; event type = change ; has_value = True ; time = 2016-06-15 08:20:59 Name = sys/tg_test/1 ; event type = change ; has_value = True ; time = 2016-06-15 08:21:02 Name = sys/tg_test/1 ; event type = change ; has_value = True ; time = 2016-06-15 08:21:05 Name = sys/tg_test/1 ; event type = change ; has_value = True ; time = 2016-06-15 08:21:08 Name = sys/tg_test/1 ; event type = change ; has_value = True ; time = 2016-06-15 08:21:11
Name = sys/tg_test/1 ; event type = change ; has_value = True ; time = 2016-06-15 08:55:21 Name = sys/tg_test/1 ; event type = change ; has_value = True ; time = 2016-06-15 08:55:23 Name = sys/tg_test/1 ; event type = change ; has_value = True ; time = 2016-06-15 08:55:26 Name = sys/tg_test/1 ; event type = change ; has_value = True ; time = 2016-06-15 08:55:29 Name = sys/tg_test/1 ; event type = change ; has_value = True ; time = 2016-06-15 08:55:32
You can reproduce the error with this code:
import PyTango
from time import gmtime, strftime, sleep
import sys
device = 'sys/tg_test/1'
attr = 'ushort_scalar'
def cb(*args, **kargs):
e_data = args[0]
attr_value = getattr(e_data, 'attr_value')
print 'Name = ', d.name(), '; event type =',e_data.event, '; has_value =', hasattr(attr_value, 'value'), '; time = ', strftime("%Y-%m-%d %H:%M:%S", gmtime())
d = PyTango.DeviceProxy(device)
id = d.subscribe_event(attr, PyTango.EventType.CHANGE_EVENT, cb)
d.write_attribute(attr, 3)
d.write_attribute(attr, 5)
Sorry, we did not notice that this attribute change every some time, so please reject this bug.
I tried with a cpp client (see attached "EventTester.tgz") and it also happens. But this doesn't seem to be a bug: the attribute value is really changing.
Last edit: Jairo Moldes 2016-06-16