AttributeEventWait

Inheritance diagram of AttributeEventWait
class AttributeEventWait(attr=None)[source]

Bases: object

Class designed to connect to a taurus.core.taurusattribute.TaurusAttribute and fire events or wait for a certain event.

clearEventSet()[source]

Clears the internal event buffer

connect(attr)[source]

Connect to the given attribute :param attr: the attribute to connect to :type attr: taurus.core.taurusattribute.TaurusAttribute

disconnect()[source]

Disconnects from the attribute. If not connected nothing happens.

eventReceived(s, t, v)[source]

Event listener method for the underlying attribute. Do not call this method. It will be called internally when the attribute generates an event.

fireEvent(v)[source]

Notifies that a given event has arrived This function is protected inside with the object’s lock. Do NOT call this function when you have the lock acquired on this object.

Parameters

v (object) – event value

getLastRecordedEvent()[source]

returns the value of the last recorded event or None if no event has been received or the last event was an error event

Returns

the last event value to be recorded

Return type

object

getRecordedEvent(v)[source]

Returns the the recorded local timestamp for the event with the given value or None if no event with the given value has been recorded.

Parameters

v (object) – event value

Returns

local timestamp for the event or None if no event has been recorded

Return type

float

getRecordedEvents()[source]

Returns a reference to the internal dictionary used to store the internal events. Modify the return dictionary at your own risk!

Returns

reference to the internal event dictionary

Return type

dict

lock()[source]

Locks this event listener

unlock()[source]

Unocks this event listener

waitEvent(val, after=0, equal=True, timeout=None, retries=-1, any=False)[source]

Wait for an event with the given value.

Parameters
  • val (object) – value to compare

  • after (float) – timestamp. wait for events comming after the given time. default value is 0 meaning any event after Jan 1, 1970

  • equal (bool) – compare for equality. equal=True means an event with the given value, equal=False means any event which as a different value

  • timeout (float) – maximum time to wait (seconds). Default is None meaning wait forever.

  • retries – number of maximum retries of max timeout to attempts. Default is -1 meaning infinite number of retries. 0 means no wait. Positive number is obvious.

  • any (bool) – if any is True ignore ‘val’ parameter and accept any event. If False (default),check with given ‘val’ parameter