Ejemplo n.º 1
0
 def trigger_passes_updated_event():
     """Pusher event
     Triggers the transmission of this event through the pusher.com service.
     """
     satnet_push.PushService().trigger_event(
         satnet_push.PushService.SIMULATION_EVENTS_CHANNEL,
         satnet_push.PushService.PASSES_UPDATED_EVENT, {})
Ejemplo n.º 2
0
def keep_alive():
    """Push event
    Keep alive event that prevents remote sessions to automatically expire.
    """
    satnet_push.PushService().trigger_event(
        satnet_push.PushService.NETWORK_EVENTS_CHANNEL,
        satnet_push.PushService.KEEP_ALIVE, {'alive': True})
Ejemplo n.º 3
0
 def setUp(self):
     """Test setup
     """
     self.__verbose_testing = False
     self.__push_service = satnet_pusher.PushService()
     self.__ch_name = 'test_channel'
     self.__ev_name = 'test_event'
     self.__ev_data = {'message': 'Hello SATNET!'}
Ejemplo n.º 4
0
    def trigger_gt_updated_event(spacecraft_id):
        """Pusher event
        Triggers the transmission of this event through the pusher.com service.

        :param spacecraft_id: Identifier of the Spacecraft
        """
        satnet_push.PushService().trigger_event(
            satnet_push.PushService.SIMULATION_EVENTS_CHANNEL,
            satnet_push.PushService.GROUNDTRACK_UPDATED_EVENT,
            {'identifier': str(spacecraft_id)})
Ejemplo n.º 5
0
    def trigger_gss_assigned(launch_id, groundstations):
        """
        This method triggers the event that notifies to the connected clients
        that some new groundstations have been assigned to the related launch.
        :param launch_id: Identifier of the launch
        :param groundstations: Identifier of the groundstations assigned (array)
        """
        push_service.PushService().trigger_event(
            push_service.PushService.LEOP_EVENTS_CHANNEL,
            push_service.PushService.LEOP_GSS_UPDATED_EVENT,
            launch_serial.serialize_leop_id(launch_id))

        for g in groundstations:

            push_service.PushService().trigger_event(
                push_service.PushService.LEOP_EVENTS_CHANNEL,
                push_service.PushService.LEOP_GS_ASSIGNED_EVENT, {
                    'launch_id': str(launch_id),
                    'groundstation_id': str(g)
                })
Ejemplo n.º 6
0
 def trigger_received_frame_event(message):
     """
     This method triggers the event about the reception of a new frame at
     the server. This way, the web clients can receive in real time the
     same frames that were received by the server.
     :param message: PassiveMessage object as read from the database
     """
     push_service.PushService().trigger_event(
         push_service.PushService.LEOP_DOWNLINK_CHANNEL,
         push_service.PushService.FRAME_EVENT,
         message_serializers.serialize_push_frame(message))
Ejemplo n.º 7
0
def gs_removed_handler(sender, instance, **kwargs):
    """
    Invokes the GS_RMOVED event through the push channel.
    :param sender: GroundStation model
    :param instance: Reference to the just created GroundStation
    :param kwargs: Additional parameters
    """
    satnet_push.PushService().trigger_event(
        satnet_push.PushService.CONFIGURATION_EVENTS_CHANNEL,
        satnet_push.PushService.GS_REMOVED_EVENT,
        {'identifier': instance.identifier})
Ejemplo n.º 8
0
 def trigger_leop_sc_updated(launch_id, launch_sc_id):
     """
     Triggers the transmission of the event that reports the update of the
     SC related directly with the cluster.
     :param launch_id: Identifier of the Launch
     :param launch_sc_id: Identifier of the Spacecraft for the cluster
     """
     push_service.PushService().trigger_event(
         push_service.PushService.LEOP_EVENTS_CHANNEL,
         push_service.PushService.LEOP_SC_UPDATED, {
             'launch_id': str(launch_id),
             'launch_sc_id': str(launch_sc_id)
         })
Ejemplo n.º 9
0
def gs_added_or_updated_handler(sender, instance, created, raw, **kwargs):
    """
    Invokes the GS_ADDED or GS_UPDATED event through the push channel.
    :param sender: GroundStation model
    :param instance: Reference to the just created GroundStation
    :param created: Flag that indicates that this object has just been created
    :param raw: Flag that indicates that the object is not stable within the db
    :param kwargs: Additional parameters
    """
    if raw:
        return

    if created:
        satnet_push.PushService().trigger_event(
            satnet_push.PushService.CONFIGURATION_EVENTS_CHANNEL,
            satnet_push.PushService.GS_ADDED_EVENT,
            {'identifier': instance.identifier})
    else:
        satnet_push.PushService().trigger_event(
            satnet_push.PushService.CONFIGURATION_EVENTS_CHANNEL,
            satnet_push.PushService.GS_UPDATED_EVENT,
            {'identifier': instance.identifier})
Ejemplo n.º 10
0
 def trigger_ufo_identified(launch_id, ufo_id, spacecraft_id):
     """
     This method triggers the event that marks the identification of a given
     UFO as a spacecraft.
     :param launch_id: Identifier of the Launch
     :param ufo_id: Identifier of the UFO.
     :param spacecraft_id: Identifier of the spacecraft linked to this UFO
     """
     push_service.PushService().trigger_event(
         push_service.PushService.LEOP_EVENTS_CHANNEL,
         push_service.PushService.LEOP_UFO_IDENTIFIED, {
             'launch_id': str(launch_id),
             'ufo_id': str(ufo_id),
             'spacecraft_id': str(spacecraft_id)
         })
Ejemplo n.º 11
0
    def trigger_gss_released(launch_id, groundstations):
        """
        This method triggers the event that notifies to the connected clients
        that some groundstations have been released from the related launch.
        :param launch_id: Identifier of the launch
        :param groundstations: Identifier of the groundstations assigned (array)
        """
        for g in groundstations:

            push_service.PushService().trigger_event(
                push_service.PushService.LEOP_EVENTS_CHANNEL,
                push_service.PushService.LEOP_GS_RELEASED_EVENT, {
                    'launch_id': str(launch_id),
                    'groundstation_id': str(g)
                })
Ejemplo n.º 12
0
 def trigger_ufo_forgotten(launch_id, ufo_id, spacecraft_id):
     """
     This method triggers the event that marks to the clients that the
     server has <forgotten> about a given UFO as a spacecraft.
     :param launch_id: Identifier of the Launch
     :param ufo_id: Identifier of the UFO (matches spacecraft_id xxxx)
     :param spacecraft_id: Identifier of the Spacecraft
     """
     push_service.PushService().trigger_event(
         push_service.PushService.LEOP_EVENTS_CHANNEL,
         push_service.PushService.LEOP_UFO_FORGOTTEN, {
             'launch_id': str(launch_id),
             'ufo_id': str(ufo_id),
             'spacecraft_id': str(spacecraft_id)
         })
Ejemplo n.º 13
0
def launch_updated_handler(sender, instance, created, raw, **kwargs):
    """
    Invokes the LAUNCH_UPDATED event through the push channel.
    :param sender: Launch model
    :param instance: Reference to the just created Launch
    :param created: Flag that indicates that this object has just been created
    :param raw: Flag that indicates that the object is not stable within the db
    :param kwargs: Additional parameters
    """
    if created or raw:
        return

    satnet_push.PushService().trigger_event(
        satnet_push.PushService.LEOP_EVENTS_CHANNEL,
        satnet_push.PushService.LEOP_UPDATED_EVENT,
        {'identifier': instance.identifier}
    )