Example #1
0
class EventContext(object):
    """
    Maintains the event context while processing.
    """

    def __init__(self, log, zepRawEvent):
        self._zepRawEvent = zepRawEvent
        self._event = self._zepRawEvent.event
        self._eventProxy = ZepRawEventProxy(self._zepRawEvent)

        # If this event is for a device, it will be attached here
        self._deviceObject = None
        self._componentObject = None
        self.log = EventLoggerAdapter(log, {'event_uuid': self._event.uuid})

    def setDeviceObject(self, device):
        self._deviceObject = device

    def refreshClearClasses(self):
        self._eventProxy._refreshClearClasses()

    @property
    def deviceObject(self):
        return self._deviceObject

    def setComponentObject(self, component):
        self._componentObject = component

    @property
    def componentObject(self):
        return self._componentObject

    @property
    def zepRawEvent(self):
        return self._zepRawEvent

    @property
    def event(self):
        return self._event

    @property
    def eventProxy(self):
        """
        A EventProxy that wraps the event protobuf and makes it look like an old style event.
        """
        return self._eventProxy
Example #2
0
    def __init__(self, log, zepRawEvent):
        self._zepRawEvent = zepRawEvent
        self._event = self._zepRawEvent.event
        self._eventProxy = ZepRawEventProxy(self._zepRawEvent)

        # If this event is for a device, it will be attached here
        self._deviceObject = None
        self._componentObject = None
        self.log = EventLoggerAdapter(log, {'event_uuid': self._event.uuid})