# -*- coding: utf-8 -*- #!/usr/bin/env python from apps.web.constant import Const from apps.web.eventer.base import FaultEvent, WorkEvent from apps.web.eventer import EventBuilder class builder(EventBuilder): def __getEvent__(self, device_event): if device_event['cmd'] == Const.I_AM_FAULT: return FaultEvent(device_event) elif device_event['cmd'] == Const.I_AM_EVENT: return WorkEvent(device_event, ) return None