Exemple #1
0
    def do_unsubscribe(self,
                       subscriber_id,
                       source_id,
                       block_name,
                       signal_index=None):
        """
        Something like a callback function for gui triggered events.
        User wants one plugin to do not get any more data from another plugin

        :param subscriber_id: plugin id which wants to lose a data source
        :type subscriber_id: int
        :param source_id: plugin id of data source
        :type source_id: int
        :param block_name: name of block to unsubscribe
        :type block_name: basestring
        :return:
        """
        # create optional data with source id and block_name
        opt = DOptionalData()
        opt.source_ID = source_id
        opt.block_name = block_name
        opt.signals = signal_index
        # sent event to Core with origin subscriber_id
        event = Event.instruction.Unsubscribe(subscriber_id, 0, opt)
        self.core_queue.put(event)
Exemple #2
0
    def do_subscribe(self,
                     subscriber_id,
                     source_id,
                     block_name,
                     signals=None,
                     sub_alias=None):
        """
        Something like a callback function for gui triggered events.
        In this case, user wants one plugin to subscribe another

        :param subscriber_id: Plugin id of plugin which should get the data
        :type subscriber_id: int
        :param source_id: plugin uname of plugin that should send the data
        :type source_id: int
        :param block_name: name of block to subscribe
        :type block_name: basestring
        :return:
        """
        # build optional data object and add id and block name to it
        opt = DOptionalData()
        opt.source_ID = source_id
        opt.block_name = block_name
        opt.signals = signals
        opt.subscription_alias = sub_alias
        # send event with subscriber id as the origin to CORE
        event = Event.instruction.Subscribe(subscriber_id, 0, opt)
        self.core_queue.put(event)
Exemple #3
0
    def do_unsubscribe(self, subscriber_id, source_id, block_name, signal_index=None):
        """
        Something like a callback function for gui triggered events.
        User wants one plugin to do not get any more data from another plugin

        :param subscriber_id: plugin id which wants to lose a data source
        :type subscriber_id: int
        :param source_id: plugin id of data source
        :type source_id: int
        :param block_name: name of block to unsubscribe
        :type block_name: basestring
        :return:
        """
        # create optional data with source id and block_name
        opt = DOptionalData()
        opt.source_ID = source_id
        opt.block_name = block_name
        opt.signals = signal_index
        # sent event to Core with origin subscriber_id
        event = Event.instruction.Unsubscribe(subscriber_id, 0, opt)
        self.core_queue.put(event)
Exemple #4
0
    def do_subscribe(self, subscriber_id, source_id, block_name, signals=None, sub_alias=None):
        """
        Something like a callback function for gui triggered events.
        In this case, user wants one plugin to subscribe another

        :param subscriber_id: Plugin id of plugin which should get the data
        :type subscriber_id: int
        :param source_id: plugin uname of plugin that should send the data
        :type source_id: int
        :param block_name: name of block to subscribe
        :type block_name: basestring
        :return:
        """
        # build optional data object and add id and block name to it
        opt = DOptionalData()
        opt.source_ID = source_id
        opt.block_name = block_name
        opt.signals = signals
        opt.subscription_alias = sub_alias
        # send event with subscriber id as the origin to CORE
        event = Event.instruction.Subscribe(subscriber_id, 0, opt)
        self.core_queue.put(event)