示例#1
0
def _wrap_callback_parse_event(on_data, message):
    """
    Wraps a user callback to parse Events
    from a WebSocket data message
    """
    pb = yamcs_pb2.Event()
    message.Unpack(pb)
    event = Event(pb)
    on_data(event)
示例#2
0
    def current_event(self):
        """
        Latest event for this alarm

        :type: :class:`.Event`
        """
        if self._proto.eventDetail.HasField("currentEvent"):
            return Event(self._proto.eventDetail.currentEvent)
        return None
示例#3
0
    def trigger_event(self):
        """
        Event that originally triggered the alarm

        :type: :class:`.Event`
        """
        if self._proto.eventDetail.HasField("triggerEvent"):
            return Event(self._proto.eventDetail.triggerEvent)
        return None
示例#4
0
    def most_severe_event(self):
        """
        First event that invoked the highest severity level
        of this alarm

        :type: :class:`.Event`
        """
        if self._proto.eventDetail.HasField("mostSevereEvent"):
            return Event(self._proto.eventDetail.mostSevereEvent)
        return None
示例#5
0
def _wrap_callback_parse_event(on_data, message):
    """
    Wraps a user callback to parse Events
    from a WebSocket data message
    """
    if message.type == message.DATA:
        if message.data.type == yamcs_pb2.EVENT:
            event = Event(getattr(message.data, 'event'))
            #pylint: disable=protected-access
            on_data(event)