# `AttributeEventWait`

digraph inheritanceadc988d4f8 { bgcolor=transparent; rankdir=UD; ratio=compress; size="8.0, 12.0"; "AttributeEventWait" [URL="#taurus.core.util.event.AttributeEventWait",color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,target="_top",tooltip="Class designed to connect to a"]; }

class AttributeEventWait(attr=None)

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

  Import from `taurus.core.util.event` as:

      from taurus.core.util.event import AttributeEventWait

  clearEventSet()

    Clears the internal event buffer

  connect(attr)

    Connect to the given attribute

    Parameters:

      attr (taurus.core.taurusattribute.TaurusAttribute) – the attribute to connect to

  disconnect()

    Disconnects from the attribute. If not connected nothing happens.

  eventReceived(s, t, v)

    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)

    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()

    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)

    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()

    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()

    Locks this event listener

  unlock()

    Unocks this event listener

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

    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

  waitForEvent(values, after=0, equal=True, timeout=None, reactivity=None, ignore_values=False)

    Wait for an event that matches some given conditions.

    Parameters:

      - values (seq<object>) – values to compare with the received event value

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

      - equal (bool) – determines how the comparison is made. If True, the wait will finish when the event matches any of the given values. If False, the wait will finish when the event differs from all the given values.

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

      - reactivity – setting reactivity (seconds) waranties reactions to aborts comming from other threads in at most the reactivity time. Default is None meaning no reactivity within timeout.

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

    Returns:

      The return value is True unless a given timeout expired, in which case it is False.

    Return type:

      bool