diff --git a/doc/recipes/ConfigureTangoEvents.rst b/doc/recipes/ConfigureTangoEvents.rst new file mode 100644 index 000000000..9ca0157b3 --- /dev/null +++ b/doc/recipes/ConfigureTangoEvents.rst @@ -0,0 +1,88 @@ +Configuring Tango Events +======================== + +The module fandango.tango provides 4 methods to manage attribute events: + +.. contents:: + +check_attribute_events +---------------------- + +:: + + def check_attribute_events(model,ev_type=None,verbose=False): + """ + This method expects model and a list of event types. + If empty, CHANGE and ARCHIVE events are tested. + + It will return a dictionary with: + - keys: available event types + - value: True for code-pushed events, int(period) for polled-based + + """ + +check_device_events +------------------- + +:: + + def check_device_events(device): + """ + apply check_attribute_events to all attributes of the device + """ + +get_attribute_events +-------------------- + +:: + + def get_attribute_events(target,polled=True,throw=False): + """ + Get current attribute events configuration + + Pushed events will be not show, attributes not polled may not works + + Use check_attribute_events to verify if events are really working + + TODO: it uses Tango Device Proxy, should be Tango Database instead to + allow offline checking + """ + +set_attribute_events +-------------------- + +:: + + def set_attribute_events(target, polling = None, rel_event = None, + abs_event = None, per_event = None, + arch_rel_event = None, arch_abs_event = None, + arch_per_event = None,verbose = False): + """ + Allows to set independently each event property of the attribute + + Event properties should have same type that the attribute to be set + + Polling must be integer, in millisecons + + from fandango 14.3.0 onwards + Setting any event to 0 or False will erase the current configuration + + """ + + +Example +------- + +Use them like:: + + import fandango as fn + curr = 'sr/di/dcct/averagecurrent' + fn.tango.get_attribute_events(curr) + {'arch_event': [0.05, None, 320.0], 'per_event': [1000.0], 'polling': 0} + fn.tango.check_attribute_events('sr/di/dcct/averagecurrent') + Out: {tango._tango.EventType.CHANGE_EVENT: True} + + # True means pushed, so the arch_event can be removed + fn.tango.set_attribute_events(curr,arch_abs_event=0,arch_per_event=0) + + diff --git a/doc/recipes/EventsAndCallbacks.rst b/doc/recipes/EventSourceAndCallbacks.rst similarity index 95% rename from doc/recipes/EventsAndCallbacks.rst rename to doc/recipes/EventSourceAndCallbacks.rst index e0bc12931..8cdf6e34c 100644 --- a/doc/recipes/EventsAndCallbacks.rst +++ b/doc/recipes/EventSourceAndCallbacks.rst @@ -132,6 +132,19 @@ occasional clients (Panic GUI, ipython). Events are not subscribed, polling is not active, all reads go directly to HW except those with period < keepTime ; thus returning a Cached value. +Controlling the EventThread +--------------------------- + +The EventThread can be tuned like:: + + EventSource.get_thread().setup(period_ms=1000,latency=100,filtered=0.5) + + - period_ms will control how often events are processed + + - the latency is the maximum drift allowed between event arrival and processing + + - if filtered has a value between 0 and 1, it will be the time value relative to the latency that will force event filtering (not processing all events but just the last arrived). + Conditions for Client Polling -----------------------------