def __init__(self): gr.top_block.__init__(self, "TJ Groundstation No Gui with Control and IQ streaming") ################################################## # Variables ################################################## self.interp = interp = 4 self.audio_rate = audio_rate = 48000 self.tx_gain = tx_gain = 10 self.rx_downsamp_bw = rx_downsamp_bw = 10000 self.rf_tx_rate = rf_tx_rate = audio_rate*interp self.rf_rx_rate = rf_rx_rate = 192000 self.preamble_len = preamble_len = 300 self.groundstation_zmq_port_4 = groundstation_zmq_port_4 = "5504" self.groundstation_zmq_port_3 = groundstation_zmq_port_3 = "5503" self.groundstation_zmq_port_2 = groundstation_zmq_port_2 = "5502" self.groundstation_zmq_port_1 = groundstation_zmq_port_1 = "5501" self.groundstation_port_2 = groundstation_port_2 = "5557" self.groundstation_port_1 = groundstation_port_1 = "5555" self.groundstation_ip_addr = groundstation_ip_addr = "192.168.1.10" self.groundstation_controller_ip = groundstation_controller_ip = "192.268.1.3" self.gain = gain = 40 self.freq = freq = 144.39e6 self.baud_rate = baud_rate = 1200 self.audio_line_driver = audio_line_driver = .8 self.Decay = Decay = 0.8 self.Attack = Attack = 0.8 ################################################## # Blocks ################################################## self.zeromq_push_sink_0_0_0_0 = zeromq.push_sink(gr.sizeof_float, 1, "tcp://"+groundstation_ip_addr+":"+groundstation_zmq_port_4, 100, False, -1) self.zeromq_push_sink_0_0_0 = zeromq.push_sink(gr.sizeof_float, 1, "tcp://"+groundstation_ip_addr+":"+groundstation_zmq_port_3, 100, False, -1) self.zeromq_push_sink_0_0 = zeromq.push_sink(gr.sizeof_gr_complex, 1, "tcp://"+groundstation_ip_addr+":"+groundstation_zmq_port_2, 100, False, -1) self.zeromq_push_sink_0 = zeromq.push_sink(gr.sizeof_gr_complex, 1, "tcp://"+groundstation_ip_addr+":"+groundstation_zmq_port_1, 100, False, -1) self.uhd_usrp_source_0_1 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0_1.set_samp_rate(rf_rx_rate) self.uhd_usrp_source_0_1.set_center_freq(freq, 0) self.uhd_usrp_source_0_1.set_gain(gain, 0) self.uhd_usrp_source_0_1.set_antenna('RX2', 0) self.uhd_usrp_source_0_1.set_bandwidth(rf_rx_rate, 0) self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0.set_samp_rate(rf_tx_rate) self.uhd_usrp_sink_0.set_center_freq(freq, 0) self.uhd_usrp_sink_0.set_gain(tx_gain, 0) self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) self.uhd_usrp_sink_0.set_bandwidth(rf_tx_rate, 0) self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=4, decimation=1, taps=None, fractional_bw=None, ) self.low_pass_filter_0_0 = filter.fir_filter_ccf(4, firdes.low_pass( 1, rf_rx_rate, rx_downsamp_bw/2, 1000, firdes.WIN_HAMMING, 6.76)) self.detectMarkSpace_1_0_0 = detectMarkSpace( Frequency=2200, attack=Attack, decay=Decay, samp_rate=audio_rate, ) self.detectMarkSpace_0_0_0 = detectMarkSpace( Frequency=1200, attack=Attack, decay=Decay, samp_rate=audio_rate, ) self.bruninga_str_to_aprs_0 = bruninga.str_to_aprs('KN4DTQ', 'KN4DTQ', []) self.bruninga_ax25_fsk_mod_0 = bruninga.ax25_fsk_mod(audio_rate, preamble_len, 5, 2200, 1200, baud_rate) self.blocks_udp_sink_0_0 = blocks.udp_sink(gr.sizeof_char*1, groundstation_controller_ip, int(groundstation_port_2), 1472, True) self.blocks_sub_xx_0_0_0_0 = blocks.sub_ff(1) self.blocks_socket_pdu_0_0 = blocks.socket_pdu("UDP_SERVER", groundstation_ip_addr, groundstation_port_1, 10000, False) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((0.8, )) self.analog_nbfm_tx_0 = analog.nbfm_tx( audio_rate=audio_rate, quad_rate=audio_rate, tau=75e-6, max_dev=5e3, fh=-1.0, ) self.analog_nbfm_rx_0_0 = analog.nbfm_rx( audio_rate=audio_rate, quad_rate=audio_rate, tau=75e-6, max_dev=5e3, ) self.afsk_ax25decode_1_0 = afsk.ax25decode(audio_rate, 1) ################################################## # Connections ################################################## self.msg_connect((self.blocks_socket_pdu_0_0, 'pdus'), (self.bruninga_str_to_aprs_0, 'in')) self.msg_connect((self.bruninga_str_to_aprs_0, 'out'), (self.bruninga_ax25_fsk_mod_0, 'in')) self.connect((self.afsk_ax25decode_1_0, 0), (self.blocks_udp_sink_0_0, 0)) self.connect((self.analog_nbfm_rx_0_0, 0), (self.detectMarkSpace_0_0_0, 0)) self.connect((self.analog_nbfm_rx_0_0, 0), (self.detectMarkSpace_1_0_0, 0)) self.connect((self.analog_nbfm_rx_0_0, 0), (self.zeromq_push_sink_0_0_0_0, 0)) self.connect((self.analog_nbfm_tx_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.analog_nbfm_tx_0, 0), (self.zeromq_push_sink_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.analog_nbfm_tx_0, 0)) self.connect((self.blocks_sub_xx_0_0_0_0, 0), (self.afsk_ax25decode_1_0, 0)) self.connect((self.bruninga_ax25_fsk_mod_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.bruninga_ax25_fsk_mod_0, 0), (self.zeromq_push_sink_0_0_0, 0)) self.connect((self.detectMarkSpace_0_0_0, 0), (self.blocks_sub_xx_0_0_0_0, 0)) self.connect((self.detectMarkSpace_1_0_0, 0), (self.blocks_sub_xx_0_0_0_0, 1)) self.connect((self.low_pass_filter_0_0, 0), (self.analog_nbfm_rx_0_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.zeromq_push_sink_0_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.uhd_usrp_source_0_1, 0), (self.low_pass_filter_0_0, 0))
def __init__(self, pluto_uri='usb:1.5.5'): gr.top_block.__init__(self, "Aprs Full Duplex Pluto") ################################################## # Parameters ################################################## self.pluto_uri = pluto_uri ################################################## # Variables ################################################## self.audio_samp = audio_samp = 24000 self.source_samp = source_samp = 44100 self.samp_rate = samp_rate = audio_samp * 22 self.refresh_rate = refresh_rate = 10 self.cutoff_frequency = cutoff_frequency = 100e3 self.center_frequency = center_frequency = 435e6 self.Decay = Decay = 0.1 self.Attack = Attack = 0.8 ################################################## # Blocks ################################################## self.rational_resampler_xxx_0_0_0_0 = filter.rational_resampler_ccc( interpolation=samp_rate, decimation=source_samp, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=1, decimation=1, taps=None, fractional_bw=None, ) self.pluto_source_0 = iio.pluto_source(pluto_uri, int(center_frequency), samp_rate, 20000000, 0x8000, True, True, True, "manual", 64.0, '', True) self.pluto_sink_0 = iio.pluto_sink(pluto_uri, int(center_frequency), samp_rate, 20000000, 0x8000, False, 10.0, '', True) self.detectMarkSpace_1_0_0 = detectMarkSpace( decay=Decay, samp_rate=audio_samp, attack=Attack, Frequency=2200, ) self.detectMarkSpace_0_0_0 = detectMarkSpace( decay=Decay, samp_rate=audio_samp, attack=Attack, Frequency=1200, ) self.blocks_wavfile_source_0 = blocks.wavfile_source( '/home/pi/aprs_web_client/aprs_test_message.wav', True) self.blocks_sub_xx_0_0_0_0 = blocks.sub_ff(1) self.blocks_file_sink_0_0 = blocks.file_sink( gr.sizeof_char * 1, '/home/pi/aprs_web_client/full_duplex.log', True) self.blocks_file_sink_0_0.set_unbuffered(True) self.band_pass_filter_0_0_0 = filter.fir_filter_fff( 1, firdes.band_pass(1, audio_samp, 950, 2450, 100, firdes.WIN_HAMMING, 6.76)) self.analog_nbfm_tx_0 = analog.nbfm_tx( audio_rate=source_samp, quad_rate=source_samp, tau=75e-6, max_dev=5e3, fh=-1.0, ) self.analog_nbfm_rx_0 = analog.nbfm_rx( audio_rate=audio_samp, quad_rate=int(samp_rate), tau=75e-6, max_dev=5e3, ) self.afsk_ax25decode_1_0 = afsk.ax25decode(audio_samp, 5) ################################################## # Connections ################################################## self.connect((self.afsk_ax25decode_1_0, 0), (self.blocks_file_sink_0_0, 0)) self.connect((self.analog_nbfm_rx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.analog_nbfm_tx_0, 0), (self.rational_resampler_xxx_0_0_0_0, 0)) self.connect((self.band_pass_filter_0_0_0, 0), (self.detectMarkSpace_0_0_0, 0)) self.connect((self.band_pass_filter_0_0_0, 0), (self.detectMarkSpace_1_0_0, 0)) self.connect((self.blocks_sub_xx_0_0_0_0, 0), (self.afsk_ax25decode_1_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.analog_nbfm_tx_0, 0)) self.connect((self.detectMarkSpace_0_0_0, 0), (self.blocks_sub_xx_0_0_0_0, 0)) self.connect((self.detectMarkSpace_1_0_0, 0), (self.blocks_sub_xx_0_0_0_0, 1)) self.connect((self.pluto_source_0, 0), (self.analog_nbfm_rx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.band_pass_filter_0_0_0, 0)) self.connect((self.rational_resampler_xxx_0_0_0_0, 0), (self.pluto_sink_0, 0))
def __init__(self): gr.top_block.__init__(self, "TJ Groundstation GUI") Qt.QWidget.__init__(self) self.setWindowTitle("TJ Groundstation GUI") 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", "TJ_groundstation_GUI") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.interp = interp = 4 self.freq_chooser = freq_chooser = 144.39e6 self.audio_rate = audio_rate = 48000 self.tx_gain = tx_gain = 10 self.rx_downsamp_bw = rx_downsamp_bw = 10000 self.rf_tx_rate = rf_tx_rate = audio_rate*interp self.rf_rx_rate = rf_rx_rate = 192000 self.preamble_len = preamble_len = 300 self.groundstation_port_2 = groundstation_port_2 = "5557" self.groundstation_port_1 = groundstation_port_1 = "5555" self.groundstation_ip_addr = groundstation_ip_addr = "127.0.0.1" self.gain = gain = 40 self.freq = freq = freq_chooser self.baud_rate = baud_rate = 1200 self.audio_line_driver = audio_line_driver = 0.8 self.Decay = Decay = 0.8 self.Attack = Attack = 0.8 ################################################## # Blocks ################################################## self._tx_gain_range = Range(1, 89, 1, 10, 200) self._tx_gain_win = RangeWidget(self._tx_gain_range, self.set_tx_gain, 'tx gain', "counter_slider", float) self.top_grid_layout.addWidget(self._tx_gain_win, 0, 2, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 3): self.top_grid_layout.setColumnStretch(c, 1) self.tabs = Qt.QTabWidget() self.tabs_widget_0 = Qt.QWidget() self.tabs_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_widget_0) self.tabs_grid_layout_0 = Qt.QGridLayout() self.tabs_layout_0.addLayout(self.tabs_grid_layout_0) self.tabs.addTab(self.tabs_widget_0, 'Big Picture') self.tabs_widget_1 = Qt.QWidget() self.tabs_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_widget_1) self.tabs_grid_layout_1 = Qt.QGridLayout() self.tabs_layout_1.addLayout(self.tabs_grid_layout_1) self.tabs.addTab(self.tabs_widget_1, 'CUBESAT TX/RX') self.tabs_widget_2 = Qt.QWidget() self.tabs_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_widget_2) self.tabs_grid_layout_2 = Qt.QGridLayout() self.tabs_layout_2.addLayout(self.tabs_grid_layout_2) self.tabs.addTab(self.tabs_widget_2, 'GND STAT TX/RX') self.tabs_widget_3 = Qt.QWidget() self.tabs_layout_3 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_widget_3) self.tabs_grid_layout_3 = Qt.QGridLayout() self.tabs_layout_3.addLayout(self.tabs_grid_layout_3) self.tabs.addTab(self.tabs_widget_3, 'MOD/DEMOD') self.top_grid_layout.addWidget(self.tabs, 2, 0, 1, 1) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self._gain_range = Range(1, 89, 1, 40, 200) self._gain_win = RangeWidget(self._gain_range, self.set_gain, "rx gain", "counter_slider", float) self.top_grid_layout.addWidget(self._gain_win, 0, 1, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self._freq_range = Range(100e6, 6e9, 100e3, freq_chooser, 200) self._freq_win = RangeWidget(self._freq_range, self.set_freq, "freq", "counter_slider", float) self.top_grid_layout.addWidget(self._freq_win, 0, 0, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self._audio_line_driver_range = Range(0.01, 1, 0.01, 0.8, 200) self._audio_line_driver_win = RangeWidget(self._audio_line_driver_range, self.set_audio_line_driver, 'audio line driver', "counter_slider", float) self.top_grid_layout.addWidget(self._audio_line_driver_win, 1, 1, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self.uhd_usrp_source_0_1 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0_1.set_samp_rate(rf_rx_rate) self.uhd_usrp_source_0_1.set_center_freq(freq, 0) self.uhd_usrp_source_0_1.set_gain(gain, 0) self.uhd_usrp_source_0_1.set_antenna('RX2', 0) self.uhd_usrp_source_0_1.set_bandwidth(rf_rx_rate, 0) self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0.set_samp_rate(rf_tx_rate) self.uhd_usrp_sink_0.set_center_freq(freq, 0) self.uhd_usrp_sink_0.set_gain(tx_gain, 0) self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) self.uhd_usrp_sink_0.set_bandwidth(rf_tx_rate, 0) self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=4, decimation=1, taps=None, fractional_bw=None, ) self.qtgui_waterfall_sink_x_0_2 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype freq, #fc rf_rx_rate, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0_2.set_update_time(0.10) self.qtgui_waterfall_sink_x_0_2.enable_grid(False) self.qtgui_waterfall_sink_x_0_2.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0_2.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0_2.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0_2.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0_2.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0_2.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0_2.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0_2.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_0_2_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0_2.pyqwidget(), Qt.QWidget) self.tabs_grid_layout_0.addWidget(self._qtgui_waterfall_sink_x_0_2_win, 1, 0, 1, 1) for r in range(1, 2): self.tabs_grid_layout_0.setRowStretch(r, 1) for c in range(0, 1): self.tabs_grid_layout_0.setColumnStretch(c, 1) self.qtgui_waterfall_sink_x_0_1 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype freq, #fc rf_rx_rate, #bw "GND STAT DEMOD", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0_1.set_update_time(0.10) self.qtgui_waterfall_sink_x_0_1.enable_grid(False) self.qtgui_waterfall_sink_x_0_1.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0_1.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0_1.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0_1.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0_1.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0_1.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0_1.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0_1.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_0_1_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0_1.pyqwidget(), Qt.QWidget) self.tabs_grid_layout_0.addWidget(self._qtgui_waterfall_sink_x_0_1_win, 3, 0, 1, 1) for r in range(3, 4): self.tabs_grid_layout_0.setRowStretch(r, 1) for c in range(0, 1): self.tabs_grid_layout_0.setColumnStretch(c, 1) self.qtgui_time_sink_x_0_1 = qtgui.time_sink_f( 1024, #size audio_rate, #samp_rate "GND STAT MOD", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_1.set_update_time(0.10) self.qtgui_time_sink_x_0_1.set_y_axis(-1, 1) self.qtgui_time_sink_x_0_1.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0_1.enable_tags(-1, True) self.qtgui_time_sink_x_0_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0_1.enable_autoscale(False) self.qtgui_time_sink_x_0_1.enable_grid(False) self.qtgui_time_sink_x_0_1.enable_axis_labels(True) self.qtgui_time_sink_x_0_1.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0_1.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_1.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_1_win = sip.wrapinstance(self.qtgui_time_sink_x_0_1.pyqwidget(), Qt.QWidget) self.tabs_grid_layout_3.addWidget(self._qtgui_time_sink_x_0_1_win, 0, 0, 1, 1) for r in range(0, 1): self.tabs_grid_layout_3.setRowStretch(r, 1) for c in range(0, 1): self.tabs_grid_layout_3.setColumnStretch(c, 1) self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f( 1024, #size audio_rate, #samp_rate "GND STAT DEMOD", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0.set_update_time(0.10) self.qtgui_time_sink_x_0_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0_0.enable_tags(-1, True) self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0_0.enable_autoscale(False) self.qtgui_time_sink_x_0_0.enable_grid(False) self.qtgui_time_sink_x_0_0.enable_axis_labels(True) self.qtgui_time_sink_x_0_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget) self.tabs_grid_layout_3.addWidget(self._qtgui_time_sink_x_0_0_win, 1, 0, 1, 1) for r in range(1, 2): self.tabs_grid_layout_3.setRowStretch(r, 1) for c in range(0, 1): self.tabs_grid_layout_3.setColumnStretch(c, 1) self.qtgui_freq_sink_x_0_2 = qtgui.freq_sink_c( 4096, #size firdes.WIN_BLACKMAN_hARRIS, #wintype freq, #fc rf_rx_rate, #bw "GND STAT DEMOD", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0_2.set_update_time(0.10) self.qtgui_freq_sink_x_0_2.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0_2.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0_2.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0_2.enable_autoscale(False) self.qtgui_freq_sink_x_0_2.enable_grid(False) self.qtgui_freq_sink_x_0_2.set_fft_average(1.0) self.qtgui_freq_sink_x_0_2.enable_axis_labels(True) self.qtgui_freq_sink_x_0_2.enable_control_panel(True) if not True: self.qtgui_freq_sink_x_0_2.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0_2.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0_2.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0_2.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0_2.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0_2.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0_2.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_2_win = sip.wrapinstance(self.qtgui_freq_sink_x_0_2.pyqwidget(), Qt.QWidget) self.tabs_grid_layout_0.addWidget(self._qtgui_freq_sink_x_0_2_win, 2, 0, 1, 1) for r in range(2, 3): self.tabs_grid_layout_0.setRowStretch(r, 1) for c in range(0, 1): self.tabs_grid_layout_0.setColumnStretch(c, 1) self.qtgui_freq_sink_x_0_1_1 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype freq, #fc rf_tx_rate, #bw "GND STAT MOD", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0_1_1.set_update_time(0.10) self.qtgui_freq_sink_x_0_1_1.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0_1_1.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0_1_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0_1_1.enable_autoscale(False) self.qtgui_freq_sink_x_0_1_1.enable_grid(False) self.qtgui_freq_sink_x_0_1_1.set_fft_average(1.0) self.qtgui_freq_sink_x_0_1_1.enable_axis_labels(True) self.qtgui_freq_sink_x_0_1_1.enable_control_panel(True) if not True: self.qtgui_freq_sink_x_0_1_1.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0_1_1.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0_1_1.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0_1_1.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0_1_1.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0_1_1.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0_1_1.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_1_1_win = sip.wrapinstance(self.qtgui_freq_sink_x_0_1_1.pyqwidget(), Qt.QWidget) self.tabs_grid_layout_0.addWidget(self._qtgui_freq_sink_x_0_1_1_win, 0, 0, 1, 1) for r in range(0, 1): self.tabs_grid_layout_0.setRowStretch(r, 1) for c in range(0, 1): self.tabs_grid_layout_0.setColumnStretch(c, 1) self.low_pass_filter_0_0 = filter.fir_filter_ccf(4, firdes.low_pass( 1, rf_rx_rate, rx_downsamp_bw/2, 1000, firdes.WIN_HAMMING, 6.76)) self._freq_chooser_options = (144.39e6, 137.62e6, 137.9125e6, 137.1e6, 88.5e6, ) self._freq_chooser_labels = ('APRS (144.39MHz)', 'NOAA-15 (137.62MHz)', 'NOAA-18 (137.9125MHz)', 'NOAA-19 (137.1MHz)', 'FM (88.5MHz)', ) self._freq_chooser_group_box = Qt.QGroupBox('APRS/NOAA Satellite Frequencies') self._freq_chooser_box = Qt.QHBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._freq_chooser_button_group = variable_chooser_button_group() self._freq_chooser_group_box.setLayout(self._freq_chooser_box) for i, label in enumerate(self._freq_chooser_labels): radio_button = Qt.QRadioButton(label) self._freq_chooser_box.addWidget(radio_button) self._freq_chooser_button_group.addButton(radio_button, i) self._freq_chooser_callback = lambda i: Qt.QMetaObject.invokeMethod(self._freq_chooser_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._freq_chooser_options.index(i))) self._freq_chooser_callback(self.freq_chooser) self._freq_chooser_button_group.buttonClicked[int].connect( lambda i: self.set_freq_chooser(self._freq_chooser_options[i])) self.top_grid_layout.addWidget(self._freq_chooser_group_box, 1, 0, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self.detectMarkSpace_1_0_0 = detectMarkSpace( Frequency=2200, attack=Attack, decay=Decay, samp_rate=audio_rate, ) self.detectMarkSpace_0_0_0 = detectMarkSpace( Frequency=1200, attack=Attack, decay=Decay, samp_rate=audio_rate, ) self.bruninga_str_to_aprs_0 = bruninga.str_to_aprs('KN4DTQ', 'KN4DTQ', []) self.bruninga_ax25_fsk_mod_0 = bruninga.ax25_fsk_mod(audio_rate, preamble_len, 5, 2200, 1200, baud_rate) self.blocks_udp_sink_0_0 = blocks.udp_sink(gr.sizeof_char*1, groundstation_ip_addr, int(groundstation_port_2), 1472, True) self.blocks_sub_xx_0_0_0_0 = blocks.sub_ff(1) self.blocks_socket_pdu_0_0 = blocks.socket_pdu("UDP_SERVER", groundstation_ip_addr, groundstation_port_1, 10000, False) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((audio_line_driver, )) self.audio_sink_0 = audio.sink(audio_rate, 'hw:1,0', True) self.analog_nbfm_tx_0 = analog.nbfm_tx( audio_rate=audio_rate, quad_rate=audio_rate, tau=75e-6, max_dev=5e3, fh=-1.0, ) self.analog_nbfm_rx_0_0 = analog.nbfm_rx( audio_rate=audio_rate, quad_rate=audio_rate, tau=75e-6, max_dev=5e3, ) self.afsk_ax25decode_1_0 = afsk.ax25decode(audio_rate, 1) ################################################## # Connections ################################################## self.msg_connect((self.blocks_socket_pdu_0_0, 'pdus'), (self.bruninga_str_to_aprs_0, 'in')) self.msg_connect((self.bruninga_str_to_aprs_0, 'out'), (self.bruninga_ax25_fsk_mod_0, 'in')) self.connect((self.afsk_ax25decode_1_0, 0), (self.blocks_udp_sink_0_0, 0)) self.connect((self.analog_nbfm_rx_0_0, 0), (self.detectMarkSpace_0_0_0, 0)) self.connect((self.analog_nbfm_rx_0_0, 0), (self.detectMarkSpace_1_0_0, 0)) self.connect((self.analog_nbfm_rx_0_0, 0), (self.qtgui_time_sink_x_0_0, 0)) self.connect((self.analog_nbfm_tx_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.analog_nbfm_tx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.qtgui_time_sink_x_0_1, 0)) self.connect((self.blocks_sub_xx_0_0_0_0, 0), (self.afsk_ax25decode_1_0, 0)) self.connect((self.bruninga_ax25_fsk_mod_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.detectMarkSpace_0_0_0, 0), (self.blocks_sub_xx_0_0_0_0, 0)) self.connect((self.detectMarkSpace_1_0_0, 0), (self.blocks_sub_xx_0_0_0_0, 1)) self.connect((self.low_pass_filter_0_0, 0), (self.analog_nbfm_rx_0_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.qtgui_freq_sink_x_0_2, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.qtgui_waterfall_sink_x_0_1, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.qtgui_freq_sink_x_0_1_1, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.qtgui_waterfall_sink_x_0_2, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.uhd_usrp_source_0_1, 0), (self.low_pass_filter_0_0, 0))
def __init__(self): gr.top_block.__init__(self, "Fm Receiver") Qt.QWidget.__init__(self) self.setWindowTitle("Fm Receiver") 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", "fm_receiver") 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.rf_rate = rf_rate = 2400000 self.rf_freq = rf_freq = 145000000 self.freq = freq = 144791400 self.channel_filter = channel_filter = firdes.low_pass(1.0, rf_rate, 9000, 1000, firdes.WIN_HAMMING, 6.76) self.channel_decim = channel_decim = 20 self.audio_rate = audio_rate = 48000 self.Decay = Decay = 0.1 self.Attack = Attack = 0.8 ################################################## # Blocks ################################################## self.tab = Qt.QTabWidget() self.tab_widget_0 = Qt.QWidget() self.tab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_0) self.tab_grid_layout_0 = Qt.QGridLayout() self.tab_layout_0.addLayout(self.tab_grid_layout_0) self.tab.addTab(self.tab_widget_0, 'RF') self.tab_widget_1 = Qt.QWidget() self.tab_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_1) self.tab_grid_layout_1 = Qt.QGridLayout() self.tab_layout_1.addLayout(self.tab_grid_layout_1) self.tab.addTab(self.tab_widget_1, 'Channel') self.top_layout.addWidget(self.tab) self._freq_range = Range(rf_freq - rf_rate/2, rf_freq + rf_rate/2, 1000, 144791400, 1000) self._freq_win = RangeWidget(self._freq_range, self.set_freq, "freq", "counter_slider", float) self.top_layout.addWidget(self._freq_win) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype rf_freq, #fc rf_rate, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.10) self.qtgui_waterfall_sink_x_0.enable_grid(False) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.tab_grid_layout_0.addWidget(self._qtgui_waterfall_sink_x_0_win, 1,0,1,1) self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype freq, #fc rf_rate/channel_decim, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0_0.set_update_time(0.10) self.qtgui_freq_sink_x_0_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0_0.enable_autoscale(False) self.qtgui_freq_sink_x_0_0.enable_grid(False) self.qtgui_freq_sink_x_0_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0_0.pyqwidget(), Qt.QWidget) self.tab_layout_1.addWidget(self._qtgui_freq_sink_x_0_0_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype rf_freq, #fc rf_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.tab_grid_layout_0.addWidget(self._qtgui_freq_sink_x_0_win, 0,0,1,1) self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_ccf( 48000.0/rf_rate*channel_decim, taps=None, flt_size=32) self.pfb_arb_resampler_xxx_0.declare_sample_delay(0) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(channel_decim, (channel_filter), freq - rf_freq, int(rf_rate)) self.detectMarkSpace_1_0 = detectMarkSpace( decay=Decay, samp_rate=48000, attack=Attack, Frequency=2200, ) self.detectMarkSpace_0_0 = detectMarkSpace( decay=Decay, samp_rate=48000, attack=Attack, Frequency=1200, ) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, rf_rate,True) self.blocks_sub_xx_0_0_0 = blocks.sub_ff(1) self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, '/home/basti/src/gr-workshop/iq-145M-2M4.cf32', True) self.blocks_file_sink_0_0 = blocks.file_sink(gr.sizeof_char*1, '/tmp/aprs.txt', False) self.blocks_file_sink_0_0.set_unbuffered(True) self.analog_nbfm_rx_0 = analog.nbfm_rx( audio_rate=48000, quad_rate=48000, tau=75e-6, max_dev=5e3, ) self.afsk_ax25decode_1 = afsk.ax25decode(48000, 5) ################################################## # Connections ################################################## self.connect((self.afsk_ax25decode_1, 0), (self.blocks_file_sink_0_0, 0)) self.connect((self.analog_nbfm_rx_0, 0), (self.detectMarkSpace_0_0, 0)) self.connect((self.analog_nbfm_rx_0, 0), (self.detectMarkSpace_1_0, 0)) self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_sub_xx_0_0_0, 0), (self.afsk_ax25decode_1, 0)) self.connect((self.blocks_throttle_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.detectMarkSpace_0_0, 0), (self.blocks_sub_xx_0_0_0, 0)) self.connect((self.detectMarkSpace_1_0, 0), (self.blocks_sub_xx_0_0_0, 1)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.pfb_arb_resampler_xxx_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.qtgui_freq_sink_x_0_0, 0)) self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.analog_nbfm_rx_0, 0))
def __init__(self): gr.top_block.__init__(self, "TJ Cubesat No Gui") ################################################## # Variables ################################################## self.interp = interp = 4 self.audio_rate = audio_rate = 48000 self.tx_gain = tx_gain = 10 self.rx_downsamp_bw = rx_downsamp_bw = 10000 self.rf_tx_rate = rf_tx_rate = audio_rate * interp self.rf_rx_rate = rf_rx_rate = 192000 self.preamble_len = preamble_len = 300 self.gain = gain = 40 self.freq = freq = 144.39e6 self.cubesat_port_2 = cubesat_port_2 = "5558" self.cubesat_port_1 = cubesat_port_1 = "5556" self.cubesat_local_ip_addr = cubesat_local_ip_addr = "127.0.0.1" self.baud_rate = baud_rate = 1200 self.audio_line_driver = audio_line_driver = .8 self.Decay = Decay = 0.8 self.Attack = Attack = 0.8 ################################################## # Blocks ################################################## self.xmlrpc_server_0 = SimpleXMLRPCServer.SimpleXMLRPCServer( ('', 1234), allow_none=True) self.xmlrpc_server_0.register_instance(self) self.xmlrpc_server_0_thread = threading.Thread( target=self.xmlrpc_server_0.serve_forever) self.xmlrpc_server_0_thread.daemon = True self.xmlrpc_server_0_thread.start() self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(rf_rx_rate) self.uhd_usrp_source_0.set_center_freq(freq, 0) self.uhd_usrp_source_0.set_gain(gain, 0) self.uhd_usrp_source_0.set_antenna('RX2', 0) self.uhd_usrp_source_0.set_bandwidth(rf_rx_rate, 0) self.uhd_usrp_sink_0_1 = uhd.usrp_sink( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0_1.set_samp_rate(rf_tx_rate) self.uhd_usrp_sink_0_1.set_center_freq(freq, 0) self.uhd_usrp_sink_0_1.set_gain(tx_gain, 0) self.uhd_usrp_sink_0_1.set_antenna('TX/RX', 0) self.uhd_usrp_sink_0_1.set_bandwidth(rf_tx_rate, 0) self.rational_resampler_xxx_0_0_0 = filter.rational_resampler_ccc( interpolation=4, decimation=1, taps=None, fractional_bw=None, ) self.low_pass_filter_0 = filter.fir_filter_ccf( 4, firdes.low_pass(1, rf_rx_rate, rx_downsamp_bw / 2, 1000, firdes.WIN_HAMMING, 6.76)) self.detectMarkSpace_1_0 = detectMarkSpace( Frequency=2200, attack=Attack, decay=Decay, samp_rate=audio_rate, ) self.detectMarkSpace_0_0 = detectMarkSpace( Frequency=1200, attack=Attack, decay=Decay, samp_rate=audio_rate, ) self.bruninga_str_to_aprs_0_1 = bruninga.str_to_aprs( 'KN4DTQ', 'KN4DTQ', []) self.bruninga_ax25_fsk_mod_0_0 = bruninga.ax25_fsk_mod( audio_rate, preamble_len, 5, 2200, 1200, baud_rate) self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_char * 1, cubesat_local_ip_addr, int(cubesat_port_1), 1472, True) self.blocks_sub_xx_0_0_0 = blocks.sub_ff(1) self.blocks_socket_pdu_0_0_0 = blocks.socket_pdu( "UDP_SERVER", cubesat_local_ip_addr, cubesat_port_2, 10000, False) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff( (audio_line_driver, )) self.analog_nbfm_tx_0_0 = analog.nbfm_tx( audio_rate=audio_rate, quad_rate=audio_rate, tau=75e-6, max_dev=5e3, fh=-1.0, ) self.analog_nbfm_rx_0 = analog.nbfm_rx( audio_rate=audio_rate, quad_rate=audio_rate, tau=75e-6, max_dev=5e3, ) self.afsk_ax25decode_1 = afsk.ax25decode(audio_rate, 1) ################################################## # Connections ################################################## self.msg_connect((self.blocks_socket_pdu_0_0_0, 'pdus'), (self.bruninga_str_to_aprs_0_1, 'in')) self.msg_connect((self.bruninga_str_to_aprs_0_1, 'out'), (self.bruninga_ax25_fsk_mod_0_0, 'in')) self.connect((self.afsk_ax25decode_1, 0), (self.blocks_udp_sink_0, 0)) self.connect((self.analog_nbfm_rx_0, 0), (self.detectMarkSpace_0_0, 0)) self.connect((self.analog_nbfm_rx_0, 0), (self.detectMarkSpace_1_0, 0)) self.connect((self.analog_nbfm_tx_0_0, 0), (self.rational_resampler_xxx_0_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.analog_nbfm_tx_0_0, 0)) self.connect((self.blocks_sub_xx_0_0_0, 0), (self.afsk_ax25decode_1, 0)) self.connect((self.bruninga_ax25_fsk_mod_0_0, 0), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.detectMarkSpace_0_0, 0), (self.blocks_sub_xx_0_0_0, 0)) self.connect((self.detectMarkSpace_1_0, 0), (self.blocks_sub_xx_0_0_0, 1)) self.connect((self.low_pass_filter_0, 0), (self.analog_nbfm_rx_0, 0)) self.connect((self.rational_resampler_xxx_0_0_0, 0), (self.uhd_usrp_sink_0_1, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.low_pass_filter_0, 0))
def __init__(self): gr.top_block.__init__(self, "Aprs Receive") ################################################## # Variables ################################################## self.audio_samp = audio_samp = 48000 self.samp_rate = samp_rate = audio_samp*20 self.cutoff_frequency = cutoff_frequency = 100e3 self.center_frequency = center_frequency = 145e6 self.Decay = Decay = 0.1 self.Attack = Attack = 0.8 ################################################## # Blocks ################################################## self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + '' ) self.rtlsdr_source_0.set_sample_rate(samp_rate) self.rtlsdr_source_0.set_center_freq(center_frequency, 0) self.rtlsdr_source_0.set_freq_corr(0, 0) self.rtlsdr_source_0.set_dc_offset_mode(2, 0) self.rtlsdr_source_0.set_iq_balance_mode(2, 0) self.rtlsdr_source_0.set_gain_mode(True, 0) self.rtlsdr_source_0.set_gain(0, 0) self.rtlsdr_source_0.set_if_gain(0, 0) self.rtlsdr_source_0.set_bb_gain(0, 0) self.rtlsdr_source_0.set_antenna('', 0) self.rtlsdr_source_0.set_bandwidth(2e6, 0) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=1, decimation=1, taps=None, fractional_bw=None, ) self.detectMarkSpace_1_0_0 = detectMarkSpace( decay=Decay, samp_rate=audio_samp, attack=Attack, Frequency=2200, ) self.detectMarkSpace_0_0_0 = detectMarkSpace( decay=Decay, samp_rate=audio_samp, attack=Attack, Frequency=1200, ) self.blocks_sub_xx_0_0_0_0 = blocks.sub_ff(1) self.blocks_file_sink_0_0 = blocks.file_sink(gr.sizeof_char*1, 'aprs_web_client/received_packets.log', True) self.blocks_file_sink_0_0.set_unbuffered(True) self.band_pass_filter_0_0_0 = filter.fir_filter_fff(1, firdes.band_pass( 1, audio_samp, 950, 2450, 100, firdes.WIN_HAMMING, 6.76)) self.analog_nbfm_rx_0 = analog.nbfm_rx( audio_rate=audio_samp, quad_rate=int(samp_rate), tau=75e-6, max_dev=5e3, ) self.afsk_ax25decode_1_0 = afsk.ax25decode(audio_samp, 1) ################################################## # Connections ################################################## self.connect((self.afsk_ax25decode_1_0, 0), (self.blocks_file_sink_0_0, 0)) self.connect((self.analog_nbfm_rx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.band_pass_filter_0_0_0, 0), (self.detectMarkSpace_0_0_0, 0)) self.connect((self.band_pass_filter_0_0_0, 0), (self.detectMarkSpace_1_0_0, 0)) self.connect((self.blocks_sub_xx_0_0_0_0, 0), (self.afsk_ax25decode_1_0, 0)) self.connect((self.detectMarkSpace_0_0_0, 0), (self.blocks_sub_xx_0_0_0_0, 0)) self.connect((self.detectMarkSpace_1_0_0, 0), (self.blocks_sub_xx_0_0_0_0, 1)) self.connect((self.rational_resampler_xxx_0, 0), (self.band_pass_filter_0_0_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.analog_nbfm_rx_0, 0))