Example #1
0
    def __init__(self, num_of_enbs, num_of_ues):
        gr.top_block.__init__(self, "Intra Handover Flowgraph")
        Qt.QWidget.__init__(self)

        if (num_of_enbs <= 0):
            raise Exception("Num of enbs must be positive")

        num_of_ues_pes_enb = int(num_of_ues / num_of_enbs)
        remainder_of_ues = num_of_ues % num_of_enbs

        ue_port = int(RANGE_START_PORTS_UE)
        enb_port = int(RANGE_START_PORTS_ENB)

        for enb_index in range(num_of_enbs):
            print("--- Setting eNB with index " + str(enb_index) + " ---")

            enb_ues = num_of_ues_pes_enb
            if (remainder_of_ues > 0):
                enb_ues += 1
                remainder_of_ues -= 1

            for ue_index in range(enb_ues):
                result = "Success"
                try:
                    ue_tx_port = zeromq.req_source(
                        gr.sizeof_gr_complex, 1,
                        'tcp://localhost:' + str(ue_port), 100, False, -1)
                    ue_rx_port = zeromq.rep_sink(gr.sizeof_gr_complex, 1,
                                                 'tcp://*:' + str(ue_port + 1),
                                                 100, False, -1)
                    ue_port += 2

                    enb_tx_port = zeromq.req_source(
                        gr.sizeof_gr_complex, 1,
                        'tcp://localhost:' + str(enb_port), 100, False, -1)
                    enb_rx_port = zeromq.rep_sink(
                        gr.sizeof_gr_complex, 1,
                        'tcp://*:' + str(enb_port + 1), 100, False, -1)
                    enb_port += 2

                    self.connect((ue_tx_port, 0), (enb_rx_port, 0))
                    self.connect((enb_tx_port, 0), (ue_rx_port, 0))
                except Exception as e:
                    result = "Fail: " + str(e)
                finally:
                    ue_index = str(enb_index) + "_" + str(ue_index)
                    print("Connecting UE with index " + ue_index + ": " +
                          result)
    def __init__(self):
        gr.top_block.__init__(self, "Zmq Audio Test Sink")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Zmq Audio Test Sink")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "zmq_audio_test_sink")

        try:
            if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                self.restoreGeometry(
                    self.settings.value("geometry").toByteArray())
            else:
                self.restoreGeometry(self.settings.value("geometry"))
        except:
            pass

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        self.zeromq_req_source_0 = zeromq.req_source(gr.sizeof_float, 1,
                                                     'tcp://127.0.0.1:5555',
                                                     100, True, -1)
        self.audio_sink_0 = audio.sink(samp_rate, '', True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.zeromq_req_source_0, 0), (self.audio_sink_0, 1))
        self.connect((self.zeromq_req_source_0, 0), (self.audio_sink_0, 0))
Example #3
0
 def test_001 (self):
     vlen = 10
     src_data = range(vlen)*100
     src = blocks.vector_source_f(src_data, False, vlen)
     zeromq_rep_sink = zeromq.rep_sink(gr.sizeof_float, vlen, "tcp://127.0.0.1:5555", 0)
     zeromq_req_source = zeromq.req_source(gr.sizeof_float, vlen, "tcp://127.0.0.1:5555", 0)
     sink = blocks.vector_sink_f(vlen)
     self.tb.connect(src, zeromq_rep_sink)
     self.tb.connect(zeromq_req_source, sink)
     self.tb.start()
     time.sleep(0.25)
     self.tb.stop()
     self.tb.wait()
     self.assertFloatTuplesAlmostEqual(sink.data(), src_data)
Example #4
0
 def test_001 (self):
     vlen = 10
     src_data = list(range(vlen))*100
     src = blocks.vector_source_f(src_data, False, vlen)
     zeromq_rep_sink = zeromq.rep_sink(gr.sizeof_float, vlen, "tcp://127.0.0.1:0", 0)
     address = zeromq_rep_sink.last_endpoint()
     zeromq_req_source = zeromq.req_source(gr.sizeof_float, vlen, address, 0)
     sink = blocks.vector_sink_f(vlen)
     self.send_tb.connect(src, zeromq_rep_sink)
     self.recv_tb.connect(zeromq_req_source, sink)
     self.recv_tb.start()
     time.sleep(0.5)
     self.send_tb.start()
     time.sleep(0.5)
     self.recv_tb.stop()
     self.send_tb.stop()
     self.recv_tb.wait()
     self.send_tb.wait()
     self.assertFloatTuplesAlmostEqual(sink.data(), src_data)
 def test_001(self):
     vlen = 10
     src_data = list(range(vlen)) * 100
     src = blocks.vector_source_f(src_data, False, vlen)
     zeromq_rep_sink = zeromq.rep_sink("tcp://127.0.0.1:0", 0)
     address = zeromq_rep_sink.last_endpoint()
     zeromq_req_source = zeromq.req_source(address, 0)
     sink = blocks.vector_sink_f(vlen)
     self.send_tb.connect(src, zeromq_rep_sink)
     self.recv_tb.connect(zeromq_req_source, sink)
     self.recv_tb.start()
     time.sleep(0.5)
     self.send_tb.start()
     time.sleep(0.5)
     self.recv_tb.stop()
     self.send_tb.stop()
     self.recv_tb.wait()
     self.send_tb.wait()
     self.assertFloatTuplesAlmostEqual(sink.data(), src_data)
Example #6
0
    def __init__(self, args, cfg):
        gr.top_block.__init__(self, "InterENB Handover Flowgraph")

        ##################################################
        # Variables
        ##################################################
        self.args = args
        self.cfg = cfg
        self.samp_rate = samp_rate = 23040000
        self.relative_gain = relative_gain = 1.0
        self.blocks_add = {}

        ##################################################
        # Blocks
        ##################################################

        # Build ENB side + connect to per stream multilier:
        for enb in self.cfg['enb']:
            for it in enb:
                source_addr = 'tcp://%s:%u' % (it['peer_addr'].encode('utf-8'),
                                               it['peer_port'])
                sink_addr = 'tcp://%s:%u' % (args.bind_addr, it['bind_port'])
                print('enb: earfcn=%u source=%r sink=%r' %
                      (it['earfcn'], source_addr, sink_addr))
                it['gr_block_zmq_source'] = zeromq.req_source(
                    gr.sizeof_gr_complex, 1, source_addr, 100, False, -1)
                it['gr_block_zmq_sink'] = zeromq.rep_sink(
                    gr.sizeof_gr_complex, 1, sink_addr, 100, False, -1)
                it['gr_block_multiply'] = blocks.multiply_const_cc(
                    relative_gain)
                it['gr_block_multiply'].set_block_alias('relative_gain %s' %
                                                        source_addr)
                self.connect((it['gr_block_zmq_source'], 0),
                             (it['gr_block_multiply'], 0))
                if it['use_mimo']:
                    source_addr = 'tcp://%s:%u' % (
                        it['peer_addr'].encode('utf-8'), it['peer_port'] + 1)
                    sink_addr = 'tcp://%s:%u' % (args.bind_addr,
                                                 it['bind_port'] + 1)
                    print('enb: earfcn=%u source=%r sink=%r (MIMO)' %
                          (it['earfcn'], source_addr, sink_addr))
                    it['gr_block_zmq_source2'] = zeromq.req_source(
                        gr.sizeof_gr_complex, 1, source_addr, 100, False, -1)
                    it['gr_block_zmq_sink2'] = zeromq.rep_sink(
                        gr.sizeof_gr_complex, 1, sink_addr, 100, False, -1)
                    it['gr_block_multiply2'] = blocks.multiply_const_cc(
                        relative_gain)
                    it['gr_block_multiply2'].set_block_alias(
                        'relative_gain %s' % source_addr)
                    self.connect((it['gr_block_zmq_source2'], 0),
                                 (it['gr_block_multiply2'], 0))

        # Build UE side:
        for ue in self.cfg['ue']:
            for it in ue:
                source_addr = 'tcp://%s:%u' % (it['peer_addr'].encode('utf-8'),
                                               it['peer_port'])
                sink_addr = 'tcp://%s:%u' % (args.bind_addr, it['bind_port'])
                print('ue: earfcn=%u source=%r sink=%r' %
                      (it['earfcn'], source_addr, sink_addr))
                it['gr_block_zmq_source'] = zeromq.req_source(
                    gr.sizeof_gr_complex, 1, source_addr, 100, False, -1)
                it['gr_block_zmq_sink'] = zeromq.rep_sink(
                    gr.sizeof_gr_complex, 1, sink_addr, 100, False, -1)
                if it['use_mimo']:
                    source_addr = 'tcp://%s:%u' % (
                        it['peer_addr'].encode('utf-8'), it['peer_port'] + 1)
                    sink_addr = 'tcp://%s:%u' % (args.bind_addr,
                                                 it['bind_port'] + 1)
                    print('ue: earfcn=%u source=%r sink=%r (MIMO)' %
                          (it['earfcn'], source_addr, sink_addr))
                    it['gr_block_zmq_source2'] = zeromq.req_source(
                        gr.sizeof_gr_complex, 1, source_addr, 100, False, -1)
                    it['gr_block_zmq_sink2'] = zeromq.rep_sink(
                        gr.sizeof_gr_complex, 1, sink_addr, 100, False, -1)

        # Create per EARFCN adder (only 2->1 supported so far)
        earfcn_li = self.calc_earfcn_list()
        blocks_add_next_avail_port = {}
        for earfcn in earfcn_li:
            self.blocks_add[earfcn] = blocks.add_vcc(1)
            blocks_add_next_avail_port[earfcn] = 0
        # Connect the ENB-side multipliers to the Adder input ports:
        idx = 0
        for enb in self.cfg['enb']:
            for it in enb:
                print('Connecting ENB port %u to Adder[%u] for earfcn %u' %
                      (it['bind_port'],
                       blocks_add_next_avail_port[it['earfcn']], it['earfcn']))
                self.connect((it['gr_block_multiply'], 0),
                             (self.blocks_add[it['earfcn']],
                              blocks_add_next_avail_port[it['earfcn']]))
                # TODO: if it['use_mimo'], connect it['gr_block_multiply2'] to some adder...
                blocks_add_next_avail_port[it['earfcn']] += 1

        # Connect the Adder to the UE-side (Dl):
        for earfcn, bl_add in self.blocks_add.items():
            for ue in self.cfg['ue']:
                for it in ue:
                    if it['earfcn'] != earfcn:
                        continue
                    print('Connecting Adder for earfcn %u to UE port %u' %
                          (earfcn, it['bind_port']))
                    self.connect((bl_add, 0), (it['gr_block_zmq_sink'], 0))
                    # TODO: if it['use_mimo'], connect some adder to it['gr_block_zmq_sink2']...

        # UL: Connect 1 UE port splitting it into N ENB ports:
        for ue in self.cfg['ue']:
            for it_ue in ue:
                for enb in self.cfg['enb']:
                    for it_enb in enb:
                        if it_ue['earfcn'] != it_enb['earfcn']:
                            continue
                        print(
                            'connecting UE port %u to ENB port %u, earfcn=%u' %
                            (it_ue['bind_port'], it_enb['bind_port'],
                             it_enb['earfcn']))
                        self.connect((it_ue['gr_block_zmq_source'], 0),
                                     (it_enb['gr_block_zmq_sink'], 0))
                        if it_ue['use_mimo'] and it_enb['use_mimo']:
                            self.connect((it_ue['gr_block_zmq_source2'], 0),
                                         (it_enb['gr_block_zmq_sink2'], 0))
    def __init__(self):
        gr.top_block.__init__(self, "Zmq Audio Test")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Zmq Audio Test")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "zmq_audio_test")

        try:
            if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                self.restoreGeometry(
                    self.settings.value("geometry").toByteArray())
            else:
                self.restoreGeometry(self.settings.value("geometry"))
        except:
            pass

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        self.zeromq_req_source_0 = zeromq.req_source(gr.sizeof_float, 1,
                                                     'tcp://127.0.0.1:5555',
                                                     100, True, -1)
        self.zeromq_rep_sink_0 = zeromq.rep_sink(gr.sizeof_float, 1,
                                                 'tcp://127.0.0.1:5555', 100,
                                                 True, -1)
        self.blocks_vco_f_0 = blocks.vco_f(samp_rate, 50, 1)
        self.blocks_stream_to_tagged_stream_0 = blocks.stream_to_tagged_stream(
            gr.sizeof_float, 1, 1, "packet_len")
        self.blocks_stream_to_tagged_stream_0.set_min_output_buffer(64)
        self.blocks_stream_to_tagged_stream_0.set_max_output_buffer(1024)
        self.audio_sink_0 = audio.sink(samp_rate, '', True)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 5, 100, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_vco_f_0, 0))
        self.connect((self.blocks_stream_to_tagged_stream_0, 0),
                     (self.zeromq_rep_sink_0, 0))
        self.connect((self.blocks_vco_f_0, 0),
                     (self.blocks_stream_to_tagged_stream_0, 0))
        self.connect((self.zeromq_req_source_0, 0), (self.audio_sink_0, 0))
        self.connect((self.zeromq_req_source_0, 0), (self.audio_sink_0, 1))
Example #8
0
    def __init__(self):
        gr.top_block.__init__(self, "Intra Handover Flowgraph")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Intra Handover Flowgraph")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "intra_enb")

        try:
            if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                self.restoreGeometry(
                    self.settings.value("geometry").toByteArray())
            else:
                self.restoreGeometry(self.settings.value("geometry"))
        except:
            pass

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1.92e6
        self.cell_gain1 = cell_gain1 = 0
        self.cell_gain0 = cell_gain0 = 1

        ##################################################
        # Blocks
        ##################################################
        self.zeromq_req_source_0_0_0_0 = zeromq.req_source(
            gr.sizeof_gr_complex, 1, 'tcp://localhost:2300', 100, False, -1)
        self.zeromq_req_source_0_0_0 = zeromq.req_source(
            gr.sizeof_gr_complex, 1, 'tcp://localhost:2200', 100, False, -1)
        self.zeromq_req_source_0_0 = zeromq.req_source(gr.sizeof_gr_complex, 1,
                                                       'tcp://localhost:2101',
                                                       100, False, -1)
        self.zeromq_req_source_0 = zeromq.req_source(gr.sizeof_gr_complex, 1,
                                                     'tcp://localhost:2100',
                                                     100, False, -1)
        self.zeromq_rep_sink_ue1_0_1 = zeromq.rep_sink(gr.sizeof_gr_complex, 1,
                                                       'tcp://*:2150', 100,
                                                       False, -1)
        self.zeromq_rep_sink_ue1_0_0_0 = zeromq.rep_sink(
            gr.sizeof_gr_complex, 1, 'tcp://*:2151', 100, False, -1)
        self.zeromq_rep_sink_ue1_0_0 = zeromq.rep_sink(gr.sizeof_gr_complex, 1,
                                                       'tcp://*:2301', 100,
                                                       False, -1)
        self.zeromq_rep_sink_ue1_0 = zeromq.rep_sink(gr.sizeof_gr_complex, 1,
                                                     'tcp://*:2201', 100,
                                                     False, -1)
        self._cell_gain1_range = Range(0, 1, 0.1, 0, 200)
        self._cell_gain1_win = RangeWidget(self._cell_gain1_range,
                                           self.set_cell_gain1, 'cell_gain1',
                                           "counter_slider", float)
        self.top_grid_layout.addWidget(self._cell_gain1_win)
        self._cell_gain0_range = Range(0, 1, 0.1, 1, 200)
        self._cell_gain0_win = RangeWidget(self._cell_gain0_range,
                                           self.set_cell_gain0, 'cell_gain0',
                                           "counter_slider", float)
        self.top_grid_layout.addWidget(self._cell_gain0_win)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.zeromq_req_source_0, 0),
                     (self.zeromq_rep_sink_ue1_0, 0))
        self.connect((self.zeromq_req_source_0_0, 0),
                     (self.zeromq_rep_sink_ue1_0_0, 0))
        self.connect((self.zeromq_req_source_0_0_0, 0),
                     (self.zeromq_rep_sink_ue1_0_1, 0))
        self.connect((self.zeromq_req_source_0_0_0_0, 0),
                     (self.zeromq_rep_sink_ue1_0_0_0, 0))
Example #9
0
    def __init__(self, interval):
        gr.top_block.__init__(self,
                              "S1 Handover Flowgraph",
                              catch_exceptions=True)
        Qt.QWidget.__init__(self)
        self.setWindowTitle("S1 Handover Flowgraph")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "s1_handover")

        try:
            if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                self.restoreGeometry(
                    self.settings.value("geometry").toByteArray())
            else:
                self.restoreGeometry(self.settings.value("geometry"))
        except:
            pass

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1.92e6
        self.cell_gain1 = cell_gain1 = 0
        self.cell_gain0 = cell_gain0 = 1

        ##################################################
        # Blocks
        ##################################################
        self._cell_gain1_range = Range(0, 1, 0.1, cell_gain1, 200)
        self._cell_gain1_win = RangeWidget(self._cell_gain1_range,
                                           self.set_cell_gain1, 'cell_gain1',
                                           "counter_slider", float,
                                           QtCore.Qt.Horizontal)
        self.top_grid_layout.addWidget(self._cell_gain1_win)
        self._cell_gain0_range = Range(0, 1, 0.1, cell_gain0, 200)
        self._cell_gain0_win = RangeWidget(self._cell_gain0_range,
                                           self.set_cell_gain0, 'cell_gain0',
                                           "counter_slider", float,
                                           QtCore.Qt.Horizontal)
        self.top_grid_layout.addWidget(self._cell_gain0_win)
        self.zeromq_req_source_1 = zeromq.req_source(gr.sizeof_gr_complex, 1,
                                                     'tcp://localhost:2001',
                                                     100, False, -1)
        self.zeromq_req_source_0_0 = zeromq.req_source(gr.sizeof_gr_complex, 1,
                                                       'tcp://localhost:2201',
                                                       100, False, -1)
        self.zeromq_req_source_0 = zeromq.req_source(gr.sizeof_gr_complex, 1,
                                                     'tcp://localhost:2101',
                                                     100, False, -1)
        self.zeromq_rep_sink_1_0 = zeromq.rep_sink(gr.sizeof_gr_complex, 1,
                                                   'tcp://*:2200', 100, False,
                                                   -1)
        self.zeromq_rep_sink_1 = zeromq.rep_sink(gr.sizeof_gr_complex, 1,
                                                 'tcp://*:2100', 100, False,
                                                 -1)
        self.zeromq_rep_sink_0 = zeromq.rep_sink(gr.sizeof_gr_complex, 1,
                                                 'tcp://*:2000', 100, False,
                                                 -1)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_cc(
            cell_gain1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_cc(cell_gain0)
        self.blocks_add_xx_0 = blocks.add_vcc(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_add_xx_0, 0), (self.zeromq_rep_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_throttle_0, 0), (self.zeromq_rep_sink_1, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.zeromq_rep_sink_1_0, 0))
        self.connect((self.zeromq_req_source_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.zeromq_req_source_0_0, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.zeromq_req_source_1, 0),
                     (self.blocks_throttle_0, 0))

        self.obj = Worker(interval)
        self.thread = Qt.QThread()
        self.obj.cell_gain_update.connect(self.update_cell_gain)
        self.obj.moveToThread(self.thread)
        self.thread.started.connect(self.obj.update)
        self.thread.finished.connect(self.obj.stop)
        self.thread.start()